diff --git a/CHANGELOG.md b/CHANGELOG.md index 05d6f927..7402e69e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) ## [Unreleased] +## [1.1.2] - 2020-06-13 +### Added +* Add "alias" input to deploy with alias [#178](https://github.com/nwtgck/actions-netlify/pull/178) by [@rajington](https://github.com/rajington) + ## [1.1.1] - 2020-05-30 ### Added * Add "netlify-config-path" input to specify path to `netlify.toml` @@ -103,7 +107,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) * Deploy to Netlify * Comment on GitHub PR -[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.1.1...HEAD +[Unreleased]: https://github.com/nwtgck/actions-netlify/compare/v1.1.2...HEAD +[1.1.2]: https://github.com/nwtgck/actions-netlify/compare/v1.1.1...v1.1.2 [1.1.1]: https://github.com/nwtgck/actions-netlify/compare/v1.1.0...v1.1.1 [1.1.0]: https://github.com/nwtgck/actions-netlify/compare/v1.0.13...v1.1.0 [1.0.13]: https://github.com/nwtgck/actions-netlify/compare/v1.0.12...v1.0.13 diff --git a/README.md b/README.md index 01efffbd..d03b6f88 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ jobs: production-branch: master github-token: ${{ secrets.GITHUB_TOKEN }} deploy-message: "Deploy from GitHub Actions" - enable-pull-request-comment: true + enable-pull-request-comment: false enable-commit-comment: true overwrites-pull-request-comment: true env: @@ -58,6 +58,9 @@ jobs: - `enable-commit-comment: true` Comment on GitHub commit (default: true) - `overwrites-pull-request-comment: true` Overwrites comment on pull request (default: true) - `netlify-config-path: ./netlify.toml` Path to `netlify.toml` (default: undefined) +- `alias` Specifies the prefix for the deployment URL (default: Netlify build ID) + - `alias: ${{ github.head_ref }}` replicates the [branch deploy prefix](https://docs.netlify.com/site-deploys/overview/#definitions) + - `alias: deploy-preview-${{ github.event.number }}` replicates the [deploy preview prefix](https://docs.netlify.com/site-deploys/overview/#definitions) ### Outputs - `deploy-url` A deployment URL generated by Netlify @@ -66,7 +69,5 @@ jobs: ```bash npm ci -# NOTE: ./dist/typescript is generated automatically and causes type errors. (see: https://github.com/nwtgck/actions-netlify/issues/28) -rm -r dist npm run all ``` diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 6ba2b688..ac3ac635 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -137,6 +137,15 @@ describe('defaultInputs', () => { }) }) }) + + describe('alias', () => { + test('it should be a string when specified', () => { + withInput('alias', 'foo', () => { + const alias: string | undefined = defaultInputs.alias() + expect(alias).toBe('foo') + }) + }) + }) }) // Old tests below diff --git a/action.yml b/action.yml index ef6a85c1..283a88fe 100644 --- a/action.yml +++ b/action.yml @@ -26,6 +26,9 @@ inputs: netlify-config-path: description: Path to netlify.toml required: false + alias: + description: Specifies the prefix for the deployment URL + required: false outputs: deploy-url: description: Deploy URL diff --git a/dist/index.js b/dist/index.js index d79be448..ad7ed9af 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1250,7 +1250,7 @@ var util = __webpack_require__(114); var binarySearch = __webpack_require__(762); var ArraySet = __webpack_require__(838).ArraySet; var base64VLQ = __webpack_require__(206); -var quickSort = __webpack_require__(829).quickSort; +var quickSort = __webpack_require__(638).quickSort; function SourceMapConsumer(aSourceMap, aSourceMapURL) { var sourceMap = aSourceMap; @@ -4039,46 +4039,473 @@ module.exports = { /***/ }), -/* 32 */ +/* 32 */, +/* 33 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const SemVer = __webpack_require__(369) -const patch = (a, loose) => new SemVer(a, loose).patch -module.exports = patch +// hoisted class for cyclic dependency +class Range { + constructor (range, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (range instanceof Range) { + if ( + range.loose === !!options.loose && + range.includePrerelease === !!options.includePrerelease + ) { + return range + } else { + return new Range(range.raw, options) + } + } -/***/ }), -/* 33 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + if (range instanceof Comparator) { + // just put it in the set and return + this.raw = range.value + this.set = [[range]] + this.format() + return this + } -// Copyright (c) 2012 Mathieu Turcotte -// Licensed under the MIT license. + this.options = options + this.loose = !!options.loose + this.includePrerelease = !!options.includePrerelease -var util = __webpack_require__(669); + // First, split based on boolean or || + this.raw = range + this.set = range + .split(/\s*\|\|\s*/) + // map the range to a 2d array of comparators + .map(range => this.parseRange(range.trim())) + // throw out any comparator lists that are empty + // this generally means that it was not a valid range, which is allowed + // in loose mode, but will still throw if the WHOLE range is invalid. + .filter(c => c.length) -var BackoffStrategy = __webpack_require__(105); + if (!this.set.length) { + throw new TypeError(`Invalid SemVer Range: ${range}`) + } -// Fibonacci backoff strategy. -function FibonacciBackoffStrategy(options) { - BackoffStrategy.call(this, options); - this.backoffDelay_ = 0; - this.nextBackoffDelay_ = this.getInitialDelay(); + this.format() + } + + format () { + this.range = this.set + .map((comps) => { + return comps.join(' ').trim() + }) + .join('||') + .trim() + return this.range + } + + toString () { + return this.range + } + + parseRange (range) { + const loose = this.options.loose + range = range.trim() + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] + range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) + debug('hyphen replace', range) + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) + debug('comparator trim', range, re[t.COMPARATORTRIM]) + + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[t.TILDETRIM], tildeTrimReplace) + + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[t.CARETTRIM], caretTrimReplace) + + // normalize spaces + range = range.split(/\s+/).join(' ') + + // At this point, the range is completely trimmed and + // ready to be split into comparators. + + const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + return range + .split(' ') + .map(comp => parseComparator(comp, this.options)) + .join(' ') + .split(/\s+/) + .map(comp => replaceGTE0(comp, this.options)) + // in loose mode, throw out any that are not valid comparators + .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) + .map(comp => new Comparator(comp, this.options)) + } + + intersects (range, options) { + if (!(range instanceof Range)) { + throw new TypeError('a Range is required') + } + + return this.set.some((thisComparators) => { + return ( + isSatisfiable(thisComparators, options) && + range.set.some((rangeComparators) => { + return ( + isSatisfiable(rangeComparators, options) && + thisComparators.every((thisComparator) => { + return rangeComparators.every((rangeComparator) => { + return thisComparator.intersects(rangeComparator, options) + }) + }) + ) + }) + ) + }) + } + + // if ANY of the sets match ALL of its comparators, then pass + test (version) { + if (!version) { + return false + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + for (let i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version, this.options)) { + return true + } + } + return false + } } -util.inherits(FibonacciBackoffStrategy, BackoffStrategy); +module.exports = Range -FibonacciBackoffStrategy.prototype.next_ = function() { - var backoffDelay = Math.min(this.nextBackoffDelay_, this.getMaxDelay()); - this.nextBackoffDelay_ += this.backoffDelay_; - this.backoffDelay_ = backoffDelay; - return backoffDelay; -}; +const Comparator = __webpack_require__(731) +const debug = __webpack_require__(547) +const SemVer = __webpack_require__(734) +const { + re, + t, + comparatorTrimReplace, + tildeTrimReplace, + caretTrimReplace +} = __webpack_require__(408) -FibonacciBackoffStrategy.prototype.reset_ = function() { - this.nextBackoffDelay_ = this.getInitialDelay(); - this.backoffDelay_ = 0; -}; +// take a set of comparators and determine whether there +// exists a version which can satisfy it +const isSatisfiable = (comparators, options) => { + let result = true + const remainingComparators = comparators.slice() + let testComparator = remainingComparators.pop() -module.exports = FibonacciBackoffStrategy; + while (result && remainingComparators.length) { + result = remainingComparators.every((otherComparator) => { + return testComparator.intersects(otherComparator, options) + }) + + testComparator = remainingComparators.pop() + } + + return result +} + +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +const parseComparator = (comp, options) => { + debug('comp', comp, options) + comp = replaceCarets(comp, options) + debug('caret', comp) + comp = replaceTildes(comp, options) + debug('tildes', comp) + comp = replaceXRanges(comp, options) + debug('xrange', comp) + comp = replaceStars(comp, options) + debug('stars', comp) + return comp +} + +const isX = id => !id || id.toLowerCase() === 'x' || id === '*' + +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 +const replaceTildes = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceTilde(comp, options) + }).join(' ') + +const replaceTilde = (comp, options) => { + const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] + return comp.replace(r, (_, M, m, p, pr) => { + debug('tilde', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0 <${+M + 1}.0.0-0` + } else if (isX(p)) { + // ~1.2 == >=1.2.0 <1.3.0-0 + ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` + } else if (pr) { + debug('replaceTilde pr', pr) + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } else { + // ~1.2.3 == >=1.2.3 <1.3.0-0 + ret = `>=${M}.${m}.${p + } <${M}.${+m + 1}.0-0` + } + + debug('tilde return', ret) + return ret + }) +} + +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 +// ^1.2.3 --> >=1.2.3 <2.0.0-0 +// ^1.2.0 --> >=1.2.0 <2.0.0-0 +const replaceCarets = (comp, options) => + comp.trim().split(/\s+/).map((comp) => { + return replaceCaret(comp, options) + }).join(' ') + +const replaceCaret = (comp, options) => { + debug('caret', comp, options) + const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] + const z = options.includePrerelease ? '-0' : '' + return comp.replace(r, (_, M, m, p, pr) => { + debug('caret', comp, _, M, m, p, pr) + let ret + + if (isX(M)) { + ret = '' + } else if (isX(m)) { + ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` + } else if (isX(p)) { + if (M === '0') { + ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` + } else { + ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` + } + } else if (pr) { + debug('replaceCaret pr', pr) + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p}-${pr + } <${+M + 1}.0.0-0` + } + } else { + debug('no pr') + if (M === '0') { + if (m === '0') { + ret = `>=${M}.${m}.${p + }${z} <${M}.${m}.${+p + 1}-0` + } else { + ret = `>=${M}.${m}.${p + }${z} <${M}.${+m + 1}.0-0` + } + } else { + ret = `>=${M}.${m}.${p + } <${+M + 1}.0.0-0` + } + } + + debug('caret return', ret) + return ret + }) +} + +const replaceXRanges = (comp, options) => { + debug('replaceXRanges', comp, options) + return comp.split(/\s+/).map((comp) => { + return replaceXRange(comp, options) + }).join(' ') +} + +const replaceXRange = (comp, options) => { + comp = comp.trim() + const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] + return comp.replace(r, (ret, gtlt, M, m, p, pr) => { + debug('xRange', comp, ret, gtlt, M, m, p, pr) + const xM = isX(M) + const xm = xM || isX(m) + const xp = xm || isX(p) + const anyX = xp + + if (gtlt === '=' && anyX) { + gtlt = '' + } + + // if we're including prereleases in the match, then we need + // to fix this to -0, the lowest possible prerelease value + pr = options.includePrerelease ? '-0' : '' + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0-0' + } else { + // nothing is forbidden + ret = '*' + } + } else if (gtlt && anyX) { + // we know patch is an x, because we have any x at all. + // replace X with 0 + if (xm) { + m = 0 + } + p = 0 + + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + gtlt = '>=' + if (xm) { + M = +M + 1 + m = 0 + p = 0 + } else { + m = +m + 1 + p = 0 + } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<' + if (xm) { + M = +M + 1 + } else { + m = +m + 1 + } + } + + if (gtlt === '<') + pr = '-0' + + ret = `${gtlt + M}.${m}.${p}${pr}` + } else if (xm) { + ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` + } else if (xp) { + ret = `>=${M}.${m}.0${pr + } <${M}.${+m + 1}.0-0` + } + + debug('xRange return', ret) + + return ret + }) +} + +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +const replaceStars = (comp, options) => { + debug('replaceStars', comp, options) + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[t.STAR], '') +} + +const replaceGTE0 = (comp, options) => { + debug('replaceGTE0', comp, options) + return comp.trim() + .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +} + +// This function is passed to string.replace(re[t.HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 +const hyphenReplace = incPr => ($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) => { + if (isX(fM)) { + from = '' + } else if (isX(fm)) { + from = `>=${fM}.0.0${incPr ? '-0' : ''}` + } else if (isX(fp)) { + from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` + } else if (fpr) { + from = `>=${from}` + } else { + from = `>=${from}${incPr ? '-0' : ''}` + } + + if (isX(tM)) { + to = '' + } else if (isX(tm)) { + to = `<${+tM + 1}.0.0-0` + } else if (isX(tp)) { + to = `<${tM}.${+tm + 1}.0-0` + } else if (tpr) { + to = `<=${tM}.${tm}.${tp}-${tpr}` + } else if (incPr) { + to = `<${tM}.${tm}.${+tp + 1}-0` + } else { + to = `<=${to}` + } + + return (`${from} ${to}`).trim() +} + +const testSet = (set, version, options) => { + for (let i = 0; i < set.length; i++) { + if (!set[i].test(version)) { + return false + } + } + + if (version.prerelease.length && !options.includePrerelease) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (let i = 0; i < set.length; i++) { + debug(set[i].semver) + if (set[i].semver === Comparator.ANY) { + continue + } + + if (set[i].semver.prerelease.length > 0) { + const allowed = set[i].semver + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) { + return true + } + } + } + + // Version has a -pre, but it's not one of the ones we like. + return false + } + + return true +} /***/ }), @@ -4263,7 +4690,15 @@ module.exports = opts => { /***/ }), /* 40 */, -/* 41 */, +/* 41 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const compare = __webpack_require__(386) +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq + + +/***/ }), /* 42 */, /* 43 */, /* 44 */, @@ -5521,7 +5956,35 @@ function factory(plugins) { /***/ }), -/* 48 */, +/* 48 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const parse = __webpack_require__(584) +const eq = __webpack_require__(41) + +const diff = (version1, version2) => { + if (eq(version1, version2)) { + return null + } else { + const v1 = parse(version1) + const v2 = parse(version2) + const hasPre = v1.prerelease.length || v2.prerelease.length + const prefix = hasPre ? 'pre' : '' + const defaultResult = hasPre ? 'prerelease' : '' + for (const key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } +} +module.exports = diff + + +/***/ }), /* 49 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -5793,7 +6256,7 @@ exports.default = void 0; var _path = _interopRequireDefault(__webpack_require__(622)); -var _cssSyntaxError = _interopRequireDefault(__webpack_require__(233)); +var _cssSyntaxError = _interopRequireDefault(__webpack_require__(830)); var _previousMap = _interopRequireDefault(__webpack_require__(560)); @@ -5824,7 +6287,7 @@ function () { opts = {}; } - if (css === null || typeof css === 'object' && !css.toString) { + if (css === null || typeof css === 'undefined' || typeof css === 'object' && !css.toString) { throw new Error("PostCSS received " + css + " instead of CSS string"); } /** @@ -6001,7 +6464,7 @@ var _default = Input; exports.default = _default; module.exports = exports.default; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImlucHV0LmVzNiJdLCJuYW1lcyI6WyJzZXF1ZW5jZSIsIklucHV0IiwiY3NzIiwib3B0cyIsInRvU3RyaW5nIiwiRXJyb3IiLCJoYXNCT00iLCJzbGljZSIsImZyb20iLCJ0ZXN0IiwicGF0aCIsImlzQWJzb2x1dGUiLCJmaWxlIiwicmVzb2x2ZSIsIm1hcCIsIlByZXZpb3VzTWFwIiwidGV4dCIsImNvbnN1bWVyIiwibWFwUmVzb2x2ZSIsImlkIiwiZXJyb3IiLCJtZXNzYWdlIiwibGluZSIsImNvbHVtbiIsInJlc3VsdCIsIm9yaWdpbiIsIkNzc1N5bnRheEVycm9yIiwic291cmNlIiwicGx1Z2luIiwiaW5wdXQiLCJvcmlnaW5hbFBvc2l0aW9uRm9yIiwic291cmNlQ29udGVudEZvciIsInNvdXJjZVJvb3QiXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUE7O0FBRUE7O0FBQ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vbWAgb3B0aW9uLCBvciB7QGxpbmsgSW5wdXQjaWR9IGlmIHRoZXkgZGlkIG5vdC5cbiAgICpcbiAgICogQHR5cGUge3N0cmluZ31cbiAgICpcbiAgICogQGV4YW1wbGVcbiAgICogY29uc3Qgcm9vdCA9IHBvc3Rjc3MucGFyc2UoY3NzLCB7IGZyb206ICdhLmNzcycgfSlcbiAgICogcm9vdC5zb3VyY2UuaW5wdXQuZnJvbSAvLz0+IFwiL2hvbWUvYWkvYS5jc3NcIlxuICAgKlxuICAgKiBjb25zdCByb290ID0gcG9zdGNzcy5wYXJzZShjc3MpXG4gICAqIHJvb3Quc291cmNlLmlucHV0LmZyb20gLy89PiBcIjxpbnB1dCBjc3MgMT5cIlxuICAgKi9cbiAgZ2V0IGZyb20gKCkge1xuICAgIHJldHVybiB0aGlzLmZpbGUgfHwgdGhpcy5pZFxuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IElucHV0XG5cbi8qKlxuICogQHR5cGVkZWYgIHtvYmplY3R9IGZpbGVQb3NpdGlvblxuICogQHByb3BlcnR5IHtzdHJpbmd9IGZpbGUgICBQYXRoIHRvIGZpbGUuXG4gKiBAcHJvcGVydHkge251bWJlcn0gbGluZSAgIFNvdXJjZSBsaW5lIGluIGZpbGUuXG4gKiBAcHJvcGVydHkge251bWJlcn0gY29sdW1uIFNvdXJjZSBjb2x1bW4gaW4gZmlsZS5cbiAqL1xuIl0sImZpbGUiOiJpbnB1dC5qcyJ9 +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImlucHV0LmVzNiJdLCJuYW1lcyI6WyJzZXF1ZW5jZSIsIklucHV0IiwiY3NzIiwib3B0cyIsInRvU3RyaW5nIiwiRXJyb3IiLCJoYXNCT00iLCJzbGljZSIsImZyb20iLCJ0ZXN0IiwicGF0aCIsImlzQWJzb2x1dGUiLCJmaWxlIiwicmVzb2x2ZSIsIm1hcCIsIlByZXZpb3VzTWFwIiwid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KiBAcHJvcGVydHkge251bWJlcn0gY29sdW1uIFNvdXJjZSBjb2x1bW4gaW4gZmlsZS5cbiAqL1xuIl0sImZpbGUiOiJpbnB1dC5qcyJ9 /***/ }), @@ -6557,110 +7020,7 @@ module.exports = { /* 59 */, /* 60 */, /* 61 */, -/* 62 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -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)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = __importStar(__webpack_require__(752)); -/** - * By default, diagnostics from the TypeScript compiler contain all errors - regardless of whether - * they are related to generic ECMAScript standards, or TypeScript-specific constructs. - * - * Therefore, we filter out all diagnostics, except for the ones we explicitly want to consider when - * the user opts in to throwing errors on semantic issues. - */ -function getFirstSemanticOrSyntacticError(program, ast) { - try { - const supportedSyntacticDiagnostics = whitelistSupportedDiagnostics(program.getSyntacticDiagnostics(ast)); - if (supportedSyntacticDiagnostics.length) { - return convertDiagnosticToSemanticOrSyntacticError(supportedSyntacticDiagnostics[0]); - } - const supportedSemanticDiagnostics = whitelistSupportedDiagnostics(program.getSemanticDiagnostics(ast)); - if (supportedSemanticDiagnostics.length) { - return convertDiagnosticToSemanticOrSyntacticError(supportedSemanticDiagnostics[0]); - } - return undefined; - } - catch (e) { - /** - * TypeScript compiler has certain Debug.fail() statements in, which will cause the diagnostics - * retrieval above to throw. - * - * E.g. from ast-alignment-tests - * "Debug Failure. Shouldn't ever directly check a JsxOpeningElement" - * - * For our current use-cases this is undesired behavior, so we just suppress it - * and log a a warning. - */ - /* istanbul ignore next */ - console.warn(`Warning From TSC: "${e.message}`); // eslint-disable-line no-console - /* istanbul ignore next */ - return undefined; - } -} -exports.getFirstSemanticOrSyntacticError = getFirstSemanticOrSyntacticError; -function whitelistSupportedDiagnostics(diagnostics) { - return diagnostics.filter(diagnostic => { - switch (diagnostic.code) { - case 1013: // "A rest parameter or binding pattern may not have a trailing comma." - case 1014: // "A rest parameter must be last in a parameter list." - case 1044: // "'{0}' modifier cannot appear on a module or namespace element." - case 1045: // "A '{0}' modifier cannot be used with an interface declaration." - case 1048: // "A rest parameter cannot have an initializer." - case 1049: // "A 'set' accessor must have exactly one parameter." - case 1070: // "'{0}' modifier cannot appear on a type member." - case 1071: // "'{0}' modifier cannot appear on an index signature." - case 1085: // "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." - case 1090: // "'{0}' modifier cannot appear on a parameter." - case 1096: // "An index signature must have exactly one parameter." - case 1097: // "'{0}' list cannot be empty." - case 1098: // "Type parameter list cannot be empty." - case 1099: // "Type argument list cannot be empty." - case 1117: // "An object literal cannot have multiple properties with the same name in strict mode." - case 1121: // "Octal literals are not allowed in strict mode." - case 1123: // "Variable declaration list cannot be empty." - case 1141: // "String literal expected." - case 1162: // "An object member cannot be declared optional." - case 1164: // "Computed property names are not allowed in enums." - case 1172: // "'extends' clause already seen." - case 1173: // "'extends' clause must precede 'implements' clause." - case 1175: // "'implements' clause already seen." - case 1176: // "Interface declaration cannot have 'implements' clause." - case 1190: // "The variable declaration of a 'for...of' statement cannot have an initializer." - case 1200: // "Line terminator not permitted before arrow." - case 1206: // "Decorators are not valid here." - case 1211: // "A class declaration without the 'default' modifier must have a name." - case 1242: // "'abstract' modifier can only appear on a class, method, or property declaration." - case 1246: // "An interface property cannot have an initializer." - case 1255: // "A definite assignment assertion '!' is not permitted in this context." - case 1308: // "'await' expression is only allowed within an async function." - case 2364: // "The left-hand side of an assignment expression must be a variable or a property access." - case 2369: // "A parameter property is only allowed in a constructor implementation." - case 2452: // "An enum member cannot have a numeric name." - case 2462: // "A rest element must be last in a destructuring pattern." - case 8017: // "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." - case 17012: // "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" - case 17013: // "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." - return true; - } - return false; - }); -} -function convertDiagnosticToSemanticOrSyntacticError(diagnostic) { - return Object.assign(Object.assign({}, diagnostic), { message: ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) }); -} -//# sourceMappingURL=semantic-or-syntactic-errors.js.map - -/***/ }), +/* 62 */, /* 63 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -6680,15 +7040,25 @@ module.exports = { /***/ }), /* 64 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(__unusedmodule, exports, __webpack_require__) { -const parse = __webpack_require__(658) -const valid = (version, options) => { - const v = parse(version, options) - return v ? v.version : null -} -module.exports = valid +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const TSESTree = __importStar(__webpack_require__(134)); +exports.TSESTree = TSESTree; +__export(__webpack_require__(702)); +//# sourceMappingURL=index.js.map /***/ }), /* 65 */, @@ -8309,7 +8679,56 @@ module.exports = function FromPropertyDescriptor(Desc) { /***/ }), -/* 85 */, +/* 85 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +// given a set of versions and a range, create a "simplified" range +// that includes the same versions that the original range does +// If the original range is shorter than the simplified one, return that. +const satisfies = __webpack_require__(586) +const compare = __webpack_require__(386) +module.exports = (versions, range, options) => { + const set = [] + let min = null + let prev = null + const v = versions.sort((a, b) => compare(a, b, options)) + for (const version of v) { + const included = satisfies(version, range, options) + if (included) { + prev = version + if (!min) + min = version + } else { + if (prev) { + set.push([min, prev]) + } + prev = null + min = null + } + } + if (min) + set.push([min, null]) + + const ranges = [] + for (const [min, max] of set) { + if (min === max) + ranges.push(min) + else if (!max && min === v[0]) + ranges.push('*') + else if (!max) + ranges.push(`>=${min}`) + else if (min === v[0]) + ranges.push(`<=${max}`) + else + ranges.push(`${min} - ${max}`) + } + const simplified = ranges.join(' || ') + const original = typeof range.raw === 'string' ? range.raw : String(range) + return simplified.length < original.length ? simplified : range +} + + +/***/ }), /* 86 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -8973,7 +9392,7 @@ module.exports = class Parser { Object.defineProperty(exports, "__esModule", { value: true }); const ts = __webpack_require__(752); const type_1 = __webpack_require__(144); -const util_1 = __webpack_require__(713); +const util_1 = __webpack_require__(833); const node_1 = __webpack_require__(10); function isEmptyObjectType(type) { if (type_1.isObjectType(type) && @@ -10331,62 +10750,127 @@ function regExpEscape (s) { /***/ }), /* 94 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(module) { + +module.exports = {"name":"@typescript-eslint/typescript-estree","version":"2.34.0","description":"A parser that converts TypeScript source code into an ESTree compatible form","main":"dist/parser.js","types":"dist/parser.d.ts","files":["dist","README.md","LICENSE"],"engines":{"node":"^8.10.0 || ^10.13.0 || >=11.10.1"},"repository":{"type":"git","url":"https://github.com/typescript-eslint/typescript-eslint.git","directory":"packages/typescript-estree"},"bugs":{"url":"https://github.com/typescript-eslint/typescript-eslint/issues"},"license":"BSD-2-Clause","keywords":["ast","estree","ecmascript","javascript","typescript","parser","syntax"],"scripts":{"build":"tsc -b tsconfig.build.json","clean":"tsc -b tsconfig.build.json --clean","format":"prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore","lint":"eslint . --ext .js,.ts --ignore-path='../../.eslintignore'","test":"jest --coverage","typecheck":"tsc -p tsconfig.json --noEmit"},"dependencies":{"debug":"^4.1.1","eslint-visitor-keys":"^1.1.0","glob":"^7.1.6","is-glob":"^4.0.1","lodash":"^4.17.15","semver":"^7.3.2","tsutils":"^3.17.1"},"devDependencies":{"@babel/code-frame":"^7.8.3","@babel/parser":"^7.8.3","@babel/types":"^7.8.3","@types/babel__code-frame":"^7.0.1","@types/debug":"^4.1.5","@types/glob":"^7.1.1","@types/is-glob":"^4.0.1","@types/lodash":"^4.14.149","@types/semver":"^7.1.0","@types/tmp":"^0.2.0","@typescript-eslint/shared-fixtures":"2.34.0","tmp":"^0.2.1","typescript":"*"},"peerDependenciesMeta":{"typescript":{"optional":true}},"funding":{"type":"opencollective","url":"https://opencollective.com/typescript-eslint"},"gitHead":"f18890166146d8c6b8804ef705c04b15da269926","_resolved":"https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz","_integrity":"sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==","_from":"@typescript-eslint/typescript-estree@2.34.0"}; + +/***/ }), +/* 95 */, +/* 96 */ +/***/ (function(module) { + +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) + + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) -// just pre-load all the stuff that index.js lazily exports -const internalRe = __webpack_require__(331) module.exports = { - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: __webpack_require__(749).SEMVER_SPEC_VERSION, - SemVer: __webpack_require__(243), - compareIdentifiers: __webpack_require__(513).compareIdentifiers, - rcompareIdentifiers: __webpack_require__(513).rcompareIdentifiers, - parse: __webpack_require__(147), - valid: __webpack_require__(803), - clean: __webpack_require__(435), - inc: __webpack_require__(989), - diff: __webpack_require__(119), - major: __webpack_require__(83), - minor: __webpack_require__(610), - patch: __webpack_require__(79), - prerelease: __webpack_require__(193), - compare: __webpack_require__(570), - rcompare: __webpack_require__(586), - compareLoose: __webpack_require__(970), - compareBuild: __webpack_require__(50), - sort: __webpack_require__(899), - rsort: __webpack_require__(281), - gt: __webpack_require__(738), - lt: __webpack_require__(375), - eq: __webpack_require__(528), - neq: __webpack_require__(291), - gte: __webpack_require__(790), - lte: __webpack_require__(546), - cmp: __webpack_require__(308), - coerce: __webpack_require__(159), - Comparator: __webpack_require__(456), - Range: __webpack_require__(635), - satisfies: __webpack_require__(171), - toComparators: __webpack_require__(931), - maxSatisfying: __webpack_require__(426), - minSatisfying: __webpack_require__(693), - minVersion: __webpack_require__(491), - validRange: __webpack_require__(397), - outside: __webpack_require__(776), - gtr: __webpack_require__(258), - ltr: __webpack_require__(163), - intersects: __webpack_require__(927), - simplifyRange: __webpack_require__(632), - subset: __webpack_require__(578), + compareIdentifiers, + rcompareIdentifiers } /***/ }), -/* 95 */, -/* 96 */, -/* 97 */, +/* 97 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SemVer = __webpack_require__(734) +const Comparator = __webpack_require__(731) +const {ANY} = Comparator +const Range = __webpack_require__(33) +const satisfies = __webpack_require__(586) +const gt = __webpack_require__(435) +const lt = __webpack_require__(318) +const lte = __webpack_require__(242) +const gte = __webpack_require__(908) + +const outside = (version, range, hilo, options) => { + version = new SemVer(version, options) + range = new Range(range, options) + + let gtfn, ltefn, ltfn, comp, ecomp + switch (hilo) { + case '>': + gtfn = gt + ltefn = lte + ltfn = lt + comp = '>' + ecomp = '>=' + break + case '<': + gtfn = lt + ltefn = gte + ltfn = gt + comp = '<' + ecomp = '<=' + break + default: + throw new TypeError('Must provide a hilo val of "<" or ">"') + } + + // If it satisifes the range it is not outside + if (satisfies(version, range, options)) { + return false + } + + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. + + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + let high = null + let low = null + + comparators.forEach((comparator) => { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') + } + high = high || comparator + low = low || comparator + if (gtfn(comparator.semver, high.semver, options)) { + high = comparator + } else if (ltfn(comparator.semver, low.semver, options)) { + low = comparator + } + }) + + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false + } + + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false + } + } + return true +} + +module.exports = outside + + +/***/ }), /* 98 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -10574,7 +11058,58 @@ exports.default = crc32; /***/ }), -/* 104 */, +/* 104 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = __importStar(__webpack_require__(752)); +const util_1 = __webpack_require__(833); +const node_utils_1 = __webpack_require__(513); +const ts_estree_1 = __webpack_require__(64); +/** + * Convert all comments for the given AST. + * @param ast the AST object + * @param code the TypeScript code + * @returns the converted ESTreeComment + * @private + */ +function convertComments(ast, code) { + const comments = []; + util_1.forEachComment(ast, (_, comment) => { + const type = comment.kind == ts.SyntaxKind.SingleLineCommentTrivia + ? ts_estree_1.AST_TOKEN_TYPES.Line + : ts_estree_1.AST_TOKEN_TYPES.Block; + const range = [comment.pos, comment.end]; + const loc = node_utils_1.getLocFor(range[0], range[1], ast); + // both comments start with 2 characters - /* or // + const textStart = range[0] + 2; + const textEnd = comment.kind === ts.SyntaxKind.SingleLineCommentTrivia + ? // single line comments end at the end + range[1] - textStart + : // multiline comments end 2 characters early + range[1] - textStart - 2; + comments.push({ + type, + value: code.substr(textStart, textEnd), + range, + loc, + }); + }, ast); + return comments; +} +exports.convertComments = convertComments; +//# sourceMappingURL=convert-comments.js.map + +/***/ }), /* 105 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -11018,7 +11553,7 @@ var internalUtil = { /**/ /**/ -var Stream = __webpack_require__(381); +var Stream = __webpack_require__(191); /**/ /**/ @@ -12475,35 +13010,7 @@ module.exports.default = macosRelease; /***/ }), -/* 119 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const parse = __webpack_require__(147) -const eq = __webpack_require__(528) - -const diff = (version1, version2) => { - if (eq(version1, version2)) { - return null - } else { - const v1 = parse(version1) - const v2 = parse(version2) - const hasPre = v1.prerelease.length || v2.prerelease.length - const prefix = hasPre ? 'pre' : '' - const defaultResult = hasPre ? 'prerelease' : '' - for (const key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } - } - } - return defaultResult // may be undefined - } -} -module.exports = diff - - -/***/ }), +/* 119 */, /* 120 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -13301,19 +13808,143 @@ Glob.prototype._stat2 = function (f, abs, er, stat, cb) { /***/ }), /* 121 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(__unusedmodule, exports, __webpack_require__) { -const Range = __webpack_require__(986) -const satisfies = (version, range, options) => { - try { - range = new Range(range, options) - } catch (er) { - return false - } - return range.test(version) -} -module.exports = satisfies +"use strict"; +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const eslintVisitorKeys = __importStar(__webpack_require__(78)); +exports.visitorKeys = eslintVisitorKeys.unionWith({ + // Additional estree nodes. + Import: [], + // Additional Properties. + ArrayPattern: ['decorators', 'elements', 'typeAnnotation'], + ArrowFunctionExpression: ['typeParameters', 'params', 'returnType', 'body'], + ClassDeclaration: [ + 'decorators', + 'id', + 'typeParameters', + 'superClass', + 'superTypeParameters', + 'implements', + 'body', + ], + ClassExpression: [ + 'decorators', + 'id', + 'typeParameters', + 'superClass', + 'superTypeParameters', + 'implements', + 'body', + ], + TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], + FunctionDeclaration: ['id', 'typeParameters', 'params', 'returnType', 'body'], + FunctionExpression: ['id', 'typeParameters', 'params', 'returnType', 'body'], + Identifier: ['decorators', 'typeAnnotation'], + MethodDefinition: ['decorators', 'key', 'value'], + ObjectPattern: ['decorators', 'properties', 'typeAnnotation'], + RestElement: ['decorators', 'argument', 'typeAnnotation'], + NewExpression: ['callee', 'typeParameters', 'arguments'], + CallExpression: ['callee', 'typeParameters', 'arguments'], + // JSX + JSXOpeningElement: ['name', 'typeParameters', 'attributes'], + JSXClosingFragment: [], + JSXOpeningFragment: [], + JSXSpreadChild: ['expression'], + // Additional Nodes. + BigIntLiteral: [], + ClassProperty: ['decorators', 'key', 'typeAnnotation', 'value'], + Decorator: ['expression'], + OptionalCallExpression: ['callee', 'typeParameters', 'arguments'], + OptionalMemberExpression: eslintVisitorKeys.KEYS.MemberExpression, + TSAbstractClassProperty: ['decorators', 'key', 'typeAnnotation', 'value'], + TSAbstractKeyword: [], + TSAbstractMethodDefinition: ['key', 'value'], + TSAnyKeyword: [], + TSArrayType: ['elementType'], + TSAsExpression: ['expression', 'typeAnnotation'], + TSAsyncKeyword: [], + TSBigIntKeyword: [], + TSBooleanKeyword: [], + TSCallSignatureDeclaration: ['typeParameters', 'params', 'returnType'], + TSClassImplements: ['expression', 'typeParameters'], + TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'], + TSConstructSignatureDeclaration: ['typeParameters', 'params', 'returnType'], + TSConstructorType: ['typeParameters', 'params', 'returnType'], + TSDeclareFunction: ['id', 'typeParameters', 'params', 'returnType', 'body'], + TSDeclareKeyword: [], + TSEmptyBodyFunctionExpression: [ + 'id', + 'typeParameters', + 'params', + 'returnType', + ], + TSEnumDeclaration: ['id', 'members'], + TSEnumMember: ['id', 'initializer'], + TSExportAssignment: ['expression'], + TSExportKeyword: [], + TSExternalModuleReference: ['expression'], + TSImportType: ['parameter', 'qualifier', 'typeParameters'], + TSInferType: ['typeParameter'], + TSLiteralType: ['literal'], + TSIntersectionType: ['types'], + TSIndexedAccessType: ['indexType', 'objectType'], + TSIndexSignature: ['parameters', 'typeAnnotation'], + TSInterfaceBody: ['body'], + TSInterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'], + TSInterfaceHeritage: ['expression', 'typeParameters'], + TSImportEqualsDeclaration: ['id', 'moduleReference'], + TSFunctionType: ['typeParameters', 'params', 'returnType'], + TSMappedType: ['typeParameter', 'typeAnnotation'], + TSMethodSignature: ['typeParameters', 'key', 'params', 'returnType'], + TSModuleBlock: ['body'], + TSModuleDeclaration: ['id', 'body'], + TSNamespaceExportDeclaration: ['id'], + TSNonNullExpression: ['expression'], + TSNeverKeyword: [], + TSNullKeyword: [], + TSNumberKeyword: [], + TSObjectKeyword: [], + TSOptionalType: ['typeAnnotation'], + TSParameterProperty: ['decorators', 'parameter'], + TSParenthesizedType: ['typeAnnotation'], + TSPrivateKeyword: [], + TSPropertySignature: ['typeAnnotation', 'key', 'initializer'], + TSProtectedKeyword: [], + TSPublicKeyword: [], + TSQualifiedName: ['left', 'right'], + TSReadonlyKeyword: [], + TSRestType: ['typeAnnotation'], + TSStaticKeyword: [], + TSStringKeyword: [], + TSSymbolKeyword: [], + TSThisType: [], + TSTupleType: ['elementTypes'], + TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'], + TSTypeAnnotation: ['typeAnnotation'], + TSTypeAssertion: ['typeAnnotation', 'expression'], + TSTypeLiteral: ['members'], + TSTypeOperator: ['typeAnnotation'], + TSTypeParameter: ['name', 'constraint', 'default'], + TSTypeParameterDeclaration: ['params'], + TSTypeParameterInstantiation: ['params'], + TSTypePredicate: ['typeAnnotation', 'parameterName'], + TSTypeReference: ['typeName', 'typeParameters'], + TSTypeQuery: ['exprName'], + TSUnionType: ['types'], + TSUndefinedKeyword: [], + TSUnknownKeyword: [], + TSVoidKeyword: [], +}); +//# sourceMappingURL=visitor-keys.js.map /***/ }), /* 122 */ @@ -13537,152 +14168,19 @@ module.exports = class Node { /***/ }), -/* 123 */ +/* 123 */, +/* 124 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const ANY = Symbol('SemVer ANY') -// hoisted class for cyclic dependency -class Comparator { - static get ANY () { - return ANY - } - constructor (comp, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) { - return comp - } else { - comp = comp.value - } - } - - debug('comparator', comp, options) - this.options = options - this.loose = !!options.loose - this.parse(comp) - - if (this.semver === ANY) { - this.value = '' - } else { - this.value = this.operator + this.semver.version - } - - debug('comp', this) - } - - parse (comp) { - const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - const m = comp.match(r) - - if (!m) { - throw new TypeError(`Invalid comparator: ${comp}`) - } - - this.operator = m[1] !== undefined ? m[1] : '' - if (this.operator === '=') { - this.operator = '' - } - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) { - this.semver = ANY - } else { - this.semver = new SemVer(m[2], this.options.loose) - } - } - - toString () { - return this.value - } - - test (version) { - debug('Comparator.test', version, this.options.loose) - - if (this.semver === ANY || version === ANY) { - return true - } - - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { - return false - } - } - - return cmp(version, this.operator, this.semver, this.options) - } - - intersects (comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required') - } - - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (this.operator === '') { - if (this.value === '') { - return true - } - return new Range(comp.value, options).test(this.value) - } else if (comp.operator === '') { - if (comp.value === '') { - return true - } - return new Range(this.value, options).test(comp.semver) - } - - const sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>') - const sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<') - const sameSemVer = this.semver.version === comp.semver.version - const differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<=') - const oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<') - const oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>') - - return ( - sameDirectionIncreasing || - sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || - oppositeDirectionsGreaterThan - ) - } +const parse = __webpack_require__(584) +const prerelease = (version, options) => { + const parsed = parse(version, options) + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null } - -module.exports = Comparator - -const {re, t} = __webpack_require__(590) -const cmp = __webpack_require__(134) -const debug = __webpack_require__(487) -const SemVer = __webpack_require__(369) -const Range = __webpack_require__(986) +module.exports = prerelease /***/ }), -/* 124 */, /* 125 */, /* 126 */ /***/ (function(module) { @@ -14589,11 +15087,21 @@ module.exports = uniq; /* 127 */ /***/ (function(module, __unusedexports, __webpack_require__) { -var core = __webpack_require__(222); +const SemVer = __webpack_require__(734) -module.exports = function isCore(x) { - return Object.prototype.hasOwnProperty.call(core, x); -}; +const inc = (version, release, options, identifier) => { + if (typeof (options) === 'string') { + identifier = options + options = undefined + } + + try { + return new SemVer(version, options).inc(release, identifier).version + } catch (er) { + return null + } +} +module.exports = inc /***/ }), @@ -14681,57 +15189,12 @@ exports.isTupleTypeReference = isTupleTypeReference; /***/ }), /* 133 */, /* 134 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const eq = __webpack_require__(804) -const neq = __webpack_require__(335) -const gt = __webpack_require__(136) -const gte = __webpack_require__(618) -const lt = __webpack_require__(342) -const lte = __webpack_require__(495) - -const cmp = (a, op, b, loose) => { - switch (op) { - case '===': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a === b - - case '!==': - if (typeof a === 'object') - a = a.version - if (typeof b === 'object') - b = b.version - return a !== b - - case '': - case '=': - case '==': - return eq(a, b, loose) - - case '!=': - return neq(a, b, loose) - - case '>': - return gt(a, b, loose) - - case '>=': - return gte(a, b, loose) - - case '<': - return lt(a, b, loose) - - case '<=': - return lte(a, b, loose) +/***/ (function(__unusedmodule, exports) { - default: - throw new TypeError(`Invalid operator: ${op}`) - } -} -module.exports = cmp +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=ts-estree.js.map /***/ }), /* 135 */ @@ -37169,15 +37632,7 @@ return /******/ (function(modules) { // webpackBootstrap ; /***/ }), -/* 136 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const compare = __webpack_require__(682) -const gt = (a, b, loose) => compare(a, b, loose) > 0 -module.exports = gt - - -/***/ }), +/* 136 */, /* 137 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -37368,55 +37823,258 @@ Duplex.prototype._destroy = function (err, cb) { /***/ }), /* 139 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module) { "use strict"; -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)) result[k] = mod[k]; - result["default"] = mod; - return result; + +var has = Object.prototype.hasOwnProperty; +var isArray = Array.isArray; + +var hexTable = (function () { + var array = []; + for (var i = 0; i < 256; ++i) { + array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + } + + return array; +}()); + +var compactQueue = function compactQueue(queue) { + while (queue.length > 1) { + var item = queue.pop(); + var obj = item.obj[item.prop]; + + if (isArray(obj)) { + var compacted = []; + + for (var j = 0; j < obj.length; ++j) { + if (typeof obj[j] !== 'undefined') { + compacted.push(obj[j]); + } + } + + item.obj[item.prop] = compacted; + } + } }; -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = __importStar(__webpack_require__(752)); -const util_1 = __webpack_require__(713); -const node_utils_1 = __webpack_require__(277); -const ts_estree_1 = __webpack_require__(372); -/** - * Convert all comments for the given AST. - * @param ast the AST object - * @param code the TypeScript code - * @returns the converted ESTreeComment - * @private - */ -function convertComments(ast, code) { - const comments = []; - util_1.forEachComment(ast, (_, comment) => { - const type = comment.kind == ts.SyntaxKind.SingleLineCommentTrivia - ? ts_estree_1.AST_TOKEN_TYPES.Line - : ts_estree_1.AST_TOKEN_TYPES.Block; - const range = [comment.pos, comment.end]; - const loc = node_utils_1.getLocFor(range[0], range[1], ast); - // both comments start with 2 characters - /* or // - const textStart = range[0] + 2; - const textEnd = comment.kind === ts.SyntaxKind.SingleLineCommentTrivia - ? // single line comments end at the end - range[1] - textStart - : // multiline comments end 2 characters early - range[1] - textStart - 2; - comments.push({ - type, - value: code.substr(textStart, textEnd), - range, - loc, + +var arrayToObject = function arrayToObject(source, options) { + var obj = options && options.plainObjects ? Object.create(null) : {}; + for (var i = 0; i < source.length; ++i) { + if (typeof source[i] !== 'undefined') { + obj[i] = source[i]; + } + } + + return obj; +}; + +var merge = function merge(target, source, options) { + /* eslint no-param-reassign: 0 */ + if (!source) { + return target; + } + + if (typeof source !== 'object') { + if (isArray(target)) { + target.push(source); + } else if (target && typeof target === 'object') { + if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { + target[source] = true; + } + } else { + return [target, source]; + } + + return target; + } + + if (!target || typeof target !== 'object') { + return [target].concat(source); + } + + var mergeTarget = target; + if (isArray(target) && !isArray(source)) { + mergeTarget = arrayToObject(target, options); + } + + if (isArray(target) && isArray(source)) { + source.forEach(function (item, i) { + if (has.call(target, i)) { + var targetItem = target[i]; + if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { + target[i] = merge(targetItem, item, options); + } else { + target.push(item); + } + } else { + target[i] = item; + } }); - }, ast); - return comments; -} -exports.convertComments = convertComments; -//# sourceMappingURL=convert-comments.js.map + return target; + } + + return Object.keys(source).reduce(function (acc, key) { + var value = source[key]; + + if (has.call(acc, key)) { + acc[key] = merge(acc[key], value, options); + } else { + acc[key] = value; + } + return acc; + }, mergeTarget); +}; + +var assign = function assignSingleSource(target, source) { + return Object.keys(source).reduce(function (acc, key) { + acc[key] = source[key]; + return acc; + }, target); +}; + +var decode = function (str, decoder, charset) { + var strWithoutPlus = str.replace(/\+/g, ' '); + if (charset === 'iso-8859-1') { + // unescape never throws, no try...catch needed: + return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); + } + // utf-8 + try { + return decodeURIComponent(strWithoutPlus); + } catch (e) { + return strWithoutPlus; + } +}; + +var encode = function encode(str, defaultEncoder, charset) { + // This code was originally written by Brian White (mscdex) for the io.js core querystring library. + // It has been adapted here for stricter adherence to RFC 3986 + if (str.length === 0) { + return str; + } + + var string = str; + if (typeof str === 'symbol') { + string = Symbol.prototype.toString.call(str); + } else if (typeof str !== 'string') { + string = String(str); + } + + if (charset === 'iso-8859-1') { + return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { + return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; + }); + } + + var out = ''; + for (var i = 0; i < string.length; ++i) { + var c = string.charCodeAt(i); + + if ( + c === 0x2D // - + || c === 0x2E // . + || c === 0x5F // _ + || c === 0x7E // ~ + || (c >= 0x30 && c <= 0x39) // 0-9 + || (c >= 0x41 && c <= 0x5A) // a-z + || (c >= 0x61 && c <= 0x7A) // A-Z + ) { + out += string.charAt(i); + continue; + } + + if (c < 0x80) { + out = out + hexTable[c]; + continue; + } + + if (c < 0x800) { + out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + if (c < 0xD800 || c >= 0xE000) { + out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); + continue; + } + + i += 1; + c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); + out += hexTable[0xF0 | (c >> 18)] + + hexTable[0x80 | ((c >> 12) & 0x3F)] + + hexTable[0x80 | ((c >> 6) & 0x3F)] + + hexTable[0x80 | (c & 0x3F)]; + } + + return out; +}; + +var compact = function compact(value) { + var queue = [{ obj: { o: value }, prop: 'o' }]; + var refs = []; + + for (var i = 0; i < queue.length; ++i) { + var item = queue[i]; + var obj = item.obj[item.prop]; + + var keys = Object.keys(obj); + for (var j = 0; j < keys.length; ++j) { + var key = keys[j]; + var val = obj[key]; + if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { + queue.push({ obj: obj, prop: key }); + refs.push(val); + } + } + } + + compactQueue(queue); + + return value; +}; + +var isRegExp = function isRegExp(obj) { + return Object.prototype.toString.call(obj) === '[object RegExp]'; +}; + +var isBuffer = function isBuffer(obj) { + if (!obj || typeof obj !== 'object') { + return false; + } + + return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); +}; + +var combine = function combine(a, b) { + return [].concat(a, b); +}; + +var maybeMap = function maybeMap(val, fn) { + if (isArray(val)) { + var mapped = []; + for (var i = 0; i < val.length; i += 1) { + mapped.push(fn(val[i])); + } + return mapped; + } + return fn(val); +}; + +module.exports = { + arrayToObject: arrayToObject, + assign: assign, + combine: combine, + compact: compact, + decode: decode, + encode: encode, + isBuffer: isBuffer, + isRegExp: isRegExp, + maybeMap: maybeMap, + merge: merge +}; + /***/ }), /* 140 */, @@ -37813,7 +38471,7 @@ module.exports = { /* 147 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const {MAX_LENGTH} = __webpack_require__(749) +const {MAX_LENGTH} = __webpack_require__(269) const { re, t } = __webpack_require__(331) const SemVer = __webpack_require__(243) @@ -37934,15 +38592,7 @@ SafeBuffer.allocUnsafeSlow = function (size) { /***/ }), -/* 150 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const compareBuild = __webpack_require__(805) -const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) -module.exports = rsort - - -/***/ }), +/* 150 */, /* 151 */, /* 152 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -37955,7 +38605,7 @@ var precond = __webpack_require__(450); var util = __webpack_require__(669); var Backoff = __webpack_require__(650); -var FibonacciBackoffStrategy = __webpack_require__(33); +var FibonacciBackoffStrategy = __webpack_require__(750); // Wraps a function to be called in a backoff loop. function FunctionCall(fn, args, callback) { @@ -38481,12 +39131,7 @@ module.exports = ProgressEmitter; /***/ }), -/* 156 */ -/***/ (function(module) { - -module.exports = {"_from":"@typescript-eslint/typescript-estree@2.34.0","_id":"@typescript-eslint/typescript-estree@2.34.0","_inBundle":false,"_integrity":"sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==","_location":"/@typescript-eslint/typescript-estree","_phantomChildren":{},"_requested":{"type":"version","registry":true,"raw":"@typescript-eslint/typescript-estree@2.34.0","name":"@typescript-eslint/typescript-estree","escapedName":"@typescript-eslint%2ftypescript-estree","scope":"@typescript-eslint","rawSpec":"2.34.0","saveSpec":null,"fetchSpec":"2.34.0"},"_requiredBy":["/@typescript-eslint/experimental-utils","/@typescript-eslint/parser","/detective-typescript"],"_resolved":"https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz","_shasum":"14aeb6353b39ef0732cc7f1b8285294937cf37d5","_spec":"@typescript-eslint/typescript-estree@2.34.0","_where":"/Users/ryo/dev/actions/actions-netlify/node_modules/@typescript-eslint/parser","bugs":{"url":"https://github.com/typescript-eslint/typescript-eslint/issues"},"bundleDependencies":false,"dependencies":{"debug":"^4.1.1","eslint-visitor-keys":"^1.1.0","glob":"^7.1.6","is-glob":"^4.0.1","lodash":"^4.17.15","semver":"^7.3.2","tsutils":"^3.17.1"},"deprecated":false,"description":"A parser that converts TypeScript source code into an ESTree compatible form","devDependencies":{"@babel/code-frame":"^7.8.3","@babel/parser":"^7.8.3","@babel/types":"^7.8.3","@types/babel__code-frame":"^7.0.1","@types/debug":"^4.1.5","@types/glob":"^7.1.1","@types/is-glob":"^4.0.1","@types/lodash":"^4.14.149","@types/semver":"^7.1.0","@types/tmp":"^0.2.0","@typescript-eslint/shared-fixtures":"2.34.0","tmp":"^0.2.1","typescript":"*"},"engines":{"node":"^8.10.0 || ^10.13.0 || >=11.10.1"},"files":["dist","README.md","LICENSE"],"funding":{"type":"opencollective","url":"https://opencollective.com/typescript-eslint"},"gitHead":"f18890166146d8c6b8804ef705c04b15da269926","homepage":"https://github.com/typescript-eslint/typescript-eslint#readme","keywords":["ast","estree","ecmascript","javascript","typescript","parser","syntax"],"license":"BSD-2-Clause","main":"dist/parser.js","name":"@typescript-eslint/typescript-estree","peerDependenciesMeta":{"typescript":{"optional":true}},"repository":{"type":"git","url":"git+https://github.com/typescript-eslint/typescript-eslint.git","directory":"packages/typescript-estree"},"scripts":{"build":"tsc -b tsconfig.build.json","clean":"tsc -b tsconfig.build.json --clean","format":"prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore","lint":"eslint . --ext .js,.ts --ignore-path='../../.eslintignore'","test":"jest --coverage","typecheck":"tsc -p tsconfig.json --noEmit"},"types":"dist/parser.d.ts","version":"2.34.0"}; - -/***/ }), +/* 156 */, /* 157 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -38649,18 +39294,7 @@ exports.default = crc16ccitt; /***/ }), /* 161 */, -/* 162 */, -/* 163 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const outside = __webpack_require__(776) -// Determine if version is less than all the versions possible in the range -const ltr = (version, range, options) => outside(version, range, '<', options) -module.exports = ltr - - -/***/ }), -/* 164 */ +/* 162 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; @@ -38676,78 +39310,53 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); +const debug_1 = __importDefault(__webpack_require__(784)); const path_1 = __importDefault(__webpack_require__(622)); const ts = __importStar(__webpack_require__(752)); +const shared_1 = __webpack_require__(769); +const log = debug_1.default('typescript-eslint:typescript-estree:createDefaultProgram'); /** - * Default compiler options for program generation from single root file + * @param code The code of the file being linted + * @param extra The config object + * @param extra.tsconfigRootDir The root directory for relative tsconfig paths + * @param extra.projects Provided tsconfig paths + * @returns If found, returns the source file corresponding to the code and the containing program */ -const DEFAULT_COMPILER_OPTIONS = { - allowNonTsExtensions: true, - allowJs: true, - checkJs: true, - noEmit: true, - // extendedDiagnostics: true, - noUnusedLocals: true, - noUnusedParameters: true, -}; -function createDefaultCompilerOptionsFromExtra(extra) { - if (extra.debugLevel.has('typescript')) { - return Object.assign(Object.assign({}, DEFAULT_COMPILER_OPTIONS), { extendedDiagnostics: true }); - } - return DEFAULT_COMPILER_OPTIONS; -} -exports.createDefaultCompilerOptionsFromExtra = createDefaultCompilerOptionsFromExtra; -// typescript doesn't provide a ts.sys implementation for browser environments -const useCaseSensitiveFileNames = ts.sys !== undefined ? ts.sys.useCaseSensitiveFileNames : true; -const correctPathCasing = useCaseSensitiveFileNames - ? (filePath) => filePath - : (filePath) => filePath.toLowerCase(); -function getCanonicalFileName(filePath) { - let normalized = path_1.default.normalize(filePath); - if (normalized.endsWith(path_1.default.sep)) { - normalized = normalized.substr(0, normalized.length - 1); +function createDefaultProgram(code, extra) { + log('Getting default program for: %s', extra.filePath || 'unnamed file'); + if (!extra.projects || extra.projects.length !== 1) { + return undefined; } - return correctPathCasing(normalized); -} -exports.getCanonicalFileName = getCanonicalFileName; -function ensureAbsolutePath(p, extra) { - return path_1.default.isAbsolute(p) - ? p - : path_1.default.join(extra.tsconfigRootDir || process.cwd(), p); -} -exports.ensureAbsolutePath = ensureAbsolutePath; -function getTsconfigPath(tsconfigPath, extra) { - return getCanonicalFileName(ensureAbsolutePath(tsconfigPath, extra)); -} -exports.getTsconfigPath = getTsconfigPath; -function canonicalDirname(p) { - return path_1.default.dirname(p); -} -exports.canonicalDirname = canonicalDirname; -function getScriptKind(extra, filePath = extra.filePath) { - const extension = path_1.default.extname(filePath).toLowerCase(); - // note - we respect the user's extension when it is known we could override it and force it to match their - // jsx setting, but that could create weird situations where we throw parse errors when TSC doesn't - switch (extension) { - case '.ts': - return ts.ScriptKind.TS; - case '.tsx': - return ts.ScriptKind.TSX; - case '.js': - return ts.ScriptKind.JS; - case '.jsx': - return ts.ScriptKind.JSX; - case '.json': - return ts.ScriptKind.JSON; - default: - // unknown extension, force typescript to ignore the file extension, and respect the user's setting - return extra.jsx ? ts.ScriptKind.TSX : ts.ScriptKind.TS; + const tsconfigPath = shared_1.getTsconfigPath(extra.projects[0], extra); + const commandLine = ts.getParsedCommandLineOfConfigFile(tsconfigPath, shared_1.createDefaultCompilerOptionsFromExtra(extra), Object.assign(Object.assign({}, ts.sys), { onUnRecoverableConfigFileDiagnostic: () => { } })); + if (!commandLine) { + return undefined; } + const compilerHost = ts.createCompilerHost(commandLine.options, + /* setParentNodes */ true); + const oldReadFile = compilerHost.readFile; + compilerHost.readFile = (fileName) => path_1.default.normalize(fileName) === path_1.default.normalize(extra.filePath) + ? code + : oldReadFile(fileName); + const program = ts.createProgram([extra.filePath], commandLine.options, compilerHost); + const ast = program.getSourceFile(extra.filePath); + return ast && { ast, program }; } -exports.getScriptKind = getScriptKind; -//# sourceMappingURL=shared.js.map +exports.createDefaultProgram = createDefaultProgram; +//# sourceMappingURL=createDefaultProgram.js.map + +/***/ }), +/* 163 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const outside = __webpack_require__(776) +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr + /***/ }), +/* 164 */, /* 165 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -39271,7 +39880,7 @@ module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); /* 175 */ /***/ (function(module) { -module.exports = {"name":"escodegen","description":"ECMAScript code generator","homepage":"http://github.com/estools/escodegen","main":"escodegen.js","bin":{"esgenerate":"./bin/esgenerate.js","escodegen":"./bin/escodegen.js"},"files":["LICENSE.BSD","README.md","bin","escodegen.js","package.json"],"version":"1.14.1","engines":{"node":">=4.0"},"maintainers":[{"name":"Yusuke Suzuki","email":"utatane.tea@gmail.com","web":"http://github.com/Constellation"}],"repository":{"type":"git","url":"http://github.com/estools/escodegen.git"},"dependencies":{"estraverse":"^4.2.0","esutils":"^2.0.2","esprima":"^4.0.1","optionator":"^0.8.1"},"optionalDependencies":{"source-map":"~0.6.1"},"devDependencies":{"acorn":"^7.1.0","bluebird":"^3.4.7","bower-registry-client":"^1.0.0","chai":"^3.5.0","commonjs-everywhere":"^0.9.7","gulp":"^3.8.10","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","semver":"^5.1.0"},"license":"BSD-2-Clause","scripts":{"test":"gulp travis","unit-test":"gulp test","lint":"gulp lint","release":"node tools/release.js","build-min":"./node_modules/.bin/cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js","build":"./node_modules/.bin/cjsify -a path: tools/entry-point.js > escodegen.browser.js"},"_resolved":"https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz","_integrity":"sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==","_from":"escodegen@1.14.1"}; +module.exports = {"name":"escodegen","description":"ECMAScript code generator","homepage":"http://github.com/estools/escodegen","main":"escodegen.js","bin":{"esgenerate":"./bin/esgenerate.js","escodegen":"./bin/escodegen.js"},"files":["LICENSE.BSD","README.md","bin","escodegen.js","package.json"],"version":"1.14.2","engines":{"node":">=4.0"},"maintainers":[{"name":"Yusuke Suzuki","email":"utatane.tea@gmail.com","web":"http://github.com/Constellation"}],"repository":{"type":"git","url":"http://github.com/estools/escodegen.git"},"dependencies":{"estraverse":"^4.2.0","esutils":"^2.0.2","esprima":"^4.0.1","optionator":"^0.8.1"},"optionalDependencies":{"source-map":"~0.6.1"},"devDependencies":{"acorn":"^7.1.0","bluebird":"^3.4.7","bower-registry-client":"^1.0.0","chai":"^3.5.0","commonjs-everywhere":"^0.9.7","gulp":"^3.8.10","gulp-eslint":"^3.0.1","gulp-mocha":"^3.0.1","semver":"^5.1.0"},"license":"BSD-2-Clause","scripts":{"test":"gulp travis","unit-test":"gulp test","lint":"gulp lint","release":"node tools/release.js","build-min":"./node_modules/.bin/cjsify -ma path: tools/entry-point.js > escodegen.browser.min.js","build":"./node_modules/.bin/cjsify -a path: tools/entry-point.js > escodegen.browser.js"},"_resolved":"https://registry.npmjs.org/escodegen/-/escodegen-1.14.2.tgz","_integrity":"sha512-InuOIiKk8wwuOFg6x9BQXbzjrQhtyXh46K9bqVTPzSo2FnyMBaYGBMC6PhQy7yxxil9vIedFBweQBMK74/7o8A==","_from":"escodegen@1.14.2"}; /***/ }), /* 176 */ @@ -41738,13 +42347,19 @@ module.exports = NestedError; multiline = false; if (expr.properties.length === 1) { property = expr.properties[0]; - if (property.value.type !== Syntax.Identifier) { + if ( + property.type === Syntax.Property + && property.value.type !== Syntax.Identifier + ) { multiline = true; } } else { for (i = 0, iz = expr.properties.length; i < iz; ++i) { property = expr.properties[i]; - if (!property.shorthand) { + if ( + property.type === Syntax.Property + && !property.shorthand + ) { multiline = true; break; } @@ -42258,10 +42873,7 @@ function authenticationPlugin(octokit, options) { /* 191 */ /***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; - - -module.exports = __webpack_require__(316).default; +module.exports = __webpack_require__(413); /***/ }), @@ -42395,7 +43007,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 (Object.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; }; @@ -42477,6 +43089,7 @@ function run(inputs) { const enableCommitComment = inputs.enableCommitComment(); const overwritesPullRequestComment = inputs.overwritesPullRequestComment(); const netlifyConfigPath = inputs.netlifyConfigPath(); + const alias = inputs.alias(); const isDraft = productionBranch === undefined || github_1.context.ref !== `refs/heads/${productionBranch}`; // Create Netlify API client @@ -42487,7 +43100,8 @@ function run(inputs) { const deploy = yield netlifyClient.deploy(siteId, deployFolder, { draft: isDraft, message: deployMessage, - configPath: netlifyConfigPath + configPath: netlifyConfigPath, + branch: alias }); // Create a message const message = isDraft @@ -42587,611 +43201,7 @@ run(inputs_1.defaultInputs); /***/ }), -/* 199 */ -/***/ (function(module) { - -/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; - -/** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; - -/** Used to match words composed of alphanumeric characters. */ -var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; - -/** Used to match Latin Unicode letters (excluding mathematical operators). */ -var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; - -/** Used to compose unicode character classes. */ -var rsAstralRange = '\\ud800-\\udfff', - rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', - rsComboSymbolsRange = '\\u20d0-\\u20f0', - rsDingbatRange = '\\u2700-\\u27bf', - rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', - rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', - rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', - rsPunctuationRange = '\\u2000-\\u206f', - rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', - rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', - rsVarRange = '\\ufe0e\\ufe0f', - rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; - -/** Used to compose unicode capture groups. */ -var rsApos = "['\u2019]", - rsAstral = '[' + rsAstralRange + ']', - rsBreak = '[' + rsBreakRange + ']', - rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', - rsDigits = '\\d+', - rsDingbat = '[' + rsDingbatRange + ']', - rsLower = '[' + rsLowerRange + ']', - rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', - rsFitz = '\\ud83c[\\udffb-\\udfff]', - rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', - rsNonAstral = '[^' + rsAstralRange + ']', - rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', - rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', - rsUpper = '[' + rsUpperRange + ']', - rsZWJ = '\\u200d'; - -/** Used to compose unicode regexes. */ -var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', - rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', - rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', - rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', - reOptMod = rsModifier + '?', - rsOptVar = '[' + rsVarRange + ']?', - rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', - rsSeq = rsOptVar + reOptMod + rsOptJoin, - rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, - rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; - -/** Used to match apostrophes. */ -var reApos = RegExp(rsApos, 'g'); - -/** - * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and - * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). - */ -var reComboMark = RegExp(rsCombo, 'g'); - -/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); - -/** Used to match complex or compound words. */ -var reUnicodeWord = RegExp([ - rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', - rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', - rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, - rsUpper + '+' + rsOptUpperContr, - rsDigits, - rsEmoji -].join('|'), 'g'); - -/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ -var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); - -/** Used to detect strings that need a more robust regexp to match words. */ -var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; - -/** Used to map Latin Unicode letters to basic Latin letters. */ -var deburredLetters = { - // Latin-1 Supplement block. - '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', - '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', - '\xc7': 'C', '\xe7': 'c', - '\xd0': 'D', '\xf0': 'd', - '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', - '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', - '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', - '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', - '\xd1': 'N', '\xf1': 'n', - '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', - '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', - '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', - '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', - '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', - '\xc6': 'Ae', '\xe6': 'ae', - '\xde': 'Th', '\xfe': 'th', - '\xdf': 'ss', - // Latin Extended-A block. - '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', - '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', - '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', - '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', - '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', - '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', - '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', - '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', - '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', - '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', - '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', - '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', - '\u0134': 'J', '\u0135': 'j', - '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', - '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', - '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', - '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', - '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', - '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', - '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', - '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', - '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', - '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', - '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', - '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', - '\u0163': 't', '\u0165': 't', '\u0167': 't', - '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', - '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', - '\u0174': 'W', '\u0175': 'w', - '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', - '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', - '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', - '\u0132': 'IJ', '\u0133': 'ij', - '\u0152': 'Oe', '\u0153': 'oe', - '\u0149': "'n", '\u017f': 'ss' -}; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -/** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ -function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array ? array.length : 0; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; -} - -/** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function asciiToArray(string) { - return string.split(''); -} - -/** - * Splits an ASCII `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ -function asciiWords(string) { - return string.match(reAsciiWord) || []; -} - -/** - * The base implementation of `_.propertyOf` without support for deep paths. - * - * @private - * @param {Object} object The object to query. - * @returns {Function} Returns the new accessor function. - */ -function basePropertyOf(object) { - return function(key) { - return object == null ? undefined : object[key]; - }; -} - -/** - * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A - * letters to basic Latin letters. - * - * @private - * @param {string} letter The matched letter to deburr. - * @returns {string} Returns the deburred letter. - */ -var deburrLetter = basePropertyOf(deburredLetters); - -/** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ -function hasUnicode(string) { - return reHasUnicode.test(string); -} - -/** - * Checks if `string` contains a word composed of Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a word is found, else `false`. - */ -function hasUnicodeWord(string) { - return reHasUnicodeWord.test(string); -} - -/** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); -} - -/** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function unicodeToArray(string) { - return string.match(reUnicode) || []; -} - -/** - * Splits a Unicode `string` into an array of its words. - * - * @private - * @param {string} The string to inspect. - * @returns {Array} Returns the words of `string`. - */ -function unicodeWords(string) { - return string.match(reUnicodeWord) || []; -} - -/** Used for built-in method references. */ -var objectProto = Object.prototype; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Built-in value references. */ -var Symbol = root.Symbol; - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - -/** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ -function baseSlice(array, start, end) { - var index = -1, - length = array.length; - - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; - } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; - } - return result; -} - -/** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ -function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; -} - -/** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ -function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); -} - -/** - * Creates a function like `_.lowerFirst`. - * - * @private - * @param {string} methodName The name of the `String` case method to use. - * @returns {Function} Returns the new case function. - */ -function createCaseFirst(methodName) { - return function(string) { - string = toString(string); - - var strSymbols = hasUnicode(string) - ? stringToArray(string) - : undefined; - - var chr = strSymbols - ? strSymbols[0] - : string.charAt(0); - - var trailing = strSymbols - ? castSlice(strSymbols, 1).join('') - : string.slice(1); - - return chr[methodName]() + trailing; - }; -} - -/** - * Creates a function like `_.camelCase`. - * - * @private - * @param {Function} callback The function to combine each word. - * @returns {Function} Returns the new compounder function. - */ -function createCompounder(callback) { - return function(string) { - return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); - }; -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); -} - -/** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {string} Returns the string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ -function toString(value) { - return value == null ? '' : baseToString(value); -} - -/** - * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the camel cased string. - * @example - * - * _.camelCase('Foo Bar'); - * // => 'fooBar' - * - * _.camelCase('--foo-bar--'); - * // => 'fooBar' - * - * _.camelCase('__FOO_BAR__'); - * // => 'fooBar' - */ -var camelCase = createCompounder(function(result, word, index) { - word = word.toLowerCase(); - return result + (index ? capitalize(word) : word); -}); - -/** - * Converts the first character of `string` to upper case and the remaining - * to lower case. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to capitalize. - * @returns {string} Returns the capitalized string. - * @example - * - * _.capitalize('FRED'); - * // => 'Fred' - */ -function capitalize(string) { - return upperFirst(toString(string).toLowerCase()); -} - -/** - * Deburrs `string` by converting - * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) - * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) - * letters to basic Latin letters and removing - * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to deburr. - * @returns {string} Returns the deburred string. - * @example - * - * _.deburr('déjà vu'); - * // => 'deja vu' - */ -function deburr(string) { - string = toString(string); - return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); -} - -/** - * Converts the first character of `string` to upper case. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.upperFirst('fred'); - * // => 'Fred' - * - * _.upperFirst('FRED'); - * // => 'FRED' - */ -var upperFirst = createCaseFirst('toUpperCase'); - -/** - * Splits `string` into an array of its words. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to inspect. - * @param {RegExp|string} [pattern] The pattern to match words. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {Array} Returns the words of `string`. - * @example - * - * _.words('fred, barney, & pebbles'); - * // => ['fred', 'barney', 'pebbles'] - * - * _.words('fred, barney, & pebbles', /[^, ]+/g); - * // => ['fred', 'barney', '&', 'pebbles'] - */ -function words(string, pattern, guard) { - string = toString(string); - pattern = guard ? undefined : pattern; - - if (pattern === undefined) { - return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); - } - return string.match(pattern) || []; -} - -module.exports = camelCase; - - -/***/ }), +/* 199 */, /* 200 */ /***/ (function(__unusedmodule, exports) { @@ -43489,70 +43499,35 @@ module.exports = function GetIntrinsic(name, allowMissing) { /***/ }), /* 203 */, /* 204 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +const SemVer = __webpack_require__(243) -Object.defineProperty(exports, "__esModule", { value: true }); -const convert_1 = __webpack_require__(514); -const convert_comments_1 = __webpack_require__(139); -const node_utils_1 = __webpack_require__(277); -const simple_traverse_1 = __webpack_require__(894); -function astConverter(ast, extra, shouldPreserveNodeMaps) { - /** - * The TypeScript compiler produced fundamental parse errors when parsing the - * source. - */ - // internal typescript api... - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const parseDiagnostics = ast.parseDiagnostics; - if (parseDiagnostics.length) { - throw convert_1.convertError(parseDiagnostics[0]); - } - /** - * Recursively convert the TypeScript AST into an ESTree-compatible AST - */ - const instance = new convert_1.Converter(ast, { - errorOnUnknownASTType: extra.errorOnUnknownASTType || false, - useJSXTextNode: extra.useJSXTextNode || false, - shouldPreserveNodeMaps, - }); - const estree = instance.convertProgram(); - /** - * Optionally remove range and loc if specified - */ - if (!extra.range || !extra.loc) { - simple_traverse_1.simpleTraverse(estree, { - enter: node => { - if (!extra.range) { - delete node.range; - } - if (!extra.loc) { - delete node.loc; - } - }, - }); - } - /** - * Optionally convert and include all tokens in the AST - */ - if (extra.tokens) { - estree.tokens = node_utils_1.convertTokens(ast); - } - /** - * Optionally convert and include all comments in the AST - */ - if (extra.comment) { - estree.comments = convert_comments_1.convertComments(ast, extra.code); - } - const astMaps = shouldPreserveNodeMaps ? instance.getASTMaps() : undefined; - return { estree, astMaps }; +const inc = (version, release, options, identifier) => { + if (typeof (options) === 'string') { + identifier = options + options = undefined + } + + try { + return new SemVer(version, options).inc(release, identifier).version + } catch (er) { + return null + } } -exports.astConverter = astConverter; -//# sourceMappingURL=ast-converter.js.map +module.exports = inc + + +/***/ }), +/* 205 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const compare = __webpack_require__(386) +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare + /***/ }), -/* 205 */, /* 206 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -44272,36 +44247,7 @@ rimraf.sync = rimrafSync /***/ }), -/* 217 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SemVer = __webpack_require__(369) -const Range = __webpack_require__(986) -const minSatisfying = (versions, range, options) => { - let min = null - let minSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { - // compare(min, v, true) - min = v - minSV = new SemVer(min, options) - } - } - }) - return min -} -module.exports = minSatisfying - - -/***/ }), +/* 217 */, /* 218 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -45139,7987 +45085,7746 @@ Writable.prototype._destroy = function (err, cb) { /***/ }), /* 224 */, /* 225 */ -/***/ (function(module, exports, __webpack_require__) { - -/* module decorator */ module = __webpack_require__.nmd(module); -(function (global, factory) { - true ? factory(exports) : - undefined; -}(this, (function (exports) { 'use strict'; - -function slice(arrayLike, start) { - start = start|0; - var newLen = Math.max(arrayLike.length - start, 0); - var newArr = Array(newLen); - for(var idx = 0; idx < newLen; idx++) { - newArr[idx] = arrayLike[start + idx]; - } - return newArr; -} +/***/ (function(module, __unusedexports, __webpack_require__) { -/** - * Creates a continuation function with some arguments already applied. - * - * Useful as a shorthand when combined with other control flow functions. Any - * arguments passed to the returned function are added to the arguments - * originally passed to apply. - * - * @name apply - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {Function} fn - The function you want to eventually apply all - * arguments to. Invokes with (arguments...). - * @param {...*} arguments... - Any number of arguments to automatically apply - * when the continuation is called. - * @returns {Function} the partially-applied function - * @example - * - * // using apply - * async.parallel([ - * async.apply(fs.writeFile, 'testfile1', 'test1'), - * async.apply(fs.writeFile, 'testfile2', 'test2') - * ]); - * - * - * // the same process without using apply - * async.parallel([ - * function(callback) { - * fs.writeFile('testfile1', 'test1', callback); - * }, - * function(callback) { - * fs.writeFile('testfile2', 'test2', callback); - * } - * ]); - * - * // It's possible to pass any number of additional arguments when calling the - * // continuation: - * - * node> var fn = async.apply(sys.puts, 'one'); - * node> fn('two', 'three'); - * one - * two - * three - */ -var apply = function(fn/*, ...args*/) { - var args = slice(arguments, 1); - return function(/*callArgs*/) { - var callArgs = slice(arguments); - return fn.apply(null, args.concat(callArgs)); - }; -}; +"use strict"; -var initialParams = function (fn) { - return function (/*...args, callback*/) { - var args = slice(arguments); - var callback = args.pop(); - fn.call(this, args, callback); - }; -}; +const pLimit = __webpack_require__(22); -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return value != null && (type == 'object' || type == 'function'); +class EndError extends Error { + constructor(value) { + super(); + this.value = value; + } } -var hasSetImmediate = typeof setImmediate === 'function' && setImmediate; -var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; - -function fallback(fn) { - setTimeout(fn, 0); -} +// The input can also be a promise, so we await it +const testElement = async (element, tester) => tester(await element); -function wrap(defer) { - return function (fn/*, ...args*/) { - var args = slice(arguments, 1); - defer(function () { - fn.apply(null, args); - }); - }; -} +// The input can also be a promise, so we `Promise.all()` them both +const finder = async element => { + const values = await Promise.all(element); + if (values[1] === true) { + throw new EndError(values[0]); + } -var _defer; + return false; +}; -if (hasSetImmediate) { - _defer = setImmediate; -} else if (hasNextTick) { - _defer = process.nextTick; -} else { - _defer = fallback; -} +const pLocate = async (iterable, tester, options) => { + options = { + concurrency: Infinity, + preserveOrder: true, + ...options + }; -var setImmediate$1 = wrap(_defer); + const limit = pLimit(options.concurrency); -/** - * Take a sync function and make it async, passing its return value to a - * callback. This is useful for plugging sync functions into a waterfall, - * series, or other async functions. Any arguments passed to the generated - * function will be passed to the wrapped function (except for the final - * callback argument). Errors thrown will be passed to the callback. - * - * If the function passed to `asyncify` returns a Promise, that promises's - * resolved/rejected state will be used to call the callback, rather than simply - * the synchronous return value. - * - * This also means you can asyncify ES2017 `async` functions. - * - * @name asyncify - * @static - * @memberOf module:Utils - * @method - * @alias wrapSync - * @category Util - * @param {Function} func - The synchronous function, or Promise-returning - * function to convert to an {@link AsyncFunction}. - * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be - * invoked with `(args..., callback)`. - * @example - * - * // passing a regular synchronous function - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(JSON.parse), - * function (data, next) { - * // data is the result of parsing the text. - * // If there was a parsing error, it would have been caught. - * } - * ], callback); - * - * // passing a function returning a promise - * async.waterfall([ - * async.apply(fs.readFile, filename, "utf8"), - * async.asyncify(function (contents) { - * return db.model.create(contents); - * }), - * function (model, next) { - * // `model` is the instantiated model object. - * // If there was an error, this function would be skipped. - * } - * ], callback); - * - * // es2017 example, though `asyncify` is not needed if your JS environment - * // supports async functions out of the box - * var q = async.queue(async.asyncify(async function(file) { - * var intermediateStep = await processFile(file); - * return await somePromise(intermediateStep) - * })); - * - * q.push(files); - */ -function asyncify(func) { - return initialParams(function (args, callback) { - var result; - try { - result = func.apply(this, args); - } catch (e) { - return callback(e); - } - // if result is Promise object - if (isObject(result) && typeof result.then === 'function') { - result.then(function(value) { - invokeCallback(callback, null, value); - }, function(err) { - invokeCallback(callback, err.message ? err : new Error(err)); - }); - } else { - callback(null, result); - } - }); -} + // Start all the promises concurrently with optional limit + const items = [...iterable].map(element => [element, limit(testElement, element, tester)]); -function invokeCallback(callback, error, value) { - try { - callback(error, value); - } catch (e) { - setImmediate$1(rethrow, e); - } -} + // Check the promises either serially or concurrently + const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity); -function rethrow(error) { - throw error; -} + try { + await Promise.all(items.map(element => checkLimit(finder, element))); + } catch (error) { + if (error instanceof EndError) { + return error.value; + } -var supportsSymbol = typeof Symbol === 'function'; + throw error; + } +}; -function isAsync(fn) { - return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction'; -} +module.exports = pLocate; +// TODO: Remove this for the next major release +module.exports.default = pLocate; -function wrapAsync(asyncFn) { - return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; -} -function applyEach$1(eachfn) { - return function(fns/*, ...args*/) { - var args = slice(arguments, 1); - var go = initialParams(function(args, callback) { - var that = this; - return eachfn(fns, function (fn, cb) { - wrapAsync(fn).apply(that, args.concat(cb)); - }, callback); - }); - if (args.length) { - return go.apply(this, args); - } - else { - return go; - } - }; -} +/***/ }), +/* 226 */ +/***/ (function(module, __unusedexports, __webpack_require__) { -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; +"use strict"; +// 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. -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); +module.exports = Readable; +/**/ -/** Built-in value references. */ -var Symbol$1 = root.Symbol; +var Duplex; +/**/ -/** Used for built-in method references. */ -var objectProto = Object.prototype; +Readable.ReadableState = ReadableState; +/**/ -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; +var EE = __webpack_require__(614).EventEmitter; -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString = objectProto.toString; +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ -/** Built-in value references. */ -var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined; +/**/ -/** - * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the raw `toStringTag`. - */ -function getRawTag(value) { - var isOwn = hasOwnProperty.call(value, symToStringTag$1), - tag = value[symToStringTag$1]; - try { - value[symToStringTag$1] = undefined; - var unmasked = true; - } catch (e) {} +var Stream = __webpack_require__(626); +/**/ - var result = nativeObjectToString.call(value); - if (unmasked) { - if (isOwn) { - value[symToStringTag$1] = tag; - } else { - delete value[symToStringTag$1]; - } - } - return result; -} -/** Used for built-in method references. */ -var objectProto$1 = Object.prototype; +var Buffer = __webpack_require__(407).Buffer; -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var nativeObjectToString$1 = objectProto$1.toString; +var OurUint8Array = global.Uint8Array || function () {}; -/** - * Converts `value` to a string using `Object.prototype.toString`. - * - * @private - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - */ -function objectToString(value) { - return nativeObjectToString$1.call(value); +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); } -/** `Object#toString` result references. */ -var nullTag = '[object Null]'; -var undefinedTag = '[object Undefined]'; +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +/**/ -/** Built-in value references. */ -var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined; -/** - * The base implementation of `getTag` without fallbacks for buggy environments. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -function baseGetTag(value) { - if (value == null) { - return value === undefined ? undefinedTag : nullTag; - } - return (symToStringTag && symToStringTag in Object(value)) - ? getRawTag(value) - : objectToString(value); -} +var debugUtil = __webpack_require__(669); -/** `Object#toString` result references. */ -var asyncTag = '[object AsyncFunction]'; -var funcTag = '[object Function]'; -var genTag = '[object GeneratorFunction]'; -var proxyTag = '[object Proxy]'; +var debug; -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - if (!isObject(value)) { - return false; - } - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 9 which returns 'object' for typed arrays and other constructors. - var tag = baseGetTag(value); - return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; } +/**/ -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} +var BufferList = __webpack_require__(912); -/** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ -function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); -} +var destroyImpl = __webpack_require__(232); -// A temporary value used to identify if the loop should be broken. -// See #1064, #1293 -var breakLoop = {}; +var _require = __webpack_require__(404), + getHighWaterMark = _require.getHighWaterMark; -/** - * This method returns `undefined`. - * - * @static - * @memberOf _ - * @since 2.3.0 - * @category Util - * @example - * - * _.times(2, _.noop); - * // => [undefined, undefined] - */ -function noop() { - // No operation performed. -} +var _require$codes = __webpack_require__(38).codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. -function once(fn) { - return function () { - if (fn === null) return; - var callFn = fn; - fn = null; - callFn.apply(this, arguments); - }; -} -var iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator; +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; -var getIterator = function (coll) { - return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol](); -}; +__webpack_require__(689)(Readable, Stream); -/** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ -function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return value != null && typeof value == 'object'; + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; } -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]'; +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(831); + options = options || {}; // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. -/** - * The base implementation of `_.isArguments`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - */ -function baseIsArguments(value) { - return isObjectLike(value) && baseGetTag(value) == argsTag; -} + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away -/** Used for built-in method references. */ -var objectProto$3 = Object.prototype; + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" -/** Used to check objects for own properties. */ -var hasOwnProperty$2 = objectProto$3.hasOwnProperty; + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() -/** Built-in value references. */ -var propertyIsEnumerable = objectProto$3.propertyIsEnumerable; + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. -/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { - return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') && - !propertyIsEnumerable.call(value, 'callee'); -}; + this.sync = true; // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; // Should close be emitted on destroy. Defaults to true. -/** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ -function stubFalse() { - return false; -} + this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') -/** Detect free variable `exports`. */ -var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + this.autoDestroy = !!options.autoDestroy; // has it been destroyed -/** Detect free variable `module`. */ -var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; + this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = freeModule && freeModule.exports === freeExports; + this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s -/** Built-in value references. */ -var Buffer = moduleExports ? root.Buffer : undefined; + this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; + this.readingMore = false; + this.decoder = null; + this.encoding = null; -/** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ -var isBuffer = nativeIsBuffer || stubFalse; + if (options.encoding) { + if (!StringDecoder) StringDecoder = __webpack_require__(432).StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER$1 = 9007199254740991; +function Readable(options) { + Duplex = Duplex || __webpack_require__(831); + if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 -/** Used to detect unsigned integer values. */ -var reIsUint = /^(?:0|[1-9]\d*)$/; + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); // legacy -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - var type = typeof value; - length = length == null ? MAX_SAFE_INTEGER$1 : length; + this.readable = true; - return !!length && - (type == 'number' || - (type != 'symbol' && reIsUint.test(value))) && - (value > -1 && value % 1 == 0 && value < length); -} + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } -/** `Object#toString` result references. */ -var argsTag$1 = '[object Arguments]'; -var arrayTag = '[object Array]'; -var boolTag = '[object Boolean]'; -var dateTag = '[object Date]'; -var errorTag = '[object Error]'; -var funcTag$1 = '[object Function]'; -var mapTag = '[object Map]'; -var numberTag = '[object Number]'; -var objectTag = '[object Object]'; -var regexpTag = '[object RegExp]'; -var setTag = '[object Set]'; -var stringTag = '[object String]'; -var weakMapTag = '[object WeakMap]'; + Stream.call(this); +} -var arrayBufferTag = '[object ArrayBuffer]'; -var dataViewTag = '[object DataView]'; -var float32Tag = '[object Float32Array]'; -var float64Tag = '[object Float64Array]'; -var int8Tag = '[object Int8Array]'; -var int16Tag = '[object Int16Array]'; -var int32Tag = '[object Int32Array]'; -var uint8Tag = '[object Uint8Array]'; -var uint8ClampedTag = '[object Uint8ClampedArray]'; -var uint16Tag = '[object Uint16Array]'; -var uint32Tag = '[object Uint32Array]'; +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } -/** Used to identify `toStringTag` values of typed arrays. */ -var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = -typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = -typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = -typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = -typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] = -typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = -typedArrayTags[errorTag] = typedArrayTags[funcTag$1] = -typedArrayTags[mapTag] = typedArrayTags[numberTag] = -typedArrayTags[objectTag] = typedArrayTags[regexpTag] = -typedArrayTags[setTag] = typedArrayTags[stringTag] = -typedArrayTags[weakMapTag] = false; + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed -/** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ -function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; -} -/** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; -/** Detect free variable `exports`. */ -var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; // Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. -/** Detect free variable `module`. */ -var freeModule$1 = freeExports$1 && "object" == 'object' && module && !module.nodeType && module; -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; -/** Detect free variable `process` from Node.js. */ -var freeProcess = moduleExports$1 && freeGlobal.process; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; -/** Used to access faster Node.js helpers. */ -var nodeUtil = (function() { - try { - // Use `util.types` for Node.js 10+. - var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } - if (types) { - return types; + skipChunkCheck = true; } + } else { + skipChunkCheck = true; + } - // Legacy `process.binding('util')` for Node.js < 10. - return freeProcess && freeProcess.binding && freeProcess.binding('util'); - } catch (e) {} -}()); + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; // Unshift should *always* be something directly out of read() -/* Node.js helper references. */ -var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; -/** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true - * - * _.isTypedArray([]); - * // => false - */ -var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; -/** Used for built-in method references. */ -var objectProto$2 = Object.prototype; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; -/** Used to check objects for own properties. */ -var hasOwnProperty$1 = objectProto$2.hasOwnProperty; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); -/** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ -function arrayLikeKeys(value, inherited) { - var isArr = isArray(value), - isArg = !isArr && isArguments(value), - isBuff = !isArr && !isArg && isBuffer(value), - isType = !isArr && !isArg && !isBuff && isTypedArray(value), - skipIndexes = isArr || isArg || isBuff || isType, - result = skipIndexes ? baseTimes(value.length, String) : [], - length = result.length; + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } - for (var key in value) { - if ((inherited || hasOwnProperty$1.call(value, key)) && - !(skipIndexes && ( - // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || - // Node.js 0.10 has enumerable non-index properties on buffers. - (isBuff && (key == 'offset' || key == 'parent')) || - // PhantomJS 2 has enumerable non-index properties on typed arrays. - (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || - // Skip index properties. - isIndex(key, length) - ))) { - result.push(key); + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); } + } // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + + + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); } - return result; + + maybeReadMore(stream, state); } -/** Used for built-in method references. */ -var objectProto$5 = Object.prototype; +function chunkInvalid(state, chunk) { + var er; -/** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ -function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } - return value === proto; + return er; } -/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; // backwards compatibility. -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeKeys = overArg(Object.keys, Object); -/** Used for built-in method references. */ -var objectProto$4 = Object.prototype; +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = __webpack_require__(432).StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 -/** Used to check objects for own properties. */ -var hasOwnProperty$3 = objectProto$4.hasOwnProperty; + this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: -/** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty$3.call(object, key) && key != 'constructor') { - result.push(key); - } + var p = this._readableState.buffer.head; + var content = ''; + + while (p !== null) { + content += decoder.write(p.data); + p = p.next; } - return result; -} -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); -} + this._readableState.buffer.clear(); -function createArrayIterator(coll) { - var i = -1; - var len = coll.length; - return function next() { - return ++i < len ? {value: coll[i], key: i} : null; - } -} + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; // Don't raise the hwm > 1GB -function createES2015Iterator(iterator) { - var i = -1; - return function next() { - var item = iterator.next(); - if (item.done) - return null; - i++; - return {value: item.value, key: i}; - } -} -function createObjectIterator(obj) { - var okeys = keys(obj); - var i = -1; - var len = okeys.length; - return function next() { - var key = okeys[++i]; - return i < len ? {value: obj[key], key: key} : null; - }; -} +var MAX_HWM = 0x40000000; -function iterator(coll) { - if (isArrayLike(coll)) { - return createArrayIterator(coll); - } +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } - var iterator = getIterator(coll); - return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); -} + return n; +} // This function is designed to be inlinable, so please take care when making +// changes to the function body. -function onlyOnce(fn) { - return function() { - if (fn === null) throw new Error("Callback was already called."); - var callFn = fn; - fn = null; - callFn.apply(this, arguments); - }; -} -function _eachOfLimit(limit) { - return function (obj, iteratee, callback) { - callback = once(callback || noop); - if (limit <= 0 || !obj) { - return callback(null); - } - var nextElem = iterator(obj); - var done = false; - var running = 0; - var looping = false; +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; - function iterateeCallback(err, value) { - running -= 1; - if (err) { - done = true; - callback(err); - } - else if (value === breakLoop || (done && running <= 0)) { - done = true; - return callback(null); - } - else if (!looping) { - replenish(); - } - } + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } // If we're asking for more than the current hwm, then raise the hwm. - function replenish () { - looping = true; - while (running < limit && !done) { - var elem = nextElem(); - if (elem === null) { - done = true; - if (running <= 0) { - callback(null); - } - return; - } - running += 1; - iteratee(elem.value, elem.key, onlyOnce(iterateeCallback)); - } - looping = false; - } - replenish(); - }; -} + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; // Don't have enough -/** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a - * time. - * - * @name eachOfLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfLimit - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. The `key` is the item's key, or index in the case of an - * array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - */ -function eachOfLimit(coll, limit, iteratee, callback) { - _eachOfLimit(limit)(coll, wrapAsync(iteratee), callback); -} + if (!state.ended) { + state.needReadable = true; + return 0; + } -function doLimit(fn, limit) { - return function (iterable, iteratee, callback) { - return fn(iterable, limit, iteratee, callback); - }; -} + return state.length; +} // you can override either this method, or the async _read(n) below. -// eachOf implementation optimized for array-likes -function eachOfArrayLike(coll, iteratee, callback) { - callback = once(callback || noop); - var index = 0, - completed = 0, - length = coll.length; - if (length === 0) { - callback(null); - } - function iteratorCallback(err, value) { - if (err) { - callback(err); - } else if ((++completed === length) || value === breakLoop) { - callback(null); - } - } +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. - for (; index < length; index++) { - iteratee(coll[index], index, onlyOnce(iteratorCallback)); - } -} + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } -// a generic version of eachOf which can handle array, object, and iterator cases. -var eachOfGeneric = doLimit(eachOfLimit, Infinity); + n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. -/** - * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument - * to the iteratee. - * - * @name eachOf - * @static - * @memberOf module:Collections - * @method - * @alias forEachOf - * @category Collection - * @see [async.each]{@link module:Collections.each} - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each - * item in `coll`. - * The `key` is the item's key, or index in the case of an array. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @example - * - * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; - * var configs = {}; - * - * async.forEachOf(obj, function (value, key, callback) { - * fs.readFile(__dirname + value, "utf8", function (err, data) { - * if (err) return callback(err); - * try { - * configs[key] = JSON.parse(data); - * } catch (e) { - * return callback(e); - * } - * callback(); - * }); - * }, function (err) { - * if (err) console.error(err.message); - * // configs is now a map of JSON data - * doSomethingWith(configs); - * }); - */ -var eachOf = function(coll, iteratee, callback) { - var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric; - eachOfImplementation(coll, wrapAsync(iteratee), callback); -}; + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + // if we need a readable event, then we need to do some reading. -function doParallel(fn) { - return function (obj, iteratee, callback) { - return fn(eachOf, obj, wrapAsync(iteratee), callback); - }; -} -function _asyncMap(eachfn, arr, iteratee, callback) { - callback = callback || noop; - arr = arr || []; - var results = []; - var counter = 0; - var _iteratee = wrapAsync(iteratee); + var doRead = state.needReadable; + debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - eachfn(arr, function (value, _, callback) { - var index = counter++; - _iteratee(value, function (err, v) { - results[index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); -} + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. -/** - * Produces a new collection of values by mapping each value in `coll` through - * the `iteratee` function. The `iteratee` is called with an item from `coll` - * and a callback for when it has finished processing. Each of these callback - * takes 2 arguments: an `error`, and the transformed item from `coll`. If - * `iteratee` passes an error to its callback, the main `callback` (for the - * `map` function) is immediately called with the error. - * - * Note, that since this function applies the `iteratee` to each item in - * parallel, there is no guarantee that the `iteratee` functions will complete - * in order. However, the results array will be in the same order as the - * original `coll`. - * - * If `map` is passed an Object, the results will be an Array. The results - * will roughly be in the order of the original Objects' keys (but this can - * vary across JavaScript engines). - * - * @name map - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an Array of the - * transformed items from the `coll`. Invoked with (err, results). - * @example - * - * async.map(['file1','file2','file3'], fs.stat, function(err, results) { - * // results is now an array of stats for each file - * }); - */ -var map = doParallel(_asyncMap); -/** - * Applies the provided arguments to each function in the array, calling - * `callback` after all functions have completed. If you only provide the first - * argument, `fns`, then it will return a function which lets you pass in the - * arguments as if it were a single function call. If more arguments are - * provided, `callback` is required while `args` is still optional. - * - * @name applyEach - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s - * to all call with the same arguments - * @param {...*} [args] - any number of separate arguments to pass to the - * function. - * @param {Function} [callback] - the final argument should be the callback, - * called when all functions have completed processing. - * @returns {Function} - If only the first argument, `fns`, is provided, it will - * return a function which lets you pass in the arguments as if it were a single - * function call. The signature is `(..args, callback)`. If invoked with any - * arguments, `callback` is required. - * @example - * - * async.applyEach([enableSearch, updateSchema], 'bucket', callback); - * - * // partial application example: - * async.each( - * buckets, - * async.applyEach([enableSearch, updateSchema]), - * callback - * ); - */ -var applyEach = applyEach$1(map); + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; // if the length is currently zero, then we *need* a readable event. -function doParallelLimit(fn) { - return function (obj, limit, iteratee, callback) { - return fn(_eachOfLimit(limit), obj, wrapAsync(iteratee), callback); - }; -} + if (state.length === 0) state.needReadable = true; // call internal read method -/** - * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time. - * - * @name mapLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.map]{@link module:Collections.map} - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an array of the - * transformed items from the `coll`. Invoked with (err, results). - */ -var mapLimit = doParallelLimit(_asyncMap); + this._read(state.highWaterMark); -/** - * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time. - * - * @name mapSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.map]{@link module:Collections.map} - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with the transformed item. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Results is an array of the - * transformed items from the `coll`. Invoked with (err, results). - */ -var mapSeries = doLimit(mapLimit, 1); + state.sync = false; // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. -/** - * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. - * - * @name applyEachSeries - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.applyEach]{@link module:ControlFlow.applyEach} - * @category Control Flow - * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all - * call with the same arguments - * @param {...*} [args] - any number of separate arguments to pass to the - * function. - * @param {Function} [callback] - the final argument should be the callback, - * called when all functions have completed processing. - * @returns {Function} - If only the first argument is provided, it will return - * a function which lets you pass in the arguments as if it were a single - * function call. - */ -var applyEachSeries = applyEach$1(mapSeries); + if (!state.reading) n = howMuchToRead(nOrig, state); + } -/** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ -function arrayEach(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length; + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; } - return array; -} -/** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ -function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; -} + if (nOrig !== n && state.ended) endReadable(this); + } -/** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ -var baseFor = createBaseFor(); + if (ret !== null) this.emit('data', ret); + return ret; +}; -/** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); -} +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; -/** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. - * - * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); + if (state.decoder) { + var chunk = state.decoder.end(); - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; } } - return -1; -} -/** - * The base implementation of `_.isNaN` without support for number objects. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. - */ -function baseIsNaN(value) { - return value !== value; -} + state.ended = true; -/** - * A specialized version of `_.indexOf` which performs strict equality - * comparisons of values, i.e. `===`. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function strictIndexOf(array, value, fromIndex) { - var index = fromIndex - 1, - length = array.length; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; - while (++index < length) { - if (array[index] === value) { - return index; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); } } - return -1; -} +} // Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. -/** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function baseIndexOf(array, value, fromIndex) { - return value === value - ? strictIndexOf(array, value, fromIndex) - : baseFindIndex(array, baseIsNaN, fromIndex); -} -/** - * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on - * their requirements. Each function can optionally depend on other functions - * being completed first, and each function is run as soon as its requirements - * are satisfied. - * - * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence - * will stop. Further tasks will not execute (so any other functions depending - * on it will not run), and the main `callback` is immediately called with the - * error. - * - * {@link AsyncFunction}s also receive an object containing the results of functions which - * have completed so far as the first argument, if they have dependencies. If a - * task function has no dependencies, it will only be passed a callback. - * - * @name auto - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Object} tasks - An object. Each of its properties is either a - * function or an array of requirements, with the {@link AsyncFunction} itself the last item - * in the array. The object's key of a property serves as the name of the task - * defined by that property, i.e. can be used when specifying requirements for - * other tasks. The function receives one or two arguments: - * * a `results` object, containing the results of the previously executed - * functions, only passed if the task has any dependencies, - * * a `callback(err, result)` function, which must be called when finished, - * passing an `error` (which can be `null`) and the result of the function's - * execution. - * @param {number} [concurrency=Infinity] - An optional `integer` for - * determining the maximum number of tasks that can be run in parallel. By - * default, as many as possible. - * @param {Function} [callback] - An optional callback which is called when all - * the tasks have been completed. It receives the `err` argument if any `tasks` - * pass an error to their callback. Results are always returned; however, if an - * error occurs, no further `tasks` will be performed, and the results object - * will only contain partial results. Invoked with (err, results). - * @returns undefined - * @example - * - * async.auto({ - * // this function will just be passed a callback - * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), - * showData: ['readData', function(results, cb) { - * // results.readData is the file's contents - * // ... - * }] - * }, callback); - * - * async.auto({ - * get_data: function(callback) { - * console.log('in get_data'); - * // async code to get some data - * callback(null, 'data', 'converted to array'); - * }, - * make_folder: function(callback) { - * console.log('in make_folder'); - * // async code to create a directory to store a file in - * // this is run at the same time as getting the data - * callback(null, 'folder'); - * }, - * write_file: ['get_data', 'make_folder', function(results, callback) { - * console.log('in write_file', JSON.stringify(results)); - * // once there is some data and the directory exists, - * // write the data to a file in the directory - * callback(null, 'filename'); - * }], - * email_link: ['write_file', function(results, callback) { - * console.log('in email_link', JSON.stringify(results)); - * // once the file is written let's email a link to it... - * // results.write_file contains the filename returned by write_file. - * callback(null, {'file':results.write_file, 'email':'user@example.com'}); - * }] - * }, function(err, results) { - * console.log('err = ', err); - * console.log('results = ', results); - * }); - */ -var auto = function (tasks, concurrency, callback) { - if (typeof concurrency === 'function') { - // concurrency is optional, shift the args. - callback = concurrency; - concurrency = null; - } - callback = once(callback || noop); - var keys$$1 = keys(tasks); - var numTasks = keys$$1.length; - if (!numTasks) { - return callback(null); - } - if (!concurrency) { - concurrency = numTasks; - } +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; - var results = {}; - var runningTasks = 0; - var hasError = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} - var listeners = Object.create(null); +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); - var readyTasks = []; + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. - // for cycle detection: - var readyToCheck = []; // tasks that have been identified as reachable - // without the possibility of returning to an ancestor task - var uncheckedDependencies = {}; - baseForOwn(tasks, function (task, key) { - if (!isArray(task)) { - // no dependencies - enqueueTask(key, [task]); - readyToCheck.push(key); - return; - } + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} // at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. - var dependencies = task.slice(0, task.length - 1); - var remainingDependencies = dependencies.length; - if (remainingDependencies === 0) { - enqueueTask(key, task); - readyToCheck.push(key); - return; - } - uncheckedDependencies[key] = remainingDependencies; - arrayEach(dependencies, function (dependencyName) { - if (!tasks[dependencyName]) { - throw new Error('async.auto task `' + key + - '` has a non-existent dependency `' + - dependencyName + '` in ' + - dependencies.join(', ')); - } - addListener(dependencyName, function () { - remainingDependencies--; - if (remainingDependencies === 0) { - enqueueTask(key, task); - } - }); - }); - }); +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} - checkForDeadlocks(); - processQueue(); +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) // didn't get any data, stop spinning. + break; + } - function enqueueTask(key, task) { - readyTasks.push(function () { - runTask(key, task); - }); - } + state.readingMore = false; +} // abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. - function processQueue() { - if (readyTasks.length === 0 && runningTasks === 0) { - return callback(null, results); - } - while(readyTasks.length && runningTasks < concurrency) { - var run = readyTasks.shift(); - run(); - } - } +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; - function addListener(taskName, fn) { - var taskListeners = listeners[taskName]; - if (!taskListeners) { - taskListeners = listeners[taskName] = []; - } - - taskListeners.push(fn); - } +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; - function taskComplete(taskName) { - var taskListeners = listeners[taskName] || []; - arrayEach(taskListeners, function (fn) { - fn(); - }); - processQueue(); - } + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; - function runTask(key, task) { - if (hasError) return; + default: + state.pipes.push(dest); + break; + } - var taskCallback = onlyOnce(function(err, result) { - runningTasks--; - if (arguments.length > 2) { - result = slice(arguments, 1); - } - if (err) { - var safeResults = {}; - baseForOwn(results, function(val, rkey) { - safeResults[rkey] = val; - }); - safeResults[key] = result; - hasError = true; - listeners = Object.create(null); + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); - callback(err, safeResults); - } else { - results[key] = result; - taskComplete(key); - } - }); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); - runningTasks++; - var taskFn = wrapAsync(task[task.length - 1]); - if (task.length > 1) { - taskFn(results, taskCallback); - } else { - taskFn(taskCallback); - } + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } } + } - function checkForDeadlocks() { - // Kahn's algorithm - // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm - // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html - var currentTask; - var counter = 0; - while (readyToCheck.length) { - currentTask = readyToCheck.pop(); - counter++; - arrayEach(getDependents(currentTask), function (dependent) { - if (--uncheckedDependencies[dependent] === 0) { - readyToCheck.push(dependent); - } - }); - } + function onend() { + debug('onend'); + dest.end(); + } // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. - if (counter !== numTasks) { - throw new Error( - 'async.auto cannot execute tasks due to a recursive dependency' - ); - } - } - function getDependents(taskName) { - var result = []; - baseForOwn(tasks, function (task, key) { - if (isArray(task) && baseIndexOf(task, taskName, 0) >= 0) { - result.push(key); - } - }); - return result; - } -}; + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; -/** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. - */ -function arrayMap(array, iteratee) { - var index = -1, - length = array == null ? 0 : array.length, - result = Array(length); + function cleanup() { + debug('cleanup'); // cleanup event handlers once the pipe is broken - while (++index < length) { - result[index] = iteratee(array[index], index, array); + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); } - return result; -} -/** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; + src.on('data', ondata); -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && baseGetTag(value) == symbolTag); -} + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0; + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined; -var symbolToString = symbolProto ? symbolProto.toString : undefined; + src.pause(); + } + } // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. -/** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ -function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isArray(value)) { - // Recursively convert values (susceptible to call stack limits). - return arrayMap(value, baseToString) + ''; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; -} -/** - * The base implementation of `_.slice` without an iteratee call guard. - * - * @private - * @param {Array} array The array to slice. - * @param {number} [start=0] The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the slice of `array`. - */ -function baseSlice(array, start, end) { - var index = -1, - length = array.length; + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } // Make sure our error handler is attached before userland ones. - if (start < 0) { - start = -start > length ? 0 : (length + start); - } - end = end > length ? length : end; - if (end < 0) { - end += length; + + prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. + + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); } - length = start > end ? 0 : ((end - start) >>> 0); - start >>>= 0; - var result = Array(length); - while (++index < length) { - result[index] = array[index + start]; + dest.once('close', onclose); + + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); } - return result; -} -/** - * Casts `array` to a slice if it's needed. - * - * @private - * @param {Array} array The array to inspect. - * @param {number} start The start position. - * @param {number} [end=array.length] The end position. - * @returns {Array} Returns the cast slice. - */ -function castSlice(array, start, end) { - var length = array.length; - end = end === undefined ? length : end; - return (!start && end >= length) ? array : baseSlice(array, start, end); -} + dest.once('finish', onfinish); -/** - * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the last unmatched string symbol. - */ -function charsEndIndex(strSymbols, chrSymbols) { - var index = strSymbols.length; + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } // tell the dest that it's being piped to - while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; -} -/** - * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol - * that is not found in the character symbols. - * - * @private - * @param {Array} strSymbols The string symbols to inspect. - * @param {Array} chrSymbols The character symbols to find. - * @returns {number} Returns the index of the first unmatched string symbol. - */ -function charsStartIndex(strSymbols, chrSymbols) { - var index = -1, - length = strSymbols.length; + dest.emit('pipe', src); // start the flow if it hasn't been started already. - while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} - return index; -} + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } -/** - * Converts an ASCII `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function asciiToArray(string) { - return string.split(''); + return dest; +}; + +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; } -/** Used to compose unicode character classes. */ -var rsAstralRange = '\\ud800-\\udfff'; -var rsComboMarksRange = '\\u0300-\\u036f'; -var reComboHalfMarksRange = '\\ufe20-\\ufe2f'; -var rsComboSymbolsRange = '\\u20d0-\\u20ff'; -var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; -var rsVarRange = '\\ufe0e\\ufe0f'; +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; // if we're not piping anywhere, then do nothing. -/** Used to compose unicode capture groups. */ -var rsZWJ = '\\u200d'; + if (state.pipesCount === 0) return this; // just one destination. most common case. -/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ -var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; // got a match. -/** - * Checks if `string` contains Unicode symbols. - * - * @private - * @param {string} string The string to inspect. - * @returns {boolean} Returns `true` if a symbol is found, else `false`. - */ -function hasUnicode(string) { - return reHasUnicode.test(string); -} + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } // slow case. multiple pipe destinations. -/** Used to compose unicode character classes. */ -var rsAstralRange$1 = '\\ud800-\\udfff'; -var rsComboMarksRange$1 = '\\u0300-\\u036f'; -var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f'; -var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff'; -var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1; -var rsVarRange$1 = '\\ufe0e\\ufe0f'; -/** Used to compose unicode capture groups. */ -var rsAstral = '[' + rsAstralRange$1 + ']'; -var rsCombo = '[' + rsComboRange$1 + ']'; -var rsFitz = '\\ud83c[\\udffb-\\udfff]'; -var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')'; -var rsNonAstral = '[^' + rsAstralRange$1 + ']'; -var rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}'; -var rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]'; -var rsZWJ$1 = '\\u200d'; + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; -/** Used to compose unicode regexes. */ -var reOptMod = rsModifier + '?'; -var rsOptVar = '[' + rsVarRange$1 + ']?'; -var rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*'; -var rsSeq = rsOptVar + reOptMod + rsOptJoin; -var rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + } -/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ -var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + return this; + } // try to find the right one. -/** - * Converts a Unicode `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function unicodeToArray(string) { - return string.match(reUnicode) || []; -} -/** - * Converts `string` to an array. - * - * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the converted array. - */ -function stringToArray(string) { - return hasUnicode(string) - ? unicodeToArray(string) - : asciiToArray(string); -} + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; // set up data events if they are asked for +// Ensure readable listeners eventually get something -/** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' - * - * _.toString([1, 2, 3]); - * // => '1,2,3' - */ -function toString(value) { - return value == null ? '' : baseToString(value); -} -/** Used to match leading and trailing whitespace. */ -var reTrim = /^\s+|\s+$/g; +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; -/** - * Removes leading and trailing whitespace or specified characters from `string`. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category String - * @param {string} [string=''] The string to trim. - * @param {string} [chars=whitespace] The characters to trim. - * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. - * @returns {string} Returns the trimmed string. - * @example - * - * _.trim(' abc '); - * // => 'abc' - * - * _.trim('-_-abc-_-', '_-'); - * // => 'abc' - * - * _.map([' foo ', ' bar '], _.trim); - * // => ['foo', 'bar'] - */ -function trim(string, chars, guard) { - string = toString(string); - if (string && (guard || chars === undefined)) { - return string.replace(reTrim, ''); - } - if (!string || !(chars = baseToString(chars))) { - return string; - } - var strSymbols = stringToArray(string), - chrSymbols = stringToArray(chars), - start = charsStartIndex(strSymbols, chrSymbols), - end = charsEndIndex(strSymbols, chrSymbols) + 1; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused - return castSlice(strSymbols, start, end).join(''); -} + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); -var FN_ARGS = /^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m; -var FN_ARG_SPLIT = /,/; -var FN_ARG = /(=.+)?(\s*)$/; -var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } -function parseParams(func) { - func = func.toString().replace(STRIP_COMMENTS, ''); - func = func.match(FN_ARGS)[2].replace(' ', ''); - func = func ? func.split(FN_ARG_SPLIT) : []; - func = func.map(function (arg){ - return trim(arg.replace(FN_ARG, '')); - }); - return func; -} + return res; +}; -/** - * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent - * tasks are specified as parameters to the function, after the usual callback - * parameter, with the parameter names matching the names of the tasks it - * depends on. This can provide even more readable task graphs which can be - * easier to maintain. - * - * If a final callback is specified, the task results are similarly injected, - * specified as named parameters after the initial error parameter. - * - * The autoInject function is purely syntactic sugar and its semantics are - * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. - * - * @name autoInject - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.auto]{@link module:ControlFlow.auto} - * @category Control Flow - * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of - * the form 'func([dependencies...], callback). The object's key of a property - * serves as the name of the task defined by that property, i.e. can be used - * when specifying requirements for other tasks. - * * The `callback` parameter is a `callback(err, result)` which must be called - * when finished, passing an `error` (which can be `null`) and the result of - * the function's execution. The remaining parameters name other tasks on - * which the task is dependent, and the results from those tasks are the - * arguments of those parameters. - * @param {Function} [callback] - An optional callback which is called when all - * the tasks have been completed. It receives the `err` argument if any `tasks` - * pass an error to their callback, and a `results` object with any completed - * task results, similar to `auto`. - * @example - * - * // The example from `auto` can be rewritten as follows: - * async.autoInject({ - * get_data: function(callback) { - * // async code to get some data - * callback(null, 'data', 'converted to array'); - * }, - * make_folder: function(callback) { - * // async code to create a directory to store a file in - * // this is run at the same time as getting the data - * callback(null, 'folder'); - * }, - * write_file: function(get_data, make_folder, callback) { - * // once there is some data and the directory exists, - * // write the data to a file in the directory - * callback(null, 'filename'); - * }, - * email_link: function(write_file, callback) { - * // once the file is written let's email a link to it... - * // write_file contains the filename returned by write_file. - * callback(null, {'file':write_file, 'email':'user@example.com'}); - * } - * }, function(err, results) { - * console.log('err = ', err); - * console.log('email_link = ', results.email_link); - * }); - * - * // If you are using a JS minifier that mangles parameter names, `autoInject` - * // will not work with plain functions, since the parameter names will be - * // collapsed to a single letter identifier. To work around this, you can - * // explicitly specify the names of the parameters your task function needs - * // in an array, similar to Angular.js dependency injection. - * - * // This still has an advantage over plain `auto`, since the results a task - * // depends on are still spread into arguments. - * async.autoInject({ - * //... - * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { - * callback(null, 'filename'); - * }], - * email_link: ['write_file', function(write_file, callback) { - * callback(null, {'file':write_file, 'email':'user@example.com'}); - * }] - * //... - * }, function(err, results) { - * console.log('err = ', err); - * console.log('email_link = ', results.email_link); - * }); - */ -function autoInject(tasks, callback) { - var newTasks = {}; +Readable.prototype.addListener = Readable.prototype.on; - baseForOwn(tasks, function (taskFn, key) { - var params; - var fnIsAsync = isAsync(taskFn); - var hasNoDeps = - (!fnIsAsync && taskFn.length === 1) || - (fnIsAsync && taskFn.length === 0); +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); - if (isArray(taskFn)) { - params = taskFn.slice(0, -1); - taskFn = taskFn[taskFn.length - 1]; + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } - newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); - } else if (hasNoDeps) { - // no dependencies, use the function as-is - newTasks[key] = taskFn; - } else { - params = parseParams(taskFn); - if (taskFn.length === 0 && !fnIsAsync && params.length === 0) { - throw new Error("autoInject task functions require explicit parameters."); - } + return res; +}; - // remove callback param - if (!fnIsAsync) params.pop(); +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); - newTasks[key] = params.concat(newTask); - } + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } - function newTask(results, taskCb) { - var newArgs = arrayMap(params, function (name) { - return results[name]; - }); - newArgs.push(taskCb); - wrapAsync(taskFn).apply(null, newArgs); - } - }); + return res; +}; - auto(newTasks, callback); -} +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; -// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation -// used for queues. This implementation assumes that the node provided by the user can be modified -// to adjust the next and last properties. We implement only the minimal functionality -// for queue support. -function DLL() { - this.head = this.tail = null; - this.length = 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } } -function setInitial(dll, node) { - dll.length = 1; - dll.head = dll.tail = node; -} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} // pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. -DLL.prototype.removeLink = function(node) { - if (node.prev) node.prev.next = node.next; - else this.head = node.next; - if (node.next) node.next.prev = node.prev; - else this.tail = node.prev; - node.prev = node.next = null; - this.length -= 1; - return node; -}; +Readable.prototype.resume = function () { + var state = this._readableState; -DLL.prototype.empty = function () { - while(this.head) this.shift(); - return this; -}; + if (!state.flowing) { + debug('resume'); // we flow only if there is no one listening + // for readable, but we still have to call + // resume() -DLL.prototype.insertAfter = function(node, newNode) { - newNode.prev = node; - newNode.next = node.next; - if (node.next) node.next.prev = newNode; - else this.tail = newNode; - node.next = newNode; - this.length += 1; -}; + state.flowing = !state.readableListening; + resume(this, state); + } -DLL.prototype.insertBefore = function(node, newNode) { - newNode.prev = node.prev; - newNode.next = node; - if (node.prev) node.prev.next = newNode; - else this.head = newNode; - node.prev = newNode; - this.length += 1; + state.paused = false; + return this; }; -DLL.prototype.unshift = function(node) { - if (this.head) this.insertBefore(this.head, node); - else setInitial(this, node); -}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} -DLL.prototype.push = function(node) { - if (this.tail) this.insertAfter(this.tail, node); - else setInitial(this, node); -}; +function resume_(stream, state) { + debug('resume', state.reading); -DLL.prototype.shift = function() { - return this.head && this.removeLink(this.head); -}; + if (!state.reading) { + stream.read(0); + } -DLL.prototype.pop = function() { - return this.tail && this.removeLink(this.tail); -}; + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} -DLL.prototype.toArray = function () { - var arr = Array(this.length); - var curr = this.head; - for(var idx = 0; idx < this.length; idx++) { - arr[idx] = curr.data; - curr = curr.next; - } - return arr; -}; +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); -DLL.prototype.remove = function (testFn) { - var curr = this.head; - while(!!curr) { - var next = curr.next; - if (testFn(curr)) { - this.removeLink(curr); - } - curr = next; - } - return this; + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + + this._readableState.paused = true; + return this; }; -function queue(worker, concurrency, payload) { - if (concurrency == null) { - concurrency = 1; - } - else if(concurrency === 0) { - throw new Error('Concurrency must not be zero'); - } +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); - var _worker = wrapAsync(worker); - var numRunning = 0; - var workersList = []; + while (state.flowing && stream.read() !== null) { + ; + } +} // wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. - var processingScheduled = false; - function _insert(data, insertAtFront, callback) { - if (callback != null && typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - q.started = true; - if (!isArray(data)) { - data = [data]; - } - if (data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - return setImmediate$1(function() { - q.drain(); - }); - } - for (var i = 0, l = data.length; i < l; i++) { - var item = { - data: data[i], - callback: callback || noop - }; +Readable.prototype.wrap = function (stream) { + var _this = this; - if (insertAtFront) { - q._tasks.unshift(item); - } else { - q._tasks.push(item); - } - } + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); - if (!processingScheduled) { - processingScheduled = true; - setImmediate$1(function() { - processingScheduled = false; - q.process(); - }); - } + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); } - function _next(tasks) { - return function(err){ - numRunning -= 1; - - for (var i = 0, l = tasks.length; i < l; i++) { - var task = tasks[i]; - - var index = baseIndexOf(workersList, task, 0); - if (index === 0) { - workersList.shift(); - } else if (index > 0) { - workersList.splice(index, 1); - } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode - task.callback.apply(task, arguments); + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - if (err != null) { - q.error(err, task.data); - } - } + var ret = _this.push(chunk); - if (numRunning <= (q.concurrency - q.buffer) ) { - q.unsaturated(); - } + if (!ret) { + paused = true; + stream.pause(); + } + }); // proxy all the other methods. + // important when wrapping filters and duplexes. - if (q.idle()) { - q.drain(); - } - q.process(); + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); }; + }(i); } + } // proxy certain important events. - var isProcessing = false; - var q = { - _tasks: new DLL(), - concurrency: concurrency, - payload: payload, - saturated: noop, - unsaturated:noop, - buffer: concurrency / 4, - empty: noop, - drain: noop, - error: noop, - started: false, - paused: false, - push: function (data, callback) { - _insert(data, false, callback); - }, - kill: function () { - q.drain = noop; - q._tasks.empty(); - }, - unshift: function (data, callback) { - _insert(data, true, callback); - }, - remove: function (testFn) { - q._tasks.remove(testFn); - }, - process: function () { - // Avoid trying to start too many processing operations. This can occur - // when callbacks resolve synchronously (#1267). - if (isProcessing) { - return; - } - isProcessing = true; - while(!q.paused && numRunning < q.concurrency && q._tasks.length){ - var tasks = [], data = []; - var l = q._tasks.length; - if (q.payload) l = Math.min(l, q.payload); - for (var i = 0; i < l; i++) { - var node = q._tasks.shift(); - tasks.push(node); - workersList.push(node); - data.push(node.data); - } - numRunning += 1; + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } // when we try to consume some more bytes, simply unpause the + // underlying stream. - if (q._tasks.length === 0) { - q.empty(); - } - if (numRunning === q.concurrency) { - q.saturated(); - } + this._read = function (n) { + debug('wrapped _read', n); - var cb = onlyOnce(_next(tasks)); - _worker(data, cb); - } - isProcessing = false; - }, - length: function () { - return q._tasks.length; - }, - running: function () { - return numRunning; - }, - workersList: function () { - return workersList; - }, - idle: function() { - return q._tasks.length + numRunning === 0; - }, - pause: function () { - q.paused = true; - }, - resume: function () { - if (q.paused === false) { return; } - q.paused = false; - setImmediate$1(q.process); - } - }; - return q; + if (paused) { + paused = false; + stream.resume(); + } + }; + + return this; +}; + +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = __webpack_require__(46); + } + + return createReadableStreamAsyncIterator(this); + }; } -/** - * A cargo of tasks for the worker function to complete. Cargo inherits all of - * the same methods and event callbacks as [`queue`]{@link module:ControlFlow.queue}. - * @typedef {Object} CargoObject - * @memberOf module:ControlFlow - * @property {Function} length - A function returning the number of items - * waiting to be processed. Invoke like `cargo.length()`. - * @property {number} payload - An `integer` for determining how many tasks - * should be process per round. This property can be changed after a `cargo` is - * created to alter the payload on-the-fly. - * @property {Function} push - Adds `task` to the `queue`. The callback is - * called once the `worker` has finished processing the task. Instead of a - * single task, an array of `tasks` can be submitted. The respective callback is - * used for every task in the list. Invoke like `cargo.push(task, [callback])`. - * @property {Function} saturated - A callback that is called when the - * `queue.length()` hits the concurrency and further tasks will be queued. - * @property {Function} empty - A callback that is called when the last item - * from the `queue` is given to a `worker`. - * @property {Function} drain - A callback that is called when the last item - * from the `queue` has returned from the `worker`. - * @property {Function} idle - a function returning false if there are items - * waiting or being processed, or true if not. Invoke like `cargo.idle()`. - * @property {Function} pause - a function that pauses the processing of tasks - * until `resume()` is called. Invoke like `cargo.pause()`. - * @property {Function} resume - a function that resumes the processing of - * queued tasks when the queue is paused. Invoke like `cargo.resume()`. - * @property {Function} kill - a function that removes the `drain` callback and - * empties remaining tasks from the queue forcing it to go idle. Invoke like `cargo.kill()`. +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); // exposed for testing purposes only. + +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); // Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. + +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} + +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. + + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} + +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = __webpack_require__(176); + } + + return from(Readable, iterable, opts); + }; +} + +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + + return -1; +} + +/***/ }), +/* 227 */, +/* 228 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const { stat } = __webpack_require__(747) +const { dirname, basename, normalize, sep } = __webpack_require__(622) + +const commonPathPrefix = __webpack_require__(963) +const glob = __webpack_require__(120) +const { not: notJunk } = __webpack_require__(556) +const pkgDir = __webpack_require__(942) +const unixify = __webpack_require__(305) +const promisify = __webpack_require__(799) + +const { startZip, addZipFile, addZipContent, endZip } = __webpack_require__(71) +const { getDependencies } = __webpack_require__(976) + +const pGlob = promisify(glob) +const pStat = promisify(stat) + +// Zip a Node.js function file +const zipNodeJs = async function(srcPath, srcDir, destPath, filename, mainFile, stat) { + const { archive, output } = startZip(destPath) + + const packageRoot = await pkgDir(srcDir) + + const files = await filesForFunctionZip(srcPath, filename, mainFile, packageRoot, stat) + const dirnames = files.map(dirname) + const commonPrefix = commonPathPrefix(dirnames) + + addEntryFile(commonPrefix, archive, filename, mainFile) + + await Promise.all(files.map(file => zipJsFile(file, commonPrefix, archive))) + + await endZip(archive, output) +} + +// Retrieve the paths to the files to zip. +// We only include the files actually needed by the function because AWS Lambda +// has a size limit for the zipped file. It also makes cold starts faster. +const filesForFunctionZip = async function(srcPath, filename, mainFile, packageRoot, stat) { + const [treeFiles, depFiles] = await Promise.all([getTreeFiles(srcPath, stat), getDependencies(mainFile, packageRoot)]) + const files = [...treeFiles, ...depFiles].map(normalize) + const uniqueFiles = [...new Set(files)] + const filteredFiles = uniqueFiles.filter(isNotJunk) + return filteredFiles +} + +// When using a directory, we include all its descendants except `node_modules` +const getTreeFiles = function(srcPath, stat) { + if (!stat.isDirectory()) { + return [srcPath] + } + + return pGlob(`${srcPath}/**`, { + ignore: `${srcPath}/**/node_modules/**`, + nodir: true, + absolute: true + }) +} + +// Remove temporary files like *~, *.swp, etc. +const isNotJunk = function(file) { + return notJunk(basename(file)) +} + +const addEntryFile = function(commonPrefix, archive, filename, mainFile) { + const mainPath = normalizeFilePath(mainFile, commonPrefix) + const content = Buffer.from(`module.exports = require('./${mainPath}')`) + const entryFilename = filename.endsWith('.js') ? filename : `${filename}.js` + + addZipContent(archive, content, entryFilename) +} + +const zipJsFile = async function(file, commonPrefix, archive) { + const filename = normalizeFilePath(file, commonPrefix) + const stat = await pStat(file) + addZipFile(archive, file, filename, stat) +} + +// `adm-zip` and `require()` expect Unix paths. +// We remove the common path prefix. +// With files on different Windows drives, we remove the drive letter. +const normalizeFilePath = function(path, commonPrefix) { + const pathA = normalize(path) + const pathB = pathA.replace(commonPrefix, `${ZIP_ROOT_DIR}${sep}`) + const pathC = unixify(pathB) + return pathC +} + +const ZIP_ROOT_DIR = 'src' + +module.exports = { zipNodeJs } + + +/***/ }), +/* 229 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause */ +var util = __webpack_require__(992); + /** - * Creates a `cargo` object with the specified payload. Tasks added to the - * cargo will be processed altogether (up to the `payload` limit). If the - * `worker` is in progress, the task is queued until it becomes available. Once - * the `worker` has completed some tasks, each callback of those tasks is - * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) - * for how `cargo` and `queue` work. - * - * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers - * at a time, cargo passes an array of tasks to a single worker, repeating - * when the worker is finished. - * - * @name cargo - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.queue]{@link module:ControlFlow.queue} - * @category Control Flow - * @param {AsyncFunction} worker - An asynchronous function for processing an array - * of queued tasks. Invoked with `(tasks, callback)`. - * @param {number} [payload=Infinity] - An optional `integer` for determining - * how many tasks should be processed per round; if omitted, the default is - * unlimited. - * @returns {module:ControlFlow.CargoObject} A cargo object to manage the tasks. Callbacks can - * attached as certain properties to listen for specific events during the - * lifecycle of the cargo and inner queue. - * @example - * - * // create a cargo object with payload 2 - * var cargo = async.cargo(function(tasks, callback) { - * for (var i=0; i lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; } /** - * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. - * - * @name eachOfSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.eachOf]{@link module:Collections.eachOf} - * @alias forEachOfSeries - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * Invoked with (item, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Invoked with (err). + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. */ -var eachOfSeries = doLimit(eachOfLimit, 1); +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} /** - * Reduces `coll` into a single value using an async `iteratee` to return each - * successive step. `memo` is the initial state of the reduction. This function - * only operates in series. - * - * For performance reasons, it may make sense to split a call to this function - * into a parallel map, and then use the normal `Array.prototype.reduce` on the - * results. This function is for situations where each step in the reduction - * needs to be async; if you can get the data before reducing it, then it's - * probably a good idea to do so. - * - * @name reduce - * @static - * @memberOf module:Collections - * @method - * @alias inject - * @alias foldl - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). - * @example + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. * - * async.reduce([1,2,3], 0, function(memo, item, callback) { - * // pointless async: - * process.nextTick(function() { - * callback(null, memo + item) - * }); - * }, function(err, result) { - * // result is now equal to the last value of memo, which is 6 - * }); + * NOTE: The order of the mappings is NOT guaranteed. */ -function reduce(coll, memo, iteratee, callback) { - callback = once(callback || noop); - var _iteratee = wrapAsync(iteratee); - eachOfSeries(coll, function(x, i, callback) { - _iteratee(memo, x, function(err, v) { - memo = v; - callback(err); - }); - }, function(err) { - callback(err, memo); - }); -} +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; /** - * Version of the compose function that is more natural to read. Each function - * consumes the return value of the previous function. It is the equivalent of - * [compose]{@link module:ControlFlow.compose} with the arguments reversed. - * - * Each function is executed with the `this` binding of the composed function. - * - * @name seq - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.compose]{@link module:ControlFlow.compose} - * @category Control Flow - * @param {...AsyncFunction} functions - the asynchronous functions to compose - * @returns {Function} a function that composes the `functions` in order - * @example + * Add the given source mapping. * - * // Requires lodash (or underscore), express3 and dresende's orm2. - * // Part of an app, that fetches cats of the logged user. - * // This example uses `seq` function to avoid overnesting and error - * // handling clutter. - * app.get('/cats', function(request, response) { - * var User = request.models.User; - * async.seq( - * _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - * function(user, fn) { - * user.getCats(fn); // 'getCats' has signature (callback(err, data)) - * } - * )(req.session.user_id, function (err, cats) { - * if (err) { - * console.error(err); - * response.json({ status: 'error', message: err.message }); - * } else { - * response.json({ status: 'ok', message: 'Cats found', data: cats }); - * } - * }); - * }); + * @param Object aMapping */ -function seq(/*...functions*/) { - var _functions = arrayMap(arguments, wrapAsync); - return function(/*...args*/) { - var args = slice(arguments); - var that = this; - - var cb = args[args.length - 1]; - if (typeof cb == 'function') { - args.pop(); - } else { - cb = noop; - } - - reduce(_functions, args, function(newargs, fn, cb) { - fn.apply(that, newargs.concat(function(err/*, ...nextargs*/) { - var nextargs = slice(arguments, 1); - cb(err, nextargs); - })); - }, - function(err, results) { - cb.apply(that, [err].concat(results)); - }); - }; -} +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; /** - * Creates a function which is a composition of the passed asynchronous - * functions. Each function consumes the return value of the function that - * follows. Composing functions `f()`, `g()`, and `h()` would produce the result - * of `f(g(h()))`, only this version uses callbacks to obtain the return values. - * - * Each function is executed with the `this` binding of the composed function. - * - * @name compose - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {...AsyncFunction} functions - the asynchronous functions to compose - * @returns {Function} an asynchronous function that is the composed - * asynchronous `functions` - * @example - * - * function add1(n, callback) { - * setTimeout(function () { - * callback(null, n + 1); - * }, 10); - * } - * - * function mul3(n, callback) { - * setTimeout(function () { - * callback(null, n * 3); - * }, 10); - * } + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. * - * var add1mul3 = async.compose(mul3, add1); - * add1mul3(4, function (err, result) { - * // result now equals 15 - * }); + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. */ -var compose = function(/*...args*/) { - return seq.apply(null, slice(arguments).reverse()); +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; }; -var _concat = Array.prototype.concat; +exports.MappingList = MappingList; -/** - * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time. - * - * @name concatLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, - * which should use an array as its result. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - */ -var concatLimit = function(coll, limit, iteratee, callback) { - callback = callback || noop; - var _iteratee = wrapAsync(iteratee); - mapLimit(coll, limit, function(val, callback) { - _iteratee(val, function(err /*, ...args*/) { - if (err) return callback(err); - return callback(null, slice(arguments, 1)); - }); - }, function(err, mapResults) { - var result = []; - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - result = _concat.apply(result, mapResults[i]); - } - } - return callback(err, result); - }); +/***/ }), +/* 230 */, +/* 231 */, +/* 232 */ +/***/ (function(module) { + +"use strict"; + // undocumented cb() API, needed for core, not for public API + +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + + return this; + } // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + + if (this._readableState) { + this._readableState.destroyed = true; + } // if this is a duplex stream mark the writable part as destroyed as well + + + if (this._writableState) { + this._writableState.destroyed = true; + } + + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + + return this; +} + +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} + +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} + +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} + +function emitErrorNT(self, err) { + self.emit('error', err); +} + +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} + +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy }; -/** - * Applies `iteratee` to each item in `coll`, concatenating the results. Returns - * the concatenated list. The `iteratee`s are called in parallel, and the - * results are concatenated as they return. There is no guarantee that the - * results array will be returned in the original order of `coll` passed to the - * `iteratee` function. - * - * @name concat - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, - * which should use an array as its result. Invoked with (item, callback). - * @param {Function} [callback(err)] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - * @example - * - * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) { - * // files is now a list of filenames that exist in the 3 directories - * }); - */ -var concat = doLimit(concatLimit, Infinity); +/***/ }), +/* 233 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time. - * - * @name concatSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.concat]{@link module:Collections.concat} - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`. - * The iteratee should complete with an array an array of results. - * Invoked with (item, callback). - * @param {Function} [callback(err)] - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is an array - * containing the concatenated results of the `iteratee` function. Invoked with - * (err, results). - */ -var concatSeries = doLimit(concatLimit, 1); +/* module decorator */ module = __webpack_require__.nmd(module); +(function (global, factory) { + true ? factory(exports) : + undefined; +}(this, (function (exports) { 'use strict'; + +function slice(arrayLike, start) { + start = start|0; + var newLen = Math.max(arrayLike.length - start, 0); + var newArr = Array(newLen); + for(var idx = 0; idx < newLen; idx++) { + newArr[idx] = arrayLike[start + idx]; + } + return newArr; +} /** - * Returns a function that when called, calls-back with the values provided. - * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to - * [`auto`]{@link module:ControlFlow.auto}. + * Creates a continuation function with some arguments already applied. * - * @name constant + * Useful as a shorthand when combined with other control flow functions. Any + * arguments passed to the returned function are added to the arguments + * originally passed to apply. + * + * @name apply * @static * @memberOf module:Utils * @method * @category Util - * @param {...*} arguments... - Any number of arguments to automatically invoke - * callback with. - * @returns {AsyncFunction} Returns a function that when invoked, automatically - * invokes the callback with the previous given arguments. + * @param {Function} fn - The function you want to eventually apply all + * arguments to. Invokes with (arguments...). + * @param {...*} arguments... - Any number of arguments to automatically apply + * when the continuation is called. + * @returns {Function} the partially-applied function * @example * - * async.waterfall([ - * async.constant(42), - * function (value, next) { - * // value === 42 - * }, - * //... - * ], callback); + * // using apply + * async.parallel([ + * async.apply(fs.writeFile, 'testfile1', 'test1'), + * async.apply(fs.writeFile, 'testfile2', 'test2') + * ]); * - * async.waterfall([ - * async.constant(filename, "utf8"), - * fs.readFile, - * function (fileData, next) { - * //... + * + * // the same process without using apply + * async.parallel([ + * function(callback) { + * fs.writeFile('testfile1', 'test1', callback); + * }, + * function(callback) { + * fs.writeFile('testfile2', 'test2', callback); * } - * //... - * ], callback); + * ]); * - * async.auto({ - * hostname: async.constant("https://server.net/"), - * port: findFreePort, - * launchServer: ["hostname", "port", function (options, cb) { - * startServer(options, cb); - * }], - * //... - * }, callback); + * // It's possible to pass any number of additional arguments when calling the + * // continuation: + * + * node> var fn = async.apply(sys.puts, 'one'); + * node> fn('two', 'three'); + * one + * two + * three */ -var constant = function(/*...values*/) { - var values = slice(arguments); - var args = [null].concat(values); - return function (/*...ignoredArgs, callback*/) { - var callback = arguments[arguments.length - 1]; - return callback.apply(this, args); +var apply = function(fn/*, ...args*/) { + var args = slice(arguments, 1); + return function(/*callArgs*/) { + var callArgs = slice(arguments); + return fn.apply(null, args.concat(callArgs)); + }; +}; + +var initialParams = function (fn) { + return function (/*...args, callback*/) { + var args = slice(arguments); + var callback = args.pop(); + fn.call(this, args, callback); }; }; /** - * This method returns the first argument it receives. + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static - * @since 0.1.0 * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * - * var object = { 'a': 1 }; + * _.isObject({}); + * // => true * - * console.log(_.identity(object) === object); + * _.isObject([1, 2, 3]); * // => true - */ -function identity(value) { - return value; -} - -function _createTester(check, getResult) { - return function(eachfn, arr, iteratee, cb) { - cb = cb || noop; - var testPassed = false; - var testResult; - eachfn(arr, function(value, _, callback) { - iteratee(value, function(err, result) { - if (err) { - callback(err); - } else if (check(result) && !testResult) { - testPassed = true; - testResult = getResult(true, value); - callback(null, breakLoop); - } else { - callback(); - } - }); - }, function(err) { - if (err) { - cb(err); - } else { - cb(null, testPassed ? testResult : getResult(false)); - } - }); - }; -} - -function _findGetResult(v, x) { - return x; -} - -/** - * Returns the first value in `coll` that passes an async truth test. The - * `iteratee` is applied in parallel, meaning the first iteratee to return - * `true` will fire the detect `callback` with that result. That means the - * result might not be the first item in the original `coll` (in terms of order) - * that passes the test. - - * If order within the original `coll` is important, then look at - * [`detectSeries`]{@link module:Collections.detectSeries}. * - * @name detect - * @static - * @memberOf module:Collections - * @method - * @alias find - * @category Collections - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - * @example + * _.isObject(_.noop); + * // => true * - * async.detect(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // result now equals the first file in the list that exists - * }); + * _.isObject(null); + * // => false */ -var detect = doParallel(_createTester(identity, _findGetResult)); +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); +} -/** - * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a - * time. - * - * @name detectLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findLimit - * @category Collections - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - */ -var detectLimit = doParallelLimit(_createTester(identity, _findGetResult)); +var hasSetImmediate = typeof setImmediate === 'function' && setImmediate; +var hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; -/** - * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. - * - * @name detectSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.detect]{@link module:Collections.detect} - * @alias findSeries - * @category Collections - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. - * The iteratee must complete with a boolean value as its result. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the `iteratee` functions have finished. - * Result will be the first item in the array that passes the truth test - * (iteratee) or the value `undefined` if none passed. Invoked with - * (err, result). - */ -var detectSeries = doLimit(detectLimit, 1); +function fallback(fn) { + setTimeout(fn, 0); +} -function consoleFunc(name) { +function wrap(defer) { return function (fn/*, ...args*/) { var args = slice(arguments, 1); - args.push(function (err/*, ...args*/) { - var args = slice(arguments, 1); - if (typeof console === 'object') { - if (err) { - if (console.error) { - console.error(err); - } - } else if (console[name]) { - arrayEach(args, function (x) { - console[name](x); - }); - } - } + defer(function () { + fn.apply(null, args); }); - wrapAsync(fn).apply(null, args); }; } +var _defer; + +if (hasSetImmediate) { + _defer = setImmediate; +} else if (hasNextTick) { + _defer = process.nextTick; +} else { + _defer = fallback; +} + +var setImmediate$1 = wrap(_defer); + /** - * Logs the result of an [`async` function]{@link AsyncFunction} to the - * `console` using `console.dir` to display the properties of the resulting object. - * Only works in Node.js or in browsers that support `console.dir` and - * `console.error` (such as FF and Chrome). - * If multiple arguments are returned from the async function, - * `console.dir` is called on each argument in order. + * Take a sync function and make it async, passing its return value to a + * callback. This is useful for plugging sync functions into a waterfall, + * series, or other async functions. Any arguments passed to the generated + * function will be passed to the wrapped function (except for the final + * callback argument). Errors thrown will be passed to the callback. * - * @name dir + * If the function passed to `asyncify` returns a Promise, that promises's + * resolved/rejected state will be used to call the callback, rather than simply + * the synchronous return value. + * + * This also means you can asyncify ES2017 `async` functions. + * + * @name asyncify * @static * @memberOf module:Utils * @method + * @alias wrapSync * @category Util - * @param {AsyncFunction} function - The function you want to eventually apply - * all arguments to. - * @param {...*} arguments... - Any number of arguments to apply to the function. + * @param {Function} func - The synchronous function, or Promise-returning + * function to convert to an {@link AsyncFunction}. + * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be + * invoked with `(args..., callback)`. * @example * - * // in a module - * var hello = function(name, callback) { - * setTimeout(function() { - * callback(null, {hello: name}); - * }, 1000); - * }; + * // passing a regular synchronous function + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(JSON.parse), + * function (data, next) { + * // data is the result of parsing the text. + * // If there was a parsing error, it would have been caught. + * } + * ], callback); * - * // in the node repl - * node> async.dir(hello, 'world'); - * {hello: 'world'} - */ -var dir = consoleFunc('dir'); - -/** - * The post-check version of [`during`]{@link module:ControlFlow.during}. To reflect the difference in - * the order of operations, the arguments `test` and `fn` are switched. + * // passing a function returning a promise + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(function (contents) { + * return db.model.create(contents); + * }), + * function (model, next) { + * // `model` is the instantiated model object. + * // If there was an error, this function would be skipped. + * } + * ], callback); * - * Also a version of [`doWhilst`]{@link module:ControlFlow.doWhilst} with asynchronous `test` function. - * @name doDuring - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.during]{@link module:ControlFlow.during} - * @category Control Flow - * @param {AsyncFunction} fn - An async function which is called each time - * `test` passes. Invoked with (callback). - * @param {AsyncFunction} test - asynchronous truth test to perform before each - * execution of `fn`. Invoked with (...args, callback), where `...args` are the - * non-error args from the previous callback of `fn`. - * @param {Function} [callback] - A callback which is called after the test - * function has failed and repeated execution of `fn` has stopped. `callback` - * will be passed an error if one occurred, otherwise `null`. + * // es2017 example, though `asyncify` is not needed if your JS environment + * // supports async functions out of the box + * var q = async.queue(async.asyncify(async function(file) { + * var intermediateStep = await processFile(file); + * return await somePromise(intermediateStep) + * })); + * + * q.push(files); */ -function doDuring(fn, test, callback) { - callback = onlyOnce(callback || noop); - var _fn = wrapAsync(fn); - var _test = wrapAsync(test); +function asyncify(func) { + return initialParams(function (args, callback) { + var result; + try { + result = func.apply(this, args); + } catch (e) { + return callback(e); + } + // if result is Promise object + if (isObject(result) && typeof result.then === 'function') { + result.then(function(value) { + invokeCallback(callback, null, value); + }, function(err) { + invokeCallback(callback, err.message ? err : new Error(err)); + }); + } else { + callback(null, result); + } + }); +} - function next(err/*, ...args*/) { - if (err) return callback(err); - var args = slice(arguments, 1); - args.push(check); - _test.apply(this, args); +function invokeCallback(callback, error, value) { + try { + callback(error, value); + } catch (e) { + setImmediate$1(rethrow, e); } +} - function check(err, truth) { - if (err) return callback(err); - if (!truth) return callback(null); - _fn(next); - } +function rethrow(error) { + throw error; +} - check(null, true); +var supportsSymbol = typeof Symbol === 'function'; +function isAsync(fn) { + return supportsSymbol && fn[Symbol.toStringTag] === 'AsyncFunction'; } -/** - * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in - * the order of operations, the arguments `test` and `iteratee` are switched. - * - * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - * - * @name doWhilst - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.whilst]{@link module:ControlFlow.whilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - A function which is called each time `test` - * passes. Invoked with (callback). - * @param {Function} test - synchronous truth test to perform after each - * execution of `iteratee`. Invoked with any non-error callback results of - * `iteratee`. - * @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]); - */ -function doWhilst(iteratee, test, callback) { - callback = onlyOnce(callback || noop); - var _iteratee = wrapAsync(iteratee); - var next = function(err/*, ...args*/) { - if (err) return callback(err); +function wrapAsync(asyncFn) { + return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; +} + +function applyEach$1(eachfn) { + return function(fns/*, ...args*/) { var args = slice(arguments, 1); - if (test.apply(this, args)) return _iteratee(next); - callback.apply(null, [null].concat(args)); + var go = initialParams(function(args, callback) { + var that = this; + return eachfn(fns, function (fn, cb) { + wrapAsync(fn).apply(that, args.concat(cb)); + }, callback); + }); + if (args.length) { + return go.apply(this, args); + } + else { + return go; + } }; - _iteratee(next); } +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** Built-in value references. */ +var Symbol$1 = root.Symbol; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; + /** - * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the - * argument ordering differs from `until`. - * - * @name doUntil - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.doWhilst]{@link module:ControlFlow.doWhilst} - * @category Control Flow - * @param {AsyncFunction} iteratee - An async function which is called each time - * `test` fails. Invoked with (callback). - * @param {Function} test - synchronous truth test to perform after each - * execution of `iteratee`. Invoked with any non-error callback results of - * `iteratee`. - * @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]); + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. */ -function doUntil(iteratee, test, callback) { - doWhilst(iteratee, function() { - return !test.apply(this, arguments); - }, callback); -} +var nativeObjectToString = objectProto.toString; + +/** Built-in value references. */ +var symToStringTag$1 = Symbol$1 ? Symbol$1.toStringTag : undefined; /** - * Like [`whilst`]{@link module:ControlFlow.whilst}, except the `test` is an asynchronous function that - * is passed a callback in the form of `function (err, truth)`. If error is - * passed to `test` or `fn`, the main callback is immediately called with the - * value of the error. - * - * @name during - * @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 `fn`. Invoked with (callback). - * @param {AsyncFunction} fn - 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 `fn` has stopped. `callback` - * will be passed an error, if one occurred, otherwise `null`. - * @example - * - * var count = 0; + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * - * async.during( - * function (callback) { - * return callback(null, count < 5); - * }, - * function (callback) { - * count++; - * setTimeout(callback, 1000); - * }, - * function (err) { - * // 5 seconds have passed - * } - * ); + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. */ -function during(test, fn, callback) { - callback = onlyOnce(callback || noop); - var _fn = wrapAsync(fn); - var _test = wrapAsync(test); +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag$1), + tag = value[symToStringTag$1]; - function next(err) { - if (err) return callback(err); - _test(check); - } + try { + value[symToStringTag$1] = undefined; + var unmasked = true; + } catch (e) {} - function check(err, truth) { - if (err) return callback(err); - if (!truth) return callback(null); - _fn(next); + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag$1] = tag; + } else { + delete value[symToStringTag$1]; } - - _test(check); + } + return result; } -function _withoutIndex(iteratee) { - return function (value, index, callback) { - return iteratee(value, callback); - }; -} +/** Used for built-in method references. */ +var objectProto$1 = Object.prototype; /** - * Applies the function `iteratee` to each item in `coll`, in parallel. - * The `iteratee` is called with an item from the list, and a callback for when - * it has finished. If the `iteratee` passes an error to its `callback`, the - * main `callback` (for the `each` function) is immediately called with the - * error. - * - * Note, that since this function applies `iteratee` to each item in parallel, - * there is no guarantee that the iteratee functions will complete in order. - * - * @name each - * @static - * @memberOf module:Collections - * @method - * @alias forEach - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to - * each item in `coll`. Invoked with (item, callback). - * The array index is not passed to the iteratee. - * If you need the index, use `eachOf`. - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). - * @example - * - * // assuming openFiles is an array of file names and saveFile is a function - * // to save the modified contents of that file: - * - * async.each(openFiles, saveFile, function(err){ - * // if any of the saves produced an error, err would equal that error - * }); - * - * // assuming openFiles is an array of file names - * async.each(openFiles, function(file, callback) { - * - * // Perform operation on file here. - * console.log('Processing file ' + file); - * - * if( file.length > 32 ) { - * console.log('This file name is too long'); - * callback('File name too long'); - * } else { - * // Do work to process file here - * console.log('File processed'); - * callback(); - * } - * }, function(err) { - * // if any of the file processing produced an error, err would equal that error - * if( err ) { - * // One of the iterations produced an error. - * // All processing will now stop. - * console.log('A file failed to process'); - * } else { - * console.log('All files have been processed successfully'); - * } - * }); + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. */ -function eachLimit(coll, iteratee, callback) { - eachOf(coll, _withoutIndex(wrapAsync(iteratee)), callback); -} +var nativeObjectToString$1 = objectProto$1.toString; /** - * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. + * Converts `value` to a string using `Object.prototype.toString`. * - * @name eachLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachLimit - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfLimit`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. */ -function eachLimit$1(coll, limit, iteratee, callback) { - _eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback); +function objectToString(value) { + return nativeObjectToString$1.call(value); } +/** `Object#toString` result references. */ +var nullTag = '[object Null]'; +var undefinedTag = '[object Undefined]'; + +/** Built-in value references. */ +var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined; + /** - * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. + * The base implementation of `getTag` without fallbacks for buggy environments. * - * @name eachSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.each]{@link module:Collections.each} - * @alias forEachSeries - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each - * item in `coll`. - * The array index is not passed to the iteratee. - * If you need the index, use `eachOfSeries`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called when all - * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. */ -var eachSeries = doLimit(eachLimit$1, 1); +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); +} + +/** `Object#toString` result references. */ +var asyncTag = '[object AsyncFunction]'; +var funcTag = '[object Function]'; +var genTag = '[object GeneratorFunction]'; +var proxyTag = '[object Proxy]'; /** - * Wrap an async function and ensure it calls its callback on a later tick of - * the event loop. If the function already calls its callback on a next tick, - * no extra deferral is added. This is useful for preventing stack overflows - * (`RangeError: Maximum call stack size exceeded`) and generally keeping - * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) - * contained. ES2017 `async` functions are returned as-is -- they are immune - * to Zalgo's corrupting influences, as they always resolve on a later tick. + * Checks if `value` is classified as a `Function` object. * - * @name ensureAsync * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - an async function, one that expects a node-style - * callback as its last argument. - * @returns {AsyncFunction} Returns a wrapped function with the exact same call - * signature as the function passed in. + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * - * function sometimesAsync(arg, callback) { - * if (cache[arg]) { - * return callback(null, cache[arg]); // this would be synchronous!! - * } else { - * doSomeIO(arg, callback); // this IO would be asynchronous - * } - * } - * - * // this has a risk of stack overflows if many results are cached in a row - * async.mapSeries(args, sometimesAsync, done); + * _.isFunction(_); + * // => true * - * // this will defer sometimesAsync's callback if necessary, - * // preventing stack overflows - * async.mapSeries(args, async.ensureAsync(sometimesAsync), done); + * _.isFunction(/abc/); + * // => false */ -function ensureAsync(fn) { - if (isAsync(fn)) return fn; - return initialParams(function (args, callback) { - var sync = true; - args.push(function () { - var innerArgs = arguments; - if (sync) { - setImmediate$1(function () { - callback.apply(null, innerArgs); - }); - } else { - callback.apply(null, innerArgs); - } - }); - fn.apply(this, args); - sync = false; - }); +function isFunction(value) { + if (!isObject(value)) { + return false; + } + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 9 which returns 'object' for typed arrays and other constructors. + var tag = baseGetTag(value); + return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } -function notId(v) { - return !v; -} +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; /** - * Returns `true` if every element in `coll` satisfies an async test. If any - * iteratee call returns `false`, the main `callback` is immediately called. + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * - * @name every * @static - * @memberOf module:Collections - * @method - * @alias all - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * - * async.every(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then every file exists - * }); - */ -var every = doParallel(_createTester(notId, notId)); - -/** - * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. + * _.isLength(3); + * // => true * - * @name everyLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allLimit - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in parallel. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false */ -var everyLimit = doParallelLimit(_createTester(notId, notId)); +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +} /** - * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * - * @name everySeries * @static - * @memberOf module:Collections - * @method - * @see [async.every]{@link module:Collections.every} - * @alias allSeries - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collection in series. - * The iteratee must complete with a boolean result value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result will be either `true` or `false` - * depending on the values of the async tests. Invoked with (err, result). - */ -var everySeries = doLimit(everyLimit, 1); - -/** - * The base implementation of `_.property` without support for deep paths. + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -function filterArray(eachfn, arr, iteratee, callback) { - var truthValues = new Array(arr.length); - eachfn(arr, function (x, index, callback) { - iteratee(x, function (err, v) { - truthValues[index] = !!v; - callback(err); - }); - }, function (err) { - if (err) return callback(err); - var results = []; - for (var i = 0; i < arr.length; i++) { - if (truthValues[i]) results.push(arr[i]); - } - callback(null, results); - }); -} - -function filterGeneric(eachfn, coll, iteratee, callback) { - var results = []; - eachfn(coll, function (x, index, callback) { - iteratee(x, function (err, v) { - if (err) { - callback(err); - } else { - if (v) { - results.push({index: index, value: x}); - } - callback(); - } - }); - }, function (err) { - if (err) { - callback(err); - } else { - callback(null, arrayMap(results.sort(function (a, b) { - return a.index - b.index; - }), baseProperty('value'))); - } - }); +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); } -function _filter(eachfn, coll, iteratee, callback) { - var filter = isArrayLike(coll) ? filterArray : filterGeneric; - filter(eachfn, coll, wrapAsync(iteratee), callback || noop); -} +// A temporary value used to identify if the loop should be broken. +// See #1064, #1293 +var breakLoop = {}; /** - * Returns a new array of all the values in `coll` which pass an async truth - * test. This operation is performed in parallel, but the results array will be - * in the same order as the original. + * This method returns `undefined`. * - * @name filter * @static - * @memberOf module:Collections - * @method - * @alias select - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). + * @memberOf _ + * @since 2.3.0 + * @category Util * @example * - * async.filter(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of the existing files - * }); + * _.times(2, _.noop); + * // => [undefined, undefined] */ -var filter = doParallel(_filter); +function noop() { + // No operation performed. +} -/** - * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a - * time. - * - * @name filterLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectLimit - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - */ -var filterLimit = doParallelLimit(_filter); +function once(fn) { + return function () { + if (fn === null) return; + var callFn = fn; + fn = null; + callFn.apply(this, arguments); + }; +} + +var iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator; + +var getIterator = function (coll) { + return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol](); +}; /** - * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. * - * @name filterSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.filter]{@link module:Collections.filter} - * @alias selectSeries - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - A truth test to apply to each item in `coll`. - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called - * with a boolean argument once it has completed. Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results) + * @private + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. */ -var filterSeries = doLimit(filterLimit, 1); +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); -/** - * Calls the asynchronous function `fn` with a callback parameter that allows it - * to call itself again, in series, indefinitely. + while (++index < n) { + result[index] = iteratee(index); + } + return result; +} - * If an error is passed to the callback then `errback` is called with the - * error, and execution stops, otherwise it will never be called. +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". * - * @name forever * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} fn - an async function to call repeatedly. - * Invoked with (next). - * @param {Function} [errback] - when `fn` passes an error to it's callback, - * this function will be called, and execution stops. Invoked with (err). + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * - * async.forever( - * function(next) { - * // next is suitable for passing to things that need a callback(err [, whatever]); - * // it will result in this function being called again. - * }, - * function(err) { - * // if next is called with a value in its first parameter, it will appear - * // in here as 'err', and execution will stop. - * } - * ); + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false */ -function forever(fn, errback) { - var done = onlyOnce(errback || noop); - var task = wrapAsync(ensureAsync(fn)); - - function next(err) { - if (err) return done(err); - task(next); - } - next(); +function isObjectLike(value) { + return value != null && typeof value == 'object'; } +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]'; + /** - * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time. + * The base implementation of `_.isArguments`. * - * @name groupByLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.groupBy]{@link module:Collections.groupBy} - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ -var groupByLimit = function(coll, limit, iteratee, callback) { - callback = callback || noop; - var _iteratee = wrapAsync(iteratee); - mapLimit(coll, limit, function(val, callback) { - _iteratee(val, function(err, key) { - if (err) return callback(err); - return callback(null, {key: key, val: val}); - }); - }, function(err, mapResults) { - var result = {}; - // from MDN, handle object having an `hasOwnProperty` prop - var hasOwnProperty = Object.prototype.hasOwnProperty; +function baseIsArguments(value) { + return isObjectLike(value) && baseGetTag(value) == argsTag; +} - for (var i = 0; i < mapResults.length; i++) { - if (mapResults[i]) { - var key = mapResults[i].key; - var val = mapResults[i].val; +/** Used for built-in method references. */ +var objectProto$3 = Object.prototype; - if (hasOwnProperty.call(result, key)) { - result[key].push(val); - } else { - result[key] = [val]; - } - } - } +/** Used to check objects for own properties. */ +var hasOwnProperty$2 = objectProto$3.hasOwnProperty; - return callback(err, result); - }); -}; +/** Built-in value references. */ +var propertyIsEnumerable = objectProto$3.propertyIsEnumerable; /** - * Returns a new object, where each value corresponds to an array of items, from - * `coll`, that returned the corresponding key. That is, the keys of the object - * correspond to the values passed to the `iteratee` callback. - * - * Note: Since this function applies the `iteratee` to each item in parallel, - * there is no guarantee that the `iteratee` functions will complete in order. - * However, the values for each key in the `result` will be in the same order as - * the original `coll`. For Objects, the values will roughly be in the order of - * the original Objects' keys (but this can vary across JavaScript engines). + * Checks if `value` is likely an `arguments` object. * - * @name groupBy * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. * @example * - * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { - * db.findById(userId, function(err, user) { - * if (err) return callback(err); - * return callback(null, user.age); - * }); - * }, function(err, result) { - * // result is object containing the userIds grouped by age - * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; - * }); - */ -var groupBy = doLimit(groupByLimit, Infinity); - -/** - * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time. + * _.isArguments(function() { return arguments; }()); + * // => true * - * @name groupBySeries - * @static - * @memberOf module:Collections - * @method - * @see [async.groupBy]{@link module:Collections.groupBy} - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a `key` to group the value under. - * Invoked with (value, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. Result is an `Object` whoses - * properties are arrays of values which returned the corresponding key. + * _.isArguments([1, 2, 3]); + * // => false */ -var groupBySeries = doLimit(groupByLimit, 1); +var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { + return isObjectLike(value) && hasOwnProperty$2.call(value, 'callee') && + !propertyIsEnumerable.call(value, 'callee'); +}; /** - * Logs the result of an `async` function to the `console`. Only works in - * Node.js or in browsers that support `console.log` and `console.error` (such - * as FF and Chrome). If multiple arguments are returned from the async - * function, `console.log` is called on each argument in order. + * Checks if `value` is classified as an `Array` object. * - * @name log * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} function - The function you want to eventually apply - * all arguments to. - * @param {...*} arguments... - Any number of arguments to apply to the function. + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * - * // in a module - * var hello = function(name, callback) { - * setTimeout(function() { - * callback(null, 'hello ' + name); - * }, 1000); - * }; + * _.isArray([1, 2, 3]); + * // => true * - * // in the node repl - * node> async.log(hello, 'world'); - * 'hello world' + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false */ -var log = consoleFunc('log'); +var isArray = Array.isArray; /** - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a - * time. + * This method returns `false`. * - * @name mapValuesLimit * @static - * @memberOf module:Collections - * @method - * @see [async.mapValues]{@link module:Collections.mapValues} - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). + * @memberOf _ + * @since 4.13.0 + * @category Util + * @returns {boolean} Returns `false`. + * @example + * + * _.times(2, _.stubFalse); + * // => [false, false] */ -function mapValuesLimit(obj, limit, iteratee, callback) { - callback = once(callback || noop); - var newObj = {}; - var _iteratee = wrapAsync(iteratee); - eachOfLimit(obj, limit, function(val, key, next) { - _iteratee(val, key, function (err, result) { - if (err) return next(err); - newObj[key] = result; - next(); - }); - }, function (err) { - callback(err, newObj); - }); +function stubFalse() { + return false; } +/** Detect free variable `exports`. */ +var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; + +/** Built-in value references. */ +var Buffer = moduleExports ? root.Buffer : undefined; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined; + /** - * A relative of [`map`]{@link module:Collections.map}, designed for use with objects. - * - * Produces a new Object by mapping each value of `obj` through the `iteratee` - * function. The `iteratee` is called each `value` and `key` from `obj` and a - * callback for when it has finished processing. Each of these callbacks takes - * two arguments: an `error`, and the transformed item from `obj`. If `iteratee` - * passes an error to its callback, the main `callback` (for the `mapValues` - * function) is immediately called with the error. - * - * Note, the order of the keys in the result is not guaranteed. The keys will - * be roughly in the order they complete, (but this is very engine-specific) + * Checks if `value` is a buffer. * - * @name mapValues * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). + * @memberOf _ + * @since 4.3.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * - * async.mapValues({ - * f1: 'file1', - * f2: 'file2', - * f3: 'file3' - * }, function (file, key, callback) { - * fs.stat(file, callback); - * }, function(err, result) { - * // result is now a map of stats for each file, e.g. - * // { - * // f1: [stats for file1], - * // f2: [stats for file2], - * // f3: [stats for file3] - * // } - * }); + * _.isBuffer(new Buffer(2)); + * // => true + * + * _.isBuffer(new Uint8Array(2)); + * // => false */ +var isBuffer = nativeIsBuffer || stubFalse; -var mapValues = doLimit(mapValuesLimit, Infinity); +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER$1 = 9007199254740991; + +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; /** - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time. + * Checks if `value` is a valid array-like index. * - * @name mapValuesSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.mapValues]{@link module:Collections.mapValues} - * @category Collection - * @param {Object} obj - A collection to iterate over. - * @param {AsyncFunction} iteratee - A function to apply to each value and key - * in `coll`. - * The iteratee should complete with the transformed value as its result. - * Invoked with (value, key, callback). - * @param {Function} [callback] - A callback which is called when all `iteratee` - * functions have finished, or an error occurs. `result` is a new object consisting - * of each key from `obj`, with each transformed value on the right-hand side. - * Invoked with (err, result). + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ -var mapValuesSeries = doLimit(mapValuesLimit, 1); +function isIndex(value, length) { + var type = typeof value; + length = length == null ? MAX_SAFE_INTEGER$1 : length; -function has(obj, key) { - return key in obj; + return !!length && + (type == 'number' || + (type != 'symbol' && reIsUint.test(value))) && + (value > -1 && value % 1 == 0 && value < length); } +/** `Object#toString` result references. */ +var argsTag$1 = '[object Arguments]'; +var arrayTag = '[object Array]'; +var boolTag = '[object Boolean]'; +var dateTag = '[object Date]'; +var errorTag = '[object Error]'; +var funcTag$1 = '[object Function]'; +var mapTag = '[object Map]'; +var numberTag = '[object Number]'; +var objectTag = '[object Object]'; +var regexpTag = '[object RegExp]'; +var setTag = '[object Set]'; +var stringTag = '[object String]'; +var weakMapTag = '[object WeakMap]'; + +var arrayBufferTag = '[object ArrayBuffer]'; +var dataViewTag = '[object DataView]'; +var float32Tag = '[object Float32Array]'; +var float64Tag = '[object Float64Array]'; +var int8Tag = '[object Int8Array]'; +var int16Tag = '[object Int16Array]'; +var int32Tag = '[object Int32Array]'; +var uint8Tag = '[object Uint8Array]'; +var uint8ClampedTag = '[object Uint8ClampedArray]'; +var uint16Tag = '[object Uint16Array]'; +var uint32Tag = '[object Uint32Array]'; + +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag$1] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; + /** - * Caches the results of an async function. When creating a hash to store - * function results against, the callback is omitted from the hash and an - * optional hash function can be used. - * - * If no hash function is specified, the first argument is used as a hash key, - * which may work reasonably if it is a string or a data type that converts to a - * distinct string. Note that objects and arrays will not behave reasonably. - * Neither will cases where the other arguments are significant. In such cases, - * specify your own hash function. - * - * The cache of results is exposed as the `memo` property of the function - * returned by `memoize`. - * - * @name memoize - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} fn - The async function to proxy and cache results from. - * @param {Function} hasher - An optional function for generating a custom hash - * for storing results. It has all the arguments applied to it apart from the - * callback, and must be synchronous. - * @returns {AsyncFunction} a memoized version of `fn` - * @example - * - * var slow_fn = function(name, callback) { - * // do something - * callback(null, result); - * }; - * var fn = async.memoize(slow_fn); + * The base implementation of `_.isTypedArray` without Node.js optimizations. * - * // fn can now be used as if it were slow_fn - * fn('some name', function() { - * // callback - * }); + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ -function memoize(fn, hasher) { - var memo = Object.create(null); - var queues = Object.create(null); - hasher = hasher || identity; - var _fn = wrapAsync(fn); - var memoized = initialParams(function memoized(args, callback) { - var key = hasher.apply(null, args); - if (has(memo, key)) { - setImmediate$1(function() { - callback.apply(null, memo[key]); - }); - } else if (has(queues, key)) { - queues[key].push(callback); - } else { - queues[key] = [callback]; - _fn.apply(null, args.concat(function(/*args*/) { - var args = slice(arguments); - memo[key] = args; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, args); - } - })); - } - }); - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** - * Calls `callback` on a later loop around the event loop. In Node.js this just - * calls `process.nextTick`. In the browser it will use `setImmediate` if - * available, otherwise `setTimeout(callback, 0)`, which means other higher - * priority events may precede the execution of `callback`. + * The base implementation of `_.unary` without support for storing metadata. * - * This is used internally for browser-compatibility purposes. + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} + +/** Detect free variable `exports`. */ +var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports; + +/** Detect free variable `module`. */ +var freeModule$1 = freeExports$1 && "object" == 'object' && module && !module.nodeType && module; + +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1; + +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports$1 && freeGlobal.process; + +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + // Use `util.types` for Node.js 10+. + var types = freeModule$1 && freeModule$1.require && freeModule$1.require('util').types; + + if (types) { + return types; + } + + // Legacy `process.binding('util')` for Node.js < 10. + return freeProcess && freeProcess.binding && freeProcess.binding('util'); + } catch (e) {} +}()); + +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; + +/** + * Checks if `value` is classified as a typed array. * - * @name nextTick * @static - * @memberOf module:Utils - * @method - * @see [async.setImmediate]{@link module:Utils.setImmediate} - * @category Util - * @param {Function} callback - The function to call on a later loop around - * the event loop. Invoked with (args...). - * @param {...*} args... - any number of additional arguments to pass to the - * callback on the next tick. + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * - * var call_order = []; - * async.nextTick(function() { - * call_order.push('two'); - * // call_order now equals ['one','two'] - * }); - * call_order.push('one'); + * _.isTypedArray(new Uint8Array); + * // => true * - * async.setImmediate(function (a, b, c) { - * // a, b, and c equal 1, 2, and 3 - * }, 1, 2, 3); + * _.isTypedArray([]); + * // => false */ -var _defer$1; +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; -if (hasNextTick) { - _defer$1 = process.nextTick; -} else if (hasSetImmediate) { - _defer$1 = setImmediate; -} else { - _defer$1 = fallback; -} +/** Used for built-in method references. */ +var objectProto$2 = Object.prototype; -var nextTick = wrap(_defer$1); +/** Used to check objects for own properties. */ +var hasOwnProperty$1 = objectProto$2.hasOwnProperty; -function _parallel(eachfn, tasks, callback) { - callback = callback || noop; - var results = isArrayLike(tasks) ? [] : {}; +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + var isArr = isArray(value), + isArg = !isArr && isArguments(value), + isBuff = !isArr && !isArg && isBuffer(value), + isType = !isArr && !isArg && !isBuff && isTypedArray(value), + skipIndexes = isArr || isArg || isBuff || isType, + result = skipIndexes ? baseTimes(value.length, String) : [], + length = result.length; - eachfn(tasks, function (task, key, callback) { - wrapAsync(task)(function (err, result) { - if (arguments.length > 2) { - result = slice(arguments, 1); - } - results[key] = result; - callback(err); - }); - }, function (err) { - callback(err, results); - }); + for (var key in value) { + if ((inherited || hasOwnProperty$1.call(value, key)) && + !(skipIndexes && ( + // Safari 9 has enumerable `arguments.length` in strict mode. + key == 'length' || + // Node.js 0.10 has enumerable non-index properties on buffers. + (isBuff && (key == 'offset' || key == 'parent')) || + // PhantomJS 2 has enumerable non-index properties on typed arrays. + (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || + // Skip index properties. + isIndex(key, length) + ))) { + result.push(key); + } + } + return result; } +/** Used for built-in method references. */ +var objectProto$5 = Object.prototype; + /** - * Run the `tasks` collection of functions in parallel, without waiting until - * the previous function has completed. If any of the functions pass an error to - * its callback, the main `callback` is immediately called with the value of the - * error. Once the `tasks` have completed, the results are passed to the final - * `callback` as an array. - * - * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about - * parallel execution of code. If your tasks do not use any timers or perform - * any I/O, they will actually be executed in series. Any synchronous setup - * sections for each task will happen one after the other. JavaScript remains - * single-threaded. - * - * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the - * execution of other tasks when a task fails. - * - * It is also possible to use an object instead of an array. Each property will - * be run as a function and the results will be passed to the final `callback` - * as an object instead of an array. This can be a more readable way of handling - * results from {@link async.parallel}. - * - * @name parallel - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|Object} tasks - A collection of - * [async functions]{@link AsyncFunction} to run. - * Each async function can complete with any number of optional `result` values. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed successfully. This function gets a results array - * (or object) containing all the result arguments passed to the task callbacks. - * Invoked with (err, results). - * - * @example - * async.parallel([ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ], - * // optional callback - * function(err, results) { - * // the results array will equal ['one','two'] even though - * // the second function had a shorter timeout. - * }); + * Checks if `value` is likely a prototype object. * - * // an example using an object instead of an array - * async.parallel({ - * one: function(callback) { - * setTimeout(function() { - * callback(null, 1); - * }, 200); - * }, - * two: function(callback) { - * setTimeout(function() { - * callback(null, 2); - * }, 100); - * } - * }, function(err, results) { - * // results is now equals to: {one: 1, two: 2} - * }); + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ -function parallelLimit(tasks, callback) { - _parallel(eachOf, tasks, callback); +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5; + + return value === proto; } /** - * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a - * time. + * Creates a unary function that invokes `func` with its argument transformed. * - * @name parallelLimit - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.parallel]{@link module:ControlFlow.parallel} - * @category Control Flow - * @param {Array|Iterable|Object} tasks - A collection of - * [async functions]{@link AsyncFunction} to run. - * Each async function can complete with any number of optional `result` values. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed successfully. This function gets a results array - * (or object) containing all the result arguments passed to the task callbacks. - * Invoked with (err, results). + * @private + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. */ -function parallelLimit$1(tasks, limit, callback) { - _parallel(_eachOfLimit(limit), tasks, callback); +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); + }; } +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeKeys = overArg(Object.keys, Object); + +/** Used for built-in method references. */ +var objectProto$4 = Object.prototype; + +/** Used to check objects for own properties. */ +var hasOwnProperty$3 = objectProto$4.hasOwnProperty; + /** - * A queue of tasks for the worker function to complete. - * @typedef {Object} QueueObject - * @memberOf module:ControlFlow - * @property {Function} length - a function returning the number of items - * waiting to be processed. Invoke with `queue.length()`. - * @property {boolean} started - a boolean indicating whether or not any - * items have been pushed and processed by the queue. - * @property {Function} running - a function returning the number of items - * currently being processed. Invoke with `queue.running()`. - * @property {Function} workersList - a function returning the array of items - * currently being processed. Invoke with `queue.workersList()`. - * @property {Function} idle - a function returning false if there are items - * waiting or being processed, or true if not. Invoke with `queue.idle()`. - * @property {number} concurrency - an integer for determining how many `worker` - * functions should be run in parallel. This property can be changed after a - * `queue` is created to alter the concurrency on-the-fly. - * @property {Function} push - add a new task to the `queue`. Calls `callback` - * once the `worker` has finished processing the task. Instead of a single task, - * a `tasks` array can be submitted. The respective callback is used for every - * task in the list. Invoke with `queue.push(task, [callback])`, - * @property {Function} unshift - add a new task to the front of the `queue`. - * Invoke with `queue.unshift(task, [callback])`. - * @property {Function} remove - remove items from the queue that match a test - * function. The test function will be passed an object with a `data` property, - * and a `priority` property, if this is a - * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. - * Invoked with `queue.remove(testFn)`, where `testFn` is of the form - * `function ({data, priority}) {}` and returns a Boolean. - * @property {Function} saturated - a callback that is called when the number of - * running workers hits the `concurrency` limit, and further tasks will be - * queued. - * @property {Function} unsaturated - a callback that is called when the number - * of running workers is less than the `concurrency` & `buffer` limits, and - * further tasks will not be queued. - * @property {number} buffer - A minimum threshold buffer in order to say that - * the `queue` is `unsaturated`. - * @property {Function} empty - a callback that is called when the last item - * from the `queue` is given to a `worker`. - * @property {Function} drain - a callback that is called when the last item - * from the `queue` has returned from the `worker`. - * @property {Function} error - a callback that is called when a task errors. - * Has the signature `function(error, task)`. - * @property {boolean} paused - a boolean for determining whether the queue is - * in a paused state. - * @property {Function} pause - a function that pauses the processing of tasks - * until `resume()` is called. Invoke with `queue.pause()`. - * @property {Function} resume - a function that resumes the processing of - * queued tasks when the queue is paused. Invoke with `queue.resume()`. - * @property {Function} kill - a function that removes the `drain` callback and - * empties remaining tasks from the queue forcing it to go idle. No more tasks - * should be pushed to the queue after calling this function. Invoke with `queue.kill()`. + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty$3.call(object, key) && key != 'constructor') { + result.push(key); + } + } + return result; +} /** - * Creates a `queue` object with the specified `concurrency`. Tasks added to the - * `queue` are processed in parallel (up to the `concurrency` limit). If all - * `worker`s are in progress, the task is queued until one becomes available. - * Once a `worker` completes a `task`, that `task`'s callback is called. + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. * - * @name queue * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {AsyncFunction} worker - An async function for processing a queued task. - * If you want to handle errors from an individual task, pass a callback to - * `q.push()`. Invoked with (task, callback). - * @param {number} [concurrency=1] - An `integer` for determining how many - * `worker` functions should be run in parallel. If omitted, the concurrency - * defaults to `1`. If the concurrency is `0`, an error is thrown. - * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can - * attached as certain properties to listen for specific events during the - * lifecycle of the queue. + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. * @example * - * // create a queue object with concurrency 2 - * var q = async.queue(function(task, callback) { - * console.log('hello ' + task.name); - * callback(); - * }, 2); - * - * // assign a callback - * q.drain = function() { - * console.log('all items have been processed'); - * }; + * function Foo() { + * this.a = 1; + * this.b = 2; + * } * - * // add some items to the queue - * q.push({name: 'foo'}, function(err) { - * console.log('finished processing foo'); - * }); - * q.push({name: 'bar'}, function (err) { - * console.log('finished processing bar'); - * }); + * Foo.prototype.c = 3; * - * // add some items to the queue (batch-wise) - * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) { - * console.log('finished processing item'); - * }); + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) * - * // add some items to the front of the queue - * q.unshift({name: 'bar'}, function (err) { - * console.log('finished processing bar'); - * }); + * _.keys('hi'); + * // => ['0', '1'] */ -var queue$1 = function (worker, concurrency) { - var _worker = wrapAsync(worker); - return queue(function (items, cb) { - _worker(items[0], cb); - }, concurrency, 1); -}; +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +} -/** - * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and - * completed in ascending priority order. - * - * @name priorityQueue - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.queue]{@link module:ControlFlow.queue} - * @category Control Flow - * @param {AsyncFunction} worker - An async function for processing a queued task. - * If you want to handle errors from an individual task, pass a callback to - * `q.push()`. - * Invoked with (task, callback). - * @param {number} concurrency - An `integer` for determining how many `worker` - * functions should be run in parallel. If omitted, the concurrency defaults to - * `1`. If the concurrency is `0`, an error is thrown. - * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two - * differences between `queue` and `priorityQueue` objects: - * * `push(task, priority, [callback])` - `priority` should be a number. If an - * array of `tasks` is given, all tasks will be assigned the same priority. - * * The `unshift` method was removed. - */ -var priorityQueue = function(worker, concurrency) { - // Start with a normal queue - var q = queue$1(worker, concurrency); +function createArrayIterator(coll) { + var i = -1; + var len = coll.length; + return function next() { + return ++i < len ? {value: coll[i], key: i} : null; + } +} - // Override push to accept second parameter representing priority - q.push = function(data, priority, callback) { - if (callback == null) callback = noop; - if (typeof callback !== 'function') { - throw new Error('task callback must be a function'); - } - q.started = true; - if (!isArray(data)) { - data = [data]; - } - if (data.length === 0) { - // call drain immediately if there are no tasks - return setImmediate$1(function() { - q.drain(); - }); - } +function createES2015Iterator(iterator) { + var i = -1; + return function next() { + var item = iterator.next(); + if (item.done) + return null; + i++; + return {value: item.value, key: i}; + } +} - priority = priority || 0; - var nextNode = q._tasks.head; - while (nextNode && priority >= nextNode.priority) { - nextNode = nextNode.next; - } +function createObjectIterator(obj) { + var okeys = keys(obj); + var i = -1; + var len = okeys.length; + return function next() { + var key = okeys[++i]; + return i < len ? {value: obj[key], key: key} : null; + }; +} - for (var i = 0, l = data.length; i < l; i++) { - var item = { - data: data[i], - priority: priority, - callback: callback - }; +function iterator(coll) { + if (isArrayLike(coll)) { + return createArrayIterator(coll); + } - if (nextNode) { - q._tasks.insertBefore(nextNode, item); - } else { - q._tasks.push(item); + var iterator = getIterator(coll); + return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); +} + +function onlyOnce(fn) { + return function() { + if (fn === null) throw new Error("Callback was already called."); + var callFn = fn; + fn = null; + callFn.apply(this, arguments); + }; +} + +function _eachOfLimit(limit) { + return function (obj, iteratee, callback) { + callback = once(callback || noop); + if (limit <= 0 || !obj) { + return callback(null); + } + var nextElem = iterator(obj); + var done = false; + var running = 0; + var looping = false; + + function iterateeCallback(err, value) { + running -= 1; + if (err) { + done = true; + callback(err); + } + else if (value === breakLoop || (done && running <= 0)) { + done = true; + return callback(null); + } + else if (!looping) { + replenish(); } } - setImmediate$1(q.process); - }; - // Remove unshift function - delete q.unshift; + function replenish () { + looping = true; + while (running < limit && !done) { + var elem = nextElem(); + if (elem === null) { + done = true; + if (running <= 0) { + callback(null); + } + return; + } + running += 1; + iteratee(elem.value, elem.key, onlyOnce(iterateeCallback)); + } + looping = false; + } - return q; -}; + replenish(); + }; +} /** - * Runs the `tasks` array of functions in parallel, without waiting until the - * previous function has completed. Once any of the `tasks` complete or pass an - * error to its callback, the main `callback` is immediately called. It's - * equivalent to `Promise.race()`. + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a + * time. * - * @name race + * @name eachOfLimit * @static - * @memberOf module:ControlFlow + * @memberOf module:Collections * @method - * @category Control Flow - * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction} - * to run. Each function can complete with an optional `result` value. - * @param {Function} callback - A callback to run once any of the functions have - * completed. This function gets an error or result from the first function that - * completed. Invoked with (err, result). - * @returns undefined - * @example - * - * async.race([ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ], - * // main callback - * function(err, result) { - * // the result will be equal to 'two' as it finishes earlier - * }); + * @see [async.eachOf]{@link module:Collections.eachOf} + * @alias forEachOfLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. The `key` is the item's key, or index in the case of an + * array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). */ -function race(tasks, callback) { +function eachOfLimit(coll, limit, iteratee, callback) { + _eachOfLimit(limit)(coll, wrapAsync(iteratee), callback); +} + +function doLimit(fn, limit) { + return function (iterable, iteratee, callback) { + return fn(iterable, limit, iteratee, callback); + }; +} + +// eachOf implementation optimized for array-likes +function eachOfArrayLike(coll, iteratee, callback) { callback = once(callback || noop); - if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); - if (!tasks.length) return callback(); - for (var i = 0, l = tasks.length; i < l; i++) { - wrapAsync(tasks[i])(callback); + var index = 0, + completed = 0, + length = coll.length; + if (length === 0) { + callback(null); + } + + function iteratorCallback(err, value) { + if (err) { + callback(err); + } else if ((++completed === length) || value === breakLoop) { + callback(null); + } + } + + for (; index < length; index++) { + iteratee(coll[index], index, onlyOnce(iteratorCallback)); } } +// a generic version of eachOf which can handle array, object, and iterator cases. +var eachOfGeneric = doLimit(eachOfLimit, Infinity); + /** - * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument + * to the iteratee. * - * @name reduceRight + * @name eachOf * @static * @memberOf module:Collections * @method - * @see [async.reduce]{@link module:Collections.reduce} - * @alias foldr + * @alias forEachOf * @category Collection - * @param {Array} array - A collection to iterate over. - * @param {*} memo - The initial state of the reduction. - * @param {AsyncFunction} iteratee - A function applied to each item in the - * array to produce the next step in the reduction. - * The `iteratee` should complete with the next state of the reduction. - * If the iteratee complete with an error, the reduction is stopped and the - * main `callback` is immediately called with the error. - * Invoked with (memo, item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the reduced value. Invoked with - * (err, result). + * @see [async.each]{@link module:Collections.each} + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each + * item in `coll`. + * The `key` is the item's key, or index in the case of an array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @example + * + * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; + * var configs = {}; + * + * async.forEachOf(obj, function (value, key, callback) { + * fs.readFile(__dirname + value, "utf8", function (err, data) { + * if (err) return callback(err); + * try { + * configs[key] = JSON.parse(data); + * } catch (e) { + * return callback(e); + * } + * callback(); + * }); + * }, function (err) { + * if (err) console.error(err.message); + * // configs is now a map of JSON data + * doSomethingWith(configs); + * }); */ -function reduceRight (array, memo, iteratee, callback) { - var reversed = slice(array).reverse(); - reduce(reversed, memo, iteratee, callback); +var eachOf = function(coll, iteratee, callback) { + var eachOfImplementation = isArrayLike(coll) ? eachOfArrayLike : eachOfGeneric; + eachOfImplementation(coll, wrapAsync(iteratee), callback); +}; + +function doParallel(fn) { + return function (obj, iteratee, callback) { + return fn(eachOf, obj, wrapAsync(iteratee), callback); + }; +} + +function _asyncMap(eachfn, arr, iteratee, callback) { + callback = callback || noop; + arr = arr || []; + var results = []; + var counter = 0; + var _iteratee = wrapAsync(iteratee); + + eachfn(arr, function (value, _, callback) { + var index = counter++; + _iteratee(value, function (err, v) { + results[index] = v; + callback(err); + }); + }, function (err) { + callback(err, results); + }); } /** - * Wraps the async function in another function that always completes with a - * result object, even when it errors. + * Produces a new collection of values by mapping each value in `coll` through + * the `iteratee` function. The `iteratee` is called with an item from `coll` + * and a callback for when it has finished processing. Each of these callback + * takes 2 arguments: an `error`, and the transformed item from `coll`. If + * `iteratee` passes an error to its callback, the main `callback` (for the + * `map` function) is immediately called with the error. * - * The result object has either the property `error` or `value`. + * Note, that since this function applies the `iteratee` to each item in + * parallel, there is no guarantee that the `iteratee` functions will complete + * in order. However, the results array will be in the same order as the + * original `coll`. * - * @name reflect + * If `map` is passed an Object, the results will be an Array. The results + * will roughly be in the order of the original Objects' keys (but this can + * vary across JavaScript engines). + * + * @name map * @static - * @memberOf module:Utils + * @memberOf module:Collections * @method - * @category Util - * @param {AsyncFunction} fn - The async function you want to wrap - * @returns {Function} - A function that always passes null to it's callback as - * the error. The second argument to the callback will be an `object` with - * either an `error` or a `value` property. + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with the transformed item. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an Array of the + * transformed items from the `coll`. Invoked with (err, results). * @example * - * async.parallel([ - * async.reflect(function(callback) { - * // do some stuff ... - * callback(null, 'one'); - * }), - * async.reflect(function(callback) { - * // do some more stuff but error ... - * callback('bad stuff happened'); - * }), - * async.reflect(function(callback) { - * // do some more stuff ... - * callback(null, 'two'); - * }) - * ], - * // optional callback - * function(err, results) { - * // values - * // results[0].value = 'one' - * // results[1].error = 'bad stuff happened' - * // results[2].value = 'two' + * async.map(['file1','file2','file3'], fs.stat, function(err, results) { + * // results is now an array of stats for each file * }); */ -function reflect(fn) { - var _fn = wrapAsync(fn); - return initialParams(function reflectOn(args, reflectCallback) { - args.push(function callback(error, cbArg) { - if (error) { - reflectCallback(null, { error: error }); - } else { - var value; - if (arguments.length <= 2) { - value = cbArg; - } else { - value = slice(arguments, 1); - } - reflectCallback(null, { value: value }); - } - }); - - return _fn.apply(this, args); - }); -} +var map = doParallel(_asyncMap); /** - * A helper function that wraps an array or an object of functions with `reflect`. + * Applies the provided arguments to each function in the array, calling + * `callback` after all functions have completed. If you only provide the first + * argument, `fns`, then it will return a function which lets you pass in the + * arguments as if it were a single function call. If more arguments are + * provided, `callback` is required while `args` is still optional. * - * @name reflectAll + * @name applyEach * @static - * @memberOf module:Utils + * @memberOf module:ControlFlow * @method - * @see [async.reflect]{@link module:Utils.reflect} - * @category Util - * @param {Array|Object|Iterable} tasks - The collection of - * [async functions]{@link AsyncFunction} to wrap in `async.reflect`. - * @returns {Array} Returns an array of async functions, each wrapped in - * `async.reflect` + * @category Control Flow + * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s + * to all call with the same arguments + * @param {...*} [args] - any number of separate arguments to pass to the + * function. + * @param {Function} [callback] - the final argument should be the callback, + * called when all functions have completed processing. + * @returns {Function} - If only the first argument, `fns`, is provided, it will + * return a function which lets you pass in the arguments as if it were a single + * function call. The signature is `(..args, callback)`. If invoked with any + * arguments, `callback` is required. * @example * - * let tasks = [ - * function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * function(callback) { - * // do some more stuff but error ... - * callback(new Error('bad stuff happened')); - * }, - * function(callback) { - * setTimeout(function() { - * callback(null, 'two'); - * }, 100); - * } - * ]; - * - * async.parallel(async.reflectAll(tasks), - * // optional callback - * function(err, results) { - * // values - * // results[0].value = 'one' - * // results[1].error = Error('bad stuff happened') - * // results[2].value = 'two' - * }); - * - * // an example using an object instead of an array - * let tasks = { - * one: function(callback) { - * setTimeout(function() { - * callback(null, 'one'); - * }, 200); - * }, - * two: function(callback) { - * callback('two'); - * }, - * three: function(callback) { - * setTimeout(function() { - * callback(null, 'three'); - * }, 100); - * } - * }; + * async.applyEach([enableSearch, updateSchema], 'bucket', callback); * - * async.parallel(async.reflectAll(tasks), - * // optional callback - * function(err, results) { - * // values - * // results.one.value = 'one' - * // results.two.error = 'two' - * // results.three.value = 'three' - * }); + * // partial application example: + * async.each( + * buckets, + * async.applyEach([enableSearch, updateSchema]), + * callback + * ); */ -function reflectAll(tasks) { - var results; - if (isArray(tasks)) { - results = arrayMap(tasks, reflect); - } else { - results = {}; - baseForOwn(tasks, function(task, key) { - results[key] = reflect.call(this, task); - }); - } - return results; -} +var applyEach = applyEach$1(map); -function reject$1(eachfn, arr, iteratee, callback) { - _filter(eachfn, arr, function(value, cb) { - iteratee(value, function(err, v) { - cb(err, !v); - }); - }, callback); +function doParallelLimit(fn) { + return function (obj, limit, iteratee, callback) { + return fn(_eachOfLimit(limit), obj, wrapAsync(iteratee), callback); + }; } /** - * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. + * The same as [`map`]{@link module:Collections.map} but runs a maximum of `limit` async operations at a time. * - * @name reject + * @name mapLimit * @static * @memberOf module:Collections * @method - * @see [async.filter]{@link module:Collections.filter} + * @see [async.map]{@link module:Collections.map} * @category Collection * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. - * The should complete with a boolean value as its `result`. + * The iteratee should complete with the transformed item. * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). - * @example + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an array of the + * transformed items from the `coll`. Invoked with (err, results). + */ +var mapLimit = doParallelLimit(_asyncMap); + +/** + * The same as [`map`]{@link module:Collections.map} but runs only a single async operation at a time. * - * async.reject(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, results) { - * // results now equals an array of missing files - * createFiles(results); - * }); - */ -var reject = doParallel(reject$1); - -/** - * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a - * time. - * - * @name rejectLimit + * @name mapSeries * @static * @memberOf module:Collections * @method - * @see [async.reject]{@link module:Collections.reject} + * @see [async.map]{@link module:Collections.map} * @category Collection * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {Function} iteratee - An async truth test to apply to each item in + * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. - * The should complete with a boolean value as its `result`. + * The iteratee should complete with the transformed item. * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Results is an array of the + * transformed items from the `coll`. Invoked with (err, results). */ -var rejectLimit = doParallelLimit(reject$1); +var mapSeries = doLimit(mapLimit, 1); /** - * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time. + * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. * - * @name rejectSeries + * @name applyEachSeries * @static - * @memberOf module:Collections + * @memberOf module:ControlFlow * @method - * @see [async.reject]{@link module:Collections.reject} - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {Function} iteratee - An async truth test to apply to each item in - * `coll`. - * The should complete with a boolean value as its `result`. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Invoked with (err, results). + * @see [async.applyEach]{@link module:ControlFlow.applyEach} + * @category Control Flow + * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all + * call with the same arguments + * @param {...*} [args] - any number of separate arguments to pass to the + * function. + * @param {Function} [callback] - the final argument should be the callback, + * called when all functions have completed processing. + * @returns {Function} - If only the first argument is provided, it will return + * a function which lets you pass in the arguments as if it were a single + * function call. */ -var rejectSeries = doLimit(rejectLimit, 1); +var applyEachSeries = applyEach$1(mapSeries); /** - * Creates a function that returns `value`. + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Util - * @param {*} value The value to return from the new function. - * @returns {Function} Returns the new constant function. - * @example + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. + */ +function arrayEach(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length; + + while (++index < length) { + if (iteratee(array[index], index, array) === false) { + break; + } + } + return array; +} + +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. * - * var objects = _.times(2, _.constant({ 'a': 1 })); + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; +} + +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. * - * console.log(objects); - * // => [{ 'a': 1 }, { 'a': 1 }] + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); + +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. * - * console.log(objects[0] === objects[1]); - * // => true + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. */ -function constant$1(value) { - return function() { - return value; - }; +function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); } /** - * Attempts to get a successful response from `task` no more than `times` times - * before returning an error. If the task is successful, the `callback` will be - * passed the result of the successful task. If all attempts fail, the callback - * will be passed the error and result (if any) of the final attempt. + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. * - * @name retry - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @see [async.retryable]{@link module:ControlFlow.retryable} - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an - * object with `times` and `interval` or a number. - * * `times` - The number of attempts to make before giving up. The default - * is `5`. - * * `interval` - The time to wait between retries, in milliseconds. The - * default is `0`. The interval may also be specified as a function of the - * retry count (see example). - * * `errorFilter` - An optional synchronous function that is invoked on - * erroneous result. If it returns `true` the retry attempts will continue; - * if the function returns `false` the retry flow is aborted with the current - * attempt's error and result being returned to the final callback. - * Invoked with (err). - * * If `opts` is a number, the number specifies the number of times to retry, - * with the default interval of `0`. - * @param {AsyncFunction} task - An async function to retry. - * Invoked with (callback). - * @param {Function} [callback] - An optional callback which is called when the - * task has succeeded, or after the final failed attempt. It receives the `err` - * and `result` arguments of the last attempt at completing the `task`. Invoked - * with (err, results). + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); + + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.isNaN` without support for number objects. * - * @example + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} + +/** + * A specialized version of `_.indexOf` which performs strict equality + * comparisons of values, i.e. `===`. * - * // The `retry` function can be used as a stand-alone control flow by passing - * // a callback, as shown below: + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function strictIndexOf(array, value, fromIndex) { + var index = fromIndex - 1, + length = array.length; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} + +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. * - * // try calling apiMethod 3 times - * async.retry(3, apiMethod, function(err, result) { - * // do something with the result - * }); + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + return value === value + ? strictIndexOf(array, value, fromIndex) + : baseFindIndex(array, baseIsNaN, fromIndex); +} + +/** + * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on + * their requirements. Each function can optionally depend on other functions + * being completed first, and each function is run as soon as its requirements + * are satisfied. * - * // try calling apiMethod 3 times, waiting 200 ms between each retry - * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { - * // do something with the result - * }); + * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence + * will stop. Further tasks will not execute (so any other functions depending + * on it will not run), and the main `callback` is immediately called with the + * error. * - * // try calling apiMethod 10 times with exponential backoff - * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds) - * async.retry({ - * times: 10, - * interval: function(retryCount) { - * return 50 * Math.pow(2, retryCount); - * } - * }, apiMethod, function(err, result) { - * // do something with the result - * }); + * {@link AsyncFunction}s also receive an object containing the results of functions which + * have completed so far as the first argument, if they have dependencies. If a + * task function has no dependencies, it will only be passed a callback. * - * // try calling apiMethod the default 5 times no delay between each retry - * async.retry(apiMethod, function(err, result) { - * // do something with the result - * }); + * @name auto + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Object} tasks - An object. Each of its properties is either a + * function or an array of requirements, with the {@link AsyncFunction} itself the last item + * in the array. The object's key of a property serves as the name of the task + * defined by that property, i.e. can be used when specifying requirements for + * other tasks. The function receives one or two arguments: + * * a `results` object, containing the results of the previously executed + * functions, only passed if the task has any dependencies, + * * a `callback(err, result)` function, which must be called when finished, + * passing an `error` (which can be `null`) and the result of the function's + * execution. + * @param {number} [concurrency=Infinity] - An optional `integer` for + * determining the maximum number of tasks that can be run in parallel. By + * default, as many as possible. + * @param {Function} [callback] - An optional callback which is called when all + * the tasks have been completed. It receives the `err` argument if any `tasks` + * pass an error to their callback. Results are always returned; however, if an + * error occurs, no further `tasks` will be performed, and the results object + * will only contain partial results. Invoked with (err, results). + * @returns undefined + * @example * - * // try calling apiMethod only when error condition satisfies, all other - * // errors will abort the retry control flow and return to final callback - * async.retry({ - * errorFilter: function(err) { - * return err.message === 'Temporary error'; // only retry on a specific error - * } - * }, apiMethod, function(err, result) { - * // do something with the result - * }); + * async.auto({ + * // this function will just be passed a callback + * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), + * showData: ['readData', function(results, cb) { + * // results.readData is the file's contents + * // ... + * }] + * }, callback); * - * // to retry individual methods that are not as reliable within other - * // control flow functions, use the `retryable` wrapper: * async.auto({ - * users: api.getUsers.bind(api), - * payments: async.retryable(3, api.getPayments.bind(api)) + * get_data: function(callback) { + * console.log('in get_data'); + * // async code to get some data + * callback(null, 'data', 'converted to array'); + * }, + * make_folder: function(callback) { + * console.log('in make_folder'); + * // async code to create a directory to store a file in + * // this is run at the same time as getting the data + * callback(null, 'folder'); + * }, + * write_file: ['get_data', 'make_folder', function(results, callback) { + * console.log('in write_file', JSON.stringify(results)); + * // once there is some data and the directory exists, + * // write the data to a file in the directory + * callback(null, 'filename'); + * }], + * email_link: ['write_file', function(results, callback) { + * console.log('in email_link', JSON.stringify(results)); + * // once the file is written let's email a link to it... + * // results.write_file contains the filename returned by write_file. + * callback(null, {'file':results.write_file, 'email':'user@example.com'}); + * }] * }, function(err, results) { - * // do something with the results + * console.log('err = ', err); + * console.log('results = ', results); * }); - * */ -function retry(opts, task, callback) { - var DEFAULT_TIMES = 5; - var DEFAULT_INTERVAL = 0; +var auto = function (tasks, concurrency, callback) { + if (typeof concurrency === 'function') { + // concurrency is optional, shift the args. + callback = concurrency; + concurrency = null; + } + callback = once(callback || noop); + var keys$$1 = keys(tasks); + var numTasks = keys$$1.length; + if (!numTasks) { + return callback(null); + } + if (!concurrency) { + concurrency = numTasks; + } - var options = { - times: DEFAULT_TIMES, - intervalFunc: constant$1(DEFAULT_INTERVAL) - }; + var results = {}; + var runningTasks = 0; + var hasError = false; - function parseTimes(acc, t) { - if (typeof t === 'object') { - acc.times = +t.times || DEFAULT_TIMES; + var listeners = Object.create(null); - acc.intervalFunc = typeof t.interval === 'function' ? - t.interval : - constant$1(+t.interval || DEFAULT_INTERVAL); + var readyTasks = []; - acc.errorFilter = t.errorFilter; - } else if (typeof t === 'number' || typeof t === 'string') { - acc.times = +t || DEFAULT_TIMES; - } else { - throw new Error("Invalid arguments for async.retry"); + // for cycle detection: + var readyToCheck = []; // tasks that have been identified as reachable + // without the possibility of returning to an ancestor task + var uncheckedDependencies = {}; + + baseForOwn(tasks, function (task, key) { + if (!isArray(task)) { + // no dependencies + enqueueTask(key, [task]); + readyToCheck.push(key); + return; + } + + var dependencies = task.slice(0, task.length - 1); + var remainingDependencies = dependencies.length; + if (remainingDependencies === 0) { + enqueueTask(key, task); + readyToCheck.push(key); + return; } + uncheckedDependencies[key] = remainingDependencies; + + arrayEach(dependencies, function (dependencyName) { + if (!tasks[dependencyName]) { + throw new Error('async.auto task `' + key + + '` has a non-existent dependency `' + + dependencyName + '` in ' + + dependencies.join(', ')); + } + addListener(dependencyName, function () { + remainingDependencies--; + if (remainingDependencies === 0) { + enqueueTask(key, task); + } + }); + }); + }); + + checkForDeadlocks(); + processQueue(); + + function enqueueTask(key, task) { + readyTasks.push(function () { + runTask(key, task); + }); } - if (arguments.length < 3 && typeof opts === 'function') { - callback = task || noop; - task = opts; - } else { - parseTimes(options, opts); - callback = callback || noop; + function processQueue() { + if (readyTasks.length === 0 && runningTasks === 0) { + return callback(null, results); + } + while(readyTasks.length && runningTasks < concurrency) { + var run = readyTasks.shift(); + run(); + } + } - if (typeof task !== 'function') { - throw new Error("Invalid arguments for async.retry"); + function addListener(taskName, fn) { + var taskListeners = listeners[taskName]; + if (!taskListeners) { + taskListeners = listeners[taskName] = []; + } + + taskListeners.push(fn); } - var _task = wrapAsync(task); + function taskComplete(taskName) { + var taskListeners = listeners[taskName] || []; + arrayEach(taskListeners, function (fn) { + fn(); + }); + processQueue(); + } - var attempt = 1; - function retryAttempt() { - _task(function(err) { - if (err && attempt++ < options.times && - (typeof options.errorFilter != 'function' || - options.errorFilter(err))) { - setTimeout(retryAttempt, options.intervalFunc(attempt)); + + function runTask(key, task) { + if (hasError) return; + + var taskCallback = onlyOnce(function(err, result) { + runningTasks--; + if (arguments.length > 2) { + result = slice(arguments, 1); + } + if (err) { + var safeResults = {}; + baseForOwn(results, function(val, rkey) { + safeResults[rkey] = val; + }); + safeResults[key] = result; + hasError = true; + listeners = Object.create(null); + + callback(err, safeResults); } else { - callback.apply(null, arguments); + results[key] = result; + taskComplete(key); } }); - } - - retryAttempt(); -} -/** - * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method - * wraps a task and makes it retryable, rather than immediately calling it - * with retries. - * - * @name retryable - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.retry]{@link module:ControlFlow.retry} - * @category Control Flow - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional - * options, exactly the same as from `retry` - * @param {AsyncFunction} task - the asynchronous function to wrap. - * This function will be passed any arguments passed to the returned wrapper. - * Invoked with (...args, callback). - * @returns {AsyncFunction} The wrapped function, which when invoked, will - * retry on an error, based on the parameters specified in `opts`. - * This function will accept the same parameters as `task`. - * @example - * - * async.auto({ - * dep1: async.retryable(3, getFromFlakyService), - * process: ["dep1", async.retryable(3, function (results, cb) { - * maybeProcessData(results.dep1, cb); - * })] - * }, callback); - */ -var retryable = function (opts, task) { - if (!task) { - task = opts; - opts = null; + runningTasks++; + var taskFn = wrapAsync(task[task.length - 1]); + if (task.length > 1) { + taskFn(results, taskCallback); + } else { + taskFn(taskCallback); + } } - var _task = wrapAsync(task); - return initialParams(function (args, callback) { - function taskFn(cb) { - _task.apply(null, args.concat(cb)); + + function checkForDeadlocks() { + // Kahn's algorithm + // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm + // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html + var currentTask; + var counter = 0; + while (readyToCheck.length) { + currentTask = readyToCheck.pop(); + counter++; + arrayEach(getDependents(currentTask), function (dependent) { + if (--uncheckedDependencies[dependent] === 0) { + readyToCheck.push(dependent); + } + }); } - if (opts) retry(opts, taskFn, callback); - else retry(taskFn, callback); + if (counter !== numTasks) { + throw new Error( + 'async.auto cannot execute tasks due to a recursive dependency' + ); + } + } - }); + function getDependents(taskName) { + var result = []; + baseForOwn(tasks, function (task, key) { + if (isArray(task) && baseIndexOf(task, taskName, 0) >= 0) { + result.push(key); + } + }); + return result; + } }; /** - * Run the functions in the `tasks` collection in series, each one running once - * the previous function has completed. If any functions in the series pass an - * error to its callback, no more functions are run, and `callback` is - * immediately called with the value of the error. Otherwise, `callback` - * receives an array of results when `tasks` have completed. - * - * It is also possible to use an object instead of an array. Each property will - * be run as a function, and the results will be passed to the final `callback` - * as an object instead of an array. This can be a more readable way of handling - * results from {@link async.series}. - * - * **Note** that while many implementations preserve the order of object - * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) - * explicitly states that - * - * > The mechanics and order of enumerating the properties is not specified. - * - * So if you rely on the order in which your series of functions are executed, - * and want this to work on all platforms, consider using an array. - * - * @name series - * @static - * @memberOf module:ControlFlow - * @method - * @category Control Flow - * @param {Array|Iterable|Object} tasks - A collection containing - * [async functions]{@link AsyncFunction} to run in series. - * Each function can complete with any number of optional `result` values. - * @param {Function} [callback] - An optional callback to run once all the - * functions have completed. This function gets a results array (or object) - * containing all the result arguments passed to the `task` callbacks. Invoked - * with (err, result). - * @example - * async.series([ - * function(callback) { - * // do some stuff ... - * callback(null, 'one'); - * }, - * function(callback) { - * // do some more stuff ... - * callback(null, 'two'); - * } - * ], - * // optional callback - * function(err, results) { - * // results is now equal to ['one', 'two'] - * }); + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. * - * async.series({ - * one: function(callback) { - * setTimeout(function() { - * callback(null, 1); - * }, 200); - * }, - * two: function(callback){ - * setTimeout(function() { - * callback(null, 2); - * }, 100); - * } - * }, function(err, results) { - * // results is now equal to: {one: 1, two: 2} - * }); + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. */ -function series(tasks, callback) { - _parallel(eachOfSeries, tasks, callback); +function arrayMap(array, iteratee) { + var index = -1, + length = array == null ? 0 : array.length, + result = Array(length); + + while (++index < length) { + result[index] = iteratee(array[index], index, array); + } + return result; } +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + /** - * Returns `true` if at least one element in the `coll` satisfies an async test. - * If any iteratee call returns `true`, the main `callback` is immediately - * called. + * Checks if `value` is classified as a `Symbol` primitive or object. * - * @name some * @static - * @memberOf module:Collections - * @method - * @alias any - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. * @example * - * async.some(['file1','file2','file3'], function(filePath, callback) { - * fs.access(filePath, function(err) { - * callback(null, !err) - * }); - * }, function(err, result) { - * // if result is true then at least one of the files exists - * }); + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false */ -var some = doParallel(_createTester(Boolean, identity)); +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); +} + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined; +var symbolToString = symbolProto ? symbolProto.toString : undefined; /** - * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. * - * @name someLimit - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anyLimit - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in parallel. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. */ -var someLimit = doParallelLimit(_createTester(Boolean, identity)); +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isArray(value)) { + // Recursively convert values (susceptible to call stack limits). + return arrayMap(value, baseToString) + ''; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} /** - * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. + * The base implementation of `_.slice` without an iteratee call guard. * - * @name someSeries - * @static - * @memberOf module:Collections - * @method - * @see [async.some]{@link module:Collections.some} - * @alias anySeries - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async truth test to apply to each item - * in the collections in series. - * The iteratee should complete with a boolean `result` value. - * Invoked with (item, callback). - * @param {Function} [callback] - A callback which is called as soon as any - * iteratee returns `true`, or after all the iteratee functions have finished. - * Result will be either `true` or `false` depending on the values of the async - * tests. Invoked with (err, result). + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. */ -var someSeries = doLimit(someLimit, 1); +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} /** - * Sorts a list by the results of running each `coll` value through an async - * `iteratee`. - * - * @name sortBy - * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {AsyncFunction} iteratee - An async function to apply to each item in - * `coll`. - * The iteratee should complete with a value to use as the sort criteria as - * its `result`. - * Invoked with (item, callback). - * @param {Function} callback - A callback which is called after all the - * `iteratee` functions have finished, or an error occurs. Results is the items - * from the original `coll` sorted by the values returned by the `iteratee` - * calls. Invoked with (err, results). - * @example - * - * async.sortBy(['file1','file2','file3'], function(file, callback) { - * fs.stat(file, function(err, stats) { - * callback(err, stats.mtime); - * }); - * }, function(err, results) { - * // results is now the original array of files sorted by - * // modified date - * }); - * - * // By modifying the callback parameter the - * // sorting order can be influenced: - * - * // ascending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x); - * }, function(err,result) { - * // result callback - * }); + * Casts `array` to a slice if it's needed. * - * // descending order - * async.sortBy([1,9,3,5], function(x, callback) { - * callback(null, x*-1); //<- x*-1 instead of x, turns the order around - * }, function(err,result) { - * // result callback - * }); + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. */ -function sortBy (coll, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - map(coll, function (x, callback) { - _iteratee(x, function (err, criteria) { - if (err) return callback(err); - callback(null, {value: x, criteria: criteria}); - }); - }, function (err, results) { - if (err) return callback(err); - callback(null, arrayMap(results.sort(comparator), baseProperty('value'))); - }); - - function comparator(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); } /** - * Sets a time limit on an asynchronous function. If the function does not call - * its callback within the specified milliseconds, it will be called with a - * timeout error. The code property for the error object will be `'ETIMEDOUT'`. - * - * @name timeout - * @static - * @memberOf module:Utils - * @method - * @category Util - * @param {AsyncFunction} asyncFn - The async function to limit in time. - * @param {number} milliseconds - The specified time limit. - * @param {*} [info] - Any variable you want attached (`string`, `object`, etc) - * to timeout Error for more information.. - * @returns {AsyncFunction} Returns a wrapped function that can be used with any - * of the control flow functions. - * Invoke this function with the same parameters as you would `asyncFunc`. - * @example - * - * function myFunction(foo, callback) { - * doAsyncTask(foo, function(err, data) { - * // handle errors - * if (err) return callback(err); - * - * // do some stuff ... - * - * // return processed data - * return callback(null, data); - * }); - * } - * - * var wrapped = async.timeout(myFunction, 1000); - * - * // call `wrapped` as you would `myFunction` - * wrapped({ bar: 'bar' }, function(err, data) { - * // if `myFunction` takes < 1000 ms to execute, `err` - * // and `data` will have their expected values + * Used by `_.trim` and `_.trimEnd` to get the index of the last string symbol + * that is not found in the character symbols. * - * // else `err` will be an Error with the code 'ETIMEDOUT' - * }); + * @private + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the last unmatched string symbol. */ -function timeout(asyncFn, milliseconds, info) { - var fn = wrapAsync(asyncFn); - - return initialParams(function (args, callback) { - var timedOut = false; - var timer; - - function timeoutCallback() { - var name = asyncFn.name || 'anonymous'; - var error = new Error('Callback function "' + name + '" timed out.'); - error.code = 'ETIMEDOUT'; - if (info) { - error.info = info; - } - timedOut = true; - callback(error); - } - - args.push(function () { - if (!timedOut) { - callback.apply(null, arguments); - clearTimeout(timer); - } - }); +function charsEndIndex(strSymbols, chrSymbols) { + var index = strSymbols.length; - // setup timer and call original function - timer = setTimeout(timeoutCallback, milliseconds); - fn.apply(null, args); - }); + while (index-- && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; } -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeCeil = Math.ceil; -var nativeMax = Math.max; - /** - * The base implementation of `_.range` and `_.rangeRight` which doesn't - * coerce arguments. + * Used by `_.trim` and `_.trimStart` to get the index of the first string symbol + * that is not found in the character symbols. * * @private - * @param {number} start The start of the range. - * @param {number} end The end of the range. - * @param {number} step The value to increment or decrement by. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Array} Returns the range of numbers. + * @param {Array} strSymbols The string symbols to inspect. + * @param {Array} chrSymbols The character symbols to find. + * @returns {number} Returns the index of the first unmatched string symbol. */ -function baseRange(start, end, step, fromRight) { +function charsStartIndex(strSymbols, chrSymbols) { var index = -1, - length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), - result = Array(length); + length = strSymbols.length; - while (length--) { - result[fromRight ? length : ++index] = start; - start += step; - } - return result; + while (++index < length && baseIndexOf(chrSymbols, strSymbols[index], 0) > -1) {} + return index; } /** - * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a - * time. + * Converts an ASCII `string` to an array. * - * @name timesLimit - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.times]{@link module:ControlFlow.times} - * @category Control Flow - * @param {number} count - The number of times to run the function. - * @param {number} limit - The maximum number of async operations at a time. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see [async.map]{@link module:Collections.map}. + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. */ -function timeLimit(count, limit, iteratee, callback) { - var _iteratee = wrapAsync(iteratee); - mapLimit(baseRange(0, count, 1), limit, _iteratee, callback); +function asciiToArray(string) { + return string.split(''); } +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff'; +var rsComboMarksRange = '\\u0300-\\u036f'; +var reComboHalfMarksRange = '\\ufe20-\\ufe2f'; +var rsComboSymbolsRange = '\\u20d0-\\u20ff'; +var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange; +var rsVarRange = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsZWJ = '\\u200d'; + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']'); + /** - * Calls the `iteratee` function `n` times, and accumulates results in the same - * manner you would use with [map]{@link module:Collections.map}. - * - * @name times - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.map]{@link module:Collections.map} - * @category Control Flow - * @param {number} n - The number of times to run the function. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see {@link module:Collections.map}. - * @example - * - * // Pretend this is some complicated async factory - * var createUser = function(id, callback) { - * callback(null, { - * id: 'user' + id - * }); - * }; + * Checks if `string` contains Unicode symbols. * - * // generate 5 users - * async.times(5, function(n, next) { - * createUser(n, function(err, user) { - * next(err, user); - * }); - * }, function(err, users) { - * // we should now have 5 users - * }); + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. */ -var times = doLimit(timeLimit, Infinity); +function hasUnicode(string) { + return reHasUnicode.test(string); +} -/** - * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time. +/** Used to compose unicode character classes. */ +var rsAstralRange$1 = '\\ud800-\\udfff'; +var rsComboMarksRange$1 = '\\u0300-\\u036f'; +var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f'; +var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff'; +var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1; +var rsVarRange$1 = '\\ufe0e\\ufe0f'; + +/** Used to compose unicode capture groups. */ +var rsAstral = '[' + rsAstralRange$1 + ']'; +var rsCombo = '[' + rsComboRange$1 + ']'; +var rsFitz = '\\ud83c[\\udffb-\\udfff]'; +var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')'; +var rsNonAstral = '[^' + rsAstralRange$1 + ']'; +var rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}'; +var rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]'; +var rsZWJ$1 = '\\u200d'; + +/** Used to compose unicode regexes. */ +var reOptMod = rsModifier + '?'; +var rsOptVar = '[' + rsVarRange$1 + ']?'; +var rsOptJoin = '(?:' + rsZWJ$1 + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*'; +var rsSeq = rsOptVar + reOptMod + rsOptJoin; +var rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** + * Converts a Unicode `string` to an array. * - * @name timesSeries - * @static - * @memberOf module:ControlFlow - * @method - * @see [async.times]{@link module:ControlFlow.times} - * @category Control Flow - * @param {number} n - The number of times to run the function. - * @param {AsyncFunction} iteratee - The async function to call `n` times. - * Invoked with the iteration index and a callback: (n, next). - * @param {Function} callback - see {@link module:Collections.map}. + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. */ -var timesSeries = doLimit(timeLimit, 1); +function unicodeToArray(string) { + return string.match(reUnicode) || []; +} /** - * A relative of `reduce`. Takes an Object or Array, and iterates over each - * element in series, each step potentially mutating an `accumulator` value. - * The type of the accumulator defaults to the type of collection passed in. + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. * - * @name transform * @static - * @memberOf module:Collections - * @method - * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. - * @param {*} [accumulator] - The initial state of the transform. If omitted, - * it will default to an empty Object or Array, depending on the type of `coll` - * @param {AsyncFunction} iteratee - A function applied to each item in the - * collection that potentially modifies the accumulator. - * Invoked with (accumulator, item, key, callback). - * @param {Function} [callback] - A callback which is called after all the - * `iteratee` functions have finished. Result is the transformed accumulator. - * Invoked with (err, result). + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. * @example * - * async.transform([1,2,3], function(acc, item, index, callback) { - * // pointless async: - * process.nextTick(function() { - * acc.push(item * 2) - * callback(null) - * }); - * }, function(err, result) { - * // result is now equal to [2, 4, 6] - * }); + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** + * Removes leading and trailing whitespace or specified characters from `string`. * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to trim. + * @param {string} [chars=whitespace] The characters to trim. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {string} Returns the trimmed string. * @example * - * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) { - * setImmediate(function () { - * obj[key] = val * 2; - * callback(); - * }) - * }, function (err, result) { - * // result is equal to {a: 2, b: 4, c: 6} - * }) + * _.trim(' abc '); + * // => 'abc' + * + * _.trim('-_-abc-_-', '_-'); + * // => 'abc' + * + * _.map([' foo ', ' bar '], _.trim); + * // => ['foo', 'bar'] */ -function transform (coll, accumulator, iteratee, callback) { - if (arguments.length <= 3) { - callback = iteratee; - iteratee = accumulator; - accumulator = isArray(coll) ? [] : {}; - } - callback = once(callback || noop); - var _iteratee = wrapAsync(iteratee); +function trim(string, chars, guard) { + string = toString(string); + if (string && (guard || chars === undefined)) { + return string.replace(reTrim, ''); + } + if (!string || !(chars = baseToString(chars))) { + return string; + } + var strSymbols = stringToArray(string), + chrSymbols = stringToArray(chars), + start = charsStartIndex(strSymbols, chrSymbols), + end = charsEndIndex(strSymbols, chrSymbols) + 1; - eachOf(coll, function(v, k, cb) { - _iteratee(accumulator, v, k, cb); - }, function(err) { - callback(err, accumulator); + return castSlice(strSymbols, start, end).join(''); +} + +var FN_ARGS = /^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m; +var FN_ARG_SPLIT = /,/; +var FN_ARG = /(=.+)?(\s*)$/; +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; + +function parseParams(func) { + func = func.toString().replace(STRIP_COMMENTS, ''); + func = func.match(FN_ARGS)[2].replace(' ', ''); + func = func ? func.split(FN_ARG_SPLIT) : []; + func = func.map(function (arg){ + return trim(arg.replace(FN_ARG, '')); }); + return func; } /** - * It runs each task in series but stops whenever any of the functions were - * successful. If one of the tasks were successful, the `callback` will be - * passed the result of the successful task. If all tasks fail, the callback - * will be passed the error and result (if any) of the final attempt. + * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent + * tasks are specified as parameters to the function, after the usual callback + * parameter, with the parameter names matching the names of the tasks it + * depends on. This can provide even more readable task graphs which can be + * easier to maintain. * - * @name tryEach + * If a final callback is specified, the task results are similarly injected, + * specified as named parameters after the initial error parameter. + * + * The autoInject function is purely syntactic sugar and its semantics are + * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. + * + * @name autoInject * @static * @memberOf module:ControlFlow * @method + * @see [async.auto]{@link module:ControlFlow.auto} * @category Control Flow - * @param {Array|Iterable|Object} tasks - A collection containing functions to - * run, each function is passed a `callback(err, result)` it must call on - * completion with an error `err` (which can be `null`) and an optional `result` - * value. - * @param {Function} [callback] - An optional callback which is called when one - * of the tasks has succeeded, or all have failed. It receives the `err` and - * `result` arguments of the last attempt at completing the `task`. Invoked with - * (err, results). + * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of + * the form 'func([dependencies...], callback). The object's key of a property + * serves as the name of the task defined by that property, i.e. can be used + * when specifying requirements for other tasks. + * * The `callback` parameter is a `callback(err, result)` which must be called + * when finished, passing an `error` (which can be `null`) and the result of + * the function's execution. The remaining parameters name other tasks on + * which the task is dependent, and the results from those tasks are the + * arguments of those parameters. + * @param {Function} [callback] - An optional callback which is called when all + * the tasks have been completed. It receives the `err` argument if any `tasks` + * pass an error to their callback, and a `results` object with any completed + * task results, similar to `auto`. * @example - * async.tryEach([ - * function getDataFromFirstWebsite(callback) { - * // Try getting the data from the first website - * callback(err, data); + * + * // The example from `auto` can be rewritten as follows: + * async.autoInject({ + * get_data: function(callback) { + * // async code to get some data + * callback(null, 'data', 'converted to array'); * }, - * function getDataFromSecondWebsite(callback) { - * // First website failed, - * // Try getting the data from the backup website - * callback(err, data); + * make_folder: function(callback) { + * // async code to create a directory to store a file in + * // this is run at the same time as getting the data + * callback(null, 'folder'); + * }, + * write_file: function(get_data, make_folder, callback) { + * // once there is some data and the directory exists, + * // write the data to a file in the directory + * callback(null, 'filename'); + * }, + * email_link: function(write_file, callback) { + * // once the file is written let's email a link to it... + * // write_file contains the filename returned by write_file. + * callback(null, {'file':write_file, 'email':'user@example.com'}); * } - * ], - * // optional callback - * function(err, results) { - * Now do something with the data. + * }, function(err, results) { + * console.log('err = ', err); + * console.log('email_link = ', results.email_link); * }); * + * // If you are using a JS minifier that mangles parameter names, `autoInject` + * // will not work with plain functions, since the parameter names will be + * // collapsed to a single letter identifier. To work around this, you can + * // explicitly specify the names of the parameters your task function needs + * // in an array, similar to Angular.js dependency injection. + * + * // This still has an advantage over plain `auto`, since the results a task + * // depends on are still spread into arguments. + * async.autoInject({ + * //... + * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { + * callback(null, 'filename'); + * }], + * email_link: ['write_file', function(write_file, callback) { + * callback(null, {'file':write_file, 'email':'user@example.com'}); + * }] + * //... + * }, function(err, results) { + * console.log('err = ', err); + * console.log('email_link = ', results.email_link); + * }); */ -function tryEach(tasks, callback) { - var error = null; - var result; - callback = callback || noop; - eachSeries(tasks, function(task, callback) { - wrapAsync(task)(function (err, res/*, ...args*/) { - if (arguments.length > 2) { - result = slice(arguments, 1); - } else { - result = res; +function autoInject(tasks, callback) { + var newTasks = {}; + + baseForOwn(tasks, function (taskFn, key) { + var params; + var fnIsAsync = isAsync(taskFn); + var hasNoDeps = + (!fnIsAsync && taskFn.length === 1) || + (fnIsAsync && taskFn.length === 0); + + if (isArray(taskFn)) { + params = taskFn.slice(0, -1); + taskFn = taskFn[taskFn.length - 1]; + + newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); + } else if (hasNoDeps) { + // no dependencies, use the function as-is + newTasks[key] = taskFn; + } else { + params = parseParams(taskFn); + if (taskFn.length === 0 && !fnIsAsync && params.length === 0) { + throw new Error("autoInject task functions require explicit parameters."); } - error = err; - callback(!err); - }); - }, function () { - callback(error, result); + + // remove callback param + if (!fnIsAsync) params.pop(); + + newTasks[key] = params.concat(newTask); + } + + function newTask(results, taskCb) { + var newArgs = arrayMap(params, function (name) { + return results[name]; + }); + newArgs.push(taskCb); + wrapAsync(taskFn).apply(null, newArgs); + } }); + + auto(newTasks, callback); } -/** - * 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 function () { - return (fn.unmemoized || fn).apply(null, arguments); +// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation +// used for queues. This implementation assumes that the node provided by the user can be modified +// to adjust the next and last properties. We implement only the minimal functionality +// for queue support. +function DLL() { + this.head = this.tail = null; + this.length = 0; +} + +function setInitial(dll, node) { + dll.length = 1; + dll.head = dll.tail = node; +} + +DLL.prototype.removeLink = function(node) { + if (node.prev) node.prev.next = node.next; + else this.head = node.next; + if (node.next) node.next.prev = node.prev; + else this.tail = node.prev; + + node.prev = node.next = null; + this.length -= 1; + return node; +}; + +DLL.prototype.empty = function () { + while(this.head) this.shift(); + return this; +}; + +DLL.prototype.insertAfter = function(node, newNode) { + newNode.prev = node; + newNode.next = node.next; + if (node.next) node.next.prev = newNode; + else this.tail = newNode; + node.next = newNode; + this.length += 1; +}; + +DLL.prototype.insertBefore = function(node, newNode) { + newNode.prev = node.prev; + newNode.next = node; + if (node.prev) node.prev.next = newNode; + else this.head = newNode; + node.prev = newNode; + this.length += 1; +}; + +DLL.prototype.unshift = function(node) { + if (this.head) this.insertBefore(this.head, node); + else setInitial(this, node); +}; + +DLL.prototype.push = function(node) { + if (this.tail) this.insertAfter(this.tail, node); + else setInitial(this, node); +}; + +DLL.prototype.shift = function() { + return this.head && this.removeLink(this.head); +}; + +DLL.prototype.pop = function() { + return this.tail && this.removeLink(this.tail); +}; + +DLL.prototype.toArray = function () { + var arr = Array(this.length); + var curr = this.head; + for(var idx = 0; idx < this.length; idx++) { + arr[idx] = curr.data; + curr = curr.next; + } + return arr; +}; + +DLL.prototype.remove = function (testFn) { + var curr = this.head; + while(!!curr) { + var next = curr.next; + if (testFn(curr)) { + this.removeLink(curr); + } + curr = next; + } + return this; +}; + +function queue(worker, concurrency, payload) { + if (concurrency == null) { + concurrency = 1; + } + else if(concurrency === 0) { + throw new Error('Concurrency must not be zero'); + } + + var _worker = wrapAsync(worker); + var numRunning = 0; + var workersList = []; + + var processingScheduled = false; + function _insert(data, insertAtFront, callback) { + if (callback != null && typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + q.started = true; + if (!isArray(data)) { + data = [data]; + } + if (data.length === 0 && q.idle()) { + // call drain immediately if there are no tasks + return setImmediate$1(function() { + q.drain(); + }); + } + + for (var i = 0, l = data.length; i < l; i++) { + var item = { + data: data[i], + callback: callback || noop + }; + + if (insertAtFront) { + q._tasks.unshift(item); + } else { + q._tasks.push(item); + } + } + + if (!processingScheduled) { + processingScheduled = true; + setImmediate$1(function() { + processingScheduled = false; + q.process(); + }); + } + } + + function _next(tasks) { + return function(err){ + numRunning -= 1; + + for (var i = 0, l = tasks.length; i < l; i++) { + var task = tasks[i]; + + var index = baseIndexOf(workersList, task, 0); + if (index === 0) { + workersList.shift(); + } else if (index > 0) { + workersList.splice(index, 1); + } + + task.callback.apply(task, arguments); + + if (err != null) { + q.error(err, task.data); + } + } + + if (numRunning <= (q.concurrency - q.buffer) ) { + q.unsaturated(); + } + + if (q.idle()) { + q.drain(); + } + q.process(); + }; + } + + var isProcessing = false; + var q = { + _tasks: new DLL(), + concurrency: concurrency, + payload: payload, + saturated: noop, + unsaturated:noop, + buffer: concurrency / 4, + empty: noop, + drain: noop, + error: noop, + started: false, + paused: false, + push: function (data, callback) { + _insert(data, false, callback); + }, + kill: function () { + q.drain = noop; + q._tasks.empty(); + }, + unshift: function (data, callback) { + _insert(data, true, callback); + }, + remove: function (testFn) { + q._tasks.remove(testFn); + }, + process: function () { + // Avoid trying to start too many processing operations. This can occur + // when callbacks resolve synchronously (#1267). + if (isProcessing) { + return; + } + isProcessing = true; + while(!q.paused && numRunning < q.concurrency && q._tasks.length){ + var tasks = [], data = []; + var l = q._tasks.length; + if (q.payload) l = Math.min(l, q.payload); + for (var i = 0; i < l; i++) { + var node = q._tasks.shift(); + tasks.push(node); + workersList.push(node); + data.push(node.data); + } + + numRunning += 1; + + if (q._tasks.length === 0) { + q.empty(); + } + + if (numRunning === q.concurrency) { + q.saturated(); + } + + var cb = onlyOnce(_next(tasks)); + _worker(data, cb); + } + isProcessing = false; + }, + length: function () { + return q._tasks.length; + }, + running: function () { + return numRunning; + }, + workersList: function () { + return workersList; + }, + idle: function() { + return q._tasks.length + numRunning === 0; + }, + pause: function () { + q.paused = true; + }, + resume: function () { + if (q.paused === false) { return; } + q.paused = false; + setImmediate$1(q.process); + } }; + return q; } /** - * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when - * stopped, or an error occurs. + * A cargo of tasks for the worker function to complete. Cargo inherits all of + * the same methods and event callbacks as [`queue`]{@link module:ControlFlow.queue}. + * @typedef {Object} CargoObject + * @memberOf module:ControlFlow + * @property {Function} length - A function returning the number of items + * waiting to be processed. Invoke like `cargo.length()`. + * @property {number} payload - An `integer` for determining how many tasks + * should be process per round. This property can be changed after a `cargo` is + * created to alter the payload on-the-fly. + * @property {Function} push - Adds `task` to the `queue`. The callback is + * called once the `worker` has finished processing the task. Instead of a + * single task, an array of `tasks` can be submitted. The respective callback is + * used for every task in the list. Invoke like `cargo.push(task, [callback])`. + * @property {Function} saturated - A callback that is called when the + * `queue.length()` hits the concurrency and further tasks will be queued. + * @property {Function} empty - A callback that is called when the last item + * from the `queue` is given to a `worker`. + * @property {Function} drain - A callback that is called when the last item + * from the `queue` has returned from the `worker`. + * @property {Function} idle - a function returning false if there are items + * waiting or being processed, or true if not. Invoke like `cargo.idle()`. + * @property {Function} pause - a function that pauses the processing of tasks + * until `resume()` is called. Invoke like `cargo.pause()`. + * @property {Function} resume - a function that resumes the processing of + * queued tasks when the queue is paused. Invoke like `cargo.resume()`. + * @property {Function} kill - a function that removes the `drain` callback and + * empties remaining tasks from the queue forcing it to go idle. Invoke like `cargo.kill()`. + */ + +/** + * Creates a `cargo` object with the specified payload. Tasks added to the + * cargo will be processed altogether (up to the `payload` limit). If the + * `worker` is in progress, the task is queued until it becomes available. Once + * the `worker` has completed some tasks, each callback of those tasks is + * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) + * for how `cargo` and `queue` work. * - * @name whilst + * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers + * at a time, cargo passes an array of tasks to a single worker, repeating + * when the worker is finished. + * + * @name cargo * @static * @memberOf module:ControlFlow * @method + * @see [async.queue]{@link module:ControlFlow.queue} * @category Control Flow - * @param {Function} test - synchronous truth test to perform before each - * execution of `iteratee`. Invoked with (). - * @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 undefined + * @param {AsyncFunction} worker - An asynchronous function for processing an array + * of queued tasks. Invoked with `(tasks, callback)`. + * @param {number} [payload=Infinity] - An optional `integer` for determining + * how many tasks should be processed per round; if omitted, the default is + * unlimited. + * @returns {module:ControlFlow.CargoObject} A cargo object to manage the tasks. Callbacks can + * attached as certain properties to listen for specific events during the + * lifecycle of the cargo and inner queue. * @example * - * var count = 0; - * async.whilst( - * function() { return count < 5; }, - * function(callback) { - * count++; - * setTimeout(function() { - * callback(null, count); - * }, 1000); - * }, - * function (err, n) { - * // 5 seconds have passed, n = 5 + * // create a cargo object with payload 2 + * var cargo = async.cargo(function(tasks, callback) { + * for (var i=0; i 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. + * function add1(n, callback) { + * setTimeout(function () { + * callback(null, n + 1); + * }, 10); + * } * - * @typedef {Function} AsyncFunction - * @static + * function mul3(n, callback) { + * setTimeout(function () { + * callback(null, n * 3); + * }, 10); + * } + * + * var add1mul3 = async.compose(mul3, add1); + * add1mul3(4, function (err, result) { + * // result now equals 15 + * }); */ +var compose = function(/*...args*/) { + return seq.apply(null, slice(arguments).reverse()); +}; + +var _concat = Array.prototype.concat; /** - * Async is a utility module which provides straight-forward, powerful functions - * for working with asynchronous JavaScript. Although originally designed for - * use with [Node.js](http://nodejs.org) and installable via - * `npm install --save async`, it can also be used directly in the browser. - * @module async - * @see AsyncFunction + * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time. + * + * @name concatLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.concat]{@link module:Collections.concat} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, + * which should use an array as its result. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished, or an error occurs. Results is an array + * containing the concatenated results of the `iteratee` function. Invoked with + * (err, results). */ +var concatLimit = function(coll, limit, iteratee, callback) { + callback = callback || noop; + var _iteratee = wrapAsync(iteratee); + mapLimit(coll, limit, function(val, callback) { + _iteratee(val, function(err /*, ...args*/) { + if (err) return callback(err); + return callback(null, slice(arguments, 1)); + }); + }, function(err, mapResults) { + var result = []; + for (var i = 0; i < mapResults.length; i++) { + if (mapResults[i]) { + result = _concat.apply(result, mapResults[i]); + } + } + return callback(err, result); + }); +}; /** - * A collection of `async` functions for manipulating collections, such as - * arrays and objects. - * @module Collections + * Applies `iteratee` to each item in `coll`, concatenating the results. Returns + * the concatenated list. The `iteratee`s are called in parallel, and the + * results are concatenated as they return. There is no guarantee that the + * results array will be returned in the original order of `coll` passed to the + * `iteratee` function. + * + * @name concat + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, + * which should use an array as its result. Invoked with (item, callback). + * @param {Function} [callback(err)] - A callback which is called after all the + * `iteratee` functions have finished, or an error occurs. Results is an array + * containing the concatenated results of the `iteratee` function. Invoked with + * (err, results). + * @example + * + * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) { + * // files is now a list of filenames that exist in the 3 directories + * }); */ +var concat = doLimit(concatLimit, Infinity); /** - * A collection of `async` functions for controlling the flow through a script. - * @module ControlFlow + * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time. + * + * @name concatSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.concat]{@link module:Collections.concat} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`. + * The iteratee should complete with an array an array of results. + * Invoked with (item, callback). + * @param {Function} [callback(err)] - A callback which is called after all the + * `iteratee` functions have finished, or an error occurs. Results is an array + * containing the concatenated results of the `iteratee` function. Invoked with + * (err, results). */ +var concatSeries = doLimit(concatLimit, 1); /** - * A collection of `async` utility functions. - * @module Utils + * Returns a function that when called, calls-back with the values provided. + * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to + * [`auto`]{@link module:ControlFlow.auto}. + * + * @name constant + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {...*} arguments... - Any number of arguments to automatically invoke + * callback with. + * @returns {AsyncFunction} Returns a function that when invoked, automatically + * invokes the callback with the previous given arguments. + * @example + * + * async.waterfall([ + * async.constant(42), + * function (value, next) { + * // value === 42 + * }, + * //... + * ], callback); + * + * async.waterfall([ + * async.constant(filename, "utf8"), + * fs.readFile, + * function (fileData, next) { + * //... + * } + * //... + * ], callback); + * + * async.auto({ + * hostname: async.constant("https://server.net/"), + * port: findFreePort, + * launchServer: ["hostname", "port", function (options, cb) { + * startServer(options, cb); + * }], + * //... + * }, callback); */ - -var index = { - apply: apply, - applyEach: applyEach, - applyEachSeries: applyEachSeries, - asyncify: asyncify, - auto: auto, - autoInject: autoInject, - cargo: cargo, - compose: compose, - concat: concat, - concatLimit: concatLimit, - concatSeries: concatSeries, - constant: constant, - detect: detect, - detectLimit: detectLimit, - detectSeries: detectSeries, - dir: dir, - doDuring: doDuring, - doUntil: doUntil, - doWhilst: doWhilst, - during: during, - each: eachLimit, - eachLimit: eachLimit$1, - eachOf: eachOf, - eachOfLimit: eachOfLimit, - eachOfSeries: eachOfSeries, - eachSeries: eachSeries, - ensureAsync: ensureAsync, - every: every, - everyLimit: everyLimit, - everySeries: everySeries, - filter: filter, - filterLimit: filterLimit, - filterSeries: filterSeries, - forever: forever, - groupBy: groupBy, - groupByLimit: groupByLimit, - groupBySeries: groupBySeries, - log: log, - map: map, - mapLimit: mapLimit, - mapSeries: mapSeries, - mapValues: mapValues, - mapValuesLimit: mapValuesLimit, - mapValuesSeries: mapValuesSeries, - memoize: memoize, - nextTick: nextTick, - parallel: parallelLimit, - parallelLimit: parallelLimit$1, - priorityQueue: priorityQueue, - queue: queue$1, - race: race, - reduce: reduce, - reduceRight: reduceRight, - reflect: reflect, - reflectAll: reflectAll, - reject: reject, - rejectLimit: rejectLimit, - rejectSeries: rejectSeries, - retry: retry, - retryable: retryable, - seq: seq, - series: series, - setImmediate: setImmediate$1, - some: some, - someLimit: someLimit, - someSeries: someSeries, - sortBy: sortBy, - timeout: timeout, - times: times, - timesLimit: timeLimit, - timesSeries: timesSeries, - transform: transform, - tryEach: tryEach, - unmemoize: unmemoize, - until: until, - waterfall: waterfall, - whilst: whilst, - - // aliases - all: every, - allLimit: everyLimit, - allSeries: everySeries, - any: some, - anyLimit: someLimit, - anySeries: someSeries, - find: detect, - findLimit: detectLimit, - findSeries: detectSeries, - forEach: eachLimit, - forEachSeries: eachSeries, - forEachLimit: eachLimit$1, - forEachOf: eachOf, - forEachOfSeries: eachOfSeries, - forEachOfLimit: eachOfLimit, - inject: reduce, - foldl: reduce, - foldr: reduceRight, - select: filter, - selectLimit: filterLimit, - selectSeries: filterSeries, - wrapSync: asyncify +var constant = function(/*...values*/) { + var values = slice(arguments); + var args = [null].concat(values); + return function (/*...ignoredArgs, callback*/) { + var callback = arguments[arguments.length - 1]; + return callback.apply(this, args); + }; }; -exports['default'] = index; -exports.apply = apply; -exports.applyEach = applyEach; -exports.applyEachSeries = applyEachSeries; -exports.asyncify = asyncify; -exports.auto = auto; -exports.autoInject = autoInject; -exports.cargo = cargo; -exports.compose = compose; -exports.concat = concat; -exports.concatLimit = concatLimit; -exports.concatSeries = concatSeries; -exports.constant = constant; -exports.detect = detect; -exports.detectLimit = detectLimit; -exports.detectSeries = detectSeries; -exports.dir = dir; -exports.doDuring = doDuring; -exports.doUntil = doUntil; -exports.doWhilst = doWhilst; -exports.during = during; -exports.each = eachLimit; -exports.eachLimit = eachLimit$1; -exports.eachOf = eachOf; -exports.eachOfLimit = eachOfLimit; -exports.eachOfSeries = eachOfSeries; -exports.eachSeries = eachSeries; -exports.ensureAsync = ensureAsync; -exports.every = every; -exports.everyLimit = everyLimit; -exports.everySeries = everySeries; -exports.filter = filter; -exports.filterLimit = filterLimit; -exports.filterSeries = filterSeries; -exports.forever = forever; -exports.groupBy = groupBy; -exports.groupByLimit = groupByLimit; -exports.groupBySeries = groupBySeries; -exports.log = log; -exports.map = map; -exports.mapLimit = mapLimit; -exports.mapSeries = mapSeries; -exports.mapValues = mapValues; -exports.mapValuesLimit = mapValuesLimit; -exports.mapValuesSeries = mapValuesSeries; -exports.memoize = memoize; -exports.nextTick = nextTick; -exports.parallel = parallelLimit; -exports.parallelLimit = parallelLimit$1; -exports.priorityQueue = priorityQueue; -exports.queue = queue$1; -exports.race = race; -exports.reduce = reduce; -exports.reduceRight = reduceRight; -exports.reflect = reflect; -exports.reflectAll = reflectAll; -exports.reject = reject; -exports.rejectLimit = rejectLimit; -exports.rejectSeries = rejectSeries; -exports.retry = retry; -exports.retryable = retryable; -exports.seq = seq; -exports.series = series; -exports.setImmediate = setImmediate$1; -exports.some = some; -exports.someLimit = someLimit; -exports.someSeries = someSeries; -exports.sortBy = sortBy; -exports.timeout = timeout; -exports.times = times; -exports.timesLimit = timeLimit; -exports.timesSeries = timesSeries; -exports.transform = transform; -exports.tryEach = tryEach; -exports.unmemoize = unmemoize; -exports.until = until; -exports.waterfall = waterfall; -exports.whilst = whilst; -exports.all = every; -exports.allLimit = everyLimit; -exports.allSeries = everySeries; -exports.any = some; -exports.anyLimit = someLimit; -exports.anySeries = someSeries; -exports.find = detect; -exports.findLimit = detectLimit; -exports.findSeries = detectSeries; -exports.forEach = eachLimit; -exports.forEachSeries = eachSeries; -exports.forEachLimit = eachLimit$1; -exports.forEachOf = eachOf; -exports.forEachOfSeries = eachOfSeries; -exports.forEachOfLimit = eachOfLimit; -exports.inject = reduce; -exports.foldl = reduce; -exports.foldr = reduceRight; -exports.select = filter; -exports.selectLimit = filterLimit; -exports.selectSeries = filterSeries; -exports.wrapSync = asyncify; - -Object.defineProperty(exports, '__esModule', { value: true }); - -}))); - - -/***/ }), -/* 226 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; +} -"use strict"; -// 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. +function _createTester(check, getResult) { + return function(eachfn, arr, iteratee, cb) { + cb = cb || noop; + var testPassed = false; + var testResult; + eachfn(arr, function(value, _, callback) { + iteratee(value, function(err, result) { + if (err) { + callback(err); + } else if (check(result) && !testResult) { + testPassed = true; + testResult = getResult(true, value); + callback(null, breakLoop); + } else { + callback(); + } + }); + }, function(err) { + if (err) { + cb(err); + } else { + cb(null, testPassed ? testResult : getResult(false)); + } + }); + }; +} +function _findGetResult(v, x) { + return x; +} -module.exports = Readable; -/**/ +/** + * Returns the first value in `coll` that passes an async truth test. The + * `iteratee` is applied in parallel, meaning the first iteratee to return + * `true` will fire the detect `callback` with that result. That means the + * result might not be the first item in the original `coll` (in terms of order) + * that passes the test. -var Duplex; -/**/ + * If order within the original `coll` is important, then look at + * [`detectSeries`]{@link module:Collections.detectSeries}. + * + * @name detect + * @static + * @memberOf module:Collections + * @method + * @alias find + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + * @example + * + * async.detect(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // result now equals the first file in the list that exists + * }); + */ +var detect = doParallel(_createTester(identity, _findGetResult)); -Readable.ReadableState = ReadableState; -/**/ +/** + * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a + * time. + * + * @name detectLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.detect]{@link module:Collections.detect} + * @alias findLimit + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + */ +var detectLimit = doParallelLimit(_createTester(identity, _findGetResult)); -var EE = __webpack_require__(614).EventEmitter; +/** + * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. + * + * @name detectSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.detect]{@link module:Collections.detect} + * @alias findSeries + * @category Collections + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. + * The iteratee must complete with a boolean value as its result. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the `iteratee` functions have finished. + * Result will be the first item in the array that passes the truth test + * (iteratee) or the value `undefined` if none passed. Invoked with + * (err, result). + */ +var detectSeries = doLimit(detectLimit, 1); -var EElistenerCount = function EElistenerCount(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ +function consoleFunc(name) { + return function (fn/*, ...args*/) { + var args = slice(arguments, 1); + args.push(function (err/*, ...args*/) { + var args = slice(arguments, 1); + if (typeof console === 'object') { + if (err) { + if (console.error) { + console.error(err); + } + } else if (console[name]) { + arrayEach(args, function (x) { + console[name](x); + }); + } + } + }); + wrapAsync(fn).apply(null, args); + }; +} -/**/ +/** + * Logs the result of an [`async` function]{@link AsyncFunction} to the + * `console` using `console.dir` to display the properties of the resulting object. + * Only works in Node.js or in browsers that support `console.dir` and + * `console.error` (such as FF and Chrome). + * If multiple arguments are returned from the async function, + * `console.dir` is called on each argument in order. + * + * @name dir + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} function - The function you want to eventually apply + * all arguments to. + * @param {...*} arguments... - Any number of arguments to apply to the function. + * @example + * + * // in a module + * var hello = function(name, callback) { + * setTimeout(function() { + * callback(null, {hello: name}); + * }, 1000); + * }; + * + * // in the node repl + * node> async.dir(hello, 'world'); + * {hello: 'world'} + */ +var dir = consoleFunc('dir'); +/** + * The post-check version of [`during`]{@link module:ControlFlow.during}. To reflect the difference in + * the order of operations, the arguments `test` and `fn` are switched. + * + * Also a version of [`doWhilst`]{@link module:ControlFlow.doWhilst} with asynchronous `test` function. + * @name doDuring + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.during]{@link module:ControlFlow.during} + * @category Control Flow + * @param {AsyncFunction} fn - An async function which is called each time + * `test` passes. Invoked with (callback). + * @param {AsyncFunction} test - asynchronous truth test to perform before each + * execution of `fn`. Invoked with (...args, callback), where `...args` are the + * non-error args from the previous callback of `fn`. + * @param {Function} [callback] - A callback which is called after the test + * function has failed and repeated execution of `fn` has stopped. `callback` + * will be passed an error if one occurred, otherwise `null`. + */ +function doDuring(fn, test, callback) { + callback = onlyOnce(callback || noop); + var _fn = wrapAsync(fn); + var _test = wrapAsync(test); -var Stream = __webpack_require__(626); -/**/ + function next(err/*, ...args*/) { + if (err) return callback(err); + var args = slice(arguments, 1); + args.push(check); + _test.apply(this, args); + } + function check(err, truth) { + if (err) return callback(err); + if (!truth) return callback(null); + _fn(next); + } -var Buffer = __webpack_require__(407).Buffer; + check(null, true); -var OurUint8Array = global.Uint8Array || function () {}; +} -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); +/** + * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in + * the order of operations, the arguments `test` and `iteratee` are switched. + * + * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. + * + * @name doWhilst + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.whilst]{@link module:ControlFlow.whilst} + * @category Control Flow + * @param {AsyncFunction} iteratee - A function which is called each time `test` + * passes. Invoked with (callback). + * @param {Function} test - synchronous truth test to perform after each + * execution of `iteratee`. Invoked with any non-error callback results of + * `iteratee`. + * @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]); + */ +function doWhilst(iteratee, test, callback) { + callback = onlyOnce(callback || noop); + var _iteratee = wrapAsync(iteratee); + var next = function(err/*, ...args*/) { + if (err) return callback(err); + var args = slice(arguments, 1); + if (test.apply(this, args)) return _iteratee(next); + callback.apply(null, [null].concat(args)); + }; + _iteratee(next); } -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +/** + * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the + * argument ordering differs from `until`. + * + * @name doUntil + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.doWhilst]{@link module:ControlFlow.doWhilst} + * @category Control Flow + * @param {AsyncFunction} iteratee - An async function which is called each time + * `test` fails. Invoked with (callback). + * @param {Function} test - synchronous truth test to perform after each + * execution of `iteratee`. Invoked with any non-error callback results of + * `iteratee`. + * @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]); + */ +function doUntil(iteratee, test, callback) { + doWhilst(iteratee, function() { + return !test.apply(this, arguments); + }, callback); } -/**/ +/** + * Like [`whilst`]{@link module:ControlFlow.whilst}, except the `test` is an asynchronous function that + * is passed a callback in the form of `function (err, truth)`. If error is + * passed to `test` or `fn`, the main callback is immediately called with the + * value of the error. + * + * @name during + * @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 `fn`. Invoked with (callback). + * @param {AsyncFunction} fn - 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 `fn` has stopped. `callback` + * will be passed an error, if one occurred, otherwise `null`. + * @example + * + * var count = 0; + * + * async.during( + * function (callback) { + * return callback(null, count < 5); + * }, + * function (callback) { + * count++; + * setTimeout(callback, 1000); + * }, + * function (err) { + * // 5 seconds have passed + * } + * ); + */ +function during(test, fn, callback) { + callback = onlyOnce(callback || noop); + var _fn = wrapAsync(fn); + var _test = wrapAsync(test); -var debugUtil = __webpack_require__(669); + function next(err) { + if (err) return callback(err); + _test(check); + } -var debug; + function check(err, truth) { + if (err) return callback(err); + if (!truth) return callback(null); + _fn(next); + } -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function debug() {}; + _test(check); } -/**/ +function _withoutIndex(iteratee) { + return function (value, index, callback) { + return iteratee(value, callback); + }; +} -var BufferList = __webpack_require__(912); +/** + * Applies the function `iteratee` to each item in `coll`, in parallel. + * The `iteratee` is called with an item from the list, and a callback for when + * it has finished. If the `iteratee` passes an error to its `callback`, the + * main `callback` (for the `each` function) is immediately called with the + * error. + * + * Note, that since this function applies `iteratee` to each item in parallel, + * there is no guarantee that the iteratee functions will complete in order. + * + * @name each + * @static + * @memberOf module:Collections + * @method + * @alias forEach + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to + * each item in `coll`. Invoked with (item, callback). + * The array index is not passed to the iteratee. + * If you need the index, use `eachOf`. + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @example + * + * // assuming openFiles is an array of file names and saveFile is a function + * // to save the modified contents of that file: + * + * async.each(openFiles, saveFile, function(err){ + * // if any of the saves produced an error, err would equal that error + * }); + * + * // assuming openFiles is an array of file names + * async.each(openFiles, function(file, callback) { + * + * // Perform operation on file here. + * console.log('Processing file ' + file); + * + * if( file.length > 32 ) { + * console.log('This file name is too long'); + * callback('File name too long'); + * } else { + * // Do work to process file here + * console.log('File processed'); + * callback(); + * } + * }, function(err) { + * // if any of the file processing produced an error, err would equal that error + * if( err ) { + * // One of the iterations produced an error. + * // All processing will now stop. + * console.log('A file failed to process'); + * } else { + * console.log('All files have been processed successfully'); + * } + * }); + */ +function eachLimit(coll, iteratee, callback) { + eachOf(coll, _withoutIndex(wrapAsync(iteratee)), callback); +} -var destroyImpl = __webpack_require__(232); +/** + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. + * + * @name eachLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} + * @alias forEachLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The array index is not passed to the iteratee. + * If you need the index, use `eachOfLimit`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +function eachLimit$1(coll, limit, iteratee, callback) { + _eachOfLimit(limit)(coll, _withoutIndex(wrapAsync(iteratee)), callback); +} -var _require = __webpack_require__(404), - getHighWaterMark = _require.getHighWaterMark; +/** + * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. + * + * @name eachSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.each]{@link module:Collections.each} + * @alias forEachSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. + * The array index is not passed to the iteratee. + * If you need the index, use `eachOfSeries`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + */ +var eachSeries = doLimit(eachLimit$1, 1); -var _require$codes = __webpack_require__(38).codes, - ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, - ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, - ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, - ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance. +/** + * Wrap an async function and ensure it calls its callback on a later tick of + * the event loop. If the function already calls its callback on a next tick, + * no extra deferral is added. This is useful for preventing stack overflows + * (`RangeError: Maximum call stack size exceeded`) and generally keeping + * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) + * contained. ES2017 `async` functions are returned as-is -- they are immune + * to Zalgo's corrupting influences, as they always resolve on a later tick. + * + * @name ensureAsync + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - an async function, one that expects a node-style + * callback as its last argument. + * @returns {AsyncFunction} Returns a wrapped function with the exact same call + * signature as the function passed in. + * @example + * + * function sometimesAsync(arg, callback) { + * if (cache[arg]) { + * return callback(null, cache[arg]); // this would be synchronous!! + * } else { + * doSomeIO(arg, callback); // this IO would be asynchronous + * } + * } + * + * // this has a risk of stack overflows if many results are cached in a row + * async.mapSeries(args, sometimesAsync, done); + * + * // this will defer sometimesAsync's callback if necessary, + * // preventing stack overflows + * async.mapSeries(args, async.ensureAsync(sometimesAsync), done); + */ +function ensureAsync(fn) { + if (isAsync(fn)) return fn; + return initialParams(function (args, callback) { + var sync = true; + args.push(function () { + var innerArgs = arguments; + if (sync) { + setImmediate$1(function () { + callback.apply(null, innerArgs); + }); + } else { + callback.apply(null, innerArgs); + } + }); + fn.apply(this, args); + sync = false; + }); +} +function notId(v) { + return !v; +} -var StringDecoder; -var createReadableStreamAsyncIterator; -var from; +/** + * Returns `true` if every element in `coll` satisfies an async test. If any + * iteratee call returns `false`, the main `callback` is immediately called. + * + * @name every + * @static + * @memberOf module:Collections + * @method + * @alias all + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in parallel. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + * @example + * + * async.every(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // if result is true then every file exists + * }); + */ +var every = doParallel(_createTester(notId, notId)); -__webpack_require__(689)(Readable, Stream); +/** + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. + * + * @name everyLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} + * @alias allLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in parallel. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + */ +var everyLimit = doParallelLimit(_createTester(notId, notId)); -var errorOrDestroy = destroyImpl.errorOrDestroy; -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +/** + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. + * + * @name everySeries + * @static + * @memberOf module:Collections + * @method + * @see [async.every]{@link module:Collections.every} + * @alias allSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collection in series. + * The iteratee must complete with a boolean result value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result will be either `true` or `false` + * depending on the values of the async tests. Invoked with (err, result). + */ +var everySeries = doLimit(everyLimit, 1); -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. +/** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; +} - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +function filterArray(eachfn, arr, iteratee, callback) { + var truthValues = new Array(arr.length); + eachfn(arr, function (x, index, callback) { + iteratee(x, function (err, v) { + truthValues[index] = !!v; + callback(err); + }); + }, function (err) { + if (err) return callback(err); + var results = []; + for (var i = 0; i < arr.length; i++) { + if (truthValues[i]) results.push(arr[i]); + } + callback(null, results); + }); } -function ReadableState(options, stream, isDuplex) { - Duplex = Duplex || __webpack_require__(831); - options = options || {}; // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. +function filterGeneric(eachfn, coll, iteratee, callback) { + var results = []; + eachfn(coll, function (x, index, callback) { + iteratee(x, function (err, v) { + if (err) { + callback(err); + } else { + if (v) { + results.push({index: index, value: x}); + } + callback(); + } + }); + }, function (err) { + if (err) { + callback(err); + } else { + callback(null, arrayMap(results.sort(function (a, b) { + return a.index - b.index; + }), baseProperty('value'))); + } + }); +} - if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away +function _filter(eachfn, coll, iteratee, callback) { + var filter = isArrayLike(coll) ? filterArray : filterGeneric; + filter(eachfn, coll, wrapAsync(iteratee), callback || noop); +} - this.objectMode = !!options.objectMode; - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" +/** + * Returns a new array of all the values in `coll` which pass an async truth + * test. This operation is performed in parallel, but the results array will be + * in the same order as the original. + * + * @name filter + * @static + * @memberOf module:Collections + * @method + * @alias select + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + * @example + * + * async.filter(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, results) { + * // results now equals an array of the existing files + * }); + */ +var filter = doParallel(_filter); - this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() +/** + * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a + * time. + * + * @name filterLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @alias selectLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +var filterLimit = doParallelLimit(_filter); - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - - this.sync = true; // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - this.paused = true; // Should close be emitted on destroy. Defaults to true. - - this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish') - - this.autoDestroy = !!options.autoDestroy; // has it been destroyed - - this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - - this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s - - this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled - - this.readingMore = false; - this.decoder = null; - this.encoding = null; - - if (options.encoding) { - if (!StringDecoder) StringDecoder = __webpack_require__(432).StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - Duplex = Duplex || __webpack_require__(831); - if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside - // the ReadableState constructor, at least with V8 6.5 - - var isDuplex = this instanceof Duplex; - this._readableState = new ReadableState(options, this, isDuplex); // legacy - - this.readable = true; +/** + * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. + * + * @name filterSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @alias selectSeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - A truth test to apply to each item in `coll`. + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called + * with a boolean argument once it has completed. Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results) + */ +var filterSeries = doLimit(filterLimit, 1); - if (options) { - if (typeof options.read === 'function') this._read = options.read; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } +/** + * Calls the asynchronous function `fn` with a callback parameter that allows it + * to call itself again, in series, indefinitely. - Stream.call(this); -} + * If an error is passed to the callback then `errback` is called with the + * error, and execution stops, otherwise it will never be called. + * + * @name forever + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {AsyncFunction} fn - an async function to call repeatedly. + * Invoked with (next). + * @param {Function} [errback] - when `fn` passes an error to it's callback, + * this function will be called, and execution stops. Invoked with (err). + * @example + * + * async.forever( + * function(next) { + * // next is suitable for passing to things that need a callback(err [, whatever]); + * // it will result in this function being called again. + * }, + * function(err) { + * // if next is called with a value in its first parameter, it will appear + * // in here as 'err', and execution will stop. + * } + * ); + */ +function forever(fn, errback) { + var done = onlyOnce(errback || noop); + var task = wrapAsync(ensureAsync(fn)); -Object.defineProperty(Readable.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined) { - return false; + function next(err) { + if (err) return done(err); + task(next); } + next(); +} - return this._readableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._readableState.destroyed = value; - } -}); -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; - -Readable.prototype._destroy = function (err, cb) { - cb(err); -}; // Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. - +/** + * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time. + * + * @name groupByLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.groupBy]{@link module:Collections.groupBy} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + */ +var groupByLimit = function(coll, limit, iteratee, callback) { + callback = callback || noop; + var _iteratee = wrapAsync(iteratee); + mapLimit(coll, limit, function(val, callback) { + _iteratee(val, function(err, key) { + if (err) return callback(err); + return callback(null, {key: key, val: val}); + }); + }, function(err, mapResults) { + var result = {}; + // from MDN, handle object having an `hasOwnProperty` prop + var hasOwnProperty = Object.prototype.hasOwnProperty; -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; + for (var i = 0; i < mapResults.length; i++) { + if (mapResults[i]) { + var key = mapResults[i].key; + var val = mapResults[i].val; - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; + if (hasOwnProperty.call(result, key)) { + result[key].push(val); + } else { + result[key] = [val]; + } + } + } - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } + return callback(err, result); + }); +}; - skipChunkCheck = true; - } - } else { - skipChunkCheck = true; - } +/** + * Returns a new object, where each value corresponds to an array of items, from + * `coll`, that returned the corresponding key. That is, the keys of the object + * correspond to the values passed to the `iteratee` callback. + * + * Note: Since this function applies the `iteratee` to each item in parallel, + * there is no guarantee that the `iteratee` functions will complete in order. + * However, the values for each key in the `result` will be in the same order as + * the original `coll`. For Objects, the values will roughly be in the order of + * the original Objects' keys (but this can vary across JavaScript engines). + * + * @name groupBy + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + * @example + * + * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { + * db.findById(userId, function(err, user) { + * if (err) return callback(err); + * return callback(null, user.age); + * }); + * }, function(err, result) { + * // result is object containing the userIds grouped by age + * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; + * }); + */ +var groupBy = doLimit(groupByLimit, Infinity); - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; // Unshift should *always* be something directly out of read() +/** + * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time. + * + * @name groupBySeries + * @static + * @memberOf module:Collections + * @method + * @see [async.groupBy]{@link module:Collections.groupBy} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a `key` to group the value under. + * Invoked with (value, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Result is an `Object` whoses + * properties are arrays of values which returned the corresponding key. + */ +var groupBySeries = doLimit(groupByLimit, 1); +/** + * Logs the result of an `async` function to the `console`. Only works in + * Node.js or in browsers that support `console.log` and `console.error` (such + * as FF and Chrome). If multiple arguments are returned from the async + * function, `console.log` is called on each argument in order. + * + * @name log + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} function - The function you want to eventually apply + * all arguments to. + * @param {...*} arguments... - Any number of arguments to apply to the function. + * @example + * + * // in a module + * var hello = function(name, callback) { + * setTimeout(function() { + * callback(null, 'hello ' + name); + * }, 1000); + * }; + * + * // in the node repl + * node> async.log(hello, 'world'); + * 'hello world' + */ +var log = consoleFunc('log'); -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; +/** + * The same as [`mapValues`]{@link module:Collections.mapValues} but runs a maximum of `limit` async operations at a + * time. + * + * @name mapValuesLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.mapValues]{@link module:Collections.mapValues} + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + */ +function mapValuesLimit(obj, limit, iteratee, callback) { + callback = once(callback || noop); + var newObj = {}; + var _iteratee = wrapAsync(iteratee); + eachOfLimit(obj, limit, function(val, key, next) { + _iteratee(val, key, function (err, result) { + if (err) return next(err); + newObj[key] = result; + next(); + }); + }, function (err) { + callback(err, newObj); + }); +} -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - debug('readableAddChunk', chunk); - var state = stream._readableState; +/** + * A relative of [`map`]{@link module:Collections.map}, designed for use with objects. + * + * Produces a new Object by mapping each value of `obj` through the `iteratee` + * function. The `iteratee` is called each `value` and `key` from `obj` and a + * callback for when it has finished processing. Each of these callbacks takes + * two arguments: an `error`, and the transformed item from `obj`. If `iteratee` + * passes an error to its callback, the main `callback` (for the `mapValues` + * function) is immediately called with the error. + * + * Note, the order of the keys in the result is not guaranteed. The keys will + * be roughly in the order they complete, (but this is very engine-specific) + * + * @name mapValues + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + * @example + * + * async.mapValues({ + * f1: 'file1', + * f2: 'file2', + * f3: 'file3' + * }, function (file, key, callback) { + * fs.stat(file, callback); + * }, function(err, result) { + * // result is now a map of stats for each file, e.g. + * // { + * // f1: [stats for file1], + * // f2: [stats for file2], + * // f3: [stats for file3] + * // } + * }); + */ - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); +var mapValues = doLimit(mapValuesLimit, Infinity); - if (er) { - errorOrDestroy(stream, er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } +/** + * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time. + * + * @name mapValuesSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.mapValues]{@link module:Collections.mapValues} + * @category Collection + * @param {Object} obj - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each value and key + * in `coll`. + * The iteratee should complete with the transformed value as its result. + * Invoked with (value, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. `result` is a new object consisting + * of each key from `obj`, with each transformed value on the right-hand side. + * Invoked with (err, result). + */ +var mapValuesSeries = doLimit(mapValuesLimit, 1); - if (addToFront) { - if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); - } else if (state.ended) { - errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); - } else if (state.destroyed) { - return false; - } else { - state.reading = false; +function has(obj, key) { + return key in obj; +} - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); +/** + * Caches the results of an async function. When creating a hash to store + * function results against, the callback is omitted from the hash and an + * optional hash function can be used. + * + * If no hash function is specified, the first argument is used as a hash key, + * which may work reasonably if it is a string or a data type that converts to a + * distinct string. Note that objects and arrays will not behave reasonably. + * Neither will cases where the other arguments are significant. In such cases, + * specify your own hash function. + * + * The cache of results is exposed as the `memo` property of the function + * returned by `memoize`. + * + * @name memoize + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - The async function to proxy and cache results from. + * @param {Function} hasher - An optional function for generating a custom hash + * for storing results. It has all the arguments applied to it apart from the + * callback, and must be synchronous. + * @returns {AsyncFunction} a memoized version of `fn` + * @example + * + * var slow_fn = function(name, callback) { + * // do something + * callback(null, result); + * }; + * var fn = async.memoize(slow_fn); + * + * // fn can now be used as if it were slow_fn + * fn('some name', function() { + * // callback + * }); + */ +function memoize(fn, hasher) { + var memo = Object.create(null); + var queues = Object.create(null); + hasher = hasher || identity; + var _fn = wrapAsync(fn); + var memoized = initialParams(function memoized(args, callback) { + var key = hasher.apply(null, args); + if (has(memo, key)) { + setImmediate$1(function() { + callback.apply(null, memo[key]); + }); + } else if (has(queues, key)) { + queues[key].push(callback); } else { - addChunk(stream, state, chunk, false); + queues[key] = [callback]; + _fn.apply(null, args.concat(function(/*args*/) { + var args = slice(arguments); + memo[key] = args; + var q = queues[key]; + delete queues[key]; + for (var i = 0, l = q.length; i < l; i++) { + q[i].apply(null, args); + } + })); } - } - } else if (!addToFront) { - state.reading = false; - maybeReadMore(stream, state); - } - } // We can push more data if we are below the highWaterMark. - // Also, if we have no data yet, we can stand some more bytes. - // This is to work around cases where hwm=0, such as the repl. - - - return !state.ended && (state.length < state.highWaterMark || state.length === 0); + }); + memoized.memo = memo; + memoized.unmemoized = fn; + return memoized; } -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - state.awaitDrain = 0; - stream.emit('data', chunk); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - if (state.needReadable) emitReadable(stream); - } +/** + * Calls `callback` on a later loop around the event loop. In Node.js this just + * calls `process.nextTick`. In the browser it will use `setImmediate` if + * available, otherwise `setTimeout(callback, 0)`, which means other higher + * priority events may precede the execution of `callback`. + * + * This is used internally for browser-compatibility purposes. + * + * @name nextTick + * @static + * @memberOf module:Utils + * @method + * @see [async.setImmediate]{@link module:Utils.setImmediate} + * @category Util + * @param {Function} callback - The function to call on a later loop around + * the event loop. Invoked with (args...). + * @param {...*} args... - any number of additional arguments to pass to the + * callback on the next tick. + * @example + * + * var call_order = []; + * async.nextTick(function() { + * call_order.push('two'); + * // call_order now equals ['one','two'] + * }); + * call_order.push('one'); + * + * async.setImmediate(function (a, b, c) { + * // a, b, and c equal 1, 2, and 3 + * }, 1, 2, 3); + */ +var _defer$1; - maybeReadMore(stream, state); +if (hasNextTick) { + _defer$1 = process.nextTick; +} else if (hasSetImmediate) { + _defer$1 = setImmediate; +} else { + _defer$1 = fallback; } -function chunkInvalid(state, chunk) { - var er; +var nextTick = wrap(_defer$1); - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); - } +function _parallel(eachfn, tasks, callback) { + callback = callback || noop; + var results = isArrayLike(tasks) ? [] : {}; - return er; + eachfn(tasks, function (task, key, callback) { + wrapAsync(task)(function (err, result) { + if (arguments.length > 2) { + result = slice(arguments, 1); + } + results[key] = result; + callback(err); + }); + }, function (err) { + callback(err, results); + }); } -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; // backwards compatibility. - - -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = __webpack_require__(432).StringDecoder; - var decoder = new StringDecoder(enc); - this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8 - - this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers: - - var p = this._readableState.buffer.head; - var content = ''; - - while (p !== null) { - content += decoder.write(p.data); - p = p.next; - } +/** + * Run the `tasks` collection of functions in parallel, without waiting until + * the previous function has completed. If any of the functions pass an error to + * its callback, the main `callback` is immediately called with the value of the + * error. Once the `tasks` have completed, the results are passed to the final + * `callback` as an array. + * + * **Note:** `parallel` is about kicking-off I/O tasks in parallel, not about + * parallel execution of code. If your tasks do not use any timers or perform + * any I/O, they will actually be executed in series. Any synchronous setup + * sections for each task will happen one after the other. JavaScript remains + * single-threaded. + * + * **Hint:** Use [`reflect`]{@link module:Utils.reflect} to continue the + * execution of other tasks when a task fails. + * + * It is also possible to use an object instead of an array. Each property will + * be run as a function and the results will be passed to the final `callback` + * as an object instead of an array. This can be a more readable way of handling + * results from {@link async.parallel}. + * + * @name parallel + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection of + * [async functions]{@link AsyncFunction} to run. + * Each async function can complete with any number of optional `result` values. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed successfully. This function gets a results array + * (or object) containing all the result arguments passed to the task callbacks. + * Invoked with (err, results). + * + * @example + * async.parallel([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ], + * // optional callback + * function(err, results) { + * // the results array will equal ['one','two'] even though + * // the second function had a shorter timeout. + * }); + * + * // an example using an object instead of an array + * async.parallel({ + * one: function(callback) { + * setTimeout(function() { + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * callback(null, 2); + * }, 100); + * } + * }, function(err, results) { + * // results is now equals to: {one: 1, two: 2} + * }); + */ +function parallelLimit(tasks, callback) { + _parallel(eachOf, tasks, callback); +} - this._readableState.buffer.clear(); +/** + * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a + * time. + * + * @name parallelLimit + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.parallel]{@link module:ControlFlow.parallel} + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection of + * [async functions]{@link AsyncFunction} to run. + * Each async function can complete with any number of optional `result` values. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed successfully. This function gets a results array + * (or object) containing all the result arguments passed to the task callbacks. + * Invoked with (err, results). + */ +function parallelLimit$1(tasks, limit, callback) { + _parallel(_eachOfLimit(limit), tasks, callback); +} - if (content !== '') this._readableState.buffer.push(content); - this._readableState.length = content.length; - return this; -}; // Don't raise the hwm > 1GB +/** + * A queue of tasks for the worker function to complete. + * @typedef {Object} QueueObject + * @memberOf module:ControlFlow + * @property {Function} length - a function returning the number of items + * waiting to be processed. Invoke with `queue.length()`. + * @property {boolean} started - a boolean indicating whether or not any + * items have been pushed and processed by the queue. + * @property {Function} running - a function returning the number of items + * currently being processed. Invoke with `queue.running()`. + * @property {Function} workersList - a function returning the array of items + * currently being processed. Invoke with `queue.workersList()`. + * @property {Function} idle - a function returning false if there are items + * waiting or being processed, or true if not. Invoke with `queue.idle()`. + * @property {number} concurrency - an integer for determining how many `worker` + * functions should be run in parallel. This property can be changed after a + * `queue` is created to alter the concurrency on-the-fly. + * @property {Function} push - add a new task to the `queue`. Calls `callback` + * once the `worker` has finished processing the task. Instead of a single task, + * a `tasks` array can be submitted. The respective callback is used for every + * task in the list. Invoke with `queue.push(task, [callback])`, + * @property {Function} unshift - add a new task to the front of the `queue`. + * Invoke with `queue.unshift(task, [callback])`. + * @property {Function} remove - remove items from the queue that match a test + * function. The test function will be passed an object with a `data` property, + * and a `priority` property, if this is a + * [priorityQueue]{@link module:ControlFlow.priorityQueue} object. + * Invoked with `queue.remove(testFn)`, where `testFn` is of the form + * `function ({data, priority}) {}` and returns a Boolean. + * @property {Function} saturated - a callback that is called when the number of + * running workers hits the `concurrency` limit, and further tasks will be + * queued. + * @property {Function} unsaturated - a callback that is called when the number + * of running workers is less than the `concurrency` & `buffer` limits, and + * further tasks will not be queued. + * @property {number} buffer - A minimum threshold buffer in order to say that + * the `queue` is `unsaturated`. + * @property {Function} empty - a callback that is called when the last item + * from the `queue` is given to a `worker`. + * @property {Function} drain - a callback that is called when the last item + * from the `queue` has returned from the `worker`. + * @property {Function} error - a callback that is called when a task errors. + * Has the signature `function(error, task)`. + * @property {boolean} paused - a boolean for determining whether the queue is + * in a paused state. + * @property {Function} pause - a function that pauses the processing of tasks + * until `resume()` is called. Invoke with `queue.pause()`. + * @property {Function} resume - a function that resumes the processing of + * queued tasks when the queue is paused. Invoke with `queue.resume()`. + * @property {Function} kill - a function that removes the `drain` callback and + * empties remaining tasks from the queue forcing it to go idle. No more tasks + * should be pushed to the queue after calling this function. Invoke with `queue.kill()`. + */ +/** + * Creates a `queue` object with the specified `concurrency`. Tasks added to the + * `queue` are processed in parallel (up to the `concurrency` limit). If all + * `worker`s are in progress, the task is queued until one becomes available. + * Once a `worker` completes a `task`, that `task`'s callback is called. + * + * @name queue + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {AsyncFunction} worker - An async function for processing a queued task. + * If you want to handle errors from an individual task, pass a callback to + * `q.push()`. Invoked with (task, callback). + * @param {number} [concurrency=1] - An `integer` for determining how many + * `worker` functions should be run in parallel. If omitted, the concurrency + * defaults to `1`. If the concurrency is `0`, an error is thrown. + * @returns {module:ControlFlow.QueueObject} A queue object to manage the tasks. Callbacks can + * attached as certain properties to listen for specific events during the + * lifecycle of the queue. + * @example + * + * // create a queue object with concurrency 2 + * var q = async.queue(function(task, callback) { + * console.log('hello ' + task.name); + * callback(); + * }, 2); + * + * // assign a callback + * q.drain = function() { + * console.log('all items have been processed'); + * }; + * + * // add some items to the queue + * q.push({name: 'foo'}, function(err) { + * console.log('finished processing foo'); + * }); + * q.push({name: 'bar'}, function (err) { + * console.log('finished processing bar'); + * }); + * + * // add some items to the queue (batch-wise) + * q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function(err) { + * console.log('finished processing item'); + * }); + * + * // add some items to the front of the queue + * q.unshift({name: 'bar'}, function (err) { + * console.log('finished processing bar'); + * }); + */ +var queue$1 = function (worker, concurrency) { + var _worker = wrapAsync(worker); + return queue(function (items, cb) { + _worker(items[0], cb); + }, concurrency, 1); +}; -var MAX_HWM = 0x40000000; +/** + * The same as [async.queue]{@link module:ControlFlow.queue} only tasks are assigned a priority and + * completed in ascending priority order. + * + * @name priorityQueue + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.queue]{@link module:ControlFlow.queue} + * @category Control Flow + * @param {AsyncFunction} worker - An async function for processing a queued task. + * If you want to handle errors from an individual task, pass a callback to + * `q.push()`. + * Invoked with (task, callback). + * @param {number} concurrency - An `integer` for determining how many `worker` + * functions should be run in parallel. If omitted, the concurrency defaults to + * `1`. If the concurrency is `0`, an error is thrown. + * @returns {module:ControlFlow.QueueObject} A priorityQueue object to manage the tasks. There are two + * differences between `queue` and `priorityQueue` objects: + * * `push(task, priority, [callback])` - `priority` should be a number. If an + * array of `tasks` is given, all tasks will be assigned the same priority. + * * The `unshift` method was removed. + */ +var priorityQueue = function(worker, concurrency) { + // Start with a normal queue + var q = queue$1(worker, concurrency); -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } + // Override push to accept second parameter representing priority + q.push = function(data, priority, callback) { + if (callback == null) callback = noop; + if (typeof callback !== 'function') { + throw new Error('task callback must be a function'); + } + q.started = true; + if (!isArray(data)) { + data = [data]; + } + if (data.length === 0) { + // call drain immediately if there are no tasks + return setImmediate$1(function() { + q.drain(); + }); + } - return n; -} // This function is designed to be inlinable, so please take care when making -// changes to the function body. + priority = priority || 0; + var nextNode = q._tasks.head; + while (nextNode && priority >= nextNode.priority) { + nextNode = nextNode.next; + } + for (var i = 0, l = data.length; i < l; i++) { + var item = { + data: data[i], + priority: priority, + callback: callback + }; -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; + if (nextNode) { + q._tasks.insertBefore(nextNode, item); + } else { + q._tasks.push(item); + } + } + setImmediate$1(q.process); + }; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } // If we're asking for more than the current hwm, then raise the hwm. + // Remove unshift function + delete q.unshift; + return q; +}; - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; // Don't have enough +/** + * Runs the `tasks` array of functions in parallel, without waiting until the + * previous function has completed. Once any of the `tasks` complete or pass an + * error to its callback, the main `callback` is immediately called. It's + * equivalent to `Promise.race()`. + * + * @name race + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction} + * to run. Each function can complete with an optional `result` value. + * @param {Function} callback - A callback to run once any of the functions have + * completed. This function gets an error or result from the first function that + * completed. Invoked with (err, result). + * @returns undefined + * @example + * + * async.race([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ], + * // main callback + * function(err, result) { + * // the result will be equal to 'two' as it finishes earlier + * }); + */ +function race(tasks, callback) { + callback = once(callback || noop); + if (!isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions')); + if (!tasks.length) return callback(); + for (var i = 0, l = tasks.length; i < l; i++) { + wrapAsync(tasks[i])(callback); + } +} - if (!state.ended) { - state.needReadable = true; - return 0; - } +/** + * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. + * + * @name reduceRight + * @static + * @memberOf module:Collections + * @method + * @see [async.reduce]{@link module:Collections.reduce} + * @alias foldr + * @category Collection + * @param {Array} array - A collection to iterate over. + * @param {*} memo - The initial state of the reduction. + * @param {AsyncFunction} iteratee - A function applied to each item in the + * array to produce the next step in the reduction. + * The `iteratee` should complete with the next state of the reduction. + * If the iteratee complete with an error, the reduction is stopped and the + * main `callback` is immediately called with the error. + * Invoked with (memo, item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the reduced value. Invoked with + * (err, result). + */ +function reduceRight (array, memo, iteratee, callback) { + var reversed = slice(array).reverse(); + reduce(reversed, memo, iteratee, callback); +} - return state.length; -} // you can override either this method, or the async _read(n) below. +/** + * Wraps the async function in another function that always completes with a + * result object, even when it errors. + * + * The result object has either the property `error` or `value`. + * + * @name reflect + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} fn - The async function you want to wrap + * @returns {Function} - A function that always passes null to it's callback as + * the error. The second argument to the callback will be an `object` with + * either an `error` or a `value` property. + * @example + * + * async.parallel([ + * async.reflect(function(callback) { + * // do some stuff ... + * callback(null, 'one'); + * }), + * async.reflect(function(callback) { + * // do some more stuff but error ... + * callback('bad stuff happened'); + * }), + * async.reflect(function(callback) { + * // do some more stuff ... + * callback(null, 'two'); + * }) + * ], + * // optional callback + * function(err, results) { + * // values + * // results[0].value = 'one' + * // results[1].error = 'bad stuff happened' + * // results[2].value = 'two' + * }); + */ +function reflect(fn) { + var _fn = wrapAsync(fn); + return initialParams(function reflectOn(args, reflectCallback) { + args.push(function callback(error, cbArg) { + if (error) { + reflectCallback(null, { error: error }); + } else { + var value; + if (arguments.length <= 2) { + value = cbArg; + } else { + value = slice(arguments, 1); + } + reflectCallback(null, { value: value }); + } + }); + return _fn.apply(this, args); + }); +} -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; - if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - - if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up. - - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - // if we need a readable event, then we need to do some reading. - - - var doRead = state.needReadable; - debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some - - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - - - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; // if the length is currently zero, then we *need* a readable event. - - if (state.length === 0) state.needReadable = true; // call internal read method - - this._read(state.highWaterMark); +/** + * A helper function that wraps an array or an object of functions with `reflect`. + * + * @name reflectAll + * @static + * @memberOf module:Utils + * @method + * @see [async.reflect]{@link module:Utils.reflect} + * @category Util + * @param {Array|Object|Iterable} tasks - The collection of + * [async functions]{@link AsyncFunction} to wrap in `async.reflect`. + * @returns {Array} Returns an array of async functions, each wrapped in + * `async.reflect` + * @example + * + * let tasks = [ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * // do some more stuff but error ... + * callback(new Error('bad stuff happened')); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ]; + * + * async.parallel(async.reflectAll(tasks), + * // optional callback + * function(err, results) { + * // values + * // results[0].value = 'one' + * // results[1].error = Error('bad stuff happened') + * // results[2].value = 'two' + * }); + * + * // an example using an object instead of an array + * let tasks = { + * one: function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * two: function(callback) { + * callback('two'); + * }, + * three: function(callback) { + * setTimeout(function() { + * callback(null, 'three'); + * }, 100); + * } + * }; + * + * async.parallel(async.reflectAll(tasks), + * // optional callback + * function(err, results) { + * // values + * // results.one.value = 'one' + * // results.two.error = 'two' + * // results.three.value = 'three' + * }); + */ +function reflectAll(tasks) { + var results; + if (isArray(tasks)) { + results = arrayMap(tasks, reflect); + } else { + results = {}; + baseForOwn(tasks, function(task, key) { + results[key] = reflect.call(this, task); + }); + } + return results; +} - state.sync = false; // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. +function reject$1(eachfn, arr, iteratee, callback) { + _filter(eachfn, arr, function(value, cb) { + iteratee(value, function(err, v) { + cb(err, !v); + }); + }, callback); +} - if (!state.reading) n = howMuchToRead(nOrig, state); - } +/** + * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test. + * + * @name reject + * @static + * @memberOf module:Collections + * @method + * @see [async.filter]{@link module:Collections.filter} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + * @example + * + * async.reject(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, results) { + * // results now equals an array of missing files + * createFiles(results); + * }); + */ +var reject = doParallel(reject$1); - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; +/** + * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a + * time. + * + * @name rejectLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.reject]{@link module:Collections.reject} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +var rejectLimit = doParallelLimit(reject$1); - if (ret === null) { - state.needReadable = state.length <= state.highWaterMark; - n = 0; - } else { - state.length -= n; - state.awaitDrain = 0; - } +/** + * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time. + * + * @name rejectSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.reject]{@link module:Collections.reject} + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Function} iteratee - An async truth test to apply to each item in + * `coll`. + * The should complete with a boolean value as its `result`. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Invoked with (err, results). + */ +var rejectSeries = doLimit(rejectLimit, 1); - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick. +/** + * Creates a function that returns `value`. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {*} value The value to return from the new function. + * @returns {Function} Returns the new constant function. + * @example + * + * var objects = _.times(2, _.constant({ 'a': 1 })); + * + * console.log(objects); + * // => [{ 'a': 1 }, { 'a': 1 }] + * + * console.log(objects[0] === objects[1]); + * // => true + */ +function constant$1(value) { + return function() { + return value; + }; +} - if (nOrig !== n && state.ended) endReadable(this); - } +/** + * Attempts to get a successful response from `task` no more than `times` times + * before returning an error. If the task is successful, the `callback` will be + * passed the result of the successful task. If all attempts fail, the callback + * will be passed the error and result (if any) of the final attempt. + * + * @name retry + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @see [async.retryable]{@link module:ControlFlow.retryable} + * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - Can be either an + * object with `times` and `interval` or a number. + * * `times` - The number of attempts to make before giving up. The default + * is `5`. + * * `interval` - The time to wait between retries, in milliseconds. The + * default is `0`. The interval may also be specified as a function of the + * retry count (see example). + * * `errorFilter` - An optional synchronous function that is invoked on + * erroneous result. If it returns `true` the retry attempts will continue; + * if the function returns `false` the retry flow is aborted with the current + * attempt's error and result being returned to the final callback. + * Invoked with (err). + * * If `opts` is a number, the number specifies the number of times to retry, + * with the default interval of `0`. + * @param {AsyncFunction} task - An async function to retry. + * Invoked with (callback). + * @param {Function} [callback] - An optional callback which is called when the + * task has succeeded, or after the final failed attempt. It receives the `err` + * and `result` arguments of the last attempt at completing the `task`. Invoked + * with (err, results). + * + * @example + * + * // The `retry` function can be used as a stand-alone control flow by passing + * // a callback, as shown below: + * + * // try calling apiMethod 3 times + * async.retry(3, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod 3 times, waiting 200 ms between each retry + * async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod 10 times with exponential backoff + * // (i.e. intervals of 100, 200, 400, 800, 1600, ... milliseconds) + * async.retry({ + * times: 10, + * interval: function(retryCount) { + * return 50 * Math.pow(2, retryCount); + * } + * }, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod the default 5 times no delay between each retry + * async.retry(apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // try calling apiMethod only when error condition satisfies, all other + * // errors will abort the retry control flow and return to final callback + * async.retry({ + * errorFilter: function(err) { + * return err.message === 'Temporary error'; // only retry on a specific error + * } + * }, apiMethod, function(err, result) { + * // do something with the result + * }); + * + * // to retry individual methods that are not as reliable within other + * // control flow functions, use the `retryable` wrapper: + * async.auto({ + * users: api.getUsers.bind(api), + * payments: async.retryable(3, api.getPayments.bind(api)) + * }, function(err, results) { + * // do something with the results + * }); + * + */ +function retry(opts, task, callback) { + var DEFAULT_TIMES = 5; + var DEFAULT_INTERVAL = 0; - if (ret !== null) this.emit('data', ret); - return ret; -}; + var options = { + times: DEFAULT_TIMES, + intervalFunc: constant$1(DEFAULT_INTERVAL) + }; -function onEofChunk(stream, state) { - debug('onEofChunk'); - if (state.ended) return; + function parseTimes(acc, t) { + if (typeof t === 'object') { + acc.times = +t.times || DEFAULT_TIMES; - if (state.decoder) { - var chunk = state.decoder.end(); + acc.intervalFunc = typeof t.interval === 'function' ? + t.interval : + constant$1(+t.interval || DEFAULT_INTERVAL); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; + acc.errorFilter = t.errorFilter; + } else if (typeof t === 'number' || typeof t === 'string') { + acc.times = +t || DEFAULT_TIMES; + } else { + throw new Error("Invalid arguments for async.retry"); + } } - } - - state.ended = true; - if (state.sync) { - // if we are sync, wait until next tick to emit the data. - // Otherwise we risk emitting data in the flow() - // the readable code triggers during a read() call - emitReadable(stream); - } else { - // emit 'readable' now to make sure it gets picked up. - state.needReadable = false; + if (arguments.length < 3 && typeof opts === 'function') { + callback = task || noop; + task = opts; + } else { + parseTimes(options, opts); + callback = callback || noop; + } - if (!state.emittedReadable) { - state.emittedReadable = true; - emitReadable_(stream); + if (typeof task !== 'function') { + throw new Error("Invalid arguments for async.retry"); } - } -} // Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. + var _task = wrapAsync(task); -function emitReadable(stream) { - var state = stream._readableState; - debug('emitReadable', state.needReadable, state.emittedReadable); - state.needReadable = false; + var attempt = 1; + function retryAttempt() { + _task(function(err) { + if (err && attempt++ < options.times && + (typeof options.errorFilter != 'function' || + options.errorFilter(err))) { + setTimeout(retryAttempt, options.intervalFunc(attempt)); + } else { + callback.apply(null, arguments); + } + }); + } - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - process.nextTick(emitReadable_, stream); - } + retryAttempt(); } -function emitReadable_(stream) { - var state = stream._readableState; - debug('emitReadable_', state.destroyed, state.length, state.ended); - - if (!state.destroyed && (state.length || state.ended)) { - stream.emit('readable'); - state.emittedReadable = false; - } // The stream needs another readable event if - // 1. It is not flowing, as the flow mechanism will take - // care of it. - // 2. It is not ended. - // 3. It is below the highWaterMark, so we can schedule - // another readable later. - +/** + * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method + * wraps a task and makes it retryable, rather than immediately calling it + * with retries. + * + * @name retryable + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.retry]{@link module:ControlFlow.retry} + * @category Control Flow + * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional + * options, exactly the same as from `retry` + * @param {AsyncFunction} task - the asynchronous function to wrap. + * This function will be passed any arguments passed to the returned wrapper. + * Invoked with (...args, callback). + * @returns {AsyncFunction} The wrapped function, which when invoked, will + * retry on an error, based on the parameters specified in `opts`. + * This function will accept the same parameters as `task`. + * @example + * + * async.auto({ + * dep1: async.retryable(3, getFromFlakyService), + * process: ["dep1", async.retryable(3, function (results, cb) { + * maybeProcessData(results.dep1, cb); + * })] + * }, callback); + */ +var retryable = function (opts, task) { + if (!task) { + task = opts; + opts = null; + } + var _task = wrapAsync(task); + return initialParams(function (args, callback) { + function taskFn(cb) { + _task.apply(null, args.concat(cb)); + } - state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; - flow(stream); -} // at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. + if (opts) retry(opts, taskFn, callback); + else retry(taskFn, callback); + }); +}; -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(maybeReadMore_, stream, state); - } +/** + * Run the functions in the `tasks` collection in series, each one running once + * the previous function has completed. If any functions in the series pass an + * error to its callback, no more functions are run, and `callback` is + * immediately called with the value of the error. Otherwise, `callback` + * receives an array of results when `tasks` have completed. + * + * It is also possible to use an object instead of an array. Each property will + * be run as a function, and the results will be passed to the final `callback` + * as an object instead of an array. This can be a more readable way of handling + * results from {@link async.series}. + * + * **Note** that while many implementations preserve the order of object + * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) + * explicitly states that + * + * > The mechanics and order of enumerating the properties is not specified. + * + * So if you rely on the order in which your series of functions are executed, + * and want this to work on all platforms, consider using an array. + * + * @name series + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection containing + * [async functions]{@link AsyncFunction} to run in series. + * Each function can complete with any number of optional `result` values. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed. This function gets a results array (or object) + * containing all the result arguments passed to the `task` callbacks. Invoked + * with (err, result). + * @example + * async.series([ + * function(callback) { + * // do some stuff ... + * callback(null, 'one'); + * }, + * function(callback) { + * // do some more stuff ... + * callback(null, 'two'); + * } + * ], + * // optional callback + * function(err, results) { + * // results is now equal to ['one', 'two'] + * }); + * + * async.series({ + * one: function(callback) { + * setTimeout(function() { + * callback(null, 1); + * }, 200); + * }, + * two: function(callback){ + * setTimeout(function() { + * callback(null, 2); + * }, 100); + * } + * }, function(err, results) { + * // results is now equal to: {one: 1, two: 2} + * }); + */ +function series(tasks, callback) { + _parallel(eachOfSeries, tasks, callback); } -function maybeReadMore_(stream, state) { - // Attempt to read more data if we should. - // - // The conditions for reading more data are (one of): - // - Not enough data buffered (state.length < state.highWaterMark). The loop - // is responsible for filling the buffer with enough data if such data - // is available. If highWaterMark is 0 and we are not in the flowing mode - // we should _not_ attempt to buffer any extra data. We'll get more data - // when the stream consumer calls read() instead. - // - No data in the buffer, and the stream is in flowing mode. In this mode - // the loop below is responsible for ensuring read() is called. Failing to - // call read here would abort the flow and there's no other mechanism for - // continuing the flow if the stream consumer has just subscribed to the - // 'data' event. - // - // In addition to the above conditions to keep reading data, the following - // conditions prevent the data from being read: - // - The stream has ended (state.ended). - // - There is already a pending 'read' operation (state.reading). This is a - // case where the the stream has called the implementation defined _read() - // method, but they are processing the call asynchronously and have _not_ - // called push() with new data. In this case we skip performing more - // read()s. The execution ends in this method again after the _read() ends - // up calling push() with more data. - while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { - var len = state.length; - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) // didn't get any data, stop spinning. - break; - } - - state.readingMore = false; -} // abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. - - -Readable.prototype._read = function (n) { - errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; +/** + * Returns `true` if at least one element in the `coll` satisfies an async test. + * If any iteratee call returns `true`, the main `callback` is immediately + * called. + * + * @name some + * @static + * @memberOf module:Collections + * @method + * @alias any + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in parallel. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + * @example + * + * async.some(['file1','file2','file3'], function(filePath, callback) { + * fs.access(filePath, function(err) { + * callback(null, !err) + * }); + * }, function(err, result) { + * // if result is true then at least one of the files exists + * }); + */ +var some = doParallel(_createTester(Boolean, identity)); - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; +/** + * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. + * + * @name someLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} + * @alias anyLimit + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in parallel. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + */ +var someLimit = doParallelLimit(_createTester(Boolean, identity)); - case 1: - state.pipes = [state.pipes, dest]; - break; +/** + * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. + * + * @name someSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.some]{@link module:Collections.some} + * @alias anySeries + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async truth test to apply to each item + * in the collections in series. + * The iteratee should complete with a boolean `result` value. + * Invoked with (item, callback). + * @param {Function} [callback] - A callback which is called as soon as any + * iteratee returns `true`, or after all the iteratee functions have finished. + * Result will be either `true` or `false` depending on the values of the async + * tests. Invoked with (err, result). + */ +var someSeries = doLimit(someLimit, 1); - default: - state.pipes.push(dest); - break; - } +/** + * Sorts a list by the results of running each `coll` value through an async + * `iteratee`. + * + * @name sortBy + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * The iteratee should complete with a value to use as the sort criteria as + * its `result`. + * Invoked with (item, callback). + * @param {Function} callback - A callback which is called after all the + * `iteratee` functions have finished, or an error occurs. Results is the items + * from the original `coll` sorted by the values returned by the `iteratee` + * calls. Invoked with (err, results). + * @example + * + * async.sortBy(['file1','file2','file3'], function(file, callback) { + * fs.stat(file, function(err, stats) { + * callback(err, stats.mtime); + * }); + * }, function(err, results) { + * // results is now the original array of files sorted by + * // modified date + * }); + * + * // By modifying the callback parameter the + * // sorting order can be influenced: + * + * // ascending order + * async.sortBy([1,9,3,5], function(x, callback) { + * callback(null, x); + * }, function(err,result) { + * // result callback + * }); + * + * // descending order + * async.sortBy([1,9,3,5], function(x, callback) { + * callback(null, x*-1); //<- x*-1 instead of x, turns the order around + * }, function(err,result) { + * // result callback + * }); + */ +function sortBy (coll, iteratee, callback) { + var _iteratee = wrapAsync(iteratee); + map(coll, function (x, callback) { + _iteratee(x, function (err, criteria) { + if (err) return callback(err); + callback(null, {value: x, criteria: criteria}); + }); + }, function (err, results) { + if (err) return callback(err); + callback(null, arrayMap(results.sort(comparator), baseProperty('value'))); + }); - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); - dest.on('unpipe', onunpipe); + function comparator(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + } +} - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); +/** + * Sets a time limit on an asynchronous function. If the function does not call + * its callback within the specified milliseconds, it will be called with a + * timeout error. The code property for the error object will be `'ETIMEDOUT'`. + * + * @name timeout + * @static + * @memberOf module:Utils + * @method + * @category Util + * @param {AsyncFunction} asyncFn - The async function to limit in time. + * @param {number} milliseconds - The specified time limit. + * @param {*} [info] - Any variable you want attached (`string`, `object`, etc) + * to timeout Error for more information.. + * @returns {AsyncFunction} Returns a wrapped function that can be used with any + * of the control flow functions. + * Invoke this function with the same parameters as you would `asyncFunc`. + * @example + * + * function myFunction(foo, callback) { + * doAsyncTask(foo, function(err, data) { + * // handle errors + * if (err) return callback(err); + * + * // do some stuff ... + * + * // return processed data + * return callback(null, data); + * }); + * } + * + * var wrapped = async.timeout(myFunction, 1000); + * + * // call `wrapped` as you would `myFunction` + * wrapped({ bar: 'bar' }, function(err, data) { + * // if `myFunction` takes < 1000 ms to execute, `err` + * // and `data` will have their expected values + * + * // else `err` will be an Error with the code 'ETIMEDOUT' + * }); + */ +function timeout(asyncFn, milliseconds, info) { + var fn = wrapAsync(asyncFn); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); - } - } - } + return initialParams(function (args, callback) { + var timedOut = false; + var timer; - function onend() { - debug('onend'); - dest.end(); - } // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. + function timeoutCallback() { + var name = asyncFn.name || 'anonymous'; + var error = new Error('Callback function "' + name + '" timed out.'); + error.code = 'ETIMEDOUT'; + if (info) { + error.info = info; + } + timedOut = true; + callback(error); + } + args.push(function () { + if (!timedOut) { + callback.apply(null, arguments); + clearTimeout(timer); + } + }); - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - var cleanedUp = false; + // setup timer and call original function + timer = setTimeout(timeoutCallback, milliseconds); + fn.apply(null, args); + }); +} - function cleanup() { - debug('cleanup'); // cleanup event handlers once the pipe is broken +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeCeil = Math.ceil; +var nativeMax = Math.max; - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); - cleanedUp = true; // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. +/** + * The base implementation of `_.range` and `_.rangeRight` which doesn't + * coerce arguments. + * + * @private + * @param {number} start The start of the range. + * @param {number} end The end of the range. + * @param {number} step The value to increment or decrement by. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Array} Returns the range of numbers. + */ +function baseRange(start, end, step, fromRight) { + var index = -1, + length = nativeMax(nativeCeil((end - start) / (step || 1)), 0), + result = Array(length); - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + while (length--) { + result[fromRight ? length : ++index] = start; + start += step; } + return result; +} - src.on('data', ondata); +/** + * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a + * time. + * + * @name timesLimit + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.times]{@link module:ControlFlow.times} + * @category Control Flow + * @param {number} count - The number of times to run the function. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see [async.map]{@link module:Collections.map}. + */ +function timeLimit(count, limit, iteratee, callback) { + var _iteratee = wrapAsync(iteratee); + mapLimit(baseRange(0, count, 1), limit, _iteratee, callback); +} - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - debug('dest.write', ret); +/** + * Calls the `iteratee` function `n` times, and accumulates results in the same + * manner you would use with [map]{@link module:Collections.map}. + * + * @name times + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.map]{@link module:Collections.map} + * @category Control Flow + * @param {number} n - The number of times to run the function. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see {@link module:Collections.map}. + * @example + * + * // Pretend this is some complicated async factory + * var createUser = function(id, callback) { + * callback(null, { + * id: 'user' + id + * }); + * }; + * + * // generate 5 users + * async.times(5, function(n, next) { + * createUser(n, function(err, user) { + * next(err, user); + * }); + * }, function(err, users) { + * // we should now have 5 users + * }); + */ +var times = doLimit(timeLimit, Infinity); - if (ret === false) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', state.awaitDrain); - state.awaitDrain++; - } +/** + * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time. + * + * @name timesSeries + * @static + * @memberOf module:ControlFlow + * @method + * @see [async.times]{@link module:ControlFlow.times} + * @category Control Flow + * @param {number} n - The number of times to run the function. + * @param {AsyncFunction} iteratee - The async function to call `n` times. + * Invoked with the iteration index and a callback: (n, next). + * @param {Function} callback - see {@link module:Collections.map}. + */ +var timesSeries = doLimit(timeLimit, 1); - src.pause(); +/** + * A relative of `reduce`. Takes an Object or Array, and iterates over each + * element in series, each step potentially mutating an `accumulator` value. + * The type of the accumulator defaults to the type of collection passed in. + * + * @name transform + * @static + * @memberOf module:Collections + * @method + * @category Collection + * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {*} [accumulator] - The initial state of the transform. If omitted, + * it will default to an empty Object or Array, depending on the type of `coll` + * @param {AsyncFunction} iteratee - A function applied to each item in the + * collection that potentially modifies the accumulator. + * Invoked with (accumulator, item, key, callback). + * @param {Function} [callback] - A callback which is called after all the + * `iteratee` functions have finished. Result is the transformed accumulator. + * Invoked with (err, result). + * @example + * + * async.transform([1,2,3], function(acc, item, index, callback) { + * // pointless async: + * process.nextTick(function() { + * acc.push(item * 2) + * callback(null) + * }); + * }, function(err, result) { + * // result is now equal to [2, 4, 6] + * }); + * + * @example + * + * async.transform({a: 1, b: 2, c: 3}, function (obj, val, key, callback) { + * setImmediate(function () { + * obj[key] = val * 2; + * callback(); + * }) + * }, function (err, result) { + * // result is equal to {a: 2, b: 4, c: 6} + * }) + */ +function transform (coll, accumulator, iteratee, callback) { + if (arguments.length <= 3) { + callback = iteratee; + iteratee = accumulator; + accumulator = isArray(coll) ? [] : {}; } - } // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. + callback = once(callback || noop); + var _iteratee = wrapAsync(iteratee); + eachOf(coll, function(v, k, cb) { + _iteratee(accumulator, v, k, cb); + }, function(err) { + callback(err, accumulator); + }); +} - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); - } // Make sure our error handler is attached before userland ones. - - - prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once. - - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - - dest.once('close', onclose); +/** + * It runs each task in series but stops whenever any of the functions were + * successful. If one of the tasks were successful, the `callback` will be + * passed the result of the successful task. If all tasks fail, the callback + * will be passed the error and result (if any) of the final attempt. + * + * @name tryEach + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|Object} tasks - A collection containing functions to + * run, each function is passed a `callback(err, result)` it must call on + * completion with an error `err` (which can be `null`) and an optional `result` + * value. + * @param {Function} [callback] - An optional callback which is called when one + * of the tasks has succeeded, or all have failed. It receives the `err` and + * `result` arguments of the last attempt at completing the `task`. Invoked with + * (err, results). + * @example + * async.tryEach([ + * function getDataFromFirstWebsite(callback) { + * // Try getting the data from the first website + * callback(err, data); + * }, + * function getDataFromSecondWebsite(callback) { + * // First website failed, + * // Try getting the data from the backup website + * callback(err, data); + * } + * ], + * // optional callback + * function(err, results) { + * Now do something with the data. + * }); + * + */ +function tryEach(tasks, callback) { + var error = null; + var result; + callback = callback || noop; + eachSeries(tasks, function(task, callback) { + wrapAsync(task)(function (err, res/*, ...args*/) { + if (arguments.length > 2) { + result = slice(arguments, 1); + } else { + result = res; + } + error = err; + callback(!err); + }); + }, function () { + callback(error, result); + }); +} - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } +/** + * 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 function () { + return (fn.unmemoized || fn).apply(null, arguments); + }; +} - dest.once('finish', onfinish); +/** + * 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 {Function} test - synchronous truth test to perform before each + * execution of `iteratee`. Invoked with (). + * @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 undefined + * @example + * + * var count = 0; + * async.whilst( + * function() { return count < 5; }, + * function(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 || noop); + var _iteratee = wrapAsync(iteratee); + if (!test()) return callback(null); + var next = function(err/*, ...args*/) { + if (err) return callback(err); + if (test()) return _iteratee(next); + var args = slice(arguments, 1); + callback.apply(null, [null].concat(args)); + }; + _iteratee(next); +} - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } // tell the dest that it's being piped to +/** + * 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 {Function} test - synchronous truth test to perform before each + * execution of `iteratee`. Invoked with (). + * @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]); + */ +function until(test, iteratee, callback) { + whilst(function() { + return !test.apply(this, arguments); + }, 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 undefined + * @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'); + * } + */ +var waterfall = function(tasks, callback) { + callback = once(callback || noop); + if (!isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions')); + if (!tasks.length) return callback(); + var taskIndex = 0; - dest.emit('pipe', src); // start the flow if it hasn't been started already. + function nextTask(args) { + var task = wrapAsync(tasks[taskIndex++]); + args.push(onlyOnce(next)); + task.apply(null, args); + } - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } + function next(err/*, ...args*/) { + if (err || taskIndex === tasks.length) { + return callback.apply(null, arguments); + } + nextTask(slice(arguments, 1)); + } - return dest; + nextTask([]); }; -function pipeOnDrain(src) { - return function pipeOnDrainFunctionResult() { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; +/** + * 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 + */ - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} +/** + * Async is a utility module which provides straight-forward, powerful functions + * for working with asynchronous JavaScript. Although originally designed for + * use with [Node.js](http://nodejs.org) and installable via + * `npm install --save async`, it can also be used directly in the browser. + * @module async + * @see AsyncFunction + */ -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { - hasUnpiped: false - }; // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; // just one destination. most common case. +/** + * A collection of `async` functions for manipulating collections, such as + * arrays and objects. + * @module Collections + */ - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; // got a match. +/** + * A collection of `async` functions for controlling the flow through a script. + * @module ControlFlow + */ - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } // slow case. multiple pipe destinations. +/** + * A collection of `async` utility functions. + * @module Utils + */ +var index = { + apply: apply, + applyEach: applyEach, + applyEachSeries: applyEachSeries, + asyncify: asyncify, + auto: auto, + autoInject: autoInject, + cargo: cargo, + compose: compose, + concat: concat, + concatLimit: concatLimit, + concatSeries: concatSeries, + constant: constant, + detect: detect, + detectLimit: detectLimit, + detectSeries: detectSeries, + dir: dir, + doDuring: doDuring, + doUntil: doUntil, + doWhilst: doWhilst, + during: during, + each: eachLimit, + eachLimit: eachLimit$1, + eachOf: eachOf, + eachOfLimit: eachOfLimit, + eachOfSeries: eachOfSeries, + eachSeries: eachSeries, + ensureAsync: ensureAsync, + every: every, + everyLimit: everyLimit, + everySeries: everySeries, + filter: filter, + filterLimit: filterLimit, + filterSeries: filterSeries, + forever: forever, + groupBy: groupBy, + groupByLimit: groupByLimit, + groupBySeries: groupBySeries, + log: log, + map: map, + mapLimit: mapLimit, + mapSeries: mapSeries, + mapValues: mapValues, + mapValuesLimit: mapValuesLimit, + mapValuesSeries: mapValuesSeries, + memoize: memoize, + nextTick: nextTick, + parallel: parallelLimit, + parallelLimit: parallelLimit$1, + priorityQueue: priorityQueue, + queue: queue$1, + race: race, + reduce: reduce, + reduceRight: reduceRight, + reflect: reflect, + reflectAll: reflectAll, + reject: reject, + rejectLimit: rejectLimit, + rejectSeries: rejectSeries, + retry: retry, + retryable: retryable, + seq: seq, + series: series, + setImmediate: setImmediate$1, + some: some, + someLimit: someLimit, + someSeries: someSeries, + sortBy: sortBy, + timeout: timeout, + times: times, + timesLimit: timeLimit, + timesSeries: timesSeries, + transform: transform, + tryEach: tryEach, + unmemoize: unmemoize, + until: until, + waterfall: waterfall, + whilst: whilst, - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; + // aliases + all: every, + allLimit: everyLimit, + allSeries: everySeries, + any: some, + anyLimit: someLimit, + anySeries: someSeries, + find: detect, + findLimit: detectLimit, + findSeries: detectSeries, + forEach: eachLimit, + forEachSeries: eachSeries, + forEachLimit: eachLimit$1, + forEachOf: eachOf, + forEachOfSeries: eachOfSeries, + forEachOfLimit: eachOfLimit, + inject: reduce, + foldl: reduce, + foldr: reduceRight, + select: filter, + selectLimit: filterLimit, + selectSeries: filterSeries, + wrapSync: asyncify +}; - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, { - hasUnpiped: false - }); - } +exports['default'] = index; +exports.apply = apply; +exports.applyEach = applyEach; +exports.applyEachSeries = applyEachSeries; +exports.asyncify = asyncify; +exports.auto = auto; +exports.autoInject = autoInject; +exports.cargo = cargo; +exports.compose = compose; +exports.concat = concat; +exports.concatLimit = concatLimit; +exports.concatSeries = concatSeries; +exports.constant = constant; +exports.detect = detect; +exports.detectLimit = detectLimit; +exports.detectSeries = detectSeries; +exports.dir = dir; +exports.doDuring = doDuring; +exports.doUntil = doUntil; +exports.doWhilst = doWhilst; +exports.during = during; +exports.each = eachLimit; +exports.eachLimit = eachLimit$1; +exports.eachOf = eachOf; +exports.eachOfLimit = eachOfLimit; +exports.eachOfSeries = eachOfSeries; +exports.eachSeries = eachSeries; +exports.ensureAsync = ensureAsync; +exports.every = every; +exports.everyLimit = everyLimit; +exports.everySeries = everySeries; +exports.filter = filter; +exports.filterLimit = filterLimit; +exports.filterSeries = filterSeries; +exports.forever = forever; +exports.groupBy = groupBy; +exports.groupByLimit = groupByLimit; +exports.groupBySeries = groupBySeries; +exports.log = log; +exports.map = map; +exports.mapLimit = mapLimit; +exports.mapSeries = mapSeries; +exports.mapValues = mapValues; +exports.mapValuesLimit = mapValuesLimit; +exports.mapValuesSeries = mapValuesSeries; +exports.memoize = memoize; +exports.nextTick = nextTick; +exports.parallel = parallelLimit; +exports.parallelLimit = parallelLimit$1; +exports.priorityQueue = priorityQueue; +exports.queue = queue$1; +exports.race = race; +exports.reduce = reduce; +exports.reduceRight = reduceRight; +exports.reflect = reflect; +exports.reflectAll = reflectAll; +exports.reject = reject; +exports.rejectLimit = rejectLimit; +exports.rejectSeries = rejectSeries; +exports.retry = retry; +exports.retryable = retryable; +exports.seq = seq; +exports.series = series; +exports.setImmediate = setImmediate$1; +exports.some = some; +exports.someLimit = someLimit; +exports.someSeries = someSeries; +exports.sortBy = sortBy; +exports.timeout = timeout; +exports.times = times; +exports.timesLimit = timeLimit; +exports.timesSeries = timesSeries; +exports.transform = transform; +exports.tryEach = tryEach; +exports.unmemoize = unmemoize; +exports.until = until; +exports.waterfall = waterfall; +exports.whilst = whilst; +exports.all = every; +exports.allLimit = everyLimit; +exports.allSeries = everySeries; +exports.any = some; +exports.anyLimit = someLimit; +exports.anySeries = someSeries; +exports.find = detect; +exports.findLimit = detectLimit; +exports.findSeries = detectSeries; +exports.forEach = eachLimit; +exports.forEachSeries = eachSeries; +exports.forEachLimit = eachLimit$1; +exports.forEachOf = eachOf; +exports.forEachOfSeries = eachOfSeries; +exports.forEachOfLimit = eachOfLimit; +exports.inject = reduce; +exports.foldl = reduce; +exports.foldr = reduceRight; +exports.select = filter; +exports.selectLimit = filterLimit; +exports.selectSeries = filterSeries; +exports.wrapSync = asyncify; - return this; - } // try to find the right one. +Object.defineProperty(exports, '__esModule', { value: true }); +}))); - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); - return this; -}; // set up data events if they are asked for -// Ensure readable listeners eventually get something +/***/ }), +/* 234 */ +/***/ (function(module) { -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - var state = this._readableState; +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ - if (ev === 'data') { - // update readableListening so that resume() may be a no-op - // a few lines down. This is needed to support once('readable'). - state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; - if (state.flowing !== false) this.resume(); - } else if (ev === 'readable') { - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.flowing = false; - state.emittedReadable = false; - debug('on readable', state.length, state.reading); +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; - if (state.length) { - emitReadable(this); - } else if (!state.reading) { - process.nextTick(nReadingNextTick, this); - } - } - } +/** Used as references for various `Number` constants. */ +var MAX_SAFE_INTEGER = 9007199254740991; - return res; -}; +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; -Readable.prototype.addListener = Readable.prototype.on; +/** + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). + */ +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; -Readable.prototype.removeListener = function (ev, fn) { - var res = Stream.prototype.removeListener.call(this, ev, fn); +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; - if (ev === 'readable') { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); - } +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - return res; -}; +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; -Readable.prototype.removeAllListeners = function (ev) { - var res = Stream.prototype.removeAllListeners.apply(this, arguments); +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); - if (ev === 'readable' || ev === undefined) { - // We need to check if there is someone still listening to - // readable and reset the state. However this needs to happen - // after readable has been emitted but before I/O (nextTick) to - // support once('readable', fn) cycles. This means that calling - // resume within the same tick will have no - // effect. - process.nextTick(updateReadableListening, this); +/** + * A faster alternative to `Function#apply`, this function invokes `func` + * with the `this` binding of `thisArg` and the arguments of `args`. + * + * @private + * @param {Function} func The function to invoke. + * @param {*} thisArg The `this` binding of `func`. + * @param {Array} args The arguments to invoke `func` with. + * @returns {*} Returns the result of `func`. + */ +function apply(func, thisArg, args) { + switch (args.length) { + case 0: return func.call(thisArg); + case 1: return func.call(thisArg, args[0]); + case 2: return func.call(thisArg, args[0], args[1]); + case 3: return func.call(thisArg, args[0], args[1], args[2]); } + return func.apply(thisArg, args); +} - return res; -}; +/** + * A specialized version of `_.includes` for arrays without support for + * specifying an index to search from. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludes(array, value) { + var length = array ? array.length : 0; + return !!length && baseIndexOf(array, value, 0) > -1; +} -function updateReadableListening(self) { - var state = self._readableState; - state.readableListening = self.listenerCount('readable') > 0; +/** + * This function is like `arrayIncludes` except that it accepts a comparator. + * + * @private + * @param {Array} [array] The array to inspect. + * @param {*} target The value to search for. + * @param {Function} comparator The comparator invoked per element. + * @returns {boolean} Returns `true` if `target` is found, else `false`. + */ +function arrayIncludesWith(array, value, comparator) { + var index = -1, + length = array ? array.length : 0; - if (state.resumeScheduled && !state.paused) { - // flowing needs to be set to true now, otherwise - // the upcoming resume will not flow. - state.flowing = true; // crude way to check if we should resume - } else if (self.listenerCount('data') > 0) { - self.resume(); + while (++index < length) { + if (comparator(value, array[index])) { + return true; + } } + return false; } -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} // pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. - - -Readable.prototype.resume = function () { - var state = this._readableState; - - if (!state.flowing) { - debug('resume'); // we flow only if there is no one listening - // for readable, but we still have to call - // resume() +/** + * A specialized version of `_.map` for arrays without support for iteratee + * shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the new mapped array. + */ +function arrayMap(array, iteratee) { + var index = -1, + length = array ? array.length : 0, + result = Array(length); - state.flowing = !state.readableListening; - resume(this, state); + while (++index < length) { + result[index] = iteratee(array[index], index, array); } + return result; +} - state.paused = false; - return this; -}; +/** + * Appends the elements of `values` to `array`. + * + * @private + * @param {Array} array The array to modify. + * @param {Array} values The values to append. + * @returns {Array} Returns `array`. + */ +function arrayPush(array, values) { + var index = -1, + length = values.length, + offset = array.length; -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - process.nextTick(resume_, stream, state); + while (++index < length) { + array[offset + index] = values[index]; } + return array; } -function resume_(stream, state) { - debug('resume', state.reading); +/** + * The base implementation of `_.findIndex` and `_.findLastIndex` without + * support for iteratee shorthands. + * + * @private + * @param {Array} array The array to inspect. + * @param {Function} predicate The function invoked per iteration. + * @param {number} fromIndex The index to search from. + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseFindIndex(array, predicate, fromIndex, fromRight) { + var length = array.length, + index = fromIndex + (fromRight ? 1 : -1); - if (!state.reading) { - stream.read(0); + while ((fromRight ? index-- : ++index < length)) { + if (predicate(array[index], index, array)) { + return index; + } } - - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); + return -1; } -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - - if (this._readableState.flowing !== false) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); +/** + * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} value The value to search for. + * @param {number} fromIndex The index to search from. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function baseIndexOf(array, value, fromIndex) { + if (value !== value) { + return baseFindIndex(array, baseIsNaN, fromIndex); } + var index = fromIndex - 1, + length = array.length; - this._readableState.paused = true; - return this; -}; + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; +} -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); +/** + * The base implementation of `_.isNaN` without support for number objects. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + */ +function baseIsNaN(value) { + return value !== value; +} - while (state.flowing && stream.read() !== null) { - ; - } -} // wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. +/** + * The base implementation of `_.unary` without support for storing metadata. + * + * @private + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. + */ +function baseUnary(func) { + return function(value) { + return func(value); + }; +} +/** + * Checks if a cache value for `key` exists. + * + * @private + * @param {Object} cache The cache to query. + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function cacheHas(cache, key) { + return cache.has(key); +} -Readable.prototype.wrap = function (stream) { - var _this = this; +/** + * Gets the value at `key` of `object`. + * + * @private + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. + */ +function getValue(object, key) { + return object == null ? undefined : object[key]; +} - var state = this._readableState; - var paused = false; - stream.on('end', function () { - debug('wrapped end'); +/** + * Checks if `value` is a host object in IE < 9. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. + */ +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; +} - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; - _this.push(null); - }); - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); - var ret = _this.push(chunk); +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; - if (!ret) { - paused = true; - stream.pause(); - } - }); // proxy all the other methods. - // important when wrapping filters and duplexes. +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function methodWrap(method) { - return function methodWrapReturnFunction() { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } // proxy certain important events. +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } // when we try to consume some more bytes, simply unpause the - // underlying stream. +/** Built-in value references. */ +var Symbol = root.Symbol, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice, + spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max; - this._read = function (n) { - debug('wrapped _read', n); +/* Built-in method references that are verified to be native. */ +var Map = getNative(root, 'Map'), + nativeCreate = getNative(Object, 'create'); - if (paused) { - paused = false; - stream.resume(); - } - }; +/** + * Creates a hash object. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; - return this; -}; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } +} -if (typeof Symbol === 'function') { - Readable.prototype[Symbol.asyncIterator] = function () { - if (createReadableStreamAsyncIterator === undefined) { - createReadableStreamAsyncIterator = __webpack_require__(46); - } +/** + * Removes all key-value entries from the hash. + * + * @private + * @name clear + * @memberOf Hash + */ +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; +} - return createReadableStreamAsyncIterator(this); - }; +/** + * Removes `key` and its value from the hash. + * + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; } -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.highWaterMark; - } -}); -Object.defineProperty(Readable.prototype, 'readableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState && this._readableState.buffer; - } -}); -Object.defineProperty(Readable.prototype, 'readableFlowing', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.flowing; - }, - set: function set(state) { - if (this._readableState) { - this._readableState.flowing = state; - } - } -}); // exposed for testing purposes only. - -Readable._fromList = fromList; -Object.defineProperty(Readable.prototype, 'readableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._readableState.length; - } -}); // Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. - -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = state.buffer.consume(n, state.decoder); - } - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - debug('endReadable', state.endEmitted); - - if (!state.endEmitted) { - state.ended = true; - process.nextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift. - - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - - if (state.autoDestroy) { - // In case of duplex streams we need a way to detect - // if the writable side is ready for autoDestroy as well - var wState = stream._writableState; - - if (!wState || wState.autoDestroy && wState.finished) { - stream.destroy(); - } - } - } -} - -if (typeof Symbol === 'function') { - Readable.from = function (iterable, opts) { - if (from === undefined) { - from = __webpack_require__(176); - } - - return from(Readable, iterable, opts); - }; -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - - return -1; -} - -/***/ }), -/* 227 */, -/* 228 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const { stat } = __webpack_require__(747) -const { dirname, normalize, sep } = __webpack_require__(622) - -const commonPathPrefix = __webpack_require__(963) -const glob = __webpack_require__(120) -const pkgDir = __webpack_require__(942) -const unixify = __webpack_require__(305) -const promisify = __webpack_require__(799) - -const { startZip, addZipFile, addZipContent, endZip } = __webpack_require__(71) -const { getDependencies } = __webpack_require__(976) - -const pGlob = promisify(glob) -const pStat = promisify(stat) - -// Zip a Node.js function file -const zipNodeJs = async function(srcPath, srcDir, destPath, filename, handler, stat) { - const { archive, output } = startZip(destPath) - - const packageRoot = await pkgDir(srcDir) - - const files = await filesForFunctionZip(srcPath, filename, handler, packageRoot, stat) - const dirnames = files.map(dirname) - const commonPrefix = commonPathPrefix(dirnames) - - addEntryFile(commonPrefix, archive, filename, handler) - - await Promise.all(files.map(file => zipJsFile(file, commonPrefix, archive))) - - await endZip(archive, output) -} - -// Retrieve the paths to the files to zip. -// We only include the files actually needed by the function because AWS Lambda -// has a size limit for the zipped file. It also makes cold starts faster. -const filesForFunctionZip = async function(srcPath, filename, handler, packageRoot, stat) { - const [treeFiles, depFiles] = await Promise.all([getTreeFiles(srcPath, stat), getDependencies(handler, packageRoot)]) - const files = [...treeFiles, ...depFiles].map(normalize) - const uniqueFiles = [...new Set(files)] - return uniqueFiles -} - -// When using a directory, we include all its descendants except `node_modules` -const getTreeFiles = function(srcPath, stat) { - if (!stat.isDirectory()) { - return [srcPath] - } - - return pGlob(`${srcPath}/**`, { - ignore: `${srcPath}/**/node_modules/**`, - nodir: true, - absolute: true - }) -} - -const addEntryFile = function(commonPrefix, archive, filename, handler) { - const mainPath = normalizeFilePath(handler, commonPrefix) - const content = Buffer.from(`module.exports = require('./${mainPath}')`) - const entryFilename = filename.endsWith('.js') ? filename : `${filename}.js` - - addZipContent(archive, content, entryFilename) -} - -const zipJsFile = async function(file, commonPrefix, archive) { - const filename = normalizeFilePath(file, commonPrefix) - const stat = await pStat(file) - addZipFile(archive, file, filename, stat) -} - -// `adm-zip` and `require()` expect Unix paths. -// We remove the common path prefix. -// With files on different Windows drives, we remove the drive letter. -const normalizeFilePath = function(path, commonPrefix) { - const pathA = normalize(path) - const pathB = pathA.replace(commonPrefix, `${ZIP_ROOT_DIR}${sep}`) - const pathC = unixify(pathB) - return pathC -} - -const ZIP_ROOT_DIR = 'src' - -module.exports = { zipNodeJs } - - -/***/ }), -/* 229 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2014 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -var util = __webpack_require__(992); - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. + * Gets the hash value for `key`. + * + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ -function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var columnB = mappingB.generatedColumn; - return lineB > lineA || lineB == lineA && columnB >= columnA || - util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** - * A data structure to provide a sorted view of accumulated mappings in a - * performance conscious manner. It trades a neglibable overhead in general - * case for a large speedup in case of mappings being added in order. + * Checks if a hash value for `key` exists. + * + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -function MappingList() { - this._array = []; - this._sorted = true; - // Serves as infimum - this._last = {generatedLine: -1, generatedColumn: 0}; +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); } /** - * Iterate through internal items. This method takes the same arguments that - * `Array.prototype.forEach` takes. + * Sets the hash `key` to `value`. * - * NOTE: The order of the mappings is NOT guaranteed. + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. */ -MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; +} -/** - * Add the given source mapping. - * - * @param Object aMapping - */ -MappingList.prototype.add = function MappingList_add(aMapping) { - if (generatedPositionAfter(this._last, aMapping)) { - this._last = aMapping; - this._array.push(aMapping); - } else { - this._sorted = false; - this._array.push(aMapping); - } -}; +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; /** - * Returns the flat, sorted array of mappings. The mappings are sorted by - * generated position. + * Creates an list cache object. * - * WARNING: This method returns internal data without copying, for - * performance. The return value must NOT be mutated, and should be treated as - * an immutable borrow. If you want to take ownership, you must make your own - * copy. + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. */ -MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; -}; - -exports.MappingList = MappingList; - - -/***/ }), -/* 230 */, -/* 231 */, -/* 232 */ -/***/ (function(module) { - -"use strict"; - // undocumented cb() API, needed for core, not for public API - -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err) { - if (!this._writableState) { - process.nextTick(emitErrorNT, this, err); - } else if (!this._writableState.errorEmitted) { - this._writableState.errorEmitted = true; - process.nextTick(emitErrorNT, this, err); - } - } - - return this; - } // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - - if (this._readableState) { - this._readableState.destroyed = true; - } // if this is a duplex stream mark the writable part as destroyed as well - - - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - if (!_this._writableState) { - process.nextTick(emitErrorAndCloseNT, _this, err); - } else if (!_this._writableState.errorEmitted) { - _this._writableState.errorEmitted = true; - process.nextTick(emitErrorAndCloseNT, _this, err); - } else { - process.nextTick(emitCloseNT, _this); - } - } else if (cb) { - process.nextTick(emitCloseNT, _this); - cb(err); - } else { - process.nextTick(emitCloseNT, _this); - } - }); - - return this; -} - -function emitErrorAndCloseNT(self, err) { - emitErrorNT(self, err); - emitCloseNT(self); -} - -function emitCloseNT(self) { - if (self._writableState && !self._writableState.emitClose) return; - if (self._readableState && !self._readableState.emitClose) return; - self.emit('close'); -} - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finalCalled = false; - this._writableState.prefinished = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); } } -function emitErrorNT(self, err) { - self.emit('error', err); -} - -function errorOrDestroy(stream, err) { - // We have tests that rely on errors being emitted - // in the same tick, so changing this is semver major. - // For now when you opt-in to autoDestroy we allow - // the error to be emitted nextTick. In a future - // semver major update we should change the default to this. - var rState = stream._readableState; - var wState = stream._writableState; - if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +/** + * Removes all key-value entries from the list cache. + * + * @private + * @name clear + * @memberOf ListCache + */ +function listCacheClear() { + this.__data__ = []; } -module.exports = { - destroy: destroy, - undestroy: undestroy, - errorOrDestroy: errorOrDestroy -}; - -/***/ }), -/* 233 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; -exports.default = void 0; - -var _supportsColor = _interopRequireDefault(__webpack_require__(31)); - -var _chalk = _interopRequireDefault(__webpack_require__(507)); - -var _terminalHighlight = _interopRequireDefault(__webpack_require__(958)); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } - -function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } - -function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - -function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } - -function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - /** - * The CSS parser throws this error for broken CSS. - * - * Custom parsers can throw this error for broken custom syntax using - * the {@link Node#error} method. - * - * PostCSS will use the input source map to detect the original error location. - * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS, - * PostCSS will show the original position in the Sass file. - * - * If you need the position in the PostCSS input - * (e.g., to debug the previous compiler), use `error.input.file`. - * - * @example - * // Catching and checking syntax error - * try { - * postcss.parse('a{') - * } catch (error) { - * if (error.name === 'CssSyntaxError') { - * error //=> CssSyntaxError - * } - * } + * Removes `key` and its value from the list cache. * - * @example - * // Raising error from plugin - * throw node.error('Unknown variable', { plugin: 'postcss-vars' }) + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -var CssSyntaxError = -/*#__PURE__*/ -function (_Error) { - _inheritsLoose(CssSyntaxError, _Error); - - /** - * @param {string} message Error message. - * @param {number} [line] Source line of the error. - * @param {number} [column] Source column of the error. - * @param {string} [source] Source code of the broken file. - * @param {string} [file] Absolute path to the broken file. - * @param {string} [plugin] PostCSS plugin name, if error came from plugin. - */ - function CssSyntaxError(message, line, column, source, file, plugin) { - var _this; - - _this = _Error.call(this, message) || this; - /** - * Always equal to `'CssSyntaxError'`. You should always check error type - * by `error.name === 'CssSyntaxError'` - * instead of `error instanceof CssSyntaxError`, - * because npm could have several PostCSS versions. - * - * @type {string} - * - * @example - * if (error.name === 'CssSyntaxError') { - * error //=> CssSyntaxError - * } - */ - - _this.name = 'CssSyntaxError'; - /** - * Error message. - * - * @type {string} - * - * @example - * error.message //=> 'Unclosed block' - */ - - _this.reason = message; - - if (file) { - /** - * Absolute path to the broken file. - * - * @type {string} - * - * @example - * error.file //=> 'a.sass' - * error.input.file //=> 'a.css' - */ - _this.file = file; - } - - if (source) { - /** - * Source code of the broken file. - * - * @type {string} - * - * @example - * error.source //=> 'a { b {} }' - * error.input.column //=> 'a b { }' - */ - _this.source = source; - } - - if (plugin) { - /** - * Plugin name, if error came from plugin. - * - * @type {string} - * - * @example - * error.plugin //=> 'postcss-vars' - */ - _this.plugin = plugin; - } - - if (typeof line !== 'undefined' && typeof column !== 'undefined') { - /** - * Source line of the error. - * - * @type {number} - * - * @example - * error.line //=> 2 - * error.input.line //=> 4 - */ - _this.line = line; - /** - * Source column of the error. - * - * @type {number} - * - * @example - * error.column //=> 1 - * error.input.column //=> 4 - */ - - _this.column = column; - } - - _this.setMessage(); - - if (Error.captureStackTrace) { - Error.captureStackTrace(_assertThisInitialized(_this), CssSyntaxError); - } - - return _this; - } - - var _proto = CssSyntaxError.prototype; - - _proto.setMessage = function setMessage() { - /** - * Full error text in the GNU error format - * with plugin, file, line and column. - * - * @type {string} - * - * @example - * error.message //=> 'a.css:1:1: Unclosed block' - */ - this.message = this.plugin ? this.plugin + ': ' : ''; - this.message += this.file ? this.file : ''; - - if (typeof this.line !== 'undefined') { - this.message += ':' + this.line + ':' + this.column; - } - - this.message += ': ' + this.reason; - } - /** - * Returns a few lines of CSS source that caused the error. - * - * If the CSS has an input source map without `sourceContent`, - * this method will return an empty string. - * - * @param {boolean} [color] Whether arrow will be colored red by terminal - * color codes. By default, PostCSS will detect - * color support by `process.stdout.isTTY` - * and `process.env.NODE_DISABLE_COLORS`. - * - * @example - * error.showSourceCode() //=> " 4 | } - * // 5 | a { - * // > 6 | bad - * // | ^ - * // 7 | } - * // 8 | b {" - * - * @return {string} Few lines of CSS source that caused the error. - */ - ; - - _proto.showSourceCode = function showSourceCode(color) { - var _this2 = this; - - if (!this.source) return ''; - var css = this.source; - - if (_terminalHighlight.default) { - if (typeof color === 'undefined') color = _supportsColor.default.stdout; - if (color) css = (0, _terminalHighlight.default)(css); - } - - var lines = css.split(/\r?\n/); - var start = Math.max(this.line - 3, 0); - var end = Math.min(this.line + 2, lines.length); - var maxWidth = String(end).length; - - function mark(text) { - if (color && _chalk.default.red) { - return _chalk.default.red.bold(text); - } - - return text; - } - - function aside(text) { - if (color && _chalk.default.gray) { - return _chalk.default.gray(text); - } - - return text; - } - - return lines.slice(start, end).map(function (line, index) { - var number = start + 1 + index; - var gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | '; - - if (number === _this2.line) { - var spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, _this2.column - 1).replace(/[^\t]/g, ' '); - return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^'); - } +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); - return ' ' + aside(gutter) + line; - }).join('\n'); + if (index < 0) { + return false; } - /** - * Returns error position, message and source code of the broken part. - * - * @example - * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block - * // > 1 | a { - * // | ^" - * - * @return {string} Error position, message and source code. - */ - ; - - _proto.toString = function toString() { - var code = this.showSourceCode(); - - if (code) { - code = '\n\n' + code + '\n'; - } - - return this.name + ': ' + this.message + code; + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); } - /** - * @memberof CssSyntaxError# - * @member {Input} input Input object with PostCSS internal information - * about input file. If input has source map - * from previous tool, PostCSS will use origin - * (for example, Sass) source. You can use this - * object to get PostCSS input source. - * - * @example - * error.input.file //=> 'a.css' - * error.file //=> 'a.sass' - */ - ; - - return CssSyntaxError; -}(_wrapNativeSuper(Error)); - -var _default = CssSyntaxError; -exports.default = _default; -module.exports = exports.default; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNzcy1zeW50YXgtZXJyb3IuZXM2Il0sIm5hbWVzIjpbIkNzc1N5bnRheEVycm9yIiwibWVzc2FnZSIsImxpbmUiLCJjb2x1bW4iLCJzb3VyY2UiLCJmaWxlIiwicGx1Z2luIiwibmFtZSIsInJlYXNvbiIsInNldE1lc3NhZ2UiLCJFcnJvciIsImNhcHR1cmVTdGFja1RyYWNlIiwic2hvd1NvdXJjZUNvZGUiLCJjb2xvciIsImNzcyIsInRlcm1pbmFsSGlnaGxpZ2h0Iiwic3VwcG9ydHNDb2xvciIsInN0ZG91dCIsImxpbmVzIiwic3BsaXQiLCJzdGFydCIsIk1hdGgiLCJtYXgiLCJlbmQiLCJtaW4iLCJsZW5ndGgiLCJtYXhXaWR0aCIsIlN0cmluZyIsIm1hcmsiLCJ0ZXh0IiwiY2hhbGsiLCJyZWQiLCJib2xkIiwiYXNpZGUiLCJncmF5Iiwic2xpY2UiLCJtYXAiLCJpbmRleCIsIm51bWJlciIsImd1dHRlciIsInNwYWNpbmciLCJyZXBsYWNlIiwiam9pbiIsInRvU3RyaW5nIiwiY29kZSJdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQTs7QUFDQTs7QUFFQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7QUFFQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0lBMkJNQSxjOzs7OztBQUNKOzs7Ozs7OztBQVFBLDBCQUFhQy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lID0gJ0Nzc1N5bnRheEVycm9yJ1xuICAgIC8qKlxuICAgICAqIEVycm9yIG1lc3NhZ2UuXG4gICAgICpcbiAgICAgKiBAdHlwZSB7c3RyaW5nfVxuICAgICAqXG4gICAgICogQGV4YW1wbGVcbiAgICAgKiBlcnJvci5tZXNzYWdlIC8vPT4gJ1VuY2xvc2VkIGJsb2NrJ1xuICAgICAqL1xuICAgIHRoaXMucmVhc29uID0gbWVzc2FnZVxuXG4gICAgaWYgKGZpbGUpIHtcbiAgICAgIC8qKlxuICAgICAgICogQWJzb2x1dGUgcGF0aCB0byB0aGUgYnJva2VuIGZpbGUuXG4gICAgICAgKlxuICAgICAgICogQHR5cGUge3N0cmluZ31cbiAgICAgICAqXG4gICAgICAgKiBAZXhhbXBsZVxuICAgICAgICogZXJyb3IuZmlsZSAgICAgICAvLz0+ICdhLnNhc3MnXG4gICAgICAgKiBlcnJvci5pbnB1dC5maWxlIC8vPT4gJ2EuY3NzJ1xuICAgICAgICovXG4gICAgICB0aGlzLmZpbGUgPSBmaWxlXG4gICAgfVxuICAgIGlmIChzb3VyY2UpIHtcbiAgICAgIC8qKlxuICAgICAgICogU291cmNlIGNvZGUgb2YgdGhlIGJyb2tlbiBmaWxlLlxuICAgICAgICpcbiAgICAgICAqIEB0eXBlIHtzdHJpbmd9XG4gICAgICAgKlxuICAgICAgICogQGV4YW1wbGVcbiAgICAgICAqIGVycm9yLnNvdXJjZSAgICAgICAvLz0+ICdhIHsgYiB7fSB9J1xuICAgICAgICogZXJyb3IuaW5wdXQuY29sdW1uIC8vPT4gJ2EgYiB7IH0nXG4gICAgICAgKi9cbiAgICAgIHRoaXMuc291cmNlID0gc291cmNlXG4gICAgfVxuICAgIGlmIChwbHVnaW4pIHtcbiAgICAgIC8qKlxuICAgICAgICogUGx1Z2luIG5hbWUsIGlmIGVycm9yIGNhbWUgZnJvbSBwbHVnaW4uXG4gICAgICAgKlxuICAgICAgICogQHR5cGUge3N0cmluZ31cbiAgICAgICAqXG4gICAgICAgKiBAZXhhbXBsZVxuICAgICAgICogZXJyb3IucGx1Z2luIC8vPT4gJ3Bvc3Rjc3MtdmFycydcbiAgICAgICAqL1xuICAgICAgdGhpcy5wbHVnaW4gPSBwbHVnaW5cbiAgICB9XG4gICAgaWYgKHR5cGVvZiBsaW5lICE9PSAndW5kZWZpbmVkJyAmJiB0eXBlb2YgY29sdW1uICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgLyoqXG4gICAgICAgKiBTb3VyY2UgbGluZSBvZiB0aGUgZXJyb3IuXG4gICAgICAgKlxuICAgICAgICogQHR5cGUge251bWJlcn1cbiAgICAgICAqXG4gICAgICAgKiBAZXhhbXBsZVxuICAgICAgICogZXJyb3IubGluZSAgICAgICAvLz0+IDJcbiAgICAgICAqIGVycm9yLmlucHV0LmxpbmUgLy89PiA0XG4gICAgICAgKi9cbiAgICAgIHRoaXMubGluZSA9IGxpbmVcbiAgICAgIC8qKlxuICAgICAgICogU291cmNlIGNvbHVtbiBvZiB0aGUgZXJyb3IuXG4gICAgICAgKlxuICAgICAgICogQHR5cGUge251bWJlcn1cbiAgICAgICAqXG4gICAgICAgKiBAZXhhbXBsZVxuICAgICAgICogZXJyb3IuY29sdW1uICAgICAgIC8vPT4gMVxuICAgICAgICogZXJyb3IuaW5wdXQuY29sdW1uIC8vPT4gNFxuICAgICAgICovXG4gICAgICB0aGlzLmNvbHVtbiA9IGNvbHVtblxuICAgIH1cblxuICAgIHRoaXMuc2V0TWVzc2FnZSgpXG5cbiAgICBpZiAoRXJyb3IuY2FwdHVyZVN0YWNrVHJhY2UpIHtcbiAgICAgIEVycm9yLmNhcHR1cmVTdGFja1RyYWNlKHRoaXMsIENzc1N5bnRheEVycm9yKVxuICAgIH1cbiAgfVxuXG4gIHNldE1lc3NhZ2UgKCkge1xuICAgIC8qKlxuICAgICAqIEZ1bGwgZXJyb3IgdGV4dCBpbiB0aGUgR05VIGVycm9yIGZvcm1hdFxuICAgICAqIHdpdGggcGx1Z2luLCBm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rkb3V0LmlzVFRZYFxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgYW5kIGBwcm9jZXNzLmVudi5OT0RFX0RJU0FCTEVfQ09MT1JTYC5cbiAgICpcbiAgICogQGV4YW1wbGVcbiAgICogZXJyb3Iuc2hvd1NvdXJjZUNvZGUoKSAvLz0+IFwiICA0IHwgfVxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgNSB8IGEge1xuICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgID4gNiB8ICAgYmFkXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgIHwgICBeXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICA3IHwgfVxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgOCB8IGIge1wiXG4gICAqXG4gICAqIEByZXR1cm4ge3N0cmluZ30gRmV3IGxpbmVzIG9mIENTUyBzb3VyY2UgdGhhdCBjYXVzZWQgdGhlIGVycm9yLlxuICAgKi9cbiAgc2hvd1NvdXJjZUNvZGUgKGNvbG9yKSB7XG4gICAgaWYgKCF0aGlzLnNvdXJjZSkgcmV0dXJuICcnXG5cbiAgICBsZXQgY3NzID0gdGhpcy5zb3VyY2VcbiAgICBpZiAodGVybWluYWxIaWdobGlnaHQpIHtcbiAgICAgIGlmICh0eXBlb2YgY29sb3IgPT09ICd1bmRlZmluZWQnKSBjb2xvciA9IHN1cHBvcnRzQ29sb3Iuc3Rkb3V0XG4gICAgICBpZiAoY29sb3IpIGNzcyA9IHRlcm1pbmFsSGlnaGxpZ2h0KGNzcylcbiAgICB9XG5cbiAgICBsZXQgbGluZXMgPSBjc3Muc3BsaXQoL1xccj9cXG4vKVxuICAgIGxldCBzdGFydCA9IE1hdGgubWF4KHRoaXMubGluZSAtIDMsIDApXG4gICAgbGV0IGVuZCA9IE1hdGgubWluKHRoaXMubGluZSArIDIsIGxpbmVzLmxlbmd0aClcblxuICAgIGxldCBtYXhX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aGUgYnJva2VuIHBhcnQuXG4gICAqXG4gICAqIEBleGFtcGxlXG4gICAqIGVycm9yLnRvU3RyaW5nKCkgLy89PiBcIkNzc1N5bnRheEVycm9yOiBhcHAuY3NzOjE6MTogVW5jbG9zZWQgYmxvY2tcbiAgICogICAgICAgICAgICAgICAgICAvLyAgICA+IDEgfCBhIHtcbiAgICogICAgICAgICAgICAgICAgICAvLyAgICAgICAgfCBeXCJcbiAgICpcbiAgICogQHJldHVybiB7c3RyaW5nfSBFcnJvciBwb3NpdGlvbiwgbWVzc2FnZSBhbmQgc291cmNlIGNvZGUuXG4gICAqL1xuICB0b1N0cmluZyAoKSB7XG4gICAgbGV0IGNvZGUgPSB0aGlzLnNob3dTb3VyY2VDb2RlKClcbiAgICBpZiAoY29kZSkge1xuICAgICAgY29kZSA9ICdcXG5cXG4nICsgY29kZSArICdcXG4nXG4gICAgfVxuICAgIHJldHVybiB0aGlzLm5hbWUgKyAnOiAnICsgdGhpcy5tZXNzYWdlICsgY29kZVxuICB9XG5cbiAgLyoqXG4gICAqIEBtZW1iZXJvZiBDc3NTeW50YXhFcnJvciNcbiAgICogQG1lbWJlciB7SW5wdXR9IGlucHV0IElucHV0IG9iamVjdCB3aXRoIFBvc3RDU1MgaW50ZXJuYWwgaW5mb3JtYXRpb25cbiAgICogICAgICAgICAgICAgICAgICAgICAgIGFib3V0IGlucHV0IGZpbGUuIElmIGlucHV0IGhhcyBzb3VyY2UgbWFwXG4gICAqICAgICAgICAgICAgICAgICAgICAgICBmcm9tIHByZXZpb3VzIHRvb2wsIFBvc3RDU1Mgd2lsbCB1c2Ugb3JpZ2luXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAoZm9yIGV4YW1wbGUsIFNhc3MpIHNvdXJjZS4gWW91IGNhbiB1c2UgdGhpc1xuICAgKiAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0IHRvIGdldCBQb3N0Q1NTIGlucHV0IHNvdXJjZS5cbiAgICpcbiAgICogQGV4YW1wbGVcbiAgICogZXJyb3IuaW5wdXQuZmlsZSAvLz0+ICdhLmNzcydcbiAgICogZXJyb3IuZmlsZSAgICAgICAvLz0+ICdhLnNhc3MnXG4gICAqL1xufVxuXG5leHBvcnQgZGVmYXVsdCBDc3NTeW50YXhFcnJvclxuIl0sImZpbGUiOiJjc3Mtc3ludGF4LWVycm9yLmpzIn0= - - -/***/ }), -/* 234 */ -/***/ (function(module) { - -/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to detect host constructors (Safari). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); + return true; +} /** - * A faster alternative to `Function#apply`, this function invokes `func` - * with the `this` binding of `thisArg` and the arguments of `args`. + * Gets the list cache value for `key`. * * @private - * @param {Function} func The function to invoke. - * @param {*} thisArg The `this` binding of `func`. - * @param {Array} args The arguments to invoke `func` with. - * @returns {*} Returns the result of `func`. + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ -function apply(func, thisArg, args) { - switch (args.length) { - case 0: return func.call(thisArg); - case 1: return func.call(thisArg, args[0]); - case 2: return func.call(thisArg, args[0], args[1]); - case 3: return func.call(thisArg, args[0], args[1], args[2]); - } - return func.apply(thisArg, args); +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; } /** - * A specialized version of `_.includes` for arrays without support for - * specifying an index to search from. + * Checks if a list cache value for `key` exists. * * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @returns {boolean} Returns `true` if `target` is found, else `false`. + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -function arrayIncludes(array, value) { - var length = array ? array.length : 0; - return !!length && baseIndexOf(array, value, 0) > -1; +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; } /** - * This function is like `arrayIncludes` except that it accepts a comparator. + * Sets the list cache `key` to `value`. * * @private - * @param {Array} [array] The array to inspect. - * @param {*} target The value to search for. - * @param {Function} comparator The comparator invoked per element. - * @returns {boolean} Returns `true` if `target` is found, else `false`. + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. */ -function arrayIncludesWith(array, value, comparator) { - var index = -1, - length = array ? array.length : 0; +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); - while (++index < length) { - if (comparator(value, array[index])) { - return true; - } + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; } - return false; + return this; } +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + /** - * A specialized version of `_.map` for arrays without support for iteratee - * shorthands. + * Creates a map cache object to store key-value pairs. * * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the new mapped array. + * @constructor + * @param {Array} [entries] The key-value pairs to cache. */ -function arrayMap(array, iteratee) { +function MapCache(entries) { var index = -1, - length = array ? array.length : 0, - result = Array(length); + length = entries ? entries.length : 0; + this.clear(); while (++index < length) { - result[index] = iteratee(array[index], index, array); + var entry = entries[index]; + this.set(entry[0], entry[1]); } - return result; } /** - * Appends the elements of `values` to `array`. + * Removes all key-value entries from the map. * * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. + * @name clear + * @memberOf MapCache */ -function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; } /** - * The base implementation of `_.findIndex` and `_.findLastIndex` without - * support for iteratee shorthands. + * Removes `key` and its value from the map. * * @private - * @param {Array} array The array to inspect. - * @param {Function} predicate The function invoked per iteration. - * @param {number} fromIndex The index to search from. - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {number} Returns the index of the matched value, else `-1`. + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -function baseFindIndex(array, predicate, fromIndex, fromRight) { - var length = array.length, - index = fromIndex + (fromRight ? 1 : -1); - - while ((fromRight ? index-- : ++index < length)) { - if (predicate(array[index], index, array)) { - return index; - } - } - return -1; +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); } /** - * The base implementation of `_.indexOf` without `fromIndex` bounds checks. + * Gets the map value for `key`. * * @private - * @param {Array} array The array to inspect. - * @param {*} value The value to search for. - * @param {number} fromIndex The index to search from. - * @returns {number} Returns the index of the matched value, else `-1`. + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ -function baseIndexOf(array, value, fromIndex) { - if (value !== value) { - return baseFindIndex(array, baseIsNaN, fromIndex); - } - var index = fromIndex - 1, - length = array.length; - - while (++index < length) { - if (array[index] === value) { - return index; - } - } - return -1; +function mapCacheGet(key) { + return getMapData(this, key).get(key); } /** - * The base implementation of `_.isNaN` without support for number objects. + * Checks if a map value for `key` exists. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is `NaN`, else `false`. + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -function baseIsNaN(value) { - return value !== value; +function mapCacheHas(key) { + return getMapData(this, key).has(key); } /** - * The base implementation of `_.unary` without support for storing metadata. + * Sets the map `key` to `value`. * * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. */ -function baseUnary(func) { - return function(value) { - return func(value); - }; +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; } +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; + /** - * Checks if a cache value for `key` exists. + * + * Creates an array cache object to store unique values. * * @private - * @param {Object} cache The cache to query. - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + * @constructor + * @param {Array} [values] The values to cache. */ -function cacheHas(cache, key) { - return cache.has(key); +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; + + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); + } } /** - * Gets the value at `key` of `object`. + * Adds `value` to the array cache. * * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. */ -function getValue(object, key) { - return object == null ? undefined : object[key]; +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; } /** - * Checks if `value` is a host object in IE < 9. + * Checks if `value` is in the array cache. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - -/** Used to detect overreaching core-js shims. */ -var coreJsData = root['__core-js_shared__']; - -/** Used to detect methods masquerading as native. */ -var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; -}()); - -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** Built-in value references. */ -var Symbol = root.Symbol, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice, - spreadableSymbol = Symbol ? Symbol.isConcatSpreadable : undefined; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max; - -/* Built-in method references that are verified to be native. */ -var Map = getNative(root, 'Map'), - nativeCreate = getNative(Object, 'create'); - -/** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Hash(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ -function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; -} - -/** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(key) { - return this.has(key) && delete this.__data__[key]; -} - -/** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; -} - -/** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); -} - -/** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ -function hashSet(key, value) { - var data = this.__data__; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; -} - -// Add methods to `Hash`. -Hash.prototype.clear = hashClear; -Hash.prototype['delete'] = hashDelete; -Hash.prototype.get = hashGet; -Hash.prototype.has = hashHas; -Hash.prototype.set = hashSet; - -/** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function ListCache(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ -function listCacheClear() { - this.__data__ = []; -} - -/** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - return true; -} - -/** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; -} - -/** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; -} - -/** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ -function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; -} - -// Add methods to `ListCache`. -ListCache.prototype.clear = listCacheClear; -ListCache.prototype['delete'] = listCacheDelete; -ListCache.prototype.get = listCacheGet; -ListCache.prototype.has = listCacheHas; -ListCache.prototype.set = listCacheSet; - -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function MapCache(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapCacheClear() { - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; -} - -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapCacheDelete(key) { - return getMapData(this, key)['delete'](key); -} - -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapCacheGet(key) { - return getMapData(this, key).get(key); -} - -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapCacheHas(key) { - return getMapData(this, key).has(key); -} - -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ -function mapCacheSet(key, value) { - getMapData(this, key).set(key, value); - return this; -} - -// Add methods to `MapCache`. -MapCache.prototype.clear = mapCacheClear; -MapCache.prototype['delete'] = mapCacheDelete; -MapCache.prototype.get = mapCacheGet; -MapCache.prototype.has = mapCacheHas; -MapCache.prototype.set = mapCacheSet; - -/** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function SetCache(values) { - var index = -1, - length = values ? values.length : 0; - - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } -} - -/** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. - */ -function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; -} - -/** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); @@ -53675,7 +53380,18 @@ module.exports = function ToObject(value) { /***/ }), /* 236 */, -/* 237 */, +/* 237 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const parse = __webpack_require__(584) +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean + + +/***/ }), /* 238 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -54518,15 +54234,23 @@ Writable.prototype._destroy = function (err, cb) { }; /***/ }), -/* 242 */, +/* 242 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const compare = __webpack_require__(386) +const lte = (a, b, loose) => compare(a, b, loose) <= 0 +module.exports = lte + + +/***/ }), /* 243 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const debug = __webpack_require__(509) -const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(749) +const debug = __webpack_require__(467) +const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(269) const { re, t } = __webpack_require__(331) -const { compareIdentifiers } = __webpack_require__(513) +const { compareIdentifiers } = __webpack_require__(96) class SemVer { constructor (version, options) { if (!options || typeof options !== 'object') { @@ -56121,7 +55845,87 @@ module.exports = { /***/ }), /* 253 */, /* 254 */, -/* 255 */, +/* 255 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const debug_1 = __importDefault(__webpack_require__(784)); +const path_1 = __importDefault(__webpack_require__(622)); +const createWatchProgram_1 = __webpack_require__(612); +const node_utils_1 = __webpack_require__(513); +const log = debug_1.default('typescript-eslint:typescript-estree:createProjectProgram'); +const DEFAULT_EXTRA_FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx']; +function getExtension(fileName) { + if (!fileName) { + return null; + } + return fileName.endsWith('.d.ts') ? '.d.ts' : path_1.default.extname(fileName); +} +/** + * @param code The code of the file being linted + * @param createDefaultProgram True if the default program should be created + * @param extra The config object + * @returns If found, returns the source file corresponding to the code and the containing program + */ +function createProjectProgram(code, createDefaultProgram, extra) { + log('Creating project program for: %s', extra.filePath); + const astAndProgram = node_utils_1.firstDefined(createWatchProgram_1.getProgramsForProjects(code, extra.filePath, extra), currentProgram => { + const ast = currentProgram.getSourceFile(extra.filePath); + // working around https://github.com/typescript-eslint/typescript-eslint/issues/1573 + const expectedExt = getExtension(extra.filePath); + const returnedExt = getExtension(ast === null || ast === void 0 ? void 0 : ast.fileName); + if (expectedExt !== returnedExt) { + return; + } + return ast && { ast, program: currentProgram }; + }); + if (!astAndProgram && !createDefaultProgram) { + // the file was either not matched within the tsconfig, or the extension wasn't expected + const errorLines = [ + '"parserOptions.project" has been set for @typescript-eslint/parser.', + `The file does not match your project config: ${path_1.default.relative(extra.tsconfigRootDir || process.cwd(), extra.filePath)}.`, + ]; + let hasMatchedAnError = false; + const extraFileExtensions = extra.extraFileExtensions || []; + extraFileExtensions.forEach(extraExtension => { + if (!extraExtension.startsWith('.')) { + errorLines.push(`Found unexpected extension "${extraExtension}" specified with the "extraFileExtensions" option. Did you mean ".${extraExtension}"?`); + } + if (DEFAULT_EXTRA_FILE_EXTENSIONS.includes(extraExtension)) { + errorLines.push(`You unnecessarily included the extension "${extraExtension}" with the "extraFileExtensions" option. This extension is already handled by the parser by default.`); + } + }); + const fileExtension = path_1.default.extname(extra.filePath); + if (!DEFAULT_EXTRA_FILE_EXTENSIONS.includes(fileExtension)) { + const nonStandardExt = `The extension for the file (${fileExtension}) is non-standard`; + if (extraFileExtensions.length > 0) { + if (!extraFileExtensions.includes(fileExtension)) { + errorLines.push(`${nonStandardExt}. It should be added to your existing "parserOptions.extraFileExtensions".`); + hasMatchedAnError = true; + } + } + else { + errorLines.push(`${nonStandardExt}. You should add "parserOptions.extraFileExtensions" to your config.`); + hasMatchedAnError = true; + } + } + if (!hasMatchedAnError) { + errorLines.push('The file must be included in at least one of the projects provided.'); + hasMatchedAnError = true; + } + throw new Error(errorLines.join('\n')); + } + return astAndProgram; +} +exports.createProjectProgram = createProjectProgram; +//# sourceMappingURL=createProjectProgram.js.map + +/***/ }), /* 256 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -57196,32 +57000,26 @@ ZipArchiveOutputStream.prototype.setComment = function(comment) { /***/ }), /* 269 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module) { -"use strict"; +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -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)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug_1 = __importDefault(__webpack_require__(784)); -const ts = __importStar(__webpack_require__(752)); -const shared_1 = __webpack_require__(164); -const log = debug_1.default('typescript-eslint:typescript-estree:createSourceFile'); -function createSourceFile(code, extra) { - log('Getting AST without type information in %s mode for: %s', extra.jsx ? 'TSX' : 'TS', extra.filePath); - return ts.createSourceFile(extra.filePath, code, ts.ScriptTarget.Latest, - /* setParentNodes */ true, shared_1.getScriptKind(extra)); +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 + +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +module.exports = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH } -exports.createSourceFile = createSourceFile; -//# sourceMappingURL=createSourceFile.js.map + /***/ }), /* 270 */ @@ -58077,7 +57875,316 @@ if (process.env.READABLE_STREAM === 'disable' && Stream) { /***/ }), -/* 275 */, +/* 275 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +var fs = __webpack_require__(747); +var path = __webpack_require__(622); +var caller = __webpack_require__(433); +var nodeModulesPaths = __webpack_require__(194); +var normalizeOptions = __webpack_require__(590); +var isCore = __webpack_require__(528); + +var defaultIsFile = function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var maybeUnwrapSymlink = function maybeUnwrapSymlink(x, opts, cb) { + if (!opts || !opts.preserveSymlinks) { + fs.realpath(x, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? x : realPath); + }); + } else { + cb(null, x); + } +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolve(x, options, callback) { + var cb = callback; + var opts = options; + if (typeof options === 'function') { + cb = opts; + opts = {}; + } + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + opts = normalizeOptions(x, opts); + + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; + var readFile = opts.readFile || fs.readFile; + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || []; + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = path.resolve(basedir); + + maybeUnwrapSymlink( + absoluteStart, + opts, + function (err, realStart) { + if (err) cb(err); + else validateBasedir(realStart); + } + ); + + function validateBasedir(basedir) { + if (opts.basedir) { + var dirError = new TypeError('Provided basedir "' + basedir + '" is not a directory' + (opts.preserveSymlinks ? '' : ', or a symlink to a directory')); + dirError.code = 'INVALID_BASEDIR'; + isDirectory(basedir, function (err, result) { + if (err) return cb(err); + if (!result) { return cb(dirError); } + validBasedir(basedir); + }); + } else { + validBasedir(basedir); + } + } + + var res; + function validBasedir(basedir) { + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + res = path.resolve(basedir, x); + if (x === '..' || x.slice(-1) === '/') res += '/'; + if ((/\/$/).test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else if (isCore(x)) { + return cb(null, x); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err); + else if (n) { + return maybeUnwrapSymlink(n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function onfile(err, m, pkg) { + if (err) cb(err); + else if (m) cb(null, m, pkg); + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err); + else if (d) { + maybeUnwrapSymlink(d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + + var pkg = loadPackage; + if (pkg) onpkg(null, pkg); + else loadpkg(path.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return cb(null); + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); + + maybeUnwrapSymlink(dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path.dirname(dir), cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); + + readFile(pkgfile, function (err, body) { + if (err) cb(err); + try { var pkg = JSON.parse(body); } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile, dir); + } + cb(null, pkg, dir); + }); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + maybeUnwrapSymlink(x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadAsDirectory(path.dirname(x), fpkg, cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + + readFile(pkgfile, function (err, body) { + if (err) return cb(err); + try { + var pkg = JSON.parse(body); + } catch (jsonErr) {} + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile, pkgdir); + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + isDirectory(path.dirname(dir), isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + loadAsFile(dir, opts.package, onfile); + } + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(dir, opts.package, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + function loadNodeModules(x, start, cb) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + processDirs( + cb, + packageIterator ? packageIterator(x, start, thunk, opts) : thunk() + ); + } +}; + + +/***/ }), /* 276 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -58137,603 +58244,7 @@ module.exports = function ToPropertyDescriptor(Obj) { /***/ }), -/* 277 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -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)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const unescape_1 = __importDefault(__webpack_require__(821)); -const ts = __importStar(__webpack_require__(752)); -const ts_estree_1 = __webpack_require__(372); -const SyntaxKind = ts.SyntaxKind; -const ASSIGNMENT_OPERATORS = [ - SyntaxKind.EqualsToken, - SyntaxKind.PlusEqualsToken, - SyntaxKind.MinusEqualsToken, - SyntaxKind.AsteriskEqualsToken, - SyntaxKind.AsteriskAsteriskEqualsToken, - SyntaxKind.SlashEqualsToken, - SyntaxKind.PercentEqualsToken, - SyntaxKind.LessThanLessThanEqualsToken, - SyntaxKind.GreaterThanGreaterThanEqualsToken, - SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, - SyntaxKind.AmpersandEqualsToken, - SyntaxKind.BarEqualsToken, - SyntaxKind.CaretEqualsToken, -]; -const LOGICAL_OPERATORS = [ - SyntaxKind.BarBarToken, - SyntaxKind.AmpersandAmpersandToken, - SyntaxKind.QuestionQuestionToken, -]; -const TOKEN_TO_TEXT = { - [SyntaxKind.OpenBraceToken]: '{', - [SyntaxKind.CloseBraceToken]: '}', - [SyntaxKind.OpenParenToken]: '(', - [SyntaxKind.CloseParenToken]: ')', - [SyntaxKind.OpenBracketToken]: '[', - [SyntaxKind.CloseBracketToken]: ']', - [SyntaxKind.DotToken]: '.', - [SyntaxKind.DotDotDotToken]: '...', - [SyntaxKind.SemicolonToken]: ';', - [SyntaxKind.CommaToken]: ',', - [SyntaxKind.LessThanToken]: '<', - [SyntaxKind.GreaterThanToken]: '>', - [SyntaxKind.LessThanEqualsToken]: '<=', - [SyntaxKind.GreaterThanEqualsToken]: '>=', - [SyntaxKind.EqualsEqualsToken]: '==', - [SyntaxKind.ExclamationEqualsToken]: '!=', - [SyntaxKind.EqualsEqualsEqualsToken]: '===', - [SyntaxKind.InstanceOfKeyword]: 'instanceof', - [SyntaxKind.ExclamationEqualsEqualsToken]: '!==', - [SyntaxKind.EqualsGreaterThanToken]: '=>', - [SyntaxKind.PlusToken]: '+', - [SyntaxKind.MinusToken]: '-', - [SyntaxKind.AsteriskToken]: '*', - [SyntaxKind.AsteriskAsteriskToken]: '**', - [SyntaxKind.SlashToken]: '/', - [SyntaxKind.PercentToken]: '%', - [SyntaxKind.PlusPlusToken]: '++', - [SyntaxKind.MinusMinusToken]: '--', - [SyntaxKind.LessThanLessThanToken]: '<<', - [SyntaxKind.LessThanSlashToken]: '>', - [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>', - [SyntaxKind.AmpersandToken]: '&', - [SyntaxKind.BarToken]: '|', - [SyntaxKind.CaretToken]: '^', - [SyntaxKind.ExclamationToken]: '!', - [SyntaxKind.TildeToken]: '~', - [SyntaxKind.AmpersandAmpersandToken]: '&&', - [SyntaxKind.BarBarToken]: '||', - [SyntaxKind.QuestionToken]: '?', - [SyntaxKind.ColonToken]: ':', - [SyntaxKind.EqualsToken]: '=', - [SyntaxKind.PlusEqualsToken]: '+=', - [SyntaxKind.MinusEqualsToken]: '-=', - [SyntaxKind.AsteriskEqualsToken]: '*=', - [SyntaxKind.AsteriskAsteriskEqualsToken]: '**=', - [SyntaxKind.SlashEqualsToken]: '/=', - [SyntaxKind.PercentEqualsToken]: '%=', - [SyntaxKind.LessThanLessThanEqualsToken]: '<<=', - [SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>=', - [SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>=', - [SyntaxKind.AmpersandEqualsToken]: '&=', - [SyntaxKind.BarEqualsToken]: '|=', - [SyntaxKind.CaretEqualsToken]: '^=', - [SyntaxKind.AtToken]: '@', - [SyntaxKind.InKeyword]: 'in', - [SyntaxKind.UniqueKeyword]: 'unique', - [SyntaxKind.KeyOfKeyword]: 'keyof', - [SyntaxKind.NewKeyword]: 'new', - [SyntaxKind.ImportKeyword]: 'import', - [SyntaxKind.ReadonlyKeyword]: 'readonly', - [SyntaxKind.QuestionQuestionToken]: '??', - [SyntaxKind.QuestionDotToken]: '?.', -}; -/** - * Returns true if the given ts.Token is the assignment operator - * @param operator the operator token - * @returns is assignment - */ -function isAssignmentOperator(operator) { - return ASSIGNMENT_OPERATORS.includes(operator.kind); -} -exports.isAssignmentOperator = isAssignmentOperator; -/** - * Returns true if the given ts.Token is a logical operator - * @param operator the operator token - * @returns is a logical operator - */ -function isLogicalOperator(operator) { - return LOGICAL_OPERATORS.includes(operator.kind); -} -exports.isLogicalOperator = isLogicalOperator; -/** - * Returns the string form of the given TSToken SyntaxKind - * @param kind the token's SyntaxKind - * @returns the token applicable token as a string - */ -function getTextForTokenKind(kind) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - return kind in TOKEN_TO_TEXT ? TOKEN_TO_TEXT[kind] : undefined; -} -exports.getTextForTokenKind = getTextForTokenKind; -/** - * Returns true if the given ts.Node is a valid ESTree class member - * @param node TypeScript AST node - * @returns is valid ESTree class member - */ -function isESTreeClassMember(node) { - return node.kind !== SyntaxKind.SemicolonClassElement; -} -exports.isESTreeClassMember = isESTreeClassMember; -/** - * Checks if a ts.Node has a modifier - * @param modifierKind TypeScript SyntaxKind modifier - * @param node TypeScript AST node - * @returns has the modifier specified - */ -function hasModifier(modifierKind, node) { - return (!!node.modifiers && - !!node.modifiers.length && - node.modifiers.some(modifier => modifier.kind === modifierKind)); -} -exports.hasModifier = hasModifier; -/** - * Get last last modifier in ast - * @param node TypeScript AST node - * @returns returns last modifier if present or null - */ -function getLastModifier(node) { - return ((!!node.modifiers && - !!node.modifiers.length && - node.modifiers[node.modifiers.length - 1]) || - null); -} -exports.getLastModifier = getLastModifier; -/** - * Returns true if the given ts.Token is a comma - * @param token the TypeScript token - * @returns is comma - */ -function isComma(token) { - return token.kind === SyntaxKind.CommaToken; -} -exports.isComma = isComma; -/** - * Returns true if the given ts.Node is a comment - * @param node the TypeScript node - * @returns is comment - */ -function isComment(node) { - return (node.kind === SyntaxKind.SingleLineCommentTrivia || - node.kind === SyntaxKind.MultiLineCommentTrivia); -} -exports.isComment = isComment; -/** - * Returns true if the given ts.Node is a JSDoc comment - * @param node the TypeScript node - * @returns is JSDoc comment - */ -function isJSDocComment(node) { - return node.kind === SyntaxKind.JSDocComment; -} -exports.isJSDocComment = isJSDocComment; -/** - * Returns the binary expression type of the given ts.Token - * @param operator the operator token - * @returns the binary expression type - */ -function getBinaryExpressionType(operator) { - if (isAssignmentOperator(operator)) { - return ts_estree_1.AST_NODE_TYPES.AssignmentExpression; - } - else if (isLogicalOperator(operator)) { - return ts_estree_1.AST_NODE_TYPES.LogicalExpression; - } - return ts_estree_1.AST_NODE_TYPES.BinaryExpression; -} -exports.getBinaryExpressionType = getBinaryExpressionType; -/** - * Returns line and column data for the given positions, - * @param pos position to check - * @param ast the AST object - * @returns line and column - */ -function getLineAndCharacterFor(pos, ast) { - const loc = ast.getLineAndCharacterOfPosition(pos); - return { - line: loc.line + 1, - column: loc.character, - }; -} -exports.getLineAndCharacterFor = getLineAndCharacterFor; -/** - * Returns line and column data for the given start and end positions, - * for the given AST - * @param start start data - * @param end end data - * @param ast the AST object - * @returns the loc data - */ -function getLocFor(start, end, ast) { - return { - start: getLineAndCharacterFor(start, ast), - end: getLineAndCharacterFor(end, ast), - }; -} -exports.getLocFor = getLocFor; -/** - * Check whatever node can contain directive - * @param node - * @returns returns true if node can contain directive - */ -function canContainDirective(node) { - if (node.kind === ts.SyntaxKind.Block) { - switch (node.parent.kind) { - case ts.SyntaxKind.Constructor: - case ts.SyntaxKind.GetAccessor: - case ts.SyntaxKind.SetAccessor: - case ts.SyntaxKind.ArrowFunction: - case ts.SyntaxKind.FunctionExpression: - case ts.SyntaxKind.FunctionDeclaration: - case ts.SyntaxKind.MethodDeclaration: - return true; - default: - return false; - } - } - return true; -} -exports.canContainDirective = canContainDirective; -/** - * Returns range for the given ts.Node - * @param node the ts.Node or ts.Token - * @param ast the AST object - * @returns the range data - */ -function getRange(node, ast) { - return [node.getStart(ast), node.getEnd()]; -} -exports.getRange = getRange; -/** - * Returns true if a given ts.Node is a token - * @param node the ts.Node - * @returns is a token - */ -function isToken(node) { - return (node.kind >= SyntaxKind.FirstToken && node.kind <= SyntaxKind.LastToken); -} -exports.isToken = isToken; -/** - * Returns true if a given ts.Node is a JSX token - * @param node ts.Node to be checked - * @returns is a JSX token - */ -function isJSXToken(node) { - return (node.kind >= SyntaxKind.JsxElement && node.kind <= SyntaxKind.JsxAttribute); -} -exports.isJSXToken = isJSXToken; -/** - * Returns the declaration kind of the given ts.Node - * @param node TypeScript AST node - * @returns declaration kind - */ -function getDeclarationKind(node) { - if (node.flags & ts.NodeFlags.Let) { - return 'let'; - } - if (node.flags & ts.NodeFlags.Const) { - return 'const'; - } - return 'var'; -} -exports.getDeclarationKind = getDeclarationKind; -/** - * Gets a ts.Node's accessibility level - * @param node The ts.Node - * @returns accessibility "public", "protected", "private", or null - */ -function getTSNodeAccessibility(node) { - const modifiers = node.modifiers; - if (!modifiers) { - return null; - } - for (let i = 0; i < modifiers.length; i++) { - const modifier = modifiers[i]; - switch (modifier.kind) { - case SyntaxKind.PublicKeyword: - return 'public'; - case SyntaxKind.ProtectedKeyword: - return 'protected'; - case SyntaxKind.PrivateKeyword: - return 'private'; - default: - break; - } - } - return null; -} -exports.getTSNodeAccessibility = getTSNodeAccessibility; -/** - * Finds the next token based on the previous one and its parent - * Had to copy this from TS instead of using TS's version because theirs doesn't pass the ast to getChildren - * @param previousToken The previous TSToken - * @param parent The parent TSNode - * @param ast The TS AST - * @returns the next TSToken - */ -function findNextToken(previousToken, parent, ast) { - return find(parent); - function find(n) { - if (ts.isToken(n) && n.pos === previousToken.end) { - // this is token that starts at the end of previous token - return it - return n; - } - return firstDefined(n.getChildren(ast), (child) => { - const shouldDiveInChildNode = - // previous token is enclosed somewhere in the child - (child.pos <= previousToken.pos && child.end > previousToken.end) || - // previous token ends exactly at the beginning of child - child.pos === previousToken.end; - return shouldDiveInChildNode && nodeHasTokens(child, ast) - ? find(child) - : undefined; - }); - } -} -exports.findNextToken = findNextToken; -/** - * Find the first matching ancestor based on the given predicate function. - * @param node The current ts.Node - * @param predicate The predicate function to apply to each checked ancestor - * @returns a matching parent ts.Node - */ -function findFirstMatchingAncestor(node, predicate) { - while (node) { - if (predicate(node)) { - return node; - } - node = node.parent; - } - return undefined; -} -exports.findFirstMatchingAncestor = findFirstMatchingAncestor; -/** - * Returns true if a given ts.Node has a JSX token within its hierarchy - * @param node ts.Node to be checked - * @returns has JSX ancestor - */ -function hasJSXAncestor(node) { - return !!findFirstMatchingAncestor(node, isJSXToken); -} -exports.hasJSXAncestor = hasJSXAncestor; -/** - * Unescape the text content of string literals, e.g. & -> & - * @param text The escaped string literal text. - * @returns The unescaped string literal text. - */ -function unescapeStringLiteralText(text) { - return unescape_1.default(text); -} -exports.unescapeStringLiteralText = unescapeStringLiteralText; -/** - * Returns true if a given ts.Node is a computed property - * @param node ts.Node to be checked - * @returns is Computed Property - */ -function isComputedProperty(node) { - return node.kind === SyntaxKind.ComputedPropertyName; -} -exports.isComputedProperty = isComputedProperty; -/** - * Returns true if a given ts.Node is optional (has QuestionToken) - * @param node ts.Node to be checked - * @returns is Optional - */ -function isOptional(node) { - return node.questionToken - ? node.questionToken.kind === SyntaxKind.QuestionToken - : false; -} -exports.isOptional = isOptional; -/** - * Returns the type of a given ts.Token - * @param token the ts.Token - * @returns the token type - */ -function getTokenType(token) { - if ('originalKeywordKind' in token && token.originalKeywordKind) { - if (token.originalKeywordKind === SyntaxKind.NullKeyword) { - return ts_estree_1.AST_TOKEN_TYPES.Null; - } - else if (token.originalKeywordKind >= SyntaxKind.FirstFutureReservedWord && - token.originalKeywordKind <= SyntaxKind.LastKeyword) { - return ts_estree_1.AST_TOKEN_TYPES.Identifier; - } - return ts_estree_1.AST_TOKEN_TYPES.Keyword; - } - if (token.kind >= SyntaxKind.FirstKeyword && - token.kind <= SyntaxKind.LastFutureReservedWord) { - if (token.kind === SyntaxKind.FalseKeyword || - token.kind === SyntaxKind.TrueKeyword) { - return ts_estree_1.AST_TOKEN_TYPES.Boolean; - } - return ts_estree_1.AST_TOKEN_TYPES.Keyword; - } - if (token.kind >= SyntaxKind.FirstPunctuation && - token.kind <= SyntaxKind.LastBinaryOperator) { - return ts_estree_1.AST_TOKEN_TYPES.Punctuator; - } - if (token.kind >= SyntaxKind.NoSubstitutionTemplateLiteral && - token.kind <= SyntaxKind.TemplateTail) { - return ts_estree_1.AST_TOKEN_TYPES.Template; - } - switch (token.kind) { - case SyntaxKind.NumericLiteral: - return ts_estree_1.AST_TOKEN_TYPES.Numeric; - case SyntaxKind.JsxText: - return ts_estree_1.AST_TOKEN_TYPES.JSXText; - case SyntaxKind.StringLiteral: - // A TypeScript-StringLiteral token with a TypeScript-JsxAttribute or TypeScript-JsxElement parent, - // must actually be an ESTree-JSXText token - if (token.parent && - (token.parent.kind === SyntaxKind.JsxAttribute || - token.parent.kind === SyntaxKind.JsxElement)) { - return ts_estree_1.AST_TOKEN_TYPES.JSXText; - } - return ts_estree_1.AST_TOKEN_TYPES.String; - case SyntaxKind.RegularExpressionLiteral: - return ts_estree_1.AST_TOKEN_TYPES.RegularExpression; - case SyntaxKind.Identifier: - case SyntaxKind.ConstructorKeyword: - case SyntaxKind.GetKeyword: - case SyntaxKind.SetKeyword: - // falls through - default: - } - // Some JSX tokens have to be determined based on their parent - if (token.parent && token.kind === SyntaxKind.Identifier) { - if (isJSXToken(token.parent)) { - return ts_estree_1.AST_TOKEN_TYPES.JSXIdentifier; - } - if (token.parent.kind === SyntaxKind.PropertyAccessExpression && - hasJSXAncestor(token)) { - return ts_estree_1.AST_TOKEN_TYPES.JSXIdentifier; - } - } - return ts_estree_1.AST_TOKEN_TYPES.Identifier; -} -exports.getTokenType = getTokenType; -/** - * Extends and formats a given ts.Token, for a given AST - * @param token the ts.Token - * @param ast the AST object - * @returns the converted Token - */ -function convertToken(token, ast) { - const start = token.kind === SyntaxKind.JsxText - ? token.getFullStart() - : token.getStart(ast); - const end = token.getEnd(); - const value = ast.text.slice(start, end); - const tokenType = getTokenType(token); - if (tokenType === ts_estree_1.AST_TOKEN_TYPES.RegularExpression) { - return { - type: tokenType, - value, - range: [start, end], - loc: getLocFor(start, end, ast), - regex: { - pattern: value.slice(1, value.lastIndexOf('/')), - flags: value.slice(value.lastIndexOf('/') + 1), - }, - }; - } - else { - return { - type: tokenType, - value, - range: [start, end], - loc: getLocFor(start, end, ast), - }; - } -} -exports.convertToken = convertToken; -/** - * Converts all tokens for the given AST - * @param ast the AST object - * @returns the converted Tokens - */ -function convertTokens(ast) { - const result = []; - /** - * @param node the ts.Node - */ - function walk(node) { - // TypeScript generates tokens for types in JSDoc blocks. Comment tokens - // and their children should not be walked or added to the resulting tokens list. - if (isComment(node) || isJSDocComment(node)) { - return; - } - if (isToken(node) && node.kind !== SyntaxKind.EndOfFileToken) { - const converted = convertToken(node, ast); - if (converted) { - result.push(converted); - } - } - else { - node.getChildren(ast).forEach(walk); - } - } - walk(ast); - return result; -} -exports.convertTokens = convertTokens; -/** - * @param ast the AST object - * @param start the index at which the error starts - * @param message the error message - * @returns converted error object - */ -function createError(ast, start, message) { - const loc = ast.getLineAndCharacterOfPosition(start); - return { - index: start, - lineNumber: loc.line + 1, - column: loc.character, - message, - }; -} -exports.createError = createError; -/** - * @param n the TSNode - * @param ast the TS AST - */ -function nodeHasTokens(n, ast) { - // If we have a token or node that has a non-zero width, it must have tokens. - // Note: getWidth() does not take trivia into account. - return n.kind === SyntaxKind.EndOfFileToken - ? // eslint-disable-next-line @typescript-eslint/no-explicit-any - !!n.jsDoc - : n.getWidth(ast) !== 0; -} -exports.nodeHasTokens = nodeHasTokens; -/** - * Like `forEach`, but suitable for use with numbers and strings (which may be falsy). - * @template T - * @template U - * @param array - * @param callback - */ -function firstDefined(array, callback) { - if (array === undefined) { - return undefined; - } - for (let i = 0; i < array.length; i++) { - const result = callback(array[i], i); - if (result !== undefined) { - return result; - } - } - return undefined; -} -exports.firstDefined = firstDefined; -//# sourceMappingURL=node-utils.js.map - -/***/ }), +/* 277 */, /* 278 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -60659,29 +60170,13 @@ module.exports = function(fileContent) { /* 291 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(570) +const compare = __webpack_require__(340) const neq = (a, b, loose) => compare(a, b, loose) !== 0 module.exports = neq /***/ }), -/* 292 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const Range = __webpack_require__(986) -const validRange = (range, options) => { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*' - } catch (er) { - return null - } -} -module.exports = validRange - - -/***/ }), +/* 292 */, /* 293 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -61608,7 +61103,7 @@ function expand(str, isTop) { /* 308 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const eq = __webpack_require__(528) +const eq = __webpack_require__(541) const neq = __webpack_require__(291) const gt = __webpack_require__(738) const gte = __webpack_require__(790) @@ -63706,7 +63201,15 @@ function plural(ms, msAbs, n, name) { /***/ }), -/* 318 */, +/* 318 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const compare = __webpack_require__(386) +const lt = (a, b, loose) => compare(a, b, loose) < 0 +module.exports = lt + + +/***/ }), /* 319 */, /* 320 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -63791,161 +63294,12 @@ module.exports = { /* 321 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const Range = __webpack_require__(986) -const { ANY } = __webpack_require__(123) -const satisfies = __webpack_require__(121) -const compare = __webpack_require__(682) - -// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: -// - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...` -// -// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: -// - If c is only the ANY comparator -// - If C is only the ANY comparator, return true -// - Else return false -// - Let EQ be the set of = comparators in c -// - If EQ is more than one, return true (null set) -// - Let GT be the highest > or >= comparator in c -// - Let LT be the lowest < or <= comparator in c -// - If GT and LT, and GT.semver > LT.semver, return true (null set) -// - If EQ -// - If GT, and EQ does not satisfy GT, return true (null set) -// - If LT, and EQ does not satisfy LT, return true (null set) -// - If EQ satisfies every C, return true -// - Else return false -// - If GT -// - If GT is lower than any > or >= comp in C, return false -// - If GT is >=, and GT.semver does not satisfy every C, return false -// - If LT -// - If LT.semver is greater than that of any > comp in C, return false -// - If LT is <=, and LT.semver does not satisfy every C, return false -// - If any C is a = range, and GT or LT are set, return false -// - Else return true - -const subset = (sub, dom, options) => { - sub = new Range(sub, options) - dom = new Range(dom, options) - let sawNonNull = false - - OUTER: for (const simpleSub of sub.set) { - for (const simpleDom of dom.set) { - const isSub = simpleSubset(simpleSub, simpleDom, options) - sawNonNull = sawNonNull || isSub !== null - if (isSub) - continue OUTER - } - // the null set is a subset of everything, but null simple ranges in - // a complex range should be ignored. so if we saw a non-null range, - // then we know this isn't a subset, but if EVERY simple range was null, - // then it is a subset. - if (sawNonNull) - return false - } - return true -} - -const simpleSubset = (sub, dom, options) => { - if (sub.length === 1 && sub[0].semver === ANY) - return dom.length === 1 && dom[0].semver === ANY - - const eqSet = new Set() - let gt, lt - for (const c of sub) { - if (c.operator === '>' || c.operator === '>=') - gt = higherGT(gt, c, options) - else if (c.operator === '<' || c.operator === '<=') - lt = lowerLT(lt, c, options) - else - eqSet.add(c.semver) - } - - if (eqSet.size > 1) - return null - - let gtltComp - if (gt && lt) { - gtltComp = compare(gt.semver, lt.semver, options) - if (gtltComp > 0) - return null - else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) - return null - } - - // will iterate one or zero times - for (const eq of eqSet) { - if (gt && !satisfies(eq, String(gt), options)) - return null - - if (lt && !satisfies(eq, String(lt), options)) - return null - - for (const c of dom) { - if (!satisfies(eq, String(c), options)) - return false - } - return true - } - - let higher, lower - let hasDomLT, hasDomGT - for (const c of dom) { - hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' - hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' - if (gt) { - if (c.operator === '>' || c.operator === '>=') { - higher = higherGT(gt, c, options) - if (higher === c) - return false - } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) - return false - } - if (lt) { - if (c.operator === '<' || c.operator === '<=') { - lower = lowerLT(lt, c, options) - if (lower === c) - return false - } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) - return false - } - if (!c.operator && (lt || gt) && gtltComp !== 0) - return false - } - - // if there was a < or >, and nothing in the dom, then must be false - // UNLESS it was limited by another range in the other direction. - // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 - if (gt && hasDomLT && !lt && gtltComp !== 0) - return false - - if (lt && hasDomGT && !gt && gtltComp !== 0) - return false - - return true -} - -// >=1.2.3 is lower than >1.2.3 -const higherGT = (a, b, options) => { - if (!a) - return b - const comp = compare(a.semver, b.semver, options) - return comp > 0 ? a - : comp < 0 ? b - : b.operator === '>' && a.operator === '>=' ? b - : a -} - -// <=1.2.3 is higher than <1.2.3 -const lowerLT = (a, b, options) => { - if (!a) - return b - const comp = compare(a.semver, b.semver, options) - return comp < 0 ? a - : comp > 0 ? b - : b.operator === '<' && a.operator === '<=' ? b - : a +const parse = __webpack_require__(147) +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null } - -module.exports = subset +module.exports = valid /***/ }), @@ -64244,7 +63598,16 @@ module.exports.methods = getOperations() /***/ }), -/* 327 */, +/* 327 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const outside = __webpack_require__(97) +// Determine if version is less than all the versions possible in the range +const ltr = (version, range, options) => outside(version, range, '<', options) +module.exports = ltr + + +/***/ }), /* 328 */, /* 329 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -64257,8 +63620,8 @@ module.exports = __webpack_require__(413); /* 331 */ /***/ (function(module, exports, __webpack_require__) { -const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(749) -const debug = __webpack_require__(509) +const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(269) +const debug = __webpack_require__(467) exports = module.exports = {} // The actual regexps go on exports.re @@ -64443,43 +63806,65 @@ createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') /***/ }), /* 332 */ -/***/ (function(module) { +/***/ (function(module, __unusedexports, __webpack_require__) { -var scopePattern = /^(?:(@[^/]+)[/]+)([^/]+)[/]?/ -var basePattern = /^([^/]+)[/]?/ +const SemVer = __webpack_require__(734) +const parse = __webpack_require__(584) +const {re, t} = __webpack_require__(408) -module.exports = extract.bind(null, false) -module.exports.base = extract.bind(null, true) +const coerce = (version, options) => { + if (version instanceof SemVer) { + return version + } -function extract(isBase, str) { - if (/^@/.test(str)) { - var match = scopePattern.exec(str) - if (!match || !match[1] || !match[2]) - return null - if (isBase) - return match[2] || null + if (typeof version === 'number') { + version = String(version) + } - return [ match[1], match[2] ].join('/') + if (typeof version !== 'string') { + return null + } + + options = options || {} + + let match = null + if (!options.rtl) { + match = version.match(re[t.COERCE]) } else { - var match = basePattern.exec(str) - if (!match) - return null - return match[1] || null + // Find the right-most coercible string that does not share + // a terminus with a more left-ward coercible string. + // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' + // + // Walk through the string checking with a /g regexp + // Manually set the index so as to pick up overlapping matches. + // Stop when we get a match that ends at the string end, since no + // coercible string can be more right-ward without the same terminus. + let next + while ((next = re[t.COERCERTL].exec(version)) && + (!match || match.index + match[0].length !== version.length) + ) { + if (!match || + next.index + next[0].length !== match.index + match[0].length) { + match = next + } + re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length + } + // leave it in a clean state + re[t.COERCERTL].lastIndex = -1 } -} -/***/ }), -/* 333 */, -/* 334 */, -/* 335 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + if (match === null) + return null -const compare = __webpack_require__(682) -const neq = (a, b, loose) => compare(a, b, loose) !== 0 -module.exports = neq + return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) +} +module.exports = coerce /***/ }), +/* 333 */, +/* 334 */, +/* 335 */, /* 336 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -65207,7 +64592,17 @@ exports.default = crc1; /***/ }), -/* 340 */, +/* 340 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SemVer = __webpack_require__(243) +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare + + +/***/ }), /* 341 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -65225,11 +64620,40 @@ exports.isBigIntLiteral = isBigIntLiteral; /***/ }), /* 342 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(module) { -const compare = __webpack_require__(682) -const lt = (a, b, loose) => compare(a, b, loose) < 0 -module.exports = lt +// When the API is rate limiting, the request is retried later +const shouldRetry = function(response, index) { + return response.status === RATE_LIMIT_STATUS && index !== MAX_RETRY +} + +const waitForRetry = async function(response) { + const delay = getDelay(response) + await sleep(delay) +} + +const getDelay = function({ headers }) { + const rateLimitReset = headers.get(RATE_LIMIT_HEADER) + + if (!rateLimitReset) { + return DEFAULT_RETRY_DELAY + } + + return Math.max(Number(rateLimitReset) * SECS_TO_MSECS - Date.now(), MIN_RETRY_DELAY) +} + +const sleep = function(ms) { + return new Promise(resolve => setTimeout(resolve, ms)) +} + +const DEFAULT_RETRY_DELAY = 5e3 +const MIN_RETRY_DELAY = 1e3 +const SECS_TO_MSECS = 1e3 +const MAX_RETRY = 10 +const RATE_LIMIT_STATUS = 429 +const RATE_LIMIT_HEADER = 'X-RateLimit-Reset' + +module.exports = { shouldRetry, waitForRetry, MAX_RETRY } /***/ }), @@ -66857,15 +66281,7 @@ util.toDosTime = function(d) { /***/ }), /* 355 */, -/* 356 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -//# sourceMappingURL=ts-estree.js.map - -/***/ }), +/* 356 */, /* 357 */ /***/ (function(module) { @@ -67429,302 +66845,7 @@ module.exports = function atob(str) { /***/ }), -/* 369 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const debug = __webpack_require__(487) -const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(627) -const { re, t } = __webpack_require__(590) - -const { compareIdentifiers } = __webpack_require__(853) -class SemVer { - constructor (version, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - if (version instanceof SemVer) { - if (version.loose === !!options.loose && - version.includePrerelease === !!options.includePrerelease) { - return version - } else { - version = version.version - } - } else if (typeof version !== 'string') { - throw new TypeError(`Invalid Version: ${version}`) - } - - if (version.length > MAX_LENGTH) { - throw new TypeError( - `version is longer than ${MAX_LENGTH} characters` - ) - } - - debug('SemVer', version, options) - this.options = options - this.loose = !!options.loose - // this isn't actually relevant for versions, but keep it so that we - // don't run into trouble passing this.options around. - this.includePrerelease = !!options.includePrerelease - - const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) - - if (!m) { - throw new TypeError(`Invalid Version: ${version}`) - } - - this.raw = version - - // these are actually numbers - this.major = +m[1] - this.minor = +m[2] - this.patch = +m[3] - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) { - throw new TypeError('Invalid major version') - } - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { - throw new TypeError('Invalid minor version') - } - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { - throw new TypeError('Invalid patch version') - } - - // numberify any prerelease numeric ids - if (!m[4]) { - this.prerelease = [] - } else { - this.prerelease = m[4].split('.').map((id) => { - if (/^[0-9]+$/.test(id)) { - const num = +id - if (num >= 0 && num < MAX_SAFE_INTEGER) { - return num - } - } - return id - }) - } - - this.build = m[5] ? m[5].split('.') : [] - this.format() - } - - format () { - this.version = `${this.major}.${this.minor}.${this.patch}` - if (this.prerelease.length) { - this.version += `-${this.prerelease.join('.')}` - } - return this.version - } - - toString () { - return this.version - } - - compare (other) { - debug('SemVer.compare', this.version, this.options, other) - if (!(other instanceof SemVer)) { - if (typeof other === 'string' && other === this.version) { - return 0 - } - other = new SemVer(other, this.options) - } - - if (other.version === this.version) { - return 0 - } - - return this.compareMain(other) || this.comparePre(other) - } - - compareMain (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - return ( - compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch) - ) - } - - comparePre (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) { - return -1 - } else if (!this.prerelease.length && other.prerelease.length) { - return 1 - } else if (!this.prerelease.length && !other.prerelease.length) { - return 0 - } - - let i = 0 - do { - const a = this.prerelease[i] - const b = other.prerelease[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } - - compareBuild (other) { - if (!(other instanceof SemVer)) { - other = new SemVer(other, this.options) - } - - let i = 0 - do { - const a = this.build[i] - const b = other.build[i] - debug('prerelease compare', i, a, b) - if (a === undefined && b === undefined) { - return 0 - } else if (b === undefined) { - return 1 - } else if (a === undefined) { - return -1 - } else if (a === b) { - continue - } else { - return compareIdentifiers(a, b) - } - } while (++i) - } - - // preminor will bump the version up to the next minor release, and immediately - // down to pre-release. premajor and prepatch work the same way. - inc (release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0 - this.patch = 0 - this.minor = 0 - this.major++ - this.inc('pre', identifier) - break - case 'preminor': - this.prerelease.length = 0 - this.patch = 0 - this.minor++ - this.inc('pre', identifier) - break - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0 - this.inc('patch', identifier) - this.inc('pre', identifier) - break - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) { - this.inc('patch', identifier) - } - this.inc('pre', identifier) - break - - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if ( - this.minor !== 0 || - this.patch !== 0 || - this.prerelease.length === 0 - ) { - this.major++ - } - this.minor = 0 - this.patch = 0 - this.prerelease = [] - break - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) { - this.minor++ - } - this.patch = 0 - this.prerelease = [] - break - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) { - this.patch++ - } - this.prerelease = [] - break - // This probably shouldn't be used publicly. - // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) { - this.prerelease = [0] - } else { - let i = this.prerelease.length - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++ - i = -2 - } - } - if (i === -1) { - // didn't increment anything - this.prerelease.push(0) - } - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) { - this.prerelease = [identifier, 0] - } - } else { - this.prerelease = [identifier, 0] - } - } - break - - default: - throw new Error(`invalid increment argument: ${release}`) - } - this.format() - this.raw = this.version - return this - } -} - -module.exports = SemVer - - -/***/ }), +/* 369 */, /* 370 */ /***/ (function(module) { @@ -67743,38 +66864,34 @@ function deprecate (message) { /***/ }), -/* 371 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -var async = __webpack_require__(949); -async.core = __webpack_require__(222); -async.isCore = __webpack_require__(127); -async.sync = __webpack_require__(987); - -module.exports = async; - - -/***/ }), +/* 371 */, /* 372 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +const parse = __webpack_require__(147) +const eq = __webpack_require__(541) -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +const diff = (version1, version2) => { + if (eq(version1, version2)) { + return null + } else { + const v1 = parse(version1) + const v2 = parse(version2) + const hasPre = v1.prerelease.length || v2.prerelease.length + const prefix = hasPre ? 'pre' : '' + const defaultResult = hasPre ? 'prerelease' : '' + for (const key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return prefix + key + } + } + } + return defaultResult // may be undefined + } } -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)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const TSESTree = __importStar(__webpack_require__(356)); -exports.TSESTree = TSESTree; -__export(__webpack_require__(660)); -//# sourceMappingURL=index.js.map +module.exports = diff + /***/ }), /* 373 */, @@ -67845,7 +66962,7 @@ module.exports = exports.default; /* 375 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(570) +const compare = __webpack_require__(340) const lt = (a, b, loose) => compare(a, b, loose) < 0 module.exports = lt @@ -68047,7 +67164,64 @@ module.exports = function Type(x) { /* 381 */ /***/ (function(module, __unusedexports, __webpack_require__) { -module.exports = __webpack_require__(413); +"use strict"; + + +const pFinally = __webpack_require__(697); + +class TimeoutError extends Error { + constructor(message) { + super(message); + this.name = 'TimeoutError'; + } +} + +const pTimeout = (promise, milliseconds, fallback) => new Promise((resolve, reject) => { + if (typeof milliseconds !== 'number' || milliseconds < 0) { + throw new TypeError('Expected `milliseconds` to be a positive number'); + } + + if (milliseconds === Infinity) { + resolve(promise); + return; + } + + const timer = setTimeout(() => { + if (typeof fallback === 'function') { + try { + resolve(fallback()); + } catch (error) { + reject(error); + } + + return; + } + + const message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`; + const timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message); + + if (typeof promise.cancel === 'function') { + promise.cancel(); + } + + reject(timeoutError); + }, milliseconds); + + // TODO: Use native `finally` keyword when targeting Node.js 10 + pFinally( + // eslint-disable-next-line promise/prefer-await-to-then + promise.then(resolve, reject), + () => { + clearTimeout(timer); + } + ); +}); + +module.exports = pTimeout; +// TODO: Remove this for the next major release +module.exports.default = pTimeout; + +module.exports.TimeoutError = TimeoutError; /***/ }), @@ -69732,12 +68906,11 @@ exports.endpoint = endpoint; /* 386 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const parse = __webpack_require__(658) -const clean = (version, options) => { - const s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} -module.exports = clean +const SemVer = __webpack_require__(734) +const compare = (a, b, loose) => + new SemVer(a, loose).compare(new SemVer(b, loose)) + +module.exports = compare /***/ }), @@ -69906,7 +69079,7 @@ module.exports = SectionHeader; /* 393 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const camelCase = __webpack_require__(199) +const camelCase = __webpack_require__(931) const queryString = __webpack_require__(597) // Replace path parameters and query parameters in the URI, using the OpenAPI @@ -70083,7 +69256,33 @@ exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { /***/ }), -/* 396 */, +/* 396 */ +/***/ (function(module) { + +var scopePattern = /^(?:(@[^/]+)[/]+)([^/]+)[/]?/ +var basePattern = /^([^/]+)[/]?/ + +module.exports = extract.bind(null, false) +module.exports.base = extract.bind(null, true) + +function extract(isBase, str) { + if (/^@/.test(str)) { + var match = scopePattern.exec(str) + if (!match || !match[1] || !match[2]) + return null + if (isBase) + return match[2] || null + + return [ match[1], match[2] ].join('/') + } else { + var match = basePattern.exec(str) + if (!match) + return null + return match[1] || null + } +} + +/***/ }), /* 397 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -70102,79 +69301,285 @@ module.exports = validRange /***/ }), /* 398 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module, __unusedexports, __webpack_require__) { + +const Range = __webpack_require__(635) + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators + + +/***/ }), +/* 399 */, +/* 400 */, +/* 401 */ +/***/ (function(module, __unusedexports, __webpack_require__) { "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; + +var utils = __webpack_require__(139); + +var has = Object.prototype.hasOwnProperty; +var isArray = Array.isArray; + +var defaults = { + allowDots: false, + allowPrototypes: false, + arrayLimit: 20, + charset: 'utf-8', + charsetSentinel: false, + comma: false, + decoder: utils.decode, + delimiter: '&', + depth: 5, + ignoreQueryPrefix: false, + interpretNumericEntities: false, + parameterLimit: 1000, + parseArrays: true, + plainObjects: false, + strictNullHandling: false }; -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)) result[k] = mod[k]; - result["default"] = mod; - return result; + +var interpretNumericEntities = function (str) { + return str.replace(/&#(\d+);/g, function ($0, numberStr) { + return String.fromCharCode(parseInt(numberStr, 10)); + }); }; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug_1 = __importDefault(__webpack_require__(784)); -const ts = __importStar(__webpack_require__(752)); -const shared_1 = __webpack_require__(164); -const log = debug_1.default('typescript-eslint:typescript-estree:createIsolatedProgram'); -/** - * @param code The code of the file being linted - * @returns Returns a new source file and program corresponding to the linted code - */ -function createIsolatedProgram(code, extra) { - log('Getting isolated program in %s mode for: %s', extra.jsx ? 'TSX' : 'TS', extra.filePath); - const compilerHost = { - fileExists() { - return true; - }, - getCanonicalFileName() { - return extra.filePath; - }, - getCurrentDirectory() { - return ''; - }, - getDirectories() { - return []; - }, - getDefaultLibFileName() { - return 'lib.d.ts'; - }, - // TODO: Support Windows CRLF - getNewLine() { - return '\n'; - }, - getSourceFile(filename) { - return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, - /* setParentNodes */ true, shared_1.getScriptKind(extra, filename)); - }, - readFile() { - return undefined; - }, - useCaseSensitiveFileNames() { - return true; - }, - writeFile() { - return null; - }, + +var parseArrayValue = function (val, options) { + if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) { + return val.split(','); + } + + return val; +}; + +// This is what browsers will submit when the ✓ character occurs in an +// application/x-www-form-urlencoded body and the encoding of the page containing +// the form is iso-8859-1, or when the submitted form has an accept-charset +// attribute of iso-8859-1. Presumably also with other charsets that do not contain +// the ✓ character, such as us-ascii. +var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓') + +// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded. +var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓') + +var parseValues = function parseQueryStringValues(str, options) { + var obj = {}; + var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; + var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; + var parts = cleanStr.split(options.delimiter, limit); + var skipIndex = -1; // Keep track of where the utf8 sentinel was found + var i; + + var charset = options.charset; + if (options.charsetSentinel) { + for (i = 0; i < parts.length; ++i) { + if (parts[i].indexOf('utf8=') === 0) { + if (parts[i] === charsetSentinel) { + charset = 'utf-8'; + } else if (parts[i] === isoSentinel) { + charset = 'iso-8859-1'; + } + skipIndex = i; + i = parts.length; // The eslint settings do not allow break; + } + } + } + + for (i = 0; i < parts.length; ++i) { + if (i === skipIndex) { + continue; + } + var part = parts[i]; + + var bracketEqualsPos = part.indexOf(']='); + var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; + + var key, val; + if (pos === -1) { + key = options.decoder(part, defaults.decoder, charset, 'key'); + val = options.strictNullHandling ? null : ''; + } else { + key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); + val = utils.maybeMap( + parseArrayValue(part.slice(pos + 1), options), + function (encodedVal) { + return options.decoder(encodedVal, defaults.decoder, charset, 'value'); + } + ); + } + + if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { + val = interpretNumericEntities(val); + } + + if (part.indexOf('[]=') > -1) { + val = isArray(val) ? [val] : val; + } + + if (has.call(obj, key)) { + obj[key] = utils.combine(obj[key], val); + } else { + obj[key] = val; + } + } + + return obj; +}; + +var parseObject = function (chain, val, options, valuesParsed) { + var leaf = valuesParsed ? val : parseArrayValue(val, options); + + for (var i = chain.length - 1; i >= 0; --i) { + var obj; + var root = chain[i]; + + if (root === '[]' && options.parseArrays) { + obj = [].concat(leaf); + } else { + obj = options.plainObjects ? Object.create(null) : {}; + var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; + var index = parseInt(cleanRoot, 10); + if (!options.parseArrays && cleanRoot === '') { + obj = { 0: leaf }; + } else if ( + !isNaN(index) + && root !== cleanRoot + && String(index) === cleanRoot + && index >= 0 + && (options.parseArrays && index <= options.arrayLimit) + ) { + obj = []; + obj[index] = leaf; + } else { + obj[cleanRoot] = leaf; + } + } + + leaf = obj; // eslint-disable-line no-param-reassign + } + + return leaf; +}; + +var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) { + if (!givenKey) { + return; + } + + // Transform dot notation to bracket notation + var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; + + // The regex chunks + + var brackets = /(\[[^[\]]*])/; + var child = /(\[[^[\]]*])/g; + + // Get the parent + + var segment = options.depth > 0 && brackets.exec(key); + var parent = segment ? key.slice(0, segment.index) : key; + + // Stash the parent if it exists + + var keys = []; + if (parent) { + // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties + if (!options.plainObjects && has.call(Object.prototype, parent)) { + if (!options.allowPrototypes) { + return; + } + } + + keys.push(parent); + } + + // Loop through children appending to the array until we hit depth + + var i = 0; + while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) { + i += 1; + if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { + if (!options.allowPrototypes) { + return; + } + } + keys.push(segment[1]); + } + + // If there's a remainder, just add whatever is left + + if (segment) { + keys.push('[' + key.slice(segment.index) + ']'); + } + + return parseObject(keys, val, options, valuesParsed); +}; + +var normalizeParseOptions = function normalizeParseOptions(opts) { + if (!opts) { + return defaults; + } + + if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') { + throw new TypeError('Decoder has to be a function.'); + } + + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; + + return { + allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, + allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes, + arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit, + charset: charset, + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma, + decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder, + delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, + // eslint-disable-next-line no-implicit-coercion, no-extra-parens + depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth, + ignoreQueryPrefix: opts.ignoreQueryPrefix === true, + interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities, + parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit, + parseArrays: opts.parseArrays !== false, + plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects, + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling }; - const program = ts.createProgram([extra.filePath], Object.assign({ noResolve: true, target: ts.ScriptTarget.Latest, jsx: extra.jsx ? ts.JsxEmit.Preserve : undefined }, shared_1.createDefaultCompilerOptionsFromExtra(extra)), compilerHost); - const ast = program.getSourceFile(extra.filePath); - if (!ast) { - throw new Error('Expected an ast to be returned for the single-file isolated program.'); +}; + +module.exports = function (str, opts) { + var options = normalizeParseOptions(opts); + + if (str === '' || str === null || typeof str === 'undefined') { + return options.plainObjects ? Object.create(null) : {}; } - return { ast, program }; -} -exports.createIsolatedProgram = createIsolatedProgram; -//# sourceMappingURL=createIsolatedProgram.js.map + + var tempObj = typeof str === 'string' ? parseValues(str, options) : str; + var obj = options.plainObjects ? Object.create(null) : {}; + + // Iterate over the keys and setup the new object + + var keys = Object.keys(tempObj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string'); + obj = utils.merge(obj, newObj, options); + } + + return utils.compact(obj); +}; + /***/ }), -/* 399 */, -/* 400 */, -/* 401 */, /* 402 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -70245,7 +69650,60 @@ module.exports = { /***/ }), /* 405 */, -/* 406 */, +/* 406 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +// just pre-load all the stuff that index.js lazily exports +const internalRe = __webpack_require__(408) +module.exports = { + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: __webpack_require__(699).SEMVER_SPEC_VERSION, + SemVer: __webpack_require__(734), + compareIdentifiers: __webpack_require__(570).compareIdentifiers, + rcompareIdentifiers: __webpack_require__(570).rcompareIdentifiers, + parse: __webpack_require__(584), + valid: __webpack_require__(968), + clean: __webpack_require__(237), + inc: __webpack_require__(127), + diff: __webpack_require__(48), + major: __webpack_require__(771), + minor: __webpack_require__(871), + patch: __webpack_require__(623), + prerelease: __webpack_require__(124), + compare: __webpack_require__(386), + rcompare: __webpack_require__(205), + compareLoose: __webpack_require__(508), + compareBuild: __webpack_require__(783), + sort: __webpack_require__(829), + rsort: __webpack_require__(949), + gt: __webpack_require__(435), + lt: __webpack_require__(318), + eq: __webpack_require__(41), + neq: __webpack_require__(993), + gte: __webpack_require__(908), + lte: __webpack_require__(242), + cmp: __webpack_require__(447), + coerce: __webpack_require__(332), + Comparator: __webpack_require__(731), + Range: __webpack_require__(33), + satisfies: __webpack_require__(586), + toComparators: __webpack_require__(686), + maxSatisfying: __webpack_require__(701), + minSatisfying: __webpack_require__(878), + minVersion: __webpack_require__(449), + validRange: __webpack_require__(971), + outside: __webpack_require__(97), + gtr: __webpack_require__(607), + ltr: __webpack_require__(327), + intersects: __webpack_require__(997), + simplifyRange: __webpack_require__(85), + subset: __webpack_require__(986), +} + + +/***/ }), /* 407 */ /***/ (function(module) { @@ -70253,143 +69711,191 @@ module.exports = require("buffer"); /***/ }), /* 408 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module, exports, __webpack_require__) { -"use strict"; +const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(699) +const debug = __webpack_require__(547) +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 + +const createToken = (name, value, isGlobal) => { + const index = R++ + debug(index, value) + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCE', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') -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)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const eslintVisitorKeys = __importStar(__webpack_require__(78)); -exports.visitorKeys = eslintVisitorKeys.unionWith({ - // Additional estree nodes. - Import: [], - // Additional Properties. - ArrayPattern: ['decorators', 'elements', 'typeAnnotation'], - ArrowFunctionExpression: ['typeParameters', 'params', 'returnType', 'body'], - ClassDeclaration: [ - 'decorators', - 'id', - 'typeParameters', - 'superClass', - 'superTypeParameters', - 'implements', - 'body', - ], - ClassExpression: [ - 'decorators', - 'id', - 'typeParameters', - 'superClass', - 'superTypeParameters', - 'implements', - 'body', - ], - TaggedTemplateExpression: ['tag', 'typeParameters', 'quasi'], - FunctionDeclaration: ['id', 'typeParameters', 'params', 'returnType', 'body'], - FunctionExpression: ['id', 'typeParameters', 'params', 'returnType', 'body'], - Identifier: ['decorators', 'typeAnnotation'], - MethodDefinition: ['decorators', 'key', 'value'], - ObjectPattern: ['decorators', 'properties', 'typeAnnotation'], - RestElement: ['decorators', 'argument', 'typeAnnotation'], - NewExpression: ['callee', 'typeParameters', 'arguments'], - CallExpression: ['callee', 'typeParameters', 'arguments'], - // JSX - JSXOpeningElement: ['name', 'typeParameters', 'attributes'], - JSXClosingFragment: [], - JSXOpeningFragment: [], - JSXSpreadChild: ['expression'], - // Additional Nodes. - BigIntLiteral: [], - ClassProperty: ['decorators', 'key', 'typeAnnotation', 'value'], - Decorator: ['expression'], - OptionalCallExpression: ['callee', 'typeParameters', 'arguments'], - OptionalMemberExpression: eslintVisitorKeys.KEYS.MemberExpression, - TSAbstractClassProperty: ['decorators', 'key', 'typeAnnotation', 'value'], - TSAbstractKeyword: [], - TSAbstractMethodDefinition: ['key', 'value'], - TSAnyKeyword: [], - TSArrayType: ['elementType'], - TSAsExpression: ['expression', 'typeAnnotation'], - TSAsyncKeyword: [], - TSBigIntKeyword: [], - TSBooleanKeyword: [], - TSCallSignatureDeclaration: ['typeParameters', 'params', 'returnType'], - TSClassImplements: ['expression', 'typeParameters'], - TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'], - TSConstructSignatureDeclaration: ['typeParameters', 'params', 'returnType'], - TSConstructorType: ['typeParameters', 'params', 'returnType'], - TSDeclareFunction: ['id', 'typeParameters', 'params', 'returnType', 'body'], - TSDeclareKeyword: [], - TSEmptyBodyFunctionExpression: [ - 'id', - 'typeParameters', - 'params', - 'returnType', - ], - TSEnumDeclaration: ['id', 'members'], - TSEnumMember: ['id', 'initializer'], - TSExportAssignment: ['expression'], - TSExportKeyword: [], - TSExternalModuleReference: ['expression'], - TSImportType: ['parameter', 'qualifier', 'typeParameters'], - TSInferType: ['typeParameter'], - TSLiteralType: ['literal'], - TSIntersectionType: ['types'], - TSIndexedAccessType: ['indexType', 'objectType'], - TSIndexSignature: ['parameters', 'typeAnnotation'], - TSInterfaceBody: ['body'], - TSInterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'], - TSInterfaceHeritage: ['expression', 'typeParameters'], - TSImportEqualsDeclaration: ['id', 'moduleReference'], - TSFunctionType: ['typeParameters', 'params', 'returnType'], - TSMappedType: ['typeParameter', 'typeAnnotation'], - TSMethodSignature: ['typeParameters', 'key', 'params', 'returnType'], - TSModuleBlock: ['body'], - TSModuleDeclaration: ['id', 'body'], - TSNamespaceExportDeclaration: ['id'], - TSNonNullExpression: ['expression'], - TSNeverKeyword: [], - TSNullKeyword: [], - TSNumberKeyword: [], - TSObjectKeyword: [], - TSOptionalType: ['typeAnnotation'], - TSParameterProperty: ['decorators', 'parameter'], - TSParenthesizedType: ['typeAnnotation'], - TSPrivateKeyword: [], - TSPropertySignature: ['typeAnnotation', 'key', 'initializer'], - TSProtectedKeyword: [], - TSPublicKeyword: [], - TSQualifiedName: ['left', 'right'], - TSReadonlyKeyword: [], - TSRestType: ['typeAnnotation'], - TSStaticKeyword: [], - TSStringKeyword: [], - TSSymbolKeyword: [], - TSThisType: [], - TSTupleType: ['elementTypes'], - TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'], - TSTypeAnnotation: ['typeAnnotation'], - TSTypeAssertion: ['typeAnnotation', 'expression'], - TSTypeLiteral: ['members'], - TSTypeOperator: ['typeAnnotation'], - TSTypeParameter: ['name', 'constraint', 'default'], - TSTypeParameterDeclaration: ['params'], - TSTypeParameterInstantiation: ['params'], - TSTypePredicate: ['typeAnnotation', 'parameterName'], - TSTypeReference: ['typeName', 'typeParameters'], - TSTypeQuery: ['exprName'], - TSUnionType: ['types'], - TSUndefinedKeyword: [], - TSUnknownKeyword: [], - TSVoidKeyword: [], -}); -//# sourceMappingURL=visitor-keys.js.map /***/ }), /* 409 */ @@ -70603,7 +70109,15 @@ module.exports = { parseResponse, getFetchError } module.exports = require("crypto"); /***/ }), -/* 418 */, +/* 418 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const compare = __webpack_require__(340) +const rcompare = (a, b, loose) => compare(b, a, loose) +module.exports = rcompare + + +/***/ }), /* 419 */, /* 420 */, /* 421 */ @@ -70635,7 +70149,7 @@ function isSeparator(str, i) { "use strict"; -const Parser = __webpack_require__(642); +const Parser = __webpack_require__(627); const Walker = __webpack_require__(80); const types = __webpack_require__(885); @@ -70754,7 +70268,7 @@ const { getOperations } = __webpack_require__(759) const { addBody } = __webpack_require__(409) const { parseResponse, getFetchError } = __webpack_require__(415) -const { shouldRetry, waitForRetry, MAX_RETRY } = __webpack_require__(708) +const { shouldRetry, waitForRetry, MAX_RETRY } = __webpack_require__(342) const { getUrl } = __webpack_require__(393) // For each OpenAPI operation, add a corresponding method. @@ -71542,12 +71056,9 @@ module.exports = function () { /* 435 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const parse = __webpack_require__(147) -const clean = (version, options) => { - const s = parse(version.trim().replace(/^[=v]+/, ''), options) - return s ? s.version : null -} -module.exports = clean +const compare = __webpack_require__(386) +const gt = (a, b, loose) => compare(a, b, loose) > 0 +module.exports = gt /***/ }), @@ -72404,7 +71915,60 @@ module.exports = ELFHeader; /***/ }), -/* 447 */, +/* 447 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const eq = __webpack_require__(41) +const neq = __webpack_require__(993) +const gt = __webpack_require__(435) +const gte = __webpack_require__(908) +const lt = __webpack_require__(318) +const lte = __webpack_require__(242) + +const cmp = (a, op, b, loose) => { + switch (op) { + case '===': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a === b + + case '!==': + if (typeof a === 'object') + a = a.version + if (typeof b === 'object') + b = b.version + return a !== b + + case '': + case '=': + case '==': + return eq(a, b, loose) + + case '!=': + return neq(a, b, loose) + + case '>': + return gt(a, b, loose) + + case '>=': + return gte(a, b, loose) + + case '<': + return lt(a, b, loose) + + case '<=': + return lte(a, b, loose) + + default: + throw new TypeError(`Invalid operator: ${op}`) + } +} +module.exports = cmp + + +/***/ }), /* 448 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -72413,7 +71977,7 @@ module.exports = ELFHeader; var Backoff = __webpack_require__(650); var ExponentialBackoffStrategy = __webpack_require__(646); -var FibonacciBackoffStrategy = __webpack_require__(33); +var FibonacciBackoffStrategy = __webpack_require__(750); var FunctionCall = __webpack_require__(152); module.exports.Backoff = Backoff; @@ -72442,7 +72006,69 @@ module.exports.call = function(fn, vargs, callback) { /***/ }), -/* 449 */, +/* 449 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SemVer = __webpack_require__(734) +const Range = __webpack_require__(33) +const gt = __webpack_require__(435) + +const minVersion = (range, loose) => { + range = new Range(range, loose) + + let minver = new SemVer('0.0.0') + if (range.test(minver)) { + return minver + } + + minver = new SemVer('0.0.0-0') + if (range.test(minver)) { + return minver + } + + minver = null + for (let i = 0; i < range.set.length; ++i) { + const comparators = range.set[i] + + comparators.forEach((comparator) => { + // Clone to avoid manipulating the comparator's semver object. + const compver = new SemVer(comparator.semver.version) + switch (comparator.operator) { + case '>': + if (compver.prerelease.length === 0) { + compver.patch++ + } else { + compver.prerelease.push(0) + } + compver.raw = compver.format() + /* fallthrough */ + case '': + case '>=': + if (!minver || gt(minver, compver)) { + minver = compver + } + break + case '<': + case '<=': + /* Ignore maximum versions */ + break + /* istanbul ignore next */ + default: + throw new Error(`Unexpected operation: ${comparator.operator}`) + } + }) + } + + if (minver && range.test(minver)) { + return minver + } + + return null +} +module.exports = minVersion + + +/***/ }), /* 450 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -72454,7 +72080,22 @@ module.exports.call = function(fn, vargs, callback) { module.exports = __webpack_require__(544); /***/ }), -/* 451 */, +/* 451 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = __webpack_require__(259); +tslib_1.__exportStar(__webpack_require__(581), exports); +const ts = __webpack_require__(752); +function isImportTypeNode(node) { + return node.kind === ts.SyntaxKind.ImportType; +} +exports.isImportTypeNode = isImportTypeNode; + + +/***/ }), /* 452 */, /* 453 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -74246,7 +73887,7 @@ var EElistenerCount = function (emitter, type) { /**/ /**/ -var Stream = __webpack_require__(381); +var Stream = __webpack_require__(191); /**/ /**/ @@ -75357,7 +74998,7 @@ module.exports = Comparator const {re, t} = __webpack_require__(331) const cmp = __webpack_require__(308) -const debug = __webpack_require__(509) +const debug = __webpack_require__(467) const SemVer = __webpack_require__(243) const Range = __webpack_require__(635) @@ -75687,11 +75328,17 @@ function legacy (fs) { /***/ }), /* 467 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(module) { -const compare = __webpack_require__(682) -const compareLoose = (a, b) => compare(a, b, true) -module.exports = compareLoose +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug /***/ }), @@ -77193,15 +76840,7 @@ exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { /***/ }), /* 475 */, -/* 476 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SemVer = __webpack_require__(369) -const major = (a, loose) => new SemVer(a, loose).major -module.exports = major - - -/***/ }), +/* 476 */, /* 477 */, /* 478 */, /* 479 */, @@ -77926,21 +77565,7 @@ module.exports = setup; /***/ }), -/* 487 */ -/***/ (function(module) { - -const debug = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {} - -module.exports = debug - - -/***/ }), +/* 487 */, /* 488 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -78095,15 +77720,7 @@ module.exports = global[ID]; /***/ }), /* 494 */, -/* 495 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const compare = __webpack_require__(682) -const lte = (a, b, loose) => compare(a, b, loose) <= 0 -module.exports = lte - - -/***/ }), +/* 495 */, /* 496 */, /* 497 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -78246,84 +77863,15 @@ module.exports = { /***/ }), /* 499 */, /* 500 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +var async = __webpack_require__(275); +async.core = __webpack_require__(222); +async.isCore = __webpack_require__(528); +async.sync = __webpack_require__(987); + +module.exports = async; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug_1 = __importDefault(__webpack_require__(784)); -const path_1 = __importDefault(__webpack_require__(622)); -const createWatchProgram_1 = __webpack_require__(547); -const node_utils_1 = __webpack_require__(277); -const log = debug_1.default('typescript-eslint:typescript-estree:createProjectProgram'); -const DEFAULT_EXTRA_FILE_EXTENSIONS = ['.ts', '.tsx', '.js', '.jsx']; -function getExtension(fileName) { - if (!fileName) { - return null; - } - return fileName.endsWith('.d.ts') ? '.d.ts' : path_1.default.extname(fileName); -} -/** - * @param code The code of the file being linted - * @param createDefaultProgram True if the default program should be created - * @param extra The config object - * @returns If found, returns the source file corresponding to the code and the containing program - */ -function createProjectProgram(code, createDefaultProgram, extra) { - log('Creating project program for: %s', extra.filePath); - const astAndProgram = node_utils_1.firstDefined(createWatchProgram_1.getProgramsForProjects(code, extra.filePath, extra), currentProgram => { - const ast = currentProgram.getSourceFile(extra.filePath); - // working around https://github.com/typescript-eslint/typescript-eslint/issues/1573 - const expectedExt = getExtension(extra.filePath); - const returnedExt = getExtension(ast === null || ast === void 0 ? void 0 : ast.fileName); - if (expectedExt !== returnedExt) { - return; - } - return ast && { ast, program: currentProgram }; - }); - if (!astAndProgram && !createDefaultProgram) { - // the file was either not matched within the tsconfig, or the extension wasn't expected - const errorLines = [ - '"parserOptions.project" has been set for @typescript-eslint/parser.', - `The file does not match your project config: ${path_1.default.relative(extra.tsconfigRootDir || process.cwd(), extra.filePath)}.`, - ]; - let hasMatchedAnError = false; - const extraFileExtensions = extra.extraFileExtensions || []; - extraFileExtensions.forEach(extraExtension => { - if (!extraExtension.startsWith('.')) { - errorLines.push(`Found unexpected extension "${extraExtension}" specified with the "extraFileExtensions" option. Did you mean ".${extraExtension}"?`); - } - if (DEFAULT_EXTRA_FILE_EXTENSIONS.includes(extraExtension)) { - errorLines.push(`You unnecessarily included the extension "${extraExtension}" with the "extraFileExtensions" option. This extension is already handled by the parser by default.`); - } - }); - const fileExtension = path_1.default.extname(extra.filePath); - if (!DEFAULT_EXTRA_FILE_EXTENSIONS.includes(fileExtension)) { - const nonStandardExt = `The extension for the file (${fileExtension}) is non-standard`; - if (extraFileExtensions.length > 0) { - if (!extraFileExtensions.includes(fileExtension)) { - errorLines.push(`${nonStandardExt}. It should be added to your existing "parserOptions.extraFileExtensions".`); - hasMatchedAnError = true; - } - } - else { - errorLines.push(`${nonStandardExt}. You should add "parserOptions.extraFileExtensions" to your config.`); - hasMatchedAnError = true; - } - } - if (!hasMatchedAnError) { - errorLines.push('The file must be included in at least one of the projects provided.'); - hasMatchedAnError = true; - } - throw new Error(errorLines.join('\n')); - } - return astAndProgram; -} -exports.createProjectProgram = createProjectProgram; -//# sourceMappingURL=createProjectProgram.js.map /***/ }), /* 501 */ @@ -78412,7 +77960,7 @@ module.exports = bufferFrom const path = __webpack_require__(622); const fs = __webpack_require__(747); const {promisify} = __webpack_require__(669); -const pLocate = __webpack_require__(908); +const pLocate = __webpack_require__(225); const fsStat = promisify(fs.stat); const fsLStat = promisify(fs.lstat); @@ -78725,22 +78273,16 @@ module.exports.default = module.exports; // For TypeScript /***/ }), -/* 508 */, -/* 509 */ -/***/ (function(module) { - -const debug = ( - typeof process === 'object' && - process.env && - process.env.NODE_DEBUG && - /\bsemver\b/i.test(process.env.NODE_DEBUG) -) ? (...args) => console.error('SEMVER', ...args) - : () => {} +/* 508 */ +/***/ (function(module, __unusedexports, __webpack_require__) { -module.exports = debug +const compare = __webpack_require__(386) +const compareLoose = (a, b) => compare(a, b, true) +module.exports = compareLoose /***/ }), +/* 509 */, /* 510 */ /***/ (function(module) { @@ -78900,39 +78442,13 @@ module.exports = (object, predicate) => { /***/ }), /* 513 */ -/***/ (function(module) { - -const numeric = /^[0-9]+$/ -const compareIdentifiers = (a, b) => { - const anum = numeric.test(a) - const bnum = numeric.test(b) - - if (anum && bnum) { - a = +a - b = +b - } - - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} - -const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) - -module.exports = { - compareIdentifiers, - rcompareIdentifiers -} - - -/***/ }), -/* 514 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; @@ -78941,2170 +78457,618 @@ var __importStar = (this && this.__importStar) || function (mod) { return result; }; Object.defineProperty(exports, "__esModule", { value: true }); -// There's lots of funny stuff due to the typing of ts.Node -/* eslint-disable @typescript-eslint/no-explicit-any */ +const unescape_1 = __importDefault(__webpack_require__(821)); const ts = __importStar(__webpack_require__(752)); -const node_utils_1 = __webpack_require__(277); -const ts_estree_1 = __webpack_require__(372); +const ts_estree_1 = __webpack_require__(64); const SyntaxKind = ts.SyntaxKind; +const ASSIGNMENT_OPERATORS = [ + SyntaxKind.EqualsToken, + SyntaxKind.PlusEqualsToken, + SyntaxKind.MinusEqualsToken, + SyntaxKind.AsteriskEqualsToken, + SyntaxKind.AsteriskAsteriskEqualsToken, + SyntaxKind.SlashEqualsToken, + SyntaxKind.PercentEqualsToken, + SyntaxKind.LessThanLessThanEqualsToken, + SyntaxKind.GreaterThanGreaterThanEqualsToken, + SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken, + SyntaxKind.AmpersandEqualsToken, + SyntaxKind.BarEqualsToken, + SyntaxKind.CaretEqualsToken, +]; +const LOGICAL_OPERATORS = [ + SyntaxKind.BarBarToken, + SyntaxKind.AmpersandAmpersandToken, + SyntaxKind.QuestionQuestionToken, +]; +const TOKEN_TO_TEXT = { + [SyntaxKind.OpenBraceToken]: '{', + [SyntaxKind.CloseBraceToken]: '}', + [SyntaxKind.OpenParenToken]: '(', + [SyntaxKind.CloseParenToken]: ')', + [SyntaxKind.OpenBracketToken]: '[', + [SyntaxKind.CloseBracketToken]: ']', + [SyntaxKind.DotToken]: '.', + [SyntaxKind.DotDotDotToken]: '...', + [SyntaxKind.SemicolonToken]: ';', + [SyntaxKind.CommaToken]: ',', + [SyntaxKind.LessThanToken]: '<', + [SyntaxKind.GreaterThanToken]: '>', + [SyntaxKind.LessThanEqualsToken]: '<=', + [SyntaxKind.GreaterThanEqualsToken]: '>=', + [SyntaxKind.EqualsEqualsToken]: '==', + [SyntaxKind.ExclamationEqualsToken]: '!=', + [SyntaxKind.EqualsEqualsEqualsToken]: '===', + [SyntaxKind.InstanceOfKeyword]: 'instanceof', + [SyntaxKind.ExclamationEqualsEqualsToken]: '!==', + [SyntaxKind.EqualsGreaterThanToken]: '=>', + [SyntaxKind.PlusToken]: '+', + [SyntaxKind.MinusToken]: '-', + [SyntaxKind.AsteriskToken]: '*', + [SyntaxKind.AsteriskAsteriskToken]: '**', + [SyntaxKind.SlashToken]: '/', + [SyntaxKind.PercentToken]: '%', + [SyntaxKind.PlusPlusToken]: '++', + [SyntaxKind.MinusMinusToken]: '--', + [SyntaxKind.LessThanLessThanToken]: '<<', + [SyntaxKind.LessThanSlashToken]: '>', + [SyntaxKind.GreaterThanGreaterThanGreaterThanToken]: '>>>', + [SyntaxKind.AmpersandToken]: '&', + [SyntaxKind.BarToken]: '|', + [SyntaxKind.CaretToken]: '^', + [SyntaxKind.ExclamationToken]: '!', + [SyntaxKind.TildeToken]: '~', + [SyntaxKind.AmpersandAmpersandToken]: '&&', + [SyntaxKind.BarBarToken]: '||', + [SyntaxKind.QuestionToken]: '?', + [SyntaxKind.ColonToken]: ':', + [SyntaxKind.EqualsToken]: '=', + [SyntaxKind.PlusEqualsToken]: '+=', + [SyntaxKind.MinusEqualsToken]: '-=', + [SyntaxKind.AsteriskEqualsToken]: '*=', + [SyntaxKind.AsteriskAsteriskEqualsToken]: '**=', + [SyntaxKind.SlashEqualsToken]: '/=', + [SyntaxKind.PercentEqualsToken]: '%=', + [SyntaxKind.LessThanLessThanEqualsToken]: '<<=', + [SyntaxKind.GreaterThanGreaterThanEqualsToken]: '>>=', + [SyntaxKind.GreaterThanGreaterThanGreaterThanEqualsToken]: '>>>=', + [SyntaxKind.AmpersandEqualsToken]: '&=', + [SyntaxKind.BarEqualsToken]: '|=', + [SyntaxKind.CaretEqualsToken]: '^=', + [SyntaxKind.AtToken]: '@', + [SyntaxKind.InKeyword]: 'in', + [SyntaxKind.UniqueKeyword]: 'unique', + [SyntaxKind.KeyOfKeyword]: 'keyof', + [SyntaxKind.NewKeyword]: 'new', + [SyntaxKind.ImportKeyword]: 'import', + [SyntaxKind.ReadonlyKeyword]: 'readonly', + [SyntaxKind.QuestionQuestionToken]: '??', + [SyntaxKind.QuestionDotToken]: '?.', +}; /** - * Extends and formats a given error object - * @param error the error object - * @returns converted error object + * Returns true if the given ts.Token is the assignment operator + * @param operator the operator token + * @returns is assignment */ -function convertError(error) { - return node_utils_1.createError(error.file, error.start, error.message || error.messageText); +function isAssignmentOperator(operator) { + return ASSIGNMENT_OPERATORS.includes(operator.kind); } -exports.convertError = convertError; -class Converter { - /** - * Converts a TypeScript node into an ESTree node - * @param ast the full TypeScript AST - * @param options additional options for the conversion - * @returns the converted ESTreeNode - */ - constructor(ast, options) { - this.esTreeNodeToTSNodeMap = new WeakMap(); - this.tsNodeToESTreeNodeMap = new WeakMap(); - this.allowPattern = false; - this.inTypeMode = false; - this.ast = ast; - this.options = Object.assign({}, options); +exports.isAssignmentOperator = isAssignmentOperator; +/** + * Returns true if the given ts.Token is a logical operator + * @param operator the operator token + * @returns is a logical operator + */ +function isLogicalOperator(operator) { + return LOGICAL_OPERATORS.includes(operator.kind); +} +exports.isLogicalOperator = isLogicalOperator; +/** + * Returns the string form of the given TSToken SyntaxKind + * @param kind the token's SyntaxKind + * @returns the token applicable token as a string + */ +function getTextForTokenKind(kind) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return kind in TOKEN_TO_TEXT ? TOKEN_TO_TEXT[kind] : undefined; +} +exports.getTextForTokenKind = getTextForTokenKind; +/** + * Returns true if the given ts.Node is a valid ESTree class member + * @param node TypeScript AST node + * @returns is valid ESTree class member + */ +function isESTreeClassMember(node) { + return node.kind !== SyntaxKind.SemicolonClassElement; +} +exports.isESTreeClassMember = isESTreeClassMember; +/** + * Checks if a ts.Node has a modifier + * @param modifierKind TypeScript SyntaxKind modifier + * @param node TypeScript AST node + * @returns has the modifier specified + */ +function hasModifier(modifierKind, node) { + return (!!node.modifiers && + !!node.modifiers.length && + node.modifiers.some(modifier => modifier.kind === modifierKind)); +} +exports.hasModifier = hasModifier; +/** + * Get last last modifier in ast + * @param node TypeScript AST node + * @returns returns last modifier if present or null + */ +function getLastModifier(node) { + return ((!!node.modifiers && + !!node.modifiers.length && + node.modifiers[node.modifiers.length - 1]) || + null); +} +exports.getLastModifier = getLastModifier; +/** + * Returns true if the given ts.Token is a comma + * @param token the TypeScript token + * @returns is comma + */ +function isComma(token) { + return token.kind === SyntaxKind.CommaToken; +} +exports.isComma = isComma; +/** + * Returns true if the given ts.Node is a comment + * @param node the TypeScript node + * @returns is comment + */ +function isComment(node) { + return (node.kind === SyntaxKind.SingleLineCommentTrivia || + node.kind === SyntaxKind.MultiLineCommentTrivia); +} +exports.isComment = isComment; +/** + * Returns true if the given ts.Node is a JSDoc comment + * @param node the TypeScript node + * @returns is JSDoc comment + */ +function isJSDocComment(node) { + return node.kind === SyntaxKind.JSDocComment; +} +exports.isJSDocComment = isJSDocComment; +/** + * Returns the binary expression type of the given ts.Token + * @param operator the operator token + * @returns the binary expression type + */ +function getBinaryExpressionType(operator) { + if (isAssignmentOperator(operator)) { + return ts_estree_1.AST_NODE_TYPES.AssignmentExpression; } - getASTMaps() { - return { - esTreeNodeToTSNodeMap: this.esTreeNodeToTSNodeMap, - tsNodeToESTreeNodeMap: this.tsNodeToESTreeNodeMap, - }; + else if (isLogicalOperator(operator)) { + return ts_estree_1.AST_NODE_TYPES.LogicalExpression; } - convertProgram() { - return this.converter(this.ast); + return ts_estree_1.AST_NODE_TYPES.BinaryExpression; +} +exports.getBinaryExpressionType = getBinaryExpressionType; +/** + * Returns line and column data for the given positions, + * @param pos position to check + * @param ast the AST object + * @returns line and column + */ +function getLineAndCharacterFor(pos, ast) { + const loc = ast.getLineAndCharacterOfPosition(pos); + return { + line: loc.line + 1, + column: loc.character, + }; +} +exports.getLineAndCharacterFor = getLineAndCharacterFor; +/** + * Returns line and column data for the given start and end positions, + * for the given AST + * @param start start data + * @param end end data + * @param ast the AST object + * @returns the loc data + */ +function getLocFor(start, end, ast) { + return { + start: getLineAndCharacterFor(start, ast), + end: getLineAndCharacterFor(end, ast), + }; +} +exports.getLocFor = getLocFor; +/** + * Check whatever node can contain directive + * @param node + * @returns returns true if node can contain directive + */ +function canContainDirective(node) { + if (node.kind === ts.SyntaxKind.Block) { + switch (node.parent.kind) { + case ts.SyntaxKind.Constructor: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.MethodDeclaration: + return true; + default: + return false; + } } - /** - * Converts a TypeScript node into an ESTree node. - * @param node the child ts.Node - * @param parent parentNode - * @param inTypeMode flag to determine if we are in typeMode - * @param allowPattern flag to determine if patterns are allowed - * @returns the converted ESTree node - */ - converter(node, parent, inTypeMode, allowPattern) { - /** - * Exit early for null and undefined - */ - if (!node) { - return null; + return true; +} +exports.canContainDirective = canContainDirective; +/** + * Returns range for the given ts.Node + * @param node the ts.Node or ts.Token + * @param ast the AST object + * @returns the range data + */ +function getRange(node, ast) { + return [node.getStart(ast), node.getEnd()]; +} +exports.getRange = getRange; +/** + * Returns true if a given ts.Node is a token + * @param node the ts.Node + * @returns is a token + */ +function isToken(node) { + return (node.kind >= SyntaxKind.FirstToken && node.kind <= SyntaxKind.LastToken); +} +exports.isToken = isToken; +/** + * Returns true if a given ts.Node is a JSX token + * @param node ts.Node to be checked + * @returns is a JSX token + */ +function isJSXToken(node) { + return (node.kind >= SyntaxKind.JsxElement && node.kind <= SyntaxKind.JsxAttribute); +} +exports.isJSXToken = isJSXToken; +/** + * Returns the declaration kind of the given ts.Node + * @param node TypeScript AST node + * @returns declaration kind + */ +function getDeclarationKind(node) { + if (node.flags & ts.NodeFlags.Let) { + return 'let'; + } + if (node.flags & ts.NodeFlags.Const) { + return 'const'; + } + return 'var'; +} +exports.getDeclarationKind = getDeclarationKind; +/** + * Gets a ts.Node's accessibility level + * @param node The ts.Node + * @returns accessibility "public", "protected", "private", or null + */ +function getTSNodeAccessibility(node) { + const modifiers = node.modifiers; + if (!modifiers) { + return null; + } + for (let i = 0; i < modifiers.length; i++) { + const modifier = modifiers[i]; + switch (modifier.kind) { + case SyntaxKind.PublicKeyword: + return 'public'; + case SyntaxKind.ProtectedKeyword: + return 'protected'; + case SyntaxKind.PrivateKeyword: + return 'private'; + default: + break; } - const typeMode = this.inTypeMode; - const pattern = this.allowPattern; - if (inTypeMode !== undefined) { - this.inTypeMode = inTypeMode; + } + return null; +} +exports.getTSNodeAccessibility = getTSNodeAccessibility; +/** + * Finds the next token based on the previous one and its parent + * Had to copy this from TS instead of using TS's version because theirs doesn't pass the ast to getChildren + * @param previousToken The previous TSToken + * @param parent The parent TSNode + * @param ast The TS AST + * @returns the next TSToken + */ +function findNextToken(previousToken, parent, ast) { + return find(parent); + function find(n) { + if (ts.isToken(n) && n.pos === previousToken.end) { + // this is token that starts at the end of previous token - return it + return n; } - if (allowPattern !== undefined) { - this.allowPattern = allowPattern; + return firstDefined(n.getChildren(ast), (child) => { + const shouldDiveInChildNode = + // previous token is enclosed somewhere in the child + (child.pos <= previousToken.pos && child.end > previousToken.end) || + // previous token ends exactly at the beginning of child + child.pos === previousToken.end; + return shouldDiveInChildNode && nodeHasTokens(child, ast) + ? find(child) + : undefined; + }); + } +} +exports.findNextToken = findNextToken; +/** + * Find the first matching ancestor based on the given predicate function. + * @param node The current ts.Node + * @param predicate The predicate function to apply to each checked ancestor + * @returns a matching parent ts.Node + */ +function findFirstMatchingAncestor(node, predicate) { + while (node) { + if (predicate(node)) { + return node; } - const result = this.convertNode(node, (parent !== null && parent !== void 0 ? parent : node.parent)); - this.registerTSNodeInNodeMap(node, result); - this.inTypeMode = typeMode; - this.allowPattern = pattern; - return result; + node = node.parent; } - /** - * Fixes the exports of the given ts.Node - * @param node the ts.Node - * @param result result - * @returns the ESTreeNode with fixed exports - */ - fixExports(node, result) { - // check for exports - if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { - /** - * Make sure that original node is registered instead of export - */ - this.registerTSNodeInNodeMap(node, result); - const exportKeyword = node.modifiers[0]; - const nextModifier = node.modifiers[1]; - const declarationIsDefault = nextModifier && nextModifier.kind === SyntaxKind.DefaultKeyword; - const varToken = declarationIsDefault - ? node_utils_1.findNextToken(nextModifier, this.ast, this.ast) - : node_utils_1.findNextToken(exportKeyword, this.ast, this.ast); - result.range[0] = varToken.getStart(this.ast); - result.loc = node_utils_1.getLocFor(result.range[0], result.range[1], this.ast); - if (declarationIsDefault) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ExportDefaultDeclaration, - declaration: result, - range: [exportKeyword.getStart(this.ast), result.range[1]], - exportKind: 'value', - }); - } - else { - const isType = result.type === ts_estree_1.AST_NODE_TYPES.TSInterfaceDeclaration || - result.type === ts_estree_1.AST_NODE_TYPES.TSTypeAliasDeclaration; - const isDeclare = result.declare === true; - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ExportNamedDeclaration, - declaration: result, - specifiers: [], - source: null, - exportKind: isType || isDeclare ? 'type' : 'value', - range: [exportKeyword.getStart(this.ast), result.range[1]], - }); - } + return undefined; +} +exports.findFirstMatchingAncestor = findFirstMatchingAncestor; +/** + * Returns true if a given ts.Node has a JSX token within its hierarchy + * @param node ts.Node to be checked + * @returns has JSX ancestor + */ +function hasJSXAncestor(node) { + return !!findFirstMatchingAncestor(node, isJSXToken); +} +exports.hasJSXAncestor = hasJSXAncestor; +/** + * Unescape the text content of string literals, e.g. & -> & + * @param text The escaped string literal text. + * @returns The unescaped string literal text. + */ +function unescapeStringLiteralText(text) { + return unescape_1.default(text); +} +exports.unescapeStringLiteralText = unescapeStringLiteralText; +/** + * Returns true if a given ts.Node is a computed property + * @param node ts.Node to be checked + * @returns is Computed Property + */ +function isComputedProperty(node) { + return node.kind === SyntaxKind.ComputedPropertyName; +} +exports.isComputedProperty = isComputedProperty; +/** + * Returns true if a given ts.Node is optional (has QuestionToken) + * @param node ts.Node to be checked + * @returns is Optional + */ +function isOptional(node) { + return node.questionToken + ? node.questionToken.kind === SyntaxKind.QuestionToken + : false; +} +exports.isOptional = isOptional; +/** + * Returns the type of a given ts.Token + * @param token the ts.Token + * @returns the token type + */ +function getTokenType(token) { + if ('originalKeywordKind' in token && token.originalKeywordKind) { + if (token.originalKeywordKind === SyntaxKind.NullKeyword) { + return ts_estree_1.AST_TOKEN_TYPES.Null; } - return result; + else if (token.originalKeywordKind >= SyntaxKind.FirstFutureReservedWord && + token.originalKeywordKind <= SyntaxKind.LastKeyword) { + return ts_estree_1.AST_TOKEN_TYPES.Identifier; + } + return ts_estree_1.AST_TOKEN_TYPES.Keyword; } - /** - * Register specific TypeScript node into map with first ESTree node provided - */ - registerTSNodeInNodeMap(node, result) { - if (result && this.options.shouldPreserveNodeMaps) { - if (!this.tsNodeToESTreeNodeMap.has(node)) { - this.tsNodeToESTreeNodeMap.set(node, result); - } + if (token.kind >= SyntaxKind.FirstKeyword && + token.kind <= SyntaxKind.LastFutureReservedWord) { + if (token.kind === SyntaxKind.FalseKeyword || + token.kind === SyntaxKind.TrueKeyword) { + return ts_estree_1.AST_TOKEN_TYPES.Boolean; } + return ts_estree_1.AST_TOKEN_TYPES.Keyword; } - /** - * Converts a TypeScript node into an ESTree node. - * @param child the child ts.Node - * @param parent parentNode - * @returns the converted ESTree node - */ - convertPattern(child, parent) { - return this.converter(child, parent, this.inTypeMode, true); + if (token.kind >= SyntaxKind.FirstPunctuation && + token.kind <= SyntaxKind.LastBinaryOperator) { + return ts_estree_1.AST_TOKEN_TYPES.Punctuator; } - /** - * Converts a TypeScript node into an ESTree node. - * @param child the child ts.Node - * @param parent parentNode - * @returns the converted ESTree node - */ - convertChild(child, parent) { - return this.converter(child, parent, this.inTypeMode, false); + if (token.kind >= SyntaxKind.NoSubstitutionTemplateLiteral && + token.kind <= SyntaxKind.TemplateTail) { + return ts_estree_1.AST_TOKEN_TYPES.Template; } - /** - * Converts a TypeScript node into an ESTree node. - * @param child the child ts.Node - * @param parent parentNode - * @returns the converted ESTree node - */ - convertType(child, parent) { - return this.converter(child, parent, true, false); + switch (token.kind) { + case SyntaxKind.NumericLiteral: + return ts_estree_1.AST_TOKEN_TYPES.Numeric; + case SyntaxKind.JsxText: + return ts_estree_1.AST_TOKEN_TYPES.JSXText; + case SyntaxKind.StringLiteral: + // A TypeScript-StringLiteral token with a TypeScript-JsxAttribute or TypeScript-JsxElement parent, + // must actually be an ESTree-JSXText token + if (token.parent && + (token.parent.kind === SyntaxKind.JsxAttribute || + token.parent.kind === SyntaxKind.JsxElement)) { + return ts_estree_1.AST_TOKEN_TYPES.JSXText; + } + return ts_estree_1.AST_TOKEN_TYPES.String; + case SyntaxKind.RegularExpressionLiteral: + return ts_estree_1.AST_TOKEN_TYPES.RegularExpression; + case SyntaxKind.Identifier: + case SyntaxKind.ConstructorKeyword: + case SyntaxKind.GetKeyword: + case SyntaxKind.SetKeyword: + // falls through + default: } - createNode(node, data) { - const result = data; - if (!result.range) { - result.range = node_utils_1.getRange(node, this.ast); - } - if (!result.loc) { - result.loc = node_utils_1.getLocFor(result.range[0], result.range[1], this.ast); + // Some JSX tokens have to be determined based on their parent + if (token.parent && token.kind === SyntaxKind.Identifier) { + if (isJSXToken(token.parent)) { + return ts_estree_1.AST_TOKEN_TYPES.JSXIdentifier; } - if (result && this.options.shouldPreserveNodeMaps) { - this.esTreeNodeToTSNodeMap.set(result, node); + if (token.parent.kind === SyntaxKind.PropertyAccessExpression && + hasJSXAncestor(token)) { + return ts_estree_1.AST_TOKEN_TYPES.JSXIdentifier; } - return result; } - /** - * Converts a child into a type annotation. This creates an intermediary - * TypeAnnotation node to match what Flow does. - * @param child The TypeScript AST node to convert. - * @param parent parentNode - * @returns The type annotation node. - */ - convertTypeAnnotation(child, parent) { - // in FunctionType and ConstructorType typeAnnotation has 2 characters `=>` and in other places is just colon - const offset = parent.kind === SyntaxKind.FunctionType || - parent.kind === SyntaxKind.ConstructorType - ? 2 - : 1; - const annotationStartCol = child.getFullStart() - offset; - const loc = node_utils_1.getLocFor(annotationStartCol, child.end, this.ast); + return ts_estree_1.AST_TOKEN_TYPES.Identifier; +} +exports.getTokenType = getTokenType; +/** + * Extends and formats a given ts.Token, for a given AST + * @param token the ts.Token + * @param ast the AST object + * @returns the converted Token + */ +function convertToken(token, ast) { + const start = token.kind === SyntaxKind.JsxText + ? token.getFullStart() + : token.getStart(ast); + const end = token.getEnd(); + const value = ast.text.slice(start, end); + const tokenType = getTokenType(token); + if (tokenType === ts_estree_1.AST_TOKEN_TYPES.RegularExpression) { return { - type: ts_estree_1.AST_NODE_TYPES.TSTypeAnnotation, - loc, - range: [annotationStartCol, child.end], - typeAnnotation: this.convertType(child), + type: tokenType, + value, + range: [start, end], + loc: getLocFor(start, end, ast), + regex: { + pattern: value.slice(1, value.lastIndexOf('/')), + flags: value.slice(value.lastIndexOf('/') + 1), + }, }; } - /** - * Coverts body Nodes and add a directive field to StringLiterals - * @param nodes of ts.Node - * @param parent parentNode - * @returns Array of body statements - */ - convertBodyExpressions(nodes, parent) { - let allowDirectives = node_utils_1.canContainDirective(parent); - return (nodes - .map(statement => { - const child = this.convertChild(statement); - if (allowDirectives) { - if ((child === null || child === void 0 ? void 0 : child.expression) && - ts.isExpressionStatement(statement) && - ts.isStringLiteral(statement.expression)) { - const raw = child.expression.raw; - child.directive = raw.slice(1, -1); - return child; // child can be null, but it's filtered below - } - else { - allowDirectives = false; - } - } - return child; // child can be null, but it's filtered below - }) - // filter out unknown nodes for now - .filter(statement => statement)); - } - /** - * Converts a ts.Node's typeArguments to TSTypeParameterInstantiation node - * @param typeArguments ts.NodeArray typeArguments - * @param node parent used to create this node - * @returns TypeParameterInstantiation node - */ - convertTypeArgumentsToTypeParameters(typeArguments, node) { - const greaterThanToken = node_utils_1.findNextToken(typeArguments, this.ast, this.ast); - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypeParameterInstantiation, - range: [typeArguments.pos - 1, greaterThanToken.end], - params: typeArguments.map(typeArgument => this.convertType(typeArgument)), - }); - } - /** - * Converts a ts.Node's typeParameters to TSTypeParameterDeclaration node - * @param typeParameters ts.Node typeParameters - * @returns TypeParameterDeclaration node - */ - convertTSTypeParametersToTypeParametersDeclaration(typeParameters) { - const greaterThanToken = node_utils_1.findNextToken(typeParameters, this.ast, this.ast); + else { return { - type: ts_estree_1.AST_NODE_TYPES.TSTypeParameterDeclaration, - range: [typeParameters.pos - 1, greaterThanToken.end], - loc: node_utils_1.getLocFor(typeParameters.pos - 1, greaterThanToken.end, this.ast), - params: typeParameters.map(typeParameter => this.convertType(typeParameter)), + type: tokenType, + value, + range: [start, end], + loc: getLocFor(start, end, ast), }; } +} +exports.convertToken = convertToken; +/** + * Converts all tokens for the given AST + * @param ast the AST object + * @returns the converted Tokens + */ +function convertTokens(ast) { + const result = []; /** - * Converts an array of ts.Node parameters into an array of ESTreeNode params - * @param parameters An array of ts.Node params to be converted - * @returns an array of converted ESTreeNode params - */ - convertParameters(parameters) { - if (!parameters || !parameters.length) { - return []; - } - return parameters.map(param => { - const convertedParam = this.convertChild(param); - if (param.decorators && param.decorators.length) { - convertedParam.decorators = param.decorators.map(el => this.convertChild(el)); - } - return convertedParam; - }); - } - /** - * For nodes that are copied directly from the TypeScript AST into - * ESTree mostly as-is. The only difference is the addition of a type - * property instead of a kind property. Recursively copies all children. - */ - deeplyCopy(node) { - if (node.kind === ts.SyntaxKind.JSDocFunctionType) { - throw node_utils_1.createError(this.ast, node.pos, 'JSDoc types can only be used inside documentation comments.'); - } - const customType = `TS${SyntaxKind[node.kind]}`; - /** - * If the "errorOnUnknownASTType" option is set to true, throw an error, - * otherwise fallback to just including the unknown type as-is. - */ - if (this.options.errorOnUnknownASTType && !ts_estree_1.AST_NODE_TYPES[customType]) { - throw new Error(`Unknown AST_NODE_TYPE: "${customType}"`); - } - const result = this.createNode(node, { - type: customType, - }); - if ('type' in node) { - result.typeAnnotation = - node.type && 'kind' in node.type && ts.isTypeNode(node.type) - ? this.convertTypeAnnotation(node.type, node) - : null; - } - if ('typeArguments' in node) { - result.typeParameters = - node.typeArguments && 'pos' in node.typeArguments - ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) - : null; - } - if ('typeParameters' in node) { - result.typeParameters = - node.typeParameters && 'pos' in node.typeParameters - ? this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters) - : null; - } - if ('decorators' in node && node.decorators && node.decorators.length) { - result.decorators = node.decorators.map(el => this.convertChild(el)); - } - Object.entries(node) - .filter(([key]) => !/^(?:_children|kind|parent|pos|end|flags|modifierFlagsCache|jsDoc|type|typeArguments|typeParameters|decorators)$/.test(key)) - .forEach(([key, value]) => { - if (Array.isArray(value)) { - result[key] = value.map(el => this.convertChild(el)); - } - else if (value && typeof value === 'object' && value.kind) { - // need to check node[key].kind to ensure we don't try to convert a symbol - result[key] = this.convertChild(value); - } - else { - result[key] = value; - } - }); - return result; - } - /** - * Converts a TypeScript JSX node.tagName into an ESTree node.name - * @param node the tagName object from a JSX ts.Node - * @param parent - * @returns the converted ESTree name object - */ - convertJSXTagName(node, parent) { - let result; - switch (node.kind) { - case SyntaxKind.PropertyAccessExpression: - if (node.name.kind === SyntaxKind.PrivateIdentifier) { - // This is one of the few times where TS explicitly errors, and doesn't even gracefully handle the syntax. - // So we shouldn't ever get into this state to begin with. - throw new Error('Non-private identifier expected.'); - } - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXMemberExpression, - object: this.convertJSXTagName(node.expression, parent), - property: this.convertJSXTagName(node.name, parent), - }); - break; - case SyntaxKind.ThisKeyword: - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXIdentifier, - name: 'this', - }); - break; - case SyntaxKind.Identifier: - default: - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXIdentifier, - name: node.text, - }); - break; - } - this.registerTSNodeInNodeMap(node, result); - return result; - } - /** - * Applies the given TS modifiers to the given result object. - * @param result - * @param modifiers original ts.Nodes from the node.modifiers array - * @returns the current result object will be mutated - * @deprecated This method adds not standardized `modifiers` property in nodes + * @param node the ts.Node */ - applyModifiersToResult(result, modifiers) { - if (!modifiers || !modifiers.length) { + function walk(node) { + // TypeScript generates tokens for types in JSDoc blocks. Comment tokens + // and their children should not be walked or added to the resulting tokens list. + if (isComment(node) || isJSDocComment(node)) { return; } - /** - * Some modifiers are explicitly handled by applying them as - * boolean values on the result node. As well as adding them - * to the result, we remove them from the array, so that they - * are not handled twice. - */ - const handledModifierIndices = {}; - for (let i = 0; i < modifiers.length; i++) { - const modifier = modifiers[i]; - switch (modifier.kind) { - /** - * Ignore ExportKeyword and DefaultKeyword, they are handled - * via the fixExports utility function - */ - case SyntaxKind.ExportKeyword: - case SyntaxKind.DefaultKeyword: - handledModifierIndices[i] = true; - break; - case SyntaxKind.ConstKeyword: - result.const = true; - handledModifierIndices[i] = true; - break; - case SyntaxKind.DeclareKeyword: - result.declare = true; - handledModifierIndices[i] = true; - break; - default: + if (isToken(node) && node.kind !== SyntaxKind.EndOfFileToken) { + const converted = convertToken(node, ast); + if (converted) { + result.push(converted); } } - /** - * If there are still valid modifiers available which have - * not been explicitly handled above, we just convert and - * add the modifiers array to the result node. - */ - const remainingModifiers = modifiers.filter((_, i) => !handledModifierIndices[i]); - if (!remainingModifiers || !remainingModifiers.length) { - return; + else { + node.getChildren(ast).forEach(walk); } - result.modifiers = remainingModifiers.map(el => this.convertChild(el)); } - /** - * Uses the provided range location to adjust the location data of the given Node - * @param result The node that will have its location data mutated - * @param childRange The child node range used to expand location - */ - fixParentLocation(result, childRange) { - if (childRange[0] < result.range[0]) { - result.range[0] = childRange[0]; - result.loc.start = node_utils_1.getLineAndCharacterFor(result.range[0], this.ast); - } - if (childRange[1] > result.range[1]) { - result.range[1] = childRange[1]; - result.loc.end = node_utils_1.getLineAndCharacterFor(result.range[1], this.ast); + walk(ast); + return result; +} +exports.convertTokens = convertTokens; +/** + * @param ast the AST object + * @param start the index at which the error starts + * @param message the error message + * @returns converted error object + */ +function createError(ast, start, message) { + const loc = ast.getLineAndCharacterOfPosition(start); + return { + index: start, + lineNumber: loc.line + 1, + column: loc.character, + message, + }; +} +exports.createError = createError; +/** + * @param n the TSNode + * @param ast the TS AST + */ +function nodeHasTokens(n, ast) { + // If we have a token or node that has a non-zero width, it must have tokens. + // Note: getWidth() does not take trivia into account. + return n.kind === SyntaxKind.EndOfFileToken + ? // eslint-disable-next-line @typescript-eslint/no-explicit-any + !!n.jsDoc + : n.getWidth(ast) !== 0; +} +exports.nodeHasTokens = nodeHasTokens; +/** + * Like `forEach`, but suitable for use with numbers and strings (which may be falsy). + * @template T + * @template U + * @param array + * @param callback + */ +function firstDefined(array, callback) { + if (array === undefined) { + return undefined; + } + for (let i = 0; i < array.length; i++) { + const result = callback(array[i], i); + if (result !== undefined) { + return result; } } - /** - * Converts a TypeScript node into an ESTree node. - * The core of the conversion logic: - * Identify and convert each relevant TypeScript SyntaxKind - * @param node the child ts.Node - * @param parent parentNode - * @returns the converted ESTree node - */ - convertNode(node, parent) { - var _a, _b, _c, _d, _e, _f, _g, _h; - switch (node.kind) { - case SyntaxKind.SourceFile: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Program, - body: this.convertBodyExpressions(node.statements, node), - sourceType: node.externalModuleIndicator ? 'module' : 'script', - range: [node.getStart(this.ast), node.endOfFileToken.end], - }); - } - case SyntaxKind.Block: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.BlockStatement, - body: this.convertBodyExpressions(node.statements, node), - }); - } - case SyntaxKind.Identifier: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Identifier, - name: node.text, - }); + return undefined; +} +exports.firstDefined = firstDefined; +//# sourceMappingURL=node-utils.js.map + +/***/ }), +/* 514 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + + +var replace = String.prototype.replace; +var percentTwenties = /%20/g; + +var util = __webpack_require__(139); + +var Format = { + RFC1738: 'RFC1738', + RFC3986: 'RFC3986' +}; + +module.exports = util.assign( + { + 'default': Format.RFC3986, + formatters: { + RFC1738: function (value) { + return replace.call(value, percentTwenties, '+'); + }, + RFC3986: function (value) { + return String(value); } - case SyntaxKind.WithStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.WithStatement, - object: this.convertChild(node.expression), - body: this.convertChild(node.statement), - }); - // Control Flow - case SyntaxKind.ReturnStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ReturnStatement, - argument: this.convertChild(node.expression), - }); - case SyntaxKind.LabeledStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.LabeledStatement, - label: this.convertChild(node.label), - body: this.convertChild(node.statement), - }); - case SyntaxKind.ContinueStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ContinueStatement, - label: this.convertChild(node.label), - }); - case SyntaxKind.BreakStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.BreakStatement, - label: this.convertChild(node.label), - }); - // Choice - case SyntaxKind.IfStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.IfStatement, - test: this.convertChild(node.expression), - consequent: this.convertChild(node.thenStatement), - alternate: this.convertChild(node.elseStatement), - }); - case SyntaxKind.SwitchStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.SwitchStatement, - discriminant: this.convertChild(node.expression), - cases: node.caseBlock.clauses.map(el => this.convertChild(el)), - }); - case SyntaxKind.CaseClause: - case SyntaxKind.DefaultClause: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.SwitchCase, - // expression is present in case only - test: node.kind === SyntaxKind.CaseClause - ? this.convertChild(node.expression) - : null, - consequent: node.statements.map(el => this.convertChild(el)), - }); - // Exceptions - case SyntaxKind.ThrowStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ThrowStatement, - argument: this.convertChild(node.expression), - }); - case SyntaxKind.TryStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TryStatement, - block: this.convertChild(node.tryBlock), - handler: this.convertChild(node.catchClause), - finalizer: this.convertChild(node.finallyBlock), - }); - case SyntaxKind.CatchClause: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.CatchClause, - param: node.variableDeclaration - ? this.convertChild(node.variableDeclaration.name) - : null, - body: this.convertChild(node.block), - }); - // Loops - case SyntaxKind.WhileStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.WhileStatement, - test: this.convertChild(node.expression), - body: this.convertChild(node.statement), - }); - /** - * Unlike other parsers, TypeScript calls a "DoWhileStatement" - * a "DoStatement" - */ - case SyntaxKind.DoStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.DoWhileStatement, - test: this.convertChild(node.expression), - body: this.convertChild(node.statement), - }); - case SyntaxKind.ForStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ForStatement, - init: this.convertChild(node.initializer), - test: this.convertChild(node.condition), - update: this.convertChild(node.incrementor), - body: this.convertChild(node.statement), - }); - case SyntaxKind.ForInStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ForInStatement, - left: this.convertPattern(node.initializer), - right: this.convertChild(node.expression), - body: this.convertChild(node.statement), - }); - case SyntaxKind.ForOfStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ForOfStatement, - left: this.convertPattern(node.initializer), - right: this.convertChild(node.expression), - body: this.convertChild(node.statement), - await: Boolean(node.awaitModifier && - node.awaitModifier.kind === SyntaxKind.AwaitKeyword), - }); - // Declarations - case SyntaxKind.FunctionDeclaration: { - const isDeclare = node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node); - const result = this.createNode(node, { - type: isDeclare || !node.body - ? ts_estree_1.AST_NODE_TYPES.TSDeclareFunction - : ts_estree_1.AST_NODE_TYPES.FunctionDeclaration, - id: this.convertChild(node.name), - generator: !!node.asteriskToken, - expression: false, - async: node_utils_1.hasModifier(SyntaxKind.AsyncKeyword, node), - params: this.convertParameters(node.parameters), - body: this.convertChild(node.body) || undefined, - }); - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - if (isDeclare) { - result.declare = true; - } - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - /** - * Semantically, decorators are not allowed on function declarations, - * but the TypeScript compiler will parse them and produce a valid AST, - * so we handle them here too. - */ - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); - } - // check for exports - return this.fixExports(node, result); - } - case SyntaxKind.VariableDeclaration: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.VariableDeclarator, - id: this.convertPattern(node.name), - init: this.convertChild(node.initializer), - }); - if (node.exclamationToken) { - result.definite = true; - } - if (node.type) { - result.id.typeAnnotation = this.convertTypeAnnotation(node.type, node); - this.fixParentLocation(result.id, result.id.typeAnnotation.range); - } - return result; - } - case SyntaxKind.VariableStatement: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.VariableDeclaration, - declarations: node.declarationList.declarations.map(el => this.convertChild(el)), - kind: node_utils_1.getDeclarationKind(node.declarationList), - }); - /** - * Semantically, decorators are not allowed on variable declarations, - * but the TypeScript compiler will parse them and produce a valid AST, - * so we handle them here too. - */ - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); - } - if (node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - // check for exports - return this.fixExports(node, result); - } - // mostly for for-of, for-in - case SyntaxKind.VariableDeclarationList: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.VariableDeclaration, - declarations: node.declarations.map(el => this.convertChild(el)), - kind: node_utils_1.getDeclarationKind(node), - }); - // Expressions - case SyntaxKind.ExpressionStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ExpressionStatement, - expression: this.convertChild(node.expression), - }); - case SyntaxKind.ThisKeyword: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ThisExpression, - }); - case SyntaxKind.ArrayLiteralExpression: { - // TypeScript uses ArrayLiteralExpression in destructuring assignment, too - if (this.allowPattern) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ArrayPattern, - elements: node.elements.map(el => this.convertPattern(el)), - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ArrayExpression, - elements: node.elements.map(el => this.convertChild(el)), - }); - } - } - case SyntaxKind.ObjectLiteralExpression: { - // TypeScript uses ObjectLiteralExpression in destructuring assignment, too - if (this.allowPattern) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ObjectPattern, - properties: node.properties.map(el => this.convertPattern(el)), - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ObjectExpression, - properties: node.properties.map(el => this.convertChild(el)), - }); - } - } - case SyntaxKind.PropertyAssignment: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Property, - key: this.convertChild(node.name), - value: this.converter(node.initializer, node, this.inTypeMode, this.allowPattern), - computed: node_utils_1.isComputedProperty(node.name), - method: false, - shorthand: false, - kind: 'init', - }); - case SyntaxKind.ShorthandPropertyAssignment: { - if (node.objectAssignmentInitializer) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Property, - key: this.convertChild(node.name), - value: this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, - left: this.convertPattern(node.name), - right: this.convertChild(node.objectAssignmentInitializer), - }), - computed: false, - method: false, - shorthand: true, - kind: 'init', - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Property, - key: this.convertChild(node.name), - value: this.convertChild(node.name), - computed: false, - method: false, - shorthand: true, - kind: 'init', - }); - } - } - case SyntaxKind.ComputedPropertyName: - return this.convertChild(node.expression); - case SyntaxKind.PropertyDeclaration: { - const isAbstract = node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node); - const result = this.createNode(node, { - type: isAbstract - ? ts_estree_1.AST_NODE_TYPES.TSAbstractClassProperty - : ts_estree_1.AST_NODE_TYPES.ClassProperty, - key: this.convertChild(node.name), - value: this.convertChild(node.initializer), - computed: node_utils_1.isComputedProperty(node.name), - static: node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node), - readonly: node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - declare: node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node), - }); - if (node.type) { - result.typeAnnotation = this.convertTypeAnnotation(node.type, node); - } - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); - } - const accessibility = node_utils_1.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - if ((node.name.kind === SyntaxKind.Identifier || - node.name.kind === SyntaxKind.ComputedPropertyName) && - node.questionToken) { - result.optional = true; - } - if (node.exclamationToken) { - result.definite = true; - } - if (result.key.type === ts_estree_1.AST_NODE_TYPES.Literal && node.questionToken) { - result.optional = true; - } - return result; - } - case SyntaxKind.GetAccessor: - case SyntaxKind.SetAccessor: - case SyntaxKind.MethodDeclaration: { - const method = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.FunctionExpression, - id: null, - generator: !!node.asteriskToken, - expression: false, - async: node_utils_1.hasModifier(SyntaxKind.AsyncKeyword, node), - body: this.convertChild(node.body), - range: [node.parameters.pos - 1, node.end], - params: [], - }); - if (node.type) { - method.returnType = this.convertTypeAnnotation(node.type, node); - } - // Process typeParameters - if (node.typeParameters) { - method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - this.fixParentLocation(method, method.typeParameters.range); - } - let result; - if (parent.kind === SyntaxKind.ObjectLiteralExpression) { - method.params = node.parameters.map(el => this.convertChild(el)); - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Property, - key: this.convertChild(node.name), - value: method, - computed: node_utils_1.isComputedProperty(node.name), - method: node.kind === SyntaxKind.MethodDeclaration, - shorthand: false, - kind: 'init', - }); - } - else { - // class - /** - * Unlike in object literal methods, class method params can have decorators - */ - method.params = this.convertParameters(node.parameters); - /** - * TypeScript class methods can be defined as "abstract" - */ - const methodDefinitionType = node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node) - ? ts_estree_1.AST_NODE_TYPES.TSAbstractMethodDefinition - : ts_estree_1.AST_NODE_TYPES.MethodDefinition; - result = this.createNode(node, { - type: methodDefinitionType, - key: this.convertChild(node.name), - value: method, - computed: node_utils_1.isComputedProperty(node.name), - static: node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node), - kind: 'method', - }); - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); - } - const accessibility = node_utils_1.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - } - if (result.key.type === ts_estree_1.AST_NODE_TYPES.Identifier && - node.questionToken) { - result.key.optional = true; - } - if (node.kind === SyntaxKind.GetAccessor) { - result.kind = 'get'; - } - else if (node.kind === SyntaxKind.SetAccessor) { - result.kind = 'set'; - } - else if (!result.static && - node.name.kind === SyntaxKind.StringLiteral && - node.name.text === 'constructor' && - result.type !== ts_estree_1.AST_NODE_TYPES.Property) { - result.kind = 'constructor'; - } - return result; - } - // TypeScript uses this even for static methods named "constructor" - case SyntaxKind.Constructor: { - const lastModifier = node_utils_1.getLastModifier(node); - const constructorToken = (lastModifier && node_utils_1.findNextToken(lastModifier, node, this.ast)) || - node.getFirstToken(); - const constructor = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.FunctionExpression, - id: null, - params: this.convertParameters(node.parameters), - generator: false, - expression: false, - async: false, - body: this.convertChild(node.body), - range: [node.parameters.pos - 1, node.end], - }); - // Process typeParameters - if (node.typeParameters) { - constructor.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - this.fixParentLocation(constructor, constructor.typeParameters.range); - } - // Process returnType - if (node.type) { - constructor.returnType = this.convertTypeAnnotation(node.type, node); - } - const constructorKey = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Identifier, - name: 'constructor', - range: [constructorToken.getStart(this.ast), constructorToken.end], - }); - const isStatic = node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node); - const result = this.createNode(node, { - type: node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node) - ? ts_estree_1.AST_NODE_TYPES.TSAbstractMethodDefinition - : ts_estree_1.AST_NODE_TYPES.MethodDefinition, - key: constructorKey, - value: constructor, - computed: false, - static: isStatic, - kind: isStatic ? 'method' : 'constructor', - }); - const accessibility = node_utils_1.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - return result; - } - case SyntaxKind.FunctionExpression: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.FunctionExpression, - id: this.convertChild(node.name), - generator: !!node.asteriskToken, - params: this.convertParameters(node.parameters), - body: this.convertChild(node.body), - async: node_utils_1.hasModifier(SyntaxKind.AsyncKeyword, node), - expression: false, - }); - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - return result; - } - case SyntaxKind.SuperKeyword: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Super, - }); - case SyntaxKind.ArrayBindingPattern: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ArrayPattern, - elements: node.elements.map(el => this.convertPattern(el)), - }); - // occurs with missing array elements like [,] - case SyntaxKind.OmittedExpression: - return null; - case SyntaxKind.ObjectBindingPattern: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ObjectPattern, - properties: node.elements.map(el => this.convertPattern(el)), - }); - case SyntaxKind.BindingElement: { - if (parent.kind === SyntaxKind.ArrayBindingPattern) { - const arrayItem = this.convertChild(node.name, parent); - if (node.initializer) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, - left: arrayItem, - right: this.convertChild(node.initializer), - }); - } - else if (node.dotDotDotToken) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.RestElement, - argument: arrayItem, - }); - } - else { - return arrayItem; - } - } - else { - let result; - if (node.dotDotDotToken) { - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.RestElement, - argument: this.convertChild((_a = node.propertyName) !== null && _a !== void 0 ? _a : node.name), - }); - } - else { - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Property, - key: this.convertChild((_b = node.propertyName) !== null && _b !== void 0 ? _b : node.name), - value: this.convertChild(node.name), - computed: Boolean(node.propertyName && - node.propertyName.kind === SyntaxKind.ComputedPropertyName), - method: false, - shorthand: !node.propertyName, - kind: 'init', - }); - } - if (node.initializer) { - result.value = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, - left: this.convertChild(node.name), - right: this.convertChild(node.initializer), - range: [node.name.getStart(this.ast), node.initializer.end], - }); - } - return result; - } - } - case SyntaxKind.ArrowFunction: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ArrowFunctionExpression, - generator: false, - id: null, - params: this.convertParameters(node.parameters), - body: this.convertChild(node.body), - async: node_utils_1.hasModifier(SyntaxKind.AsyncKeyword, node), - expression: node.body.kind !== SyntaxKind.Block, - }); - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - return result; - } - case SyntaxKind.YieldExpression: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.YieldExpression, - delegate: !!node.asteriskToken, - argument: this.convertChild(node.expression), - }); - case SyntaxKind.AwaitExpression: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.AwaitExpression, - argument: this.convertChild(node.expression), - }); - // Template Literals - case SyntaxKind.NoSubstitutionTemplateLiteral: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TemplateLiteral, - quasis: [ - this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TemplateElement, - value: { - raw: this.ast.text.slice(node.getStart(this.ast) + 1, node.end - 1), - cooked: node.text, - }, - tail: true, - }), - ], - expressions: [], - }); - case SyntaxKind.TemplateExpression: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TemplateLiteral, - quasis: [this.convertChild(node.head)], - expressions: [], - }); - node.templateSpans.forEach(templateSpan => { - result.expressions.push(this.convertChild(templateSpan.expression)); - result.quasis.push(this.convertChild(templateSpan.literal)); - }); - return result; - } - case SyntaxKind.TaggedTemplateExpression: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TaggedTemplateExpression, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) - : undefined, - tag: this.convertChild(node.tag), - quasi: this.convertChild(node.template), - }); - case SyntaxKind.TemplateHead: - case SyntaxKind.TemplateMiddle: - case SyntaxKind.TemplateTail: { - const tail = node.kind === SyntaxKind.TemplateTail; - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TemplateElement, - value: { - raw: this.ast.text.slice(node.getStart(this.ast) + 1, node.end - (tail ? 1 : 2)), - cooked: node.text, - }, - tail, - }); - } - // Patterns - case SyntaxKind.SpreadAssignment: - case SyntaxKind.SpreadElement: { - if (this.allowPattern) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.RestElement, - argument: this.convertPattern(node.expression), - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.SpreadElement, - argument: this.convertChild(node.expression), - }); - } - } - case SyntaxKind.Parameter: { - let parameter; - let result; - if (node.dotDotDotToken) { - parameter = result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.RestElement, - argument: this.convertChild(node.name), - }); - } - else if (node.initializer) { - parameter = this.convertChild(node.name); - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, - left: parameter, - right: this.convertChild(node.initializer), - }); - if (node.modifiers) { - // AssignmentPattern should not contain modifiers in range - result.range[0] = parameter.range[0]; - result.loc = node_utils_1.getLocFor(result.range[0], result.range[1], this.ast); - } - } - else { - parameter = result = this.convertChild(node.name, parent); - } - if (node.type) { - parameter.typeAnnotation = this.convertTypeAnnotation(node.type, node); - this.fixParentLocation(parameter, parameter.typeAnnotation.range); - } - if (node.questionToken) { - if (node.questionToken.end > parameter.range[1]) { - parameter.range[1] = node.questionToken.end; - parameter.loc.end = node_utils_1.getLineAndCharacterFor(parameter.range[1], this.ast); - } - parameter.optional = true; - } - if (node.modifiers) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSParameterProperty, - accessibility: (_c = node_utils_1.getTSNodeAccessibility(node)) !== null && _c !== void 0 ? _c : undefined, - readonly: node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node) || undefined, - export: node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node) || undefined, - parameter: result, - }); - } - return result; - } - // Classes - case SyntaxKind.ClassDeclaration: - case SyntaxKind.ClassExpression: { - const heritageClauses = (_d = node.heritageClauses) !== null && _d !== void 0 ? _d : []; - const classNodeType = node.kind === SyntaxKind.ClassDeclaration - ? ts_estree_1.AST_NODE_TYPES.ClassDeclaration - : ts_estree_1.AST_NODE_TYPES.ClassExpression; - const superClass = heritageClauses.find(clause => clause.token === SyntaxKind.ExtendsKeyword); - const implementsClause = heritageClauses.find(clause => clause.token === SyntaxKind.ImplementsKeyword); - const result = this.createNode(node, { - type: classNodeType, - id: this.convertChild(node.name), - body: this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ClassBody, - body: [], - range: [node.members.pos - 1, node.end], - }), - superClass: (superClass === null || superClass === void 0 ? void 0 : superClass.types[0]) ? this.convertChild(superClass.types[0].expression) - : null, - }); - if (superClass) { - if (superClass.types.length > 1) { - throw node_utils_1.createError(this.ast, superClass.types[1].pos, 'Classes can only extend a single class.'); - } - if (superClass.types[0] && superClass.types[0].typeArguments) { - result.superTypeParameters = this.convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments, superClass.types[0]); - } - } - if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - if (implementsClause) { - result.implements = implementsClause.types.map(el => this.convertChild(el)); - } - /** - * TypeScript class declarations can be defined as "abstract" - */ - if (node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node)) { - result.abstract = true; - } - if (node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); - } - const filteredMembers = node.members.filter(node_utils_1.isESTreeClassMember); - if (filteredMembers.length) { - result.body.body = filteredMembers.map(el => this.convertChild(el)); - } - // check for exports - return this.fixExports(node, result); - } - // Modules - case SyntaxKind.ModuleBlock: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSModuleBlock, - body: this.convertBodyExpressions(node.statements, node), - }); - case SyntaxKind.ImportDeclaration: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ImportDeclaration, - source: this.convertChild(node.moduleSpecifier), - specifiers: [], - importKind: 'value', - }); - if (node.importClause) { - if (node.importClause.isTypeOnly) { - result.importKind = 'type'; - } - if (node.importClause.name) { - result.specifiers.push(this.convertChild(node.importClause)); - } - if (node.importClause.namedBindings) { - switch (node.importClause.namedBindings.kind) { - case SyntaxKind.NamespaceImport: - result.specifiers.push(this.convertChild(node.importClause.namedBindings)); - break; - case SyntaxKind.NamedImports: - result.specifiers = result.specifiers.concat(node.importClause.namedBindings.elements.map(el => this.convertChild(el))); - break; - } - } - } - return result; - } - case SyntaxKind.NamespaceImport: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ImportNamespaceSpecifier, - local: this.convertChild(node.name), - }); - case SyntaxKind.ImportSpecifier: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ImportSpecifier, - local: this.convertChild(node.name), - imported: this.convertChild((_e = node.propertyName) !== null && _e !== void 0 ? _e : node.name), - }); - case SyntaxKind.ImportClause: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ImportDefaultSpecifier, - local: this.convertChild(node.name), - range: [node.getStart(this.ast), node.name.end], - }); - case SyntaxKind.ExportDeclaration: - if (((_f = node.exportClause) === null || _f === void 0 ? void 0 : _f.kind) === SyntaxKind.NamedExports) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ExportNamedDeclaration, - source: this.convertChild(node.moduleSpecifier), - specifiers: node.exportClause.elements.map(el => this.convertChild(el)), - exportKind: node.isTypeOnly ? 'type' : 'value', - declaration: null, - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ExportAllDeclaration, - source: this.convertChild(node.moduleSpecifier), - exportKind: node.isTypeOnly ? 'type' : 'value', - exported: - // note - for compat with 3.7.x, where node.exportClause is always undefined and - // SyntaxKind.NamespaceExport does not exist yet (i.e. is undefined), this - // cannot be shortened to an optional chain, or else you end up with - // undefined === undefined, and the true path will hard error at runtime - node.exportClause && - node.exportClause.kind === SyntaxKind.NamespaceExport - ? this.convertChild(node.exportClause.name) - : null, - }); - } - case SyntaxKind.ExportSpecifier: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ExportSpecifier, - local: this.convertChild((_g = node.propertyName) !== null && _g !== void 0 ? _g : node.name), - exported: this.convertChild(node.name), - }); - case SyntaxKind.ExportAssignment: - if (node.isExportEquals) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSExportAssignment, - expression: this.convertChild(node.expression), - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ExportDefaultDeclaration, - declaration: this.convertChild(node.expression), - exportKind: 'value', - }); - } - // Unary Operations - case SyntaxKind.PrefixUnaryExpression: - case SyntaxKind.PostfixUnaryExpression: { - const operator = node_utils_1.getTextForTokenKind(node.operator); - /** - * ESTree uses UpdateExpression for ++/-- - */ - if (operator === '++' || operator === '--') { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.UpdateExpression, - operator, - prefix: node.kind === SyntaxKind.PrefixUnaryExpression, - argument: this.convertChild(node.operand), - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.UnaryExpression, - operator, - prefix: node.kind === SyntaxKind.PrefixUnaryExpression, - argument: this.convertChild(node.operand), - }); - } - } - case SyntaxKind.DeleteExpression: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.UnaryExpression, - operator: 'delete', - prefix: true, - argument: this.convertChild(node.expression), - }); - case SyntaxKind.VoidExpression: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.UnaryExpression, - operator: 'void', - prefix: true, - argument: this.convertChild(node.expression), - }); - case SyntaxKind.TypeOfExpression: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.UnaryExpression, - operator: 'typeof', - prefix: true, - argument: this.convertChild(node.expression), - }); - case SyntaxKind.TypeOperator: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypeOperator, - operator: node_utils_1.getTextForTokenKind(node.operator), - typeAnnotation: this.convertChild(node.type), - }); - // Binary Operations - case SyntaxKind.BinaryExpression: { - // TypeScript uses BinaryExpression for sequences as well - if (node_utils_1.isComma(node.operatorToken)) { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.SequenceExpression, - expressions: [], - }); - const left = this.convertChild(node.left); - if (left.type === ts_estree_1.AST_NODE_TYPES.SequenceExpression && - node.left.kind !== SyntaxKind.ParenthesizedExpression) { - result.expressions = result.expressions.concat(left.expressions); - } - else { - result.expressions.push(left); - } - result.expressions.push(this.convertChild(node.right)); - return result; - } - else { - const type = node_utils_1.getBinaryExpressionType(node.operatorToken); - if (this.allowPattern && - type === ts_estree_1.AST_NODE_TYPES.AssignmentExpression) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, - left: this.convertPattern(node.left, node), - right: this.convertChild(node.right), - }); - } - return this.createNode(node, { - type, - operator: node_utils_1.getTextForTokenKind(node.operatorToken.kind), - left: this.converter(node.left, node, this.inTypeMode, type === ts_estree_1.AST_NODE_TYPES.AssignmentExpression), - right: this.convertChild(node.right), - }); - } - } - case SyntaxKind.PropertyAccessExpression: { - const object = this.convertChild(node.expression); - const property = this.convertChild(node.name); - const computed = false; - const isLocallyOptional = node.questionDotToken !== undefined; - // the optional expression should propagate up the member expression tree - const isChildOptional = (object.type === ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression || - object.type === ts_estree_1.AST_NODE_TYPES.OptionalCallExpression) && - // (x?.y).z is semantically different, and as such .z is no longer optional - node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; - if (isLocallyOptional || isChildOptional) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression, - object, - property, - computed, - optional: isLocallyOptional, - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.MemberExpression, - object, - property, - computed, - optional: false, - }); - } - } - case SyntaxKind.ElementAccessExpression: { - const object = this.convertChild(node.expression); - const property = this.convertChild(node.argumentExpression); - const computed = true; - const isLocallyOptional = node.questionDotToken !== undefined; - // the optional expression should propagate up the member expression tree - const isChildOptional = (object.type === ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression || - object.type === ts_estree_1.AST_NODE_TYPES.OptionalCallExpression) && - // (x?.y).z is semantically different, and as such .z is no longer optional - node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; - if (isLocallyOptional || isChildOptional) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression, - object, - property, - computed, - optional: isLocallyOptional, - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.MemberExpression, - object, - property, - computed, - optional: false, - }); - } - } - case SyntaxKind.CallExpression: { - const callee = this.convertChild(node.expression); - const args = node.arguments.map(el => this.convertChild(el)); - let result; - const isLocallyOptional = node.questionDotToken !== undefined; - // the optional expression should propagate up the member expression tree - const isChildOptional = (callee.type === ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression || - callee.type === ts_estree_1.AST_NODE_TYPES.OptionalCallExpression) && - // (x?.y).z() is semantically different, and as such .z() is no longer optional - node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; - if (isLocallyOptional || isChildOptional) { - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.OptionalCallExpression, - callee, - arguments: args, - optional: isLocallyOptional, - }); - } - else { - result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.CallExpression, - callee, - arguments: args, - optional: false, - }); - } - if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters(node.typeArguments, node); - } - return result; - } - case SyntaxKind.NewExpression: { - // NOTE - NewExpression cannot have an optional chain in it - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.NewExpression, - callee: this.convertChild(node.expression), - arguments: node.arguments - ? node.arguments.map(el => this.convertChild(el)) - : [], - }); - if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters(node.typeArguments, node); - } - return result; - } - case SyntaxKind.ConditionalExpression: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.ConditionalExpression, - test: this.convertChild(node.condition), - consequent: this.convertChild(node.whenTrue), - alternate: this.convertChild(node.whenFalse), - }); - case SyntaxKind.MetaProperty: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.MetaProperty, - meta: this.createNode( - // TODO: do we really want to convert it to Token? - node.getFirstToken(), { - type: ts_estree_1.AST_NODE_TYPES.Identifier, - name: node_utils_1.getTextForTokenKind(node.keywordToken), - }), - property: this.convertChild(node.name), - }); - } - case SyntaxKind.Decorator: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Decorator, - expression: this.convertChild(node.expression), - }); - } - // Literals - case SyntaxKind.StringLiteral: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Literal, - raw: '', - value: '', - }); - result.raw = this.ast.text.slice(result.range[0], result.range[1]); - if ('name' in parent && parent.name === node) { - result.value = node.text; - } - else { - result.value = node_utils_1.unescapeStringLiteralText(node.text); - } - return result; - } - case SyntaxKind.NumericLiteral: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Literal, - value: Number(node.text), - raw: node.getText(), - }); - } - case SyntaxKind.BigIntLiteral: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.BigIntLiteral, - raw: '', - value: '', - }); - result.raw = this.ast.text.slice(result.range[0], result.range[1]); - result.value = result.raw.slice(0, -1); // remove suffix `n` - return result; - } - case SyntaxKind.RegularExpressionLiteral: { - const pattern = node.text.slice(1, node.text.lastIndexOf('/')); - const flags = node.text.slice(node.text.lastIndexOf('/') + 1); - let regex = null; - try { - regex = new RegExp(pattern, flags); - } - catch (exception) { - regex = null; - } - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Literal, - value: regex, - raw: node.text, - regex: { - pattern, - flags, - }, - }); - } - case SyntaxKind.TrueKeyword: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Literal, - value: true, - raw: 'true', - }); - case SyntaxKind.FalseKeyword: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Literal, - value: false, - raw: 'false', - }); - case SyntaxKind.NullKeyword: { - if (this.inTypeMode) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSNullKeyword, - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Literal, - value: null, - raw: 'null', - }); - } - } - case SyntaxKind.ImportKeyword: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Import, - }); - case SyntaxKind.EmptyStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.EmptyStatement, - }); - case SyntaxKind.DebuggerStatement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.DebuggerStatement, - }); - // JSX - case SyntaxKind.JsxElement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXElement, - openingElement: this.convertChild(node.openingElement), - closingElement: this.convertChild(node.closingElement), - children: node.children.map(el => this.convertChild(el)), - }); - case SyntaxKind.JsxFragment: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXFragment, - openingFragment: this.convertChild(node.openingFragment), - closingFragment: this.convertChild(node.closingFragment), - children: node.children.map(el => this.convertChild(el)), - }); - case SyntaxKind.JsxSelfClosingElement: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXElement, - /** - * Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, - * TypeScript does not seem to have the idea of openingElement when tag is self-closing - */ - openingElement: this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXOpeningElement, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) - : undefined, - selfClosing: true, - name: this.convertJSXTagName(node.tagName, node), - attributes: node.attributes.properties.map(el => this.convertChild(el)), - range: node_utils_1.getRange(node, this.ast), - }), - closingElement: null, - children: [], - }); - } - case SyntaxKind.JsxOpeningElement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXOpeningElement, - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) - : undefined, - selfClosing: false, - name: this.convertJSXTagName(node.tagName, node), - attributes: node.attributes.properties.map(el => this.convertChild(el)), - }); - case SyntaxKind.JsxClosingElement: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXClosingElement, - name: this.convertJSXTagName(node.tagName, node), - }); - case SyntaxKind.JsxOpeningFragment: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXOpeningFragment, - }); - case SyntaxKind.JsxClosingFragment: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXClosingFragment, - }); - case SyntaxKind.JsxExpression: { - const expression = node.expression - ? this.convertChild(node.expression) - : this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXEmptyExpression, - range: [node.getStart(this.ast) + 1, node.getEnd() - 1], - }); - if (node.dotDotDotToken) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXSpreadChild, - expression, - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXExpressionContainer, - expression, - }); - } - } - case SyntaxKind.JsxAttribute: { - const attributeName = this.convertChild(node.name); - attributeName.type = ts_estree_1.AST_NODE_TYPES.JSXIdentifier; - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXAttribute, - name: attributeName, - value: this.convertChild(node.initializer), - }); - } - /** - * The JSX AST changed the node type for string literals - * inside a JSX Element from `Literal` to `JSXText`. We - * provide a flag to support both types until `Literal` - * node type is deprecated in ESLint v5. - */ - case SyntaxKind.JsxText: { - const start = node.getFullStart(); - const end = node.getEnd(); - if (this.options.useJSXTextNode) { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXText, - value: this.ast.text.slice(start, end), - raw: this.ast.text.slice(start, end), - range: [start, end], - }); - } - else { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.Literal, - value: this.ast.text.slice(start, end), - raw: this.ast.text.slice(start, end), - range: [start, end], - }); - } - } - case SyntaxKind.JsxSpreadAttribute: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.JSXSpreadAttribute, - argument: this.convertChild(node.expression), - }); - case SyntaxKind.QualifiedName: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSQualifiedName, - left: this.convertChild(node.left), - right: this.convertChild(node.right), - }); - } - // TypeScript specific - case SyntaxKind.TypeReference: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypeReference, - typeName: this.convertType(node.typeName), - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) - : undefined, - }); - } - case SyntaxKind.TypeParameter: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypeParameter, - name: this.convertType(node.name), - constraint: node.constraint - ? this.convertType(node.constraint) - : undefined, - default: node.default ? this.convertType(node.default) : undefined, - }); - } - case SyntaxKind.ThisType: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSThisType, - }); - case SyntaxKind.AnyKeyword: - case SyntaxKind.BigIntKeyword: - case SyntaxKind.BooleanKeyword: - case SyntaxKind.NeverKeyword: - case SyntaxKind.NumberKeyword: - case SyntaxKind.ObjectKeyword: - case SyntaxKind.StringKeyword: - case SyntaxKind.SymbolKeyword: - case SyntaxKind.UnknownKeyword: - case SyntaxKind.VoidKeyword: - case SyntaxKind.UndefinedKeyword: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES[`TS${SyntaxKind[node.kind]}`], - }); - } - case SyntaxKind.NonNullExpression: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSNonNullExpression, - expression: this.convertChild(node.expression), - }); - } - case SyntaxKind.TypeLiteral: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypeLiteral, - members: node.members.map(el => this.convertChild(el)), - }); - } - case SyntaxKind.ArrayType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSArrayType, - elementType: this.convertType(node.elementType), - }); - } - case SyntaxKind.IndexedAccessType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSIndexedAccessType, - objectType: this.convertType(node.objectType), - indexType: this.convertType(node.indexType), - }); - } - case SyntaxKind.ConditionalType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSConditionalType, - checkType: this.convertType(node.checkType), - extendsType: this.convertType(node.extendsType), - trueType: this.convertType(node.trueType), - falseType: this.convertType(node.falseType), - }); - } - case SyntaxKind.TypeQuery: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypeQuery, - exprName: this.convertType(node.exprName), - }); - } - case SyntaxKind.MappedType: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSMappedType, - typeParameter: this.convertType(node.typeParameter), - }); - if (node.readonlyToken) { - if (node.readonlyToken.kind === SyntaxKind.ReadonlyKeyword) { - result.readonly = true; - } - else { - result.readonly = node_utils_1.getTextForTokenKind(node.readonlyToken.kind); - } - } - if (node.questionToken) { - if (node.questionToken.kind === SyntaxKind.QuestionToken) { - result.optional = true; - } - else { - result.optional = node_utils_1.getTextForTokenKind(node.questionToken.kind); - } - } - if (node.type) { - result.typeAnnotation = this.convertType(node.type); - } - return result; - } - case SyntaxKind.ParenthesizedExpression: - return this.convertChild(node.expression, parent); - case SyntaxKind.TypeAliasDeclaration: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypeAliasDeclaration, - id: this.convertChild(node.name), - typeAnnotation: this.convertType(node.type), - }); - if (node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - // check for exports - return this.fixExports(node, result); - } - case SyntaxKind.MethodSignature: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSMethodSignature, - computed: node_utils_1.isComputedProperty(node.name), - key: this.convertChild(node.name), - params: this.convertParameters(node.parameters), - }); - if (node_utils_1.isOptional(node)) { - result.optional = true; - } - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - if (node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node)) { - result.readonly = true; - } - if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - const accessibility = node_utils_1.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - if (node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node)) { - result.export = true; - } - if (node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node)) { - result.static = true; - } - return result; - } - case SyntaxKind.PropertySignature: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSPropertySignature, - optional: node_utils_1.isOptional(node) || undefined, - computed: node_utils_1.isComputedProperty(node.name), - key: this.convertChild(node.name), - typeAnnotation: node.type - ? this.convertTypeAnnotation(node.type, node) - : undefined, - initializer: this.convertChild(node.initializer) || undefined, - readonly: node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node) || undefined, - export: node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node) || undefined, - }); - const accessibility = node_utils_1.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - return result; - } - case SyntaxKind.IndexSignature: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSIndexSignature, - parameters: node.parameters.map(el => this.convertChild(el)), - }); - if (node.type) { - result.typeAnnotation = this.convertTypeAnnotation(node.type, node); - } - if (node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node)) { - result.readonly = true; - } - const accessibility = node_utils_1.getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - if (node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node)) { - result.export = true; - } - if (node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node)) { - result.static = true; - } - return result; - } - case SyntaxKind.ConstructorType: - case SyntaxKind.FunctionType: - case SyntaxKind.ConstructSignature: - case SyntaxKind.CallSignature: { - let type; - switch (node.kind) { - case SyntaxKind.ConstructSignature: - type = ts_estree_1.AST_NODE_TYPES.TSConstructSignatureDeclaration; - break; - case SyntaxKind.CallSignature: - type = ts_estree_1.AST_NODE_TYPES.TSCallSignatureDeclaration; - break; - case SyntaxKind.FunctionType: - type = ts_estree_1.AST_NODE_TYPES.TSFunctionType; - break; - case SyntaxKind.ConstructorType: - default: - type = ts_estree_1.AST_NODE_TYPES.TSConstructorType; - break; - } - const result = this.createNode(node, { - type: type, - params: this.convertParameters(node.parameters), - }); - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - return result; - } - case SyntaxKind.ExpressionWithTypeArguments: { - const result = this.createNode(node, { - type: parent && parent.kind === SyntaxKind.InterfaceDeclaration - ? ts_estree_1.AST_NODE_TYPES.TSInterfaceHeritage - : ts_estree_1.AST_NODE_TYPES.TSClassImplements, - expression: this.convertChild(node.expression), - }); - if (node.typeArguments) { - result.typeParameters = this.convertTypeArgumentsToTypeParameters(node.typeArguments, node); - } - return result; - } - case SyntaxKind.InterfaceDeclaration: { - const interfaceHeritageClauses = (_h = node.heritageClauses) !== null && _h !== void 0 ? _h : []; - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSInterfaceDeclaration, - body: this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSInterfaceBody, - body: node.members.map(member => this.convertChild(member)), - range: [node.members.pos - 1, node.end], - }), - id: this.convertChild(node.name), - }); - if (node.typeParameters) { - result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); - } - if (interfaceHeritageClauses.length > 0) { - const interfaceExtends = []; - const interfaceImplements = []; - for (const heritageClause of interfaceHeritageClauses) { - if (heritageClause.token === SyntaxKind.ExtendsKeyword) { - for (const n of heritageClause.types) { - interfaceExtends.push(this.convertChild(n, node)); - } - } - else { - for (const n of heritageClause.types) { - interfaceImplements.push(this.convertChild(n, node)); - } - } - } - if (interfaceExtends.length) { - result.extends = interfaceExtends; - } - if (interfaceImplements.length) { - result.implements = interfaceImplements; - } - } - /** - * Semantically, decorators are not allowed on interface declarations, - * but the TypeScript compiler will parse them and produce a valid AST, - * so we handle them here too. - */ - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); - } - if (node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node)) { - result.abstract = true; - } - if (node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - // check for exports - return this.fixExports(node, result); - } - case SyntaxKind.TypePredicate: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypePredicate, - asserts: node.assertsModifier !== undefined, - parameterName: this.convertChild(node.parameterName), - typeAnnotation: null, - }); - /** - * Specific fix for type-guard location data - */ - if (node.type) { - result.typeAnnotation = this.convertTypeAnnotation(node.type, node); - result.typeAnnotation.loc = result.typeAnnotation.typeAnnotation.loc; - result.typeAnnotation.range = - result.typeAnnotation.typeAnnotation.range; - } - return result; - } - case SyntaxKind.ImportType: - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSImportType, - isTypeOf: !!node.isTypeOf, - parameter: this.convertChild(node.argument), - qualifier: this.convertChild(node.qualifier), - typeParameters: node.typeArguments - ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) - : null, - }); - case SyntaxKind.EnumDeclaration: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSEnumDeclaration, - id: this.convertChild(node.name), - members: node.members.map(el => this.convertChild(el)), - }); - // apply modifiers first... - this.applyModifiersToResult(result, node.modifiers); - /** - * Semantically, decorators are not allowed on enum declarations, - * but the TypeScript compiler will parse them and produce a valid AST, - * so we handle them here too. - */ - if (node.decorators) { - result.decorators = node.decorators.map(el => this.convertChild(el)); - } - // ...then check for exports - return this.fixExports(node, result); - } - case SyntaxKind.EnumMember: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSEnumMember, - id: this.convertChild(node.name), - }); - if (node.initializer) { - result.initializer = this.convertChild(node.initializer); - } - if (node.name.kind === ts.SyntaxKind.ComputedPropertyName) { - result.computed = true; - } - return result; - } - case SyntaxKind.ModuleDeclaration: { - const result = this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSModuleDeclaration, - id: this.convertChild(node.name), - }); - if (node.body) { - result.body = this.convertChild(node.body); - } - // apply modifiers first... - this.applyModifiersToResult(result, node.modifiers); - if (node.flags & ts.NodeFlags.GlobalAugmentation) { - result.global = true; - } - // ...then check for exports - return this.fixExports(node, result); - } - // TypeScript specific types - case SyntaxKind.OptionalType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSOptionalType, - typeAnnotation: this.convertType(node.type), - }); - } - case SyntaxKind.ParenthesizedType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSParenthesizedType, - typeAnnotation: this.convertType(node.type), - }); - } - case SyntaxKind.TupleType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTupleType, - elementTypes: node.elementTypes.map(el => this.convertType(el)), - }); - } - case SyntaxKind.UnionType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSUnionType, - types: node.types.map(el => this.convertType(el)), - }); - } - case SyntaxKind.IntersectionType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSIntersectionType, - types: node.types.map(el => this.convertType(el)), - }); - } - case SyntaxKind.RestType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSRestType, - typeAnnotation: this.convertType(node.type), - }); - } - case SyntaxKind.AsExpression: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSAsExpression, - expression: this.convertChild(node.expression), - typeAnnotation: this.convertType(node.type), - }); - } - case SyntaxKind.InferType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSInferType, - typeParameter: this.convertType(node.typeParameter), - }); - } - case SyntaxKind.LiteralType: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSLiteralType, - literal: this.convertType(node.literal), - }); - } - case SyntaxKind.TypeAssertionExpression: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSTypeAssertion, - typeAnnotation: this.convertType(node.type), - expression: this.convertChild(node.expression), - }); - } - case SyntaxKind.ImportEqualsDeclaration: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSImportEqualsDeclaration, - id: this.convertChild(node.name), - moduleReference: this.convertChild(node.moduleReference), - isExport: node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node), - }); - } - case SyntaxKind.ExternalModuleReference: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSExternalModuleReference, - expression: this.convertChild(node.expression), - }); - } - case SyntaxKind.NamespaceExportDeclaration: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSNamespaceExportDeclaration, - id: this.convertChild(node.name), - }); - } - case SyntaxKind.AbstractKeyword: { - return this.createNode(node, { - type: ts_estree_1.AST_NODE_TYPES.TSAbstractKeyword, - }); - } - default: - return this.deeplyCopy(node); } - } -} -exports.Converter = Converter; -//# sourceMappingURL=convert.js.map + }, + Format +); + /***/ }), /* 515 */, @@ -82417,8 +80381,120 @@ module.exports.Collection = Hook.Collection /***/ }), -/* 524 */, -/* 525 */, +/* 524 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + + +module.exports = __webpack_require__(316).default; + + +/***/ }), +/* 525 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = __importStar(__webpack_require__(752)); +/** + * By default, diagnostics from the TypeScript compiler contain all errors - regardless of whether + * they are related to generic ECMAScript standards, or TypeScript-specific constructs. + * + * Therefore, we filter out all diagnostics, except for the ones we explicitly want to consider when + * the user opts in to throwing errors on semantic issues. + */ +function getFirstSemanticOrSyntacticError(program, ast) { + try { + const supportedSyntacticDiagnostics = whitelistSupportedDiagnostics(program.getSyntacticDiagnostics(ast)); + if (supportedSyntacticDiagnostics.length) { + return convertDiagnosticToSemanticOrSyntacticError(supportedSyntacticDiagnostics[0]); + } + const supportedSemanticDiagnostics = whitelistSupportedDiagnostics(program.getSemanticDiagnostics(ast)); + if (supportedSemanticDiagnostics.length) { + return convertDiagnosticToSemanticOrSyntacticError(supportedSemanticDiagnostics[0]); + } + return undefined; + } + catch (e) { + /** + * TypeScript compiler has certain Debug.fail() statements in, which will cause the diagnostics + * retrieval above to throw. + * + * E.g. from ast-alignment-tests + * "Debug Failure. Shouldn't ever directly check a JsxOpeningElement" + * + * For our current use-cases this is undesired behavior, so we just suppress it + * and log a a warning. + */ + /* istanbul ignore next */ + console.warn(`Warning From TSC: "${e.message}`); // eslint-disable-line no-console + /* istanbul ignore next */ + return undefined; + } +} +exports.getFirstSemanticOrSyntacticError = getFirstSemanticOrSyntacticError; +function whitelistSupportedDiagnostics(diagnostics) { + return diagnostics.filter(diagnostic => { + switch (diagnostic.code) { + case 1013: // "A rest parameter or binding pattern may not have a trailing comma." + case 1014: // "A rest parameter must be last in a parameter list." + case 1044: // "'{0}' modifier cannot appear on a module or namespace element." + case 1045: // "A '{0}' modifier cannot be used with an interface declaration." + case 1048: // "A rest parameter cannot have an initializer." + case 1049: // "A 'set' accessor must have exactly one parameter." + case 1070: // "'{0}' modifier cannot appear on a type member." + case 1071: // "'{0}' modifier cannot appear on an index signature." + case 1085: // "Octal literals are not available when targeting ECMAScript 5 and higher. Use the syntax '{0}'." + case 1090: // "'{0}' modifier cannot appear on a parameter." + case 1096: // "An index signature must have exactly one parameter." + case 1097: // "'{0}' list cannot be empty." + case 1098: // "Type parameter list cannot be empty." + case 1099: // "Type argument list cannot be empty." + case 1117: // "An object literal cannot have multiple properties with the same name in strict mode." + case 1121: // "Octal literals are not allowed in strict mode." + case 1123: // "Variable declaration list cannot be empty." + case 1141: // "String literal expected." + case 1162: // "An object member cannot be declared optional." + case 1164: // "Computed property names are not allowed in enums." + case 1172: // "'extends' clause already seen." + case 1173: // "'extends' clause must precede 'implements' clause." + case 1175: // "'implements' clause already seen." + case 1176: // "Interface declaration cannot have 'implements' clause." + case 1190: // "The variable declaration of a 'for...of' statement cannot have an initializer." + case 1200: // "Line terminator not permitted before arrow." + case 1206: // "Decorators are not valid here." + case 1211: // "A class declaration without the 'default' modifier must have a name." + case 1242: // "'abstract' modifier can only appear on a class, method, or property declaration." + case 1246: // "An interface property cannot have an initializer." + case 1255: // "A definite assignment assertion '!' is not permitted in this context." + case 1308: // "'await' expression is only allowed within an async function." + case 2364: // "The left-hand side of an assignment expression must be a variable or a property access." + case 2369: // "A parameter property is only allowed in a constructor implementation." + case 2452: // "An enum member cannot have a numeric name." + case 2462: // "A rest element must be last in a destructuring pattern." + case 8017: // "Octal literal types must use ES2015 syntax. Use the syntax '{0}'." + case 17012: // "'{0}' is not a valid meta-property for keyword '{1}'. Did you mean '{2}'?" + case 17013: // "Meta-property '{0}' is only allowed in the body of a function declaration, function expression, or constructor." + return true; + } + return false; + }); +} +function convertDiagnosticToSemanticOrSyntacticError(diagnostic) { + return Object.assign(Object.assign({}, diagnostic), { message: ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine) }); +} +//# sourceMappingURL=semantic-or-syntactic-errors.js.map + +/***/ }), /* 526 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -82506,9 +80582,11 @@ exports.default = crc81wire; /* 528 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(570) -const eq = (a, b, loose) => compare(a, b, loose) === 0 -module.exports = eq +var core = __webpack_require__(222); + +module.exports = function isCore(x) { + return Object.prototype.hasOwnProperty.call(core, x); +}; /***/ }), @@ -82524,10 +80602,9 @@ module.exports = factory(); /* 530 */ /***/ (function(module, __unusedexports, __webpack_require__) { -// Determine if version is greater than all the versions possible in the range. -const outside = __webpack_require__(750) -const gtr = (version, range, options) => outside(version, range, '>', options) -module.exports = gtr +const compareBuild = __webpack_require__(50) +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort /***/ }), @@ -83763,7 +81840,15 @@ module.exports = function tokenize (input, options) { /***/ }), -/* 541 */, +/* 541 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const compare = __webpack_require__(340) +const eq = (a, b, loose) => compare(a, b, loose) === 0 +module.exports = eq + + +/***/ }), /* 542 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -83887,390 +81972,25 @@ module.exports.checkIsObject = typeCheck('object'); /* 546 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(570) +const compare = __webpack_require__(340) const lte = (a, b, loose) => compare(a, b, loose) <= 0 module.exports = lte /***/ }), /* 547 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module) { -"use strict"; +const debug = ( + typeof process === 'object' && + process.env && + process.env.NODE_DEBUG && + /\bsemver\b/i.test(process.env.NODE_DEBUG) +) ? (...args) => console.error('SEMVER', ...args) + : () => {} + +module.exports = debug -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -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)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug_1 = __importDefault(__webpack_require__(784)); -const fs_1 = __importDefault(__webpack_require__(747)); -const semver_1 = __importDefault(__webpack_require__(900)); -const ts = __importStar(__webpack_require__(752)); -const shared_1 = __webpack_require__(164); -const log = debug_1.default('typescript-eslint:typescript-estree:createWatchProgram'); -/** - * Maps tsconfig paths to their corresponding file contents and resulting watches - */ -const knownWatchProgramMap = new Map(); -/** - * Maps file/folder paths to their set of corresponding watch callbacks - * There may be more than one per file/folder if a file/folder is shared between projects - */ -const fileWatchCallbackTrackingMap = new Map(); -const folderWatchCallbackTrackingMap = new Map(); -/** - * Stores the list of known files for each program - */ -const programFileListCache = new Map(); -/** - * Caches the last modified time of the tsconfig files - */ -const tsconfigLastModifiedTimestampCache = new Map(); -const parsedFilesSeenHash = new Map(); -/** - * Clear all of the parser caches. - * This should only be used in testing to ensure the parser is clean between tests. - */ -function clearCaches() { - knownWatchProgramMap.clear(); - fileWatchCallbackTrackingMap.clear(); - folderWatchCallbackTrackingMap.clear(); - parsedFilesSeenHash.clear(); - programFileListCache.clear(); - tsconfigLastModifiedTimestampCache.clear(); -} -exports.clearCaches = clearCaches; -function saveWatchCallback(trackingMap) { - return (fileName, callback) => { - const normalizedFileName = shared_1.getCanonicalFileName(fileName); - const watchers = (() => { - let watchers = trackingMap.get(normalizedFileName); - if (!watchers) { - watchers = new Set(); - trackingMap.set(normalizedFileName, watchers); - } - return watchers; - })(); - watchers.add(callback); - return { - close: () => { - watchers.delete(callback); - }, - }; - }; -} -/** - * Holds information about the file currently being linted - */ -const currentLintOperationState = { - code: '', - filePath: '', -}; -/** - * Appropriately report issues found when reading a config file - * @param diagnostic The diagnostic raised when creating a program - */ -function diagnosticReporter(diagnostic) { - throw new Error(ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine)); -} -/** - * Hash content for compare content. - * @param content hashed contend - * @returns hashed result - */ -function createHash(content) { - // No ts.sys in browser environments. - if (ts.sys && ts.sys.createHash) { - return ts.sys.createHash(content); - } - return content; -} -/** - * Calculate project environments using options provided by consumer and paths from config - * @param code The code being linted - * @param filePathIn The path of the file being parsed - * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.projects Provided tsconfig paths - * @returns The programs corresponding to the supplied tsconfig paths - */ -function getProgramsForProjects(code, filePathIn, extra) { - const filePath = shared_1.getCanonicalFileName(filePathIn); - const results = []; - // preserve reference to code and file being linted - currentLintOperationState.code = code; - currentLintOperationState.filePath = filePath; - // Update file version if necessary - const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(filePath); - const codeHash = createHash(code); - if (parsedFilesSeenHash.get(filePath) !== codeHash && - fileWatchCallbacks && - fileWatchCallbacks.size > 0) { - fileWatchCallbacks.forEach(cb => cb(filePath, ts.FileWatcherEventKind.Changed)); - } - /* - * before we go into the process of attempting to find and update every program - * see if we know of a program that contains this file - */ - for (const rawTsconfigPath of extra.projects) { - const tsconfigPath = shared_1.getTsconfigPath(rawTsconfigPath, extra); - const existingWatch = knownWatchProgramMap.get(tsconfigPath); - if (!existingWatch) { - continue; - } - let fileList = programFileListCache.get(tsconfigPath); - let updatedProgram = null; - if (!fileList) { - updatedProgram = existingWatch.getProgram().getProgram(); - fileList = new Set(updatedProgram.getRootFileNames().map(f => shared_1.getCanonicalFileName(f))); - programFileListCache.set(tsconfigPath, fileList); - } - if (fileList.has(filePath)) { - log('Found existing program for file. %s', filePath); - updatedProgram = updatedProgram !== null && updatedProgram !== void 0 ? updatedProgram : existingWatch.getProgram().getProgram(); - // sets parent pointers in source files - updatedProgram.getTypeChecker(); - return [updatedProgram]; - } - } - log('File did not belong to any existing programs, moving to create/update. %s', filePath); - /* - * We don't know of a program that contains the file, this means that either: - * - the required program hasn't been created yet, or - * - the file is new/renamed, and the program hasn't been updated. - */ - for (const rawTsconfigPath of extra.projects) { - const tsconfigPath = shared_1.getTsconfigPath(rawTsconfigPath, extra); - const existingWatch = knownWatchProgramMap.get(tsconfigPath); - if (existingWatch) { - const updatedProgram = maybeInvalidateProgram(existingWatch, filePath, tsconfigPath); - if (!updatedProgram) { - continue; - } - // sets parent pointers in source files - updatedProgram.getTypeChecker(); - results.push(updatedProgram); - continue; - } - const programWatch = createWatchProgram(tsconfigPath, extra); - const program = programWatch.getProgram().getProgram(); - // cache watch program and return current program - knownWatchProgramMap.set(tsconfigPath, programWatch); - // sets parent pointers in source files - program.getTypeChecker(); - results.push(program); - } - return results; -} -exports.getProgramsForProjects = getProgramsForProjects; -const isRunningNoTimeoutFix = semver_1.default.satisfies(ts.version, '>=3.9.0-beta', { - includePrerelease: true, -}); -function createWatchProgram(tsconfigPath, extra) { - log('Creating watch program for %s.', tsconfigPath); - // create compiler host - const watchCompilerHost = ts.createWatchCompilerHost(tsconfigPath, shared_1.createDefaultCompilerOptionsFromExtra(extra), ts.sys, ts.createAbstractBuilder, diagnosticReporter, - /*reportWatchStatus*/ () => { }); - // ensure readFile reads the code being linted instead of the copy on disk - const oldReadFile = watchCompilerHost.readFile; - watchCompilerHost.readFile = (filePathIn, encoding) => { - const filePath = shared_1.getCanonicalFileName(filePathIn); - const fileContent = filePath === currentLintOperationState.filePath - ? currentLintOperationState.code - : oldReadFile(filePath, encoding); - if (fileContent !== undefined) { - parsedFilesSeenHash.set(filePath, createHash(fileContent)); - } - return fileContent; - }; - // ensure process reports error on failure instead of exiting process immediately - watchCompilerHost.onUnRecoverableConfigFileDiagnostic = diagnosticReporter; - // ensure process doesn't emit programs - watchCompilerHost.afterProgramCreate = (program) => { - // report error if there are any errors in the config file - const configFileDiagnostics = program - .getConfigFileParsingDiagnostics() - .filter(diag => diag.category === ts.DiagnosticCategory.Error && diag.code !== 18003); - if (configFileDiagnostics.length > 0) { - diagnosticReporter(configFileDiagnostics[0]); - } - }; - /* - * From the CLI, the file watchers won't matter, as the files will be parsed once and then forgotten. - * When running from an IDE, these watchers will let us tell typescript about changes. - * - * ESLint IDE plugins will send us unfinished file content as the user types (before it's saved to disk). - * We use the file watchers to tell typescript about this latest file content. - * - * When files are created (or renamed), we won't know about them because we have no filesystem watchers attached. - * We use the folder watchers to tell typescript it needs to go and find new files in the project folders. - */ - watchCompilerHost.watchFile = saveWatchCallback(fileWatchCallbackTrackingMap); - watchCompilerHost.watchDirectory = saveWatchCallback(folderWatchCallbackTrackingMap); - // allow files with custom extensions to be included in program (uses internal ts api) - const oldOnDirectoryStructureHostCreate = watchCompilerHost.onCachedDirectoryStructureHostCreate; - watchCompilerHost.onCachedDirectoryStructureHostCreate = (host) => { - const oldReadDirectory = host.readDirectory; - host.readDirectory = (path, extensions, exclude, include, depth) => oldReadDirectory(path, !extensions ? undefined : extensions.concat(extra.extraFileExtensions), exclude, include, depth); - oldOnDirectoryStructureHostCreate(host); - }; - // This works only on 3.9 - watchCompilerHost.extraFileExtensions = extra.extraFileExtensions.map(extension => ({ - extension, - isMixedContent: true, - scriptKind: ts.ScriptKind.Deferred, - })); - watchCompilerHost.trace = log; - // Since we don't want to asynchronously update program we want to disable timeout methods - // So any changes in the program will be delayed and updated when getProgram is called on watch - let callback; - if (isRunningNoTimeoutFix) { - watchCompilerHost.setTimeout = undefined; - watchCompilerHost.clearTimeout = undefined; - } - else { - log('Running without timeout fix'); - // But because of https://github.com/microsoft/TypeScript/pull/37308 we cannot just set it to undefined - // instead save it and call before getProgram is called - watchCompilerHost.setTimeout = (cb, _ms, ...args) => { - callback = cb.bind(/*this*/ undefined, ...args); - return callback; - }; - watchCompilerHost.clearTimeout = () => { - callback = undefined; - }; - } - const watch = ts.createWatchProgram(watchCompilerHost); - if (!isRunningNoTimeoutFix) { - const originalGetProgram = watch.getProgram; - watch.getProgram = () => { - if (callback) { - callback(); - } - callback = undefined; - return originalGetProgram.call(watch); - }; - } - return watch; -} -exports.createWatchProgram = createWatchProgram; -function hasTSConfigChanged(tsconfigPath) { - const stat = fs_1.default.statSync(tsconfigPath); - const lastModifiedAt = stat.mtimeMs; - const cachedLastModifiedAt = tsconfigLastModifiedTimestampCache.get(tsconfigPath); - tsconfigLastModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); - if (cachedLastModifiedAt === undefined) { - return false; - } - return Math.abs(cachedLastModifiedAt - lastModifiedAt) > Number.EPSILON; -} -function maybeInvalidateProgram(existingWatch, filePath, tsconfigPath) { - /* - * By calling watchProgram.getProgram(), it will trigger a resync of the program based on - * whatever new file content we've given it from our input. - */ - let updatedProgram = existingWatch.getProgram().getProgram(); - // In case this change causes problems in larger real world codebases - // Provide an escape hatch so people don't _have_ to revert to an older version - if (process.env.TSESTREE_NO_INVALIDATION === 'true') { - return updatedProgram; - } - if (hasTSConfigChanged(tsconfigPath)) { - /* - * If the stat of the tsconfig has changed, that could mean the include/exclude/files lists has changed - * We need to make sure typescript knows this so it can update appropriately - */ - log('tsconfig has changed - triggering program update. %s', tsconfigPath); - fileWatchCallbackTrackingMap - .get(tsconfigPath) - .forEach(cb => cb(tsconfigPath, ts.FileWatcherEventKind.Changed)); - // tsconfig change means that the file list more than likely changed, so clear the cache - programFileListCache.delete(tsconfigPath); - } - let sourceFile = updatedProgram.getSourceFile(filePath); - if (sourceFile) { - return updatedProgram; - } - /* - * Missing source file means our program's folder structure might be out of date. - * So we need to tell typescript it needs to update the correct folder. - */ - log('File was not found in program - triggering folder update. %s', filePath); - // Find the correct directory callback by climbing the folder tree - const currentDir = shared_1.canonicalDirname(filePath); - let current = null; - let next = currentDir; - let hasCallback = false; - while (current !== next) { - current = next; - const folderWatchCallbacks = folderWatchCallbackTrackingMap.get(current); - if (folderWatchCallbacks) { - folderWatchCallbacks.forEach(cb => { - if (currentDir !== current) { - cb(currentDir, ts.FileWatcherEventKind.Changed); - } - cb(current, ts.FileWatcherEventKind.Changed); - }); - hasCallback = true; - } - next = shared_1.canonicalDirname(current); - } - if (!hasCallback) { - /* - * No callback means the paths don't matchup - so no point returning any program - * this will signal to the caller to skip this program - */ - log('No callback found for file, not part of this program. %s', filePath); - return null; - } - // directory update means that the file list more than likely changed, so clear the cache - programFileListCache.delete(tsconfigPath); - // force the immediate resync - updatedProgram = existingWatch.getProgram().getProgram(); - sourceFile = updatedProgram.getSourceFile(filePath); - if (sourceFile) { - return updatedProgram; - } - /* - * At this point we're in one of two states: - * - The file isn't supposed to be in this program due to exclusions - * - The file is new, and was renamed from an old, included filename - * - * For the latter case, we need to tell typescript that the old filename is now deleted - */ - log('File was still not found in program after directory update - checking file deletions. %s', filePath); - const rootFilenames = updatedProgram.getRootFileNames(); - // use find because we only need to "delete" one file to cause typescript to do a full resync - const deletedFile = rootFilenames.find(file => !fs_1.default.existsSync(file)); - if (!deletedFile) { - // There are no deleted files, so it must be the former case of the file not belonging to this program - return null; - } - const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(shared_1.getCanonicalFileName(deletedFile)); - if (!fileWatchCallbacks) { - // shouldn't happen, but just in case - log('Could not find watch callbacks for root file. %s', deletedFile); - return updatedProgram; - } - log('Marking file as deleted. %s', deletedFile); - fileWatchCallbacks.forEach(cb => cb(deletedFile, ts.FileWatcherEventKind.Deleted)); - // deleted files means that the file list _has_ changed, so clear the cache - programFileListCache.delete(tsconfigPath); - updatedProgram = existingWatch.getProgram().getProgram(); - sourceFile = updatedProgram.getSourceFile(filePath); - if (sourceFile) { - return updatedProgram; - } - log('File was still not found in program after deletion check, assuming it is not part of this program. %s', filePath); - return null; -} -//# sourceMappingURL=createWatchProgram.js.map /***/ }), /* 548 */, @@ -84293,7 +82013,52 @@ function getNextPage (octokit, link, headers) { /* 553 */, /* 554 */, /* 555 */, -/* 556 */, +/* 556 */ +/***/ (function(module, exports) { + +"use strict"; + + +const blacklist = [ + // # All + '^npm-debug\\.log$', // Error log for npm + '^\\..*\\.swp$', // Swap file for vim state + + // # macOS + '^\\.DS_Store$', // Stores custom folder attributes + '^\\.AppleDouble$', // Stores additional file resources + '^\\.LSOverride$', // Contains the absolute path to the app to be used + '^Icon\\r$', // Custom Finder icon: http://superuser.com/questions/298785/icon-file-on-os-x-desktop + '^\\._.*', // Thumbnail + '^\\.Spotlight-V100(?:$|\\/)', // Directory that might appear on external disk + '\\.Trashes', // File that might appear on external disk + '^__MACOSX$', // Resource fork + + // # Linux + '~$', // Backup file + + // # Windows + '^Thumbs\\.db$', // Image file cache + '^ehthumbs\\.db$', // Folder config file + '^Desktop\\.ini$', // Stores custom folder attributes + '@eaDir$' // Synology Diskstation "hidden" folder where the server stores thumbnails +]; + +exports.re = () => { + throw new Error('`junk.re` was renamed to `junk.regex`'); +}; + +exports.regex = new RegExp(blacklist.join('|')); + +exports.is = filename => exports.regex.test(filename); + +exports.not = filename => !exports.is(filename); + +// TODO: Remove this for the next major release +exports.default = module.exports; + + +/***/ }), /* 557 */, /* 558 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -85000,13 +82765,31 @@ exports.quickSort = function (ary, comparator) { /***/ }), /* 570 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(module) { -const SemVer = __webpack_require__(243) -const compare = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)) +const numeric = /^[0-9]+$/ +const compareIdentifiers = (a, b) => { + const anum = numeric.test(a) + const bnum = numeric.test(b) -module.exports = compare + if (anum && bnum) { + a = +a + b = +b + } + + return a === b ? 0 + : (anum && !bnum) ? -1 + : (bnum && !anum) ? 1 + : a < b ? -1 + : 1 +} + +const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) + +module.exports = { + compareIdentifiers, + rcompareIdentifiers +} /***/ }), @@ -85607,7 +83390,7 @@ function getPageLinks (link) { const Range = __webpack_require__(635) const { ANY } = __webpack_require__(456) const satisfies = __webpack_require__(171) -const compare = __webpack_require__(570) +const compare = __webpack_require__(340) // Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: // - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...` @@ -86528,14 +84311,45 @@ module.exports = function IsRegExp(argument) { /***/ }), /* 583 */, /* 584 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; +const {MAX_LENGTH} = __webpack_require__(699) +const { re, t } = __webpack_require__(408) +const SemVer = __webpack_require__(734) -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = __webpack_require__(259); -tslib_1.__exportStar(__webpack_require__(341), exports); -tslib_1.__exportStar(__webpack_require__(179), exports); +const parse = (version, options) => { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (version instanceof SemVer) { + return version + } + + if (typeof version !== 'string') { + return null + } + + if (version.length > MAX_LENGTH) { + return null + } + + const r = options.loose ? re[t.LOOSE] : re[t.FULL] + if (!r.test(version)) { + return null + } + + try { + return new SemVer(version, options) + } catch (er) { + return null + } +} + +module.exports = parse /***/ }), @@ -86764,9 +84578,16 @@ module.exports = exports.default; /* 586 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(570) -const rcompare = (a, b, loose) => compare(b, a, loose) -module.exports = rcompare +const Range = __webpack_require__(33) +const satisfies = (version, range, options) => { + try { + range = new Range(range, options) + } catch (er) { + return false + } + return range.test(version) +} +module.exports = satisfies /***/ }), @@ -87481,201 +85302,20 @@ exports.SourceNode = SourceNode; /***/ }), -/* 589 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const outside = __webpack_require__(750) -// Determine if version is less than all the versions possible in the range -const ltr = (version, range, options) => outside(version, range, '<', options) -module.exports = ltr - - -/***/ }), +/* 589 */, /* 590 */ -/***/ (function(module, exports, __webpack_require__) { - -const { MAX_SAFE_COMPONENT_LENGTH } = __webpack_require__(627) -const debug = __webpack_require__(487) -exports = module.exports = {} - -// The actual regexps go on exports.re -const re = exports.re = [] -const src = exports.src = [] -const t = exports.t = {} -let R = 0 - -const createToken = (name, value, isGlobal) => { - const index = R++ - debug(index, value) - t[name] = index - src[index] = value - re[index] = new RegExp(value, isGlobal ? 'g' : undefined) -} - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') -createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') - -// ## Main Version -// Three dot-separated numeric identifiers. - -createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})\\.` + - `(${src[t.NUMERICIDENTIFIER]})`) - -createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + - `(${src[t.NUMERICIDENTIFIERLOOSE]})`) - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] -}|${src[t.NONNUMERICIDENTIFIER]})`) - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] -}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) - -createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] -}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] -}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -createToken('FULLPLAIN', `v?${src[t.MAINVERSION] -}${src[t.PRERELEASE]}?${ - src[t.BUILD]}?`) - -createToken('FULL', `^${src[t.FULLPLAIN]}$`) - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] -}${src[t.PRERELEASELOOSE]}?${ - src[t.BUILD]}?`) - -createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) - -createToken('GTLT', '((?:<|>)?=?)') - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) -createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) - -createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + - `(?:${src[t.PRERELEASE]})?${ - src[t.BUILD]}?` + - `)?)?`) - -createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + - `(?:${src[t.PRERELEASELOOSE]})?${ - src[t.BUILD]}?` + - `)?)?`) - -createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) -createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -createToken('COERCE', `${'(^|[^\\d])' + - '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + - `(?:$|[^\\d])`) -createToken('COERCERTL', src[t.COERCE], true) - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -createToken('LONETILDE', '(?:~>?)') - -createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) -exports.tildeTrimReplace = '$1~' - -createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) -createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -createToken('LONECARET', '(?:\\^)') - -createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) -exports.caretTrimReplace = '$1^' - -createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) -createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) - -// A simple gt/lt/eq thing, or just "" to indicate "any version" -createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) -createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) - -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] -}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) -exports.comparatorTrimReplace = '$1$2$3' - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAIN]})` + - `\\s*$`) +/***/ (function(module) { -createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + - `\\s+-\\s+` + - `(${src[t.XRANGEPLAINLOOSE]})` + - `\\s*$`) +module.exports = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ -// Star ranges basically just allow anything at all. -createToken('STAR', '(<|>)?=?\\s*\\*') -// >=0.0.0 is like a star -createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') -createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') + return opts || {}; +}; /***/ }), @@ -87900,284 +85540,7 @@ function done(stream, er, data) { } /***/ }), -/* 593 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -var utils = __webpack_require__(733); -var formats = __webpack_require__(859); -var has = Object.prototype.hasOwnProperty; - -var arrayPrefixGenerators = { - brackets: function brackets(prefix) { - return prefix + '[]'; - }, - comma: 'comma', - indices: function indices(prefix, key) { - return prefix + '[' + key + ']'; - }, - repeat: function repeat(prefix) { - return prefix; - } -}; - -var isArray = Array.isArray; -var push = Array.prototype.push; -var pushToArray = function (arr, valueOrArray) { - push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); -}; - -var toISO = Date.prototype.toISOString; - -var defaultFormat = formats['default']; -var defaults = { - addQueryPrefix: false, - allowDots: false, - charset: 'utf-8', - charsetSentinel: false, - delimiter: '&', - encode: true, - encoder: utils.encode, - encodeValuesOnly: false, - format: defaultFormat, - formatter: formats.formatters[defaultFormat], - // deprecated - indices: false, - serializeDate: function serializeDate(date) { - return toISO.call(date); - }, - skipNulls: false, - strictNullHandling: false -}; - -var isNonNullishPrimitive = function isNonNullishPrimitive(v) { - return typeof v === 'string' - || typeof v === 'number' - || typeof v === 'boolean' - || typeof v === 'symbol' - || typeof v === 'bigint'; -}; - -var stringify = function stringify( - object, - prefix, - generateArrayPrefix, - strictNullHandling, - skipNulls, - encoder, - filter, - sort, - allowDots, - serializeDate, - formatter, - encodeValuesOnly, - charset -) { - var obj = object; - if (typeof filter === 'function') { - obj = filter(prefix, obj); - } else if (obj instanceof Date) { - obj = serializeDate(obj); - } else if (generateArrayPrefix === 'comma' && isArray(obj)) { - obj = utils.maybeMap(obj, function (value) { - if (value instanceof Date) { - return serializeDate(value); - } - return value; - }).join(','); - } - - if (obj === null) { - if (strictNullHandling) { - return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key') : prefix; - } - - obj = ''; - } - - if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { - if (encoder) { - var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key'); - return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value'))]; - } - return [formatter(prefix) + '=' + formatter(String(obj))]; - } - - var values = []; - - if (typeof obj === 'undefined') { - return values; - } - - var objKeys; - if (isArray(filter)) { - objKeys = filter; - } else { - var keys = Object.keys(obj); - objKeys = sort ? keys.sort(sort) : keys; - } - - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - var value = obj[key]; - - if (skipNulls && value === null) { - continue; - } - - var keyPrefix = isArray(obj) - ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix - : prefix + (allowDots ? '.' + key : '[' + key + ']'); - - pushToArray(values, stringify( - value, - keyPrefix, - generateArrayPrefix, - strictNullHandling, - skipNulls, - encoder, - filter, - sort, - allowDots, - serializeDate, - formatter, - encodeValuesOnly, - charset - )); - } - - return values; -}; - -var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { - if (!opts) { - return defaults; - } - - if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') { - throw new TypeError('Encoder has to be a function.'); - } - - var charset = opts.charset || defaults.charset; - if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { - throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); - } - - var format = formats['default']; - if (typeof opts.format !== 'undefined') { - if (!has.call(formats.formatters, opts.format)) { - throw new TypeError('Unknown format option provided.'); - } - format = opts.format; - } - var formatter = formats.formatters[format]; - - var filter = defaults.filter; - if (typeof opts.filter === 'function' || isArray(opts.filter)) { - filter = opts.filter; - } - - return { - addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, - allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, - charset: charset, - charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, - delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, - encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, - encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, - encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, - filter: filter, - formatter: formatter, - serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate, - skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls, - sort: typeof opts.sort === 'function' ? opts.sort : null, - strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling - }; -}; - -module.exports = function (object, opts) { - var obj = object; - var options = normalizeStringifyOptions(opts); - - var objKeys; - var filter; - - if (typeof options.filter === 'function') { - filter = options.filter; - obj = filter('', obj); - } else if (isArray(options.filter)) { - filter = options.filter; - objKeys = filter; - } - - var keys = []; - - if (typeof obj !== 'object' || obj === null) { - return ''; - } - - var arrayFormat; - if (opts && opts.arrayFormat in arrayPrefixGenerators) { - arrayFormat = opts.arrayFormat; - } else if (opts && 'indices' in opts) { - arrayFormat = opts.indices ? 'indices' : 'repeat'; - } else { - arrayFormat = 'indices'; - } - - var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; - - if (!objKeys) { - objKeys = Object.keys(obj); - } - - if (options.sort) { - objKeys.sort(options.sort); - } - - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - - if (options.skipNulls && obj[key] === null) { - continue; - } - pushToArray(keys, stringify( - obj[key], - key, - generateArrayPrefix, - options.strictNullHandling, - options.skipNulls, - options.encode ? options.encoder : null, - options.filter, - options.sort, - options.allowDots, - options.serializeDate, - options.formatter, - options.encodeValuesOnly, - options.charset - )); - } - - var joined = keys.join(options.delimiter); - var prefix = options.addQueryPrefix === true ? '?' : ''; - - if (options.charsetSentinel) { - if (options.charset === 'iso-8859-1') { - // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark - prefix += 'utf8=%26%2310003%3B&'; - } else { - // encodeURIComponent('✓') - prefix += 'utf8=%E2%9C%93&'; - } - } - - return joined.length > 0 ? prefix + joined : ''; -}; - - -/***/ }), +/* 593 */, /* 594 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -88193,9 +85556,9 @@ module.exports = __webpack_require__(807).PassThrough "use strict"; -var stringify = __webpack_require__(593); -var parse = __webpack_require__(997); -var formats = __webpack_require__(859); +var stringify = __webpack_require__(853); +var parse = __webpack_require__(401); +var formats = __webpack_require__(514); module.exports = { formats: formats, @@ -88804,7 +86167,35 @@ module.exports = __webpack_require__(339).default; /***/ }), -/* 600 */, +/* 600 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const debug_1 = __importDefault(__webpack_require__(784)); +const ts = __importStar(__webpack_require__(752)); +const shared_1 = __webpack_require__(769); +const log = debug_1.default('typescript-eslint:typescript-estree:createSourceFile'); +function createSourceFile(code, extra) { + log('Getting AST without type information in %s mode for: %s', extra.jsx ? 'TSX' : 'TS', extra.filePath); + return ts.createSourceFile(extra.filePath, code, ts.ScriptTarget.Latest, + /* setParentNodes */ true, shared_1.getScriptKind(extra)); +} +exports.createSourceFile = createSourceFile; +//# sourceMappingURL=createSourceFile.js.map + +/***/ }), /* 601 */, /* 602 */ /***/ (function(module) { @@ -88983,7 +86374,16 @@ module.exports = FunctionNode; /***/ }), -/* 607 */, +/* 607 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +// Determine if version is greater than all the versions possible in the range. +const outside = __webpack_require__(97) +const gtr = (version, range, options) => outside(version, range, '>', options) +module.exports = gtr + + +/***/ }), /* 608 */ /***/ (function(module) { @@ -89010,29 +86410,397 @@ function clone (obj) { /***/ }), -/* 609 */ +/* 609 */, +/* 610 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const parse = __webpack_require__(658) -const prerelease = (version, options) => { - const parsed = parse(version, options) - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null +const SemVer = __webpack_require__(243) +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor + + +/***/ }), +/* 611 */, +/* 612 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const debug_1 = __importDefault(__webpack_require__(784)); +const fs_1 = __importDefault(__webpack_require__(747)); +const semver_1 = __importDefault(__webpack_require__(406)); +const ts = __importStar(__webpack_require__(752)); +const shared_1 = __webpack_require__(769); +const log = debug_1.default('typescript-eslint:typescript-estree:createWatchProgram'); +/** + * Maps tsconfig paths to their corresponding file contents and resulting watches + */ +const knownWatchProgramMap = new Map(); +/** + * Maps file/folder paths to their set of corresponding watch callbacks + * There may be more than one per file/folder if a file/folder is shared between projects + */ +const fileWatchCallbackTrackingMap = new Map(); +const folderWatchCallbackTrackingMap = new Map(); +/** + * Stores the list of known files for each program + */ +const programFileListCache = new Map(); +/** + * Caches the last modified time of the tsconfig files + */ +const tsconfigLastModifiedTimestampCache = new Map(); +const parsedFilesSeenHash = new Map(); +/** + * Clear all of the parser caches. + * This should only be used in testing to ensure the parser is clean between tests. + */ +function clearCaches() { + knownWatchProgramMap.clear(); + fileWatchCallbackTrackingMap.clear(); + folderWatchCallbackTrackingMap.clear(); + parsedFilesSeenHash.clear(); + programFileListCache.clear(); + tsconfigLastModifiedTimestampCache.clear(); +} +exports.clearCaches = clearCaches; +function saveWatchCallback(trackingMap) { + return (fileName, callback) => { + const normalizedFileName = shared_1.getCanonicalFileName(fileName); + const watchers = (() => { + let watchers = trackingMap.get(normalizedFileName); + if (!watchers) { + watchers = new Set(); + trackingMap.set(normalizedFileName, watchers); + } + return watchers; + })(); + watchers.add(callback); + return { + close: () => { + watchers.delete(callback); + }, + }; + }; +} +/** + * Holds information about the file currently being linted + */ +const currentLintOperationState = { + code: '', + filePath: '', +}; +/** + * Appropriately report issues found when reading a config file + * @param diagnostic The diagnostic raised when creating a program + */ +function diagnosticReporter(diagnostic) { + throw new Error(ts.flattenDiagnosticMessageText(diagnostic.messageText, ts.sys.newLine)); +} +/** + * Hash content for compare content. + * @param content hashed contend + * @returns hashed result + */ +function createHash(content) { + // No ts.sys in browser environments. + if (ts.sys && ts.sys.createHash) { + return ts.sys.createHash(content); + } + return content; +} +/** + * Calculate project environments using options provided by consumer and paths from config + * @param code The code being linted + * @param filePathIn The path of the file being parsed + * @param extra.tsconfigRootDir The root directory for relative tsconfig paths + * @param extra.projects Provided tsconfig paths + * @returns The programs corresponding to the supplied tsconfig paths + */ +function getProgramsForProjects(code, filePathIn, extra) { + const filePath = shared_1.getCanonicalFileName(filePathIn); + const results = []; + // preserve reference to code and file being linted + currentLintOperationState.code = code; + currentLintOperationState.filePath = filePath; + // Update file version if necessary + const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(filePath); + const codeHash = createHash(code); + if (parsedFilesSeenHash.get(filePath) !== codeHash && + fileWatchCallbacks && + fileWatchCallbacks.size > 0) { + fileWatchCallbacks.forEach(cb => cb(filePath, ts.FileWatcherEventKind.Changed)); + } + /* + * before we go into the process of attempting to find and update every program + * see if we know of a program that contains this file + */ + for (const rawTsconfigPath of extra.projects) { + const tsconfigPath = shared_1.getTsconfigPath(rawTsconfigPath, extra); + const existingWatch = knownWatchProgramMap.get(tsconfigPath); + if (!existingWatch) { + continue; + } + let fileList = programFileListCache.get(tsconfigPath); + let updatedProgram = null; + if (!fileList) { + updatedProgram = existingWatch.getProgram().getProgram(); + fileList = new Set(updatedProgram.getRootFileNames().map(f => shared_1.getCanonicalFileName(f))); + programFileListCache.set(tsconfigPath, fileList); + } + if (fileList.has(filePath)) { + log('Found existing program for file. %s', filePath); + updatedProgram = updatedProgram !== null && updatedProgram !== void 0 ? updatedProgram : existingWatch.getProgram().getProgram(); + // sets parent pointers in source files + updatedProgram.getTypeChecker(); + return [updatedProgram]; + } + } + log('File did not belong to any existing programs, moving to create/update. %s', filePath); + /* + * We don't know of a program that contains the file, this means that either: + * - the required program hasn't been created yet, or + * - the file is new/renamed, and the program hasn't been updated. + */ + for (const rawTsconfigPath of extra.projects) { + const tsconfigPath = shared_1.getTsconfigPath(rawTsconfigPath, extra); + const existingWatch = knownWatchProgramMap.get(tsconfigPath); + if (existingWatch) { + const updatedProgram = maybeInvalidateProgram(existingWatch, filePath, tsconfigPath); + if (!updatedProgram) { + continue; + } + // sets parent pointers in source files + updatedProgram.getTypeChecker(); + results.push(updatedProgram); + continue; + } + const programWatch = createWatchProgram(tsconfigPath, extra); + const program = programWatch.getProgram().getProgram(); + // cache watch program and return current program + knownWatchProgramMap.set(tsconfigPath, programWatch); + // sets parent pointers in source files + program.getTypeChecker(); + results.push(program); + } + return results; +} +exports.getProgramsForProjects = getProgramsForProjects; +const isRunningNoTimeoutFix = semver_1.default.satisfies(ts.version, '>=3.9.0-beta', { + includePrerelease: true, +}); +function createWatchProgram(tsconfigPath, extra) { + log('Creating watch program for %s.', tsconfigPath); + // create compiler host + const watchCompilerHost = ts.createWatchCompilerHost(tsconfigPath, shared_1.createDefaultCompilerOptionsFromExtra(extra), ts.sys, ts.createAbstractBuilder, diagnosticReporter, + /*reportWatchStatus*/ () => { }); + // ensure readFile reads the code being linted instead of the copy on disk + const oldReadFile = watchCompilerHost.readFile; + watchCompilerHost.readFile = (filePathIn, encoding) => { + const filePath = shared_1.getCanonicalFileName(filePathIn); + const fileContent = filePath === currentLintOperationState.filePath + ? currentLintOperationState.code + : oldReadFile(filePath, encoding); + if (fileContent !== undefined) { + parsedFilesSeenHash.set(filePath, createHash(fileContent)); + } + return fileContent; + }; + // ensure process reports error on failure instead of exiting process immediately + watchCompilerHost.onUnRecoverableConfigFileDiagnostic = diagnosticReporter; + // ensure process doesn't emit programs + watchCompilerHost.afterProgramCreate = (program) => { + // report error if there are any errors in the config file + const configFileDiagnostics = program + .getConfigFileParsingDiagnostics() + .filter(diag => diag.category === ts.DiagnosticCategory.Error && diag.code !== 18003); + if (configFileDiagnostics.length > 0) { + diagnosticReporter(configFileDiagnostics[0]); + } + }; + /* + * From the CLI, the file watchers won't matter, as the files will be parsed once and then forgotten. + * When running from an IDE, these watchers will let us tell typescript about changes. + * + * ESLint IDE plugins will send us unfinished file content as the user types (before it's saved to disk). + * We use the file watchers to tell typescript about this latest file content. + * + * When files are created (or renamed), we won't know about them because we have no filesystem watchers attached. + * We use the folder watchers to tell typescript it needs to go and find new files in the project folders. + */ + watchCompilerHost.watchFile = saveWatchCallback(fileWatchCallbackTrackingMap); + watchCompilerHost.watchDirectory = saveWatchCallback(folderWatchCallbackTrackingMap); + // allow files with custom extensions to be included in program (uses internal ts api) + const oldOnDirectoryStructureHostCreate = watchCompilerHost.onCachedDirectoryStructureHostCreate; + watchCompilerHost.onCachedDirectoryStructureHostCreate = (host) => { + const oldReadDirectory = host.readDirectory; + host.readDirectory = (path, extensions, exclude, include, depth) => oldReadDirectory(path, !extensions ? undefined : extensions.concat(extra.extraFileExtensions), exclude, include, depth); + oldOnDirectoryStructureHostCreate(host); + }; + // This works only on 3.9 + watchCompilerHost.extraFileExtensions = extra.extraFileExtensions.map(extension => ({ + extension, + isMixedContent: true, + scriptKind: ts.ScriptKind.Deferred, + })); + watchCompilerHost.trace = log; + // Since we don't want to asynchronously update program we want to disable timeout methods + // So any changes in the program will be delayed and updated when getProgram is called on watch + let callback; + if (isRunningNoTimeoutFix) { + watchCompilerHost.setTimeout = undefined; + watchCompilerHost.clearTimeout = undefined; + } + else { + log('Running without timeout fix'); + // But because of https://github.com/microsoft/TypeScript/pull/37308 we cannot just set it to undefined + // instead save it and call before getProgram is called + watchCompilerHost.setTimeout = (cb, _ms, ...args) => { + callback = cb.bind(/*this*/ undefined, ...args); + return callback; + }; + watchCompilerHost.clearTimeout = () => { + callback = undefined; + }; + } + const watch = ts.createWatchProgram(watchCompilerHost); + if (!isRunningNoTimeoutFix) { + const originalGetProgram = watch.getProgram; + watch.getProgram = () => { + if (callback) { + callback(); + } + callback = undefined; + return originalGetProgram.call(watch); + }; + } + return watch; +} +exports.createWatchProgram = createWatchProgram; +function hasTSConfigChanged(tsconfigPath) { + const stat = fs_1.default.statSync(tsconfigPath); + const lastModifiedAt = stat.mtimeMs; + const cachedLastModifiedAt = tsconfigLastModifiedTimestampCache.get(tsconfigPath); + tsconfigLastModifiedTimestampCache.set(tsconfigPath, lastModifiedAt); + if (cachedLastModifiedAt === undefined) { + return false; + } + return Math.abs(cachedLastModifiedAt - lastModifiedAt) > Number.EPSILON; +} +function maybeInvalidateProgram(existingWatch, filePath, tsconfigPath) { + /* + * By calling watchProgram.getProgram(), it will trigger a resync of the program based on + * whatever new file content we've given it from our input. + */ + let updatedProgram = existingWatch.getProgram().getProgram(); + // In case this change causes problems in larger real world codebases + // Provide an escape hatch so people don't _have_ to revert to an older version + if (process.env.TSESTREE_NO_INVALIDATION === 'true') { + return updatedProgram; + } + if (hasTSConfigChanged(tsconfigPath)) { + /* + * If the stat of the tsconfig has changed, that could mean the include/exclude/files lists has changed + * We need to make sure typescript knows this so it can update appropriately + */ + log('tsconfig has changed - triggering program update. %s', tsconfigPath); + fileWatchCallbackTrackingMap + .get(tsconfigPath) + .forEach(cb => cb(tsconfigPath, ts.FileWatcherEventKind.Changed)); + // tsconfig change means that the file list more than likely changed, so clear the cache + programFileListCache.delete(tsconfigPath); + } + let sourceFile = updatedProgram.getSourceFile(filePath); + if (sourceFile) { + return updatedProgram; + } + /* + * Missing source file means our program's folder structure might be out of date. + * So we need to tell typescript it needs to update the correct folder. + */ + log('File was not found in program - triggering folder update. %s', filePath); + // Find the correct directory callback by climbing the folder tree + const currentDir = shared_1.canonicalDirname(filePath); + let current = null; + let next = currentDir; + let hasCallback = false; + while (current !== next) { + current = next; + const folderWatchCallbacks = folderWatchCallbackTrackingMap.get(current); + if (folderWatchCallbacks) { + folderWatchCallbacks.forEach(cb => { + if (currentDir !== current) { + cb(currentDir, ts.FileWatcherEventKind.Changed); + } + cb(current, ts.FileWatcherEventKind.Changed); + }); + hasCallback = true; + } + next = shared_1.canonicalDirname(current); + } + if (!hasCallback) { + /* + * No callback means the paths don't matchup - so no point returning any program + * this will signal to the caller to skip this program + */ + log('No callback found for file, not part of this program. %s', filePath); + return null; + } + // directory update means that the file list more than likely changed, so clear the cache + programFileListCache.delete(tsconfigPath); + // force the immediate resync + updatedProgram = existingWatch.getProgram().getProgram(); + sourceFile = updatedProgram.getSourceFile(filePath); + if (sourceFile) { + return updatedProgram; + } + /* + * At this point we're in one of two states: + * - The file isn't supposed to be in this program due to exclusions + * - The file is new, and was renamed from an old, included filename + * + * For the latter case, we need to tell typescript that the old filename is now deleted + */ + log('File was still not found in program after directory update - checking file deletions. %s', filePath); + const rootFilenames = updatedProgram.getRootFileNames(); + // use find because we only need to "delete" one file to cause typescript to do a full resync + const deletedFile = rootFilenames.find(file => !fs_1.default.existsSync(file)); + if (!deletedFile) { + // There are no deleted files, so it must be the former case of the file not belonging to this program + return null; + } + const fileWatchCallbacks = fileWatchCallbackTrackingMap.get(shared_1.getCanonicalFileName(deletedFile)); + if (!fileWatchCallbacks) { + // shouldn't happen, but just in case + log('Could not find watch callbacks for root file. %s', deletedFile); + return updatedProgram; + } + log('Marking file as deleted. %s', deletedFile); + fileWatchCallbacks.forEach(cb => cb(deletedFile, ts.FileWatcherEventKind.Deleted)); + // deleted files means that the file list _has_ changed, so clear the cache + programFileListCache.delete(tsconfigPath); + updatedProgram = existingWatch.getProgram().getProgram(); + sourceFile = updatedProgram.getSourceFile(filePath); + if (sourceFile) { + return updatedProgram; + } + log('File was still not found in program after deletion check, assuming it is not part of this program. %s', filePath); + return null; } -module.exports = prerelease - - -/***/ }), -/* 610 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SemVer = __webpack_require__(243) -const minor = (a, loose) => new SemVer(a, loose).minor -module.exports = minor - +//# sourceMappingURL=createWatchProgram.js.map /***/ }), -/* 611 */, -/* 612 */, /* 613 */ /***/ (function(module) { @@ -89183,15 +86951,7 @@ module.exports = require("events"); /* 615 */, /* 616 */, /* 617 */, -/* 618 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const compare = __webpack_require__(682) -const gte = (a, b, loose) => compare(a, b, loose) >= 0 -module.exports = gte - - -/***/ }), +/* 618 */, /* 619 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -89274,7 +87034,15 @@ module.exports.env = opts => { module.exports = require("path"); /***/ }), -/* 623 */, +/* 623 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SemVer = __webpack_require__(734) +const patch = (a, loose) => new SemVer(a, loose).patch +module.exports = patch + + +/***/ }), /* 624 */, /* 625 */, /* 626 */ @@ -89285,26 +87053,419 @@ module.exports = __webpack_require__(413); /***/ }), /* 627 */ -/***/ (function(module) { - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0' - -const MAX_LENGTH = 256 -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 +/***/ (function(__unusedmodule, exports, __webpack_require__) { -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16 +"use strict"; -module.exports = { - SEMVER_SPEC_VERSION, - MAX_LENGTH, - MAX_SAFE_INTEGER, - MAX_SAFE_COMPONENT_LENGTH +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; } - +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const debug_1 = __importDefault(__webpack_require__(784)); +const glob_1 = __webpack_require__(120); +const is_glob_1 = __importDefault(__webpack_require__(846)); +const semver_1 = __importDefault(__webpack_require__(406)); +const ts = __importStar(__webpack_require__(752)); +const ast_converter_1 = __webpack_require__(781); +const convert_1 = __webpack_require__(703); +const createDefaultProgram_1 = __webpack_require__(162); +const createIsolatedProgram_1 = __webpack_require__(894); +const createProjectProgram_1 = __webpack_require__(255); +const createSourceFile_1 = __webpack_require__(600); +const semantic_or_syntactic_errors_1 = __webpack_require__(525); +const shared_1 = __webpack_require__(769); +const log = debug_1.default('typescript-eslint:typescript-estree:parser'); +/** + * This needs to be kept in sync with the top-level README.md in the + * typescript-eslint monorepo + */ +const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0'; +/* + * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one + * List them all separately here, so we can automatically create the full string + */ +const SUPPORTED_PRERELEASE_RANGES = ['>3.7.0-dev.0', '3.7.1-rc']; +const ACTIVE_TYPESCRIPT_VERSION = ts.version; +const isRunningSupportedTypeScriptVersion = semver_1.default.satisfies(ACTIVE_TYPESCRIPT_VERSION, [SUPPORTED_TYPESCRIPT_VERSIONS] + .concat(SUPPORTED_PRERELEASE_RANGES) + .join(' || ')); +let extra; +let warnedAboutTSVersion = false; +function enforceString(code) { + /** + * Ensure the source code is a string + */ + if (typeof code !== 'string') { + return String(code); + } + return code; +} +/** + * @param code The code of the file being linted + * @param shouldProvideParserServices True if the program should be attempted to be calculated from provided tsconfig files + * @param shouldCreateDefaultProgram True if the program should be created from compiler host + * @returns Returns a source file and program corresponding to the linted code + */ +function getProgramAndAST(code, shouldProvideParserServices, shouldCreateDefaultProgram) { + return ((shouldProvideParserServices && + createProjectProgram_1.createProjectProgram(code, shouldCreateDefaultProgram, extra)) || + (shouldProvideParserServices && + shouldCreateDefaultProgram && + createDefaultProgram_1.createDefaultProgram(code, extra)) || + createIsolatedProgram_1.createIsolatedProgram(code, extra)); +} +/** + * Compute the filename based on the parser options. + * + * Even if jsx option is set in typescript compiler, filename still has to + * contain .tsx file extension. + * + * @param options Parser options + */ +function getFileName({ jsx } = {}) { + return jsx ? 'estree.tsx' : 'estree.ts'; +} +/** + * Resets the extra config object + */ +function resetExtra() { + extra = { + code: '', + comment: false, + comments: [], + createDefaultProgram: false, + debugLevel: new Set(), + errorOnTypeScriptSyntacticAndSemanticIssues: false, + errorOnUnknownASTType: false, + extraFileExtensions: [], + filePath: getFileName(), + jsx: false, + loc: false, + log: console.log, + preserveNodeMaps: undefined, + projects: [], + range: false, + strict: false, + tokens: null, + tsconfigRootDir: process.cwd(), + useJSXTextNode: false, + }; +} +/** + * Normalizes, sanitizes, resolves and filters the provided + */ +function prepareAndTransformProjects(projectsInput, ignoreListInput) { + let projects = []; + // Normalize and sanitize the project paths + if (typeof projectsInput === 'string') { + projects.push(projectsInput); + } + else if (Array.isArray(projectsInput)) { + for (const project of projectsInput) { + if (typeof project === 'string') { + projects.push(project); + } + } + } + if (projects.length === 0) { + return projects; + } + // Transform glob patterns into paths + projects = projects.reduce((projects, project) => projects.concat(is_glob_1.default(project) + ? glob_1.sync(project, { + cwd: extra.tsconfigRootDir, + }) + : project), []); + // Normalize and sanitize the ignore regex list + const ignoreRegexes = []; + if (Array.isArray(ignoreListInput)) { + for (const ignore of ignoreListInput) { + if (ignore instanceof RegExp) { + ignoreRegexes.push(ignore); + } + else if (typeof ignore === 'string') { + ignoreRegexes.push(new RegExp(ignore)); + } + } + } + else { + ignoreRegexes.push(/\/node_modules\//); + } + // Remove any paths that match the ignore list + const filtered = projects.filter(project => { + for (const ignore of ignoreRegexes) { + if (ignore.test(project)) { + return false; + } + } + return true; + }); + log('parserOptions.project matched projects: %s', projects); + log('ignore list applied to parserOptions.project: %s', filtered); + return filtered; +} +function applyParserOptionsToExtra(options) { + /** + * Configure Debug logging + */ + if (options.debugLevel === true) { + extra.debugLevel = new Set(['typescript-eslint']); + } + else if (Array.isArray(options.debugLevel)) { + extra.debugLevel = new Set(options.debugLevel); + } + if (extra.debugLevel.size > 0) { + // debug doesn't support multiple `enable` calls, so have to do it all at once + const namespaces = []; + if (extra.debugLevel.has('typescript-eslint')) { + namespaces.push('typescript-eslint:*'); + } + if (extra.debugLevel.has('eslint') || + // make sure we don't turn off the eslint debug if it was enabled via --debug + debug_1.default.enabled('eslint:*')) { + // https://github.com/eslint/eslint/blob/9dfc8501fb1956c90dc11e6377b4cb38a6bea65d/bin/eslint.js#L25 + namespaces.push('eslint:*,-eslint:code-path'); + } + debug_1.default.enable(namespaces.join(',')); + } + /** + * Track range information in the AST + */ + extra.range = typeof options.range === 'boolean' && options.range; + extra.loc = typeof options.loc === 'boolean' && options.loc; + /** + * Track tokens in the AST + */ + if (typeof options.tokens === 'boolean' && options.tokens) { + extra.tokens = []; + } + /** + * Track comments in the AST + */ + if (typeof options.comment === 'boolean' && options.comment) { + extra.comment = true; + extra.comments = []; + } + /** + * Enable JSX - note the applicable file extension is still required + */ + if (typeof options.jsx === 'boolean' && options.jsx) { + extra.jsx = true; + } + /** + * Get the file extension + */ + if (typeof options.filePath === 'string' && options.filePath !== '') { + extra.filePath = options.filePath; + } + else { + extra.filePath = getFileName(extra); + } + /** + * The JSX AST changed the node type for string literals + * inside a JSX Element from `Literal` to `JSXText`. + * + * When value is `true`, these nodes will be parsed as type `JSXText`. + * When value is `false`, these nodes will be parsed as type `Literal`. + */ + if (typeof options.useJSXTextNode === 'boolean' && options.useJSXTextNode) { + extra.useJSXTextNode = true; + } + /** + * Allow the user to cause the parser to error if it encounters an unknown AST Node Type + * (used in testing) + */ + if (typeof options.errorOnUnknownASTType === 'boolean' && + options.errorOnUnknownASTType) { + extra.errorOnUnknownASTType = true; + } + /** + * Allow the user to override the function used for logging + */ + if (typeof options.loggerFn === 'function') { + extra.log = options.loggerFn; + } + else if (options.loggerFn === false) { + extra.log = Function.prototype; + } + if (typeof options.tsconfigRootDir === 'string') { + extra.tsconfigRootDir = options.tsconfigRootDir; + } + // NOTE - ensureAbsolutePath relies upon having the correct tsconfigRootDir in extra + extra.filePath = shared_1.ensureAbsolutePath(extra.filePath, extra); + // NOTE - prepareAndTransformProjects relies upon having the correct tsconfigRootDir in extra + extra.projects = prepareAndTransformProjects(options.project, options.projectFolderIgnoreList); + if (Array.isArray(options.extraFileExtensions) && + options.extraFileExtensions.every(ext => typeof ext === 'string')) { + extra.extraFileExtensions = options.extraFileExtensions; + } + /** + * Allow the user to enable or disable the preservation of the AST node maps + * during the conversion process. + * + * NOTE: For backwards compatibility we also preserve node maps in the case where `project` is set, + * and `preserveNodeMaps` is not explicitly set to anything. + */ + extra.preserveNodeMaps = + typeof options.preserveNodeMaps === 'boolean' && options.preserveNodeMaps; + if (options.preserveNodeMaps === undefined && extra.projects.length > 0) { + extra.preserveNodeMaps = true; + } + extra.createDefaultProgram = + typeof options.createDefaultProgram === 'boolean' && + options.createDefaultProgram; +} +function warnAboutTSVersion() { + var _a; + if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { + const isTTY = typeof process === undefined ? false : (_a = process.stdout) === null || _a === void 0 ? void 0 : _a.isTTY; + if (isTTY) { + const border = '============='; + const versionWarning = [ + border, + 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', + 'You may find that it works just fine, or you may not.', + `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, + `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, + 'Please only submit bug reports when using the officially supported version.', + border, + ]; + extra.log(versionWarning.join('\n\n')); + } + warnedAboutTSVersion = true; + } +} +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ +const version = __webpack_require__(94).version; +exports.version = version; +function parse(code, options) { + /** + * Reset the parse configuration + */ + resetExtra(); + /** + * Ensure users do not attempt to use parse() when they need parseAndGenerateServices() + */ + if (options === null || options === void 0 ? void 0 : options.errorOnTypeScriptSyntacticAndSemanticIssues) { + throw new Error(`"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()`); + } + /** + * Ensure the source code is a string, and store a reference to it + */ + code = enforceString(code); + extra.code = code; + /** + * Apply the given parser options + */ + if (typeof options !== 'undefined') { + applyParserOptionsToExtra(options); + } + /** + * Warn if the user is using an unsupported version of TypeScript + */ + warnAboutTSVersion(); + /** + * Create a ts.SourceFile directly, no ts.Program is needed for a simple + * parse + */ + const ast = createSourceFile_1.createSourceFile(code, extra); + /** + * Convert the TypeScript AST to an ESTree-compatible one + */ + const { estree } = ast_converter_1.astConverter(ast, extra, false); + return estree; +} +exports.parse = parse; +function parseAndGenerateServices(code, options) { + /** + * Reset the parse configuration + */ + resetExtra(); + /** + * Ensure the source code is a string, and store a reference to it + */ + code = enforceString(code); + extra.code = code; + /** + * Apply the given parser options + */ + if (typeof options !== 'undefined') { + applyParserOptionsToExtra(options); + if (typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === + 'boolean' && + options.errorOnTypeScriptSyntacticAndSemanticIssues) { + extra.errorOnTypeScriptSyntacticAndSemanticIssues = true; + } + } + /** + * Warn if the user is using an unsupported version of TypeScript + */ + warnAboutTSVersion(); + /** + * Generate a full ts.Program in order to be able to provide parser + * services, such as type-checking + */ + const shouldProvideParserServices = extra.projects && extra.projects.length > 0; + const { ast, program } = getProgramAndAST(code, shouldProvideParserServices, extra.createDefaultProgram); + /** + * Determine if two-way maps of converted AST nodes should be preserved + * during the conversion process + */ + const shouldPreserveNodeMaps = extra.preserveNodeMaps !== undefined + ? extra.preserveNodeMaps + : shouldProvideParserServices; + /** + * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve + * mappings between converted and original AST nodes + */ + const { estree, astMaps } = ast_converter_1.astConverter(ast, extra, shouldPreserveNodeMaps); + /** + * Even if TypeScript parsed the source code ok, and we had no problems converting the AST, + * there may be other syntactic or semantic issues in the code that we can optionally report on. + */ + if (program && extra.errorOnTypeScriptSyntacticAndSemanticIssues) { + const error = semantic_or_syntactic_errors_1.getFirstSemanticOrSyntacticError(program, ast); + if (error) { + throw convert_1.convertError(error); + } + } + /** + * Return the converted AST and additional parser services + */ + return { + ast: estree, + services: { + program: shouldProvideParserServices ? program : undefined, + esTreeNodeToTSNodeMap: shouldPreserveNodeMaps && astMaps + ? astMaps.esTreeNodeToTSNodeMap + : undefined, + tsNodeToESTreeNodeMap: shouldPreserveNodeMaps && astMaps + ? astMaps.tsNodeToESTreeNodeMap + : undefined, + }, + }; +} +exports.parseAndGenerateServices = parseAndGenerateServices; +var simple_traverse_1 = __webpack_require__(657); +exports.simpleTraverse = simple_traverse_1.simpleTraverse; +var visitor_keys_1 = __webpack_require__(121); +exports.visitorKeys = visitor_keys_1.visitorKeys; +__export(__webpack_require__(64)); +var createWatchProgram_1 = __webpack_require__(612); +exports.clearCaches = createWatchProgram_1.clearCaches; +//# sourceMappingURL=parser.js.map /***/ }), /* 628 */, @@ -89407,7 +87568,7 @@ module.exports = require("net"); // that includes the same versions that the original range does // If the original range is shorter than the simplified one, return that. const satisfies = __webpack_require__(171) -const compare = __webpack_require__(570) +const compare = __webpack_require__(340) module.exports = (versions, range, options) => { const set = [] let min = null @@ -89661,7 +87822,7 @@ class Range { module.exports = Range const Comparator = __webpack_require__(456) -const debug = __webpack_require__(509) +const debug = __webpack_require__(467) const SemVer = __webpack_require__(243) const { re, @@ -89994,11 +88155,122 @@ module.exports = __webpack_require__(665); /***/ }), /* 637 */, /* 638 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(__unusedmodule, exports) { -const compareBuild = __webpack_require__(805) -const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) -module.exports = sort +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +// It turns out that some (most?) JavaScript engines don't self-host +// `Array.prototype.sort`. This makes sense because C++ will likely remain +// faster than JS when doing raw CPU-intensive sorting. However, when using a +// custom comparator function, calling back and forth between the VM's C++ and +// JIT'd JS is rather slow *and* loses JIT type information, resulting in +// worse generated code for the comparator function than would be optimal. In +// fact, when sorting with a comparator, these costs outweigh the benefits of +// sorting in C++. By using our own JS-implemented Quick Sort (below), we get +// a ~3500ms mean speed-up in `bench/bench.html`. + +/** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ +function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; +} + +/** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ +function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); +} + +/** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ +function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } +} + +/** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ +exports.quickSort = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); +}; /***/ }), @@ -90061,422 +88333,7 @@ function obj(options, fn) { /***/ }), -/* 642 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -function __export(m) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -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)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug_1 = __importDefault(__webpack_require__(784)); -const glob_1 = __webpack_require__(120); -const is_glob_1 = __importDefault(__webpack_require__(846)); -const semver_1 = __importDefault(__webpack_require__(900)); -const ts = __importStar(__webpack_require__(752)); -const ast_converter_1 = __webpack_require__(204); -const convert_1 = __webpack_require__(514); -const createDefaultProgram_1 = __webpack_require__(982); -const createIsolatedProgram_1 = __webpack_require__(398); -const createProjectProgram_1 = __webpack_require__(500); -const createSourceFile_1 = __webpack_require__(269); -const semantic_or_syntactic_errors_1 = __webpack_require__(62); -const shared_1 = __webpack_require__(164); -const log = debug_1.default('typescript-eslint:typescript-estree:parser'); -/** - * This needs to be kept in sync with the top-level README.md in the - * typescript-eslint monorepo - */ -const SUPPORTED_TYPESCRIPT_VERSIONS = '>=3.2.1 <3.8.0'; -/* - * The semver package will ignore prerelease ranges, and we don't want to explicitly document every one - * List them all separately here, so we can automatically create the full string - */ -const SUPPORTED_PRERELEASE_RANGES = ['>3.7.0-dev.0', '3.7.1-rc']; -const ACTIVE_TYPESCRIPT_VERSION = ts.version; -const isRunningSupportedTypeScriptVersion = semver_1.default.satisfies(ACTIVE_TYPESCRIPT_VERSION, [SUPPORTED_TYPESCRIPT_VERSIONS] - .concat(SUPPORTED_PRERELEASE_RANGES) - .join(' || ')); -let extra; -let warnedAboutTSVersion = false; -function enforceString(code) { - /** - * Ensure the source code is a string - */ - if (typeof code !== 'string') { - return String(code); - } - return code; -} -/** - * @param code The code of the file being linted - * @param shouldProvideParserServices True if the program should be attempted to be calculated from provided tsconfig files - * @param shouldCreateDefaultProgram True if the program should be created from compiler host - * @returns Returns a source file and program corresponding to the linted code - */ -function getProgramAndAST(code, shouldProvideParserServices, shouldCreateDefaultProgram) { - return ((shouldProvideParserServices && - createProjectProgram_1.createProjectProgram(code, shouldCreateDefaultProgram, extra)) || - (shouldProvideParserServices && - shouldCreateDefaultProgram && - createDefaultProgram_1.createDefaultProgram(code, extra)) || - createIsolatedProgram_1.createIsolatedProgram(code, extra)); -} -/** - * Compute the filename based on the parser options. - * - * Even if jsx option is set in typescript compiler, filename still has to - * contain .tsx file extension. - * - * @param options Parser options - */ -function getFileName({ jsx } = {}) { - return jsx ? 'estree.tsx' : 'estree.ts'; -} -/** - * Resets the extra config object - */ -function resetExtra() { - extra = { - code: '', - comment: false, - comments: [], - createDefaultProgram: false, - debugLevel: new Set(), - errorOnTypeScriptSyntacticAndSemanticIssues: false, - errorOnUnknownASTType: false, - extraFileExtensions: [], - filePath: getFileName(), - jsx: false, - loc: false, - log: console.log, - preserveNodeMaps: undefined, - projects: [], - range: false, - strict: false, - tokens: null, - tsconfigRootDir: process.cwd(), - useJSXTextNode: false, - }; -} -/** - * Normalizes, sanitizes, resolves and filters the provided - */ -function prepareAndTransformProjects(projectsInput, ignoreListInput) { - let projects = []; - // Normalize and sanitize the project paths - if (typeof projectsInput === 'string') { - projects.push(projectsInput); - } - else if (Array.isArray(projectsInput)) { - for (const project of projectsInput) { - if (typeof project === 'string') { - projects.push(project); - } - } - } - if (projects.length === 0) { - return projects; - } - // Transform glob patterns into paths - projects = projects.reduce((projects, project) => projects.concat(is_glob_1.default(project) - ? glob_1.sync(project, { - cwd: extra.tsconfigRootDir, - }) - : project), []); - // Normalize and sanitize the ignore regex list - const ignoreRegexes = []; - if (Array.isArray(ignoreListInput)) { - for (const ignore of ignoreListInput) { - if (ignore instanceof RegExp) { - ignoreRegexes.push(ignore); - } - else if (typeof ignore === 'string') { - ignoreRegexes.push(new RegExp(ignore)); - } - } - } - else { - ignoreRegexes.push(/\/node_modules\//); - } - // Remove any paths that match the ignore list - const filtered = projects.filter(project => { - for (const ignore of ignoreRegexes) { - if (ignore.test(project)) { - return false; - } - } - return true; - }); - log('parserOptions.project matched projects: %s', projects); - log('ignore list applied to parserOptions.project: %s', filtered); - return filtered; -} -function applyParserOptionsToExtra(options) { - /** - * Configure Debug logging - */ - if (options.debugLevel === true) { - extra.debugLevel = new Set(['typescript-eslint']); - } - else if (Array.isArray(options.debugLevel)) { - extra.debugLevel = new Set(options.debugLevel); - } - if (extra.debugLevel.size > 0) { - // debug doesn't support multiple `enable` calls, so have to do it all at once - const namespaces = []; - if (extra.debugLevel.has('typescript-eslint')) { - namespaces.push('typescript-eslint:*'); - } - if (extra.debugLevel.has('eslint') || - // make sure we don't turn off the eslint debug if it was enabled via --debug - debug_1.default.enabled('eslint:*')) { - // https://github.com/eslint/eslint/blob/9dfc8501fb1956c90dc11e6377b4cb38a6bea65d/bin/eslint.js#L25 - namespaces.push('eslint:*,-eslint:code-path'); - } - debug_1.default.enable(namespaces.join(',')); - } - /** - * Track range information in the AST - */ - extra.range = typeof options.range === 'boolean' && options.range; - extra.loc = typeof options.loc === 'boolean' && options.loc; - /** - * Track tokens in the AST - */ - if (typeof options.tokens === 'boolean' && options.tokens) { - extra.tokens = []; - } - /** - * Track comments in the AST - */ - if (typeof options.comment === 'boolean' && options.comment) { - extra.comment = true; - extra.comments = []; - } - /** - * Enable JSX - note the applicable file extension is still required - */ - if (typeof options.jsx === 'boolean' && options.jsx) { - extra.jsx = true; - } - /** - * Get the file extension - */ - if (typeof options.filePath === 'string' && options.filePath !== '') { - extra.filePath = options.filePath; - } - else { - extra.filePath = getFileName(extra); - } - /** - * The JSX AST changed the node type for string literals - * inside a JSX Element from `Literal` to `JSXText`. - * - * When value is `true`, these nodes will be parsed as type `JSXText`. - * When value is `false`, these nodes will be parsed as type `Literal`. - */ - if (typeof options.useJSXTextNode === 'boolean' && options.useJSXTextNode) { - extra.useJSXTextNode = true; - } - /** - * Allow the user to cause the parser to error if it encounters an unknown AST Node Type - * (used in testing) - */ - if (typeof options.errorOnUnknownASTType === 'boolean' && - options.errorOnUnknownASTType) { - extra.errorOnUnknownASTType = true; - } - /** - * Allow the user to override the function used for logging - */ - if (typeof options.loggerFn === 'function') { - extra.log = options.loggerFn; - } - else if (options.loggerFn === false) { - extra.log = Function.prototype; - } - if (typeof options.tsconfigRootDir === 'string') { - extra.tsconfigRootDir = options.tsconfigRootDir; - } - // NOTE - ensureAbsolutePath relies upon having the correct tsconfigRootDir in extra - extra.filePath = shared_1.ensureAbsolutePath(extra.filePath, extra); - // NOTE - prepareAndTransformProjects relies upon having the correct tsconfigRootDir in extra - extra.projects = prepareAndTransformProjects(options.project, options.projectFolderIgnoreList); - if (Array.isArray(options.extraFileExtensions) && - options.extraFileExtensions.every(ext => typeof ext === 'string')) { - extra.extraFileExtensions = options.extraFileExtensions; - } - /** - * Allow the user to enable or disable the preservation of the AST node maps - * during the conversion process. - * - * NOTE: For backwards compatibility we also preserve node maps in the case where `project` is set, - * and `preserveNodeMaps` is not explicitly set to anything. - */ - extra.preserveNodeMaps = - typeof options.preserveNodeMaps === 'boolean' && options.preserveNodeMaps; - if (options.preserveNodeMaps === undefined && extra.projects.length > 0) { - extra.preserveNodeMaps = true; - } - extra.createDefaultProgram = - typeof options.createDefaultProgram === 'boolean' && - options.createDefaultProgram; -} -function warnAboutTSVersion() { - var _a; - if (!isRunningSupportedTypeScriptVersion && !warnedAboutTSVersion) { - const isTTY = typeof process === undefined ? false : (_a = process.stdout) === null || _a === void 0 ? void 0 : _a.isTTY; - if (isTTY) { - const border = '============='; - const versionWarning = [ - border, - 'WARNING: You are currently running a version of TypeScript which is not officially supported by @typescript-eslint/typescript-estree.', - 'You may find that it works just fine, or you may not.', - `SUPPORTED TYPESCRIPT VERSIONS: ${SUPPORTED_TYPESCRIPT_VERSIONS}`, - `YOUR TYPESCRIPT VERSION: ${ACTIVE_TYPESCRIPT_VERSION}`, - 'Please only submit bug reports when using the officially supported version.', - border, - ]; - extra.log(versionWarning.join('\n\n')); - } - warnedAboutTSVersion = true; - } -} -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ -const version = __webpack_require__(156).version; -exports.version = version; -function parse(code, options) { - /** - * Reset the parse configuration - */ - resetExtra(); - /** - * Ensure users do not attempt to use parse() when they need parseAndGenerateServices() - */ - if (options === null || options === void 0 ? void 0 : options.errorOnTypeScriptSyntacticAndSemanticIssues) { - throw new Error(`"errorOnTypeScriptSyntacticAndSemanticIssues" is only supported for parseAndGenerateServices()`); - } - /** - * Ensure the source code is a string, and store a reference to it - */ - code = enforceString(code); - extra.code = code; - /** - * Apply the given parser options - */ - if (typeof options !== 'undefined') { - applyParserOptionsToExtra(options); - } - /** - * Warn if the user is using an unsupported version of TypeScript - */ - warnAboutTSVersion(); - /** - * Create a ts.SourceFile directly, no ts.Program is needed for a simple - * parse - */ - const ast = createSourceFile_1.createSourceFile(code, extra); - /** - * Convert the TypeScript AST to an ESTree-compatible one - */ - const { estree } = ast_converter_1.astConverter(ast, extra, false); - return estree; -} -exports.parse = parse; -function parseAndGenerateServices(code, options) { - /** - * Reset the parse configuration - */ - resetExtra(); - /** - * Ensure the source code is a string, and store a reference to it - */ - code = enforceString(code); - extra.code = code; - /** - * Apply the given parser options - */ - if (typeof options !== 'undefined') { - applyParserOptionsToExtra(options); - if (typeof options.errorOnTypeScriptSyntacticAndSemanticIssues === - 'boolean' && - options.errorOnTypeScriptSyntacticAndSemanticIssues) { - extra.errorOnTypeScriptSyntacticAndSemanticIssues = true; - } - } - /** - * Warn if the user is using an unsupported version of TypeScript - */ - warnAboutTSVersion(); - /** - * Generate a full ts.Program in order to be able to provide parser - * services, such as type-checking - */ - const shouldProvideParserServices = extra.projects && extra.projects.length > 0; - const { ast, program } = getProgramAndAST(code, shouldProvideParserServices, extra.createDefaultProgram); - /** - * Determine if two-way maps of converted AST nodes should be preserved - * during the conversion process - */ - const shouldPreserveNodeMaps = extra.preserveNodeMaps !== undefined - ? extra.preserveNodeMaps - : shouldProvideParserServices; - /** - * Convert the TypeScript AST to an ESTree-compatible one, and optionally preserve - * mappings between converted and original AST nodes - */ - const { estree, astMaps } = ast_converter_1.astConverter(ast, extra, shouldPreserveNodeMaps); - /** - * Even if TypeScript parsed the source code ok, and we had no problems converting the AST, - * there may be other syntactic or semantic issues in the code that we can optionally report on. - */ - if (program && extra.errorOnTypeScriptSyntacticAndSemanticIssues) { - const error = semantic_or_syntactic_errors_1.getFirstSemanticOrSyntacticError(program, ast); - if (error) { - throw convert_1.convertError(error); - } - } - /** - * Return the converted AST and additional parser services - */ - return { - ast: estree, - services: { - program: shouldProvideParserServices ? program : undefined, - esTreeNodeToTSNodeMap: shouldPreserveNodeMaps && astMaps - ? astMaps.esTreeNodeToTSNodeMap - : undefined, - tsNodeToESTreeNodeMap: shouldPreserveNodeMaps && astMaps - ? astMaps.tsNodeToESTreeNodeMap - : undefined, - }, - }; -} -exports.parseAndGenerateServices = parseAndGenerateServices; -var simple_traverse_1 = __webpack_require__(894); -exports.simpleTraverse = simple_traverse_1.simpleTraverse; -var visitor_keys_1 = __webpack_require__(408); -exports.visitorKeys = visitor_keys_1.visitorKeys; -__export(__webpack_require__(372)); -var createWatchProgram_1 = __webpack_require__(547); -exports.clearCaches = createWatchProgram_1.clearCaches; -//# sourceMappingURL=parser.js.map - -/***/ }), +/* 642 */, /* 643 */ /***/ (function(module) { @@ -91102,7 +88959,7 @@ module.exports = (chalk, tmp) => { Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = __webpack_require__(259); -tslib_1.__exportStar(__webpack_require__(734), exports); +tslib_1.__exportStar(__webpack_require__(451), exports); const ts = __webpack_require__(752); function isOptionalTypeNode(node) { return node.kind === ts.SyntaxKind.OptionalType; @@ -91239,242 +89096,58 @@ function Writable(fn, options) { /***/ }), -/* 657 */, -/* 658 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/* 657 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { -const {MAX_LENGTH} = __webpack_require__(627) -const { re, t } = __webpack_require__(590) -const SemVer = __webpack_require__(369) +"use strict"; -const parse = (version, options) => { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false +Object.defineProperty(exports, "__esModule", { value: true }); +const visitor_keys_1 = __webpack_require__(121); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function isValidNode(x) { + return x !== null && typeof x === 'object' && typeof x.type === 'string'; +} +function getVisitorKeysForNode(allVisitorKeys, node) { + const keys = allVisitorKeys[node.type]; + return keys !== null && keys !== void 0 ? keys : []; +} +class SimpleTraverser { + constructor({ enter }) { + this.allVisitorKeys = visitor_keys_1.visitorKeys; + this.enter = enter; + } + traverse(node, parent) { + if (!isValidNode(node)) { + return; + } + this.enter(node, parent); + const keys = getVisitorKeysForNode(this.allVisitorKeys, node); + if (keys.length < 1) { + return; + } + for (const key of keys) { + const childOrChildren = node[key]; + if (Array.isArray(childOrChildren)) { + for (const child of childOrChildren) { + this.traverse(child, node); + } + } + else { + this.traverse(childOrChildren, node); + } + } } - } - - if (version instanceof SemVer) { - return version - } - - if (typeof version !== 'string') { - return null - } - - if (version.length > MAX_LENGTH) { - return null - } - - const r = options.loose ? re[t.LOOSE] : re[t.FULL] - if (!r.test(version)) { - return null - } - - try { - return new SemVer(version, options) - } catch (er) { - return null - } } - -module.exports = parse - +function simpleTraverse(startingNode, options) { + new SimpleTraverser(options).traverse(startingNode, undefined); +} +exports.simpleTraverse = simpleTraverse; +//# sourceMappingURL=simple-traverse.js.map /***/ }), +/* 658 */, /* 659 */, -/* 660 */ -/***/ (function(__unusedmodule, exports) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -var AST_NODE_TYPES; -(function (AST_NODE_TYPES) { - AST_NODE_TYPES["ArrayExpression"] = "ArrayExpression"; - AST_NODE_TYPES["ArrayPattern"] = "ArrayPattern"; - AST_NODE_TYPES["ArrowFunctionExpression"] = "ArrowFunctionExpression"; - AST_NODE_TYPES["AssignmentExpression"] = "AssignmentExpression"; - AST_NODE_TYPES["AssignmentPattern"] = "AssignmentPattern"; - AST_NODE_TYPES["AwaitExpression"] = "AwaitExpression"; - AST_NODE_TYPES["BigIntLiteral"] = "BigIntLiteral"; - AST_NODE_TYPES["BinaryExpression"] = "BinaryExpression"; - AST_NODE_TYPES["BlockStatement"] = "BlockStatement"; - AST_NODE_TYPES["BreakStatement"] = "BreakStatement"; - AST_NODE_TYPES["CallExpression"] = "CallExpression"; - AST_NODE_TYPES["CatchClause"] = "CatchClause"; - AST_NODE_TYPES["ClassBody"] = "ClassBody"; - AST_NODE_TYPES["ClassDeclaration"] = "ClassDeclaration"; - AST_NODE_TYPES["ClassExpression"] = "ClassExpression"; - AST_NODE_TYPES["ClassProperty"] = "ClassProperty"; - AST_NODE_TYPES["ConditionalExpression"] = "ConditionalExpression"; - AST_NODE_TYPES["ContinueStatement"] = "ContinueStatement"; - AST_NODE_TYPES["DebuggerStatement"] = "DebuggerStatement"; - AST_NODE_TYPES["Decorator"] = "Decorator"; - AST_NODE_TYPES["DoWhileStatement"] = "DoWhileStatement"; - AST_NODE_TYPES["EmptyStatement"] = "EmptyStatement"; - AST_NODE_TYPES["ExportAllDeclaration"] = "ExportAllDeclaration"; - AST_NODE_TYPES["ExportDefaultDeclaration"] = "ExportDefaultDeclaration"; - AST_NODE_TYPES["ExportNamedDeclaration"] = "ExportNamedDeclaration"; - AST_NODE_TYPES["ExportSpecifier"] = "ExportSpecifier"; - AST_NODE_TYPES["ExpressionStatement"] = "ExpressionStatement"; - AST_NODE_TYPES["ForInStatement"] = "ForInStatement"; - AST_NODE_TYPES["ForOfStatement"] = "ForOfStatement"; - AST_NODE_TYPES["ForStatement"] = "ForStatement"; - AST_NODE_TYPES["FunctionDeclaration"] = "FunctionDeclaration"; - AST_NODE_TYPES["FunctionExpression"] = "FunctionExpression"; - AST_NODE_TYPES["Identifier"] = "Identifier"; - AST_NODE_TYPES["IfStatement"] = "IfStatement"; - AST_NODE_TYPES["Import"] = "Import"; - AST_NODE_TYPES["ImportDeclaration"] = "ImportDeclaration"; - AST_NODE_TYPES["ImportDefaultSpecifier"] = "ImportDefaultSpecifier"; - AST_NODE_TYPES["ImportNamespaceSpecifier"] = "ImportNamespaceSpecifier"; - AST_NODE_TYPES["ImportSpecifier"] = "ImportSpecifier"; - AST_NODE_TYPES["JSXAttribute"] = "JSXAttribute"; - AST_NODE_TYPES["JSXClosingElement"] = "JSXClosingElement"; - AST_NODE_TYPES["JSXClosingFragment"] = "JSXClosingFragment"; - AST_NODE_TYPES["JSXElement"] = "JSXElement"; - AST_NODE_TYPES["JSXEmptyExpression"] = "JSXEmptyExpression"; - AST_NODE_TYPES["JSXExpressionContainer"] = "JSXExpressionContainer"; - AST_NODE_TYPES["JSXFragment"] = "JSXFragment"; - AST_NODE_TYPES["JSXIdentifier"] = "JSXIdentifier"; - AST_NODE_TYPES["JSXMemberExpression"] = "JSXMemberExpression"; - AST_NODE_TYPES["JSXOpeningElement"] = "JSXOpeningElement"; - AST_NODE_TYPES["JSXOpeningFragment"] = "JSXOpeningFragment"; - AST_NODE_TYPES["JSXSpreadAttribute"] = "JSXSpreadAttribute"; - AST_NODE_TYPES["JSXSpreadChild"] = "JSXSpreadChild"; - AST_NODE_TYPES["JSXText"] = "JSXText"; - AST_NODE_TYPES["LabeledStatement"] = "LabeledStatement"; - AST_NODE_TYPES["Literal"] = "Literal"; - AST_NODE_TYPES["LogicalExpression"] = "LogicalExpression"; - AST_NODE_TYPES["MemberExpression"] = "MemberExpression"; - AST_NODE_TYPES["MetaProperty"] = "MetaProperty"; - AST_NODE_TYPES["MethodDefinition"] = "MethodDefinition"; - AST_NODE_TYPES["NewExpression"] = "NewExpression"; - AST_NODE_TYPES["ObjectExpression"] = "ObjectExpression"; - AST_NODE_TYPES["ObjectPattern"] = "ObjectPattern"; - AST_NODE_TYPES["OptionalCallExpression"] = "OptionalCallExpression"; - AST_NODE_TYPES["OptionalMemberExpression"] = "OptionalMemberExpression"; - AST_NODE_TYPES["Program"] = "Program"; - AST_NODE_TYPES["Property"] = "Property"; - AST_NODE_TYPES["RestElement"] = "RestElement"; - AST_NODE_TYPES["ReturnStatement"] = "ReturnStatement"; - AST_NODE_TYPES["SequenceExpression"] = "SequenceExpression"; - AST_NODE_TYPES["SpreadElement"] = "SpreadElement"; - AST_NODE_TYPES["Super"] = "Super"; - AST_NODE_TYPES["SwitchCase"] = "SwitchCase"; - AST_NODE_TYPES["SwitchStatement"] = "SwitchStatement"; - AST_NODE_TYPES["TaggedTemplateExpression"] = "TaggedTemplateExpression"; - AST_NODE_TYPES["TemplateElement"] = "TemplateElement"; - AST_NODE_TYPES["TemplateLiteral"] = "TemplateLiteral"; - AST_NODE_TYPES["ThisExpression"] = "ThisExpression"; - AST_NODE_TYPES["ThrowStatement"] = "ThrowStatement"; - AST_NODE_TYPES["TryStatement"] = "TryStatement"; - AST_NODE_TYPES["UnaryExpression"] = "UnaryExpression"; - AST_NODE_TYPES["UpdateExpression"] = "UpdateExpression"; - AST_NODE_TYPES["VariableDeclaration"] = "VariableDeclaration"; - AST_NODE_TYPES["VariableDeclarator"] = "VariableDeclarator"; - AST_NODE_TYPES["WhileStatement"] = "WhileStatement"; - AST_NODE_TYPES["WithStatement"] = "WithStatement"; - AST_NODE_TYPES["YieldExpression"] = "YieldExpression"; - /** - * TS-prefixed nodes - */ - AST_NODE_TYPES["TSAbstractClassProperty"] = "TSAbstractClassProperty"; - AST_NODE_TYPES["TSAbstractKeyword"] = "TSAbstractKeyword"; - AST_NODE_TYPES["TSAbstractMethodDefinition"] = "TSAbstractMethodDefinition"; - AST_NODE_TYPES["TSAnyKeyword"] = "TSAnyKeyword"; - AST_NODE_TYPES["TSArrayType"] = "TSArrayType"; - AST_NODE_TYPES["TSAsExpression"] = "TSAsExpression"; - AST_NODE_TYPES["TSAsyncKeyword"] = "TSAsyncKeyword"; - AST_NODE_TYPES["TSBooleanKeyword"] = "TSBooleanKeyword"; - AST_NODE_TYPES["TSBigIntKeyword"] = "TSBigIntKeyword"; - AST_NODE_TYPES["TSConditionalType"] = "TSConditionalType"; - AST_NODE_TYPES["TSConstructorType"] = "TSConstructorType"; - AST_NODE_TYPES["TSCallSignatureDeclaration"] = "TSCallSignatureDeclaration"; - AST_NODE_TYPES["TSClassImplements"] = "TSClassImplements"; - AST_NODE_TYPES["TSConstructSignatureDeclaration"] = "TSConstructSignatureDeclaration"; - AST_NODE_TYPES["TSDeclareKeyword"] = "TSDeclareKeyword"; - AST_NODE_TYPES["TSDeclareFunction"] = "TSDeclareFunction"; - AST_NODE_TYPES["TSEmptyBodyFunctionExpression"] = "TSEmptyBodyFunctionExpression"; - AST_NODE_TYPES["TSEnumDeclaration"] = "TSEnumDeclaration"; - AST_NODE_TYPES["TSEnumMember"] = "TSEnumMember"; - AST_NODE_TYPES["TSExportAssignment"] = "TSExportAssignment"; - AST_NODE_TYPES["TSExportKeyword"] = "TSExportKeyword"; - AST_NODE_TYPES["TSExternalModuleReference"] = "TSExternalModuleReference"; - AST_NODE_TYPES["TSImportType"] = "TSImportType"; - AST_NODE_TYPES["TSInferType"] = "TSInferType"; - AST_NODE_TYPES["TSLiteralType"] = "TSLiteralType"; - AST_NODE_TYPES["TSIndexedAccessType"] = "TSIndexedAccessType"; - AST_NODE_TYPES["TSIndexSignature"] = "TSIndexSignature"; - AST_NODE_TYPES["TSInterfaceBody"] = "TSInterfaceBody"; - AST_NODE_TYPES["TSInterfaceDeclaration"] = "TSInterfaceDeclaration"; - AST_NODE_TYPES["TSInterfaceHeritage"] = "TSInterfaceHeritage"; - AST_NODE_TYPES["TSImportEqualsDeclaration"] = "TSImportEqualsDeclaration"; - AST_NODE_TYPES["TSFunctionType"] = "TSFunctionType"; - AST_NODE_TYPES["TSMethodSignature"] = "TSMethodSignature"; - AST_NODE_TYPES["TSModuleBlock"] = "TSModuleBlock"; - AST_NODE_TYPES["TSModuleDeclaration"] = "TSModuleDeclaration"; - AST_NODE_TYPES["TSNamespaceExportDeclaration"] = "TSNamespaceExportDeclaration"; - AST_NODE_TYPES["TSNonNullExpression"] = "TSNonNullExpression"; - AST_NODE_TYPES["TSNeverKeyword"] = "TSNeverKeyword"; - AST_NODE_TYPES["TSNullKeyword"] = "TSNullKeyword"; - AST_NODE_TYPES["TSNumberKeyword"] = "TSNumberKeyword"; - AST_NODE_TYPES["TSMappedType"] = "TSMappedType"; - AST_NODE_TYPES["TSObjectKeyword"] = "TSObjectKeyword"; - AST_NODE_TYPES["TSParameterProperty"] = "TSParameterProperty"; - AST_NODE_TYPES["TSPrivateKeyword"] = "TSPrivateKeyword"; - AST_NODE_TYPES["TSPropertySignature"] = "TSPropertySignature"; - AST_NODE_TYPES["TSProtectedKeyword"] = "TSProtectedKeyword"; - AST_NODE_TYPES["TSPublicKeyword"] = "TSPublicKeyword"; - AST_NODE_TYPES["TSQualifiedName"] = "TSQualifiedName"; - AST_NODE_TYPES["TSReadonlyKeyword"] = "TSReadonlyKeyword"; - AST_NODE_TYPES["TSRestType"] = "TSRestType"; - AST_NODE_TYPES["TSStaticKeyword"] = "TSStaticKeyword"; - AST_NODE_TYPES["TSStringKeyword"] = "TSStringKeyword"; - AST_NODE_TYPES["TSSymbolKeyword"] = "TSSymbolKeyword"; - AST_NODE_TYPES["TSThisType"] = "TSThisType"; - AST_NODE_TYPES["TSTypeAnnotation"] = "TSTypeAnnotation"; - AST_NODE_TYPES["TSTypeAliasDeclaration"] = "TSTypeAliasDeclaration"; - AST_NODE_TYPES["TSTypeAssertion"] = "TSTypeAssertion"; - AST_NODE_TYPES["TSTypeLiteral"] = "TSTypeLiteral"; - AST_NODE_TYPES["TSTypeOperator"] = "TSTypeOperator"; - AST_NODE_TYPES["TSTypeParameter"] = "TSTypeParameter"; - AST_NODE_TYPES["TSTypeParameterDeclaration"] = "TSTypeParameterDeclaration"; - AST_NODE_TYPES["TSTypeParameterInstantiation"] = "TSTypeParameterInstantiation"; - AST_NODE_TYPES["TSTypePredicate"] = "TSTypePredicate"; - AST_NODE_TYPES["TSTypeReference"] = "TSTypeReference"; - AST_NODE_TYPES["TSTypeQuery"] = "TSTypeQuery"; - AST_NODE_TYPES["TSIntersectionType"] = "TSIntersectionType"; - AST_NODE_TYPES["TSTupleType"] = "TSTupleType"; - AST_NODE_TYPES["TSOptionalType"] = "TSOptionalType"; - AST_NODE_TYPES["TSParenthesizedType"] = "TSParenthesizedType"; - AST_NODE_TYPES["TSUnionType"] = "TSUnionType"; - AST_NODE_TYPES["TSUndefinedKeyword"] = "TSUndefinedKeyword"; - AST_NODE_TYPES["TSUnknownKeyword"] = "TSUnknownKeyword"; - AST_NODE_TYPES["TSVoidKeyword"] = "TSVoidKeyword"; -})(AST_NODE_TYPES = exports.AST_NODE_TYPES || (exports.AST_NODE_TYPES = {})); -var AST_TOKEN_TYPES; -(function (AST_TOKEN_TYPES) { - AST_TOKEN_TYPES["Boolean"] = "Boolean"; - AST_TOKEN_TYPES["Identifier"] = "Identifier"; - AST_TOKEN_TYPES["JSXIdentifier"] = "JSXIdentifier"; - AST_TOKEN_TYPES["JSXText"] = "JSXText"; - AST_TOKEN_TYPES["Keyword"] = "Keyword"; - AST_TOKEN_TYPES["Null"] = "Null"; - AST_TOKEN_TYPES["Numeric"] = "Numeric"; - AST_TOKEN_TYPES["Punctuator"] = "Punctuator"; - AST_TOKEN_TYPES["RegularExpression"] = "RegularExpression"; - AST_TOKEN_TYPES["String"] = "String"; - AST_TOKEN_TYPES["Template"] = "Template"; - // comment types - AST_TOKEN_TYPES["Block"] = "Block"; - AST_TOKEN_TYPES["Line"] = "Line"; -})(AST_TOKEN_TYPES = exports.AST_TOKEN_TYPES || (exports.AST_TOKEN_TYPES = {})); -//# sourceMappingURL=ast-node-types.js.map - -/***/ }), +/* 660 */, /* 661 */, /* 662 */ /***/ (function(module, exports, __webpack_require__) { @@ -92233,6 +89906,7 @@ module.exports = async (api, siteId, dir, opts) => { files, functions, async: Object.keys(files).length > opts.syncFileLimit, + branch: opts.branch, draft: opts.draft } }) @@ -92909,7 +90583,7 @@ module.exports = function assertRecord(Type, recordType, argumentName, value) { module.exports = { crc1: __webpack_require__(599), - crc8: __webpack_require__(191), + crc8: __webpack_require__(524), crc81wire: __webpack_require__(414), crc16: __webpack_require__(707), crc16ccitt: __webpack_require__(858), @@ -92971,11 +90645,54 @@ module.exports.win32 = win32; /* 682 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const SemVer = __webpack_require__(369) -const compare = (a, b, loose) => - new SemVer(a, loose).compare(new SemVer(b, loose)) - -module.exports = compare +// just pre-load all the stuff that index.js lazily exports +const internalRe = __webpack_require__(331) +module.exports = { + re: internalRe.re, + src: internalRe.src, + tokens: internalRe.t, + SEMVER_SPEC_VERSION: __webpack_require__(269).SEMVER_SPEC_VERSION, + SemVer: __webpack_require__(243), + compareIdentifiers: __webpack_require__(96).compareIdentifiers, + rcompareIdentifiers: __webpack_require__(96).rcompareIdentifiers, + parse: __webpack_require__(147), + valid: __webpack_require__(321), + clean: __webpack_require__(910), + inc: __webpack_require__(204), + diff: __webpack_require__(372), + major: __webpack_require__(83), + minor: __webpack_require__(610), + patch: __webpack_require__(79), + prerelease: __webpack_require__(193), + compare: __webpack_require__(340), + rcompare: __webpack_require__(418), + compareLoose: __webpack_require__(970), + compareBuild: __webpack_require__(50), + sort: __webpack_require__(530), + rsort: __webpack_require__(281), + gt: __webpack_require__(738), + lt: __webpack_require__(375), + eq: __webpack_require__(541), + neq: __webpack_require__(291), + gte: __webpack_require__(790), + lte: __webpack_require__(546), + cmp: __webpack_require__(308), + coerce: __webpack_require__(159), + Comparator: __webpack_require__(456), + Range: __webpack_require__(635), + satisfies: __webpack_require__(171), + toComparators: __webpack_require__(398), + maxSatisfying: __webpack_require__(426), + minSatisfying: __webpack_require__(693), + minVersion: __webpack_require__(491), + validRange: __webpack_require__(397), + outside: __webpack_require__(776), + gtr: __webpack_require__(258), + ltr: __webpack_require__(163), + intersects: __webpack_require__(927), + simplifyRange: __webpack_require__(632), + subset: __webpack_require__(578), +} /***/ }), @@ -94583,7 +92300,20 @@ function coerce (version, options) { /***/ }), /* 684 */, /* 685 */, -/* 686 */, +/* 686 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const Range = __webpack_require__(33) + +// Mostly just for testing and legacy API reasons +const toComparators = (range, options) => + new Range(range, options).set + .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + +module.exports = toComparators + + +/***/ }), /* 687 */ /***/ (function(module) { @@ -95874,4523 +93604,5478 @@ function () { _this.processed = true; reject(error); }); - } else { - this.asyncTick(resolve, reject); - } - } catch (error) { - this.processed = true; - reject(error); - } - }; - - _proto.async = function async() { - var _this2 = this; - - if (this.processed) { - return new Promise(function (resolve, reject) { - if (_this2.error) { - reject(_this2.error); - } else { - resolve(_this2.stringify()); - } - }); - } - - if (this.processing) { - return this.processing; - } - - this.processing = new Promise(function (resolve, reject) { - if (_this2.error) return reject(_this2.error); - _this2.plugin = 0; - - _this2.asyncTick(resolve, reject); - }).then(function () { - _this2.processed = true; - return _this2.stringify(); - }); - return this.processing; - }; - - _proto.sync = function sync() { - if (this.processed) return this.result; - this.processed = true; - - if (this.processing) { - throw new Error('Use process(css).then(cb) to work with async plugins'); - } - - if (this.error) throw this.error; - - for (var _iterator = this.result.processor.plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; - - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; - } - - var plugin = _ref; - var promise = this.run(plugin); - - if (isPromise(promise)) { - throw new Error('Use process(css).then(cb) to work with async plugins'); - } - } - - return this.result; - }; - - _proto.run = function run(plugin) { - this.result.lastPlugin = plugin; - - try { - return plugin(this.result.root, this.result); - } catch (error) { - this.handleError(error, plugin); - throw error; - } - }; - - _proto.stringify = function stringify() { - if (this.stringified) return this.result; - this.stringified = true; - this.sync(); - var opts = this.result.opts; - var str = _stringify2.default; - if (opts.syntax) str = opts.syntax.stringify; - if (opts.stringifier) str = opts.stringifier; - if (str.stringify) str = str.stringify; - var map = new _mapGenerator.default(str, this.result.root, this.result.opts); - var data = map.generate(); - this.result.css = data[0]; - this.result.map = data[1]; - return this.result; - }; - - _createClass(LazyResult, [{ - key: "processor", - get: function get() { - return this.result.processor; - } - /** - * Options from the {@link Processor#process} call. - * - * @type {processOptions} - */ - - }, { - key: "opts", - get: function get() { - return this.result.opts; - } - /** - * Processes input CSS through synchronous plugins, converts `Root` - * to a CSS string and returns {@link Result#css}. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. This is why this method is only - * for debug purpose, you should always use {@link LazyResult#then}. - * - * @type {string} - * @see Result#css - */ - - }, { - key: "css", - get: function get() { - return this.stringify().css; - } - /** - * An alias for the `css` property. Use it with syntaxes - * that generate non-CSS output. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. This is why this method is only - * for debug purpose, you should always use {@link LazyResult#then}. - * - * @type {string} - * @see Result#content - */ - - }, { - key: "content", - get: function get() { - return this.stringify().content; - } - /** - * Processes input CSS through synchronous plugins - * and returns {@link Result#map}. - * - * This property will only work with synchronous plugins. - * If the processor contains any asynchronous plugins - * it will throw an error. This is why this method is only - * for debug purpose, you should always use {@link LazyResult#then}. - * - * @type {SourceMapGenerator} - * @see Result#map - */ - - }, { - key: "map", - get: function get() { - return this.stringify().map; - } - /** - * Processes input CSS through synchronous plugins - * and returns {@link Result#root}. - * - * This property will only work with synchronous plugins. If the processor - * contains any asynchronous plugins it will throw an error. - * - * This is why this method is only for debug purpose, - * you should always use {@link LazyResult#then}. - * - * @type {Root} - * @see Result#root - */ - - }, { - key: "root", - get: function get() { - return this.sync().root; - } - /** - * Processes input CSS through synchronous plugins - * and returns {@link Result#messages}. - * - * This property will only work with synchronous plugins. If the processor - * contains any asynchronous plugins it will throw an error. - * - * This is why this method is only for debug purpose, - * you should always use {@link LazyResult#then}. - * - * @type {Message[]} - * @see Result#messages - */ - - }, { - key: "messages", - get: function get() { - return this.sync().messages; - } - }]); - - return LazyResult; -}(); - -var _default = LazyResult; -/** - * @callback onFulfilled - * @param {Result} result - */ - -/** - * @callback onRejected - * @param {Error} error - */ - -exports.default = _default; -module.exports = exports.default; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxhenktcmVzdWx0LmVzNiJdLCJuYW1lcyI6WyJpc1Byb21pc2UiLCJvYmoiLCJ0aGVuIiwiTGF6eVJlc3VsdCIsInByb2Nlc3NvciIsImNzcyIsIm9wdHMiLCJzdHJpbmdpZmllZCIsInByb2Nlc3NlZCIsInJvb3QiLCJ0eXBlIiwiUmVzdWx0IiwibWFwIiwiaW5saW5lIiwicHJldiIsInBhcnNlciIsInBhcnNlIiwic3ludGF4IiwiZXJyb3IiLCJyZXN1bHQiLCJ3YXJuaW5ncyIsInN5bmMiLCJ0b1N0cmluZyIsIm9uRnVsZmlsbGVkIiwib25SZWplY3RlZCIsInByb2Nlc3MiLCJlbnYiL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iAob3B0cy5zeW50YXgpIHN0ciA9IG9wdHMuc3ludGF4LnN0cmluZ2lmeVxuICAgIGlmIChvcHRzLnN0cmluZ2lmaWVyKSBzdHIgPSBvcHRzLnN0cmluZ2lmaWVyXG4gICAgaWYgKHN0ci5zdHJpbmdpZnkpIHN0ciA9IHN0ci5zdHJpbmdpZnlcblxuICAgIGxldCBtYXAgPSBuZXcgTWFwR2VuZXJhdG9yKHN0ciwgdGhpcy5yZXN1bHQucm9vdCwgdGhpcy5yZXN1bHQub3B0cylcbiAgICBsZXQgZGF0YSA9IG1hcC5nZW5lcmF0ZSgpXG4gICAgdGhpcy5yZXN1bHQuY3NzID0gZGF0YVswXVxuICAgIHRoaXMucmVzdWx0Lm1hcCA9IGRhdGFbMV1cblxuICAgIHJldHVybiB0aGlzLnJlc3VsdFxuICB9XG59XG5cbmV4cG9ydCBkZWZhdWx0IExhenlSZXN1bHRcblxuLyoqXG4gKiBAY2FsbGJhY2sgb25GdWxmaWxsZWRcbiAqIEBwYXJhbSB7UmVzdWx0fSByZXN1bHRcbiAqL1xuXG4vKipcbiAqIEBjYWxsYmFjayBvblJlamVjdGVkXG4gKiBAcGFyYW0ge0Vycm9yfSBlcnJvclxuICovXG4iXSwiZmlsZSI6ImxhenktcmVzdWx0LmpzIn0= - - -/***/ }), -/* 699 */, -/* 700 */, -/* 701 */, -/* 702 */, -/* 703 */, -/* 704 */ -/***/ (function(module, exports, __webpack_require__) { - -/* module decorator */ module = __webpack_require__.nmd(module); -/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** Used to compose bitmasks for comparison styles. */ -var UNORDERED_COMPARE_FLAG = 1, - PARTIAL_COMPARE_FLAG = 2; - -/** Used as references for various `Number` constants. */ -var INFINITY = 1 / 0, - MAX_SAFE_INTEGER = 9007199254740991; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** Used to match property names within property paths. */ -var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, - reIsPlainProp = /^\w*$/, - reLeadingDot = /^\./, - rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; - -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to match backslashes in property paths. */ -var reEscapeChar = /\\(\\)?/g; - -/** Used to detect host constructors (Safari). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used to detect unsigned integer values. */ -var reIsUint = /^(?:0|[1-9]\d*)$/; - -/** Used to identify `toStringTag` values of typed arrays. */ -var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = -typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = -typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = -typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = -typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag] = typedArrayTags[arrayTag] = -typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = -typedArrayTags[errorTag] = typedArrayTags[funcTag] = -typedArrayTags[mapTag] = typedArrayTags[numberTag] = -typedArrayTags[objectTag] = typedArrayTags[regexpTag] = -typedArrayTags[setTag] = typedArrayTags[stringTag] = -typedArrayTags[weakMapTag] = false; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -/** Detect free variable `exports`. */ -var freeExports = true && exports && !exports.nodeType && exports; - -/** Detect free variable `module`. */ -var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; - -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = freeModule && freeModule.exports === freeExports; - -/** Detect free variable `process` from Node.js. */ -var freeProcess = moduleExports && freeGlobal.process; - -/** Used to access faster Node.js helpers. */ -var nodeUtil = (function() { - try { - return freeProcess && freeProcess.binding('util'); - } catch (e) {} -}()); - -/* Node.js helper references. */ -var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; - -/** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ -function arrayEach(array, iteratee) { - var index = -1, - length = array ? array.length : 0; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; -} - -/** - * A specialized version of `_.some` for arrays without support for iteratee - * shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} predicate The function invoked per iteration. - * @returns {boolean} Returns `true` if any element passes the predicate check, - * else `false`. - */ -function arraySome(array, predicate) { - var index = -1, - length = array ? array.length : 0; - - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; -} - -/** - * The base implementation of `_.property` without support for deep paths. - * - * @private - * @param {string} key The key of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function baseProperty(key) { - return function(object) { - return object == null ? undefined : object[key]; - }; -} - -/** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ -function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} - -/** - * The base implementation of `_.unary` without support for storing metadata. - * - * @private - * @param {Function} func The function to cap arguments for. - * @returns {Function} Returns the new capped function. - */ -function baseUnary(func) { - return function(value) { - return func(value); - }; -} - -/** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ -function getValue(object, key) { - return object == null ? undefined : object[key]; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ -function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; -} - -/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} - -/** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - -/** Used to detect overreaching core-js shims. */ -var coreJsData = root['__core-js_shared__']; - -/** Used to detect methods masquerading as native. */ -var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; -}()); - -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** Built-in value references. */ -var Symbol = root.Symbol, - Uint8Array = root.Uint8Array, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeKeys = overArg(Object.keys, Object); - -/* Built-in method references that are verified to be native. */ -var DataView = getNative(root, 'DataView'), - Map = getNative(root, 'Map'), - Promise = getNative(root, 'Promise'), - Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - -/** Used to detect maps, sets, and weakmaps. */ -var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, - symbolToString = symbolProto ? symbolProto.toString : undefined; - -/** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Hash(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ -function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; -} - -/** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(key) { - return this.has(key) && delete this.__data__[key]; -} - -/** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; -} - -/** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); -} - -/** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ -function hashSet(key, value) { - var data = this.__data__; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; -} + } else { + this.asyncTick(resolve, reject); + } + } catch (error) { + this.processed = true; + reject(error); + } + }; -// Add methods to `Hash`. -Hash.prototype.clear = hashClear; -Hash.prototype['delete'] = hashDelete; -Hash.prototype.get = hashGet; -Hash.prototype.has = hashHas; -Hash.prototype.set = hashSet; + _proto.async = function async() { + var _this2 = this; -/** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function ListCache(entries) { - var index = -1, - length = entries ? entries.length : 0; + if (this.processed) { + return new Promise(function (resolve, reject) { + if (_this2.error) { + reject(_this2.error); + } else { + resolve(_this2.stringify()); + } + }); + } - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} + if (this.processing) { + return this.processing; + } -/** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ -function listCacheClear() { - this.__data__ = []; -} + this.processing = new Promise(function (resolve, reject) { + if (_this2.error) return reject(_this2.error); + _this2.plugin = 0; -/** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); + _this2.asyncTick(resolve, reject); + }).then(function () { + _this2.processed = true; + return _this2.stringify(); + }); + return this.processing; + }; - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - return true; -} + _proto.sync = function sync() { + if (this.processed) return this.result; + this.processed = true; -/** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); + if (this.processing) { + throw new Error('Use process(css).then(cb) to work with async plugins'); + } - return index < 0 ? undefined : data[index][1]; -} + if (this.error) throw this.error; -/** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; -} + for (var _iterator = this.result.processor.plugins, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; -/** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ -function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } - if (index < 0) { - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; -} + var plugin = _ref; + var promise = this.run(plugin); -// Add methods to `ListCache`. -ListCache.prototype.clear = listCacheClear; -ListCache.prototype['delete'] = listCacheDelete; -ListCache.prototype.get = listCacheGet; -ListCache.prototype.has = listCacheHas; -ListCache.prototype.set = listCacheSet; + if (isPromise(promise)) { + throw new Error('Use process(css).then(cb) to work with async plugins'); + } + } -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function MapCache(entries) { - var index = -1, - length = entries ? entries.length : 0; + return this.result; + }; - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} + _proto.run = function run(plugin) { + this.result.lastPlugin = plugin; -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapCacheClear() { - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash + try { + return plugin(this.result.root, this.result); + } catch (error) { + this.handleError(error, plugin); + throw error; + } }; -} -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapCacheDelete(key) { - return getMapData(this, key)['delete'](key); -} + _proto.stringify = function stringify() { + if (this.stringified) return this.result; + this.stringified = true; + this.sync(); + var opts = this.result.opts; + var str = _stringify2.default; + if (opts.syntax) str = opts.syntax.stringify; + if (opts.stringifier) str = opts.stringifier; + if (str.stringify) str = str.stringify; + var map = new _mapGenerator.default(str, this.result.root, this.result.opts); + var data = map.generate(); + this.result.css = data[0]; + this.result.map = data[1]; + return this.result; + }; -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapCacheGet(key) { - return getMapData(this, key).get(key); -} + _createClass(LazyResult, [{ + key: "processor", + get: function get() { + return this.result.processor; + } + /** + * Options from the {@link Processor#process} call. + * + * @type {processOptions} + */ -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapCacheHas(key) { - return getMapData(this, key).has(key); -} + }, { + key: "opts", + get: function get() { + return this.result.opts; + } + /** + * Processes input CSS through synchronous plugins, converts `Root` + * to a CSS string and returns {@link Result#css}. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. This is why this method is only + * for debug purpose, you should always use {@link LazyResult#then}. + * + * @type {string} + * @see Result#css + */ -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ -function mapCacheSet(key, value) { - getMapData(this, key).set(key, value); - return this; -} + }, { + key: "css", + get: function get() { + return this.stringify().css; + } + /** + * An alias for the `css` property. Use it with syntaxes + * that generate non-CSS output. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. This is why this method is only + * for debug purpose, you should always use {@link LazyResult#then}. + * + * @type {string} + * @see Result#content + */ -// Add methods to `MapCache`. -MapCache.prototype.clear = mapCacheClear; -MapCache.prototype['delete'] = mapCacheDelete; -MapCache.prototype.get = mapCacheGet; -MapCache.prototype.has = mapCacheHas; -MapCache.prototype.set = mapCacheSet; + }, { + key: "content", + get: function get() { + return this.stringify().content; + } + /** + * Processes input CSS through synchronous plugins + * and returns {@link Result#map}. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. This is why this method is only + * for debug purpose, you should always use {@link LazyResult#then}. + * + * @type {SourceMapGenerator} + * @see Result#map + */ -/** - * - * Creates an array cache object to store unique values. - * - * @private - * @constructor - * @param {Array} [values] The values to cache. - */ -function SetCache(values) { - var index = -1, - length = values ? values.length : 0; + }, { + key: "map", + get: function get() { + return this.stringify().map; + } + /** + * Processes input CSS through synchronous plugins + * and returns {@link Result#root}. + * + * This property will only work with synchronous plugins. If the processor + * contains any asynchronous plugins it will throw an error. + * + * This is why this method is only for debug purpose, + * you should always use {@link LazyResult#then}. + * + * @type {Root} + * @see Result#root + */ - this.__data__ = new MapCache; - while (++index < length) { - this.add(values[index]); - } -} + }, { + key: "root", + get: function get() { + return this.sync().root; + } + /** + * Processes input CSS through synchronous plugins + * and returns {@link Result#messages}. + * + * This property will only work with synchronous plugins. If the processor + * contains any asynchronous plugins it will throw an error. + * + * This is why this method is only for debug purpose, + * you should always use {@link LazyResult#then}. + * + * @type {Message[]} + * @see Result#messages + */ + + }, { + key: "messages", + get: function get() { + return this.sync().messages; + } + }]); + return LazyResult; +}(); + +var _default = LazyResult; /** - * Adds `value` to the array cache. - * - * @private - * @name add - * @memberOf SetCache - * @alias push - * @param {*} value The value to cache. - * @returns {Object} Returns the cache instance. + * @callback onFulfilled + * @param {Result} result */ -function setCacheAdd(value) { - this.__data__.set(value, HASH_UNDEFINED); - return this; -} /** - * Checks if `value` is in the array cache. - * - * @private - * @name has - * @memberOf SetCache - * @param {*} value The value to search for. - * @returns {number} Returns `true` if `value` is found, else `false`. + * @callback onRejected + * @param {Error} error */ -function setCacheHas(value) { - return this.__data__.has(value); -} -// Add methods to `SetCache`. -SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; -SetCache.prototype.has = setCacheHas; +exports.default = _default; +module.exports = exports.default; +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImxhenktcmVzdWx0LmVzNiJdLCJuYW1lcyI6WyJpc1Byb21pc2UiLCJvYmoiLCJ0aGVuIiwiTGF6eVJlc3VsdCIsInByb2Nlc3NvciIsImNzcyIsIm9wdHMiLCJzdHJpbmdpZmllZCIsInByb2Nlc3NlZCIsInJvb3QiLCJ0eXBlIiwiUmVzdWx0IiwibWFwIiwiaW5saW5lIiwicHJldiIsInBhcnNlciIsInBhcnNlIiwic3ludGF4IiwiZXJyb3IiLCJyZXN1bHQiLCJ3YXJuaW5ncyIsInN5bmMiLCJ0b1N0cmluZyIsIm9uRnVsZmlsbGVkIiwib25SZWplY3RlZCIsInByb2Nlc3MiLCJlbnYiLCJOT0RFX0VOViIsImFzeW5jIiwiY2F0Y2giLCJmaW5hbGx5Iiwib25GaW5hbGx5IiwiaGFuZGxlRXJyb3IiLCJwbHVnaW4iLCJuYW1lIiwicG9zdGNzc1BsdWdpbiIsInNldE1lc3NhZ2UiLCJwb3N0Y3NzVmVyc2lvbiIsInBsdWdpbk5hbWUiLCJwbHVnaW5WZXIiLCJydW50aW1lVmVyIiwidmVyc2lvbiIsImEiLCJzcGxpdCIsImIiLCJwYXJzZUludCIsImNvbnNvbGUiLCJlcnIiLCJhc3luY1RpY2siLCJyZXNvbHZlIiwicmVqZWN0IiwicGx1Z2lucyIsImxlbmd0aCIsInByb21pc2UiLCJydW4iLCJQcm9taXNlIiwic3RyaW5naWZ5IiwicHJvY2Vzc2luZyIsIkVycm9yIiwibGFzdFBsdWdpbiIsInN0ciIsInN0cmluZ2lmaWVyIiwiTWFwR2VuZXJhdG9yIiwiZGF0YSIsImdlbmVyYX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W9uKSB7XG4gICAgICAgIGlmIChwcm9jZXNzLmVudi5OT0RFX0VOViAhPT0gJ3Byb2R1Y3Rpb24nKSB7XG4gICAgICAgICAgbGV0IHBsdWdpbk5hbWUgPSBwbHVnaW4ucG9zdGNzc1BsdWdpblxuICAgICAgICAgIGxldCBwbHVnaW5WZXIgPSBwbHVnaW4ucG9zdGNzc1ZlcnNpb25cbiAgICAgICAgICBsZXQgcnVudGltZVZlciA9IHRoaXMucmVzdWx0LnByb2Nlc3Nvci52ZXJzaW9uXG4gICAgICAgICAgbGV0IGEgPSBwbHVnaW5WZXIuc3BsaXQoJy4nKVxuICAgICAgICAgIGxldCBiID0gcnVudGltZVZlci5zcGxpdCgnLicpXG5cbiAgICAgICAgICBpZiAoYVswXSAhPT0gYlswXSB8fCBwYXJzZUludChhWzFdKSA+IHBhcnNlSW50KGJbMV0pKSB7XG4gICAgICAgICAgICBjb25zb2xlLmVycm9yKFxuICAgICAgICAgICAgICAnVW5rbm93biBlcnJvciBmcm9tIFBvc3RDU1MgcGx1Z2luLiBZb3VyIGN1cnJlbnQgUG9zdENTUyAnICtcbiAgICAgICAgICAgICAgJ3ZlcnNpb24gaXMgJyArIHJ1bnRpbWVWZXIgKyAnLCBidXQgJyArIHBsdWdpbk5hbWUgKyAnIHVzZXMgJyArXG4gICAgICAgICAgICAgIHBsdWdpblZlciArICcuIFBlcmhhcHMgdGhpcyBpcyB0aGUgc291cmNlIG9mIHRoZSBlcnJvciBiZWxvdy4nXG4gICAgICAgICAgICApXG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICB9XG4gICAgfSBjYXRjaCAoZXJyKSB7XG4gICAgICBpZiAoY29uc29sZSAmJiBjb25zb2xlLmVycm9yKSBjb25zb2xlLmVycm9yKGVycilcbiAgICB9XG4gIH1cblxuICBhc3luY1RpY2sgKHJlc29sdmUsIHJlamVjdCkge1xuICAgIGlmICh0aGlzLnBsdWdpbiA+PSB0aGlzLnByb2Nlc3Nvci5wbHVnaW5zLmxlbmd0aCkge1xuICAgICAgdGhpcy5wcm9jZXNzZWQgPSB0cnVlXG4gICAgICByZXR1cm4gcmVzb2x2ZSgpXG4gICAgfVxuXG4gICAgdHJ5IHtcbiAgICAgIGxldCBwbHVnaW4gPSB0aGlzLnByb2Nlc3Nvci5wbHVnaW5zW3RoaXMucGx1Z2luXVxuICAgICAgbGV0IHByb21pc2UgPSB0aGlzLnJ1bihwbHVnaW4pXG4gICAgICB0aGlzLnBsdWdpbiArPSAxXG5cbiAgICAgIGlmIChpc1Byb21pc2UocHJvbWlzZSkpIHtcbiAgICAgICAgcHJvbWlzZS50aGVuKCgpID0+IHtcbiAgICAgICAgICB0aGlzLmFzeW5jVGljayhyZXNvbHZlLCByZWplY3QpXG4gICAgICAgIH0pLmNhdGNoKGVycm9yID0+IHtcbiAgICAgICAgICB0aGlzLmhhbmRsZUVycm9yKGVycm9yLCBwbHVnaW4pXG4gICAgICAgICAgdGhpcy5wcm9jZXNzZWQgPSB0cnVlXG4gICAgICAgICAgcmVqZWN0KGVycm9yKVxuICAgICAgICB9KVxuICAgICAgfSBlbHNlIHtcbiAgICAgICAgdGhpcy5hc3luY1RpY2socmVzb2x2ZSwgcmVqZWN0KVxuICAgICAgfVxuICAgIH0gY2F0Y2ggKGVycm9yKSB7XG4gICAgICB0aGlzLnByb2Nlc3NlZCA9IHRydWVcbiAgICAgIHJlamVjdChlcnJvcilcbiAgICB9XG4gIH1cblxuICBhc3luYyAoKSB7XG4gICAgaWYgKHRoaXMucHJvY2Vzc2VkKSB7XG4gICAgICByZXR1cm4gbmV3IFByb21pc2UoKHJlc29sdmUsIHJlamVjdCkgPT4ge1xuICAgICAgICBpZiAodGhpcy5lcnJvcikge1xuICAgICAgICAgIHJlamVjdCh0aGlzLmVycm9yKVxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIHJlc29sdmUodGhpcy5zdHJpbmdpZnkoKSlcbiAgICAgICAgfVxuICAgICAgfSlcbiAgICB9XG4gICAgaWYgKHRoa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GJhY2sgb25GdWxmaWxsZWRcbiAqIEBwYXJhbSB7UmVzdWx0fSByZXN1bHRcbiAqL1xuXG4vKipcbiAqIEBjYWxsYmFjayBvblJlamVjdGVkXG4gKiBAcGFyYW0ge0Vycm9yfSBlcnJvclxuICovXG4iXSwiZmlsZSI6ImxhenktcmVzdWx0LmpzIn0= -/** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Stack(entries) { - this.__data__ = new ListCache(entries); -} -/** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ -function stackClear() { - this.__data__ = new ListCache; -} +/***/ }), +/* 699 */ +/***/ (function(module) { -/** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function stackDelete(key) { - return this.__data__['delete'](key); -} +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +const SEMVER_SPEC_VERSION = '2.0.0' -/** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function stackGet(key) { - return this.__data__.get(key); -} +const MAX_LENGTH = 256 +const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || + /* istanbul ignore next */ 9007199254740991 -/** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function stackHas(key) { - return this.__data__.has(key); +// Max safe segment length for coercion. +const MAX_SAFE_COMPONENT_LENGTH = 16 + +module.exports = { + SEMVER_SPEC_VERSION, + MAX_LENGTH, + MAX_SAFE_INTEGER, + MAX_SAFE_COMPONENT_LENGTH } -/** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ -function stackSet(key, value) { - var cache = this.__data__; - if (cache instanceof ListCache) { - var pairs = cache.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - return this; - } - cache = this.__data__ = new MapCache(pairs); + +/***/ }), +/* 700 */, +/* 701 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SemVer = __webpack_require__(734) +const Range = __webpack_require__(33) + +const maxSatisfying = (versions, range, options) => { + let max = null + let maxSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { + return null } - cache.set(key, value); - return this; + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!max || maxSV.compare(v) === -1) { + // compare(max, v, true) + max = v + maxSV = new SemVer(max, options) + } + } + }) + return max } +module.exports = maxSatisfying -// Add methods to `Stack`. -Stack.prototype.clear = stackClear; -Stack.prototype['delete'] = stackDelete; -Stack.prototype.get = stackGet; -Stack.prototype.has = stackHas; -Stack.prototype.set = stackSet; -/** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ -function arrayLikeKeys(value, inherited) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - // Safari 9 makes `arguments.length` enumerable in strict mode. - var result = (isArray(value) || isArguments(value)) - ? baseTimes(value.length, String) - : []; +/***/ }), +/* 702 */ +/***/ (function(__unusedmodule, exports) { - var length = result.length, - skipIndexes = !!length; +"use strict"; - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && (key == 'length' || isIndex(key, length)))) { - result.push(key); +Object.defineProperty(exports, "__esModule", { value: true }); +var AST_NODE_TYPES; +(function (AST_NODE_TYPES) { + AST_NODE_TYPES["ArrayExpression"] = "ArrayExpression"; + AST_NODE_TYPES["ArrayPattern"] = "ArrayPattern"; + AST_NODE_TYPES["ArrowFunctionExpression"] = "ArrowFunctionExpression"; + AST_NODE_TYPES["AssignmentExpression"] = "AssignmentExpression"; + AST_NODE_TYPES["AssignmentPattern"] = "AssignmentPattern"; + AST_NODE_TYPES["AwaitExpression"] = "AwaitExpression"; + AST_NODE_TYPES["BigIntLiteral"] = "BigIntLiteral"; + AST_NODE_TYPES["BinaryExpression"] = "BinaryExpression"; + AST_NODE_TYPES["BlockStatement"] = "BlockStatement"; + AST_NODE_TYPES["BreakStatement"] = "BreakStatement"; + AST_NODE_TYPES["CallExpression"] = "CallExpression"; + AST_NODE_TYPES["CatchClause"] = "CatchClause"; + AST_NODE_TYPES["ClassBody"] = "ClassBody"; + AST_NODE_TYPES["ClassDeclaration"] = "ClassDeclaration"; + AST_NODE_TYPES["ClassExpression"] = "ClassExpression"; + AST_NODE_TYPES["ClassProperty"] = "ClassProperty"; + AST_NODE_TYPES["ConditionalExpression"] = "ConditionalExpression"; + AST_NODE_TYPES["ContinueStatement"] = "ContinueStatement"; + AST_NODE_TYPES["DebuggerStatement"] = "DebuggerStatement"; + AST_NODE_TYPES["Decorator"] = "Decorator"; + AST_NODE_TYPES["DoWhileStatement"] = "DoWhileStatement"; + AST_NODE_TYPES["EmptyStatement"] = "EmptyStatement"; + AST_NODE_TYPES["ExportAllDeclaration"] = "ExportAllDeclaration"; + AST_NODE_TYPES["ExportDefaultDeclaration"] = "ExportDefaultDeclaration"; + AST_NODE_TYPES["ExportNamedDeclaration"] = "ExportNamedDeclaration"; + AST_NODE_TYPES["ExportSpecifier"] = "ExportSpecifier"; + AST_NODE_TYPES["ExpressionStatement"] = "ExpressionStatement"; + AST_NODE_TYPES["ForInStatement"] = "ForInStatement"; + AST_NODE_TYPES["ForOfStatement"] = "ForOfStatement"; + AST_NODE_TYPES["ForStatement"] = "ForStatement"; + AST_NODE_TYPES["FunctionDeclaration"] = "FunctionDeclaration"; + AST_NODE_TYPES["FunctionExpression"] = "FunctionExpression"; + AST_NODE_TYPES["Identifier"] = "Identifier"; + AST_NODE_TYPES["IfStatement"] = "IfStatement"; + AST_NODE_TYPES["Import"] = "Import"; + AST_NODE_TYPES["ImportDeclaration"] = "ImportDeclaration"; + AST_NODE_TYPES["ImportDefaultSpecifier"] = "ImportDefaultSpecifier"; + AST_NODE_TYPES["ImportNamespaceSpecifier"] = "ImportNamespaceSpecifier"; + AST_NODE_TYPES["ImportSpecifier"] = "ImportSpecifier"; + AST_NODE_TYPES["JSXAttribute"] = "JSXAttribute"; + AST_NODE_TYPES["JSXClosingElement"] = "JSXClosingElement"; + AST_NODE_TYPES["JSXClosingFragment"] = "JSXClosingFragment"; + AST_NODE_TYPES["JSXElement"] = "JSXElement"; + AST_NODE_TYPES["JSXEmptyExpression"] = "JSXEmptyExpression"; + AST_NODE_TYPES["JSXExpressionContainer"] = "JSXExpressionContainer"; + AST_NODE_TYPES["JSXFragment"] = "JSXFragment"; + AST_NODE_TYPES["JSXIdentifier"] = "JSXIdentifier"; + AST_NODE_TYPES["JSXMemberExpression"] = "JSXMemberExpression"; + AST_NODE_TYPES["JSXOpeningElement"] = "JSXOpeningElement"; + AST_NODE_TYPES["JSXOpeningFragment"] = "JSXOpeningFragment"; + AST_NODE_TYPES["JSXSpreadAttribute"] = "JSXSpreadAttribute"; + AST_NODE_TYPES["JSXSpreadChild"] = "JSXSpreadChild"; + AST_NODE_TYPES["JSXText"] = "JSXText"; + AST_NODE_TYPES["LabeledStatement"] = "LabeledStatement"; + AST_NODE_TYPES["Literal"] = "Literal"; + AST_NODE_TYPES["LogicalExpression"] = "LogicalExpression"; + AST_NODE_TYPES["MemberExpression"] = "MemberExpression"; + AST_NODE_TYPES["MetaProperty"] = "MetaProperty"; + AST_NODE_TYPES["MethodDefinition"] = "MethodDefinition"; + AST_NODE_TYPES["NewExpression"] = "NewExpression"; + AST_NODE_TYPES["ObjectExpression"] = "ObjectExpression"; + AST_NODE_TYPES["ObjectPattern"] = "ObjectPattern"; + AST_NODE_TYPES["OptionalCallExpression"] = "OptionalCallExpression"; + AST_NODE_TYPES["OptionalMemberExpression"] = "OptionalMemberExpression"; + AST_NODE_TYPES["Program"] = "Program"; + AST_NODE_TYPES["Property"] = "Property"; + AST_NODE_TYPES["RestElement"] = "RestElement"; + AST_NODE_TYPES["ReturnStatement"] = "ReturnStatement"; + AST_NODE_TYPES["SequenceExpression"] = "SequenceExpression"; + AST_NODE_TYPES["SpreadElement"] = "SpreadElement"; + AST_NODE_TYPES["Super"] = "Super"; + AST_NODE_TYPES["SwitchCase"] = "SwitchCase"; + AST_NODE_TYPES["SwitchStatement"] = "SwitchStatement"; + AST_NODE_TYPES["TaggedTemplateExpression"] = "TaggedTemplateExpression"; + AST_NODE_TYPES["TemplateElement"] = "TemplateElement"; + AST_NODE_TYPES["TemplateLiteral"] = "TemplateLiteral"; + AST_NODE_TYPES["ThisExpression"] = "ThisExpression"; + AST_NODE_TYPES["ThrowStatement"] = "ThrowStatement"; + AST_NODE_TYPES["TryStatement"] = "TryStatement"; + AST_NODE_TYPES["UnaryExpression"] = "UnaryExpression"; + AST_NODE_TYPES["UpdateExpression"] = "UpdateExpression"; + AST_NODE_TYPES["VariableDeclaration"] = "VariableDeclaration"; + AST_NODE_TYPES["VariableDeclarator"] = "VariableDeclarator"; + AST_NODE_TYPES["WhileStatement"] = "WhileStatement"; + AST_NODE_TYPES["WithStatement"] = "WithStatement"; + AST_NODE_TYPES["YieldExpression"] = "YieldExpression"; + /** + * TS-prefixed nodes + */ + AST_NODE_TYPES["TSAbstractClassProperty"] = "TSAbstractClassProperty"; + AST_NODE_TYPES["TSAbstractKeyword"] = "TSAbstractKeyword"; + AST_NODE_TYPES["TSAbstractMethodDefinition"] = "TSAbstractMethodDefinition"; + AST_NODE_TYPES["TSAnyKeyword"] = "TSAnyKeyword"; + AST_NODE_TYPES["TSArrayType"] = "TSArrayType"; + AST_NODE_TYPES["TSAsExpression"] = "TSAsExpression"; + AST_NODE_TYPES["TSAsyncKeyword"] = "TSAsyncKeyword"; + AST_NODE_TYPES["TSBooleanKeyword"] = "TSBooleanKeyword"; + AST_NODE_TYPES["TSBigIntKeyword"] = "TSBigIntKeyword"; + AST_NODE_TYPES["TSConditionalType"] = "TSConditionalType"; + AST_NODE_TYPES["TSConstructorType"] = "TSConstructorType"; + AST_NODE_TYPES["TSCallSignatureDeclaration"] = "TSCallSignatureDeclaration"; + AST_NODE_TYPES["TSClassImplements"] = "TSClassImplements"; + AST_NODE_TYPES["TSConstructSignatureDeclaration"] = "TSConstructSignatureDeclaration"; + AST_NODE_TYPES["TSDeclareKeyword"] = "TSDeclareKeyword"; + AST_NODE_TYPES["TSDeclareFunction"] = "TSDeclareFunction"; + AST_NODE_TYPES["TSEmptyBodyFunctionExpression"] = "TSEmptyBodyFunctionExpression"; + AST_NODE_TYPES["TSEnumDeclaration"] = "TSEnumDeclaration"; + AST_NODE_TYPES["TSEnumMember"] = "TSEnumMember"; + AST_NODE_TYPES["TSExportAssignment"] = "TSExportAssignment"; + AST_NODE_TYPES["TSExportKeyword"] = "TSExportKeyword"; + AST_NODE_TYPES["TSExternalModuleReference"] = "TSExternalModuleReference"; + AST_NODE_TYPES["TSImportType"] = "TSImportType"; + AST_NODE_TYPES["TSInferType"] = "TSInferType"; + AST_NODE_TYPES["TSLiteralType"] = "TSLiteralType"; + AST_NODE_TYPES["TSIndexedAccessType"] = "TSIndexedAccessType"; + AST_NODE_TYPES["TSIndexSignature"] = "TSIndexSignature"; + AST_NODE_TYPES["TSInterfaceBody"] = "TSInterfaceBody"; + AST_NODE_TYPES["TSInterfaceDeclaration"] = "TSInterfaceDeclaration"; + AST_NODE_TYPES["TSInterfaceHeritage"] = "TSInterfaceHeritage"; + AST_NODE_TYPES["TSImportEqualsDeclaration"] = "TSImportEqualsDeclaration"; + AST_NODE_TYPES["TSFunctionType"] = "TSFunctionType"; + AST_NODE_TYPES["TSMethodSignature"] = "TSMethodSignature"; + AST_NODE_TYPES["TSModuleBlock"] = "TSModuleBlock"; + AST_NODE_TYPES["TSModuleDeclaration"] = "TSModuleDeclaration"; + AST_NODE_TYPES["TSNamespaceExportDeclaration"] = "TSNamespaceExportDeclaration"; + AST_NODE_TYPES["TSNonNullExpression"] = "TSNonNullExpression"; + AST_NODE_TYPES["TSNeverKeyword"] = "TSNeverKeyword"; + AST_NODE_TYPES["TSNullKeyword"] = "TSNullKeyword"; + AST_NODE_TYPES["TSNumberKeyword"] = "TSNumberKeyword"; + AST_NODE_TYPES["TSMappedType"] = "TSMappedType"; + AST_NODE_TYPES["TSObjectKeyword"] = "TSObjectKeyword"; + AST_NODE_TYPES["TSParameterProperty"] = "TSParameterProperty"; + AST_NODE_TYPES["TSPrivateKeyword"] = "TSPrivateKeyword"; + AST_NODE_TYPES["TSPropertySignature"] = "TSPropertySignature"; + AST_NODE_TYPES["TSProtectedKeyword"] = "TSProtectedKeyword"; + AST_NODE_TYPES["TSPublicKeyword"] = "TSPublicKeyword"; + AST_NODE_TYPES["TSQualifiedName"] = "TSQualifiedName"; + AST_NODE_TYPES["TSReadonlyKeyword"] = "TSReadonlyKeyword"; + AST_NODE_TYPES["TSRestType"] = "TSRestType"; + AST_NODE_TYPES["TSStaticKeyword"] = "TSStaticKeyword"; + AST_NODE_TYPES["TSStringKeyword"] = "TSStringKeyword"; + AST_NODE_TYPES["TSSymbolKeyword"] = "TSSymbolKeyword"; + AST_NODE_TYPES["TSThisType"] = "TSThisType"; + AST_NODE_TYPES["TSTypeAnnotation"] = "TSTypeAnnotation"; + AST_NODE_TYPES["TSTypeAliasDeclaration"] = "TSTypeAliasDeclaration"; + AST_NODE_TYPES["TSTypeAssertion"] = "TSTypeAssertion"; + AST_NODE_TYPES["TSTypeLiteral"] = "TSTypeLiteral"; + AST_NODE_TYPES["TSTypeOperator"] = "TSTypeOperator"; + AST_NODE_TYPES["TSTypeParameter"] = "TSTypeParameter"; + AST_NODE_TYPES["TSTypeParameterDeclaration"] = "TSTypeParameterDeclaration"; + AST_NODE_TYPES["TSTypeParameterInstantiation"] = "TSTypeParameterInstantiation"; + AST_NODE_TYPES["TSTypePredicate"] = "TSTypePredicate"; + AST_NODE_TYPES["TSTypeReference"] = "TSTypeReference"; + AST_NODE_TYPES["TSTypeQuery"] = "TSTypeQuery"; + AST_NODE_TYPES["TSIntersectionType"] = "TSIntersectionType"; + AST_NODE_TYPES["TSTupleType"] = "TSTupleType"; + AST_NODE_TYPES["TSOptionalType"] = "TSOptionalType"; + AST_NODE_TYPES["TSParenthesizedType"] = "TSParenthesizedType"; + AST_NODE_TYPES["TSUnionType"] = "TSUnionType"; + AST_NODE_TYPES["TSUndefinedKeyword"] = "TSUndefinedKeyword"; + AST_NODE_TYPES["TSUnknownKeyword"] = "TSUnknownKeyword"; + AST_NODE_TYPES["TSVoidKeyword"] = "TSVoidKeyword"; +})(AST_NODE_TYPES = exports.AST_NODE_TYPES || (exports.AST_NODE_TYPES = {})); +var AST_TOKEN_TYPES; +(function (AST_TOKEN_TYPES) { + AST_TOKEN_TYPES["Boolean"] = "Boolean"; + AST_TOKEN_TYPES["Identifier"] = "Identifier"; + AST_TOKEN_TYPES["JSXIdentifier"] = "JSXIdentifier"; + AST_TOKEN_TYPES["JSXText"] = "JSXText"; + AST_TOKEN_TYPES["Keyword"] = "Keyword"; + AST_TOKEN_TYPES["Null"] = "Null"; + AST_TOKEN_TYPES["Numeric"] = "Numeric"; + AST_TOKEN_TYPES["Punctuator"] = "Punctuator"; + AST_TOKEN_TYPES["RegularExpression"] = "RegularExpression"; + AST_TOKEN_TYPES["String"] = "String"; + AST_TOKEN_TYPES["Template"] = "Template"; + // comment types + AST_TOKEN_TYPES["Block"] = "Block"; + AST_TOKEN_TYPES["Line"] = "Line"; +})(AST_TOKEN_TYPES = exports.AST_TOKEN_TYPES || (exports.AST_TOKEN_TYPES = {})); +//# sourceMappingURL=ast-node-types.js.map + +/***/ }), +/* 703 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +// There's lots of funny stuff due to the typing of ts.Node +/* eslint-disable @typescript-eslint/no-explicit-any */ +const ts = __importStar(__webpack_require__(752)); +const node_utils_1 = __webpack_require__(513); +const ts_estree_1 = __webpack_require__(64); +const SyntaxKind = ts.SyntaxKind; +/** + * Extends and formats a given error object + * @param error the error object + * @returns converted error object + */ +function convertError(error) { + return node_utils_1.createError(error.file, error.start, error.message || error.messageText); +} +exports.convertError = convertError; +class Converter { + /** + * Converts a TypeScript node into an ESTree node + * @param ast the full TypeScript AST + * @param options additional options for the conversion + * @returns the converted ESTreeNode + */ + constructor(ast, options) { + this.esTreeNodeToTSNodeMap = new WeakMap(); + this.tsNodeToESTreeNodeMap = new WeakMap(); + this.allowPattern = false; + this.inTypeMode = false; + this.ast = ast; + this.options = Object.assign({}, options); + } + getASTMaps() { + return { + esTreeNodeToTSNodeMap: this.esTreeNodeToTSNodeMap, + tsNodeToESTreeNodeMap: this.tsNodeToESTreeNodeMap, + }; + } + convertProgram() { + return this.converter(this.ast); + } + /** + * Converts a TypeScript node into an ESTree node. + * @param node the child ts.Node + * @param parent parentNode + * @param inTypeMode flag to determine if we are in typeMode + * @param allowPattern flag to determine if patterns are allowed + * @returns the converted ESTree node + */ + converter(node, parent, inTypeMode, allowPattern) { + /** + * Exit early for null and undefined + */ + if (!node) { + return null; + } + const typeMode = this.inTypeMode; + const pattern = this.allowPattern; + if (inTypeMode !== undefined) { + this.inTypeMode = inTypeMode; + } + if (allowPattern !== undefined) { + this.allowPattern = allowPattern; + } + const result = this.convertNode(node, (parent !== null && parent !== void 0 ? parent : node.parent)); + this.registerTSNodeInNodeMap(node, result); + this.inTypeMode = typeMode; + this.allowPattern = pattern; + return result; + } + /** + * Fixes the exports of the given ts.Node + * @param node the ts.Node + * @param result result + * @returns the ESTreeNode with fixed exports + */ + fixExports(node, result) { + // check for exports + if (node.modifiers && node.modifiers[0].kind === SyntaxKind.ExportKeyword) { + /** + * Make sure that original node is registered instead of export + */ + this.registerTSNodeInNodeMap(node, result); + const exportKeyword = node.modifiers[0]; + const nextModifier = node.modifiers[1]; + const declarationIsDefault = nextModifier && nextModifier.kind === SyntaxKind.DefaultKeyword; + const varToken = declarationIsDefault + ? node_utils_1.findNextToken(nextModifier, this.ast, this.ast) + : node_utils_1.findNextToken(exportKeyword, this.ast, this.ast); + result.range[0] = varToken.getStart(this.ast); + result.loc = node_utils_1.getLocFor(result.range[0], result.range[1], this.ast); + if (declarationIsDefault) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ExportDefaultDeclaration, + declaration: result, + range: [exportKeyword.getStart(this.ast), result.range[1]], + exportKind: 'value', + }); + } + else { + const isType = result.type === ts_estree_1.AST_NODE_TYPES.TSInterfaceDeclaration || + result.type === ts_estree_1.AST_NODE_TYPES.TSTypeAliasDeclaration; + const isDeclare = result.declare === true; + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ExportNamedDeclaration, + declaration: result, + specifiers: [], + source: null, + exportKind: isType || isDeclare ? 'type' : 'value', + range: [exportKeyword.getStart(this.ast), result.range[1]], + }); + } + } + return result; + } + /** + * Register specific TypeScript node into map with first ESTree node provided + */ + registerTSNodeInNodeMap(node, result) { + if (result && this.options.shouldPreserveNodeMaps) { + if (!this.tsNodeToESTreeNodeMap.has(node)) { + this.tsNodeToESTreeNodeMap.set(node, result); + } + } + } + /** + * Converts a TypeScript node into an ESTree node. + * @param child the child ts.Node + * @param parent parentNode + * @returns the converted ESTree node + */ + convertPattern(child, parent) { + return this.converter(child, parent, this.inTypeMode, true); + } + /** + * Converts a TypeScript node into an ESTree node. + * @param child the child ts.Node + * @param parent parentNode + * @returns the converted ESTree node + */ + convertChild(child, parent) { + return this.converter(child, parent, this.inTypeMode, false); + } + /** + * Converts a TypeScript node into an ESTree node. + * @param child the child ts.Node + * @param parent parentNode + * @returns the converted ESTree node + */ + convertType(child, parent) { + return this.converter(child, parent, true, false); + } + createNode(node, data) { + const result = data; + if (!result.range) { + result.range = node_utils_1.getRange(node, this.ast); + } + if (!result.loc) { + result.loc = node_utils_1.getLocFor(result.range[0], result.range[1], this.ast); + } + if (result && this.options.shouldPreserveNodeMaps) { + this.esTreeNodeToTSNodeMap.set(result, node); + } + return result; + } + /** + * Converts a child into a type annotation. This creates an intermediary + * TypeAnnotation node to match what Flow does. + * @param child The TypeScript AST node to convert. + * @param parent parentNode + * @returns The type annotation node. + */ + convertTypeAnnotation(child, parent) { + // in FunctionType and ConstructorType typeAnnotation has 2 characters `=>` and in other places is just colon + const offset = parent.kind === SyntaxKind.FunctionType || + parent.kind === SyntaxKind.ConstructorType + ? 2 + : 1; + const annotationStartCol = child.getFullStart() - offset; + const loc = node_utils_1.getLocFor(annotationStartCol, child.end, this.ast); + return { + type: ts_estree_1.AST_NODE_TYPES.TSTypeAnnotation, + loc, + range: [annotationStartCol, child.end], + typeAnnotation: this.convertType(child), + }; + } + /** + * Coverts body Nodes and add a directive field to StringLiterals + * @param nodes of ts.Node + * @param parent parentNode + * @returns Array of body statements + */ + convertBodyExpressions(nodes, parent) { + let allowDirectives = node_utils_1.canContainDirective(parent); + return (nodes + .map(statement => { + const child = this.convertChild(statement); + if (allowDirectives) { + if ((child === null || child === void 0 ? void 0 : child.expression) && + ts.isExpressionStatement(statement) && + ts.isStringLiteral(statement.expression)) { + const raw = child.expression.raw; + child.directive = raw.slice(1, -1); + return child; // child can be null, but it's filtered below + } + else { + allowDirectives = false; + } + } + return child; // child can be null, but it's filtered below + }) + // filter out unknown nodes for now + .filter(statement => statement)); + } + /** + * Converts a ts.Node's typeArguments to TSTypeParameterInstantiation node + * @param typeArguments ts.NodeArray typeArguments + * @param node parent used to create this node + * @returns TypeParameterInstantiation node + */ + convertTypeArgumentsToTypeParameters(typeArguments, node) { + const greaterThanToken = node_utils_1.findNextToken(typeArguments, this.ast, this.ast); + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypeParameterInstantiation, + range: [typeArguments.pos - 1, greaterThanToken.end], + params: typeArguments.map(typeArgument => this.convertType(typeArgument)), + }); + } + /** + * Converts a ts.Node's typeParameters to TSTypeParameterDeclaration node + * @param typeParameters ts.Node typeParameters + * @returns TypeParameterDeclaration node + */ + convertTSTypeParametersToTypeParametersDeclaration(typeParameters) { + const greaterThanToken = node_utils_1.findNextToken(typeParameters, this.ast, this.ast); + return { + type: ts_estree_1.AST_NODE_TYPES.TSTypeParameterDeclaration, + range: [typeParameters.pos - 1, greaterThanToken.end], + loc: node_utils_1.getLocFor(typeParameters.pos - 1, greaterThanToken.end, this.ast), + params: typeParameters.map(typeParameter => this.convertType(typeParameter)), + }; + } + /** + * Converts an array of ts.Node parameters into an array of ESTreeNode params + * @param parameters An array of ts.Node params to be converted + * @returns an array of converted ESTreeNode params + */ + convertParameters(parameters) { + if (!parameters || !parameters.length) { + return []; + } + return parameters.map(param => { + const convertedParam = this.convertChild(param); + if (param.decorators && param.decorators.length) { + convertedParam.decorators = param.decorators.map(el => this.convertChild(el)); + } + return convertedParam; + }); } - } - return result; -} - -/** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; + /** + * For nodes that are copied directly from the TypeScript AST into + * ESTree mostly as-is. The only difference is the addition of a type + * property instead of a kind property. Recursively copies all children. + */ + deeplyCopy(node) { + if (node.kind === ts.SyntaxKind.JSDocFunctionType) { + throw node_utils_1.createError(this.ast, node.pos, 'JSDoc types can only be used inside documentation comments.'); + } + const customType = `TS${SyntaxKind[node.kind]}`; + /** + * If the "errorOnUnknownASTType" option is set to true, throw an error, + * otherwise fallback to just including the unknown type as-is. + */ + if (this.options.errorOnUnknownASTType && !ts_estree_1.AST_NODE_TYPES[customType]) { + throw new Error(`Unknown AST_NODE_TYPE: "${customType}"`); + } + const result = this.createNode(node, { + type: customType, + }); + if ('type' in node) { + result.typeAnnotation = + node.type && 'kind' in node.type && ts.isTypeNode(node.type) + ? this.convertTypeAnnotation(node.type, node) + : null; + } + if ('typeArguments' in node) { + result.typeParameters = + node.typeArguments && 'pos' in node.typeArguments + ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) + : null; + } + if ('typeParameters' in node) { + result.typeParameters = + node.typeParameters && 'pos' in node.typeParameters + ? this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters) + : null; + } + if ('decorators' in node && node.decorators && node.decorators.length) { + result.decorators = node.decorators.map(el => this.convertChild(el)); + } + Object.entries(node) + .filter(([key]) => !/^(?:_children|kind|parent|pos|end|flags|modifierFlagsCache|jsDoc|type|typeArguments|typeParameters|decorators)$/.test(key)) + .forEach(([key, value]) => { + if (Array.isArray(value)) { + result[key] = value.map(el => this.convertChild(el)); + } + else if (value && typeof value === 'object' && value.kind) { + // need to check node[key].kind to ensure we don't try to convert a symbol + result[key] = this.convertChild(value); + } + else { + result[key] = value; + } + }); + return result; } - } - return -1; -} - -/** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ -function baseCreate(proto) { - return isObject(proto) ? objectCreate(proto) : {}; -} - -/** - * The base implementation of `baseForOwn` which iterates over `object` - * properties returned by `keysFunc` and invokes `iteratee` for each property. - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {Function} keysFunc The function to get the keys of `object`. - * @returns {Object} Returns `object`. - */ -var baseFor = createBaseFor(); - -/** - * The base implementation of `_.forOwn` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Object} Returns `object`. - */ -function baseForOwn(object, iteratee) { - return object && baseFor(object, iteratee, keys); -} - -/** - * The base implementation of `_.get` without support for default values. - * - * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @returns {*} Returns the resolved value. - */ -function baseGet(object, path) { - path = isKey(path, object) ? [path] : castPath(path); - - var index = 0, - length = path.length; - - while (object != null && index < length) { - object = object[toKey(path[index++])]; - } - return (index && index == length) ? object : undefined; -} - -/** - * The base implementation of `getTag`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -function baseGetTag(value) { - return objectToString.call(value); -} - -/** - * The base implementation of `_.hasIn` without support for deep paths. - * - * @private - * @param {Object} [object] The object to query. - * @param {Array|string} key The key to check. - * @returns {boolean} Returns `true` if `key` exists, else `false`. - */ -function baseHasIn(object, key) { - return object != null && key in Object(object); -} - -/** - * The base implementation of `_.isEqual` which supports partial comparisons - * and tracks traversed objects. - * - * @private - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @param {Function} [customizer] The function to customize comparisons. - * @param {boolean} [bitmask] The bitmask of comparison flags. - * The bitmask may be composed of the following flags: - * 1 - Unordered comparison - * 2 - Partial comparison - * @param {Object} [stack] Tracks traversed `value` and `other` objects. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - */ -function baseIsEqual(value, other, customizer, bitmask, stack) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { - return value !== value && other !== other; - } - return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); -} - -/** - * A specialized version of `baseIsEqual` for arrays and objects which performs - * deep comparisons and tracks traversed objects enabling objects with circular - * references to be compared. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} [customizer] The function to customize comparisons. - * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` - * for more details. - * @param {Object} [stack] Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = arrayTag, - othTag = arrayTag; - - if (!objIsArr) { - objTag = getTag(object); - objTag = objTag == argsTag ? objectTag : objTag; - } - if (!othIsArr) { - othTag = getTag(other); - othTag = othTag == argsTag ? objectTag : othTag; - } - var objIsObj = objTag == objectTag && !isHostObject(object), - othIsObj = othTag == objectTag && !isHostObject(other), - isSameTag = objTag == othTag; - - if (isSameTag && !objIsObj) { - stack || (stack = new Stack); - return (objIsArr || isTypedArray(object)) - ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) - : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); - } - if (!(bitmask & PARTIAL_COMPARE_FLAG)) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - - if (objIsWrapped || othIsWrapped) { - var objUnwrapped = objIsWrapped ? object.value() : object, - othUnwrapped = othIsWrapped ? other.value() : other; - - stack || (stack = new Stack); - return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); + /** + * Converts a TypeScript JSX node.tagName into an ESTree node.name + * @param node the tagName object from a JSX ts.Node + * @param parent + * @returns the converted ESTree name object + */ + convertJSXTagName(node, parent) { + let result; + switch (node.kind) { + case SyntaxKind.PropertyAccessExpression: + if (node.name.kind === SyntaxKind.PrivateIdentifier) { + // This is one of the few times where TS explicitly errors, and doesn't even gracefully handle the syntax. + // So we shouldn't ever get into this state to begin with. + throw new Error('Non-private identifier expected.'); + } + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXMemberExpression, + object: this.convertJSXTagName(node.expression, parent), + property: this.convertJSXTagName(node.name, parent), + }); + break; + case SyntaxKind.ThisKeyword: + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXIdentifier, + name: 'this', + }); + break; + case SyntaxKind.Identifier: + default: + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXIdentifier, + name: node.text, + }); + break; + } + this.registerTSNodeInNodeMap(node, result); + return result; } - } - if (!isSameTag) { - return false; - } - stack || (stack = new Stack); - return equalObjects(object, other, equalFunc, customizer, bitmask, stack); -} - -/** - * The base implementation of `_.isMatch` without support for iteratee shorthands. - * - * @private - * @param {Object} object The object to inspect. - * @param {Object} source The object of property values to match. - * @param {Array} matchData The property names, values, and compare flags to match. - * @param {Function} [customizer] The function to customize comparisons. - * @returns {boolean} Returns `true` if `object` is a match, else `false`. - */ -function baseIsMatch(object, source, matchData, customizer) { - var index = matchData.length, - length = index, - noCustomizer = !customizer; - - if (object == null) { - return !length; - } - object = Object(object); - while (index--) { - var data = matchData[index]; - if ((noCustomizer && data[2]) - ? data[1] !== object[data[0]] - : !(data[0] in object) - ) { - return false; + /** + * Applies the given TS modifiers to the given result object. + * @param result + * @param modifiers original ts.Nodes from the node.modifiers array + * @returns the current result object will be mutated + * @deprecated This method adds not standardized `modifiers` property in nodes + */ + applyModifiersToResult(result, modifiers) { + if (!modifiers || !modifiers.length) { + return; + } + /** + * Some modifiers are explicitly handled by applying them as + * boolean values on the result node. As well as adding them + * to the result, we remove them from the array, so that they + * are not handled twice. + */ + const handledModifierIndices = {}; + for (let i = 0; i < modifiers.length; i++) { + const modifier = modifiers[i]; + switch (modifier.kind) { + /** + * Ignore ExportKeyword and DefaultKeyword, they are handled + * via the fixExports utility function + */ + case SyntaxKind.ExportKeyword: + case SyntaxKind.DefaultKeyword: + handledModifierIndices[i] = true; + break; + case SyntaxKind.ConstKeyword: + result.const = true; + handledModifierIndices[i] = true; + break; + case SyntaxKind.DeclareKeyword: + result.declare = true; + handledModifierIndices[i] = true; + break; + default: + } + } + /** + * If there are still valid modifiers available which have + * not been explicitly handled above, we just convert and + * add the modifiers array to the result node. + */ + const remainingModifiers = modifiers.filter((_, i) => !handledModifierIndices[i]); + if (!remainingModifiers || !remainingModifiers.length) { + return; + } + result.modifiers = remainingModifiers.map(el => this.convertChild(el)); } - } - while (++index < length) { - data = matchData[index]; - var key = data[0], - objValue = object[key], - srcValue = data[1]; - - if (noCustomizer && data[2]) { - if (objValue === undefined && !(key in object)) { - return false; - } - } else { - var stack = new Stack; - if (customizer) { - var result = customizer(objValue, srcValue, key, object, source, stack); - } - if (!(result === undefined - ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) - : result - )) { - return false; - } + /** + * Uses the provided range location to adjust the location data of the given Node + * @param result The node that will have its location data mutated + * @param childRange The child node range used to expand location + */ + fixParentLocation(result, childRange) { + if (childRange[0] < result.range[0]) { + result.range[0] = childRange[0]; + result.loc.start = node_utils_1.getLineAndCharacterFor(result.range[0], this.ast); + } + if (childRange[1] > result.range[1]) { + result.range[1] = childRange[1]; + result.loc.end = node_utils_1.getLineAndCharacterFor(result.range[1], this.ast); + } + } + /** + * Converts a TypeScript node into an ESTree node. + * The core of the conversion logic: + * Identify and convert each relevant TypeScript SyntaxKind + * @param node the child ts.Node + * @param parent parentNode + * @returns the converted ESTree node + */ + convertNode(node, parent) { + var _a, _b, _c, _d, _e, _f, _g, _h; + switch (node.kind) { + case SyntaxKind.SourceFile: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Program, + body: this.convertBodyExpressions(node.statements, node), + sourceType: node.externalModuleIndicator ? 'module' : 'script', + range: [node.getStart(this.ast), node.endOfFileToken.end], + }); + } + case SyntaxKind.Block: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.BlockStatement, + body: this.convertBodyExpressions(node.statements, node), + }); + } + case SyntaxKind.Identifier: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Identifier, + name: node.text, + }); + } + case SyntaxKind.WithStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.WithStatement, + object: this.convertChild(node.expression), + body: this.convertChild(node.statement), + }); + // Control Flow + case SyntaxKind.ReturnStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ReturnStatement, + argument: this.convertChild(node.expression), + }); + case SyntaxKind.LabeledStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.LabeledStatement, + label: this.convertChild(node.label), + body: this.convertChild(node.statement), + }); + case SyntaxKind.ContinueStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ContinueStatement, + label: this.convertChild(node.label), + }); + case SyntaxKind.BreakStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.BreakStatement, + label: this.convertChild(node.label), + }); + // Choice + case SyntaxKind.IfStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.IfStatement, + test: this.convertChild(node.expression), + consequent: this.convertChild(node.thenStatement), + alternate: this.convertChild(node.elseStatement), + }); + case SyntaxKind.SwitchStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.SwitchStatement, + discriminant: this.convertChild(node.expression), + cases: node.caseBlock.clauses.map(el => this.convertChild(el)), + }); + case SyntaxKind.CaseClause: + case SyntaxKind.DefaultClause: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.SwitchCase, + // expression is present in case only + test: node.kind === SyntaxKind.CaseClause + ? this.convertChild(node.expression) + : null, + consequent: node.statements.map(el => this.convertChild(el)), + }); + // Exceptions + case SyntaxKind.ThrowStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ThrowStatement, + argument: this.convertChild(node.expression), + }); + case SyntaxKind.TryStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TryStatement, + block: this.convertChild(node.tryBlock), + handler: this.convertChild(node.catchClause), + finalizer: this.convertChild(node.finallyBlock), + }); + case SyntaxKind.CatchClause: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.CatchClause, + param: node.variableDeclaration + ? this.convertChild(node.variableDeclaration.name) + : null, + body: this.convertChild(node.block), + }); + // Loops + case SyntaxKind.WhileStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.WhileStatement, + test: this.convertChild(node.expression), + body: this.convertChild(node.statement), + }); + /** + * Unlike other parsers, TypeScript calls a "DoWhileStatement" + * a "DoStatement" + */ + case SyntaxKind.DoStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.DoWhileStatement, + test: this.convertChild(node.expression), + body: this.convertChild(node.statement), + }); + case SyntaxKind.ForStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ForStatement, + init: this.convertChild(node.initializer), + test: this.convertChild(node.condition), + update: this.convertChild(node.incrementor), + body: this.convertChild(node.statement), + }); + case SyntaxKind.ForInStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ForInStatement, + left: this.convertPattern(node.initializer), + right: this.convertChild(node.expression), + body: this.convertChild(node.statement), + }); + case SyntaxKind.ForOfStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ForOfStatement, + left: this.convertPattern(node.initializer), + right: this.convertChild(node.expression), + body: this.convertChild(node.statement), + await: Boolean(node.awaitModifier && + node.awaitModifier.kind === SyntaxKind.AwaitKeyword), + }); + // Declarations + case SyntaxKind.FunctionDeclaration: { + const isDeclare = node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node); + const result = this.createNode(node, { + type: isDeclare || !node.body + ? ts_estree_1.AST_NODE_TYPES.TSDeclareFunction + : ts_estree_1.AST_NODE_TYPES.FunctionDeclaration, + id: this.convertChild(node.name), + generator: !!node.asteriskToken, + expression: false, + async: node_utils_1.hasModifier(SyntaxKind.AsyncKeyword, node), + params: this.convertParameters(node.parameters), + body: this.convertChild(node.body) || undefined, + }); + // Process returnType + if (node.type) { + result.returnType = this.convertTypeAnnotation(node.type, node); + } + if (isDeclare) { + result.declare = true; + } + // Process typeParameters + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + /** + * Semantically, decorators are not allowed on function declarations, + * but the TypeScript compiler will parse them and produce a valid AST, + * so we handle them here too. + */ + if (node.decorators) { + result.decorators = node.decorators.map(el => this.convertChild(el)); + } + // check for exports + return this.fixExports(node, result); + } + case SyntaxKind.VariableDeclaration: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.VariableDeclarator, + id: this.convertPattern(node.name), + init: this.convertChild(node.initializer), + }); + if (node.exclamationToken) { + result.definite = true; + } + if (node.type) { + result.id.typeAnnotation = this.convertTypeAnnotation(node.type, node); + this.fixParentLocation(result.id, result.id.typeAnnotation.range); + } + return result; + } + case SyntaxKind.VariableStatement: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.VariableDeclaration, + declarations: node.declarationList.declarations.map(el => this.convertChild(el)), + kind: node_utils_1.getDeclarationKind(node.declarationList), + }); + /** + * Semantically, decorators are not allowed on variable declarations, + * but the TypeScript compiler will parse them and produce a valid AST, + * so we handle them here too. + */ + if (node.decorators) { + result.decorators = node.decorators.map(el => this.convertChild(el)); + } + if (node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node)) { + result.declare = true; + } + // check for exports + return this.fixExports(node, result); + } + // mostly for for-of, for-in + case SyntaxKind.VariableDeclarationList: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.VariableDeclaration, + declarations: node.declarations.map(el => this.convertChild(el)), + kind: node_utils_1.getDeclarationKind(node), + }); + // Expressions + case SyntaxKind.ExpressionStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ExpressionStatement, + expression: this.convertChild(node.expression), + }); + case SyntaxKind.ThisKeyword: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ThisExpression, + }); + case SyntaxKind.ArrayLiteralExpression: { + // TypeScript uses ArrayLiteralExpression in destructuring assignment, too + if (this.allowPattern) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ArrayPattern, + elements: node.elements.map(el => this.convertPattern(el)), + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ArrayExpression, + elements: node.elements.map(el => this.convertChild(el)), + }); + } + } + case SyntaxKind.ObjectLiteralExpression: { + // TypeScript uses ObjectLiteralExpression in destructuring assignment, too + if (this.allowPattern) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ObjectPattern, + properties: node.properties.map(el => this.convertPattern(el)), + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ObjectExpression, + properties: node.properties.map(el => this.convertChild(el)), + }); + } + } + case SyntaxKind.PropertyAssignment: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Property, + key: this.convertChild(node.name), + value: this.converter(node.initializer, node, this.inTypeMode, this.allowPattern), + computed: node_utils_1.isComputedProperty(node.name), + method: false, + shorthand: false, + kind: 'init', + }); + case SyntaxKind.ShorthandPropertyAssignment: { + if (node.objectAssignmentInitializer) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Property, + key: this.convertChild(node.name), + value: this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, + left: this.convertPattern(node.name), + right: this.convertChild(node.objectAssignmentInitializer), + }), + computed: false, + method: false, + shorthand: true, + kind: 'init', + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Property, + key: this.convertChild(node.name), + value: this.convertChild(node.name), + computed: false, + method: false, + shorthand: true, + kind: 'init', + }); + } + } + case SyntaxKind.ComputedPropertyName: + return this.convertChild(node.expression); + case SyntaxKind.PropertyDeclaration: { + const isAbstract = node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node); + const result = this.createNode(node, { + type: isAbstract + ? ts_estree_1.AST_NODE_TYPES.TSAbstractClassProperty + : ts_estree_1.AST_NODE_TYPES.ClassProperty, + key: this.convertChild(node.name), + value: this.convertChild(node.initializer), + computed: node_utils_1.isComputedProperty(node.name), + static: node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node), + readonly: node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + declare: node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node), + }); + if (node.type) { + result.typeAnnotation = this.convertTypeAnnotation(node.type, node); + } + if (node.decorators) { + result.decorators = node.decorators.map(el => this.convertChild(el)); + } + const accessibility = node_utils_1.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + if ((node.name.kind === SyntaxKind.Identifier || + node.name.kind === SyntaxKind.ComputedPropertyName) && + node.questionToken) { + result.optional = true; + } + if (node.exclamationToken) { + result.definite = true; + } + if (result.key.type === ts_estree_1.AST_NODE_TYPES.Literal && node.questionToken) { + result.optional = true; + } + return result; + } + case SyntaxKind.GetAccessor: + case SyntaxKind.SetAccessor: + case SyntaxKind.MethodDeclaration: { + const method = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.FunctionExpression, + id: null, + generator: !!node.asteriskToken, + expression: false, + async: node_utils_1.hasModifier(SyntaxKind.AsyncKeyword, node), + body: this.convertChild(node.body), + range: [node.parameters.pos - 1, node.end], + params: [], + }); + if (node.type) { + method.returnType = this.convertTypeAnnotation(node.type, node); + } + // Process typeParameters + if (node.typeParameters) { + method.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + this.fixParentLocation(method, method.typeParameters.range); + } + let result; + if (parent.kind === SyntaxKind.ObjectLiteralExpression) { + method.params = node.parameters.map(el => this.convertChild(el)); + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Property, + key: this.convertChild(node.name), + value: method, + computed: node_utils_1.isComputedProperty(node.name), + method: node.kind === SyntaxKind.MethodDeclaration, + shorthand: false, + kind: 'init', + }); + } + else { + // class + /** + * Unlike in object literal methods, class method params can have decorators + */ + method.params = this.convertParameters(node.parameters); + /** + * TypeScript class methods can be defined as "abstract" + */ + const methodDefinitionType = node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node) + ? ts_estree_1.AST_NODE_TYPES.TSAbstractMethodDefinition + : ts_estree_1.AST_NODE_TYPES.MethodDefinition; + result = this.createNode(node, { + type: methodDefinitionType, + key: this.convertChild(node.name), + value: method, + computed: node_utils_1.isComputedProperty(node.name), + static: node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node), + kind: 'method', + }); + if (node.decorators) { + result.decorators = node.decorators.map(el => this.convertChild(el)); + } + const accessibility = node_utils_1.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + } + if (result.key.type === ts_estree_1.AST_NODE_TYPES.Identifier && + node.questionToken) { + result.key.optional = true; + } + if (node.kind === SyntaxKind.GetAccessor) { + result.kind = 'get'; + } + else if (node.kind === SyntaxKind.SetAccessor) { + result.kind = 'set'; + } + else if (!result.static && + node.name.kind === SyntaxKind.StringLiteral && + node.name.text === 'constructor' && + result.type !== ts_estree_1.AST_NODE_TYPES.Property) { + result.kind = 'constructor'; + } + return result; + } + // TypeScript uses this even for static methods named "constructor" + case SyntaxKind.Constructor: { + const lastModifier = node_utils_1.getLastModifier(node); + const constructorToken = (lastModifier && node_utils_1.findNextToken(lastModifier, node, this.ast)) || + node.getFirstToken(); + const constructor = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.FunctionExpression, + id: null, + params: this.convertParameters(node.parameters), + generator: false, + expression: false, + async: false, + body: this.convertChild(node.body), + range: [node.parameters.pos - 1, node.end], + }); + // Process typeParameters + if (node.typeParameters) { + constructor.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + this.fixParentLocation(constructor, constructor.typeParameters.range); + } + // Process returnType + if (node.type) { + constructor.returnType = this.convertTypeAnnotation(node.type, node); + } + const constructorKey = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Identifier, + name: 'constructor', + range: [constructorToken.getStart(this.ast), constructorToken.end], + }); + const isStatic = node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node); + const result = this.createNode(node, { + type: node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node) + ? ts_estree_1.AST_NODE_TYPES.TSAbstractMethodDefinition + : ts_estree_1.AST_NODE_TYPES.MethodDefinition, + key: constructorKey, + value: constructor, + computed: false, + static: isStatic, + kind: isStatic ? 'method' : 'constructor', + }); + const accessibility = node_utils_1.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + return result; + } + case SyntaxKind.FunctionExpression: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.FunctionExpression, + id: this.convertChild(node.name), + generator: !!node.asteriskToken, + params: this.convertParameters(node.parameters), + body: this.convertChild(node.body), + async: node_utils_1.hasModifier(SyntaxKind.AsyncKeyword, node), + expression: false, + }); + // Process returnType + if (node.type) { + result.returnType = this.convertTypeAnnotation(node.type, node); + } + // Process typeParameters + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + return result; + } + case SyntaxKind.SuperKeyword: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Super, + }); + case SyntaxKind.ArrayBindingPattern: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ArrayPattern, + elements: node.elements.map(el => this.convertPattern(el)), + }); + // occurs with missing array elements like [,] + case SyntaxKind.OmittedExpression: + return null; + case SyntaxKind.ObjectBindingPattern: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ObjectPattern, + properties: node.elements.map(el => this.convertPattern(el)), + }); + case SyntaxKind.BindingElement: { + if (parent.kind === SyntaxKind.ArrayBindingPattern) { + const arrayItem = this.convertChild(node.name, parent); + if (node.initializer) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, + left: arrayItem, + right: this.convertChild(node.initializer), + }); + } + else if (node.dotDotDotToken) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.RestElement, + argument: arrayItem, + }); + } + else { + return arrayItem; + } + } + else { + let result; + if (node.dotDotDotToken) { + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.RestElement, + argument: this.convertChild((_a = node.propertyName) !== null && _a !== void 0 ? _a : node.name), + }); + } + else { + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Property, + key: this.convertChild((_b = node.propertyName) !== null && _b !== void 0 ? _b : node.name), + value: this.convertChild(node.name), + computed: Boolean(node.propertyName && + node.propertyName.kind === SyntaxKind.ComputedPropertyName), + method: false, + shorthand: !node.propertyName, + kind: 'init', + }); + } + if (node.initializer) { + result.value = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, + left: this.convertChild(node.name), + right: this.convertChild(node.initializer), + range: [node.name.getStart(this.ast), node.initializer.end], + }); + } + return result; + } + } + case SyntaxKind.ArrowFunction: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ArrowFunctionExpression, + generator: false, + id: null, + params: this.convertParameters(node.parameters), + body: this.convertChild(node.body), + async: node_utils_1.hasModifier(SyntaxKind.AsyncKeyword, node), + expression: node.body.kind !== SyntaxKind.Block, + }); + // Process returnType + if (node.type) { + result.returnType = this.convertTypeAnnotation(node.type, node); + } + // Process typeParameters + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + return result; + } + case SyntaxKind.YieldExpression: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.YieldExpression, + delegate: !!node.asteriskToken, + argument: this.convertChild(node.expression), + }); + case SyntaxKind.AwaitExpression: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.AwaitExpression, + argument: this.convertChild(node.expression), + }); + // Template Literals + case SyntaxKind.NoSubstitutionTemplateLiteral: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TemplateLiteral, + quasis: [ + this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TemplateElement, + value: { + raw: this.ast.text.slice(node.getStart(this.ast) + 1, node.end - 1), + cooked: node.text, + }, + tail: true, + }), + ], + expressions: [], + }); + case SyntaxKind.TemplateExpression: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TemplateLiteral, + quasis: [this.convertChild(node.head)], + expressions: [], + }); + node.templateSpans.forEach(templateSpan => { + result.expressions.push(this.convertChild(templateSpan.expression)); + result.quasis.push(this.convertChild(templateSpan.literal)); + }); + return result; + } + case SyntaxKind.TaggedTemplateExpression: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TaggedTemplateExpression, + typeParameters: node.typeArguments + ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) + : undefined, + tag: this.convertChild(node.tag), + quasi: this.convertChild(node.template), + }); + case SyntaxKind.TemplateHead: + case SyntaxKind.TemplateMiddle: + case SyntaxKind.TemplateTail: { + const tail = node.kind === SyntaxKind.TemplateTail; + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TemplateElement, + value: { + raw: this.ast.text.slice(node.getStart(this.ast) + 1, node.end - (tail ? 1 : 2)), + cooked: node.text, + }, + tail, + }); + } + // Patterns + case SyntaxKind.SpreadAssignment: + case SyntaxKind.SpreadElement: { + if (this.allowPattern) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.RestElement, + argument: this.convertPattern(node.expression), + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.SpreadElement, + argument: this.convertChild(node.expression), + }); + } + } + case SyntaxKind.Parameter: { + let parameter; + let result; + if (node.dotDotDotToken) { + parameter = result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.RestElement, + argument: this.convertChild(node.name), + }); + } + else if (node.initializer) { + parameter = this.convertChild(node.name); + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, + left: parameter, + right: this.convertChild(node.initializer), + }); + if (node.modifiers) { + // AssignmentPattern should not contain modifiers in range + result.range[0] = parameter.range[0]; + result.loc = node_utils_1.getLocFor(result.range[0], result.range[1], this.ast); + } + } + else { + parameter = result = this.convertChild(node.name, parent); + } + if (node.type) { + parameter.typeAnnotation = this.convertTypeAnnotation(node.type, node); + this.fixParentLocation(parameter, parameter.typeAnnotation.range); + } + if (node.questionToken) { + if (node.questionToken.end > parameter.range[1]) { + parameter.range[1] = node.questionToken.end; + parameter.loc.end = node_utils_1.getLineAndCharacterFor(parameter.range[1], this.ast); + } + parameter.optional = true; + } + if (node.modifiers) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSParameterProperty, + accessibility: (_c = node_utils_1.getTSNodeAccessibility(node)) !== null && _c !== void 0 ? _c : undefined, + readonly: node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + static: node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node) || undefined, + export: node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node) || undefined, + parameter: result, + }); + } + return result; + } + // Classes + case SyntaxKind.ClassDeclaration: + case SyntaxKind.ClassExpression: { + const heritageClauses = (_d = node.heritageClauses) !== null && _d !== void 0 ? _d : []; + const classNodeType = node.kind === SyntaxKind.ClassDeclaration + ? ts_estree_1.AST_NODE_TYPES.ClassDeclaration + : ts_estree_1.AST_NODE_TYPES.ClassExpression; + const superClass = heritageClauses.find(clause => clause.token === SyntaxKind.ExtendsKeyword); + const implementsClause = heritageClauses.find(clause => clause.token === SyntaxKind.ImplementsKeyword); + const result = this.createNode(node, { + type: classNodeType, + id: this.convertChild(node.name), + body: this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ClassBody, + body: [], + range: [node.members.pos - 1, node.end], + }), + superClass: (superClass === null || superClass === void 0 ? void 0 : superClass.types[0]) ? this.convertChild(superClass.types[0].expression) + : null, + }); + if (superClass) { + if (superClass.types.length > 1) { + throw node_utils_1.createError(this.ast, superClass.types[1].pos, 'Classes can only extend a single class.'); + } + if (superClass.types[0] && superClass.types[0].typeArguments) { + result.superTypeParameters = this.convertTypeArgumentsToTypeParameters(superClass.types[0].typeArguments, superClass.types[0]); + } + } + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + if (implementsClause) { + result.implements = implementsClause.types.map(el => this.convertChild(el)); + } + /** + * TypeScript class declarations can be defined as "abstract" + */ + if (node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node)) { + result.abstract = true; + } + if (node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node)) { + result.declare = true; + } + if (node.decorators) { + result.decorators = node.decorators.map(el => this.convertChild(el)); + } + const filteredMembers = node.members.filter(node_utils_1.isESTreeClassMember); + if (filteredMembers.length) { + result.body.body = filteredMembers.map(el => this.convertChild(el)); + } + // check for exports + return this.fixExports(node, result); + } + // Modules + case SyntaxKind.ModuleBlock: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSModuleBlock, + body: this.convertBodyExpressions(node.statements, node), + }); + case SyntaxKind.ImportDeclaration: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ImportDeclaration, + source: this.convertChild(node.moduleSpecifier), + specifiers: [], + importKind: 'value', + }); + if (node.importClause) { + if (node.importClause.isTypeOnly) { + result.importKind = 'type'; + } + if (node.importClause.name) { + result.specifiers.push(this.convertChild(node.importClause)); + } + if (node.importClause.namedBindings) { + switch (node.importClause.namedBindings.kind) { + case SyntaxKind.NamespaceImport: + result.specifiers.push(this.convertChild(node.importClause.namedBindings)); + break; + case SyntaxKind.NamedImports: + result.specifiers = result.specifiers.concat(node.importClause.namedBindings.elements.map(el => this.convertChild(el))); + break; + } + } + } + return result; + } + case SyntaxKind.NamespaceImport: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ImportNamespaceSpecifier, + local: this.convertChild(node.name), + }); + case SyntaxKind.ImportSpecifier: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ImportSpecifier, + local: this.convertChild(node.name), + imported: this.convertChild((_e = node.propertyName) !== null && _e !== void 0 ? _e : node.name), + }); + case SyntaxKind.ImportClause: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ImportDefaultSpecifier, + local: this.convertChild(node.name), + range: [node.getStart(this.ast), node.name.end], + }); + case SyntaxKind.ExportDeclaration: + if (((_f = node.exportClause) === null || _f === void 0 ? void 0 : _f.kind) === SyntaxKind.NamedExports) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ExportNamedDeclaration, + source: this.convertChild(node.moduleSpecifier), + specifiers: node.exportClause.elements.map(el => this.convertChild(el)), + exportKind: node.isTypeOnly ? 'type' : 'value', + declaration: null, + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ExportAllDeclaration, + source: this.convertChild(node.moduleSpecifier), + exportKind: node.isTypeOnly ? 'type' : 'value', + exported: + // note - for compat with 3.7.x, where node.exportClause is always undefined and + // SyntaxKind.NamespaceExport does not exist yet (i.e. is undefined), this + // cannot be shortened to an optional chain, or else you end up with + // undefined === undefined, and the true path will hard error at runtime + node.exportClause && + node.exportClause.kind === SyntaxKind.NamespaceExport + ? this.convertChild(node.exportClause.name) + : null, + }); + } + case SyntaxKind.ExportSpecifier: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ExportSpecifier, + local: this.convertChild((_g = node.propertyName) !== null && _g !== void 0 ? _g : node.name), + exported: this.convertChild(node.name), + }); + case SyntaxKind.ExportAssignment: + if (node.isExportEquals) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSExportAssignment, + expression: this.convertChild(node.expression), + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ExportDefaultDeclaration, + declaration: this.convertChild(node.expression), + exportKind: 'value', + }); + } + // Unary Operations + case SyntaxKind.PrefixUnaryExpression: + case SyntaxKind.PostfixUnaryExpression: { + const operator = node_utils_1.getTextForTokenKind(node.operator); + /** + * ESTree uses UpdateExpression for ++/-- + */ + if (operator === '++' || operator === '--') { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.UpdateExpression, + operator, + prefix: node.kind === SyntaxKind.PrefixUnaryExpression, + argument: this.convertChild(node.operand), + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.UnaryExpression, + operator, + prefix: node.kind === SyntaxKind.PrefixUnaryExpression, + argument: this.convertChild(node.operand), + }); + } + } + case SyntaxKind.DeleteExpression: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.UnaryExpression, + operator: 'delete', + prefix: true, + argument: this.convertChild(node.expression), + }); + case SyntaxKind.VoidExpression: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.UnaryExpression, + operator: 'void', + prefix: true, + argument: this.convertChild(node.expression), + }); + case SyntaxKind.TypeOfExpression: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.UnaryExpression, + operator: 'typeof', + prefix: true, + argument: this.convertChild(node.expression), + }); + case SyntaxKind.TypeOperator: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypeOperator, + operator: node_utils_1.getTextForTokenKind(node.operator), + typeAnnotation: this.convertChild(node.type), + }); + // Binary Operations + case SyntaxKind.BinaryExpression: { + // TypeScript uses BinaryExpression for sequences as well + if (node_utils_1.isComma(node.operatorToken)) { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.SequenceExpression, + expressions: [], + }); + const left = this.convertChild(node.left); + if (left.type === ts_estree_1.AST_NODE_TYPES.SequenceExpression && + node.left.kind !== SyntaxKind.ParenthesizedExpression) { + result.expressions = result.expressions.concat(left.expressions); + } + else { + result.expressions.push(left); + } + result.expressions.push(this.convertChild(node.right)); + return result; + } + else { + const type = node_utils_1.getBinaryExpressionType(node.operatorToken); + if (this.allowPattern && + type === ts_estree_1.AST_NODE_TYPES.AssignmentExpression) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.AssignmentPattern, + left: this.convertPattern(node.left, node), + right: this.convertChild(node.right), + }); + } + return this.createNode(node, { + type, + operator: node_utils_1.getTextForTokenKind(node.operatorToken.kind), + left: this.converter(node.left, node, this.inTypeMode, type === ts_estree_1.AST_NODE_TYPES.AssignmentExpression), + right: this.convertChild(node.right), + }); + } + } + case SyntaxKind.PropertyAccessExpression: { + const object = this.convertChild(node.expression); + const property = this.convertChild(node.name); + const computed = false; + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propagate up the member expression tree + const isChildOptional = (object.type === ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression || + object.type === ts_estree_1.AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z is semantically different, and as such .z is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + if (isLocallyOptional || isChildOptional) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression, + object, + property, + computed, + optional: isLocallyOptional, + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.MemberExpression, + object, + property, + computed, + optional: false, + }); + } + } + case SyntaxKind.ElementAccessExpression: { + const object = this.convertChild(node.expression); + const property = this.convertChild(node.argumentExpression); + const computed = true; + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propagate up the member expression tree + const isChildOptional = (object.type === ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression || + object.type === ts_estree_1.AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z is semantically different, and as such .z is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + if (isLocallyOptional || isChildOptional) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression, + object, + property, + computed, + optional: isLocallyOptional, + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.MemberExpression, + object, + property, + computed, + optional: false, + }); + } + } + case SyntaxKind.CallExpression: { + const callee = this.convertChild(node.expression); + const args = node.arguments.map(el => this.convertChild(el)); + let result; + const isLocallyOptional = node.questionDotToken !== undefined; + // the optional expression should propagate up the member expression tree + const isChildOptional = (callee.type === ts_estree_1.AST_NODE_TYPES.OptionalMemberExpression || + callee.type === ts_estree_1.AST_NODE_TYPES.OptionalCallExpression) && + // (x?.y).z() is semantically different, and as such .z() is no longer optional + node.expression.kind !== ts.SyntaxKind.ParenthesizedExpression; + if (isLocallyOptional || isChildOptional) { + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.OptionalCallExpression, + callee, + arguments: args, + optional: isLocallyOptional, + }); + } + else { + result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.CallExpression, + callee, + arguments: args, + optional: false, + }); + } + if (node.typeArguments) { + result.typeParameters = this.convertTypeArgumentsToTypeParameters(node.typeArguments, node); + } + return result; + } + case SyntaxKind.NewExpression: { + // NOTE - NewExpression cannot have an optional chain in it + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.NewExpression, + callee: this.convertChild(node.expression), + arguments: node.arguments + ? node.arguments.map(el => this.convertChild(el)) + : [], + }); + if (node.typeArguments) { + result.typeParameters = this.convertTypeArgumentsToTypeParameters(node.typeArguments, node); + } + return result; + } + case SyntaxKind.ConditionalExpression: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.ConditionalExpression, + test: this.convertChild(node.condition), + consequent: this.convertChild(node.whenTrue), + alternate: this.convertChild(node.whenFalse), + }); + case SyntaxKind.MetaProperty: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.MetaProperty, + meta: this.createNode( + // TODO: do we really want to convert it to Token? + node.getFirstToken(), { + type: ts_estree_1.AST_NODE_TYPES.Identifier, + name: node_utils_1.getTextForTokenKind(node.keywordToken), + }), + property: this.convertChild(node.name), + }); + } + case SyntaxKind.Decorator: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Decorator, + expression: this.convertChild(node.expression), + }); + } + // Literals + case SyntaxKind.StringLiteral: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Literal, + raw: '', + value: '', + }); + result.raw = this.ast.text.slice(result.range[0], result.range[1]); + if ('name' in parent && parent.name === node) { + result.value = node.text; + } + else { + result.value = node_utils_1.unescapeStringLiteralText(node.text); + } + return result; + } + case SyntaxKind.NumericLiteral: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Literal, + value: Number(node.text), + raw: node.getText(), + }); + } + case SyntaxKind.BigIntLiteral: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.BigIntLiteral, + raw: '', + value: '', + }); + result.raw = this.ast.text.slice(result.range[0], result.range[1]); + result.value = result.raw.slice(0, -1); // remove suffix `n` + return result; + } + case SyntaxKind.RegularExpressionLiteral: { + const pattern = node.text.slice(1, node.text.lastIndexOf('/')); + const flags = node.text.slice(node.text.lastIndexOf('/') + 1); + let regex = null; + try { + regex = new RegExp(pattern, flags); + } + catch (exception) { + regex = null; + } + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Literal, + value: regex, + raw: node.text, + regex: { + pattern, + flags, + }, + }); + } + case SyntaxKind.TrueKeyword: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Literal, + value: true, + raw: 'true', + }); + case SyntaxKind.FalseKeyword: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Literal, + value: false, + raw: 'false', + }); + case SyntaxKind.NullKeyword: { + if (this.inTypeMode) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSNullKeyword, + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Literal, + value: null, + raw: 'null', + }); + } + } + case SyntaxKind.ImportKeyword: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Import, + }); + case SyntaxKind.EmptyStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.EmptyStatement, + }); + case SyntaxKind.DebuggerStatement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.DebuggerStatement, + }); + // JSX + case SyntaxKind.JsxElement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXElement, + openingElement: this.convertChild(node.openingElement), + closingElement: this.convertChild(node.closingElement), + children: node.children.map(el => this.convertChild(el)), + }); + case SyntaxKind.JsxFragment: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXFragment, + openingFragment: this.convertChild(node.openingFragment), + closingFragment: this.convertChild(node.closingFragment), + children: node.children.map(el => this.convertChild(el)), + }); + case SyntaxKind.JsxSelfClosingElement: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXElement, + /** + * Convert SyntaxKind.JsxSelfClosingElement to SyntaxKind.JsxOpeningElement, + * TypeScript does not seem to have the idea of openingElement when tag is self-closing + */ + openingElement: this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXOpeningElement, + typeParameters: node.typeArguments + ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) + : undefined, + selfClosing: true, + name: this.convertJSXTagName(node.tagName, node), + attributes: node.attributes.properties.map(el => this.convertChild(el)), + range: node_utils_1.getRange(node, this.ast), + }), + closingElement: null, + children: [], + }); + } + case SyntaxKind.JsxOpeningElement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXOpeningElement, + typeParameters: node.typeArguments + ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) + : undefined, + selfClosing: false, + name: this.convertJSXTagName(node.tagName, node), + attributes: node.attributes.properties.map(el => this.convertChild(el)), + }); + case SyntaxKind.JsxClosingElement: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXClosingElement, + name: this.convertJSXTagName(node.tagName, node), + }); + case SyntaxKind.JsxOpeningFragment: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXOpeningFragment, + }); + case SyntaxKind.JsxClosingFragment: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXClosingFragment, + }); + case SyntaxKind.JsxExpression: { + const expression = node.expression + ? this.convertChild(node.expression) + : this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXEmptyExpression, + range: [node.getStart(this.ast) + 1, node.getEnd() - 1], + }); + if (node.dotDotDotToken) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXSpreadChild, + expression, + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXExpressionContainer, + expression, + }); + } + } + case SyntaxKind.JsxAttribute: { + const attributeName = this.convertChild(node.name); + attributeName.type = ts_estree_1.AST_NODE_TYPES.JSXIdentifier; + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXAttribute, + name: attributeName, + value: this.convertChild(node.initializer), + }); + } + /** + * The JSX AST changed the node type for string literals + * inside a JSX Element from `Literal` to `JSXText`. We + * provide a flag to support both types until `Literal` + * node type is deprecated in ESLint v5. + */ + case SyntaxKind.JsxText: { + const start = node.getFullStart(); + const end = node.getEnd(); + if (this.options.useJSXTextNode) { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXText, + value: this.ast.text.slice(start, end), + raw: this.ast.text.slice(start, end), + range: [start, end], + }); + } + else { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.Literal, + value: this.ast.text.slice(start, end), + raw: this.ast.text.slice(start, end), + range: [start, end], + }); + } + } + case SyntaxKind.JsxSpreadAttribute: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.JSXSpreadAttribute, + argument: this.convertChild(node.expression), + }); + case SyntaxKind.QualifiedName: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSQualifiedName, + left: this.convertChild(node.left), + right: this.convertChild(node.right), + }); + } + // TypeScript specific + case SyntaxKind.TypeReference: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypeReference, + typeName: this.convertType(node.typeName), + typeParameters: node.typeArguments + ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) + : undefined, + }); + } + case SyntaxKind.TypeParameter: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypeParameter, + name: this.convertType(node.name), + constraint: node.constraint + ? this.convertType(node.constraint) + : undefined, + default: node.default ? this.convertType(node.default) : undefined, + }); + } + case SyntaxKind.ThisType: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSThisType, + }); + case SyntaxKind.AnyKeyword: + case SyntaxKind.BigIntKeyword: + case SyntaxKind.BooleanKeyword: + case SyntaxKind.NeverKeyword: + case SyntaxKind.NumberKeyword: + case SyntaxKind.ObjectKeyword: + case SyntaxKind.StringKeyword: + case SyntaxKind.SymbolKeyword: + case SyntaxKind.UnknownKeyword: + case SyntaxKind.VoidKeyword: + case SyntaxKind.UndefinedKeyword: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES[`TS${SyntaxKind[node.kind]}`], + }); + } + case SyntaxKind.NonNullExpression: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSNonNullExpression, + expression: this.convertChild(node.expression), + }); + } + case SyntaxKind.TypeLiteral: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypeLiteral, + members: node.members.map(el => this.convertChild(el)), + }); + } + case SyntaxKind.ArrayType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSArrayType, + elementType: this.convertType(node.elementType), + }); + } + case SyntaxKind.IndexedAccessType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSIndexedAccessType, + objectType: this.convertType(node.objectType), + indexType: this.convertType(node.indexType), + }); + } + case SyntaxKind.ConditionalType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSConditionalType, + checkType: this.convertType(node.checkType), + extendsType: this.convertType(node.extendsType), + trueType: this.convertType(node.trueType), + falseType: this.convertType(node.falseType), + }); + } + case SyntaxKind.TypeQuery: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypeQuery, + exprName: this.convertType(node.exprName), + }); + } + case SyntaxKind.MappedType: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSMappedType, + typeParameter: this.convertType(node.typeParameter), + }); + if (node.readonlyToken) { + if (node.readonlyToken.kind === SyntaxKind.ReadonlyKeyword) { + result.readonly = true; + } + else { + result.readonly = node_utils_1.getTextForTokenKind(node.readonlyToken.kind); + } + } + if (node.questionToken) { + if (node.questionToken.kind === SyntaxKind.QuestionToken) { + result.optional = true; + } + else { + result.optional = node_utils_1.getTextForTokenKind(node.questionToken.kind); + } + } + if (node.type) { + result.typeAnnotation = this.convertType(node.type); + } + return result; + } + case SyntaxKind.ParenthesizedExpression: + return this.convertChild(node.expression, parent); + case SyntaxKind.TypeAliasDeclaration: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypeAliasDeclaration, + id: this.convertChild(node.name), + typeAnnotation: this.convertType(node.type), + }); + if (node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node)) { + result.declare = true; + } + // Process typeParameters + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + // check for exports + return this.fixExports(node, result); + } + case SyntaxKind.MethodSignature: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSMethodSignature, + computed: node_utils_1.isComputedProperty(node.name), + key: this.convertChild(node.name), + params: this.convertParameters(node.parameters), + }); + if (node_utils_1.isOptional(node)) { + result.optional = true; + } + if (node.type) { + result.returnType = this.convertTypeAnnotation(node.type, node); + } + if (node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node)) { + result.readonly = true; + } + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + const accessibility = node_utils_1.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + if (node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node)) { + result.export = true; + } + if (node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node)) { + result.static = true; + } + return result; + } + case SyntaxKind.PropertySignature: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSPropertySignature, + optional: node_utils_1.isOptional(node) || undefined, + computed: node_utils_1.isComputedProperty(node.name), + key: this.convertChild(node.name), + typeAnnotation: node.type + ? this.convertTypeAnnotation(node.type, node) + : undefined, + initializer: this.convertChild(node.initializer) || undefined, + readonly: node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + static: node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node) || undefined, + export: node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node) || undefined, + }); + const accessibility = node_utils_1.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + return result; + } + case SyntaxKind.IndexSignature: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSIndexSignature, + parameters: node.parameters.map(el => this.convertChild(el)), + }); + if (node.type) { + result.typeAnnotation = this.convertTypeAnnotation(node.type, node); + } + if (node_utils_1.hasModifier(SyntaxKind.ReadonlyKeyword, node)) { + result.readonly = true; + } + const accessibility = node_utils_1.getTSNodeAccessibility(node); + if (accessibility) { + result.accessibility = accessibility; + } + if (node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node)) { + result.export = true; + } + if (node_utils_1.hasModifier(SyntaxKind.StaticKeyword, node)) { + result.static = true; + } + return result; + } + case SyntaxKind.ConstructorType: + case SyntaxKind.FunctionType: + case SyntaxKind.ConstructSignature: + case SyntaxKind.CallSignature: { + let type; + switch (node.kind) { + case SyntaxKind.ConstructSignature: + type = ts_estree_1.AST_NODE_TYPES.TSConstructSignatureDeclaration; + break; + case SyntaxKind.CallSignature: + type = ts_estree_1.AST_NODE_TYPES.TSCallSignatureDeclaration; + break; + case SyntaxKind.FunctionType: + type = ts_estree_1.AST_NODE_TYPES.TSFunctionType; + break; + case SyntaxKind.ConstructorType: + default: + type = ts_estree_1.AST_NODE_TYPES.TSConstructorType; + break; + } + const result = this.createNode(node, { + type: type, + params: this.convertParameters(node.parameters), + }); + if (node.type) { + result.returnType = this.convertTypeAnnotation(node.type, node); + } + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + return result; + } + case SyntaxKind.ExpressionWithTypeArguments: { + const result = this.createNode(node, { + type: parent && parent.kind === SyntaxKind.InterfaceDeclaration + ? ts_estree_1.AST_NODE_TYPES.TSInterfaceHeritage + : ts_estree_1.AST_NODE_TYPES.TSClassImplements, + expression: this.convertChild(node.expression), + }); + if (node.typeArguments) { + result.typeParameters = this.convertTypeArgumentsToTypeParameters(node.typeArguments, node); + } + return result; + } + case SyntaxKind.InterfaceDeclaration: { + const interfaceHeritageClauses = (_h = node.heritageClauses) !== null && _h !== void 0 ? _h : []; + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSInterfaceDeclaration, + body: this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSInterfaceBody, + body: node.members.map(member => this.convertChild(member)), + range: [node.members.pos - 1, node.end], + }), + id: this.convertChild(node.name), + }); + if (node.typeParameters) { + result.typeParameters = this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters); + } + if (interfaceHeritageClauses.length > 0) { + const interfaceExtends = []; + const interfaceImplements = []; + for (const heritageClause of interfaceHeritageClauses) { + if (heritageClause.token === SyntaxKind.ExtendsKeyword) { + for (const n of heritageClause.types) { + interfaceExtends.push(this.convertChild(n, node)); + } + } + else { + for (const n of heritageClause.types) { + interfaceImplements.push(this.convertChild(n, node)); + } + } + } + if (interfaceExtends.length) { + result.extends = interfaceExtends; + } + if (interfaceImplements.length) { + result.implements = interfaceImplements; + } + } + /** + * Semantically, decorators are not allowed on interface declarations, + * but the TypeScript compiler will parse them and produce a valid AST, + * so we handle them here too. + */ + if (node.decorators) { + result.decorators = node.decorators.map(el => this.convertChild(el)); + } + if (node_utils_1.hasModifier(SyntaxKind.AbstractKeyword, node)) { + result.abstract = true; + } + if (node_utils_1.hasModifier(SyntaxKind.DeclareKeyword, node)) { + result.declare = true; + } + // check for exports + return this.fixExports(node, result); + } + case SyntaxKind.TypePredicate: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypePredicate, + asserts: node.assertsModifier !== undefined, + parameterName: this.convertChild(node.parameterName), + typeAnnotation: null, + }); + /** + * Specific fix for type-guard location data + */ + if (node.type) { + result.typeAnnotation = this.convertTypeAnnotation(node.type, node); + result.typeAnnotation.loc = result.typeAnnotation.typeAnnotation.loc; + result.typeAnnotation.range = + result.typeAnnotation.typeAnnotation.range; + } + return result; + } + case SyntaxKind.ImportType: + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSImportType, + isTypeOf: !!node.isTypeOf, + parameter: this.convertChild(node.argument), + qualifier: this.convertChild(node.qualifier), + typeParameters: node.typeArguments + ? this.convertTypeArgumentsToTypeParameters(node.typeArguments, node) + : null, + }); + case SyntaxKind.EnumDeclaration: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSEnumDeclaration, + id: this.convertChild(node.name), + members: node.members.map(el => this.convertChild(el)), + }); + // apply modifiers first... + this.applyModifiersToResult(result, node.modifiers); + /** + * Semantically, decorators are not allowed on enum declarations, + * but the TypeScript compiler will parse them and produce a valid AST, + * so we handle them here too. + */ + if (node.decorators) { + result.decorators = node.decorators.map(el => this.convertChild(el)); + } + // ...then check for exports + return this.fixExports(node, result); + } + case SyntaxKind.EnumMember: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSEnumMember, + id: this.convertChild(node.name), + }); + if (node.initializer) { + result.initializer = this.convertChild(node.initializer); + } + if (node.name.kind === ts.SyntaxKind.ComputedPropertyName) { + result.computed = true; + } + return result; + } + case SyntaxKind.ModuleDeclaration: { + const result = this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSModuleDeclaration, + id: this.convertChild(node.name), + }); + if (node.body) { + result.body = this.convertChild(node.body); + } + // apply modifiers first... + this.applyModifiersToResult(result, node.modifiers); + if (node.flags & ts.NodeFlags.GlobalAugmentation) { + result.global = true; + } + // ...then check for exports + return this.fixExports(node, result); + } + // TypeScript specific types + case SyntaxKind.OptionalType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSOptionalType, + typeAnnotation: this.convertType(node.type), + }); + } + case SyntaxKind.ParenthesizedType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSParenthesizedType, + typeAnnotation: this.convertType(node.type), + }); + } + case SyntaxKind.TupleType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTupleType, + elementTypes: node.elementTypes.map(el => this.convertType(el)), + }); + } + case SyntaxKind.UnionType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSUnionType, + types: node.types.map(el => this.convertType(el)), + }); + } + case SyntaxKind.IntersectionType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSIntersectionType, + types: node.types.map(el => this.convertType(el)), + }); + } + case SyntaxKind.RestType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSRestType, + typeAnnotation: this.convertType(node.type), + }); + } + case SyntaxKind.AsExpression: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSAsExpression, + expression: this.convertChild(node.expression), + typeAnnotation: this.convertType(node.type), + }); + } + case SyntaxKind.InferType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSInferType, + typeParameter: this.convertType(node.typeParameter), + }); + } + case SyntaxKind.LiteralType: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSLiteralType, + literal: this.convertType(node.literal), + }); + } + case SyntaxKind.TypeAssertionExpression: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSTypeAssertion, + typeAnnotation: this.convertType(node.type), + expression: this.convertChild(node.expression), + }); + } + case SyntaxKind.ImportEqualsDeclaration: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSImportEqualsDeclaration, + id: this.convertChild(node.name), + moduleReference: this.convertChild(node.moduleReference), + isExport: node_utils_1.hasModifier(SyntaxKind.ExportKeyword, node), + }); + } + case SyntaxKind.ExternalModuleReference: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSExternalModuleReference, + expression: this.convertChild(node.expression), + }); + } + case SyntaxKind.NamespaceExportDeclaration: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSNamespaceExportDeclaration, + id: this.convertChild(node.name), + }); + } + case SyntaxKind.AbstractKeyword: { + return this.createNode(node, { + type: ts_estree_1.AST_NODE_TYPES.TSAbstractKeyword, + }); + } + default: + return this.deeplyCopy(node); + } } - } - return true; -} - -/** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ -function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); } +exports.Converter = Converter; +//# sourceMappingURL=convert.js.map -/** - * The base implementation of `_.isTypedArray` without Node.js optimizations. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - */ -function baseIsTypedArray(value) { - return isObjectLike(value) && - isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; -} +/***/ }), +/* 704 */ +/***/ (function(module, exports, __webpack_require__) { +/* module decorator */ module = __webpack_require__.nmd(module); /** - * The base implementation of `_.iteratee`. - * - * @private - * @param {*} [value=_.identity] The value to convert to an iteratee. - * @returns {Function} Returns the iteratee. + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ -function baseIteratee(value) { - // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. - // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. - if (typeof value == 'function') { - return value; - } - if (value == null) { - return identity; - } - if (typeof value == 'object') { - return isArray(value) - ? baseMatchesProperty(value[0], value[1]) - : baseMatches(value); - } - return property(value); -} -/** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; -} +/** Used as the size to enable large array optimizations. */ +var LARGE_ARRAY_SIZE = 200; -/** - * The base implementation of `_.matches` which doesn't clone `source`. - * - * @private - * @param {Object} source The object of property values to match. - * @returns {Function} Returns the new spec function. - */ -function baseMatches(source) { - var matchData = getMatchData(source); - if (matchData.length == 1 && matchData[0][2]) { - return matchesStrictComparable(matchData[0][0], matchData[0][1]); - } - return function(object) { - return object === source || baseIsMatch(object, source, matchData); - }; -} +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; -/** - * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. - * - * @private - * @param {string} path The path of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. - */ -function baseMatchesProperty(path, srcValue) { - if (isKey(path) && isStrictComparable(srcValue)) { - return matchesStrictComparable(toKey(path), srcValue); - } - return function(object) { - var objValue = get(object, path); - return (objValue === undefined && objValue === srcValue) - ? hasIn(object, path) - : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); - }; -} +/** Used to stand-in for `undefined` hash values. */ +var HASH_UNDEFINED = '__lodash_hash_undefined__'; -/** - * A specialized version of `baseProperty` which supports deep paths. - * - * @private - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. - */ -function basePropertyDeep(path) { - return function(object) { - return baseGet(object, path); - }; -} +/** Used to compose bitmasks for comparison styles. */ +var UNORDERED_COMPARE_FLAG = 1, + PARTIAL_COMPARE_FLAG = 2; -/** - * The base implementation of `_.toString` which doesn't convert nullish - * values to empty strings. - * - * @private - * @param {*} value The value to process. - * @returns {string} Returns the string. - */ -function baseToString(value) { - // Exit early for strings to avoid a performance hit in some environments. - if (typeof value == 'string') { - return value; - } - if (isSymbol(value)) { - return symbolToString ? symbolToString.call(value) : ''; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; -} +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0, + MAX_SAFE_INTEGER = 9007199254740991; -/** - * Casts `value` to a path array if it's not one. - * - * @private - * @param {*} value The value to inspect. - * @returns {Array} Returns the cast property path array. - */ -function castPath(value) { - return isArray(value) ? value : stringToPath(value); -} +/** `Object#toString` result references. */ +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + genTag = '[object GeneratorFunction]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + promiseTag = '[object Promise]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + symbolTag = '[object Symbol]', + weakMapTag = '[object WeakMap]'; -/** - * Creates a base function for methods like `_.forIn` and `_.forOwn`. - * - * @private - * @param {boolean} [fromRight] Specify iterating from right to left. - * @returns {Function} Returns the new base function. - */ -function createBaseFor(fromRight) { - return function(object, iteratee, keysFunc) { - var index = -1, - iterable = Object(object), - props = keysFunc(object), - length = props.length; +var arrayBufferTag = '[object ArrayBuffer]', + dataViewTag = '[object DataView]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; - while (length--) { - var key = props[fromRight ? length : ++index]; - if (iteratee(iterable[key], key, iterable) === false) { - break; - } - } - return object; - }; -} +/** Used to match property names within property paths. */ +var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, + reIsPlainProp = /^\w*$/, + reLeadingDot = /^\./, + rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g; /** - * A specialized version of `baseIsEqualDeep` for arrays with support for - * partial deep comparisons. - * - * @private - * @param {Array} array The array to compare. - * @param {Array} other The other array to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} customizer The function to customize comparisons. - * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` - * for more details. - * @param {Object} stack Tracks traversed `array` and `other` objects. - * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + * Used to match `RegExp` + * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ -function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { - var isPartial = bitmask & PARTIAL_COMPARE_FLAG, - arrLength = array.length, - othLength = other.length; - - if (arrLength != othLength && !(isPartial && othLength > arrLength)) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(array); - if (stacked && stack.get(other)) { - return stacked == other; - } - var index = -1, - result = true, - seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; +var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - stack.set(array, other); - stack.set(other, array); +/** Used to match backslashes in property paths. */ +var reEscapeChar = /\\(\\)?/g; - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index]; +/** Used to detect host constructors (Safari). */ +var reIsHostCtor = /^\[object .+?Constructor\]$/; - if (customizer) { - var compared = isPartial - ? customizer(othValue, arrValue, index, other, array, stack) - : customizer(arrValue, othValue, index, array, other, stack); - } - if (compared !== undefined) { - if (compared) { - continue; - } - result = false; - break; - } - // Recursively compare arrays (susceptible to call stack limits). - if (seen) { - if (!arraySome(other, function(othValue, othIndex) { - if (!seen.has(othIndex) && - (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { - return seen.add(othIndex); - } - })) { - result = false; - break; - } - } else if (!( - arrValue === othValue || - equalFunc(arrValue, othValue, customizer, bitmask, stack) - )) { - result = false; - break; - } - } - stack['delete'](array); - stack['delete'](other); - return result; -} +/** Used to detect unsigned integer values. */ +var reIsUint = /^(?:0|[1-9]\d*)$/; -/** - * A specialized version of `baseIsEqualDeep` for comparing objects of - * the same `toStringTag`. - * - * **Note:** This function only supports comparing values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {string} tag The `toStringTag` of the objects to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} customizer The function to customize comparisons. - * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` - * for more details. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. - */ -function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { - switch (tag) { - case dataViewTag: - if ((object.byteLength != other.byteLength) || - (object.byteOffset != other.byteOffset)) { - return false; - } - object = object.buffer; - other = other.buffer; +/** Used to identify `toStringTag` values of typed arrays. */ +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = +typedArrayTags[errorTag] = typedArrayTags[funcTag] = +typedArrayTags[mapTag] = typedArrayTags[numberTag] = +typedArrayTags[objectTag] = typedArrayTags[regexpTag] = +typedArrayTags[setTag] = typedArrayTags[stringTag] = +typedArrayTags[weakMapTag] = false; - case arrayBufferTag: - if ((object.byteLength != other.byteLength) || - !equalFunc(new Uint8Array(object), new Uint8Array(other))) { - return false; - } - return true; +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - case boolTag: - case dateTag: - case numberTag: - // Coerce booleans to `1` or `0` and dates to milliseconds. - // Invalid dates are coerced to `NaN`. - return eq(+object, +other); +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - case errorTag: - return object.name == other.name && object.message == other.message; +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); - case regexpTag: - case stringTag: - // Coerce regexes to strings and treat strings, primitives and objects, - // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring - // for more details. - return object == (other + ''); +/** Detect free variable `exports`. */ +var freeExports = true && exports && !exports.nodeType && exports; - case mapTag: - var convert = mapToArray; +/** Detect free variable `module`. */ +var freeModule = freeExports && "object" == 'object' && module && !module.nodeType && module; - case setTag: - var isPartial = bitmask & PARTIAL_COMPARE_FLAG; - convert || (convert = setToArray); +/** Detect the popular CommonJS extension `module.exports`. */ +var moduleExports = freeModule && freeModule.exports === freeExports; - if (object.size != other.size && !isPartial) { - return false; - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked) { - return stacked == other; - } - bitmask |= UNORDERED_COMPARE_FLAG; +/** Detect free variable `process` from Node.js. */ +var freeProcess = moduleExports && freeGlobal.process; - // Recursively compare objects (susceptible to call stack limits). - stack.set(object, other); - var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); - stack['delete'](object); - return result; +/** Used to access faster Node.js helpers. */ +var nodeUtil = (function() { + try { + return freeProcess && freeProcess.binding('util'); + } catch (e) {} +}()); - case symbolTag: - if (symbolValueOf) { - return symbolValueOf.call(object) == symbolValueOf.call(other); - } - } - return false; -} +/* Node.js helper references. */ +var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /** - * A specialized version of `baseIsEqualDeep` for objects with support for - * partial deep comparisons. + * A specialized version of `_.forEach` for arrays without support for + * iteratee shorthands. * * @private - * @param {Object} object The object to compare. - * @param {Object} other The other object to compare. - * @param {Function} equalFunc The function to determine equivalents of values. - * @param {Function} customizer The function to customize comparisons. - * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` - * for more details. - * @param {Object} stack Tracks traversed `object` and `other` objects. - * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns `array`. */ -function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { - var isPartial = bitmask & PARTIAL_COMPARE_FLAG, - objProps = keys(object), - objLength = objProps.length, - othProps = keys(other), - othLength = othProps.length; - - if (objLength != othLength && !isPartial) { - return false; - } - var index = objLength; - while (index--) { - var key = objProps[index]; - if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { - return false; - } - } - // Assume cyclic values are equal. - var stacked = stack.get(object); - if (stacked && stack.get(other)) { - return stacked == other; - } - var result = true; - stack.set(object, other); - stack.set(other, object); - - var skipCtor = isPartial; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key]; +function arrayEach(array, iteratee) { + var index = -1, + length = array ? array.length : 0; - if (customizer) { - var compared = isPartial - ? customizer(othValue, objValue, key, other, object, stack) - : customizer(objValue, othValue, key, object, other, stack); - } - // Recursively compare objects (susceptible to call stack limits). - if (!(compared === undefined - ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) - : compared - )) { - result = false; + while (++index < length) { + if (iteratee(array[index], index, array) === false) { break; } - skipCtor || (skipCtor = key == 'constructor'); - } - if (result && !skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - - // Non `Object` object instances with different constructors are not equal. - if (objCtor != othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor == 'function' && objCtor instanceof objCtor && - typeof othCtor == 'function' && othCtor instanceof othCtor)) { - result = false; - } } - stack['delete'](object); - stack['delete'](other); - return result; -} - -/** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ -function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; + return array; } /** - * Gets the property names, values, and compare flags of `object`. + * A specialized version of `_.some` for arrays without support for iteratee + * shorthands. * * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the match data of `object`. + * @param {Array} [array] The array to iterate over. + * @param {Function} predicate The function invoked per iteration. + * @returns {boolean} Returns `true` if any element passes the predicate check, + * else `false`. */ -function getMatchData(object) { - var result = keys(object), - length = result.length; - - while (length--) { - var key = result[length], - value = object[key]; +function arraySome(array, predicate) { + var index = -1, + length = array ? array.length : 0; - result[length] = [key, value, isStrictComparable(value)]; + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } } - return result; -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; + return false; } /** - * Gets the `toStringTag` of `value`. + * The base implementation of `_.property` without support for deep paths. * * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new accessor function. */ -var getTag = baseGetTag; - -// Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge < 14, and promises in Node.js. -if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = objectToString.call(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : undefined; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; +function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; }; } /** - * Checks if `path` exists on `object`. + * The base implementation of `_.times` without support for iteratee shorthands + * or max array length checks. * * @private - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @param {Function} hasFunc The function to check properties. - * @returns {boolean} Returns `true` if `path` exists, else `false`. + * @param {number} n The number of times to invoke `iteratee`. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Array} Returns the array of results. */ -function hasPath(object, path, hasFunc) { - path = isKey(path, object) ? [path] : castPath(path); - - var result, - index = -1, - length = path.length; +function baseTimes(n, iteratee) { + var index = -1, + result = Array(n); - while (++index < length) { - var key = toKey(path[index]); - if (!(result = object != null && hasFunc(object, key))) { - break; - } - object = object[key]; - } - if (result) { - return result; + while (++index < n) { + result[index] = iteratee(index); } - var length = object ? object.length : 0; - return !!length && isLength(length) && isIndex(key, length) && - (isArray(object) || isArguments(object)); + return result; } /** - * Checks if `value` is a valid array-like index. + * The base implementation of `_.unary` without support for storing metadata. * * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + * @param {Function} func The function to cap arguments for. + * @returns {Function} Returns the new capped function. */ -function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); +function baseUnary(func) { + return function(value) { + return func(value); + }; } /** - * Checks if `value` is a property name and not a property path. + * Gets the value at `key` of `object`. * * @private - * @param {*} value The value to check. - * @param {Object} [object] The object to query keys on. - * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + * @param {Object} [object] The object to query. + * @param {string} key The key of the property to get. + * @returns {*} Returns the property value. */ -function isKey(value, object) { - if (isArray(value)) { - return false; - } - var type = typeof value; - if (type == 'number' || type == 'symbol' || type == 'boolean' || - value == null || isSymbol(value)) { - return true; - } - return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || - (object != null && value in Object(object)); +function getValue(object, key) { + return object == null ? undefined : object[key]; } /** - * Checks if `value` is suitable for use as unique object key. + * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); -} - -/** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. + * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ -function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); +function isHostObject(value) { + // Many host objects are `Object` objects that can coerce to strings + // despite having improperly defined `toString` methods. + var result = false; + if (value != null && typeof value.toString != 'function') { + try { + result = !!(value + ''); + } catch (e) {} + } + return result; } /** - * Checks if `value` is likely a prototype object. + * Converts `map` to its key-value pairs. * * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + * @param {Object} map The map to convert. + * @returns {Array} Returns the key-value pairs. */ -function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; -} +function mapToArray(map) { + var index = -1, + result = Array(map.size); -/** - * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` if suitable for strict - * equality comparisons, else `false`. - */ -function isStrictComparable(value) { - return value === value && !isObject(value); + map.forEach(function(value, key) { + result[++index] = [key, value]; + }); + return result; } /** - * A specialized version of `matchesProperty` for source values suitable - * for strict equality comparisons, i.e. `===`. + * Creates a unary function that invokes `func` with its argument transformed. * * @private - * @param {string} key The key of the property to get. - * @param {*} srcValue The value to match. - * @returns {Function} Returns the new spec function. + * @param {Function} func The function to wrap. + * @param {Function} transform The argument transform. + * @returns {Function} Returns the new function. */ -function matchesStrictComparable(key, srcValue) { - return function(object) { - if (object == null) { - return false; - } - return object[key] === srcValue && - (srcValue !== undefined || (key in Object(object))); +function overArg(func, transform) { + return function(arg) { + return func(transform(arg)); }; } /** - * Converts `string` to a property path array. + * Converts `set` to an array of its values. * * @private - * @param {string} string The string to convert. - * @returns {Array} Returns the property path array. + * @param {Object} set The set to convert. + * @returns {Array} Returns the values. */ -var stringToPath = memoize(function(string) { - string = toString(string); +function setToArray(set) { + var index = -1, + result = Array(set.size); - var result = []; - if (reLeadingDot.test(string)) { - result.push(''); - } - string.replace(rePropName, function(match, number, quote, string) { - result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + set.forEach(function(value) { + result[++index] = value; }); return result; -}); - -/** - * Converts `value` to a string key if it's not a string or symbol. - * - * @private - * @param {*} value The value to inspect. - * @returns {string|symbol} Returns the key. - */ -function toKey(value) { - if (typeof value == 'string' || isSymbol(value)) { - return value; - } - var result = (value + ''); - return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } -/** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to process. - * @returns {string} Returns the source code. - */ -function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; -} +/** Used for built-in method references. */ +var arrayProto = Array.prototype, + funcProto = Function.prototype, + objectProto = Object.prototype; + +/** Used to detect overreaching core-js shims. */ +var coreJsData = root['__core-js_shared__']; + +/** Used to detect methods masquerading as native. */ +var maskSrcKey = (function() { + var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); + return uid ? ('Symbol(src)_1.' + uid) : ''; +}()); + +/** Used to resolve the decompiled source of functions. */ +var funcToString = funcProto.toString; + +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; /** - * Creates a function that memoizes the result of `func`. If `resolver` is - * provided, it determines the cache key for storing the result based on the - * arguments provided to the memoized function. By default, the first argument - * provided to the memoized function is used as the map cache key. The `func` - * is invoked with the `this` binding of the memoized function. - * - * **Note:** The cache is exposed as the `cache` property on the memoized - * function. Its creation may be customized by replacing the `_.memoize.Cache` - * constructor with one whose instances implement the - * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) - * method interface of `delete`, `get`, `has`, and `set`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to have its output memoized. - * @param {Function} [resolver] The function to resolve the cache key. - * @returns {Function} Returns the new memoized function. - * @example - * - * var object = { 'a': 1, 'b': 2 }; - * var other = { 'c': 3, 'd': 4 }; - * - * var values = _.memoize(_.values); - * values(object); - * // => [1, 2] - * - * values(other); - * // => [3, 4] - * - * object.a = 2; - * values(object); - * // => [1, 2] - * - * // Modify the result cache. - * values.cache.set(object, ['a', 'b']); - * values(object); - * // => ['a', 'b'] - * - * // Replace `_.memoize.Cache`. - * _.memoize.Cache = WeakMap; + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. */ -function memoize(func, resolver) { - if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { - throw new TypeError(FUNC_ERROR_TEXT); - } - var memoized = function() { - var args = arguments, - key = resolver ? resolver.apply(this, args) : args[0], - cache = memoized.cache; +var objectToString = objectProto.toString; - if (cache.has(key)) { - return cache.get(key); - } - var result = func.apply(this, args); - memoized.cache = cache.set(key, result); - return result; - }; - memoized.cache = new (memoize.Cache || MapCache); - return memoized; -} +/** Used to detect if a method is native. */ +var reIsNative = RegExp('^' + + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' +); -// Assign cache to `_.memoize`. -memoize.Cache = MapCache; +/** Built-in value references. */ +var Symbol = root.Symbol, + Uint8Array = root.Uint8Array, + getPrototype = overArg(Object.getPrototypeOf, Object), + objectCreate = Object.create, + propertyIsEnumerable = objectProto.propertyIsEnumerable, + splice = arrayProto.splice; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeKeys = overArg(Object.keys, Object); + +/* Built-in method references that are verified to be native. */ +var DataView = getNative(root, 'DataView'), + Map = getNative(root, 'Map'), + Promise = getNative(root, 'Promise'), + Set = getNative(root, 'Set'), + WeakMap = getNative(root, 'WeakMap'), + nativeCreate = getNative(Object, 'create'); + +/** Used to detect maps, sets, and weakmaps. */ +var dataViewCtorString = toSource(DataView), + mapCtorString = toSource(Map), + promiseCtorString = toSource(Promise), + setCtorString = toSource(Set), + weakMapCtorString = toSource(WeakMap); + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolValueOf = symbolProto ? symbolProto.valueOf : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; /** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false + * Creates a hash object. * - * _.eq(NaN, NaN); - * // => true + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. */ -function eq(value, other) { - return value === other || (value !== value && other !== other); +function Hash(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } } /** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true + * Removes all key-value entries from the hash. * - * _.isArguments([1, 2, 3]); - * // => false + * @private + * @name clear + * @memberOf Hash */ -function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); +function hashClear() { + this.__data__ = nativeCreate ? nativeCreate(null) : {}; } /** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false + * Removes `key` and its value from the hash. * - * _.isArray(_.noop); - * // => false + * @private + * @name delete + * @memberOf Hash + * @param {Object} hash The hash to modify. + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -var isArray = Array.isArray; +function hashDelete(key) { + return this.has(key) && delete this.__data__[key]; +} /** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true + * Gets the hash value for `key`. * - * _.isArrayLike(_.noop); - * // => false + * @private + * @name get + * @memberOf Hash + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ -function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); +function hashGet(key) { + var data = this.__data__; + if (nativeCreate) { + var result = data[key]; + return result === HASH_UNDEFINED ? undefined : result; + } + return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false + * Checks if a hash value for `key` exists. * - * _.isArrayLikeObject(_.noop); - * // => false + * @private + * @name has + * @memberOf Hash + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); +function hashHas(key) { + var data = this.__data__; + return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); } /** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true + * Sets the hash `key` to `value`. * - * _.isFunction(/abc/); - * // => false + * @private + * @name set + * @memberOf Hash + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the hash instance. */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; +function hashSet(key, value) { + var data = this.__data__; + data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; + return this; } +// Add methods to `Hash`. +Hash.prototype.clear = hashClear; +Hash.prototype['delete'] = hashDelete; +Hash.prototype.get = hashGet; +Hash.prototype.has = hashHas; +Hash.prototype.set = hashSet; + /** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false + * Creates an list cache object. * - * _.isLength('3'); - * // => false + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; +function ListCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } } /** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true + * Removes all key-value entries from the list cache. * - * _.isObject(null); - * // => false + * @private + * @name clear + * @memberOf ListCache */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); +function listCacheClear() { + this.__data__ = []; } /** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false + * Removes `key` and its value from the list cache. * - * _.isObjectLike(null); - * // => false + * @private + * @name delete + * @memberOf ListCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; +function listCacheDelete(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + return false; + } + var lastIndex = data.length - 1; + if (index == lastIndex) { + data.pop(); + } else { + splice.call(data, index, 1); + } + return true; } /** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true + * Gets the list cache value for `key`. * - * _.isSymbol('abc'); - * // => false + * @private + * @name get + * @memberOf ListCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); +function listCacheGet(key) { + var data = this.__data__, + index = assocIndexOf(data, key); + + return index < 0 ? undefined : data[index][1]; } /** - * Checks if `value` is classified as a typed array. - * - * @static - * @memberOf _ - * @since 3.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. - * @example - * - * _.isTypedArray(new Uint8Array); - * // => true + * Checks if a list cache value for `key` exists. * - * _.isTypedArray([]); - * // => false + * @private + * @name has + * @memberOf ListCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; +function listCacheHas(key) { + return assocIndexOf(this.__data__, key) > -1; +} /** - * Converts `value` to a string. An empty string is returned for `null` - * and `undefined` values. The sign of `-0` is preserved. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {string} Returns the string. - * @example - * - * _.toString(null); - * // => '' - * - * _.toString(-0); - * // => '-0' + * Sets the list cache `key` to `value`. * - * _.toString([1, 2, 3]); - * // => '1,2,3' + * @private + * @name set + * @memberOf ListCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the list cache instance. */ -function toString(value) { - return value == null ? '' : baseToString(value); +function listCacheSet(key, value) { + var data = this.__data__, + index = assocIndexOf(data, key); + + if (index < 0) { + data.push([key, value]); + } else { + data[index][1] = value; + } + return this; } +// Add methods to `ListCache`. +ListCache.prototype.clear = listCacheClear; +ListCache.prototype['delete'] = listCacheDelete; +ListCache.prototype.get = listCacheGet; +ListCache.prototype.has = listCacheHas; +ListCache.prototype.set = listCacheSet; + /** - * Gets the value at `path` of `object`. If the resolved value is - * `undefined`, the `defaultValue` is returned in its place. - * - * @static - * @memberOf _ - * @since 3.7.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path of the property to get. - * @param {*} [defaultValue] The value returned for `undefined` resolved values. - * @returns {*} Returns the resolved value. - * @example - * - * var object = { 'a': [{ 'b': { 'c': 3 } }] }; - * - * _.get(object, 'a[0].b.c'); - * // => 3 - * - * _.get(object, ['a', '0', 'b', 'c']); - * // => 3 + * Creates a map cache object to store key-value pairs. * - * _.get(object, 'a.b.c', 'default'); - * // => 'default' + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. */ -function get(object, path, defaultValue) { - var result = object == null ? undefined : baseGet(object, path); - return result === undefined ? defaultValue : result; +function MapCache(entries) { + var index = -1, + length = entries ? entries.length : 0; + + this.clear(); + while (++index < length) { + var entry = entries[index]; + this.set(entry[0], entry[1]); + } } /** - * Checks if `path` is a direct or inherited property of `object`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Object - * @param {Object} object The object to query. - * @param {Array|string} path The path to check. - * @returns {boolean} Returns `true` if `path` exists, else `false`. - * @example - * - * var object = _.create({ 'a': _.create({ 'b': 2 }) }); - * - * _.hasIn(object, 'a'); - * // => true - * - * _.hasIn(object, 'a.b'); - * // => true - * - * _.hasIn(object, ['a', 'b']); - * // => true + * Removes all key-value entries from the map. * - * _.hasIn(object, 'b'); - * // => false + * @private + * @name clear + * @memberOf MapCache */ -function hasIn(object, path) { - return object != null && hasPath(object, path, baseHasIn); +function mapCacheClear() { + this.__data__ = { + 'hash': new Hash, + 'map': new (Map || ListCache), + 'string': new Hash + }; } /** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) + * Removes `key` and its value from the map. * - * _.keys('hi'); - * // => ['0', '1'] + * @private + * @name delete + * @memberOf MapCache + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ -function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); +function mapCacheDelete(key) { + return getMapData(this, key)['delete'](key); } /** - * An alternative to `_.reduce`; this method transforms `object` to a new - * `accumulator` object which is the result of running each of its own - * enumerable string keyed properties thru `iteratee`, with each invocation - * potentially mutating the `accumulator` object. If `accumulator` is not - * provided, a new object with the same `[[Prototype]]` will be used. The - * iteratee is invoked with four arguments: (accumulator, value, key, object). - * Iteratee functions may exit iteration early by explicitly returning `false`. - * - * @static - * @memberOf _ - * @since 1.3.0 - * @category Object - * @param {Object} object The object to iterate over. - * @param {Function} [iteratee=_.identity] The function invoked per iteration. - * @param {*} [accumulator] The custom accumulator value. - * @returns {*} Returns the accumulated value. - * @example - * - * _.transform([2, 3, 4], function(result, n) { - * result.push(n *= n); - * return n % 2 == 0; - * }, []); - * // => [4, 9] + * Gets the map value for `key`. * - * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { - * (result[value] || (result[value] = [])).push(key); - * }, {}); - * // => { '1': ['a', 'c'], '2': ['b'] } + * @private + * @name get + * @memberOf MapCache + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. */ -function transform(object, iteratee, accumulator) { - var isArr = isArray(object) || isTypedArray(object); - iteratee = baseIteratee(iteratee, 4); - - if (accumulator == null) { - if (isArr || isObject(object)) { - var Ctor = object.constructor; - if (isArr) { - accumulator = isArray(object) ? new Ctor : []; - } else { - accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; - } - } else { - accumulator = {}; - } - } - (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) { - return iteratee(accumulator, value, index, object); - }); - return accumulator; +function mapCacheGet(key) { + return getMapData(this, key).get(key); } /** - * This method returns the first argument it receives. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Util - * @param {*} value Any value. - * @returns {*} Returns `value`. - * @example - * - * var object = { 'a': 1 }; + * Checks if a map value for `key` exists. * - * console.log(_.identity(object) === object); - * // => true + * @private + * @name has + * @memberOf MapCache + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ -function identity(value) { - return value; +function mapCacheHas(key) { + return getMapData(this, key).has(key); } /** - * Creates a function that returns the value at `path` of a given object. - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Util - * @param {Array|string} path The path of the property to get. - * @returns {Function} Returns the new accessor function. - * @example - * - * var objects = [ - * { 'a': { 'b': 2 } }, - * { 'a': { 'b': 1 } } - * ]; - * - * _.map(objects, _.property('a.b')); - * // => [2, 1] + * Sets the map `key` to `value`. * - * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); - * // => [1, 2] + * @private + * @name set + * @memberOf MapCache + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the map cache instance. */ -function property(path) { - return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); +function mapCacheSet(key, value) { + getMapData(this, key).set(key, value); + return this; } -module.exports = transform; - - -/***/ }), -/* 705 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SectionHeader = __webpack_require__(392); +// Add methods to `MapCache`. +MapCache.prototype.clear = mapCacheClear; +MapCache.prototype['delete'] = mapCacheDelete; +MapCache.prototype.get = mapCacheGet; +MapCache.prototype.has = mapCacheHas; +MapCache.prototype.set = mapCacheSet; /** - * The string table is used to store section and symbol names. In the ELF image, it consists - * of a sequence of null-terminated ASCII strings. + * + * Creates an array cache object to store unique values. + * + * @private + * @constructor + * @param {Array} [values] The values to cache. */ -class StringTable { - constructor(arg) { - if (typeof arg === 'object') { - // from StringTable.parse() - Object.assign(this, arg); - return; - } - - this.strings = ''; - this.section_header = new SectionHeader({ - name: arg, - type: 'strtab', - flags: '', - addr: 0, - offset: null, - size: null, - link: 0, - info: 0, - addralign: 1, - entsize: 0, - }); - } - - static parse({ header, data }) { - return new StringTable({ - section_header: header, - strings: data.toString(StringTable.ENCODING), - }); - } - - add_string(str) { - return this.getStringOffset(str, true); - } - - /** - * Returns the offset into the table of the specified string - * @param {string} str string to locate - * @param {boolean} [add] optional - automatically add the string if it's not in the table - */ - getStringOffset(str, add = false) { - // strings are a concatenated list of null-terminated values - const str0 = str + '\0'; - let offset = this.strings.indexOf(str0); - if (offset < 0) { - if (!add) { - throw new Error(`String '${str}' not found in string table`); - } - offset = this.strings.length; - this.strings += str0; - } - return offset; - } - - // retrieve the string from the table at the given offset - getString(offset) { - if (offset < 0 || offset >= this.strings.length) - throw new RangeError(`Offset out of range of string table. Offset=${offset}, Table length=${this.strings.length}`); - const s = this.strings.slice(offset, this.strings.indexOf('\0', offset)); - return s; - } - - calculate_size(elf_offset) { - this.elf_offset = this.section_header.offset = elf_offset; - // ELF only allows ascii chars, so bytes = length - this.elf_size = this.section_header.size = this.strings.length; - return this.elf_size; - } +function SetCache(values) { + var index = -1, + length = values ? values.length : 0; - write(stream) { - stream.writeBuf(Buffer.from(this.strings, StringTable.ENCODING)); + this.__data__ = new MapCache; + while (++index < length) { + this.add(values[index]); } } -StringTable.ENCODING = 'ascii'; - -module.exports = StringTable; - - -/***/ }), -/* 706 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -/** - * JSON Format Plugin - * - * @module plugins/json - * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE} - * @copyright (c) 2012-2014 Chris Talkington, contributors. - */ -var inherits = __webpack_require__(669).inherits; -var Transform = __webpack_require__(574).Transform; - -var crc32 = __webpack_require__(538); -var util = __webpack_require__(108); - -/** - * @constructor - * @param {(JsonOptions|TransformOptions)} options - */ -var Json = function(options) { - if (!(this instanceof Json)) { - return new Json(options); - } - - options = this.options = util.defaults(options, {}); - - Transform.call(this, options); - - this.supports = { - directory: true, - symlink: true - }; - - this.files = []; -}; - -inherits(Json, Transform); - -/** - * [_transform description] - * - * @private - * @param {Buffer} chunk - * @param {String} encoding - * @param {Function} callback - * @return void - */ -Json.prototype._transform = function(chunk, encoding, callback) { - callback(null, chunk); -}; - -/** - * [_writeStringified description] - * - * @private - * @return void - */ -Json.prototype._writeStringified = function() { - var fileString = JSON.stringify(this.files); - this.write(fileString); -}; - -/** - * [append description] - * - * @param {(Buffer|Stream)} source - * @param {EntryData} data - * @param {Function} callback - * @return void - */ -Json.prototype.append = function(source, data, callback) { - var self = this; - - data.crc32 = 0; - - function onend(err, sourceBuffer) { - if (err) { - callback(err); - return; - } - - data.size = sourceBuffer.length || 0; - data.crc32 = crc32.unsigned(sourceBuffer); - - self.files.push(data); - - callback(null, data); - } - - if (data.sourceType === 'buffer') { - onend(null, source); - } else if (data.sourceType === 'stream') { - util.collectStream(source, onend); - } -}; - -/** - * [finalize description] - * - * @return void - */ -Json.prototype.finalize = function() { - this._writeStringified(); - this.end(); -}; - -module.exports = Json; - -/** - * @typedef {Object} JsonOptions - * @global - */ - - -/***/ }), -/* 707 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -module.exports = __webpack_require__(651).default; - - -/***/ }), -/* 708 */ -/***/ (function(module) { - -// When the API is rate limiting, the request is retried later -const shouldRetry = function(response, index) { - return response.status === RATE_LIMIT_STATUS && index !== MAX_RETRY +/** + * Adds `value` to the array cache. + * + * @private + * @name add + * @memberOf SetCache + * @alias push + * @param {*} value The value to cache. + * @returns {Object} Returns the cache instance. + */ +function setCacheAdd(value) { + this.__data__.set(value, HASH_UNDEFINED); + return this; } -const waitForRetry = async function(response) { - const delay = getDelay(response) - await sleep(delay) +/** + * Checks if `value` is in the array cache. + * + * @private + * @name has + * @memberOf SetCache + * @param {*} value The value to search for. + * @returns {number} Returns `true` if `value` is found, else `false`. + */ +function setCacheHas(value) { + return this.__data__.has(value); } -const getDelay = function({ headers }) { - const rateLimitReset = headers.get(RATE_LIMIT_HEADER) - - if (!rateLimitReset) { - return DEFAULT_RETRY_DELAY - } +// Add methods to `SetCache`. +SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; +SetCache.prototype.has = setCacheHas; - return Math.max(Number(rateLimitReset) * SECS_TO_MSECS - Date.now(), MIN_RETRY_DELAY) +/** + * Creates a stack cache object to store key-value pairs. + * + * @private + * @constructor + * @param {Array} [entries] The key-value pairs to cache. + */ +function Stack(entries) { + this.__data__ = new ListCache(entries); } -const sleep = function(ms) { - return new Promise(resolve => setTimeout(resolve, ms)) +/** + * Removes all key-value entries from the stack. + * + * @private + * @name clear + * @memberOf Stack + */ +function stackClear() { + this.__data__ = new ListCache; } -const DEFAULT_RETRY_DELAY = 5e3 -const MIN_RETRY_DELAY = 1e3 -const SECS_TO_MSECS = 1e3 -const MAX_RETRY = 10 -const RATE_LIMIT_STATUS = 429 -const RATE_LIMIT_HEADER = 'X-RateLimit-Reset' - -module.exports = { shouldRetry, waitForRetry, MAX_RETRY } - - -/***/ }), -/* 709 */, -/* 710 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _buffer = __webpack_require__(407); - -var _create_buffer = __webpack_require__(346); - -var _create_buffer2 = _interopRequireDefault(_create_buffer); - -var _define_crc = __webpack_require__(200); - -var _define_crc2 = _interopRequireDefault(_define_crc); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -// Generated by `./pycrc.py --algorithm=table-driven --model=kermit --generate=c` -// prettier-ignore -var TABLE = [0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78]; - -if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE); - -var crc16kermit = (0, _define_crc2.default)('kermit', function (buf, previous) { - if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf); - - var crc = typeof previous !== 'undefined' ? ~~previous : 0x0000; - - for (var index = 0; index < buf.length; index++) { - var byte = buf[index]; - crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff; - } - - return crc; -}); - -exports.default = crc16kermit; - - -/***/ }), -/* 711 */, -/* 712 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - - - -module.exports = Transform; - -var Duplex = __webpack_require__(361); - -/**/ -var util = Object.create(__webpack_require__(286)); -util.inherits = __webpack_require__(689); -/**/ - -util.inherits(Transform, Duplex); +/** + * Removes `key` and its value from the stack. + * + * @private + * @name delete + * @memberOf Stack + * @param {string} key The key of the value to remove. + * @returns {boolean} Returns `true` if the entry was removed, else `false`. + */ +function stackDelete(key) { + return this.__data__['delete'](key); +} -function afterTransform(er, data) { - var ts = this._transformState; - ts.transforming = false; +/** + * Gets the stack value for `key`. + * + * @private + * @name get + * @memberOf Stack + * @param {string} key The key of the value to get. + * @returns {*} Returns the entry value. + */ +function stackGet(key) { + return this.__data__.get(key); +} - var cb = ts.writecb; +/** + * Checks if a stack value for `key` exists. + * + * @private + * @name has + * @memberOf Stack + * @param {string} key The key of the entry to check. + * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. + */ +function stackHas(key) { + return this.__data__.has(key); +} - if (!cb) { - return this.emit('error', new Error('write callback called multiple times')); +/** + * Sets the stack `key` to `value`. + * + * @private + * @name set + * @memberOf Stack + * @param {string} key The key of the value to set. + * @param {*} value The value to set. + * @returns {Object} Returns the stack cache instance. + */ +function stackSet(key, value) { + var cache = this.__data__; + if (cache instanceof ListCache) { + var pairs = cache.__data__; + if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { + pairs.push([key, value]); + return this; + } + cache = this.__data__ = new MapCache(pairs); } + cache.set(key, value); + return this; +} - ts.writechunk = null; - ts.writecb = null; +// Add methods to `Stack`. +Stack.prototype.clear = stackClear; +Stack.prototype['delete'] = stackDelete; +Stack.prototype.get = stackGet; +Stack.prototype.has = stackHas; +Stack.prototype.set = stackSet; - if (data != null) // single equals check for both `null` and `undefined` - this.push(data); +/** + * Creates an array of the enumerable property names of the array-like `value`. + * + * @private + * @param {*} value The value to query. + * @param {boolean} inherited Specify returning inherited property names. + * @returns {Array} Returns the array of property names. + */ +function arrayLikeKeys(value, inherited) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + // Safari 9 makes `arguments.length` enumerable in strict mode. + var result = (isArray(value) || isArguments(value)) + ? baseTimes(value.length, String) + : []; - cb(er); + var length = result.length, + skipIndexes = !!length; - var rs = this._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - this._read(rs.highWaterMark); + for (var key in value) { + if ((inherited || hasOwnProperty.call(value, key)) && + !(skipIndexes && (key == 'length' || isIndex(key, length)))) { + result.push(key); + } } + return result; } -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); +/** + * Gets the index at which the `key` is found in `array` of key-value pairs. + * + * @private + * @param {Array} array The array to inspect. + * @param {*} key The key to search for. + * @returns {number} Returns the index of the matched value, else `-1`. + */ +function assocIndexOf(array, key) { + var length = array.length; + while (length--) { + if (eq(array[length][0], key)) { + return length; + } + } + return -1; +} - Duplex.call(this, options); +/** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ +function baseCreate(proto) { + return isObject(proto) ? objectCreate(proto) : {}; +} - this._transformState = { - afterTransform: afterTransform.bind(this), - needTransform: false, - transforming: false, - writecb: null, - writechunk: null, - writeencoding: null - }; +/** + * The base implementation of `baseForOwn` which iterates over `object` + * properties returned by `keysFunc` and invokes `iteratee` for each property. + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ +var baseFor = createBaseFor(); - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; +/** + * The base implementation of `_.forOwn` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ +function baseForOwn(object, iteratee) { + return object && baseFor(object, iteratee, keys); +} - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; +/** + * The base implementation of `_.get` without support for default values. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @returns {*} Returns the resolved value. + */ +function baseGet(object, path) { + path = isKey(path, object) ? [path] : castPath(path); - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; + var index = 0, + length = path.length; - if (typeof options.flush === 'function') this._flush = options.flush; + while (object != null && index < length) { + object = object[toKey(path[index++])]; } + return (index && index == length) ? object : undefined; +} - // When the writable side finishes, then flush out anything remaining. - this.on('prefinish', prefinish); +/** + * The base implementation of `getTag`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + return objectToString.call(value); } -function prefinish() { - var _this = this; +/** + * The base implementation of `_.hasIn` without support for deep paths. + * + * @private + * @param {Object} [object] The object to query. + * @param {Array|string} key The key to check. + * @returns {boolean} Returns `true` if `key` exists, else `false`. + */ +function baseHasIn(object, key) { + return object != null && key in Object(object); +} - if (typeof this._flush === 'function') { - this._flush(function (er, data) { - done(_this, er, data); - }); - } else { - done(this, null, null); +/** + * The base implementation of `_.isEqual` which supports partial comparisons + * and tracks traversed objects. + * + * @private + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @param {Function} [customizer] The function to customize comparisons. + * @param {boolean} [bitmask] The bitmask of comparison flags. + * The bitmask may be composed of the following flags: + * 1 - Unordered comparison + * 2 - Partial comparison + * @param {Object} [stack] Tracks traversed `value` and `other` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ +function baseIsEqual(value, other, customizer, bitmask, stack) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { + return value !== value && other !== other; } + return baseIsEqualDeep(value, other, baseIsEqual, customizer, bitmask, stack); } -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); -}; +/** + * A specialized version of `baseIsEqual` for arrays and objects which performs + * deep comparisons and tracks traversed objects enabling objects with circular + * references to be compared. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} [customizer] The function to customize comparisons. + * @param {number} [bitmask] The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} [stack] Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function baseIsEqualDeep(object, other, equalFunc, customizer, bitmask, stack) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + if (!objIsArr) { + objTag = getTag(object); + objTag = objTag == argsTag ? objectTag : objTag; } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; + if (!othIsArr) { + othTag = getTag(other); + othTag = othTag == argsTag ? objectTag : othTag; } -}; - -Transform.prototype._destroy = function (err, cb) { - var _this2 = this; - - Duplex.prototype._destroy.call(this, err, function (err2) { - cb(err2); - _this2.emit('close'); - }); -}; - -function done(stream, er, data) { - if (er) return stream.emit('error', er); - - if (data != null) // single equals check for both `null` and `undefined` - stream.push(data); + var objIsObj = objTag == objectTag && !isHostObject(object), + othIsObj = othTag == objectTag && !isHostObject(other), + isSameTag = objTag == othTag; - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); + if (isSameTag && !objIsObj) { + stack || (stack = new Stack); + return (objIsArr || isTypedArray(object)) + ? equalArrays(object, other, equalFunc, customizer, bitmask, stack) + : equalByTag(object, other, objTag, equalFunc, customizer, bitmask, stack); + } + if (!(bitmask & PARTIAL_COMPARE_FLAG)) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); + if (objIsWrapped || othIsWrapped) { + var objUnwrapped = objIsWrapped ? object.value() : object, + othUnwrapped = othIsWrapped ? other.value() : other; - return stream.push(null); + stack || (stack = new Stack); + return equalFunc(objUnwrapped, othUnwrapped, customizer, bitmask, stack); + } + } + if (!isSameTag) { + return false; + } + stack || (stack = new Stack); + return equalObjects(object, other, equalFunc, customizer, bitmask, stack); } -/***/ }), -/* 713 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +/** + * The base implementation of `_.isMatch` without support for iteratee shorthands. + * + * @private + * @param {Object} object The object to inspect. + * @param {Object} source The object of property values to match. + * @param {Array} matchData The property names, values, and compare flags to match. + * @param {Function} [customizer] The function to customize comparisons. + * @returns {boolean} Returns `true` if `object` is a match, else `false`. + */ +function baseIsMatch(object, source, matchData, customizer) { + var index = matchData.length, + length = index, + noCustomizer = !customizer; -"use strict"; + if (object == null) { + return !length; + } + object = Object(object); + while (index--) { + var data = matchData[index]; + if ((noCustomizer && data[2]) + ? data[1] !== object[data[0]] + : !(data[0] in object) + ) { + return false; + } + } + while (++index < length) { + data = matchData[index]; + var key = data[0], + objValue = object[key], + srcValue = data[1]; -Object.defineProperty(exports, "__esModule", { value: true }); -const ts = __webpack_require__(752); -const node_1 = __webpack_require__(10); -const _3_2_1 = __webpack_require__(584); -const type_1 = __webpack_require__(90); -function getChildOfKind(node, kind, sourceFile) { - for (const child of node.getChildren(sourceFile)) - if (child.kind === kind) - return child; -} -exports.getChildOfKind = getChildOfKind; -function isTokenKind(kind) { - return kind >= ts.SyntaxKind.FirstToken && kind <= ts.SyntaxKind.LastToken; -} -exports.isTokenKind = isTokenKind; -function isNodeKind(kind) { - return kind >= ts.SyntaxKind.FirstNode; -} -exports.isNodeKind = isNodeKind; -function isAssignmentKind(kind) { - return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment; -} -exports.isAssignmentKind = isAssignmentKind; -function isTypeNodeKind(kind) { - return kind >= ts.SyntaxKind.FirstTypeNode && kind <= ts.SyntaxKind.LastTypeNode; -} -exports.isTypeNodeKind = isTypeNodeKind; -function isJsDocKind(kind) { - return kind >= ts.SyntaxKind.FirstJSDocNode && kind <= ts.SyntaxKind.LastJSDocNode; -} -exports.isJsDocKind = isJsDocKind; -function isKeywordKind(kind) { - return kind >= ts.SyntaxKind.FirstKeyword && kind <= ts.SyntaxKind.LastKeyword; -} -exports.isKeywordKind = isKeywordKind; -function isThisParameter(parameter) { - return parameter.name.kind === ts.SyntaxKind.Identifier && parameter.name.originalKeywordKind === ts.SyntaxKind.ThisKeyword; -} -exports.isThisParameter = isThisParameter; -function getModifier(node, kind) { - if (node.modifiers !== undefined) - for (const modifier of node.modifiers) - if (modifier.kind === kind) - return modifier; -} -exports.getModifier = getModifier; -function hasModifier(modifiers, ...kinds) { - if (modifiers === undefined) + if (noCustomizer && data[2]) { + if (objValue === undefined && !(key in object)) { return false; - for (const modifier of modifiers) - if (kinds.includes(modifier.kind)) - return true; - return false; -} -exports.hasModifier = hasModifier; -function isParameterProperty(node) { - return hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword, ts.SyntaxKind.ReadonlyKeyword); -} -exports.isParameterProperty = isParameterProperty; -function hasAccessModifier(node) { - return hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword); -} -exports.hasAccessModifier = hasAccessModifier; -function isFlagSet(obj, flag) { - return (obj.flags & flag) !== 0; -} -exports.isNodeFlagSet = isFlagSet; -exports.isTypeFlagSet = isFlagSet; -exports.isSymbolFlagSet = isFlagSet; -function isObjectFlagSet(objectType, flag) { - return (objectType.objectFlags & flag) !== 0; -} -exports.isObjectFlagSet = isObjectFlagSet; -function isModifierFlagSet(node, flag) { - return (ts.getCombinedModifierFlags(node) & flag) !== 0; -} -exports.isModifierFlagSet = isModifierFlagSet; -function getPreviousStatement(statement) { - const parent = statement.parent; - if (node_1.isBlockLike(parent)) { - const index = parent.statements.indexOf(statement); - if (index > 0) - return parent.statements[index - 1]; - } -} -exports.getPreviousStatement = getPreviousStatement; -function getNextStatement(statement) { - const parent = statement.parent; - if (node_1.isBlockLike(parent)) { - const index = parent.statements.indexOf(statement); - if (index < parent.statements.length) - return parent.statements[index + 1]; + } + } else { + var stack = new Stack; + if (customizer) { + var result = customizer(objValue, srcValue, key, object, source, stack); + } + if (!(result === undefined + ? baseIsEqual(srcValue, objValue, customizer, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG, stack) + : result + )) { + return false; + } } + } + return true; } -exports.getNextStatement = getNextStatement; -function getPreviousToken(node, sourceFile) { - let parent = node.parent; - while (parent !== undefined && parent.pos === node.pos) - parent = parent.parent; - if (parent === undefined) - return; - outer: while (true) { - const children = parent.getChildren(sourceFile); - for (let i = children.length - 1; i >= 0; --i) { - const child = children[i]; - if (child.pos < node.pos && child.kind !== ts.SyntaxKind.JSDocComment) { - if (isTokenKind(child.kind)) - return child; - parent = child; - continue outer; - } - } - return; - } + +/** + * The base implementation of `_.isNative` without bad shim checks. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, + * else `false`. + */ +function baseIsNative(value) { + if (!isObject(value) || isMasked(value)) { + return false; + } + var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; + return pattern.test(toSource(value)); } -exports.getPreviousToken = getPreviousToken; -function getNextToken(node, sourceFile = node.getSourceFile()) { - if (node.kind === ts.SyntaxKind.SourceFile || node.kind === ts.SyntaxKind.EndOfFileToken) - return; - const end = node.end; - node = node.parent; - while (node.end === end) { - if (node.parent === undefined) - return node.endOfFileToken; - node = node.parent; - } - return getTokenAtPositionWorker(node, end, sourceFile, false); + +/** + * The base implementation of `_.isTypedArray` without Node.js optimizations. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + */ +function baseIsTypedArray(value) { + return isObjectLike(value) && + isLength(value.length) && !!typedArrayTags[objectToString.call(value)]; } -exports.getNextToken = getNextToken; -function getTokenAtPosition(parent, pos, sourceFile, allowJsDoc) { - if (pos < parent.pos || pos >= parent.end) - return; - if (isTokenKind(parent.kind)) - return parent; - if (sourceFile === undefined) - sourceFile = parent.getSourceFile(); - return getTokenAtPositionWorker(parent, pos, sourceFile, allowJsDoc === true); + +/** + * The base implementation of `_.iteratee`. + * + * @private + * @param {*} [value=_.identity] The value to convert to an iteratee. + * @returns {Function} Returns the iteratee. + */ +function baseIteratee(value) { + // Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9. + // See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details. + if (typeof value == 'function') { + return value; + } + if (value == null) { + return identity; + } + if (typeof value == 'object') { + return isArray(value) + ? baseMatchesProperty(value[0], value[1]) + : baseMatches(value); + } + return property(value); } -exports.getTokenAtPosition = getTokenAtPosition; -function getTokenAtPositionWorker(node, pos, sourceFile, allowJsDoc) { - outer: while (true) { - for (const child of node.getChildren(sourceFile)) { - if (child.end > pos && (allowJsDoc || child.kind !== ts.SyntaxKind.JSDocComment)) { - if (isTokenKind(child.kind)) - return child; - node = child; - continue outer; - } - } - return; + +/** + * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ +function baseKeys(object) { + if (!isPrototype(object)) { + return nativeKeys(object); + } + var result = []; + for (var key in Object(object)) { + if (hasOwnProperty.call(object, key) && key != 'constructor') { + result.push(key); } + } + return result; } -function getCommentAtPosition(sourceFile, pos, parent = sourceFile) { - const token = getTokenAtPosition(parent, pos, sourceFile); - if (token === undefined || token.kind === ts.SyntaxKind.JsxText || pos >= token.end - (ts.tokenToString(token.kind) || '').length) - return; - const startPos = token.pos === 0 - ? (ts.getShebang(sourceFile.text) || '').length - : token.pos; - return startPos !== 0 && ts.forEachTrailingCommentRange(sourceFile.text, startPos, commentAtPositionCallback, pos) || - ts.forEachLeadingCommentRange(sourceFile.text, startPos, commentAtPositionCallback, pos); -} -exports.getCommentAtPosition = getCommentAtPosition; -function commentAtPositionCallback(pos, end, kind, _nl, at) { - return at >= pos && at < end ? { pos, end, kind } : undefined; -} -function isPositionInComment(sourceFile, pos, parent) { - return getCommentAtPosition(sourceFile, pos, parent) !== undefined; + +/** + * The base implementation of `_.matches` which doesn't clone `source`. + * + * @private + * @param {Object} source The object of property values to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatches(source) { + var matchData = getMatchData(source); + if (matchData.length == 1 && matchData[0][2]) { + return matchesStrictComparable(matchData[0][0], matchData[0][1]); + } + return function(object) { + return object === source || baseIsMatch(object, source, matchData); + }; } -exports.isPositionInComment = isPositionInComment; -function commentText(sourceText, comment) { - return sourceText.substring(comment.pos + 2, comment.kind === ts.SyntaxKind.SingleLineCommentTrivia ? comment.end : comment.end - 2); + +/** + * The base implementation of `_.matchesProperty` which doesn't clone `srcValue`. + * + * @private + * @param {string} path The path of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function baseMatchesProperty(path, srcValue) { + if (isKey(path) && isStrictComparable(srcValue)) { + return matchesStrictComparable(toKey(path), srcValue); + } + return function(object) { + var objValue = get(object, path); + return (objValue === undefined && objValue === srcValue) + ? hasIn(object, path) + : baseIsEqual(srcValue, objValue, undefined, UNORDERED_COMPARE_FLAG | PARTIAL_COMPARE_FLAG); + }; } -exports.commentText = commentText; -function getWrappedNodeAtPosition(wrap, pos) { - if (wrap.node.pos > pos || wrap.node.end <= pos) - return; - outer: while (true) { - for (const child of wrap.children) { - if (child.node.pos > pos) - return wrap; - if (child.node.end > pos) { - wrap = child; - continue outer; - } - } - return wrap; - } + +/** + * A specialized version of `baseProperty` which supports deep paths. + * + * @private + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyDeep(path) { + return function(object) { + return baseGet(object, path); + }; } -exports.getWrappedNodeAtPosition = getWrappedNodeAtPosition; -function getPropertyName(propertyName) { - if (propertyName.kind === ts.SyntaxKind.ComputedPropertyName) { - if (!node_1.isLiteralExpression(propertyName.expression)) - return; - if (_3_2_1.isBigIntLiteral(propertyName.expression)) - return propertyName.expression.text.slice(0, -1); - return propertyName.expression.text; - } - return propertyName.text; + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } -exports.getPropertyName = getPropertyName; -function forEachDestructuringIdentifier(pattern, fn) { - for (const element of pattern.elements) { - if (element.kind !== ts.SyntaxKind.BindingElement) - continue; - let result; - if (element.name.kind === ts.SyntaxKind.Identifier) { - result = fn(element); - } - else { - result = forEachDestructuringIdentifier(element.name, fn); - } - if (result) - return result; - } + +/** + * Casts `value` to a path array if it's not one. + * + * @private + * @param {*} value The value to inspect. + * @returns {Array} Returns the cast property path array. + */ +function castPath(value) { + return isArray(value) ? value : stringToPath(value); } -exports.forEachDestructuringIdentifier = forEachDestructuringIdentifier; -function forEachDeclaredVariable(declarationList, cb) { - for (const declaration of declarationList.declarations) { - let result; - if (declaration.name.kind === ts.SyntaxKind.Identifier) { - result = cb(declaration); - } - else { - result = forEachDestructuringIdentifier(declaration.name, cb); - } - if (result) - return result; + +/** + * Creates a base function for methods like `_.forIn` and `_.forOwn`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ +function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var index = -1, + iterable = Object(object), + props = keysFunc(object), + length = props.length; + + while (length--) { + var key = props[fromRight ? length : ++index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } } + return object; + }; } -exports.forEachDeclaredVariable = forEachDeclaredVariable; -var VariableDeclarationKind; -(function (VariableDeclarationKind) { - VariableDeclarationKind[VariableDeclarationKind["Var"] = 0] = "Var"; - VariableDeclarationKind[VariableDeclarationKind["Let"] = 1] = "Let"; - VariableDeclarationKind[VariableDeclarationKind["Const"] = 2] = "Const"; -})(VariableDeclarationKind = exports.VariableDeclarationKind || (exports.VariableDeclarationKind = {})); -function getVariableDeclarationKind(declarationList) { - if (declarationList.flags & ts.NodeFlags.Let) - return 1; - if (declarationList.flags & ts.NodeFlags.Const) - return 2; - return 0; -} -exports.getVariableDeclarationKind = getVariableDeclarationKind; -function isBlockScopedVariableDeclarationList(declarationList) { - return (declarationList.flags & ts.NodeFlags.BlockScoped) !== 0; -} -exports.isBlockScopedVariableDeclarationList = isBlockScopedVariableDeclarationList; -function isBlockScopedVariableDeclaration(declaration) { - const parent = declaration.parent; - return parent.kind === ts.SyntaxKind.CatchClause || - isBlockScopedVariableDeclarationList(parent); -} -exports.isBlockScopedVariableDeclaration = isBlockScopedVariableDeclaration; -function isBlockScopedDeclarationStatement(statement) { - switch (statement.kind) { - case ts.SyntaxKind.VariableStatement: - return isBlockScopedVariableDeclarationList(statement.declarationList); - case ts.SyntaxKind.ClassDeclaration: - case ts.SyntaxKind.EnumDeclaration: - case ts.SyntaxKind.InterfaceDeclaration: - case ts.SyntaxKind.TypeAliasDeclaration: - return true; - default: - return false; + +/** + * A specialized version of `baseIsEqualDeep` for arrays with support for + * partial deep comparisons. + * + * @private + * @param {Array} array The array to compare. + * @param {Array} other The other array to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `array` and `other` objects. + * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. + */ +function equalArrays(array, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + arrLength = array.length, + othLength = other.length; + + if (arrLength != othLength && !(isPartial && othLength > arrLength)) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(array); + if (stacked && stack.get(other)) { + return stacked == other; + } + var index = -1, + result = true, + seen = (bitmask & UNORDERED_COMPARE_FLAG) ? new SetCache : undefined; + + stack.set(array, other); + stack.set(other, array); + + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, arrValue, index, other, array, stack) + : customizer(arrValue, othValue, index, array, other, stack); } -} -exports.isBlockScopedDeclarationStatement = isBlockScopedDeclarationStatement; -function isInSingleStatementContext(statement) { - switch (statement.parent.kind) { - case ts.SyntaxKind.ForStatement: - case ts.SyntaxKind.ForInStatement: - case ts.SyntaxKind.ForOfStatement: - case ts.SyntaxKind.WhileStatement: - case ts.SyntaxKind.DoStatement: - case ts.SyntaxKind.IfStatement: - case ts.SyntaxKind.WithStatement: - case ts.SyntaxKind.LabeledStatement: - return true; - default: - return false; + if (compared !== undefined) { + if (compared) { + continue; + } + result = false; + break; } -} -exports.isInSingleStatementContext = isInSingleStatementContext; -var ScopeBoundary; -(function (ScopeBoundary) { - ScopeBoundary[ScopeBoundary["None"] = 0] = "None"; - ScopeBoundary[ScopeBoundary["Function"] = 1] = "Function"; - ScopeBoundary[ScopeBoundary["Block"] = 2] = "Block"; - ScopeBoundary[ScopeBoundary["Type"] = 4] = "Type"; - ScopeBoundary[ScopeBoundary["ConditionalType"] = 8] = "ConditionalType"; -})(ScopeBoundary = exports.ScopeBoundary || (exports.ScopeBoundary = {})); -var ScopeBoundarySelector; -(function (ScopeBoundarySelector) { - ScopeBoundarySelector[ScopeBoundarySelector["Function"] = 1] = "Function"; - ScopeBoundarySelector[ScopeBoundarySelector["Block"] = 3] = "Block"; - ScopeBoundarySelector[ScopeBoundarySelector["Type"] = 7] = "Type"; - ScopeBoundarySelector[ScopeBoundarySelector["InferType"] = 8] = "InferType"; -})(ScopeBoundarySelector = exports.ScopeBoundarySelector || (exports.ScopeBoundarySelector = {})); -function isScopeBoundary(node) { - return isFunctionScopeBoundary(node) || isBlockScopeBoundary(node) || isTypeScopeBoundary(node); -} -exports.isScopeBoundary = isScopeBoundary; -function isTypeScopeBoundary(node) { - switch (node.kind) { - case ts.SyntaxKind.InterfaceDeclaration: - case ts.SyntaxKind.TypeAliasDeclaration: - case ts.SyntaxKind.MappedType: - return 4; - case ts.SyntaxKind.ConditionalType: - return 8; - default: - return 0; + // Recursively compare arrays (susceptible to call stack limits). + if (seen) { + if (!arraySome(other, function(othValue, othIndex) { + if (!seen.has(othIndex) && + (arrValue === othValue || equalFunc(arrValue, othValue, customizer, bitmask, stack))) { + return seen.add(othIndex); + } + })) { + result = false; + break; + } + } else if (!( + arrValue === othValue || + equalFunc(arrValue, othValue, customizer, bitmask, stack) + )) { + result = false; + break; } + } + stack['delete'](array); + stack['delete'](other); + return result; } -exports.isTypeScopeBoundary = isTypeScopeBoundary; -function isFunctionScopeBoundary(node) { - switch (node.kind) { - case ts.SyntaxKind.FunctionExpression: - case ts.SyntaxKind.ArrowFunction: - case ts.SyntaxKind.Constructor: - case ts.SyntaxKind.ModuleDeclaration: - case ts.SyntaxKind.ClassDeclaration: - case ts.SyntaxKind.ClassExpression: - case ts.SyntaxKind.EnumDeclaration: - case ts.SyntaxKind.MethodDeclaration: - case ts.SyntaxKind.FunctionDeclaration: - case ts.SyntaxKind.GetAccessor: - case ts.SyntaxKind.SetAccessor: - case ts.SyntaxKind.MethodSignature: - case ts.SyntaxKind.CallSignature: - case ts.SyntaxKind.ConstructSignature: - case ts.SyntaxKind.ConstructorType: - case ts.SyntaxKind.FunctionType: - return 1; - case ts.SyntaxKind.SourceFile: - return ts.isExternalModule(node) ? 1 : 0; - default: - return 0; - } + +/** + * A specialized version of `baseIsEqualDeep` for comparing objects of + * the same `toStringTag`. + * + * **Note:** This function only supports comparing values with tags of + * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {string} tag The `toStringTag` of the objects to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalByTag(object, other, tag, equalFunc, customizer, bitmask, stack) { + switch (tag) { + case dataViewTag: + if ((object.byteLength != other.byteLength) || + (object.byteOffset != other.byteOffset)) { + return false; + } + object = object.buffer; + other = other.buffer; + + case arrayBufferTag: + if ((object.byteLength != other.byteLength) || + !equalFunc(new Uint8Array(object), new Uint8Array(other))) { + return false; + } + return true; + + case boolTag: + case dateTag: + case numberTag: + // Coerce booleans to `1` or `0` and dates to milliseconds. + // Invalid dates are coerced to `NaN`. + return eq(+object, +other); + + case errorTag: + return object.name == other.name && object.message == other.message; + + case regexpTag: + case stringTag: + // Coerce regexes to strings and treat strings, primitives and objects, + // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring + // for more details. + return object == (other + ''); + + case mapTag: + var convert = mapToArray; + + case setTag: + var isPartial = bitmask & PARTIAL_COMPARE_FLAG; + convert || (convert = setToArray); + + if (object.size != other.size && !isPartial) { + return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked) { + return stacked == other; + } + bitmask |= UNORDERED_COMPARE_FLAG; + + // Recursively compare objects (susceptible to call stack limits). + stack.set(object, other); + var result = equalArrays(convert(object), convert(other), equalFunc, customizer, bitmask, stack); + stack['delete'](object); + return result; + + case symbolTag: + if (symbolValueOf) { + return symbolValueOf.call(object) == symbolValueOf.call(other); + } + } + return false; } -exports.isFunctionScopeBoundary = isFunctionScopeBoundary; -function isBlockScopeBoundary(node) { - switch (node.kind) { - case ts.SyntaxKind.Block: - const parent = node.parent; - return parent.kind !== ts.SyntaxKind.CatchClause && - (parent.kind === ts.SyntaxKind.SourceFile || - !isFunctionScopeBoundary(parent)) - ? 2 - : 0; - case ts.SyntaxKind.ForStatement: - case ts.SyntaxKind.ForInStatement: - case ts.SyntaxKind.ForOfStatement: - case ts.SyntaxKind.CaseBlock: - case ts.SyntaxKind.CatchClause: - case ts.SyntaxKind.WithStatement: - return 2; - default: - return 0; + +/** + * A specialized version of `baseIsEqualDeep` for objects with support for + * partial deep comparisons. + * + * @private + * @param {Object} object The object to compare. + * @param {Object} other The other object to compare. + * @param {Function} equalFunc The function to determine equivalents of values. + * @param {Function} customizer The function to customize comparisons. + * @param {number} bitmask The bitmask of comparison flags. See `baseIsEqual` + * for more details. + * @param {Object} stack Tracks traversed `object` and `other` objects. + * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. + */ +function equalObjects(object, other, equalFunc, customizer, bitmask, stack) { + var isPartial = bitmask & PARTIAL_COMPARE_FLAG, + objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; + + if (objLength != othLength && !isPartial) { + return false; + } + var index = objLength; + while (index--) { + var key = objProps[index]; + if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { + return false; } -} -exports.isBlockScopeBoundary = isBlockScopeBoundary; -function hasOwnThisReference(node) { - switch (node.kind) { - case ts.SyntaxKind.ClassDeclaration: - case ts.SyntaxKind.ClassExpression: - case ts.SyntaxKind.FunctionExpression: - return true; - case ts.SyntaxKind.FunctionDeclaration: - return node.body !== undefined; - case ts.SyntaxKind.MethodDeclaration: - case ts.SyntaxKind.GetAccessor: - case ts.SyntaxKind.SetAccessor: - return node.parent.kind === ts.SyntaxKind.ObjectLiteralExpression; - default: - return false; + } + // Assume cyclic values are equal. + var stacked = stack.get(object); + if (stacked && stack.get(other)) { + return stacked == other; + } + var result = true; + stack.set(object, other); + stack.set(other, object); + + var skipCtor = isPartial; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key]; + + if (customizer) { + var compared = isPartial + ? customizer(othValue, objValue, key, other, object, stack) + : customizer(objValue, othValue, key, object, other, stack); } -} -exports.hasOwnThisReference = hasOwnThisReference; -function isFunctionWithBody(node) { - switch (node.kind) { - case ts.SyntaxKind.GetAccessor: - case ts.SyntaxKind.SetAccessor: - case ts.SyntaxKind.FunctionDeclaration: - case ts.SyntaxKind.MethodDeclaration: - case ts.SyntaxKind.Constructor: - return node.body !== undefined; - case ts.SyntaxKind.FunctionExpression: - case ts.SyntaxKind.ArrowFunction: - return true; - default: - return false; + // Recursively compare objects (susceptible to call stack limits). + if (!(compared === undefined + ? (objValue === othValue || equalFunc(objValue, othValue, customizer, bitmask, stack)) + : compared + )) { + result = false; + break; + } + skipCtor || (skipCtor = key == 'constructor'); + } + if (result && !skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; + + // Non `Object` object instances with different constructors are not equal. + if (objCtor != othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor == 'function' && objCtor instanceof objCtor && + typeof othCtor == 'function' && othCtor instanceof othCtor)) { + result = false; } + } + stack['delete'](object); + stack['delete'](other); + return result; } -exports.isFunctionWithBody = isFunctionWithBody; -function forEachToken(node, cb, sourceFile = node.getSourceFile()) { - return (function iterate(child) { - if (isTokenKind(child.kind)) - return cb(child); - if (child.kind !== ts.SyntaxKind.JSDocComment) - return child.getChildren(sourceFile).forEach(iterate); - })(node); + +/** + * Gets the data for `map`. + * + * @private + * @param {Object} map The map to query. + * @param {string} key The reference key. + * @returns {*} Returns the map data. + */ +function getMapData(map, key) { + var data = map.__data__; + return isKeyable(key) + ? data[typeof key == 'string' ? 'string' : 'hash'] + : data.map; } -exports.forEachToken = forEachToken; -function forEachTokenWithTrivia(node, cb, sourceFile = node.getSourceFile()) { - const fullText = sourceFile.text; - const scanner = ts.createScanner(sourceFile.languageVersion, false, sourceFile.languageVariant, fullText); - return forEachToken(node, (token) => { - const tokenStart = token.kind === ts.SyntaxKind.JsxText || token.pos === token.end ? token.pos : token.getStart(sourceFile); - if (tokenStart !== token.pos) { - scanner.setTextPos(token.pos); - let kind = scanner.scan(); - let pos = scanner.getTokenPos(); - while (pos < tokenStart) { - const textPos = scanner.getTextPos(); - cb(fullText, kind, { pos, end: textPos }, token.parent); - if (textPos === tokenStart) - break; - kind = scanner.scan(); - pos = scanner.getTokenPos(); - } - } - return cb(fullText, token.kind, { end: token.end, pos: tokenStart }, token.parent); - }, sourceFile); + +/** + * Gets the property names, values, and compare flags of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the match data of `object`. + */ +function getMatchData(object) { + var result = keys(object), + length = result.length; + + while (length--) { + var key = result[length], + value = object[key]; + + result[length] = [key, value, isStrictComparable(value)]; + } + return result; } -exports.forEachTokenWithTrivia = forEachTokenWithTrivia; -function forEachComment(node, cb, sourceFile = node.getSourceFile()) { - const fullText = sourceFile.text; - const notJsx = sourceFile.languageVariant !== ts.LanguageVariant.JSX; - return forEachToken(node, (token) => { - if (token.pos === token.end) - return; - if (token.kind !== ts.SyntaxKind.JsxText) - ts.forEachLeadingCommentRange(fullText, token.pos === 0 ? (ts.getShebang(fullText) || '').length : token.pos, commentCallback); - if (notJsx || canHaveTrailingTrivia(token)) - return ts.forEachTrailingCommentRange(fullText, token.end, commentCallback); - }, sourceFile); - function commentCallback(pos, end, kind) { - cb(fullText, { pos, end, kind }); - } + +/** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ +function getNative(object, key) { + var value = getValue(object, key); + return baseIsNative(value) ? value : undefined; } -exports.forEachComment = forEachComment; -function canHaveTrailingTrivia(token) { - switch (token.kind) { - case ts.SyntaxKind.CloseBraceToken: - return token.parent.kind !== ts.SyntaxKind.JsxExpression || !isJsxElementOrFragment(token.parent.parent); - case ts.SyntaxKind.GreaterThanToken: - switch (token.parent.kind) { - case ts.SyntaxKind.JsxOpeningElement: - return token.end !== token.parent.end; - case ts.SyntaxKind.JsxOpeningFragment: - return false; - case ts.SyntaxKind.JsxSelfClosingElement: - return token.end !== token.parent.end || - !isJsxElementOrFragment(token.parent.parent); - case ts.SyntaxKind.JsxClosingElement: - case ts.SyntaxKind.JsxClosingFragment: - return !isJsxElementOrFragment(token.parent.parent.parent); - } + +/** + * Gets the `toStringTag` of `value`. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +var getTag = baseGetTag; + +// Fallback for data views, maps, sets, and weak maps in IE 11, +// for data views in Edge < 14, and promises in Node.js. +if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || + (Map && getTag(new Map) != mapTag) || + (Promise && getTag(Promise.resolve()) != promiseTag) || + (Set && getTag(new Set) != setTag) || + (WeakMap && getTag(new WeakMap) != weakMapTag)) { + getTag = function(value) { + var result = objectToString.call(value), + Ctor = result == objectTag ? value.constructor : undefined, + ctorString = Ctor ? toSource(Ctor) : undefined; + + if (ctorString) { + switch (ctorString) { + case dataViewCtorString: return dataViewTag; + case mapCtorString: return mapTag; + case promiseCtorString: return promiseTag; + case setCtorString: return setTag; + case weakMapCtorString: return weakMapTag; + } } - return true; -} -function isJsxElementOrFragment(node) { - return node.kind === ts.SyntaxKind.JsxElement || node.kind === ts.SyntaxKind.JsxFragment; + return result; + }; } -function getLineRanges(sourceFile) { - const lineStarts = sourceFile.getLineStarts(); - const result = []; - const length = lineStarts.length; - const sourceText = sourceFile.text; - let pos = 0; - for (let i = 1; i < length; ++i) { - const end = lineStarts[i]; - let lineEnd = end; - for (; lineEnd > pos; --lineEnd) - if (!ts.isLineBreak(sourceText.charCodeAt(lineEnd - 1))) - break; - result.push({ - pos, - end, - contentLength: lineEnd - pos, - }); - pos = end; + +/** + * Checks if `path` exists on `object`. + * + * @private + * @param {Object} object The object to query. + * @param {Array|string} path The path to check. + * @param {Function} hasFunc The function to check properties. + * @returns {boolean} Returns `true` if `path` exists, else `false`. + */ +function hasPath(object, path, hasFunc) { + path = isKey(path, object) ? [path] : castPath(path); + + var result, + index = -1, + length = path.length; + + while (++index < length) { + var key = toKey(path[index]); + if (!(result = object != null && hasFunc(object, key))) { + break; } - result.push({ - pos, - end: sourceFile.end, - contentLength: sourceFile.end - pos, - }); + object = object[key]; + } + if (result) { return result; + } + var length = object ? object.length : 0; + return !!length && isLength(length) && isIndex(key, length) && + (isArray(object) || isArguments(object)); } -exports.getLineRanges = getLineRanges; -function getLineBreakStyle(sourceFile) { - const lineStarts = sourceFile.getLineStarts(); - return lineStarts.length === 1 || lineStarts[1] < 2 || sourceFile.text[lineStarts[1] - 2] !== '\r' - ? '\n' - : '\r\n'; -} -exports.getLineBreakStyle = getLineBreakStyle; -let cachedScanner; -function scanToken(text, languageVersion) { - if (cachedScanner === undefined) { - cachedScanner = ts.createScanner(languageVersion, false, undefined, text); - } - else { - cachedScanner.setScriptTarget(languageVersion); - cachedScanner.setText(text); - } - cachedScanner.scan(); - return cachedScanner; + +/** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ +function isIndex(value, length) { + length = length == null ? MAX_SAFE_INTEGER : length; + return !!length && + (typeof value == 'number' || reIsUint.test(value)) && + (value > -1 && value % 1 == 0 && value < length); } -function isValidIdentifier(text, languageVersion = ts.ScriptTarget.Latest) { - const scan = scanToken(text, languageVersion); - return scan.isIdentifier() && scan.getTextPos() === text.length && scan.getTokenPos() === 0; + +/** + * Checks if `value` is a property name and not a property path. + * + * @private + * @param {*} value The value to check. + * @param {Object} [object] The object to query keys on. + * @returns {boolean} Returns `true` if `value` is a property name, else `false`. + */ +function isKey(value, object) { + if (isArray(value)) { + return false; + } + var type = typeof value; + if (type == 'number' || type == 'symbol' || type == 'boolean' || + value == null || isSymbol(value)) { + return true; + } + return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || + (object != null && value in Object(object)); } -exports.isValidIdentifier = isValidIdentifier; -function charSize(ch) { - return ch >= 0x10000 ? 2 : 1; + +/** + * Checks if `value` is suitable for use as unique object key. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is suitable, else `false`. + */ +function isKeyable(value) { + var type = typeof value; + return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') + ? (value !== '__proto__') + : (value === null); } -function isValidPropertyAccess(text, languageVersion = ts.ScriptTarget.Latest) { - if (text.length === 0) - return false; - let ch = text.codePointAt(0); - if (!ts.isIdentifierStart(ch, languageVersion)) - return false; - for (let i = charSize(ch); i < text.length; i += charSize(ch)) { - ch = text.codePointAt(i); - if (!ts.isIdentifierPart(ch, languageVersion)) - return false; - } - return true; + +/** + * Checks if `func` has its source masked. + * + * @private + * @param {Function} func The function to check. + * @returns {boolean} Returns `true` if `func` is masked, else `false`. + */ +function isMasked(func) { + return !!maskSrcKey && (maskSrcKey in func); } -exports.isValidPropertyAccess = isValidPropertyAccess; -function isValidPropertyName(text, languageVersion = ts.ScriptTarget.Latest) { - if (isValidPropertyAccess(text, languageVersion)) - return true; - const scan = scanToken(text, languageVersion); - return scan.getTextPos() === text.length && - scan.getToken() === ts.SyntaxKind.NumericLiteral && scan.getTokenValue() === text; + +/** + * Checks if `value` is likely a prototype object. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. + */ +function isPrototype(value) { + var Ctor = value && value.constructor, + proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; + + return value === proto; } -exports.isValidPropertyName = isValidPropertyName; -function isValidNumericLiteral(text, languageVersion = ts.ScriptTarget.Latest) { - const scan = scanToken(text, languageVersion); - return scan.getToken() === ts.SyntaxKind.NumericLiteral && scan.getTextPos() === text.length && scan.getTokenPos() === 0; + +/** + * Checks if `value` is suitable for strict equality comparisons, i.e. `===`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` if suitable for strict + * equality comparisons, else `false`. + */ +function isStrictComparable(value) { + return value === value && !isObject(value); } -exports.isValidNumericLiteral = isValidNumericLiteral; -function isValidJsxIdentifier(text, languageVersion = ts.ScriptTarget.Latest) { - if (text.length === 0) - return false; - let ch = text.codePointAt(0); - if (!ts.isIdentifierStart(ch, languageVersion)) - return false; - for (let i = charSize(ch); i < text.length; i += charSize(ch)) { - ch = text.codePointAt(i); - if (!ts.isIdentifierPart(ch, languageVersion) && ch !== 45) - return false; + +/** + * A specialized version of `matchesProperty` for source values suitable + * for strict equality comparisons, i.e. `===`. + * + * @private + * @param {string} key The key of the property to get. + * @param {*} srcValue The value to match. + * @returns {Function} Returns the new spec function. + */ +function matchesStrictComparable(key, srcValue) { + return function(object) { + if (object == null) { + return false; } - return true; + return object[key] === srcValue && + (srcValue !== undefined || (key in Object(object))); + }; } -exports.isValidJsxIdentifier = isValidJsxIdentifier; -function isNumericPropertyName(name) { - return String(+name) === name; + +/** + * Converts `string` to a property path array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the property path array. + */ +var stringToPath = memoize(function(string) { + string = toString(string); + + var result = []; + if (reLeadingDot.test(string)) { + result.push(''); + } + string.replace(rePropName, function(match, number, quote, string) { + result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match)); + }); + return result; +}); + +/** + * Converts `value` to a string key if it's not a string or symbol. + * + * @private + * @param {*} value The value to inspect. + * @returns {string|symbol} Returns the key. + */ +function toKey(value) { + if (typeof value == 'string' || isSymbol(value)) { + return value; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; } -exports.isNumericPropertyName = isNumericPropertyName; -function isSameLine(sourceFile, pos1, pos2) { - return ts.getLineAndCharacterOfPosition(sourceFile, pos1).line === ts.getLineAndCharacterOfPosition(sourceFile, pos2).line; + +/** + * Converts `func` to its source code. + * + * @private + * @param {Function} func The function to process. + * @returns {string} Returns the source code. + */ +function toSource(func) { + if (func != null) { + try { + return funcToString.call(func); + } catch (e) {} + try { + return (func + ''); + } catch (e) {} + } + return ''; } -exports.isSameLine = isSameLine; -var SideEffectOptions; -(function (SideEffectOptions) { - SideEffectOptions[SideEffectOptions["None"] = 0] = "None"; - SideEffectOptions[SideEffectOptions["TaggedTemplate"] = 1] = "TaggedTemplate"; - SideEffectOptions[SideEffectOptions["Constructor"] = 2] = "Constructor"; - SideEffectOptions[SideEffectOptions["JsxElement"] = 4] = "JsxElement"; -})(SideEffectOptions = exports.SideEffectOptions || (exports.SideEffectOptions = {})); -function hasSideEffects(node, options) { - switch (node.kind) { - case ts.SyntaxKind.CallExpression: - case ts.SyntaxKind.PostfixUnaryExpression: - case ts.SyntaxKind.AwaitExpression: - case ts.SyntaxKind.YieldExpression: - case ts.SyntaxKind.DeleteExpression: - return true; - case ts.SyntaxKind.TypeAssertionExpression: - case ts.SyntaxKind.AsExpression: - case ts.SyntaxKind.ParenthesizedExpression: - case ts.SyntaxKind.NonNullExpression: - case ts.SyntaxKind.VoidExpression: - case ts.SyntaxKind.TypeOfExpression: - case ts.SyntaxKind.PropertyAccessExpression: - case ts.SyntaxKind.SpreadElement: - case ts.SyntaxKind.PartiallyEmittedExpression: - return hasSideEffects(node.expression, options); - case ts.SyntaxKind.BinaryExpression: - return isAssignmentKind(node.operatorToken.kind) || - hasSideEffects(node.left, options) || - hasSideEffects(node.right, options); - case ts.SyntaxKind.PrefixUnaryExpression: - switch (node.operator) { - case ts.SyntaxKind.PlusPlusToken: - case ts.SyntaxKind.MinusMinusToken: - return true; - default: - return hasSideEffects(node.operand, options); - } - case ts.SyntaxKind.ElementAccessExpression: - return hasSideEffects(node.expression, options) || - node.argumentExpression !== undefined && - hasSideEffects(node.argumentExpression, options); - case ts.SyntaxKind.ConditionalExpression: - return hasSideEffects(node.condition, options) || - hasSideEffects(node.whenTrue, options) || - hasSideEffects(node.whenFalse, options); - case ts.SyntaxKind.NewExpression: - if (options & 2 || hasSideEffects(node.expression, options)) - return true; - if (node.arguments !== undefined) - for (const child of node.arguments) - if (hasSideEffects(child, options)) - return true; - return false; - case ts.SyntaxKind.TaggedTemplateExpression: - if (options & 1 || hasSideEffects(node.tag, options)) - return true; - if (node.template.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral) - return false; - node = node.template; - case ts.SyntaxKind.TemplateExpression: - for (const child of node.templateSpans) - if (hasSideEffects(child.expression, options)) - return true; - return false; - case ts.SyntaxKind.ClassExpression: - return classExpressionHasSideEffects(node, options); - case ts.SyntaxKind.ArrayLiteralExpression: - for (const child of node.elements) - if (hasSideEffects(child, options)) - return true; - return false; - case ts.SyntaxKind.ObjectLiteralExpression: - for (const child of node.properties) { - if (child.name !== undefined && child.name.kind === ts.SyntaxKind.ComputedPropertyName && - hasSideEffects(child.name.expression, options)) - return true; - switch (child.kind) { - case ts.SyntaxKind.PropertyAssignment: - if (hasSideEffects(child.initializer, options)) - return true; - break; - case ts.SyntaxKind.SpreadAssignment: - if (hasSideEffects(child.expression, options)) - return true; - } - } - return false; - case ts.SyntaxKind.JsxExpression: - return node.expression !== undefined && hasSideEffects(node.expression, options); - case ts.SyntaxKind.JsxElement: - case ts.SyntaxKind.JsxFragment: - for (const child of node.children) - if (child.kind !== ts.SyntaxKind.JsxText && hasSideEffects(child, options)) - return true; - if (node.kind === ts.SyntaxKind.JsxFragment) - return false; - node = node.openingElement; - case ts.SyntaxKind.JsxSelfClosingElement: - case ts.SyntaxKind.JsxOpeningElement: - if (options & 4) - return true; - for (const child of node.attributes.properties) { - if (child.kind === ts.SyntaxKind.JsxSpreadAttribute) { - if (hasSideEffects(child.expression, options)) - return true; - } - else if (child.initializer !== undefined && hasSideEffects(child.initializer, options)) { - return true; - } - } - return false; - case ts.SyntaxKind.CommaListExpression: - for (const child of node.elements) - if (hasSideEffects(child, options)) - return true; - return false; - default: - return false; + +/** + * Creates a function that memoizes the result of `func`. If `resolver` is + * provided, it determines the cache key for storing the result based on the + * arguments provided to the memoized function. By default, the first argument + * provided to the memoized function is used as the map cache key. The `func` + * is invoked with the `this` binding of the memoized function. + * + * **Note:** The cache is exposed as the `cache` property on the memoized + * function. Its creation may be customized by replacing the `_.memoize.Cache` + * constructor with one whose instances implement the + * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object) + * method interface of `delete`, `get`, `has`, and `set`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to have its output memoized. + * @param {Function} [resolver] The function to resolve the cache key. + * @returns {Function} Returns the new memoized function. + * @example + * + * var object = { 'a': 1, 'b': 2 }; + * var other = { 'c': 3, 'd': 4 }; + * + * var values = _.memoize(_.values); + * values(object); + * // => [1, 2] + * + * values(other); + * // => [3, 4] + * + * object.a = 2; + * values(object); + * // => [1, 2] + * + * // Modify the result cache. + * values.cache.set(object, ['a', 'b']); + * values(object); + * // => ['a', 'b'] + * + * // Replace `_.memoize.Cache`. + * _.memoize.Cache = WeakMap; + */ +function memoize(func, resolver) { + if (typeof func != 'function' || (resolver && typeof resolver != 'function')) { + throw new TypeError(FUNC_ERROR_TEXT); + } + var memoized = function() { + var args = arguments, + key = resolver ? resolver.apply(this, args) : args[0], + cache = memoized.cache; + + if (cache.has(key)) { + return cache.get(key); } + var result = func.apply(this, args); + memoized.cache = cache.set(key, result); + return result; + }; + memoized.cache = new (memoize.Cache || MapCache); + return memoized; } -exports.hasSideEffects = hasSideEffects; -function classExpressionHasSideEffects(node, options) { - if (node.heritageClauses !== undefined && node.heritageClauses[0].token === ts.SyntaxKind.ExtendsKeyword) - for (const base of node.heritageClauses[0].types) - if (hasSideEffects(base.expression, options)) - return true; - for (const child of node.members) - if (child.name !== undefined && child.name.kind === ts.SyntaxKind.ComputedPropertyName && - hasSideEffects(child.name.expression, options) || - node_1.isPropertyDeclaration(child) && child.initializer !== undefined && - hasSideEffects(child.initializer, options)) - return true; - return false; -} -function getDeclarationOfBindingElement(node) { - let parent = node.parent.parent; - while (parent.kind === ts.SyntaxKind.BindingElement) - parent = parent.parent.parent; - return parent; + +// Assign cache to `_.memoize`. +memoize.Cache = MapCache; + +/** + * Performs a + * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) + * comparison between two values to determine if they are equivalent. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to compare. + * @param {*} other The other value to compare. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'a': 1 }; + * var other = { 'a': 1 }; + * + * _.eq(object, object); + * // => true + * + * _.eq(object, other); + * // => false + * + * _.eq('a', 'a'); + * // => true + * + * _.eq('a', Object('a')); + * // => false + * + * _.eq(NaN, NaN); + * // => true + */ +function eq(value, other) { + return value === other || (value !== value && other !== other); } -exports.getDeclarationOfBindingElement = getDeclarationOfBindingElement; -function isExpressionValueUsed(node) { - while (true) { - const parent = node.parent; - switch (parent.kind) { - case ts.SyntaxKind.CallExpression: - case ts.SyntaxKind.NewExpression: - case ts.SyntaxKind.ElementAccessExpression: - case ts.SyntaxKind.WhileStatement: - case ts.SyntaxKind.DoStatement: - case ts.SyntaxKind.WithStatement: - case ts.SyntaxKind.ThrowStatement: - case ts.SyntaxKind.ReturnStatement: - case ts.SyntaxKind.JsxExpression: - case ts.SyntaxKind.JsxSpreadAttribute: - case ts.SyntaxKind.JsxElement: - case ts.SyntaxKind.JsxFragment: - case ts.SyntaxKind.JsxSelfClosingElement: - case ts.SyntaxKind.ComputedPropertyName: - case ts.SyntaxKind.ArrowFunction: - case ts.SyntaxKind.ExportSpecifier: - case ts.SyntaxKind.ExportAssignment: - case ts.SyntaxKind.ImportDeclaration: - case ts.SyntaxKind.ExternalModuleReference: - case ts.SyntaxKind.Decorator: - case ts.SyntaxKind.TaggedTemplateExpression: - case ts.SyntaxKind.TemplateSpan: - case ts.SyntaxKind.ExpressionWithTypeArguments: - case ts.SyntaxKind.TypeOfExpression: - case ts.SyntaxKind.AwaitExpression: - case ts.SyntaxKind.YieldExpression: - case ts.SyntaxKind.LiteralType: - case ts.SyntaxKind.JsxAttributes: - case ts.SyntaxKind.JsxOpeningElement: - case ts.SyntaxKind.JsxClosingElement: - case ts.SyntaxKind.IfStatement: - case ts.SyntaxKind.CaseClause: - case ts.SyntaxKind.SwitchStatement: - return true; - case ts.SyntaxKind.PropertyAccessExpression: - return parent.expression === node; - case ts.SyntaxKind.QualifiedName: - return parent.left === node; - case ts.SyntaxKind.ShorthandPropertyAssignment: - return parent.objectAssignmentInitializer === node || - !isInDestructuringAssignment(parent); - case ts.SyntaxKind.PropertyAssignment: - return parent.initializer === node && !isInDestructuringAssignment(parent); - case ts.SyntaxKind.SpreadAssignment: - case ts.SyntaxKind.SpreadElement: - case ts.SyntaxKind.ArrayLiteralExpression: - return !isInDestructuringAssignment(parent); - case ts.SyntaxKind.ParenthesizedExpression: - case ts.SyntaxKind.AsExpression: - case ts.SyntaxKind.TypeAssertionExpression: - case ts.SyntaxKind.PostfixUnaryExpression: - case ts.SyntaxKind.PrefixUnaryExpression: - case ts.SyntaxKind.NonNullExpression: - node = parent; - break; - case ts.SyntaxKind.ForStatement: - return parent.condition === node; - case ts.SyntaxKind.ForInStatement: - case ts.SyntaxKind.ForOfStatement: - return parent.expression === node; - case ts.SyntaxKind.ConditionalExpression: - if (parent.condition === node) - return true; - node = parent; - break; - case ts.SyntaxKind.PropertyDeclaration: - case ts.SyntaxKind.BindingElement: - case ts.SyntaxKind.VariableDeclaration: - case ts.SyntaxKind.Parameter: - case ts.SyntaxKind.EnumMember: - return parent.initializer === node; - case ts.SyntaxKind.ImportEqualsDeclaration: - return parent.moduleReference === node; - case ts.SyntaxKind.CommaListExpression: - if (parent.elements[parent.elements.length - 1] !== node) - return false; - node = parent; - break; - case ts.SyntaxKind.BinaryExpression: - if (parent.right === node) { - if (parent.operatorToken.kind === ts.SyntaxKind.CommaToken) { - node = parent; - break; - } - return true; - } - switch (parent.operatorToken.kind) { - case ts.SyntaxKind.CommaToken: - case ts.SyntaxKind.EqualsToken: - return false; - case ts.SyntaxKind.EqualsEqualsEqualsToken: - case ts.SyntaxKind.EqualsEqualsToken: - case ts.SyntaxKind.ExclamationEqualsEqualsToken: - case ts.SyntaxKind.ExclamationEqualsToken: - case ts.SyntaxKind.InstanceOfKeyword: - case ts.SyntaxKind.PlusToken: - case ts.SyntaxKind.MinusToken: - case ts.SyntaxKind.AsteriskToken: - case ts.SyntaxKind.SlashToken: - case ts.SyntaxKind.PercentToken: - case ts.SyntaxKind.AsteriskAsteriskToken: - case ts.SyntaxKind.GreaterThanToken: - case ts.SyntaxKind.GreaterThanGreaterThanToken: - case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: - case ts.SyntaxKind.GreaterThanEqualsToken: - case ts.SyntaxKind.LessThanToken: - case ts.SyntaxKind.LessThanLessThanToken: - case ts.SyntaxKind.LessThanEqualsToken: - case ts.SyntaxKind.AmpersandToken: - case ts.SyntaxKind.BarToken: - case ts.SyntaxKind.CaretToken: - case ts.SyntaxKind.BarBarToken: - case ts.SyntaxKind.AmpersandAmpersandToken: - case ts.SyntaxKind.InKeyword: - return true; - default: - node = parent; - } - break; - default: - return false; - } - } + +/** + * Checks if `value` is likely an `arguments` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an `arguments` object, + * else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ +function isArguments(value) { + // Safari 8.1 makes `arguments.callee` enumerable in strict mode. + return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && + (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } -exports.isExpressionValueUsed = isExpressionValueUsed; -function isInDestructuringAssignment(node) { - switch (node.kind) { - case ts.SyntaxKind.ShorthandPropertyAssignment: - if (node.objectAssignmentInitializer !== undefined) - return true; - case ts.SyntaxKind.PropertyAssignment: - case ts.SyntaxKind.SpreadAssignment: - node = node.parent; - break; - case ts.SyntaxKind.SpreadElement: - if (node.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression) - return false; - node = node.parent; - } - while (true) { - switch (node.parent.kind) { - case ts.SyntaxKind.BinaryExpression: - return node.parent.left === node && - node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken; - case ts.SyntaxKind.ForOfStatement: - return node.parent.initializer === node; - case ts.SyntaxKind.ArrayLiteralExpression: - case ts.SyntaxKind.ObjectLiteralExpression: - node = node.parent; - break; - case ts.SyntaxKind.SpreadAssignment: - case ts.SyntaxKind.PropertyAssignment: - node = node.parent.parent; - break; - case ts.SyntaxKind.SpreadElement: - if (node.parent.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression) - return false; - node = node.parent.parent; - break; - default: - return false; - } - } + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +/** + * Checks if `value` is array-like. A value is considered array-like if it's + * not a function and has a `value.length` that's an integer greater than or + * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + * @example + * + * _.isArrayLike([1, 2, 3]); + * // => true + * + * _.isArrayLike(document.body.children); + * // => true + * + * _.isArrayLike('abc'); + * // => true + * + * _.isArrayLike(_.noop); + * // => false + */ +function isArrayLike(value) { + return value != null && isLength(value.length) && !isFunction(value); } -var AccessKind; -(function (AccessKind) { - AccessKind[AccessKind["None"] = 0] = "None"; - AccessKind[AccessKind["Read"] = 1] = "Read"; - AccessKind[AccessKind["Write"] = 2] = "Write"; - AccessKind[AccessKind["Delete"] = 4] = "Delete"; - AccessKind[AccessKind["ReadWrite"] = 3] = "ReadWrite"; - AccessKind[AccessKind["Modification"] = 6] = "Modification"; -})(AccessKind = exports.AccessKind || (exports.AccessKind = {})); -function getAccessKind(node) { - const parent = node.parent; - switch (parent.kind) { - case ts.SyntaxKind.DeleteExpression: - return 4; - case ts.SyntaxKind.PostfixUnaryExpression: - return 3; - case ts.SyntaxKind.PrefixUnaryExpression: - return parent.operator === ts.SyntaxKind.PlusPlusToken || - parent.operator === ts.SyntaxKind.MinusMinusToken - ? 3 - : 1; - case ts.SyntaxKind.BinaryExpression: - return parent.right === node - ? 1 - : !isAssignmentKind(parent.operatorToken.kind) - ? 1 - : parent.operatorToken.kind === ts.SyntaxKind.EqualsToken - ? 2 - : 3; - case ts.SyntaxKind.ShorthandPropertyAssignment: - return parent.objectAssignmentInitializer === node - ? 1 - : isInDestructuringAssignment(parent) - ? 2 - : 1; - case ts.SyntaxKind.PropertyAssignment: - return parent.name === node - ? 0 - : isInDestructuringAssignment(parent) - ? 2 - : 1; - case ts.SyntaxKind.ArrayLiteralExpression: - case ts.SyntaxKind.SpreadElement: - case ts.SyntaxKind.SpreadAssignment: - return isInDestructuringAssignment(parent) - ? 2 - : 1; - case ts.SyntaxKind.ParenthesizedExpression: - case ts.SyntaxKind.NonNullExpression: - case ts.SyntaxKind.TypeAssertionExpression: - case ts.SyntaxKind.AsExpression: - return getAccessKind(parent); - case ts.SyntaxKind.ForOfStatement: - case ts.SyntaxKind.ForInStatement: - return parent.initializer === node - ? 2 - : 1; - case ts.SyntaxKind.ExpressionWithTypeArguments: - return parent.parent.token === ts.SyntaxKind.ExtendsKeyword && - parent.parent.parent.kind !== ts.SyntaxKind.InterfaceDeclaration - ? 1 - : 0; - case ts.SyntaxKind.ComputedPropertyName: - case ts.SyntaxKind.ExpressionStatement: - case ts.SyntaxKind.TypeOfExpression: - case ts.SyntaxKind.ElementAccessExpression: - case ts.SyntaxKind.ForStatement: - case ts.SyntaxKind.IfStatement: - case ts.SyntaxKind.DoStatement: - case ts.SyntaxKind.WhileStatement: - case ts.SyntaxKind.SwitchStatement: - case ts.SyntaxKind.WithStatement: - case ts.SyntaxKind.ThrowStatement: - case ts.SyntaxKind.CallExpression: - case ts.SyntaxKind.NewExpression: - case ts.SyntaxKind.TaggedTemplateExpression: - case ts.SyntaxKind.JsxExpression: - case ts.SyntaxKind.Decorator: - case ts.SyntaxKind.TemplateSpan: - case ts.SyntaxKind.JsxOpeningElement: - case ts.SyntaxKind.JsxSelfClosingElement: - case ts.SyntaxKind.JsxSpreadAttribute: - case ts.SyntaxKind.VoidExpression: - case ts.SyntaxKind.ReturnStatement: - case ts.SyntaxKind.AwaitExpression: - case ts.SyntaxKind.YieldExpression: - case ts.SyntaxKind.ConditionalExpression: - case ts.SyntaxKind.CaseClause: - case ts.SyntaxKind.JsxElement: - return 1; - case ts.SyntaxKind.ArrowFunction: - return parent.body === node - ? 1 - : 2; - case ts.SyntaxKind.PropertyDeclaration: - case ts.SyntaxKind.VariableDeclaration: - case ts.SyntaxKind.Parameter: - case ts.SyntaxKind.EnumMember: - case ts.SyntaxKind.BindingElement: - case ts.SyntaxKind.JsxAttribute: - return parent.initializer === node - ? 1 - : 0; - case ts.SyntaxKind.PropertyAccessExpression: - return parent.expression === node - ? 1 - : 0; - case ts.SyntaxKind.ExportAssignment: - return parent.isExportEquals - ? 1 - : 0; - } - return 0; + +/** + * This method is like `_.isArrayLike` except that it also checks if `value` + * is an object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array-like object, + * else `false`. + * @example + * + * _.isArrayLikeObject([1, 2, 3]); + * // => true + * + * _.isArrayLikeObject(document.body.children); + * // => true + * + * _.isArrayLikeObject('abc'); + * // => false + * + * _.isArrayLikeObject(_.noop); + * // => false + */ +function isArrayLikeObject(value) { + return isObjectLike(value) && isArrayLike(value); } -exports.getAccessKind = getAccessKind; -function isReassignmentTarget(node) { - return (getAccessKind(node) & 2) !== 0; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8-9 which returns 'object' for typed array and other constructors. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; } -exports.isReassignmentTarget = isReassignmentTarget; -function canHaveJsDoc(node) { - const kind = node.kind; - switch (kind) { - case ts.SyntaxKind.Parameter: - case ts.SyntaxKind.CallSignature: - case ts.SyntaxKind.ConstructSignature: - case ts.SyntaxKind.MethodSignature: - case ts.SyntaxKind.PropertySignature: - case ts.SyntaxKind.ArrowFunction: - case ts.SyntaxKind.ParenthesizedExpression: - case ts.SyntaxKind.SpreadAssignment: - case ts.SyntaxKind.ShorthandPropertyAssignment: - case ts.SyntaxKind.PropertyAssignment: - case ts.SyntaxKind.FunctionExpression: - case ts.SyntaxKind.FunctionDeclaration: - case ts.SyntaxKind.LabeledStatement: - case ts.SyntaxKind.ExpressionStatement: - case ts.SyntaxKind.VariableStatement: - case ts.SyntaxKind.Constructor: - case ts.SyntaxKind.MethodDeclaration: - case ts.SyntaxKind.PropertyDeclaration: - case ts.SyntaxKind.GetAccessor: - case ts.SyntaxKind.SetAccessor: - case ts.SyntaxKind.ClassDeclaration: - case ts.SyntaxKind.ClassExpression: - case ts.SyntaxKind.InterfaceDeclaration: - case ts.SyntaxKind.TypeAliasDeclaration: - case ts.SyntaxKind.EnumMember: - case ts.SyntaxKind.EnumDeclaration: - case ts.SyntaxKind.ModuleDeclaration: - case ts.SyntaxKind.ImportEqualsDeclaration: - case ts.SyntaxKind.IndexSignature: - case ts.SyntaxKind.FunctionType: - case ts.SyntaxKind.ConstructorType: - case ts.SyntaxKind.JSDocFunctionType: - case ts.SyntaxKind.EndOfFileToken: - case ts.SyntaxKind.ExportDeclaration: - return true; - default: - return false; - } + +/** + * Checks if `value` is a valid array-like length. + * + * **Note:** This method is loosely based on + * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + * @example + * + * _.isLength(3); + * // => true + * + * _.isLength(Number.MIN_VALUE); + * // => false + * + * _.isLength(Infinity); + * // => false + * + * _.isLength('3'); + * // => false + */ +function isLength(value) { + return typeof value == 'number' && + value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } -exports.canHaveJsDoc = canHaveJsDoc; -function getJsDoc(node, sourceFile) { - if (node.kind === ts.SyntaxKind.EndOfFileToken) - return parseJsDocWorker(node, sourceFile || node.parent); - const result = []; - for (const child of node.getChildren(sourceFile)) { - if (!node_1.isJsDoc(child)) - break; - result.push(child); - } - return result; + +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); } -exports.getJsDoc = getJsDoc; -function parseJsDocOfNode(node, considerTrailingComments, sourceFile = node.getSourceFile()) { - if (canHaveJsDoc(node) && node.kind !== ts.SyntaxKind.EndOfFileToken) { - const result = getJsDoc(node, sourceFile); - if (result.length !== 0 || !considerTrailingComments) - return result; - } - return parseJsDocWorker(node, sourceFile, considerTrailingComments); + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; } -exports.parseJsDocOfNode = parseJsDocOfNode; -function parseJsDocWorker(node, sourceFile, considerTrailingComments) { - const nodeStart = node.getStart(sourceFile); - const start = ts[considerTrailingComments && isSameLine(sourceFile, node.pos, nodeStart) - ? 'forEachTrailingCommentRange' - : 'forEachLeadingCommentRange'](sourceFile.text, node.pos, (pos, _end, kind) => kind === ts.SyntaxKind.MultiLineCommentTrivia && sourceFile.text[pos + 2] === '*' ? { pos } : undefined); - if (start === undefined) - return []; - const startPos = start.pos; - const text = sourceFile.text.slice(startPos, nodeStart); - const newSourceFile = ts.createSourceFile('jsdoc.ts', `${text}var a;`, sourceFile.languageVersion); - const result = getJsDoc(newSourceFile.statements[0], newSourceFile); - for (const doc of result) - updateNode(doc, node); - return result; - function updateNode(n, parent) { - n.pos += startPos; - n.end += startPos; - n.parent = parent; - return ts.forEachChild(n, (child) => updateNode(child, n), (children) => { - children.pos += startPos; - children.end += startPos; - for (const child of children) - updateNode(child, n); - }); - } + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); } -var ImportKind; -(function (ImportKind) { - ImportKind[ImportKind["ImportDeclaration"] = 1] = "ImportDeclaration"; - ImportKind[ImportKind["ImportEquals"] = 2] = "ImportEquals"; - ImportKind[ImportKind["ExportFrom"] = 4] = "ExportFrom"; - ImportKind[ImportKind["DynamicImport"] = 8] = "DynamicImport"; - ImportKind[ImportKind["Require"] = 16] = "Require"; - ImportKind[ImportKind["ImportType"] = 32] = "ImportType"; - ImportKind[ImportKind["All"] = 63] = "All"; - ImportKind[ImportKind["AllImports"] = 59] = "AllImports"; - ImportKind[ImportKind["AllStaticImports"] = 3] = "AllStaticImports"; - ImportKind[ImportKind["AllImportExpressions"] = 24] = "AllImportExpressions"; - ImportKind[ImportKind["AllRequireLike"] = 18] = "AllRequireLike"; - ImportKind[ImportKind["AllNestedImports"] = 56] = "AllNestedImports"; - ImportKind[ImportKind["AllTopLevelImports"] = 7] = "AllTopLevelImports"; -})(ImportKind = exports.ImportKind || (exports.ImportKind = {})); -function findImports(sourceFile, kinds) { - const result = []; - for (const node of findImportLikeNodes(sourceFile, kinds)) { - switch (node.kind) { - case ts.SyntaxKind.ImportDeclaration: - addIfTextualLiteral(node.moduleSpecifier); - break; - case ts.SyntaxKind.ImportEqualsDeclaration: - addIfTextualLiteral(node.moduleReference.expression); - break; - case ts.SyntaxKind.ExportDeclaration: - addIfTextualLiteral(node.moduleSpecifier); - break; - case ts.SyntaxKind.CallExpression: - addIfTextualLiteral(node.arguments[0]); - break; - case ts.SyntaxKind.ImportType: - if (node_1.isLiteralTypeNode(node.argument)) - addIfTextualLiteral(node.argument.literal); - break; - default: - throw new Error('unexpected node'); - } - } - return result; - function addIfTextualLiteral(node) { - if (node_1.isTextualLiteral(node)) - result.push(node); - } + +/** + * Checks if `value` is classified as a typed array. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. + * @example + * + * _.isTypedArray(new Uint8Array); + * // => true + * + * _.isTypedArray([]); + * // => false + */ +var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); } -exports.findImports = findImports; -function findImportLikeNodes(sourceFile, kinds) { - return new ImportFinder(sourceFile, kinds).find(); + +/** + * Gets the value at `path` of `object`. If the resolved value is + * `undefined`, the `defaultValue` is returned in its place. + * + * @static + * @memberOf _ + * @since 3.7.0 + * @category Object + * @param {Object} object The object to query. + * @param {Array|string} path The path of the property to get. + * @param {*} [defaultValue] The value returned for `undefined` resolved values. + * @returns {*} Returns the resolved value. + * @example + * + * var object = { 'a': [{ 'b': { 'c': 3 } }] }; + * + * _.get(object, 'a[0].b.c'); + * // => 3 + * + * _.get(object, ['a', '0', 'b', 'c']); + * // => 3 + * + * _.get(object, 'a.b.c', 'default'); + * // => 'default' + */ +function get(object, path, defaultValue) { + var result = object == null ? undefined : baseGet(object, path); + return result === undefined ? defaultValue : result; } -exports.findImportLikeNodes = findImportLikeNodes; -class ImportFinder { - constructor(_sourceFile, _options) { - this._sourceFile = _sourceFile; - this._options = _options; - this._result = []; - } - find() { - if (this._sourceFile.isDeclarationFile) - this._options &= ~24; - if (this._options & 7) - this._findImports(this._sourceFile.statements); - if (this._options & 56) - this._findNestedImports(); - return this._result; - } - _findImports(statements) { - for (const statement of statements) { - if (node_1.isImportDeclaration(statement)) { - if (this._options & 1) - this._result.push(statement); - } - else if (node_1.isImportEqualsDeclaration(statement)) { - if (this._options & 2 && - statement.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) - this._result.push(statement); - } - else if (node_1.isExportDeclaration(statement)) { - if (statement.moduleSpecifier !== undefined && this._options & 4) - this._result.push(statement); - } - else if (node_1.isModuleDeclaration(statement)) { - this._findImportsInModule(statement); - } - } - } - _findImportsInModule(declaration) { - if (declaration.body === undefined) - return; - if (declaration.body.kind === ts.SyntaxKind.ModuleDeclaration) - return this._findImportsInModule(declaration.body); - this._findImports(declaration.body.statements); - } - _findNestedImports() { - let re; - if ((this._options & 56) === 16) { - re = /\brequire\s*[ true + * + * _.hasIn(object, 'a.b'); + * // => true + * + * _.hasIn(object, ['a', 'b']); + * // => true + * + * _.hasIn(object, 'b'); + * // => false + */ +function hasIn(object, path) { + return object != null && hasPath(object, path, baseHasIn); } -function isStatementInAmbientContext(node) { - while (node.flags & ts.NodeFlags.NestedNamespace) - node = node.parent; - return hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword) || isAmbientModuleBlock(node.parent); + +/** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) + * for more details. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ +function keys(object) { + return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } -exports.isStatementInAmbientContext = isStatementInAmbientContext; -function isAmbientModuleBlock(node) { - while (node.kind === ts.SyntaxKind.ModuleBlock) { - do - node = node.parent; - while (node.flags & ts.NodeFlags.NestedNamespace); - if (hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) - return true; - node = node.parent; + +/** + * An alternative to `_.reduce`; this method transforms `object` to a new + * `accumulator` object which is the result of running each of its own + * enumerable string keyed properties thru `iteratee`, with each invocation + * potentially mutating the `accumulator` object. If `accumulator` is not + * provided, a new object with the same `[[Prototype]]` will be used. The + * iteratee is invoked with four arguments: (accumulator, value, key, object). + * Iteratee functions may exit iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @since 1.3.0 + * @category Object + * @param {Object} object The object to iterate over. + * @param {Function} [iteratee=_.identity] The function invoked per iteration. + * @param {*} [accumulator] The custom accumulator value. + * @returns {*} Returns the accumulated value. + * @example + * + * _.transform([2, 3, 4], function(result, n) { + * result.push(n *= n); + * return n % 2 == 0; + * }, []); + * // => [4, 9] + * + * _.transform({ 'a': 1, 'b': 2, 'c': 1 }, function(result, value, key) { + * (result[value] || (result[value] = [])).push(key); + * }, {}); + * // => { '1': ['a', 'c'], '2': ['b'] } + */ +function transform(object, iteratee, accumulator) { + var isArr = isArray(object) || isTypedArray(object); + iteratee = baseIteratee(iteratee, 4); + + if (accumulator == null) { + if (isArr || isObject(object)) { + var Ctor = object.constructor; + if (isArr) { + accumulator = isArray(object) ? new Ctor : []; + } else { + accumulator = isFunction(Ctor) ? baseCreate(getPrototype(object)) : {}; + } + } else { + accumulator = {}; } - return false; + } + (isArr ? arrayEach : baseForOwn)(object, function(value, index, object) { + return iteratee(accumulator, value, index, object); + }); + return accumulator; } -exports.isAmbientModuleBlock = isAmbientModuleBlock; -function getIIFE(func) { - let node = func.parent; - while (node.kind === ts.SyntaxKind.ParenthesizedExpression) - node = node.parent; - return node_1.isCallExpression(node) && func.end <= node.expression.end ? node : undefined; + +/** + * This method returns the first argument it receives. + * + * @static + * @since 0.1.0 + * @memberOf _ + * @category Util + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'a': 1 }; + * + * console.log(_.identity(object) === object); + * // => true + */ +function identity(value) { + return value; } -exports.getIIFE = getIIFE; -function isStrictCompilerOptionEnabled(options, option) { - return (options.strict ? options[option] !== false : options[option] === true) && - (option !== 'strictPropertyInitialization' || isStrictCompilerOptionEnabled(options, 'strictNullChecks')); + +/** + * Creates a function that returns the value at `path` of a given object. + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Util + * @param {Array|string} path The path of the property to get. + * @returns {Function} Returns the new accessor function. + * @example + * + * var objects = [ + * { 'a': { 'b': 2 } }, + * { 'a': { 'b': 1 } } + * ]; + * + * _.map(objects, _.property('a.b')); + * // => [2, 1] + * + * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b'); + * // => [1, 2] + */ +function property(path) { + return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } -exports.isStrictCompilerOptionEnabled = isStrictCompilerOptionEnabled; -function isCompilerOptionEnabled(options, option) { - switch (option) { - case 'stripInternal': - return options.stripInternal === true && isCompilerOptionEnabled(options, 'declaration'); - case 'declaration': - return options.declaration || isCompilerOptionEnabled(options, 'composite'); - case 'incremental': - return options.incremental === undefined ? isCompilerOptionEnabled(options, 'composite') : options.incremental; - case 'skipDefaultLibCheck': - return options.skipDefaultLibCheck || isCompilerOptionEnabled(options, 'skipLibCheck'); - case 'suppressImplicitAnyIndexErrors': - return options.suppressImplicitAnyIndexErrors === true && isCompilerOptionEnabled(options, 'noImplicitAny'); - case 'allowSyntheticDefaultImports': - return options.allowSyntheticDefaultImports !== undefined - ? options.allowSyntheticDefaultImports - : isCompilerOptionEnabled(options, 'esModuleInterop') || options.module === ts.ModuleKind.System; - case 'noImplicitAny': - case 'noImplicitThis': - case 'strictNullChecks': - case 'strictFunctionTypes': - case 'strictPropertyInitialization': - case 'alwaysStrict': - case 'strictBindCallApply': - return isStrictCompilerOptionEnabled(options, option); + +module.exports = transform; + + +/***/ }), +/* 705 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SectionHeader = __webpack_require__(392); + +/** + * The string table is used to store section and symbol names. In the ELF image, it consists + * of a sequence of null-terminated ASCII strings. + */ +class StringTable { + constructor(arg) { + if (typeof arg === 'object') { + // from StringTable.parse() + Object.assign(this, arg); + return; } - return options[option] === true; + + this.strings = ''; + this.section_header = new SectionHeader({ + name: arg, + type: 'strtab', + flags: '', + addr: 0, + offset: null, + size: null, + link: 0, + info: 0, + addralign: 1, + entsize: 0, + }); + } + + static parse({ header, data }) { + return new StringTable({ + section_header: header, + strings: data.toString(StringTable.ENCODING), + }); + } + + add_string(str) { + return this.getStringOffset(str, true); + } + + /** + * Returns the offset into the table of the specified string + * @param {string} str string to locate + * @param {boolean} [add] optional - automatically add the string if it's not in the table + */ + getStringOffset(str, add = false) { + // strings are a concatenated list of null-terminated values + const str0 = str + '\0'; + let offset = this.strings.indexOf(str0); + if (offset < 0) { + if (!add) { + throw new Error(`String '${str}' not found in string table`); + } + offset = this.strings.length; + this.strings += str0; + } + return offset; + } + + // retrieve the string from the table at the given offset + getString(offset) { + if (offset < 0 || offset >= this.strings.length) + throw new RangeError(`Offset out of range of string table. Offset=${offset}, Table length=${this.strings.length}`); + const s = this.strings.slice(offset, this.strings.indexOf('\0', offset)); + return s; + } + + calculate_size(elf_offset) { + this.elf_offset = this.section_header.offset = elf_offset; + // ELF only allows ascii chars, so bytes = length + this.elf_size = this.section_header.size = this.strings.length; + return this.elf_size; + } + + write(stream) { + stream.writeBuf(Buffer.from(this.strings, StringTable.ENCODING)); + } +} + +StringTable.ENCODING = 'ascii'; + +module.exports = StringTable; + + +/***/ }), +/* 706 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +/** + * JSON Format Plugin + * + * @module plugins/json + * @license [MIT]{@link https://github.com/archiverjs/node-archiver/blob/master/LICENSE} + * @copyright (c) 2012-2014 Chris Talkington, contributors. + */ +var inherits = __webpack_require__(669).inherits; +var Transform = __webpack_require__(574).Transform; + +var crc32 = __webpack_require__(538); +var util = __webpack_require__(108); + +/** + * @constructor + * @param {(JsonOptions|TransformOptions)} options + */ +var Json = function(options) { + if (!(this instanceof Json)) { + return new Json(options); + } + + options = this.options = util.defaults(options, {}); + + Transform.call(this, options); + + this.supports = { + directory: true, + symlink: true + }; + + this.files = []; +}; + +inherits(Json, Transform); + +/** + * [_transform description] + * + * @private + * @param {Buffer} chunk + * @param {String} encoding + * @param {Function} callback + * @return void + */ +Json.prototype._transform = function(chunk, encoding, callback) { + callback(null, chunk); +}; + +/** + * [_writeStringified description] + * + * @private + * @return void + */ +Json.prototype._writeStringified = function() { + var fileString = JSON.stringify(this.files); + this.write(fileString); +}; + +/** + * [append description] + * + * @param {(Buffer|Stream)} source + * @param {EntryData} data + * @param {Function} callback + * @return void + */ +Json.prototype.append = function(source, data, callback) { + var self = this; + + data.crc32 = 0; + + function onend(err, sourceBuffer) { + if (err) { + callback(err); + return; + } + + data.size = sourceBuffer.length || 0; + data.crc32 = crc32.unsigned(sourceBuffer); + + self.files.push(data); + + callback(null, data); + } + + if (data.sourceType === 'buffer') { + onend(null, source); + } else if (data.sourceType === 'stream') { + util.collectStream(source, onend); + } +}; + +/** + * [finalize description] + * + * @return void + */ +Json.prototype.finalize = function() { + this._writeStringified(); + this.end(); +}; + +module.exports = Json; + +/** + * @typedef {Object} JsonOptions + * @global + */ + + +/***/ }), +/* 707 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; + + +module.exports = __webpack_require__(651).default; + + +/***/ }), +/* 708 */, +/* 709 */, +/* 710 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _buffer = __webpack_require__(407); + +var _create_buffer = __webpack_require__(346); + +var _create_buffer2 = _interopRequireDefault(_create_buffer); + +var _define_crc = __webpack_require__(200); + +var _define_crc2 = _interopRequireDefault(_define_crc); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// Generated by `./pycrc.py --algorithm=table-driven --model=kermit --generate=c` +// prettier-ignore +var TABLE = [0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf, 0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7, 0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e, 0x9cc9, 0x8d40, 0xbfdb, 0xae52, 0xdaed, 0xcb64, 0xf9ff, 0xe876, 0x2102, 0x308b, 0x0210, 0x1399, 0x6726, 0x76af, 0x4434, 0x55bd, 0xad4a, 0xbcc3, 0x8e58, 0x9fd1, 0xeb6e, 0xfae7, 0xc87c, 0xd9f5, 0x3183, 0x200a, 0x1291, 0x0318, 0x77a7, 0x662e, 0x54b5, 0x453c, 0xbdcb, 0xac42, 0x9ed9, 0x8f50, 0xfbef, 0xea66, 0xd8fd, 0xc974, 0x4204, 0x538d, 0x6116, 0x709f, 0x0420, 0x15a9, 0x2732, 0x36bb, 0xce4c, 0xdfc5, 0xed5e, 0xfcd7, 0x8868, 0x99e1, 0xab7a, 0xbaf3, 0x5285, 0x430c, 0x7197, 0x601e, 0x14a1, 0x0528, 0x37b3, 0x263a, 0xdecd, 0xcf44, 0xfddf, 0xec56, 0x98e9, 0x8960, 0xbbfb, 0xaa72, 0x6306, 0x728f, 0x4014, 0x519d, 0x2522, 0x34ab, 0x0630, 0x17b9, 0xef4e, 0xfec7, 0xcc5c, 0xddd5, 0xa96a, 0xb8e3, 0x8a78, 0x9bf1, 0x7387, 0x620e, 0x5095, 0x411c, 0x35a3, 0x242a, 0x16b1, 0x0738, 0xffcf, 0xee46, 0xdcdd, 0xcd54, 0xb9eb, 0xa862, 0x9af9, 0x8b70, 0x8408, 0x9581, 0xa71a, 0xb693, 0xc22c, 0xd3a5, 0xe13e, 0xf0b7, 0x0840, 0x19c9, 0x2b52, 0x3adb, 0x4e64, 0x5fed, 0x6d76, 0x7cff, 0x9489, 0x8500, 0xb79b, 0xa612, 0xd2ad, 0xc324, 0xf1bf, 0xe036, 0x18c1, 0x0948, 0x3bd3, 0x2a5a, 0x5ee5, 0x4f6c, 0x7df7, 0x6c7e, 0xa50a, 0xb483, 0x8618, 0x9791, 0xe32e, 0xf2a7, 0xc03c, 0xd1b5, 0x2942, 0x38cb, 0x0a50, 0x1bd9, 0x6f66, 0x7eef, 0x4c74, 0x5dfd, 0xb58b, 0xa402, 0x9699, 0x8710, 0xf3af, 0xe226, 0xd0bd, 0xc134, 0x39c3, 0x284a, 0x1ad1, 0x0b58, 0x7fe7, 0x6e6e, 0x5cf5, 0x4d7c, 0xc60c, 0xd785, 0xe51e, 0xf497, 0x8028, 0x91a1, 0xa33a, 0xb2b3, 0x4a44, 0x5bcd, 0x6956, 0x78df, 0x0c60, 0x1de9, 0x2f72, 0x3efb, 0xd68d, 0xc704, 0xf59f, 0xe416, 0x90a9, 0x8120, 0xb3bb, 0xa232, 0x5ac5, 0x4b4c, 0x79d7, 0x685e, 0x1ce1, 0x0d68, 0x3ff3, 0x2e7a, 0xe70e, 0xf687, 0xc41c, 0xd595, 0xa12a, 0xb0a3, 0x8238, 0x93b1, 0x6b46, 0x7acf, 0x4854, 0x59dd, 0x2d62, 0x3ceb, 0x0e70, 0x1ff9, 0xf78f, 0xe606, 0xd49d, 0xc514, 0xb1ab, 0xa022, 0x92b9, 0x8330, 0x7bc7, 0x6a4e, 0x58d5, 0x495c, 0x3de3, 0x2c6a, 0x1ef1, 0x0f78]; + +if (typeof Int32Array !== 'undefined') TABLE = new Int32Array(TABLE); + +var crc16kermit = (0, _define_crc2.default)('kermit', function (buf, previous) { + if (!_buffer.Buffer.isBuffer(buf)) buf = (0, _create_buffer2.default)(buf); + + var crc = typeof previous !== 'undefined' ? ~~previous : 0x0000; + + for (var index = 0; index < buf.length; index++) { + var byte = buf[index]; + crc = (TABLE[(crc ^ byte) & 0xff] ^ crc >> 8) & 0xffff; + } + + return crc; +}); + +exports.default = crc16kermit; + + +/***/ }), +/* 711 */, +/* 712 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; + +var Duplex = __webpack_require__(361); + +/**/ +var util = Object.create(__webpack_require__(286)); +util.inherits = __webpack_require__(689); +/**/ + +util.inherits(Transform, Duplex); + +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) { + return this.emit('error', new Error('write callback called multiple times')); + } + + ts.writechunk = null; + ts.writecb = null; + + if (data != null) // single equals check for both `null` and `undefined` + this.push(data); + + cb(er); + + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } } -exports.isCompilerOptionEnabled = isCompilerOptionEnabled; -function isAmbientModule(node) { - return node.name.kind === ts.SyntaxKind.StringLiteral || (node.flags & ts.NodeFlags.GlobalAugmentation) !== 0; + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); } -exports.isAmbientModule = isAmbientModule; -function getCheckJsDirective(source) { - let directive; - ts.forEachLeadingCommentRange(source, (ts.getShebang(source) || '').length, (pos, end, kind) => { - if (kind === ts.SyntaxKind.SingleLineCommentTrivia) { - const text = source.slice(pos, end); - const match = /^\/{2,3}\s*@ts-(no)?check(?:\s|$)/i.exec(text); - if (match !== null) - directive = { pos, end, enabled: match[1] === undefined }; - } + +function prefinish() { + var _this = this; + + if (typeof this._flush === 'function') { + this._flush(function (er, data) { + done(_this, er, data); }); - return directive; -} -exports.getCheckJsDirective = getCheckJsDirective; -function isConstAssertion(node) { - return node_1.isTypeReferenceNode(node.type) && - node.type.typeName.kind === ts.SyntaxKind.Identifier && - node.type.typeName.escapedText === 'const'; -} -exports.isConstAssertion = isConstAssertion; -function isInConstContext(node) { - let current = node; - while (true) { - const parent = current.parent; - outer: switch (parent.kind) { - case ts.SyntaxKind.TypeAssertionExpression: - case ts.SyntaxKind.AsExpression: - return isConstAssertion(parent); - case ts.SyntaxKind.PrefixUnaryExpression: - if (current.kind !== ts.SyntaxKind.NumericLiteral) - return false; - switch (parent.operator) { - case ts.SyntaxKind.PlusToken: - case ts.SyntaxKind.MinusToken: - current = parent; - break outer; - default: - return false; - } - case ts.SyntaxKind.PropertyAssignment: - if (parent.initializer !== current) - return false; - current = parent.parent; - break; - case ts.SyntaxKind.ShorthandPropertyAssignment: - current = parent.parent; - break; - case ts.SyntaxKind.ParenthesizedExpression: - case ts.SyntaxKind.ArrayLiteralExpression: - case ts.SyntaxKind.ObjectLiteralExpression: - current = parent; - break; - default: - return false; - } - } -} -exports.isInConstContext = isInConstContext; -function isReadonlyAssignmentDeclaration(node, checker) { - if (!isBindableObjectDefinePropertyCall(node)) - return false; - const descriptorType = checker.getTypeAtLocation(node.arguments[2]); - if (descriptorType.getProperty('value') === undefined) - return descriptorType.getProperty('set') === undefined; - const writableProp = descriptorType.getProperty('writable'); - if (writableProp === undefined) - return false; - const writableType = writableProp.valueDeclaration !== undefined && node_1.isPropertyAssignment(writableProp.valueDeclaration) - ? checker.getTypeAtLocation(writableProp.valueDeclaration.initializer) - : checker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]); - return type_1.isBooleanLiteralType(writableType, false); -} -exports.isReadonlyAssignmentDeclaration = isReadonlyAssignmentDeclaration; -function isBindableObjectDefinePropertyCall(node) { - return node.arguments.length === 3 && - node_1.isEntityNameExpression(node.arguments[0]) && - node_1.isNumericOrStringLikeLiteral(node.arguments[1]) && - node_1.isPropertyAccessExpression(node.expression) && - node.expression.name.escapedText === 'defineProperty' && - node_1.isIdentifier(node.expression.expression) && - node.expression.expression.escapedText === 'Object'; -} -exports.isBindableObjectDefinePropertyCall = isBindableObjectDefinePropertyCall; -function isWellKnownSymbolLiterally(node) { - return ts.isPropertyAccessExpression(node) && - ts.isIdentifier(node.expression) && - node.expression.escapedText === 'Symbol'; -} -exports.isWellKnownSymbolLiterally = isWellKnownSymbolLiterally; -function getPropertyNameOfWellKnownSymbol(node) { - return { - displayName: `[Symbol.${node.name.text}]`, - symbolName: ('__@' + node.name.text), - }; -} -exports.getPropertyNameOfWellKnownSymbol = getPropertyNameOfWellKnownSymbol; -function getLateBoundPropertyNames(node, checker) { - const result = { - known: true, - names: [], - }; - node = unwrapParentheses(node); - if (isWellKnownSymbolLiterally(node)) { - result.names.push(getPropertyNameOfWellKnownSymbol(node)); - } - else { - const type = checker.getTypeAtLocation(node); - for (const key of type_1.unionTypeParts(checker.getBaseConstraintOfType(type) || type)) { - const propertyName = type_1.getPropertyNameFromType(key); - if (propertyName) { - result.names.push(propertyName); - } - else { - result.known = false; - } - } - } - return result; -} -exports.getLateBoundPropertyNames = getLateBoundPropertyNames; -function getLateBoundPropertyNamesOfPropertyName(node, checker) { - const staticName = getPropertyName(node); - return staticName !== undefined - ? { known: true, names: [{ displayName: staticName, symbolName: ts.escapeLeadingUnderscores(staticName) }] } - : getLateBoundPropertyNames(node.expression, checker); -} -exports.getLateBoundPropertyNamesOfPropertyName = getLateBoundPropertyNamesOfPropertyName; -function getSingleLateBoundPropertyNameOfPropertyName(node, checker) { - const staticName = getPropertyName(node); - if (staticName !== undefined) - return { displayName: staticName, symbolName: ts.escapeLeadingUnderscores(staticName) }; - const { expression } = node; - return isWellKnownSymbolLiterally(expression) - ? getPropertyNameOfWellKnownSymbol(expression) - : type_1.getPropertyNameFromType(checker.getTypeAtLocation(expression)); -} -exports.getSingleLateBoundPropertyNameOfPropertyName = getSingleLateBoundPropertyNameOfPropertyName; -function unwrapParentheses(node) { - while (node.kind === ts.SyntaxKind.ParenthesizedExpression) - node = node.expression; - return node; + } else { + done(this, null, null); + } } -exports.unwrapParentheses = unwrapParentheses; +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +Transform.prototype._destroy = function (err, cb) { + var _this2 = this; + + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + _this2.emit('close'); + }); +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + + if (data != null) // single equals check for both `null` and `undefined` + stream.push(data); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new Error('Calling transform done when ws.length != 0'); + + if (stream._transformState.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} /***/ }), +/* 713 */, /* 714 */, /* 715 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -100826,63 +99511,7 @@ exports.SourceMapGenerator = SourceMapGenerator; /* 716 */, /* 717 */, /* 718 */, -/* 719 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SemVer = __webpack_require__(369) -const parse = __webpack_require__(658) -const {re, t} = __webpack_require__(590) - -const coerce = (version, options) => { - if (version instanceof SemVer) { - return version - } - - if (typeof version === 'number') { - version = String(version) - } - - if (typeof version !== 'string') { - return null - } - - options = options || {} - - let match = null - if (!options.rtl) { - match = version.match(re[t.COERCE]) - } else { - // Find the right-most coercible string that does not share - // a terminus with a more left-ward coercible string. - // Eg, '1.2.3.4' wants to coerce '2.3.4', not '3.4' or '4' - // - // Walk through the string checking with a /g regexp - // Manually set the index so as to pick up overlapping matches. - // Stop when we get a match that ends at the string end, since no - // coercible string can be more right-ward without the same terminus. - let next - while ((next = re[t.COERCERTL].exec(version)) && - (!match || match.index + match[0].length !== version.length) - ) { - if (!match || - next.index + next[0].length !== match.index + match[0].length) { - match = next - } - re[t.COERCERTL].lastIndex = next.index + next[1].length + next[2].length - } - // leave it in a clean state - re[t.COERCERTL].lastIndex = -1 - } - - if (match === null) - return null - - return parse(`${match[2]}.${match[3] || '0'}.${match[4] || '0'}`, options) -} -module.exports = coerce - - -/***/ }), +/* 719 */, /* 720 */ /***/ (function(module) { @@ -101296,7 +99925,151 @@ module.exports = function flatten(list, depth) { /***/ }), -/* 731 */, +/* 731 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const ANY = Symbol('SemVer ANY') +// hoisted class for cyclic dependency +class Comparator { + static get ANY () { + return ANY + } + constructor (comp, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (comp instanceof Comparator) { + if (comp.loose === !!options.loose) { + return comp + } else { + comp = comp.value + } + } + + debug('comparator', comp, options) + this.options = options + this.loose = !!options.loose + this.parse(comp) + + if (this.semver === ANY) { + this.value = '' + } else { + this.value = this.operator + this.semver.version + } + + debug('comp', this) + } + + parse (comp) { + const r = this.options.loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] + const m = comp.match(r) + + if (!m) { + throw new TypeError(`Invalid comparator: ${comp}`) + } + + this.operator = m[1] !== undefined ? m[1] : '' + if (this.operator === '=') { + this.operator = '' + } + + // if it literally is just '>' or '' then allow anything. + if (!m[2]) { + this.semver = ANY + } else { + this.semver = new SemVer(m[2], this.options.loose) + } + } + + toString () { + return this.value + } + + test (version) { + debug('Comparator.test', version, this.options.loose) + + if (this.semver === ANY || version === ANY) { + return true + } + + if (typeof version === 'string') { + try { + version = new SemVer(version, this.options) + } catch (er) { + return false + } + } + + return cmp(version, this.operator, this.semver, this.options) + } + + intersects (comp, options) { + if (!(comp instanceof Comparator)) { + throw new TypeError('a Comparator is required') + } + + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + + if (this.operator === '') { + if (this.value === '') { + return true + } + return new Range(comp.value, options).test(this.value) + } else if (comp.operator === '') { + if (comp.value === '') { + return true + } + return new Range(this.value, options).test(comp.semver) + } + + const sameDirectionIncreasing = + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '>=' || comp.operator === '>') + const sameDirectionDecreasing = + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '<=' || comp.operator === '<') + const sameSemVer = this.semver.version === comp.semver.version + const differentDirectionsInclusive = + (this.operator === '>=' || this.operator === '<=') && + (comp.operator === '>=' || comp.operator === '<=') + const oppositeDirectionsLessThan = + cmp(this.semver, '<', comp.semver, options) && + (this.operator === '>=' || this.operator === '>') && + (comp.operator === '<=' || comp.operator === '<') + const oppositeDirectionsGreaterThan = + cmp(this.semver, '>', comp.semver, options) && + (this.operator === '<=' || this.operator === '<') && + (comp.operator === '>=' || comp.operator === '>') + + return ( + sameDirectionIncreasing || + sameDirectionDecreasing || + (sameSemVer && differentDirectionsInclusive) || + oppositeDirectionsLessThan || + oppositeDirectionsGreaterThan + ) + } +} + +module.exports = Comparator + +const {re, t} = __webpack_require__(408) +const cmp = __webpack_require__(447) +const debug = __webpack_require__(547) +const SemVer = __webpack_require__(734) +const Range = __webpack_require__(33) + + +/***/ }), /* 732 */ /***/ (function(module) { @@ -101323,274 +100096,300 @@ module.exports = TokenizeError; /***/ }), -/* 733 */ -/***/ (function(module) { - -"use strict"; +/* 733 */, +/* 734 */ +/***/ (function(module, __unusedexports, __webpack_require__) { +const debug = __webpack_require__(547) +const { MAX_LENGTH, MAX_SAFE_INTEGER } = __webpack_require__(699) +const { re, t } = __webpack_require__(408) -var has = Object.prototype.hasOwnProperty; -var isArray = Array.isArray; +const { compareIdentifiers } = __webpack_require__(570) +class SemVer { + constructor (version, options) { + if (!options || typeof options !== 'object') { + options = { + loose: !!options, + includePrerelease: false + } + } + if (version instanceof SemVer) { + if (version.loose === !!options.loose && + version.includePrerelease === !!options.includePrerelease) { + return version + } else { + version = version.version + } + } else if (typeof version !== 'string') { + throw new TypeError(`Invalid Version: ${version}`) + } -var hexTable = (function () { - var array = []; - for (var i = 0; i < 256; ++i) { - array.push('%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase()); + if (version.length > MAX_LENGTH) { + throw new TypeError( + `version is longer than ${MAX_LENGTH} characters` + ) } - return array; -}()); + debug('SemVer', version, options) + this.options = options + this.loose = !!options.loose + // this isn't actually relevant for versions, but keep it so that we + // don't run into trouble passing this.options around. + this.includePrerelease = !!options.includePrerelease -var compactQueue = function compactQueue(queue) { - while (queue.length > 1) { - var item = queue.pop(); - var obj = item.obj[item.prop]; + const m = version.trim().match(options.loose ? re[t.LOOSE] : re[t.FULL]) - if (isArray(obj)) { - var compacted = []; + if (!m) { + throw new TypeError(`Invalid Version: ${version}`) + } - for (var j = 0; j < obj.length; ++j) { - if (typeof obj[j] !== 'undefined') { - compacted.push(obj[j]); - } - } + this.raw = version - item.obj[item.prop] = compacted; - } - } -}; + // these are actually numbers + this.major = +m[1] + this.minor = +m[2] + this.patch = +m[3] -var arrayToObject = function arrayToObject(source, options) { - var obj = options && options.plainObjects ? Object.create(null) : {}; - for (var i = 0; i < source.length; ++i) { - if (typeof source[i] !== 'undefined') { - obj[i] = source[i]; - } + if (this.major > MAX_SAFE_INTEGER || this.major < 0) { + throw new TypeError('Invalid major version') } - return obj; -}; + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) { + throw new TypeError('Invalid minor version') + } -var merge = function merge(target, source, options) { - /* eslint no-param-reassign: 0 */ - if (!source) { - return target; + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) { + throw new TypeError('Invalid patch version') } - if (typeof source !== 'object') { - if (isArray(target)) { - target.push(source); - } else if (target && typeof target === 'object') { - if ((options && (options.plainObjects || options.allowPrototypes)) || !has.call(Object.prototype, source)) { - target[source] = true; - } - } else { - return [target, source]; + // numberify any prerelease numeric ids + if (!m[4]) { + this.prerelease = [] + } else { + this.prerelease = m[4].split('.').map((id) => { + if (/^[0-9]+$/.test(id)) { + const num = +id + if (num >= 0 && num < MAX_SAFE_INTEGER) { + return num + } } - - return target; + return id + }) } - if (!target || typeof target !== 'object') { - return [target].concat(source); + this.build = m[5] ? m[5].split('.') : [] + this.format() + } + + format () { + this.version = `${this.major}.${this.minor}.${this.patch}` + if (this.prerelease.length) { + this.version += `-${this.prerelease.join('.')}` } + return this.version + } - var mergeTarget = target; - if (isArray(target) && !isArray(source)) { - mergeTarget = arrayToObject(target, options); + toString () { + return this.version + } + + compare (other) { + debug('SemVer.compare', this.version, this.options, other) + if (!(other instanceof SemVer)) { + if (typeof other === 'string' && other === this.version) { + return 0 + } + other = new SemVer(other, this.options) } - if (isArray(target) && isArray(source)) { - source.forEach(function (item, i) { - if (has.call(target, i)) { - var targetItem = target[i]; - if (targetItem && typeof targetItem === 'object' && item && typeof item === 'object') { - target[i] = merge(targetItem, item, options); - } else { - target.push(item); - } - } else { - target[i] = item; - } - }); - return target; + if (other.version === this.version) { + return 0 } - return Object.keys(source).reduce(function (acc, key) { - var value = source[key]; + return this.compareMain(other) || this.comparePre(other) + } - if (has.call(acc, key)) { - acc[key] = merge(acc[key], value, options); - } else { - acc[key] = value; - } - return acc; - }, mergeTarget); -}; + compareMain (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) + } -var assign = function assignSingleSource(target, source) { - return Object.keys(source).reduce(function (acc, key) { - acc[key] = source[key]; - return acc; - }, target); -}; + return ( + compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch) + ) + } -var decode = function (str, decoder, charset) { - var strWithoutPlus = str.replace(/\+/g, ' '); - if (charset === 'iso-8859-1') { - // unescape never throws, no try...catch needed: - return strWithoutPlus.replace(/%[0-9a-f]{2}/gi, unescape); - } - // utf-8 - try { - return decodeURIComponent(strWithoutPlus); - } catch (e) { - return strWithoutPlus; + comparePre (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) } -}; -var encode = function encode(str, defaultEncoder, charset) { - // This code was originally written by Brian White (mscdex) for the io.js core querystring library. - // It has been adapted here for stricter adherence to RFC 3986 - if (str.length === 0) { - return str; + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) { + return -1 + } else if (!this.prerelease.length && other.prerelease.length) { + return 1 + } else if (!this.prerelease.length && !other.prerelease.length) { + return 0 } - var string = str; - if (typeof str === 'symbol') { - string = Symbol.prototype.toString.call(str); - } else if (typeof str !== 'string') { - string = String(str); - } + let i = 0 + do { + const a = this.prerelease[i] + const b = other.prerelease[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } - if (charset === 'iso-8859-1') { - return escape(string).replace(/%u[0-9a-f]{4}/gi, function ($0) { - return '%26%23' + parseInt($0.slice(2), 16) + '%3B'; - }); + compareBuild (other) { + if (!(other instanceof SemVer)) { + other = new SemVer(other, this.options) } - var out = ''; - for (var i = 0; i < string.length; ++i) { - var c = string.charCodeAt(i); + let i = 0 + do { + const a = this.build[i] + const b = other.build[i] + debug('prerelease compare', i, a, b) + if (a === undefined && b === undefined) { + return 0 + } else if (b === undefined) { + return 1 + } else if (a === undefined) { + return -1 + } else if (a === b) { + continue + } else { + return compareIdentifiers(a, b) + } + } while (++i) + } + + // preminor will bump the version up to the next minor release, and immediately + // down to pre-release. premajor and prepatch work the same way. + inc (release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0 + this.patch = 0 + this.minor = 0 + this.major++ + this.inc('pre', identifier) + break + case 'preminor': + this.prerelease.length = 0 + this.patch = 0 + this.minor++ + this.inc('pre', identifier) + break + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0 + this.inc('patch', identifier) + this.inc('pre', identifier) + break + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) { + this.inc('patch', identifier) + } + this.inc('pre', identifier) + break + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 if ( - c === 0x2D // - - || c === 0x2E // . - || c === 0x5F // _ - || c === 0x7E // ~ - || (c >= 0x30 && c <= 0x39) // 0-9 - || (c >= 0x41 && c <= 0x5A) // a-z - || (c >= 0x61 && c <= 0x7A) // A-Z + this.minor !== 0 || + this.patch !== 0 || + this.prerelease.length === 0 ) { - out += string.charAt(i); - continue; + this.major++ } - - if (c < 0x80) { - out = out + hexTable[c]; - continue; + this.minor = 0 + this.patch = 0 + this.prerelease = [] + break + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) { + this.minor++ } - - if (c < 0x800) { - out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); - continue; + this.patch = 0 + this.prerelease = [] + break + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) { + this.patch++ } - - if (c < 0xD800 || c >= 0xE000) { - out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); - continue; + this.prerelease = [] + break + // This probably shouldn't be used publicly. + // 1.0.0 'pre' would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) { + this.prerelease = [0] + } else { + let i = this.prerelease.length + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++ + i = -2 + } + } + if (i === -1) { + // didn't increment anything + this.prerelease.push(0) + } } - - i += 1; - c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); - out += hexTable[0xF0 | (c >> 18)] - + hexTable[0x80 | ((c >> 12) & 0x3F)] - + hexTable[0x80 | ((c >> 6) & 0x3F)] - + hexTable[0x80 | (c & 0x3F)]; - } - - return out; -}; - -var compact = function compact(value) { - var queue = [{ obj: { o: value }, prop: 'o' }]; - var refs = []; - - for (var i = 0; i < queue.length; ++i) { - var item = queue[i]; - var obj = item.obj[item.prop]; - - var keys = Object.keys(obj); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - var val = obj[key]; - if (typeof val === 'object' && val !== null && refs.indexOf(val) === -1) { - queue.push({ obj: obj, prop: key }); - refs.push(val); + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) { + this.prerelease = [identifier, 0] } + } else { + this.prerelease = [identifier, 0] + } } - } - - compactQueue(queue); - - return value; -}; - -var isRegExp = function isRegExp(obj) { - return Object.prototype.toString.call(obj) === '[object RegExp]'; -}; - -var isBuffer = function isBuffer(obj) { - if (!obj || typeof obj !== 'object') { - return false; - } - - return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); -}; - -var combine = function combine(a, b) { - return [].concat(a, b); -}; + break -var maybeMap = function maybeMap(val, fn) { - if (isArray(val)) { - var mapped = []; - for (var i = 0; i < val.length; i += 1) { - mapped.push(fn(val[i])); - } - return mapped; + default: + throw new Error(`invalid increment argument: ${release}`) } - return fn(val); -}; - -module.exports = { - arrayToObject: arrayToObject, - assign: assign, - combine: combine, - compact: compact, - decode: decode, - encode: encode, - isBuffer: isBuffer, - isRegExp: isRegExp, - maybeMap: maybeMap, - merge: merge -}; - - -/***/ }), -/* 734 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -Object.defineProperty(exports, "__esModule", { value: true }); -const tslib_1 = __webpack_require__(259); -tslib_1.__exportStar(__webpack_require__(581), exports); -const ts = __webpack_require__(752); -function isImportTypeNode(node) { - return node.kind === ts.SyntaxKind.ImportType; + this.format() + this.raw = this.version + return this + } } -exports.isImportTypeNode = isImportTypeNode; + +module.exports = SemVer /***/ }), @@ -102296,7 +101095,7 @@ exports.computeSourceURL = computeSourceURL; /* 738 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(570) +const compare = __webpack_require__(340) const gt = (a, b, loose) => compare(a, b, loose) > 0 module.exports = gt @@ -102644,112 +101443,38 @@ module.exports = require("fs"); /***/ }), /* 748 */, -/* 749 */ -/***/ (function(module) { - -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -const SEMVER_SPEC_VERSION = '2.0.0' - -const MAX_LENGTH = 256 -const MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || - /* istanbul ignore next */ 9007199254740991 - -// Max safe segment length for coercion. -const MAX_SAFE_COMPONENT_LENGTH = 16 - -module.exports = { - SEMVER_SPEC_VERSION, - MAX_LENGTH, - MAX_SAFE_INTEGER, - MAX_SAFE_COMPONENT_LENGTH -} - - -/***/ }), +/* 749 */, /* 750 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const SemVer = __webpack_require__(369) -const Comparator = __webpack_require__(123) -const {ANY} = Comparator -const Range = __webpack_require__(986) -const satisfies = __webpack_require__(121) -const gt = __webpack_require__(136) -const lt = __webpack_require__(342) -const lte = __webpack_require__(495) -const gte = __webpack_require__(618) - -const outside = (version, range, hilo, options) => { - version = new SemVer(version, options) - range = new Range(range, options) - - let gtfn, ltefn, ltfn, comp, ecomp - switch (hilo) { - case '>': - gtfn = gt - ltefn = lte - ltfn = lt - comp = '>' - ecomp = '>=' - break - case '<': - gtfn = lt - ltefn = gte - ltfn = gt - comp = '<' - ecomp = '<=' - break - default: - throw new TypeError('Must provide a hilo val of "<" or ">"') - } - - // If it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. +// Copyright (c) 2012 Mathieu Turcotte +// Licensed under the MIT license. - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] +var util = __webpack_require__(669); - let high = null - let low = null +var BackoffStrategy = __webpack_require__(105); - comparators.forEach((comparator) => { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator - low = low || comparator - if (gtfn(comparator.semver, high.semver, options)) { - high = comparator - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator - } - }) +// Fibonacci backoff strategy. +function FibonacciBackoffStrategy(options) { + BackoffStrategy.call(this, options); + this.backoffDelay_ = 0; + this.nextBackoffDelay_ = this.getInitialDelay(); +} +util.inherits(FibonacciBackoffStrategy, BackoffStrategy); - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false - } +FibonacciBackoffStrategy.prototype.next_ = function() { + var backoffDelay = Math.min(this.nextBackoffDelay_, this.getMaxDelay()); + this.nextBackoffDelay_ += this.backoffDelay_; + this.backoffDelay_ = backoffDelay; + return backoffDelay; +}; - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false - } - } - return true -} +FibonacciBackoffStrategy.prototype.reset_ = function() { + this.nextBackoffDelay_ = this.getInitialDelay(); + this.backoffDelay_ = 0; +}; -module.exports = outside +module.exports = FibonacciBackoffStrategy; /***/ }), @@ -103004,7 +101729,7 @@ var ts; // If changing the text in this section, be sure to test `configurePrerelease` too. ts.versionMajorMinor = "3.9"; /** The version of the TypeScript compiler release */ - ts.version = "3.9.3"; + ts.version = "3.9.5"; /** * Returns the native Map implementation if it is available and compatible (i.e. supports iteration). */ @@ -180179,9 +178904,10 @@ var ts; ClassFacts[ClassFacts["IsNamedExternalExport"] = 16] = "IsNamedExternalExport"; ClassFacts[ClassFacts["IsDefaultExternalExport"] = 32] = "IsDefaultExternalExport"; ClassFacts[ClassFacts["IsDerivedClass"] = 64] = "IsDerivedClass"; + ClassFacts[ClassFacts["UseImmediatelyInvokedFunctionExpression"] = 128] = "UseImmediatelyInvokedFunctionExpression"; ClassFacts[ClassFacts["HasAnyDecorators"] = 6] = "HasAnyDecorators"; ClassFacts[ClassFacts["NeedsName"] = 5] = "NeedsName"; - ClassFacts[ClassFacts["UseImmediatelyInvokedFunctionExpression"] = 7] = "UseImmediatelyInvokedFunctionExpression"; + ClassFacts[ClassFacts["MayNeedImmediatelyInvokedFunctionExpression"] = 7] = "MayNeedImmediatelyInvokedFunctionExpression"; ClassFacts[ClassFacts["IsExported"] = 56] = "IsExported"; })(ClassFacts || (ClassFacts = {})); function transformTypeScript(context) { @@ -180668,6 +179394,8 @@ var ts; facts |= 32 /* IsDefaultExternalExport */; else if (isNamedExternalModuleExport(node)) facts |= 16 /* IsNamedExternalExport */; + if (languageVersion <= 1 /* ES5 */ && (facts & 7 /* MayNeedImmediatelyInvokedFunctionExpression */)) + facts |= 128 /* UseImmediatelyInvokedFunctionExpression */; return facts; } function hasTypeScriptClassSyntax(node) { @@ -180685,7 +179413,7 @@ var ts; } var staticProperties = ts.getProperties(node, /*requireInitializer*/ true, /*isStatic*/ true); var facts = getClassFacts(node, staticProperties); - if (facts & 7 /* UseImmediatelyInvokedFunctionExpression */) { + if (facts & 128 /* UseImmediatelyInvokedFunctionExpression */) { context.startLexicalEnvironment(); } var name = node.name || (facts & 5 /* NeedsName */ ? ts.getGeneratedNameForNode(node) : undefined); @@ -180697,7 +179425,7 @@ var ts; addClassElementDecorationStatements(statements, node, /*isStatic*/ false); addClassElementDecorationStatements(statements, node, /*isStatic*/ true); addConstructorDecorationStatement(statements, node); - if (facts & 7 /* UseImmediatelyInvokedFunctionExpression */) { + if (facts & 128 /* UseImmediatelyInvokedFunctionExpression */) { // When we emit a TypeScript class down to ES5, we must wrap it in an IIFE so that the // 'es2015' transformer can properly nest static initializers and decorators. The result // looks something like: @@ -180723,16 +179451,11 @@ var ts; ts.insertStatementsAfterStandardPrologue(statements, context.endLexicalEnvironment()); var iife = ts.createImmediatelyInvokedArrowFunction(statements); ts.setEmitFlags(iife, 33554432 /* TypeScriptClassWrapper */); - // Class comment is already added by the ES2015 transform when targeting ES5 or below. - // Only add if targetting ES2015+ to prevent duplicates - if (languageVersion > 1 /* ES5 */) { - ts.addSyntheticLeadingComment(iife, 3 /* MultiLineCommentTrivia */, "* @class "); - } var varStatement = ts.createVariableStatement( /*modifiers*/ undefined, ts.createVariableDeclarationList([ ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ false), /*type*/ undefined, iife) - ], languageVersion > 1 /* ES5 */ ? 1 /* Let */ : undefined)); + ])); ts.setOriginalNode(varStatement, node); ts.setCommentRange(varStatement, node); ts.setSourceMapRange(varStatement, ts.moveRangePastDecorators(node)); @@ -180745,7 +179468,7 @@ var ts; if (facts & 8 /* IsExportOfNamespace */) { addExportMemberAssignment(statements, node); } - else if (facts & 7 /* UseImmediatelyInvokedFunctionExpression */ || facts & 2 /* HasConstructorDecorators */) { + else if (facts & 128 /* UseImmediatelyInvokedFunctionExpression */ || facts & 2 /* HasConstructorDecorators */) { if (facts & 32 /* IsDefaultExternalExport */) { statements.push(ts.createExportDefault(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))); } @@ -180772,7 +179495,7 @@ var ts; // ${members} // } // we do not emit modifiers on the declaration if we are emitting an IIFE - var modifiers = !(facts & 7 /* UseImmediatelyInvokedFunctionExpression */) + var modifiers = !(facts & 128 /* UseImmediatelyInvokedFunctionExpression */) ? ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier) : undefined; var classDeclaration = ts.createClassDeclaration( @@ -193292,7 +192015,7 @@ var ts; scoped: false, dependencies: [ts.createBindingHelper, ts.setModuleDefaultHelper], priority: 2, - text: "\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};" + text: "\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};" }; // emit helper for `import Name from "foo"` ts.importDefaultHelper = { @@ -245238,7 +243961,7 @@ function extractDependencies(importStatementNode) { exports.__esModule = true; exports.default = void 0; -var _cssSyntaxError = _interopRequireDefault(__webpack_require__(233)); +var _cssSyntaxError = _interopRequireDefault(__webpack_require__(830)); var _stringifier = _interopRequireDefault(__webpack_require__(798)); @@ -245845,27 +244568,7 @@ module.exports = exports.default; /***/ }), /* 766 */, -/* 767 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SemVer = __webpack_require__(369) - -const inc = (version, release, options, identifier) => { - if (typeof (options) === 'string') { - identifier = options - options = undefined - } - - try { - return new SemVer(version, options).inc(release, identifier).version - } catch (er) { - return null - } -} -module.exports = inc - - -/***/ }), +/* 767 */, /* 768 */ /***/ (function(module) { @@ -245888,22 +244591,115 @@ module.exports = function (x) { /***/ }), -/* 769 */, +/* 769 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const path_1 = __importDefault(__webpack_require__(622)); +const ts = __importStar(__webpack_require__(752)); +/** + * Default compiler options for program generation from single root file + */ +const DEFAULT_COMPILER_OPTIONS = { + allowNonTsExtensions: true, + allowJs: true, + checkJs: true, + noEmit: true, + // extendedDiagnostics: true, + noUnusedLocals: true, + noUnusedParameters: true, +}; +function createDefaultCompilerOptionsFromExtra(extra) { + if (extra.debugLevel.has('typescript')) { + return Object.assign(Object.assign({}, DEFAULT_COMPILER_OPTIONS), { extendedDiagnostics: true }); + } + return DEFAULT_COMPILER_OPTIONS; +} +exports.createDefaultCompilerOptionsFromExtra = createDefaultCompilerOptionsFromExtra; +// typescript doesn't provide a ts.sys implementation for browser environments +const useCaseSensitiveFileNames = ts.sys !== undefined ? ts.sys.useCaseSensitiveFileNames : true; +const correctPathCasing = useCaseSensitiveFileNames + ? (filePath) => filePath + : (filePath) => filePath.toLowerCase(); +function getCanonicalFileName(filePath) { + let normalized = path_1.default.normalize(filePath); + if (normalized.endsWith(path_1.default.sep)) { + normalized = normalized.substr(0, normalized.length - 1); + } + return correctPathCasing(normalized); +} +exports.getCanonicalFileName = getCanonicalFileName; +function ensureAbsolutePath(p, extra) { + return path_1.default.isAbsolute(p) + ? p + : path_1.default.join(extra.tsconfigRootDir || process.cwd(), p); +} +exports.ensureAbsolutePath = ensureAbsolutePath; +function getTsconfigPath(tsconfigPath, extra) { + return getCanonicalFileName(ensureAbsolutePath(tsconfigPath, extra)); +} +exports.getTsconfigPath = getTsconfigPath; +function canonicalDirname(p) { + return path_1.default.dirname(p); +} +exports.canonicalDirname = canonicalDirname; +function getScriptKind(extra, filePath = extra.filePath) { + const extension = path_1.default.extname(filePath).toLowerCase(); + // note - we respect the user's extension when it is known we could override it and force it to match their + // jsx setting, but that could create weird situations where we throw parse errors when TSC doesn't + switch (extension) { + case '.ts': + return ts.ScriptKind.TS; + case '.tsx': + return ts.ScriptKind.TSX; + case '.js': + return ts.ScriptKind.JS; + case '.jsx': + return ts.ScriptKind.JSX; + case '.json': + return ts.ScriptKind.JSON; + default: + // unknown extension, force typescript to ignore the file extension, and respect the user's setting + return extra.jsx ? ts.ScriptKind.TSX : ts.ScriptKind.TS; + } +} +exports.getScriptKind = getScriptKind; +//# sourceMappingURL=shared.js.map + +/***/ }), /* 770 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/***/ (function(__unusedmodule, exports, __webpack_require__) { -const Range = __webpack_require__(986) +"use strict"; -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) +Object.defineProperty(exports, "__esModule", { value: true }); +const tslib_1 = __webpack_require__(259); +tslib_1.__exportStar(__webpack_require__(341), exports); +tslib_1.__exportStar(__webpack_require__(179), exports); -module.exports = toComparators + +/***/ }), +/* 771 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SemVer = __webpack_require__(734) +const major = (a, loose) => new SemVer(a, loose).major +module.exports = major /***/ }), -/* 771 */, /* 772 */, /* 773 */, /* 774 */ @@ -246125,9 +244921,9 @@ const { readdir, lstat } = __webpack_require__(747) const { join, resolve, dirname, basename, extname } = __webpack_require__(622) const cpFile = __webpack_require__(978) +const locatePath = __webpack_require__(505) const makeDir = __webpack_require__(938) const pMap = __webpack_require__(521) -const pathExists = __webpack_require__(757) const promisify = __webpack_require__(799) const { isGoExe, zipGoExe } = __webpack_require__(906) @@ -246140,8 +244936,7 @@ const pLstat = promisify(lstat) // used by AWS Lambda // TODO: remove `skipGo` option in next major release const zipFunctions = async function(srcFolder, destFolder, { parallelLimit = 5, skipGo, zipGo } = {}) { - const filenames = await listFilenames(srcFolder) - const srcPaths = filenames.map(filename => resolve(srcFolder, filename)) + const srcPaths = await getSrcPaths(srcFolder) const zipped = await pMap(srcPaths, srcPath => zipFunction(srcPath, destFolder, { skipGo, zipGo }), { concurrency: parallelLimit @@ -246149,6 +244944,53 @@ const zipFunctions = async function(srcFolder, destFolder, { parallelLimit = 5, return zipped.filter(Boolean) } +const zipFunction = async function(srcPath, destFolder, { skipGo = true, zipGo = !skipGo } = {}) { + const { runtime, filename, extension, srcDir, stat, mainFile } = await getFunctionInfo(srcPath) + + if (runtime === undefined) { + return + } + + await makeDir(destFolder) + + if (runtime === 'js') { + if (extension === '.zip') { + const destPath = join(destFolder, filename) + await cpFile(srcPath, destPath) + return { path: destPath, runtime } + } else { + const destPath = join(destFolder, `${basename(filename, '.js')}.zip`) + await zipNodeJs(srcPath, srcDir, destPath, filename, mainFile, stat) + return { path: destPath, runtime } + } + } + + if (runtime === 'go') { + if (zipGo) { + const destPath = join(destFolder, `${filename}.zip`) + await zipGoExe(srcPath, destPath, filename, stat) + return { path: destPath, runtime } + } else { + const destPath = join(destFolder, filename) + await cpFile(srcPath, destPath) + return { path: destPath, runtime } + } + } +} + +// List all Netlify Functions for a specific directory +const listFunctions = async function(srcFolder) { + const srcPaths = await getSrcPaths(srcFolder) + const functionInfos = await Promise.all(srcPaths.map(getFunctionInfo)) + return functionInfos.filter(hasMainFile).map(getListedFunction) +} + +const getSrcPaths = async function(srcFolder) { + const filenames = await listFilenames(srcFolder) + const srcPaths = filenames.map(filename => resolve(srcFolder, filename)) + return srcPaths +} + const listFilenames = async function(srcFolder) { try { return await pReaddir(srcFolder) @@ -246157,85 +244999,141 @@ const listFilenames = async function(srcFolder) { } } -const zipFunction = async function(srcPath, destFolder, { skipGo = true, zipGo = !skipGo } = {}) { - const { filename, extension, srcDir, stat, handler, destPath, destCopyPath } = await statFile(srcPath, destFolder) +const getFunctionInfo = async function(srcPath) { + const { filename, stat, mainFile, extension, srcDir } = await getSrcInfo(srcPath) - if (filename === 'node_modules' || (stat.isDirectory() && handler === undefined)) { - return + if (mainFile === undefined) { + return {} } - if (extension === '.zip') { - await cpFile(srcPath, destCopyPath) - return { path: destCopyPath, runtime: 'js' } + if (extension === '.zip' || extension === '.js') { + return { runtime: 'js', filename, stat, mainFile, extension, srcDir } } - if (extension === '.js' || stat.isDirectory()) { - await zipNodeJs(srcPath, srcDir, destPath, filename, handler, stat) - return { path: destPath, runtime: 'js' } + if (await isGoExe(srcPath)) { + return { runtime: 'go', filename, stat, mainFile, extension, srcDir } } - const isGoExecutable = await isGoExe(srcPath) + return {} +} - if (isGoExecutable && !zipGo) { - await cpFile(srcPath, destCopyPath) - return { path: destCopyPath, runtime: 'go' } +const getSrcInfo = async function(srcPath) { + const filename = basename(srcPath) + if (filename === 'node_modules') { + return {} } - if (isGoExecutable) { - await zipGoExe(srcPath, destPath, filename, stat) - return { path: destPath, runtime: 'go' } + const stat = await pLstat(srcPath) + const mainFile = await getMainFile(srcPath, filename, stat) + if (mainFile === undefined) { + return {} } -} -const statFile = async function(srcPath, destFolder) { - const filename = basename(srcPath) - const extension = extname(srcPath) - const stat = await pLstat(srcPath) - const handler = await getHandler(srcPath, filename, stat) + const extension = extname(mainFile) const srcDir = stat.isDirectory() ? srcPath : dirname(srcPath) - - await makeDir(destFolder) - const destCopyPath = join(destFolder, filename) - const destPath = join(destFolder, `${filename.replace(FUNCTION_EXTENSIONS, '')}.zip`) - - return { - filename, - extension, - srcDir, - stat, - handler, - destCopyPath, - destPath - } + return { filename, stat, mainFile, extension, srcDir } } // Each `srcPath` can also be a directory with an `index.js` file or a file // using the same filename as its directory -const getHandler = async function(srcPath, filename, stat) { +const getMainFile = function(srcPath, filename, stat) { if (!stat.isDirectory()) { return srcPath } - const namedHandler = join(srcPath, `${filename}.js`) - if (await pathExists(namedHandler)) { - return namedHandler - } + return locatePath([join(srcPath, `${filename}.js`), join(srcPath, 'index.js')], { type: 'file' }) +} - const indexHandler = join(srcPath, 'index.js') - if (await pathExists(indexHandler)) { - return indexHandler - } +const hasMainFile = function({ mainFile }) { + return mainFile !== undefined } -const FUNCTION_EXTENSIONS = /\.js$/ +const getListedFunction = function({ mainFile, runtime, extension }) { + return { mainFile, runtime, extension } +} -module.exports = { zipFunctions, zipFunction } +module.exports = { zipFunctions, zipFunction, listFunctions } /***/ }), -/* 781 */, +/* 781 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +const convert_1 = __webpack_require__(703); +const convert_comments_1 = __webpack_require__(104); +const node_utils_1 = __webpack_require__(513); +const simple_traverse_1 = __webpack_require__(657); +function astConverter(ast, extra, shouldPreserveNodeMaps) { + /** + * The TypeScript compiler produced fundamental parse errors when parsing the + * source. + */ + // internal typescript api... + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const parseDiagnostics = ast.parseDiagnostics; + if (parseDiagnostics.length) { + throw convert_1.convertError(parseDiagnostics[0]); + } + /** + * Recursively convert the TypeScript AST into an ESTree-compatible AST + */ + const instance = new convert_1.Converter(ast, { + errorOnUnknownASTType: extra.errorOnUnknownASTType || false, + useJSXTextNode: extra.useJSXTextNode || false, + shouldPreserveNodeMaps, + }); + const estree = instance.convertProgram(); + /** + * Optionally remove range and loc if specified + */ + if (!extra.range || !extra.loc) { + simple_traverse_1.simpleTraverse(estree, { + enter: node => { + if (!extra.range) { + delete node.range; + } + if (!extra.loc) { + delete node.loc; + } + }, + }); + } + /** + * Optionally convert and include all tokens in the AST + */ + if (extra.tokens) { + estree.tokens = node_utils_1.convertTokens(ast); + } + /** + * Optionally convert and include all comments in the AST + */ + if (extra.comment) { + estree.comments = convert_comments_1.convertComments(ast, extra.code); + } + const astMaps = shouldPreserveNodeMaps ? instance.getASTMaps() : undefined; + return { estree, astMaps }; +} +exports.astConverter = astConverter; +//# sourceMappingURL=ast-converter.js.map + +/***/ }), /* 782 */, -/* 783 */, +/* 783 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SemVer = __webpack_require__(734) +const compareBuild = (a, b, loose) => { + const versionA = new SemVer(a, loose) + const versionB = new SemVer(b, loose) + return versionA.compare(versionB) || versionA.compareBuild(versionB) +} +module.exports = compareBuild + + +/***/ }), /* 784 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -246754,7 +245652,7 @@ function () { * throw new Error('This plugin works only with PostCSS 6') * } */ - this.version = '7.0.31'; + this.version = '7.0.32'; /** * Plugins added to this processor. * @@ -246976,7 +245874,7 @@ var _default = Processor; exports.default = _default; module.exports = exports.default; -//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInByb2Nlc3Nvci5lczYiXSwibmFtZXMiOlsiUHJvY2Vzc29yIiwicGx1Z2lucyIsInZlcnNpb24iLCJub3JtYWxpemUiLCJ1c2UiLCJwbHVnaW4iLCJjb25jYXQiLCJwcm9jZXNzIiwiY3NzIiwib3B0cyIsImxlbmd0aCIsInBhcnNlciIsInN0cmluZ2lmaWVyIiwiZW52IiwiTk9ERV9FTlYiLCJjb25zb2xlIiwid2FybiIsIkxhenlSZXN1bHQiLCJub3JtYWxpemVkIiwiaSIsInBvc3Rjc3MiLCJBcnJheSIsImlzQXJyYXkiL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dheXMgc2V0IGBmcm9tYCxcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJlY2F1c2UgaXQgaXMgdXNlZCBpbiBzb3VyY2UgbWFwXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBnZW5lcmF0aW9uIGFuZCBzeW50YXggZXJyb3IgbWVzc2FnZXMuXG4gKiBAcHJvcGVydHkge3N0cmluZ30gdG8gICAgICAgICAgICAgICBUaGUgcGF0aCB3aGVyZSB5b3XigJlsbCBwdXQgdGhlIG91dHB1dFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ1NTIGZpbGUuIFlvdSBzaG91bGQgYWx3YXlzIHNldCBgdG9gXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0byBnZW5lcmF0ZSBjb3JyZWN0IHNvdXJjZSBtYXBzLlxuICogQHByb3BlcnR5IHtwYXJzZXJ9IHBhcnNlciAgICAgICAgICAgRnVuY3Rpb24gdG8gZ2VuZXJhdGUgQVNUIGJ5IHN0cmluZy5cbiAqIEBwcm9wZXJ0eSB7c3RyaW5naWZpZXJ9IHN0cmluZ2lmaWVyIENsYXNzIHRvIGdlbmVyYXRlIHN0cmluZyBieSBBU1QuXG4gKiBAcHJvcGVydHkge3N5bnRheH0gc3ludGF4ICAgICAgICAgICBPYmplY3Qgd2l0aCBgcGFyc2VgIGFuZCBgc3RyaW5naWZ5YC5cbiAqIEBwcm9wZXJ0eSB7b2JqZWN0fSBtYXAgICAgICAgICAgICAgIFNvdXJjZSBtYXAgb3B0aW9ucy5cbiAqIEBwcm9wZXJ0eSB7Ym9vbGVhbn0gbWFwLmlubGluZSAgICAgICAgICAgICAgICAgICAgRG9lcyBzb3VyY2UgbWFwIHNob3VsZFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiZSBlbWJlZGRlZCBpbiB0aGUgb3V0cHV0XG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENTUyBhcyBhIGJhc2U2NC1lbmNvZGVkXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1lbnQuXG4gKiBAcHJvcGVydHkge3N0cmluZ3xvYmplY3R8ZmFsc2V8ZnVuY3Rpb259IG1hcC5wcmV2IFNvdXJjZSBtYXAgY29udGVudFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tIGEgcHJldmlvdXNcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc2luZyBzdGVwXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmb3IgZXhhbXBsZSwgU2FzcykuXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBvc3RDU1Mgd2lsbCB0cnkgdG8gZmluZFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmV2aW91cyBtYXAgYXV0b21hdGljYWxseSxcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc28geW91IGNvdWxkIGRpc2FibGUgaXQgYnlcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYGZhbHNlYCB2YWx1ZS5cbiAqIEBwcm9wZXJ0eSB7Ym9vbGVhbn0gbWFwLnNvdXJjZXNDb250ZW50ICAgICAgICAgICAgRG9lcyBQb3N0Q1NTIHNob3VsZCBzZXRcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlIG9yaWdpbiBjb250ZW50IHRvIG1hcC5cbiAqIEBwcm9wZXJ0eSB7c3RyaW5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aGlzLm5vcm1hbGl6ZShbcGx1Z2luXSkpXG4gICAgcmV0dXJuIHRoaXNcbiAgfVxuXG4gIC8qKlxuICAgKiBQYXJzZXMgc291cmNlIENTUyBhbmQgcmV0dXJucyBhIHtAbGluayBMYXp5UmVzdWx0fSBQcm9taXNlIHByb3h5LlxuICAgKiBCZWNhdXNlIHNvbWUgcGx1Z2lucyBjYW4gYmUgYXN5bmNocm9ub3VzIGl0IGRvZXNu4oCZdCBtYWtlXG4gICAqIGFueSB0cmFuc2Zvcm1hdGlvbnMuIFRyYW5zZm9ybWF0aW9ucyB3aWxsIGJlIGFwcGxpZWRcbiAgICogaW4gdGhlIHtAbGluayBMYXp5UmVzdWx0fSBtZXRob2RzLlxuICAgKlxuICAgKiBAcGFyYW0ge3N0cmluZ3x0b1N0cmluZ3xSZXN1bHR9IGNzcyBTdHJpbmcgd2l0aCBpbnB1dCBDU1Mgb3IgYW55IG9iamVjdFxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB3aXRoIGEgYHRvU3RyaW5nKClgIG1ldGhvZCxcbiAgICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbGlrZSBhIEJ1ZmZlci4gT3B0aW9uYWxseSwgc2VuZFxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBhIHtAbGluayBSZXN1bHR9IGluc3RhbmNlXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFuZCB0aGUgcHJvY2Vzc29yIHdpbGwgdGFrZVxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0aGUge0BsaW5rIFJvb3R9IGZyb20gaXQuXG4gICAqIEBwYXJhbSB7cHJvY2Vzc09wdGlvbnN9IFtvcHRzXSAgICAgIE9wdGlvbnMuXG4gICAqXG4gICAqIEByZXR1cm4ge0xhenlSZXN1bHR9IFByb21pc2UgcHJveHkuXG4gICAqXG4gICAqIEBleGFtcGxlX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uICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgQ1NTIGZpbGUuIFlvdSBzaG91bGQgYWx3YXlzIHNldCBgdG9gXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB0byBnZW5lcmF0ZSBjb3JyZWN0IHNvdXJjZSBtYXBzLlxuICogQHByb3BlcnR5IHtwYXJzZXJ9IHBhcnNlciAgICAgICAgICAgRnVuY3Rpb24gdG8gZ2VuZXJhdGUgQVNUIGJ5IHN0cmluZy5cbiAqIEBwcm9wZXJ0eSB7c3RyaW5naWZpZXJ9IHN0cmluZ2lmaWVyIENsYXNzIHRvIGdlbmVyYXRlIHN0cmluZyBieSBBU1QuXG4gKiBAcHJvcGVydHkge3N5bnRheH0gc3ludGF4ICAgICAgICAgICBPYmplY3Qgd2l0aCBgcGFyc2VgIGFuZCBgc3RyaW5naWZ5YC5cbiAqIEBwcm9wZXJ0eSB7b2JqZWN0fSBtYXAgICAgICAgICAgICAgIFNvdXJjZSBtYXAgb3B0aW9ucy5cbiAqIEBwcm9wZXJ0eSB7Ym9vbGVhbn0gbWFwLmlubGluZSAgICAgICAgICAgICAgICAgICAgRG9lcyBzb3VyY2UgbWFwIHNob3VsZFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBiZSBlbWJlZGRlZCBpbiB0aGUgb3V0cHV0XG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIENTUyBhcyBhIGJhc2U2NC1lbmNvZGVkXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNvbW1lbnQuXG4gKiBAcHJvcGVydHkge3N0cmluZ3xvYmplY3R8ZmFsc2V8ZnVuY3Rpb259IG1hcC5wcmV2IFNvdXJjZSBtYXAgY29udGVudFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmcm9tIGEgcHJldmlvdXNcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvY2Vzc2luZyBzdGVwXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIChmb3IgZXhhbXBsZSwgU2FzcykuXG4gKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFBvc3RDU1Mgd2lsbCB0cnkgdG8gZmluZFxuICogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcmV2aW91cyBtYXAgYXV0b21hdGljYWxseSxcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc28geW91IGNvdWxkIGRpc2FibGUgaXQgYnlcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYGZhbHNlYCB2YWx1ZS5cbiAqIEBwcm9wZXJ0eSB7Ym9vbGVhbn0gbWFwLnNvdXJjZXNDb250ZW50ICAgICAgICAgICAgRG9lcyBQb3N0Q1NTIHNob3VsZCBzZXRcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgdGhlIG9yaWdpbiBjb250ZW50IHRvIG1hcC5cbiAqIEBwcm9wZXJ0eSB7c3RyaW5nfGZhbHNlfSBtYXAuYW5ub3RhdGlvbiAgICAgICAgICAgRG9lcyBQb3N0Q1NTIHNob3VsZCBzZXRcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYW5ub3RhdGlvbiBjb21tZW50IHRvIG1hcC5cbiAqIEBwcm9wZXJ0eSB7c3RyaW5nfSBtYXAuZnJvbSAgICAgICAgICAgICAgICAgICAgICAgT3ZlcnJpZGUgYGZyb21gIGluIG1hcOKAmXNcbiAqICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc291cmNlc2AuXG4gKi9cbiJdLCJmaWxlIjoicHJvY2Vzc29yLmpzIn0= /***/ }), @@ -247006,28 +245904,13 @@ module.exports = Comma; /* 790 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(570) +const compare = __webpack_require__(340) const gte = (a, b, loose) => compare(a, b, loose) >= 0 module.exports = gte /***/ }), -/* 791 */ -/***/ (function(module) { - -module.exports = function (x, opts) { - /** - * This file is purposefully a passthrough. It's expected that third-party - * environments will override it at runtime in order to inject special logic - * into `resolve` (by manipulating the options). One such example is the PnP - * code path in Yarn. - */ - - return opts || {}; -}; - - -/***/ }), +/* 791 */, /* 792 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -247919,8 +246802,8 @@ const { version: nodeVersion } = __webpack_require__(956) const findUp = __webpack_require__(957) const pathExists = __webpack_require__(757) -const resolve = __webpack_require__(371) -const { lt: ltVersion } = __webpack_require__(94) +const resolve = __webpack_require__(500) +const { lt: ltVersion } = __webpack_require__(682) // Find the path to a module's `package.json` // We need to use `resolve` instead of `require.resolve()` because: @@ -248331,3158 +247214,4680 @@ function isObject(value) { return !!value && (type == 'object' || type == 'function'); } -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +module.exports = flatten; + + +/***/ }), +/* 803 */, +/* 804 */, +/* 805 */, +/* 806 */ +/***/ (function(module) { + +/** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an array, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(document.body.children); + * // => false + * + * _.isArray('abc'); + * // => false + * + * _.isArray(_.noop); + * // => false + */ +var isArray = Array.isArray; + +module.exports = isArray; + + +/***/ }), +/* 807 */ +/***/ (function(module, exports, __webpack_require__) { + +var Stream = __webpack_require__(413); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; + exports = module.exports = Stream.Readable; + exports.Readable = Stream.Readable; + exports.Writable = Stream.Writable; + exports.Duplex = Stream.Duplex; + exports.Transform = Stream.Transform; + exports.PassThrough = Stream.PassThrough; + exports.Stream = Stream; +} else { + exports = module.exports = __webpack_require__(817); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = __webpack_require__(519); + exports.Duplex = __webpack_require__(445); + exports.Transform = __webpack_require__(437); + exports.PassThrough = __webpack_require__(797); +} + + +/***/ }), +/* 808 */, +/* 809 */, +/* 810 */, +/* 811 */, +/* 812 */, +/* 813 */ +/***/ (function(__unusedmodule, exports) { + +"use strict"; + + +Object.defineProperty(exports, '__esModule', { value: true }); + +async function auth(token) { + const tokenType = token.split(/\./).length === 3 ? "app" : /^v\d+\./.test(token) ? "installation" : "oauth"; + return { + type: "token", + token: token, + tokenType + }; +} + +/** + * Prefix token for usage in the Authorization header + * + * @param token OAuth token or JSON Web Token + */ +function withAuthorizationPrefix(token) { + if (token.split(/\./).length === 3) { + return `bearer ${token}`; + } + + return `token ${token}`; +} + +async function hook(token, request, route, parameters) { + const endpoint = request.endpoint.merge(route, parameters); + endpoint.headers.authorization = withAuthorizationPrefix(token); + return request(endpoint); +} + +const createTokenAuth = function createTokenAuth(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) + }); +}; + +exports.createTokenAuth = createTokenAuth; +//# sourceMappingURL=index.js.map + + +/***/ }), +/* 814 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +module.exports = which +which.sync = whichSync + +var isWindows = process.platform === 'win32' || + process.env.OSTYPE === 'cygwin' || + process.env.OSTYPE === 'msys' + +var path = __webpack_require__(622) +var COLON = isWindows ? ';' : ':' +var isexe = __webpack_require__(742) + +function getNotFoundError (cmd) { + var er = new Error('not found: ' + cmd) + er.code = 'ENOENT' + + return er +} + +function getPathInfo (cmd, opt) { + var colon = opt.colon || COLON + var pathEnv = opt.path || process.env.PATH || '' + var pathExt = [''] + + pathEnv = pathEnv.split(colon) + + var pathExtExe = '' + if (isWindows) { + pathEnv.unshift(process.cwd()) + pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM') + pathExt = pathExtExe.split(colon) + + + // Always test the cmd itself first. isexe will check to make sure + // it's found in the pathExt set. + if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') + pathExt.unshift('') + } + + // If it has a slash, then we don't bother searching the pathenv. + // just check the file itself, and that's it. + if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) + pathEnv = [''] + + return { + env: pathEnv, + ext: pathExt, + extExe: pathExtExe + } +} + +function which (cmd, opt, cb) { + if (typeof opt === 'function') { + cb = opt + opt = {} + } + + var info = getPathInfo(cmd, opt) + var pathEnv = info.env + var pathExt = info.ext + var pathExtExe = info.extExe + var found = [] + + ;(function F (i, l) { + if (i === l) { + if (opt.all && found.length) + return cb(null, found) + else + return cb(getNotFoundError(cmd)) + } + + var pathPart = pathEnv[i] + if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') + pathPart = pathPart.slice(1, -1) + + var p = path.join(pathPart, cmd) + if (!pathPart && (/^\.[\\\/]/).test(cmd)) { + p = cmd.slice(0, 2) + p + } + ;(function E (ii, ll) { + if (ii === ll) return F(i + 1, l) + var ext = pathExt[ii] + isexe(p + ext, { pathExt: pathExtExe }, function (er, is) { + if (!er && is) { + if (opt.all) + found.push(p + ext) + else + return cb(null, p + ext) + } + return E(ii + 1, ll) + }) + })(0, pathExt.length) + })(0, pathEnv.length) +} + +function whichSync (cmd, opt) { + opt = opt || {} + + var info = getPathInfo(cmd, opt) + var pathEnv = info.env + var pathExt = info.ext + var pathExtExe = info.extExe + var found = [] + + for (var i = 0, l = pathEnv.length; i < l; i ++) { + var pathPart = pathEnv[i] + if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') + pathPart = pathPart.slice(1, -1) + + var p = path.join(pathPart, cmd) + if (!pathPart && /^\.[\\\/]/.test(cmd)) { + p = cmd.slice(0, 2) + p + } + for (var j = 0, ll = pathExt.length; j < ll; j ++) { + var cur = p + pathExt[j] + var is + try { + is = isexe.sync(cur, { pathExt: pathExtExe }) + if (is) { + if (opt.all) + found.push(cur) + else + return cur + } + } catch (ex) {} + } + } + + if (opt.all && found.length) + return found + + if (opt.nothrow) + return null + + throw getNotFoundError(cmd) +} + + +/***/ }), +/* 815 */ +/***/ (function(module) { + +module.exports = {"assert":true,"async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"dns":true,"domain":true,"events":true,"freelist":"< 6","fs":true,"fs/promises":">= 10 && < 10.1","_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"string_decoder":true,"sys":true,"timers":true,"_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}; + +/***/ }), +/* 816 */ +/***/ (function(module) { + +"use strict"; + +module.exports = /^#!.*/; + + +/***/ }), +/* 817 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +"use strict"; +// 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 pna = __webpack_require__(822); +/**/ + +module.exports = Readable; + +/**/ +var isArray = __webpack_require__(897); +/**/ + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = __webpack_require__(614).EventEmitter; + +var EElistenerCount = function (emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(903); +/**/ + +/**/ + +var Buffer = __webpack_require__(149).Buffer; +var OurUint8Array = global.Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ + +/**/ +var util = Object.create(__webpack_require__(286)); +util.inherits = __webpack_require__(689); +/**/ + +/**/ +var debugUtil = __webpack_require__(669); +var debug = void 0; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function () {}; +} +/**/ + +var BufferList = __webpack_require__(287); +var destroyImpl = __webpack_require__(443); +var StringDecoder; + +util.inherits(Readable, Stream); + +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} + +function ReadableState(options, stream) { + Duplex = Duplex || __webpack_require__(445); + + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + var isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var readableHwm = options.readableHighWaterMark; + var defaultHwm = this.objectMode ? 16 : 16 * 1024; + + if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; + + // cast to ints. + this.highWaterMark = Math.floor(this.highWaterMark); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = __webpack_require__(432).StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + Duplex = Duplex || __webpack_require__(445); + + if (!(this instanceof Readable)) return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + if (options) { + if (typeof options.read === 'function') this._read = options.read; + + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + + Stream.call(this); +} + +Object.defineProperty(Readable.prototype, 'destroyed', { + get: function () { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function (value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); + +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + this.push(null); + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; + +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + + if (addToFront) { + if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); + } else if (state.ended) { + stream.emit('error', new Error('stream.push() after EOF')); + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + } + } + + return needMoreData(state); +} + +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} + +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); +} + +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = __webpack_require__(432).StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 8MB +var MAX_HWM = 0x800000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } else { + state.length -= n; + } + + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + + if (ret !== null) this.emit('data', ret); + + return ret; +}; + +function onEofChunk(stream, state) { + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + pna.nextTick(maybeReadMore_, stream, state); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break;else len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + this.emit('error', new Error('_read() is not implemented')); +}; + +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); -module.exports = flatten; + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; -/***/ }), -/* 803 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } -const parse = __webpack_require__(147) -const valid = (version, options) => { - const v = parse(version, options) - return v ? v.version : null -} -module.exports = valid + // If the user pushes more data while we're writing to dest then we'll end up + // in ondata again. However, we only want to increase awaitDrain once because + // dest will only emit one 'drain' event for the multiple writes. + // => Introduce a guard on increasing awaitDrain. + var increasedAwaitDrain = false; + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + increasedAwaitDrain = false; + var ret = dest.write(chunk); + if (false === ret && !increasedAwaitDrain) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', src._readableState.awaitDrain); + src._readableState.awaitDrain++; + increasedAwaitDrain = true; + } + src.pause(); + } + } + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); + } -/***/ }), -/* 804 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); -const compare = __webpack_require__(682) -const eq = (a, b, loose) => compare(a, b, loose) === 0 -module.exports = eq + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } -/***/ }), -/* 805 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + // tell the dest that it's being piped to + dest.emit('pipe', src); -const SemVer = __webpack_require__(369) -const compareBuild = (a, b, loose) => { - const versionA = new SemVer(a, loose) - const versionB = new SemVer(b, loose) - return versionA.compare(versionB) || versionA.compareBuild(versionB) + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function () { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; } -module.exports = compareBuild +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { hasUnpiped: false }; -/***/ }), -/* 806 */ -/***/ (function(module) { + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; -module.exports = isArray; + if (!dest) dest = state.pipes; + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } -/***/ }), -/* 807 */ -/***/ (function(module, exports, __webpack_require__) { + // slow case. multiple pipe destinations. -var Stream = __webpack_require__(413); -if (process.env.READABLE_STREAM === 'disable' && Stream) { - module.exports = Stream; - exports = module.exports = Stream.Readable; - exports.Readable = Stream.Readable; - exports.Writable = Stream.Writable; - exports.Duplex = Stream.Duplex; - exports.Transform = Stream.Transform; - exports.PassThrough = Stream.PassThrough; - exports.Stream = Stream; -} else { - exports = module.exports = __webpack_require__(817); - exports.Stream = Stream || exports; - exports.Readable = exports; - exports.Writable = __webpack_require__(519); - exports.Duplex = __webpack_require__(445); - exports.Transform = __webpack_require__(437); - exports.PassThrough = __webpack_require__(797); -} + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) { + dests[i].emit('unpipe', this, unpipeInfo); + }return this; + } -/***/ }), -/* 808 */, -/* 809 */, -/* 810 */, -/* 811 */, -/* 812 */, -/* 813 */ -/***/ (function(__unusedmodule, exports) { + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; -"use strict"; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); -Object.defineProperty(exports, '__esModule', { value: true }); + return this; +}; -async function auth(token) { - const tokenType = token.split(/\./).length === 3 ? "app" : /^v\d+\./.test(token) ? "installation" : "oauth"; - return { - type: "token", - token: token, - tokenType - }; -} +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); -/** - * Prefix token for usage in the Authorization header - * - * @param token OAuth token or JSON Web Token - */ -function withAuthorizationPrefix(token) { - if (token.split(/\./).length === 3) { - return `bearer ${token}`; + if (ev === 'data') { + // Start flowing on next tick if stream isn't explicitly paused + if (this._readableState.flowing !== false) this.resume(); + } else if (ev === 'readable') { + var state = this._readableState; + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.emittedReadable = false; + if (!state.reading) { + pna.nextTick(nReadingNextTick, this); + } else if (state.length) { + emitReadable(this); + } + } } - return `token ${token}`; -} + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; -async function hook(token, request, route, parameters) { - const endpoint = request.endpoint.merge(route, parameters); - endpoint.headers.authorization = withAuthorizationPrefix(token); - return request(endpoint); +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); } -const createTokenAuth = function createTokenAuth(token) { - if (!token) { - throw new Error("[@octokit/auth-token] No token passed to createTokenAuth"); +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + resume(this, state); } + return this; +}; - if (typeof token !== "string") { - throw new Error("[@octokit/auth-token] Token passed to createTokenAuth is not a string"); +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + pna.nextTick(resume_, stream, state); } +} - token = token.replace(/^(token|bearer) +/i, ""); - return Object.assign(auth.bind(null, token), { - hook: hook.bind(null, token) - }); +function resume_(stream, state) { + if (!state.reading) { + debug('resume read 0'); + stream.read(0); + } + + state.resumeScheduled = false; + state.awaitDrain = 0; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} + +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; }; -exports.createTokenAuth = createTokenAuth; -//# sourceMappingURL=index.js.map +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null) {} +} +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; -/***/ }), -/* 814 */ -/***/ (function(module, __unusedexports, __webpack_require__) { + var state = this._readableState; + var paused = false; -module.exports = which -which.sync = whichSync + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } -var isWindows = process.platform === 'win32' || - process.env.OSTYPE === 'cygwin' || - process.env.OSTYPE === 'msys' + _this.push(null); + }); -var path = __webpack_require__(622) -var COLON = isWindows ? ';' : ':' -var isexe = __webpack_require__(742) + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); -function getNotFoundError (cmd) { - var er = new Error('not found: ' + cmd) - er.code = 'ENOENT' + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - return er -} + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); -function getPathInfo (cmd, opt) { - var colon = opt.colon || COLON - var pathEnv = opt.path || process.env.PATH || '' - var pathExt = [''] + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function (method) { + return function () { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } - pathEnv = pathEnv.split(colon) + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } - var pathExtExe = '' - if (isWindows) { - pathEnv.unshift(process.cwd()) - pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM') - pathExt = pathExtExe.split(colon) + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; - // Always test the cmd itself first. isexe will check to make sure - // it's found in the pathExt set. - if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') - pathExt.unshift('') +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function () { + return this._readableState.highWaterMark; } +}); - // If it has a slash, then we don't bother searching the pathenv. - // just check the file itself, and that's it. - if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) - pathEnv = [''] +// exposed for testing purposes only. +Readable._fromList = fromList; - return { - env: pathEnv, - ext: pathExt, - extExe: pathExtExe +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = fromListPartial(n, state.buffer, state.decoder); } + + return ret; } -function which (cmd, opt, cb) { - if (typeof opt === 'function') { - cb = opt - opt = {} +// Extracts only enough buffered data to satisfy the amount requested. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromListPartial(n, list, hasStrings) { + var ret; + if (n < list.head.data.length) { + // slice is the same for buffers and strings + ret = list.head.data.slice(0, n); + list.head.data = list.head.data.slice(n); + } else if (n === list.head.data.length) { + // first chunk is a perfect match + ret = list.shift(); + } else { + // result spans more than one buffer + ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); } + return ret; +} - var info = getPathInfo(cmd, opt) - var pathEnv = info.env - var pathExt = info.ext - var pathExtExe = info.extExe - var found = [] +// Copies a specified amount of characters from the list of buffered data +// chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBufferString(n, list) { + var p = list.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + list.length -= c; + return ret; +} - ;(function F (i, l) { - if (i === l) { - if (opt.all && found.length) - return cb(null, found) - else - return cb(getNotFoundError(cmd)) +// Copies a specified amount of bytes from the list of buffered data chunks. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function copyFromBuffer(n, list) { + var ret = Buffer.allocUnsafe(n); + var p = list.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) list.head = p.next;else list.head = list.tail = null; + } else { + list.head = p; + p.data = buf.slice(nb); + } + break; } + ++c; + } + list.length -= c; + return ret; +} - var pathPart = pathEnv[i] - if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') - pathPart = pathPart.slice(1, -1) +function endReadable(stream) { + var state = stream._readableState; - var p = path.join(pathPart, cmd) - if (!pathPart && (/^\.[\\\/]/).test(cmd)) { - p = cmd.slice(0, 2) + p - } - ;(function E (ii, ll) { - if (ii === ll) return F(i + 1, l) - var ext = pathExt[ii] - isexe(p + ext, { pathExt: pathExtExe }, function (er, is) { - if (!er && is) { - if (opt.all) - found.push(p + ext) - else - return cb(null, p + ext) - } - return E(ii + 1, ll) - }) - })(0, pathExt.length) - })(0, pathEnv.length) + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + pna.nextTick(endReadableNT, state, stream); + } } -function whichSync (cmd, opt) { - opt = opt || {} +function endReadableNT(state, stream) { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } +} - var info = getPathInfo(cmd, opt) - var pathEnv = info.env - var pathExt = info.ext - var pathExtExe = info.extExe - var found = [] +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} - for (var i = 0, l = pathEnv.length; i < l; i ++) { - var pathPart = pathEnv[i] - if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') - pathPart = pathPart.slice(1, -1) +/***/ }), +/* 818 */ +/***/ (function(module, __unusedexports, __webpack_require__) { - var p = path.join(pathPart, cmd) - if (!pathPart && /^\.[\\\/]/.test(cmd)) { - p = cmd.slice(0, 2) + p - } - for (var j = 0, ll = pathExt.length; j < ll; j ++) { - var cur = p + pathExt[j] - var is - try { - is = isexe.sync(cur, { pathExt: pathExtExe }) - if (is) { - if (opt.all) - found.push(cur) - else - return cur - } - } catch (ex) {} +module.exports = isexe +isexe.sync = sync + +var fs = __webpack_require__(747) + +function checkPathExt (path, options) { + var pathext = options.pathExt !== undefined ? + options.pathExt : process.env.PATHEXT + + if (!pathext) { + return true + } + + pathext = pathext.split(';') + if (pathext.indexOf('') !== -1) { + return true + } + for (var i = 0; i < pathext.length; i++) { + var p = pathext[i].toLowerCase() + if (p && path.substr(-p.length).toLowerCase() === p) { + return true } } + return false +} - if (opt.all && found.length) - return found +function checkStat (stat, path, options) { + if (!stat.isSymbolicLink() && !stat.isFile()) { + return false + } + return checkPathExt(path, options) +} - if (opt.nothrow) - return null +function isexe (path, options, cb) { + fs.stat(path, function (er, stat) { + cb(er, er ? false : checkStat(stat, path, options)) + }) +} - throw getNotFoundError(cmd) +function sync (path, options) { + return checkStat(fs.statSync(path), path, options) } /***/ }), -/* 815 */ -/***/ (function(module) { +/* 819 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { -module.exports = {"assert":true,"async_hooks":">= 8","buffer_ieee754":"< 0.9.7","buffer":true,"child_process":true,"cluster":true,"console":true,"constants":true,"crypto":true,"_debug_agent":">= 1 && < 8","_debugger":"< 8","dgram":true,"dns":true,"domain":true,"events":true,"freelist":"< 6","fs":true,"fs/promises":">= 10 && < 10.1","_http_agent":">= 0.11.1","_http_client":">= 0.11.1","_http_common":">= 0.11.1","_http_incoming":">= 0.11.1","_http_outgoing":">= 0.11.1","_http_server":">= 0.11.1","http":true,"http2":">= 8.8","https":true,"inspector":">= 8.0.0","_linklist":"< 8","module":true,"net":true,"node-inspect/lib/_inspect":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_client":">= 7.6.0 && < 12","node-inspect/lib/internal/inspect_repl":">= 7.6.0 && < 12","os":true,"path":true,"perf_hooks":">= 8.5","process":">= 1","punycode":true,"querystring":true,"readline":true,"repl":true,"smalloc":">= 0.11.5 && < 3","_stream_duplex":">= 0.9.4","_stream_transform":">= 0.9.4","_stream_wrap":">= 1.4.1","_stream_passthrough":">= 0.9.4","_stream_readable":">= 0.9.4","_stream_writable":">= 0.9.4","stream":true,"string_decoder":true,"sys":true,"timers":true,"_tls_common":">= 0.11.13","_tls_legacy":">= 0.11.3 && < 10","_tls_wrap":">= 0.11.3","tls":true,"trace_events":">= 10","tty":true,"url":true,"util":true,"v8/tools/arguments":">= 10 && < 12","v8/tools/codemap":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/consarray":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/csvparser":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/logreader":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/profile_view":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8/tools/splaytree":[">= 4.4.0 && < 5",">= 5.2.0 && < 12"],"v8":">= 1","vm":true,"wasi":">= 13.4 && < 13.5","worker_threads":">= 11.7","zlib":true}; +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ -/***/ }), -/* 816 */ -/***/ (function(module) { +var util = __webpack_require__(992); +var binarySearch = __webpack_require__(481); +var ArraySet = __webpack_require__(845).ArraySet; +var base64VLQ = __webpack_require__(167); +var quickSort = __webpack_require__(569).quickSort; -"use strict"; +function SourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } -module.exports = /^#!.*/; + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) + : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); +} +SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); +} -/***/ }), -/* 817 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/** + * The version of the source mapping spec that we are consuming. + */ +SourceMapConsumer.prototype._version = 3; -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. +// `__generatedMappings` and `__originalMappings` are arrays that hold the +// parsed mapping coordinates from the source map's "mappings" attribute. They +// are lazily instantiated, accessed via the `_generatedMappings` and +// `_originalMappings` getters respectively, and we only parse the mappings +// and create these arrays once queried for a source location. We jump through +// these hoops because there can be many thousands of mappings, and parsing +// them is expensive, so we only want to do it if we must. // -// 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: +// Each object in the arrays is of the form: // -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. +// { +// generatedLine: The line number in the generated code, +// generatedColumn: The column number in the generated code, +// source: The path to the original source file that generated this +// chunk of code, +// originalLine: The line number in the original source that +// corresponds to this chunk of generated code, +// originalColumn: The column number in the original source that +// corresponds to this chunk of generated code, +// name: The name of the original symbol which generated this chunk of +// code. +// } // -// 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. +// All properties except for `generatedLine` and `generatedColumn` can be +// `null`. +// +// `_generatedMappings` is ordered by the generated positions. +// +// `_originalMappings` is ordered by the original positions. +SourceMapConsumer.prototype.__generatedMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + return this.__generatedMappings; + } +}); -/**/ +SourceMapConsumer.prototype.__originalMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } -var pna = __webpack_require__(822); -/**/ + return this.__originalMappings; + } +}); -module.exports = Readable; +SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; -/**/ -var isArray = __webpack_require__(897); -/**/ +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; -/**/ -var Duplex; -/**/ +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; -Readable.ReadableState = ReadableState; +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; -/**/ -var EE = __webpack_require__(614).EventEmitter; +/** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ +SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } -/**/ -var Stream = __webpack_require__(903); -/**/ + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + +/** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number is 1-based. + * - column: Optional. the column number in the original source. + * The column number is 0-based. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + needle.source = this._findSourceIndex(needle.source); + if (needle.source < 0) { + return []; + } + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + +exports.SourceMapConsumer = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The first parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + if (sourceRoot) { + sourceRoot = util.normalize(sourceRoot); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); -/**/ + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); -var Buffer = __webpack_require__(149).Buffer; -var OurUint8Array = global.Uint8Array || function () {}; -function _uint8ArrayToBuffer(chunk) { - return Buffer.from(chunk); -} -function _isUint8Array(obj) { - return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; + this._absoluteSources = this._sources.toArray().map(function (s) { + return util.computeSourceURL(sourceRoot, s, aSourceMapURL); + }); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this._sourceMapURL = aSourceMapURL; + this.file = file; } -/**/ +BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; -/**/ -var util = Object.create(__webpack_require__(286)); -util.inherits = __webpack_require__(689); -/**/ +/** + * Utility function to find the index of a source. Returns -1 if not + * found. + */ +BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } -/**/ -var debugUtil = __webpack_require__(669); -var debug = void 0; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ + if (this._sources.has(relativeSource)) { + return this._sources.indexOf(relativeSource); + } -var BufferList = __webpack_require__(287); -var destroyImpl = __webpack_require__(443); -var StringDecoder; + // Maybe aSource is an absolute URL as returned by |sources|. In + // this case we can't simply undo the transform. + var i; + for (i = 0; i < this._absoluteSources.length; ++i) { + if (this._absoluteSources[i] == aSource) { + return i; + } + } -util.inherits(Readable, Stream); + return -1; +}; -var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +/** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @param String aSourceMapURL + * The URL at which the source map can be found (optional) + * @returns BasicSourceMapConsumer + */ +BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { + var smc = Object.create(BasicSourceMapConsumer.prototype); -function prependListener(emitter, event, fn) { - // Sadly this is not cacheable as some libraries bundle their own - // event emitter implementation with them. - if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + smc._sourceMapURL = aSourceMapURL; + smc._absoluteSources = smc._sources.toArray().map(function (s) { + return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); + }); - // This is a hack to make sure that our error handler is attached before any - // userland ones. NEVER DO THIS. This is here only because this code needs - // to continue to work with older versions of Node.js that do not include - // the prependListener() method. The goal is to eventually remove this hack. - if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; -} + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. -function ReadableState(options, stream) { - Duplex = Duplex || __webpack_require__(445); + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; - options = options || {}; + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; - // Duplex streams are both readable and writable, but share - // the same options object. - // However, some cases require setting options to different - // values for the readable and the writable sides of the duplex stream. - // These options can be provided separately as readableXXX and writableXXX. - var isDuplex = stream instanceof Duplex; + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } - if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + destOriginalMappings.push(destMapping); + } - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var readableHwm = options.readableHighWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; + destGeneratedMappings.push(destMapping); + } - if (hwm || hwm === 0) this.highWaterMark = hwm;else if (isDuplex && (readableHwm || readableHwm === 0)) this.highWaterMark = readableHwm;else this.highWaterMark = defaultHwm; + quickSort(smc.__originalMappings, util.compareByOriginalPositions); - // cast to ints. - this.highWaterMark = Math.floor(this.highWaterMark); + return smc; + }; - // A linked list is used to store data chunks instead of an array because the - // linked list can remove elements from the beginning faster than - // array.shift() - this.buffer = new BufferList(); - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; +/** + * The version of the source mapping spec that we are consuming. + */ +BasicSourceMapConsumer.prototype._version = 3; - // a flag to be able to tell if the event 'readable'/'data' is emitted - // immediately, or on a later tick. We set this to true at first, because - // any actions that shouldn't happen until "later" should generally also - // not happen before the first read call. - this.sync = true; +/** + * The list of original sources. + */ +Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._absoluteSources.slice(); + } +}); - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; +/** + * Provide the JIT with a nice shape / hidden class. + */ +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} - // has it been destroyed - this.destroyed = false; +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); - // if true, a maybeReadMore has been scheduled - this.readingMore = false; + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = __webpack_require__(432).StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } -function Readable(options) { - Duplex = Duplex || __webpack_require__(445); + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } - if (!(this instanceof Readable)) return new Readable(options); + cachedSegments[str] = segment; + } - this._readableState = new ReadableState(options, this); + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; - // legacy - this.readable = true; + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; - if (options) { - if (typeof options.read === 'function') this._read = options.read; + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; - if (typeof options.destroy === 'function') this._destroy = options.destroy; - } + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; - Stream.call(this); -} + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } -Object.defineProperty(Readable.prototype, 'destroyed', { - get: function () { - if (this._readableState === undefined) { - return false; - } - return this._readableState.destroyed; - }, - set: function (value) { - // we ignore the value if the stream - // has not been initialized yet - if (!this._readableState) { - return; + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } } - // backward compatibility, the user is explicitly - // managing destroyed - this._readableState.destroyed = value; - } -}); + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; -Readable.prototype.destroy = destroyImpl.destroy; -Readable.prototype._undestroy = destroyImpl.undestroy; -Readable.prototype._destroy = function (err, cb) { - this.push(null); - cb(err); -}; + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - var skipChunkCheck; +/** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ +BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. - if (!state.objectMode) { - if (typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = Buffer.from(chunk, encoding); - encoding = ''; - } - skipChunkCheck = true; + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); } - } else { - skipChunkCheck = true; - } - return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); -}; + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - return readableAddChunk(this, chunk, null, true, false); -}; +/** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ +BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; -function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { - var state = stream._readableState; - if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else { - var er; - if (!skipChunkCheck) er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { - chunk = _uint8ArrayToBuffer(chunk); - } + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; - if (addToFront) { - if (state.endEmitted) stream.emit('error', new Error('stream.unshift() after end event'));else addChunk(stream, state, chunk, true); - } else if (state.ended) { - stream.emit('error', new Error('stream.push() after EOF')); - } else { - state.reading = false; - if (state.decoder && !encoding) { - chunk = state.decoder.write(chunk); - if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); - } else { - addChunk(stream, state, chunk, false); + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; } } - } else if (!addToFront) { - state.reading = false; + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; } - } + }; - return needMoreData(state); -} +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; -function addChunk(stream, state, chunk, addToFront) { - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); - if (state.needReadable) emitReadable(stream); - } - maybeReadMore(stream, state); -} + if (index >= 0) { + var mapping = this._generatedMappings[index]; -function chunkInvalid(state, chunk) { - var er; - if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); -} + return { + source: null, + line: null, + column: null, + name: null + }; + }; -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = __webpack_require__(432).StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 to prevent increasing hwm excessively in - // tiny amounts - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} + var index = this._findSourceIndex(aSource); + if (index >= 0) { + return this.sourcesContent[index]; + } -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function howMuchToRead(n, state) { - if (n <= 0 || state.length === 0 && state.ended) return 0; - if (state.objectMode) return 1; - if (n !== n) { - // Only flow one buffer at a time - if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; - } - // If we're asking for more than the current hwm, then raise the hwm. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - if (n <= state.length) return n; - // Don't have enough - if (!state.ended) { - state.needReadable = true; - return 0; - } - return state.length; -} + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - n = parseInt(n, 10); - var state = this._readableState; - var nOrig = n; + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } - if (n !== 0) state.emittedReadable = false; + if ((!url.path || url.path == "/") + && this._sources.has("/" + relativeSource)) { + return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; + } + } - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + relativeSource + '" is not in the SourceMap.'); + } + }; - n = howMuchToRead(n, state); +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + source = this._findSourceIndex(source); + if (source < 0) { + return { + line: null, + column: null, + lastColumn: null + }; + } - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); + if (index >= 0) { + var mapping = this._originalMappings[index]; - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } else if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (!state.reading) n = howMuchToRead(nOrig, state); - } + return { + line: null, + column: null, + lastColumn: null + }; + }; - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; +exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - if (ret === null) { - state.needReadable = true; - n = 0; - } else { - state.length -= n; +/** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The first parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ +function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); } - if (state.length === 0) { - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (!state.ended) state.needReadable = true; + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended) endReadable(this); + if (version != this._version) { + throw new Error('Unsupported version: ' + version); } - if (ret !== null) this.emit('data', ret); + this._sources = new ArraySet(); + this._names = new ArraySet(); - return ret; -}; + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); } - } - state.ended = true; + lastOffset = offset; - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) + } + }); } -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) pna.nextTick(emitReadable_, stream);else emitReadable_(stream); - } -} +IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} +/** + * The version of the source mapping spec that we are consuming. + */ +IndexedSourceMapConsumer.prototype._version = 3; -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - pna.nextTick(maybeReadMore_, stream, state); +/** + * The list of original sources. + */ +Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; } -} +}); -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; - } - state.readingMore = false; -} +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('_read() is not implemented')); -}; + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; - var endFn = doEnd ? onend : unpipe; - if (state.endEmitted) pna.nextTick(endFn);else src.once('end', endFn); + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; - dest.on('unpipe', onunpipe); - function onunpipe(readable, unpipeInfo) { - debug('onunpipe'); - if (readable === src) { - if (unpipeInfo && unpipeInfo.hasUnpiped === false) { - unpipeInfo.hasUnpiped = true; - cleanup(); +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; } } - } - function onend() { - debug('onend'); - dest.end(); - } + return { + line: null, + column: null + }; + }; - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', unpipe); - src.removeListener('data', ondata); + var source = section.consumer._sources.at(mapping.source); + source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + this._sources.add(source); + source = this._sources.indexOf(source); - cleanedUp = true; + var name = null; + if (mapping.name) { + name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + } - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; - // If the user pushes more data while we're writing to dest then we'll end up - // in ondata again. However, we only want to increase awaitDrain once because - // dest will only emit one 'drain' event for the multiple writes. - // => Introduce a guard on increasing awaitDrain. - var increasedAwaitDrain = false; - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - increasedAwaitDrain = false; - var ret = dest.write(chunk); - if (false === ret && !increasedAwaitDrain) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - // => Check whether `dest` is still a piping destination. - if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - increasedAwaitDrain = true; + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } } - src.pause(); } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } - // Make sure our error handler is attached before userland ones. - prependListener(dest, 'error', onerror); + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); +exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - // tell the dest that it's being piped to - dest.emit('pipe', src); +/***/ }), +/* 820 */, +/* 821 */ +/***/ (function(module, __unusedexports, __webpack_require__) { - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } +var toString = __webpack_require__(428), + unescapeHtmlChar = __webpack_require__(673); - return dest; -}; +/** Used to match HTML entities and HTML characters. */ +var reEscapedHtml = /&(?:amp|lt|gt|quot|#39);/g, + reHasEscapedHtml = RegExp(reEscapedHtml.source); -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; +/** + * The inverse of `_.escape`; this method converts the HTML entities + * `&`, `<`, `>`, `"`, and `'` in `string` to + * their corresponding characters. + * + * **Note:** No other HTML entities are unescaped. To unescape additional + * HTML entities use a third-party library like [_he_](https://mths.be/he). + * + * @static + * @memberOf _ + * @since 0.6.0 + * @category String + * @param {string} [string=''] The string to unescape. + * @returns {string} Returns the unescaped string. + * @example + * + * _.unescape('fred, barney, & pebbles'); + * // => 'fred, barney, & pebbles' + */ +function unescape(string) { + string = toString(string); + return (string && reHasEscapedHtml.test(string)) + ? string.replace(reEscapedHtml, unescapeHtmlChar) + : string; } -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - var unpipeInfo = { hasUnpiped: false }; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; +module.exports = unescape; - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - if (!dest) dest = state.pipes; +/***/ }), +/* 822 */ +/***/ (function(module) { - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this, unpipeInfo); - return this; - } +"use strict"; - // slow case. multiple pipe destinations. - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; +if (typeof process === 'undefined' || + !process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = { nextTick: nextTick }; +} else { + module.exports = process +} - for (var i = 0; i < len; i++) { - dests[i].emit('unpipe', this, unpipeInfo); - }return this; +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); } +} - // try to find the right one. - var index = indexOf(state.pipes, dest); - if (index === -1) return this; - state.pipes.splice(index, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - dest.emit('unpipe', this, unpipeInfo); +/***/ }), +/* 823 */, +/* 824 */ +/***/ (function(module, __unusedexports, __webpack_require__) { - return this; -}; +var freeGlobal = __webpack_require__(973); -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - if (ev === 'data') { - // Start flowing on next tick if stream isn't explicitly paused - if (this._readableState.flowing !== false) this.resume(); - } else if (ev === 'readable') { - var state = this._readableState; - if (!state.endEmitted && !state.readableListening) { - state.readableListening = state.needReadable = true; - state.emittedReadable = false; - if (!state.reading) { - pna.nextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this); - } - } - } +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; +module.exports = root; -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; -}; +/***/ }), +/* 825 */, +/* 826 */ +/***/ (function(module) { -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - pna.nextTick(resume_, stream, state); - } -} +"use strict"; -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - state.resumeScheduled = false; - state.awaitDrain = 0; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} +/* eslint complexity: [2, 18], max-statements: [2, 33] */ +module.exports = function hasSymbols() { + if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } + if (typeof Symbol.iterator === 'symbol') { return true; } -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; + var obj = {}; + var sym = Symbol('test'); + var symObj = Object(sym); + if (typeof sym === 'string') { return false; } -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - while (state.flowing && stream.read() !== null) {} -} + if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } + if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var _this = this; + // temp disabled per https://github.com/ljharb/object.assign/issues/17 + // if (sym instanceof Symbol) { return false; } + // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 + // if (!(symObj instanceof Symbol)) { return false; } - var state = this._readableState; - var paused = false; + // if (typeof Symbol.prototype.toString !== 'function') { return false; } + // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) _this.push(chunk); - } + var symVal = 42; + obj[sym] = symVal; + for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax + if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } - _this.push(null); - }); + if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); + var syms = Object.getOwnPropertySymbols(obj); + if (syms.length !== 1 || syms[0] !== sym) { return false; } - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } - var ret = _this.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); + if (typeof Object.getOwnPropertyDescriptor === 'function') { + var descriptor = Object.getOwnPropertyDescriptor(obj, sym); + if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } + } - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } + return true; +}; - // proxy certain important events. - for (var n = 0; n < kProxyEvents.length; n++) { - stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); - } - // when we try to consume some more bytes, simply unpause the - // underlying stream. - this._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; +/***/ }), +/* 827 */, +/* 828 */ +/***/ (function(module, __unusedexports, __webpack_require__) { - return this; -}; +"use strict"; -Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function () { - return this._readableState.highWaterMark; - } -}); -// exposed for testing purposes only. -Readable._fromList = fromList; +/**/ -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromList(n, state) { - // nothing buffered - if (state.length === 0) return null; +var pna = __webpack_require__(822); +/**/ - var ret; - if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { - // read it all, truncate the list - if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length); - state.buffer.clear(); - } else { - // read part of list - ret = fromListPartial(n, state.buffer, state.decoder); +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { + pna.nextTick(emitErrorNT, this, err); + } + return this; } - return ret; -} + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks -// Extracts only enough buffered data to satisfy the amount requested. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function fromListPartial(n, list, hasStrings) { - var ret; - if (n < list.head.data.length) { - // slice is the same for buffers and strings - ret = list.head.data.slice(0, n); - list.head.data = list.head.data.slice(n); - } else if (n === list.head.data.length) { - // first chunk is a perfect match - ret = list.shift(); - } else { - // result spans more than one buffer - ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list); + if (this._readableState) { + this._readableState.destroyed = true; } - return ret; -} -// Copies a specified amount of characters from the list of buffered data -// chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBufferString(n, list) { - var p = list.head; - var c = 1; - var ret = p.data; - n -= ret.length; - while (p = p.next) { - var str = p.data; - var nb = n > str.length ? str.length : n; - if (nb === str.length) ret += str;else ret += str.slice(0, n); - n -= nb; - if (n === 0) { - if (nb === str.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = str.slice(nb); - } - break; - } - ++c; + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; } - list.length -= c; - return ret; -} -// Copies a specified amount of bytes from the list of buffered data chunks. -// This function is designed to be inlinable, so please take care when making -// changes to the function body. -function copyFromBuffer(n, list) { - var ret = Buffer.allocUnsafe(n); - var p = list.head; - var c = 1; - p.data.copy(ret); - n -= p.data.length; - while (p = p.next) { - var buf = p.data; - var nb = n > buf.length ? buf.length : n; - buf.copy(ret, ret.length - n, 0, nb); - n -= nb; - if (n === 0) { - if (nb === buf.length) { - ++c; - if (p.next) list.head = p.next;else list.head = list.tail = null; - } else { - list.head = p; - p.data = buf.slice(nb); + this._destroy(err || null, function (err) { + if (!cb && err) { + pna.nextTick(emitErrorNT, _this, err); + if (_this._writableState) { + _this._writableState.errorEmitted = true; } - break; + } else if (cb) { + cb(err); } - ++c; - } - list.length -= c; - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; + }); - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('"endReadable()" called on non-empty stream'); + return this; +} - if (!state.endEmitted) { - state.ended = true; - pna.nextTick(endReadableNT, state, stream); +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; } -} -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; } } -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; +function emitErrorNT(self, err) { + self.emit('error', err); } +module.exports = { + destroy: destroy, + undestroy: undestroy +}; + /***/ }), -/* 818 */ +/* 829 */ /***/ (function(module, __unusedexports, __webpack_require__) { -module.exports = isexe -isexe.sync = sync - -var fs = __webpack_require__(747) - -function checkPathExt (path, options) { - var pathext = options.pathExt !== undefined ? - options.pathExt : process.env.PATHEXT - - if (!pathext) { - return true - } - - pathext = pathext.split(';') - if (pathext.indexOf('') !== -1) { - return true - } - for (var i = 0; i < pathext.length; i++) { - var p = pathext[i].toLowerCase() - if (p && path.substr(-p.length).toLowerCase() === p) { - return true - } - } - return false -} +const compareBuild = __webpack_require__(783) +const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) +module.exports = sort -function checkStat (stat, path, options) { - if (!stat.isSymbolicLink() && !stat.isFile()) { - return false - } - return checkPathExt(path, options) -} -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, path, options)) - }) -} +/***/ }), +/* 830 */ +/***/ (function(module, exports, __webpack_require__) { -function sync (path, options) { - return checkStat(fs.statSync(path), path, options) -} +"use strict"; -/***/ }), -/* 819 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { +exports.__esModule = true; +exports.default = void 0; -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ +var _supportsColor = _interopRequireDefault(__webpack_require__(31)); -var util = __webpack_require__(992); -var binarySearch = __webpack_require__(481); -var ArraySet = __webpack_require__(845).ArraySet; -var base64VLQ = __webpack_require__(167); -var quickSort = __webpack_require__(569).quickSort; +var _chalk = _interopRequireDefault(__webpack_require__(507)); -function SourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } +var _terminalHighlight = _interopRequireDefault(__webpack_require__(958)); - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) - : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); -} +function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } -/** - * The version of the source mapping spec that we are consuming. - */ -SourceMapConsumer.prototype._version = 3; +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } -// `__generatedMappings` and `__originalMappings` are arrays that hold the -// parsed mapping coordinates from the source map's "mappings" attribute. They -// are lazily instantiated, accessed via the `_generatedMappings` and -// `_originalMappings` getters respectively, and we only parse the mappings -// and create these arrays once queried for a source location. We jump through -// these hoops because there can be many thousands of mappings, and parsing -// them is expensive, so we only want to do it if we must. -// -// Each object in the arrays is of the form: -// -// { -// generatedLine: The line number in the generated code, -// generatedColumn: The column number in the generated code, -// source: The path to the original source file that generated this -// chunk of code, -// originalLine: The line number in the original source that -// corresponds to this chunk of generated code, -// originalColumn: The column number in the original source that -// corresponds to this chunk of generated code, -// name: The name of the original symbol which generated this chunk of -// code. -// } -// -// All properties except for `generatedLine` and `generatedColumn` can be -// `null`. -// -// `_generatedMappings` is ordered by the generated positions. -// -// `_originalMappings` is ordered by the original positions. +function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); } -SourceMapConsumer.prototype.__generatedMappings = null; -Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } +function isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - return this.__generatedMappings; - } -}); +function _construct(Parent, args, Class) { if (isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } -SourceMapConsumer.prototype.__originalMappings = null; -Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } +function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } - return this.__originalMappings; - } -}); +function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } -SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; +function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } /** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). + * The CSS parser throws this error for broken CSS. + * + * Custom parsers can throw this error for broken custom syntax using + * the {@link Node#error} method. + * + * PostCSS will use the input source map to detect the original error location. + * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS, + * PostCSS will show the original position in the Sass file. + * + * If you need the position in the PostCSS input + * (e.g., to debug the previous compiler), use `error.input.file`. + * + * @example + * // Catching and checking syntax error + * try { + * postcss.parse('a{') + * } catch (error) { + * if (error.name === 'CssSyntaxError') { + * error //=> CssSyntaxError + * } + * } + * + * @example + * // Raising error from plugin + * throw node.error('Unknown variable', { plugin: 'postcss-vars' }) */ -SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; +var CssSyntaxError = +/*#__PURE__*/ +function (_Error) { + _inheritsLoose(CssSyntaxError, _Error); -SourceMapConsumer.GENERATED_ORDER = 1; -SourceMapConsumer.ORIGINAL_ORDER = 2; + /** + * @param {string} message Error message. + * @param {number} [line] Source line of the error. + * @param {number} [column] Source column of the error. + * @param {string} [source] Source code of the broken file. + * @param {string} [file] Absolute path to the broken file. + * @param {string} [plugin] PostCSS plugin name, if error came from plugin. + */ + function CssSyntaxError(message, line, column, source, file, plugin) { + var _this; -SourceMapConsumer.GREATEST_LOWER_BOUND = 1; -SourceMapConsumer.LEAST_UPPER_BOUND = 2; + _this = _Error.call(this, message) || this; + /** + * Always equal to `'CssSyntaxError'`. You should always check error type + * by `error.name === 'CssSyntaxError'` + * instead of `error instanceof CssSyntaxError`, + * because npm could have several PostCSS versions. + * + * @type {string} + * + * @example + * if (error.name === 'CssSyntaxError') { + * error //=> CssSyntaxError + * } + */ -/** - * Iterate over each mapping between an original source/line/column and a - * generated line/column in this source map. - * - * @param Function aCallback - * The function that is called with each mapping. - * @param Object aContext - * Optional. If specified, this object will be the value of `this` every - * time that `aCallback` is called. - * @param aOrder - * Either `SourceMapConsumer.GENERATED_ORDER` or - * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to - * iterate over the mappings sorted by the generated file's line/column - * order or the original's source/line/column order, respectively. Defaults to - * `SourceMapConsumer.GENERATED_ORDER`. - */ -SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + _this.name = 'CssSyntaxError'; + /** + * Error message. + * + * @type {string} + * + * @example + * error.message //=> 'Unclosed block' + */ - var mappings; - switch (order) { - case SourceMapConsumer.GENERATED_ORDER: - mappings = this._generatedMappings; - break; - case SourceMapConsumer.ORIGINAL_ORDER: - mappings = this._originalMappings; - break; - default: - throw new Error("Unknown order of iteration."); + _this.reason = message; + + if (file) { + /** + * Absolute path to the broken file. + * + * @type {string} + * + * @example + * error.file //=> 'a.sass' + * error.input.file //=> 'a.css' + */ + _this.file = file; } - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - return { - source: source, - generatedLine: mapping.generatedLine, - generatedColumn: mapping.generatedColumn, - originalLine: mapping.originalLine, - originalColumn: mapping.originalColumn, - name: mapping.name === null ? null : this._names.at(mapping.name) - }; - }, this).forEach(aCallback, context); - }; + if (source) { + /** + * Source code of the broken file. + * + * @type {string} + * + * @example + * error.source //=> 'a { b {} }' + * error.input.column //=> 'a b { }' + */ + _this.source = source; + } -/** - * Returns all generated line and column information for the original source, - * line, and column provided. If no column is provided, returns all mappings - * corresponding to a either the line we are searching for or the next - * closest line that has any mappings. Otherwise, returns all mappings - * corresponding to the given line and either the column we are searching for - * or the next closest column that has any offsets. - * - * The only argument is an object with the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number is 1-based. - * - column: Optional. the column number in the original source. - * The column number is 0-based. - * - * and an array of objects is returned, each with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ -SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var line = util.getArg(aArgs, 'line'); + if (plugin) { + /** + * Plugin name, if error came from plugin. + * + * @type {string} + * + * @example + * error.plugin //=> 'postcss-vars' + */ + _this.plugin = plugin; + } + + if (typeof line !== 'undefined' && typeof column !== 'undefined') { + /** + * Source line of the error. + * + * @type {number} + * + * @example + * error.line //=> 2 + * error.input.line //=> 4 + */ + _this.line = line; + /** + * Source column of the error. + * + * @type {number} + * + * @example + * error.column //=> 1 + * error.input.column //=> 4 + */ - // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping - // returns the index of the closest mapping less than the needle. By - // setting needle.originalColumn to 0, we thus find the last mapping for - // the given line, provided such a mapping exists. - var needle = { - source: util.getArg(aArgs, 'source'), - originalLine: line, - originalColumn: util.getArg(aArgs, 'column', 0) - }; + _this.column = column; + } - needle.source = this._findSourceIndex(needle.source); - if (needle.source < 0) { - return []; + _this.setMessage(); + + if (Error.captureStackTrace) { + Error.captureStackTrace(_assertThisInitialized(_this), CssSyntaxError); } - var mappings = []; + return _this; + } - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; + var _proto = CssSyntaxError.prototype; - if (aArgs.column === undefined) { - var originalLine = mapping.originalLine; + _proto.setMessage = function setMessage() { + /** + * Full error text in the GNU error format + * with plugin, file, line and column. + * + * @type {string} + * + * @example + * error.message //=> 'a.css:1:1: Unclosed block' + */ + this.message = this.plugin ? this.plugin + ': ' : ''; + this.message += this.file ? this.file : ''; - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we found. Since - // mappings are sorted, this is guaranteed to find all mappings for - // the line we found. - while (mapping && mapping.originalLine === originalLine) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); + if (typeof this.line !== 'undefined') { + this.message += ':' + this.line + ':' + this.column; + } - mapping = this._originalMappings[++index]; - } - } else { - var originalColumn = mapping.originalColumn; + this.message += ': ' + this.reason; + } + /** + * Returns a few lines of CSS source that caused the error. + * + * If the CSS has an input source map without `sourceContent`, + * this method will return an empty string. + * + * @param {boolean} [color] Whether arrow will be colored red by terminal + * color codes. By default, PostCSS will detect + * color support by `process.stdout.isTTY` + * and `process.env.NODE_DISABLE_COLORS`. + * + * @example + * error.showSourceCode() //=> " 4 | } + * // 5 | a { + * // > 6 | bad + * // | ^ + * // 7 | } + * // 8 | b {" + * + * @return {string} Few lines of CSS source that caused the error. + */ + ; - // Iterate until either we run out of mappings, or we run into - // a mapping for a different line than the one we were searching for. - // Since mappings are sorted, this is guaranteed to find all mappings for - // the line we are searching for. - while (mapping && - mapping.originalLine === line && - mapping.originalColumn == originalColumn) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); + _proto.showSourceCode = function showSourceCode(color) { + var _this2 = this; - mapping = this._originalMappings[++index]; - } + if (!this.source) return ''; + var css = this.source; + + if (_terminalHighlight.default) { + if (typeof color === 'undefined') color = _supportsColor.default.stdout; + if (color) css = (0, _terminalHighlight.default)(css); + } + + var lines = css.split(/\r?\n/); + var start = Math.max(this.line - 3, 0); + var end = Math.min(this.line + 2, lines.length); + var maxWidth = String(end).length; + + function mark(text) { + if (color && _chalk.default.red) { + return _chalk.default.red.bold(text); } + + return text; } - return mappings; - }; + function aside(text) { + if (color && _chalk.default.gray) { + return _chalk.default.gray(text); + } -exports.SourceMapConsumer = SourceMapConsumer; + return text; + } -/** - * A BasicSourceMapConsumer instance represents a parsed source map which we can - * query for information about the original file positions by giving it a file - * position in the generated source. - * - * The first parameter is the raw source map (either as a JSON string, or - * already parsed to an object). According to the spec, source maps have the - * following attributes: - * - * - version: Which version of the source map spec this map is following. - * - sources: An array of URLs to the original source files. - * - names: An array of identifiers which can be referrenced by individual mappings. - * - sourceRoot: Optional. The URL root from which all sources are relative. - * - sourcesContent: Optional. An array of contents of the original source files. - * - mappings: A string of base64 VLQs which contain the actual mappings. - * - file: Optional. The generated file this source map is associated with. - * - * Here is an example source map, taken from the source map spec[0]: - * - * { - * version : 3, - * file: "out.js", - * sourceRoot : "", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AA,AB;;ABCDE;" - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# - */ -function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } + return lines.slice(start, end).map(function (line, index) { + var number = start + 1 + index; + var gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | '; - var version = util.getArg(sourceMap, 'version'); - var sources = util.getArg(sourceMap, 'sources'); - // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which - // requires the array) to play nice here. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var file = util.getArg(sourceMap, 'file', null); + if (number === _this2.line) { + var spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, _this2.column - 1).replace(/[^\t]/g, ' '); + return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^'); + } - // Once again, Sass deviates from the spec and supplies the version as a - // string rather than a number, so we use loose equality checking here. - if (version != this._version) { - throw new Error('Unsupported version: ' + version); + return ' ' + aside(gutter) + line; + }).join('\n'); } + /** + * Returns error position, message and source code of the broken part. + * + * @example + * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block + * // > 1 | a { + * // | ^" + * + * @return {string} Error position, message and source code. + */ + ; - if (sourceRoot) { - sourceRoot = util.normalize(sourceRoot); + _proto.toString = function toString() { + var code = this.showSourceCode(); + + if (code) { + code = '\n\n' + code + '\n'; + } + + return this.name + ': ' + this.message + code; } + /** + * @memberof CssSyntaxError# + * @member {Input} input Input object with PostCSS internal information + * about input file. If input has source map + * from previous tool, PostCSS will use origin + * (for example, Sass) source. You can use this + * object to get PostCSS input source. + * + * @example + * error.input.file //=> 'a.css' + * error.file //=> 'a.sass' + */ + ; - sources = sources - .map(String) - // Some source maps produce relative source paths like "./foo.js" instead of - // "foo.js". Normalize these first so that future comparisons will succeed. - // See bugzil.la/1090768. - .map(util.normalize) - // Always ensure that absolute sources are internally stored relative to - // the source root, if the source root is absolute. Not doing this would - // be particularly problematic when the source root is a prefix of the - // source (valid, but why??). See github issue #199 and bugzil.la/1188982. - .map(function (source) { - return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) - ? util.relative(sourceRoot, source) - : source; - }); + return CssSyntaxError; +}(_wrapNativeSuper(Error)); - // Pass `true` below to allow duplicate names and sources. While source maps - // are intended to be compressed and deduplicated, the TypeScript compiler - // sometimes generates source maps with duplicates in them. See Github issue - // #72 and bugzil.la/889492. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); +var _default = CssSyntaxError; +exports.default = _default; +module.exports = exports.default; +//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNzcy1zeW50YXgtZXJyb3IuZXM2Il0sIm5hbWVzIjpbIkNzc1N5bnRheEVycm9yIiwibWVzc2FnZSIsImxpbmUiLCJjb2x1bW4iLCJzb3VyY2UiLCJmaWxlIiwicGx1Z2luIiwibmFtZSIsInJlYXNvbiIsInNldE1lc3NhZ2UiLCJFcnJvciIsImNhcHR1cmVTdGFja1RyYWNlIiwic2hvd1NvdXJjZUNvZGUiLCJjb2xvciIsImNzcyIsInRlcm1pbmFsSGlnaGxpZ2h0Iiwic3VwcG9ydHNDb2xvciIsInN0ZG91dCIsImxpbmVzIiwic3BsaXQiLCJzdGFydCIsIk1hdGgiLCJtYXgiLCJlbmQiLCJtaW4iLCJs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ICpcbiAgICAgICAqIEB0eXBlIHtzdHJpbmd9XG4gICAgICAgKlxuICAgICAgICogQGV4YW1wbGVcbiAgICAgICAqIGVycm9yLnNvdXJjZSAgICAgICAvLz0+ICdhIHsgYiB7fSB9J1xuICAgICAgICogZXJyb3IuaW5wdXQuY29sdW1uIC8vPT4gJ2EgYiB7IH0nXG4gICAgICAgKi9cbiAgICAgIHRoaXMuc291cmNlID0gc291cmNlXG4gICAgfVxuICAgIGlmIChwbHVnaW4pIHtcbiAgICAgIC8qKlxuICAgICAgICogUGx1Z2luIG5hbWUsIGlmIGVycm9yIGNhbWUgZnJvbSBwbHVnaW4uXG4gICAgICAgKlxuICAgICAgICogQHR5cGUge3N0cmluZ31cbiAgICAgICAqXG4gICAgICAgKiBAZXhhbXBsZVxuICAgICAgICogZXJyb3IucGx1Z2luIC8vPT4gJ3Bvc3Rjc3MtdmFycydcbiAgICAgICAqL1xuICAgICAgdGhpcy5wbHVnaW4gPSBwbHVnaW5cbiAgICB9XG4gICAgaWYgKHR5cGVvZiBsaW5lICE9PSAndW5kZWZpbmVkJyAmJiB0eXBlb2YgY29sdW1uICE9PSAndW5kZWZpbmVkJykge1xuICAgICAgLyoqXG4gICAgICAgKiBTb3VyY2UgbGluZSBvZiB0aGUgZXJyb3IuXG4gICAgICAgKlxuICAgICAgICogQHR5cGUge251bWJlcn1cbiAgICAgICAqXG4gICAgICAgKiBAZXhhbXBsZVxuICAgICAgICogZXJyb3IubGluZSAgICAgICAvLz0+IDJcbiAgICAgICAqIGVycm9yLmlucHV0LmxpbmUgLy89PiA0XG4gICAgICAgKi9cbiAgICAgIHRoaXMubGluZSA9IGxpbmVcbiAgICAgIC8qKlxuICAgICAgICogU291cmNlIGNvbHVtbiBvZiB0aGUgZXJyb3IuXG4gICAgICAgKlxuICAgICAgICogQHR5cGUge251bWJlcn1cbiAgICAgICAqXG4gICAgICAgKiBAZXhhbXBsZVxuICAgICAgICogZXJyb3IuY29sdW1uICAgICAgIC8vPT4gMVx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zIGFuIGlucHV0IHNvdXJjZSBtYXAgd2l0aG91dCBgc291cmNlQ29udGVudGAsXG4gICAqIHRoaXMgbWV0aG9kIHdpbGwgcmV0dXJuIGFuIGVtcHR5IHN0cmluZy5cbiAgICpcbiAgICogQHBhcmFtIHtib29sZWFufSBbY29sb3JdIFdoZXRoZXIgYXJyb3cgd2lsbCBiZSBjb2xvcmVkIHJlZCBieSB0ZXJtaW5hbFxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgY29sb3IgY29kZXMuIEJ5IGRlZmF1bHQsIFBvc3RDU1Mgd2lsbCBkZXRlY3RcbiAgICogICAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yIHN1cHBvcnQgYnkgYHByb2Nlc3Muc3Rkb3V0LmlzVFRZYFxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgYW5kIGBwcm9jZXNzLmVudi5OT0RFX0RJU0FCTEVfQ09MT1JTYC5cbiAgICpcbiAgICogQGV4YW1wbGVcbiAgICogZXJyb3Iuc2hvd1NvdXJjZUNvZGUoKSAvLz0+IFwiICA0IHwgfVxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgNSB8IGEge1xuICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgID4gNiB8ICAgYmFkXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICAgIHwgICBeXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICA3IHwgfVxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgOCB8IGIge1wiXG4gICAqXG4gICAqIEByZXR1cm4ge3N0cmluZ30gRmV3IGxpbmVzIG9mIENTUyBzb3VyY2UgdGhhdCBjYXVzZWQgdGhlIGVycm9yLlxuICAgKi9cbiAgc2hvd1NvdXJjZUNvZGUgKGNvbG9yKSB7XG4gICAgaWYgKCF0aGlzLnNvdXJjZSkgcmV0dXJuICcnXG5cbiAgICBsZXQgY3NzID0gdGhpcy5zb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IucmVwbGFjZSgvXFxkL2csICcgJykpICtcbiAgICAgICAgICBsaW5lLnNsaWNlKDAsIHRoaXMuY29sdW1uIC0gMSkucmVwbGFjZSgvW15cXHRdL2csICcgJylcbiAgICAgICAgcmV0dXJuIG1hcmsoJz4nKSArIGFzaWRlKGd1dHRlcikgKyBsaW5lICsgJ1xcbiAnICsgc3BhY2luZyArIG1hcmsoJ14nKVxuICAgICAgfVxuICAgICAgcmV0dXJuICcgJyArIGFzaWRlKGd1dHRlcikgKyBsaW5lXG4gICAgfSkuam9pbignXFxuJylcbiAgfVxuXG4gIC8qKlxuICAgKiBSZXR1cm5zIGVycm9yIHBvc2l0aW9uLCBtZXNzYWdlIGFuZCBzb3VyY2UgY29kZSBvZiB0aGUgYnJva2VuIHBhcnQuXG4gICAqXG4gICAqIEBleGFtcGxlXG4gICAqIGVycm9yLnRvU3RyaW5nKCkgLy89PiBcIkNzc1N5bnRheEVycm9yOiBhcHAuY3NzOjE6MTogVW5jbG9zZWQgYmxvY2tcbiAgICogICAgICAgICAgICAgICAgICAvLyAgICA+IDEgfCBhIHtcbiAgICogICAgICAgICAgICAgICAgICAvLyAgICAgICAgfCBeXCJcbiAgICpcbiAgICogQHJldHVybiB7c3RyaW5nfSBFcnJvciBwb3NpdGlvbiwgbWVzc2FnZSBhbmQgc291cmNlIGNvZGUuXG4gICAqL1xuICB0b1N0cmluZyAoKSB7XG4gICAgbGV0IGNvZGUgPSB0aGlzLnNob3dTb3VyY2VDb2RlKClcbiAgICBpZiAoY29kZSkge1xuICAgICAgY29kZSA9ICdcXG5cXG4nICsgY29kZSArICdcXG4nXG4gICAgfVxuICAgIHJldHVybiB0aGlzLm5hbWUgKyAnOiAnICsgdGhpcy5tZXNzYWdlICsgY29kZVxuICB9XG5cbiAgLyoqXG4gICAqIEBtZW1iZXJvZiBDc3NTeW50YXhFcnJvciNcbiAgICogQG1lbWJlciB7SW5wdXR9IGlucHV0IElucHV0IG9iamVjdCB3aXRoIFBvc3RDU1MgaW50ZXJuYWwgaW5mb3JtYXRpb25cbiAgICogICAgICAgICAgICAgICAgICAgICAgIGFib3V0IGlucHV0IGZpbGUuIElmIGlucHV0IGhhcyBzb3VyY2UgbWFwXG4gICAqICAgICAgICAgICAgICAgICAgICAgICBmcm9tIHByZXZpb3VzIHRvb2wsIFBvc3RDU1Mgd2lsbCB1c2Ugb3JpZ2luXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAoZm9yIGV4YW1wbGUsIFNhc3MpIHNvdXJjZS4gWW91IGNhbiB1c2UgdGhpc1xuICAgKiAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0IHRvIGdldCBQb3N0Q1NTIGlucHV0IHNvdXJjZS5cbiAgICpcbiAgICogQGV4YW1wbGVcbiAgICogZXJyb3IuaW5wdXQuZmlsZSAvLz0+ICdhLmNzcydcbiAgICogZXJyb3IuZmlsZSAgICAgICAvLz0+ICdhLnNhc3MnXG4gICAqL1xufVxuXG5leHBvcnQgZGVmYXVsdCBDc3NTeW50YXhFcnJvclxuIl0sImZpbGUiOiJjc3Mtc3ludGF4LWVycm9yLmpzIn0= - this._absoluteSources = this._sources.toArray().map(function (s) { - return util.computeSourceURL(sourceRoot, s, aSourceMapURL); - }); - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this._sourceMapURL = aSourceMapURL; - this.file = file; -} +/***/ }), +/* 831 */ +/***/ (function(module, __unusedexports, __webpack_require__) { -BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); -BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. -/** - * Utility function to find the index of a source. Returns -1 if not - * found. - */ -BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } +/**/ - if (this._sources.has(relativeSource)) { - return this._sources.indexOf(relativeSource); - } +var objectKeys = Object.keys || function (obj) { + var keys = []; - // Maybe aSource is an absolute URL as returned by |sources|. In - // this case we can't simply undo the transform. - var i; - for (i = 0; i < this._absoluteSources.length; ++i) { - if (this._absoluteSources[i] == aSource) { - return i; - } + for (var key in obj) { + keys.push(key); } - return -1; + return keys; }; +/**/ -/** - * Create a BasicSourceMapConsumer from a SourceMapGenerator. - * - * @param SourceMapGenerator aSourceMap - * The source map that will be consumed. - * @param String aSourceMapURL - * The URL at which the source map can be found (optional) - * @returns BasicSourceMapConsumer - */ -BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - smc._sourceMapURL = aSourceMapURL; - smc._absoluteSources = smc._sources.toArray().map(function (s) { - return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); - }); - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; +module.exports = Duplex; - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; +var Readable = __webpack_require__(226); - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; +var Writable = __webpack_require__(241); - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } +__webpack_require__(689)(Duplex, Readable); - destOriginalMappings.push(destMapping); - } +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); - destGeneratedMappings.push(destMapping); - } + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} - quickSort(smc.__originalMappings, util.compareByOriginalPositions); +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; - return smc; - }; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; -/** - * The version of the source mapping spec that we are consuming. - */ -BasicSourceMapConsumer.prototype._version = 3; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} -/** - * The list of original sources. - */ -Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._absoluteSources.slice(); +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); } }); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); // the no-half-open enforcer -/** - * Provide the JIT with a nice shape / hidden class. - */ -function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = null; +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; // no more data can be written. + // But allow more writes to happen in this tick. + + process.nextTick(onEndNT, this); } -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; +function onEndNT(self) { + self.end(); +} - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } - // Because each offset is encoded relative to the previous one, - // many segments often have the same encoding. We can exploit this - // fact by caching the parsed variable length fields of each segment, - // allowing us to avoid a second parse if we encounter the same - // segment again. - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } // backward compatibility, the user is explicitly + // managing destroyed - segment = cachedSegments[str]; - if (segment) { - index += str.length; - } else { - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } +/***/ }), +/* 832 */ +/***/ (function(module, __unusedexports, __webpack_require__) { - cachedSegments[str] = segment; - } +"use strict"; - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; +module.exports = __webpack_require__(271).default; - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; +/***/ }), +/* 833 */ +/***/ (function(__unusedmodule, exports, __webpack_require__) { - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } +"use strict"; - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - originalMappings.push(mapping); +Object.defineProperty(exports, "__esModule", { value: true }); +const ts = __webpack_require__(752); +const node_1 = __webpack_require__(10); +const _3_2_1 = __webpack_require__(770); +const type_1 = __webpack_require__(90); +function getChildOfKind(node, kind, sourceFile) { + for (const child of node.getChildren(sourceFile)) + if (child.kind === kind) + return child; +} +exports.getChildOfKind = getChildOfKind; +function isTokenKind(kind) { + return kind >= ts.SyntaxKind.FirstToken && kind <= ts.SyntaxKind.LastToken; +} +exports.isTokenKind = isTokenKind; +function isNodeKind(kind) { + return kind >= ts.SyntaxKind.FirstNode; +} +exports.isNodeKind = isNodeKind; +function isAssignmentKind(kind) { + return kind >= ts.SyntaxKind.FirstAssignment && kind <= ts.SyntaxKind.LastAssignment; +} +exports.isAssignmentKind = isAssignmentKind; +function isTypeNodeKind(kind) { + return kind >= ts.SyntaxKind.FirstTypeNode && kind <= ts.SyntaxKind.LastTypeNode; +} +exports.isTypeNodeKind = isTypeNodeKind; +function isJsDocKind(kind) { + return kind >= ts.SyntaxKind.FirstJSDocNode && kind <= ts.SyntaxKind.LastJSDocNode; +} +exports.isJsDocKind = isJsDocKind; +function isKeywordKind(kind) { + return kind >= ts.SyntaxKind.FirstKeyword && kind <= ts.SyntaxKind.LastKeyword; +} +exports.isKeywordKind = isKeywordKind; +function isThisParameter(parameter) { + return parameter.name.kind === ts.SyntaxKind.Identifier && parameter.name.originalKeywordKind === ts.SyntaxKind.ThisKeyword; +} +exports.isThisParameter = isThisParameter; +function getModifier(node, kind) { + if (node.modifiers !== undefined) + for (const modifier of node.modifiers) + if (modifier.kind === kind) + return modifier; +} +exports.getModifier = getModifier; +function hasModifier(modifiers, ...kinds) { + if (modifiers === undefined) + return false; + for (const modifier of modifiers) + if (kinds.includes(modifier.kind)) + return true; + return false; +} +exports.hasModifier = hasModifier; +function isParameterProperty(node) { + return hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword, ts.SyntaxKind.ReadonlyKeyword); +} +exports.isParameterProperty = isParameterProperty; +function hasAccessModifier(node) { + return hasModifier(node.modifiers, ts.SyntaxKind.PublicKeyword, ts.SyntaxKind.ProtectedKeyword, ts.SyntaxKind.PrivateKeyword); +} +exports.hasAccessModifier = hasAccessModifier; +function isFlagSet(obj, flag) { + return (obj.flags & flag) !== 0; +} +exports.isNodeFlagSet = isFlagSet; +exports.isTypeFlagSet = isFlagSet; +exports.isSymbolFlagSet = isFlagSet; +function isObjectFlagSet(objectType, flag) { + return (objectType.objectFlags & flag) !== 0; +} +exports.isObjectFlagSet = isObjectFlagSet; +function isModifierFlagSet(node, flag) { + return (ts.getCombinedModifierFlags(node) & flag) !== 0; +} +exports.isModifierFlagSet = isModifierFlagSet; +function getPreviousStatement(statement) { + const parent = statement.parent; + if (node_1.isBlockLike(parent)) { + const index = parent.statements.indexOf(statement); + if (index > 0) + return parent.statements[index - 1]; + } +} +exports.getPreviousStatement = getPreviousStatement; +function getNextStatement(statement) { + const parent = statement.parent; + if (node_1.isBlockLike(parent)) { + const index = parent.statements.indexOf(statement); + if (index < parent.statements.length) + return parent.statements[index + 1]; + } +} +exports.getNextStatement = getNextStatement; +function getPreviousToken(node, sourceFile) { + let parent = node.parent; + while (parent !== undefined && parent.pos === node.pos) + parent = parent.parent; + if (parent === undefined) + return; + outer: while (true) { + const children = parent.getChildren(sourceFile); + for (let i = children.length - 1; i >= 0; --i) { + const child = children[i]; + if (child.pos < node.pos && child.kind !== ts.SyntaxKind.JSDocComment) { + if (isTokenKind(child.kind)) + return child; + parent = child; + continue outer; + } } - } + return; } - - quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); - this.__generatedMappings = generatedMappings; - - quickSort(originalMappings, util.compareByOriginalPositions); - this.__originalMappings = originalMappings; - }; - -/** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ -BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, - aColumnName, aComparator, aBias) { - // To return the position we are searching for, we must first find the - // mapping for the given position and then return the opposite position it - // points to. Because the mappings are sorted, we can use binary search to - // find the best mapping. - - if (aNeedle[aLineName] <= 0) { - throw new TypeError('Line must be greater than or equal to 1, got ' - + aNeedle[aLineName]); +} +exports.getPreviousToken = getPreviousToken; +function getNextToken(node, sourceFile = node.getSourceFile()) { + if (node.kind === ts.SyntaxKind.SourceFile || node.kind === ts.SyntaxKind.EndOfFileToken) + return; + const end = node.end; + node = node.parent; + while (node.end === end) { + if (node.parent === undefined) + return node.endOfFileToken; + node = node.parent; } - if (aNeedle[aColumnName] < 0) { - throw new TypeError('Column must be greater than or equal to 0, got ' - + aNeedle[aColumnName]); + return getTokenAtPositionWorker(node, end, sourceFile, false); +} +exports.getNextToken = getNextToken; +function getTokenAtPosition(parent, pos, sourceFile, allowJsDoc) { + if (pos < parent.pos || pos >= parent.end) + return; + if (isTokenKind(parent.kind)) + return parent; + if (sourceFile === undefined) + sourceFile = parent.getSourceFile(); + return getTokenAtPositionWorker(parent, pos, sourceFile, allowJsDoc === true); +} +exports.getTokenAtPosition = getTokenAtPosition; +function getTokenAtPositionWorker(node, pos, sourceFile, allowJsDoc) { + outer: while (true) { + for (const child of node.getChildren(sourceFile)) { + if (child.end > pos && (allowJsDoc || child.kind !== ts.SyntaxKind.JSDocComment)) { + if (isTokenKind(child.kind)) + return child; + node = child; + continue outer; + } + } + return; } - - return binarySearch.search(aNeedle, aMappings, aComparator, aBias); - }; - -/** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ -BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; +} +function getCommentAtPosition(sourceFile, pos, parent = sourceFile) { + const token = getTokenAtPosition(parent, pos, sourceFile); + if (token === undefined || token.kind === ts.SyntaxKind.JsxText || pos >= token.end - (ts.tokenToString(token.kind) || '').length) + return; + const startPos = token.pos === 0 + ? (ts.getShebang(sourceFile.text) || '').length + : token.pos; + return startPos !== 0 && ts.forEachTrailingCommentRange(sourceFile.text, startPos, commentAtPositionCallback, pos) || + ts.forEachLeadingCommentRange(sourceFile.text, startPos, commentAtPositionCallback, pos); +} +exports.getCommentAtPosition = getCommentAtPosition; +function commentAtPositionCallback(pos, end, kind, _nl, at) { + return at >= pos && at < end ? { pos, end, kind } : undefined; +} +function isPositionInComment(sourceFile, pos, parent) { + return getCommentAtPosition(sourceFile, pos, parent) !== undefined; +} +exports.isPositionInComment = isPositionInComment; +function commentText(sourceText, comment) { + return sourceText.substring(comment.pos + 2, comment.kind === ts.SyntaxKind.SingleLineCommentTrivia ? comment.end : comment.end - 2); +} +exports.commentText = commentText; +function getWrappedNodeAtPosition(wrap, pos) { + if (wrap.node.pos > pos || wrap.node.end <= pos) + return; + outer: while (true) { + for (const child of wrap.children) { + if (child.node.pos > pos) + return wrap; + if (child.node.end > pos) { + wrap = child; + continue outer; + } + } + return wrap; + } +} +exports.getWrappedNodeAtPosition = getWrappedNodeAtPosition; +function getPropertyName(propertyName) { + if (propertyName.kind === ts.SyntaxKind.ComputedPropertyName) { + if (!node_1.isLiteralExpression(propertyName.expression)) + return; + if (_3_2_1.isBigIntLiteral(propertyName.expression)) + return propertyName.expression.text.slice(0, -1); + return propertyName.expression.text; + } + return propertyName.text; +} +exports.getPropertyName = getPropertyName; +function forEachDestructuringIdentifier(pattern, fn) { + for (const element of pattern.elements) { + if (element.kind !== ts.SyntaxKind.BindingElement) + continue; + let result; + if (element.name.kind === ts.SyntaxKind.Identifier) { + result = fn(element); + } + else { + result = forEachDestructuringIdentifier(element.name, fn); + } + if (result) + return result; + } +} +exports.forEachDestructuringIdentifier = forEachDestructuringIdentifier; +function forEachDeclaredVariable(declarationList, cb) { + for (const declaration of declarationList.declarations) { + let result; + if (declaration.name.kind === ts.SyntaxKind.Identifier) { + result = cb(declaration); + } + else { + result = forEachDestructuringIdentifier(declaration.name, cb); + } + if (result) + return result; + } +} +exports.forEachDeclaredVariable = forEachDeclaredVariable; +var VariableDeclarationKind; +(function (VariableDeclarationKind) { + VariableDeclarationKind[VariableDeclarationKind["Var"] = 0] = "Var"; + VariableDeclarationKind[VariableDeclarationKind["Let"] = 1] = "Let"; + VariableDeclarationKind[VariableDeclarationKind["Const"] = 2] = "Const"; +})(VariableDeclarationKind = exports.VariableDeclarationKind || (exports.VariableDeclarationKind = {})); +function getVariableDeclarationKind(declarationList) { + if (declarationList.flags & ts.NodeFlags.Let) + return 1; + if (declarationList.flags & ts.NodeFlags.Const) + return 2; + return 0; +} +exports.getVariableDeclarationKind = getVariableDeclarationKind; +function isBlockScopedVariableDeclarationList(declarationList) { + return (declarationList.flags & ts.NodeFlags.BlockScoped) !== 0; +} +exports.isBlockScopedVariableDeclarationList = isBlockScopedVariableDeclarationList; +function isBlockScopedVariableDeclaration(declaration) { + const parent = declaration.parent; + return parent.kind === ts.SyntaxKind.CatchClause || + isBlockScopedVariableDeclarationList(parent); +} +exports.isBlockScopedVariableDeclaration = isBlockScopedVariableDeclaration; +function isBlockScopedDeclarationStatement(statement) { + switch (statement.kind) { + case ts.SyntaxKind.VariableStatement: + return isBlockScopedVariableDeclarationList(statement.declarationList); + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.EnumDeclaration: + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + return true; + default: + return false; + } +} +exports.isBlockScopedDeclarationStatement = isBlockScopedDeclarationStatement; +function isInSingleStatementContext(statement) { + switch (statement.parent.kind) { + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.DoStatement: + case ts.SyntaxKind.IfStatement: + case ts.SyntaxKind.WithStatement: + case ts.SyntaxKind.LabeledStatement: + return true; + default: + return false; + } +} +exports.isInSingleStatementContext = isInSingleStatementContext; +var ScopeBoundary; +(function (ScopeBoundary) { + ScopeBoundary[ScopeBoundary["None"] = 0] = "None"; + ScopeBoundary[ScopeBoundary["Function"] = 1] = "Function"; + ScopeBoundary[ScopeBoundary["Block"] = 2] = "Block"; + ScopeBoundary[ScopeBoundary["Type"] = 4] = "Type"; + ScopeBoundary[ScopeBoundary["ConditionalType"] = 8] = "ConditionalType"; +})(ScopeBoundary = exports.ScopeBoundary || (exports.ScopeBoundary = {})); +var ScopeBoundarySelector; +(function (ScopeBoundarySelector) { + ScopeBoundarySelector[ScopeBoundarySelector["Function"] = 1] = "Function"; + ScopeBoundarySelector[ScopeBoundarySelector["Block"] = 3] = "Block"; + ScopeBoundarySelector[ScopeBoundarySelector["Type"] = 7] = "Type"; + ScopeBoundarySelector[ScopeBoundarySelector["InferType"] = 8] = "InferType"; +})(ScopeBoundarySelector = exports.ScopeBoundarySelector || (exports.ScopeBoundarySelector = {})); +function isScopeBoundary(node) { + return isFunctionScopeBoundary(node) || isBlockScopeBoundary(node) || isTypeScopeBoundary(node); +} +exports.isScopeBoundary = isScopeBoundary; +function isTypeScopeBoundary(node) { + switch (node.kind) { + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + case ts.SyntaxKind.MappedType: + return 4; + case ts.SyntaxKind.ConditionalType: + return 8; + default: + return 0; + } +} +exports.isTypeScopeBoundary = isTypeScopeBoundary; +function isFunctionScopeBoundary(node) { + switch (node.kind) { + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.Constructor: + case ts.SyntaxKind.ModuleDeclaration: + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.ClassExpression: + case ts.SyntaxKind.EnumDeclaration: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.MethodSignature: + case ts.SyntaxKind.CallSignature: + case ts.SyntaxKind.ConstructSignature: + case ts.SyntaxKind.ConstructorType: + case ts.SyntaxKind.FunctionType: + return 1; + case ts.SyntaxKind.SourceFile: + return ts.isExternalModule(node) ? 1 : 0; + default: + return 0; + } +} +exports.isFunctionScopeBoundary = isFunctionScopeBoundary; +function isBlockScopeBoundary(node) { + switch (node.kind) { + case ts.SyntaxKind.Block: + const parent = node.parent; + return parent.kind !== ts.SyntaxKind.CatchClause && + (parent.kind === ts.SyntaxKind.SourceFile || + !isFunctionScopeBoundary(parent)) + ? 2 + : 0; + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.CaseBlock: + case ts.SyntaxKind.CatchClause: + case ts.SyntaxKind.WithStatement: + return 2; + default: + return 0; + } +} +exports.isBlockScopeBoundary = isBlockScopeBoundary; +function hasOwnThisReference(node) { + switch (node.kind) { + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.ClassExpression: + case ts.SyntaxKind.FunctionExpression: + return true; + case ts.SyntaxKind.FunctionDeclaration: + return node.body !== undefined; + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + return node.parent.kind === ts.SyntaxKind.ObjectLiteralExpression; + default: + return false; + } +} +exports.hasOwnThisReference = hasOwnThisReference; +function isFunctionWithBody(node) { + switch (node.kind) { + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.Constructor: + return node.body !== undefined; + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.ArrowFunction: + return true; + default: + return false; + } +} +exports.isFunctionWithBody = isFunctionWithBody; +function forEachToken(node, cb, sourceFile = node.getSourceFile()) { + return (function iterate(child) { + if (isTokenKind(child.kind)) + return cb(child); + if (child.kind !== ts.SyntaxKind.JSDocComment) + return child.getChildren(sourceFile).forEach(iterate); + })(node); +} +exports.forEachToken = forEachToken; +function forEachTokenWithTrivia(node, cb, sourceFile = node.getSourceFile()) { + const fullText = sourceFile.text; + const scanner = ts.createScanner(sourceFile.languageVersion, false, sourceFile.languageVariant, fullText); + return forEachToken(node, (token) => { + const tokenStart = token.kind === ts.SyntaxKind.JsxText || token.pos === token.end ? token.pos : token.getStart(sourceFile); + if (tokenStart !== token.pos) { + scanner.setTextPos(token.pos); + let kind = scanner.scan(); + let pos = scanner.getTokenPos(); + while (pos < tokenStart) { + const textPos = scanner.getTextPos(); + cb(fullText, kind, { pos, end: textPos }, token.parent); + if (textPos === tokenStart) + break; + kind = scanner.scan(); + pos = scanner.getTokenPos(); + } } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; + return cb(fullText, token.kind, { end: token.end, pos: tokenStart }, token.parent); + }, sourceFile); +} +exports.forEachTokenWithTrivia = forEachTokenWithTrivia; +function forEachComment(node, cb, sourceFile = node.getSourceFile()) { + const fullText = sourceFile.text; + const notJsx = sourceFile.languageVariant !== ts.LanguageVariant.JSX; + return forEachToken(node, (token) => { + if (token.pos === token.end) + return; + if (token.kind !== ts.SyntaxKind.JsxText) + ts.forEachLeadingCommentRange(fullText, token.pos === 0 ? (ts.getShebang(fullText) || '').length : token.pos, commentCallback); + if (notJsx || canHaveTrailingTrivia(token)) + return ts.forEachTrailingCommentRange(fullText, token.end, commentCallback); + }, sourceFile); + function commentCallback(pos, end, kind) { + cb(fullText, { pos, end, kind }); } - }; - -/** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ -BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: name - }; - } +} +exports.forEachComment = forEachComment; +function canHaveTrailingTrivia(token) { + switch (token.kind) { + case ts.SyntaxKind.CloseBraceToken: + return token.parent.kind !== ts.SyntaxKind.JsxExpression || !isJsxElementOrFragment(token.parent.parent); + case ts.SyntaxKind.GreaterThanToken: + switch (token.parent.kind) { + case ts.SyntaxKind.JsxOpeningElement: + return token.end !== token.parent.end; + case ts.SyntaxKind.JsxOpeningFragment: + return false; + case ts.SyntaxKind.JsxSelfClosingElement: + return token.end !== token.parent.end || + !isJsxElementOrFragment(token.parent.parent); + case ts.SyntaxKind.JsxClosingElement: + case ts.SyntaxKind.JsxClosingFragment: + return !isJsxElementOrFragment(token.parent.parent.parent); + } } - - return { - source: null, - line: null, - column: null, - name: null - }; - }; - -/** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ -BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_hasContentsOfAllSources() { - if (!this.sourcesContent) { - return false; + return true; +} +function isJsxElementOrFragment(node) { + return node.kind === ts.SyntaxKind.JsxElement || node.kind === ts.SyntaxKind.JsxFragment; +} +function getLineRanges(sourceFile) { + const lineStarts = sourceFile.getLineStarts(); + const result = []; + const length = lineStarts.length; + const sourceText = sourceFile.text; + let pos = 0; + for (let i = 1; i < length; ++i) { + const end = lineStarts[i]; + let lineEnd = end; + for (; lineEnd > pos; --lineEnd) + if (!ts.isLineBreak(sourceText.charCodeAt(lineEnd - 1))) + break; + result.push({ + pos, + end, + contentLength: lineEnd - pos, + }); + pos = end; } - return this.sourcesContent.length >= this._sources.size() && - !this.sourcesContent.some(function (sc) { return sc == null; }); - }; - -/** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ -BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; + result.push({ + pos, + end: sourceFile.end, + contentLength: sourceFile.end - pos, + }); + return result; +} +exports.getLineRanges = getLineRanges; +function getLineBreakStyle(sourceFile) { + const lineStarts = sourceFile.getLineStarts(); + return lineStarts.length === 1 || lineStarts[1] < 2 || sourceFile.text[lineStarts[1] - 2] !== '\r' + ? '\n' + : '\r\n'; +} +exports.getLineBreakStyle = getLineBreakStyle; +let cachedScanner; +function scanToken(text, languageVersion) { + if (cachedScanner === undefined) { + cachedScanner = ts.createScanner(languageVersion, false, undefined, text); } - - var index = this._findSourceIndex(aSource); - if (index >= 0) { - return this.sourcesContent[index]; + else { + cachedScanner.setScriptTarget(languageVersion); + cachedScanner.setText(text); } - - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); + cachedScanner.scan(); + return cachedScanner; +} +function isValidIdentifier(text, languageVersion = ts.ScriptTarget.Latest) { + const scan = scanToken(text, languageVersion); + return scan.isIdentifier() && scan.getTextPos() === text.length && scan.getTokenPos() === 0; +} +exports.isValidIdentifier = isValidIdentifier; +function charSize(ch) { + return ch >= 0x10000 ? 2 : 1; +} +function isValidPropertyAccess(text, languageVersion = ts.ScriptTarget.Latest) { + if (text.length === 0) + return false; + let ch = text.codePointAt(0); + if (!ts.isIdentifierStart(ch, languageVersion)) + return false; + for (let i = charSize(ch); i < text.length; i += charSize(ch)) { + ch = text.codePointAt(i); + if (!ts.isIdentifierPart(ch, languageVersion)) + return false; } - - var url; - if (this.sourceRoot != null - && (url = util.urlParse(this.sourceRoot))) { - // XXX: file:// URIs and absolute paths lead to unexpected behavior for - // many users. We can help them out when they expect file:// URIs to - // behave like it would if they were running a local HTTP server. See - // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. - var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); - if (url.scheme == "file" - && this._sources.has(fileUriAbsPath)) { - return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] - } - - if ((!url.path || url.path == "/") - && this._sources.has("/" + relativeSource)) { - return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; - } + return true; +} +exports.isValidPropertyAccess = isValidPropertyAccess; +function isValidPropertyName(text, languageVersion = ts.ScriptTarget.Latest) { + if (isValidPropertyAccess(text, languageVersion)) + return true; + const scan = scanToken(text, languageVersion); + return scan.getTextPos() === text.length && + scan.getToken() === ts.SyntaxKind.NumericLiteral && scan.getTokenValue() === text; +} +exports.isValidPropertyName = isValidPropertyName; +function isValidNumericLiteral(text, languageVersion = ts.ScriptTarget.Latest) { + const scan = scanToken(text, languageVersion); + return scan.getToken() === ts.SyntaxKind.NumericLiteral && scan.getTextPos() === text.length && scan.getTokenPos() === 0; +} +exports.isValidNumericLiteral = isValidNumericLiteral; +function isValidJsxIdentifier(text, languageVersion = ts.ScriptTarget.Latest) { + if (text.length === 0) + return false; + let ch = text.codePointAt(0); + if (!ts.isIdentifierStart(ch, languageVersion)) + return false; + for (let i = charSize(ch); i < text.length; i += charSize(ch)) { + ch = text.codePointAt(i); + if (!ts.isIdentifierPart(ch, languageVersion) && ch !== 45) + return false; } - - // This function is used recursively from - // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we - // don't want to throw if we can't find the source - we just want to - // return null, so we provide a flag to exit gracefully. - if (nullOnMissing) { - return null; + return true; +} +exports.isValidJsxIdentifier = isValidJsxIdentifier; +function isNumericPropertyName(name) { + return String(+name) === name; +} +exports.isNumericPropertyName = isNumericPropertyName; +function isSameLine(sourceFile, pos1, pos2) { + return ts.getLineAndCharacterOfPosition(sourceFile, pos1).line === ts.getLineAndCharacterOfPosition(sourceFile, pos2).line; +} +exports.isSameLine = isSameLine; +var SideEffectOptions; +(function (SideEffectOptions) { + SideEffectOptions[SideEffectOptions["None"] = 0] = "None"; + SideEffectOptions[SideEffectOptions["TaggedTemplate"] = 1] = "TaggedTemplate"; + SideEffectOptions[SideEffectOptions["Constructor"] = 2] = "Constructor"; + SideEffectOptions[SideEffectOptions["JsxElement"] = 4] = "JsxElement"; +})(SideEffectOptions = exports.SideEffectOptions || (exports.SideEffectOptions = {})); +function hasSideEffects(node, options) { + switch (node.kind) { + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.PostfixUnaryExpression: + case ts.SyntaxKind.AwaitExpression: + case ts.SyntaxKind.YieldExpression: + case ts.SyntaxKind.DeleteExpression: + return true; + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.AsExpression: + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.NonNullExpression: + case ts.SyntaxKind.VoidExpression: + case ts.SyntaxKind.TypeOfExpression: + case ts.SyntaxKind.PropertyAccessExpression: + case ts.SyntaxKind.SpreadElement: + case ts.SyntaxKind.PartiallyEmittedExpression: + return hasSideEffects(node.expression, options); + case ts.SyntaxKind.BinaryExpression: + return isAssignmentKind(node.operatorToken.kind) || + hasSideEffects(node.left, options) || + hasSideEffects(node.right, options); + case ts.SyntaxKind.PrefixUnaryExpression: + switch (node.operator) { + case ts.SyntaxKind.PlusPlusToken: + case ts.SyntaxKind.MinusMinusToken: + return true; + default: + return hasSideEffects(node.operand, options); + } + case ts.SyntaxKind.ElementAccessExpression: + return hasSideEffects(node.expression, options) || + node.argumentExpression !== undefined && + hasSideEffects(node.argumentExpression, options); + case ts.SyntaxKind.ConditionalExpression: + return hasSideEffects(node.condition, options) || + hasSideEffects(node.whenTrue, options) || + hasSideEffects(node.whenFalse, options); + case ts.SyntaxKind.NewExpression: + if (options & 2 || hasSideEffects(node.expression, options)) + return true; + if (node.arguments !== undefined) + for (const child of node.arguments) + if (hasSideEffects(child, options)) + return true; + return false; + case ts.SyntaxKind.TaggedTemplateExpression: + if (options & 1 || hasSideEffects(node.tag, options)) + return true; + if (node.template.kind === ts.SyntaxKind.NoSubstitutionTemplateLiteral) + return false; + node = node.template; + case ts.SyntaxKind.TemplateExpression: + for (const child of node.templateSpans) + if (hasSideEffects(child.expression, options)) + return true; + return false; + case ts.SyntaxKind.ClassExpression: + return classExpressionHasSideEffects(node, options); + case ts.SyntaxKind.ArrayLiteralExpression: + for (const child of node.elements) + if (hasSideEffects(child, options)) + return true; + return false; + case ts.SyntaxKind.ObjectLiteralExpression: + for (const child of node.properties) { + if (child.name !== undefined && child.name.kind === ts.SyntaxKind.ComputedPropertyName && + hasSideEffects(child.name.expression, options)) + return true; + switch (child.kind) { + case ts.SyntaxKind.PropertyAssignment: + if (hasSideEffects(child.initializer, options)) + return true; + break; + case ts.SyntaxKind.SpreadAssignment: + if (hasSideEffects(child.expression, options)) + return true; + } + } + return false; + case ts.SyntaxKind.JsxExpression: + return node.expression !== undefined && hasSideEffects(node.expression, options); + case ts.SyntaxKind.JsxElement: + case ts.SyntaxKind.JsxFragment: + for (const child of node.children) + if (child.kind !== ts.SyntaxKind.JsxText && hasSideEffects(child, options)) + return true; + if (node.kind === ts.SyntaxKind.JsxFragment) + return false; + node = node.openingElement; + case ts.SyntaxKind.JsxSelfClosingElement: + case ts.SyntaxKind.JsxOpeningElement: + if (options & 4) + return true; + for (const child of node.attributes.properties) { + if (child.kind === ts.SyntaxKind.JsxSpreadAttribute) { + if (hasSideEffects(child.expression, options)) + return true; + } + else if (child.initializer !== undefined && hasSideEffects(child.initializer, options)) { + return true; + } + } + return false; + case ts.SyntaxKind.CommaListExpression: + for (const child of node.elements) + if (hasSideEffects(child, options)) + return true; + return false; + default: + return false; } - else { - throw new Error('"' + relativeSource + '" is not in the SourceMap.'); +} +exports.hasSideEffects = hasSideEffects; +function classExpressionHasSideEffects(node, options) { + if (node.heritageClauses !== undefined && node.heritageClauses[0].token === ts.SyntaxKind.ExtendsKeyword) + for (const base of node.heritageClauses[0].types) + if (hasSideEffects(base.expression, options)) + return true; + for (const child of node.members) + if (child.name !== undefined && child.name.kind === ts.SyntaxKind.ComputedPropertyName && + hasSideEffects(child.name.expression, options) || + node_1.isPropertyDeclaration(child) && child.initializer !== undefined && + hasSideEffects(child.initializer, options)) + return true; + return false; +} +function getDeclarationOfBindingElement(node) { + let parent = node.parent.parent; + while (parent.kind === ts.SyntaxKind.BindingElement) + parent = parent.parent.parent; + return parent; +} +exports.getDeclarationOfBindingElement = getDeclarationOfBindingElement; +function isExpressionValueUsed(node) { + while (true) { + const parent = node.parent; + switch (parent.kind) { + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.NewExpression: + case ts.SyntaxKind.ElementAccessExpression: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.DoStatement: + case ts.SyntaxKind.WithStatement: + case ts.SyntaxKind.ThrowStatement: + case ts.SyntaxKind.ReturnStatement: + case ts.SyntaxKind.JsxExpression: + case ts.SyntaxKind.JsxSpreadAttribute: + case ts.SyntaxKind.JsxElement: + case ts.SyntaxKind.JsxFragment: + case ts.SyntaxKind.JsxSelfClosingElement: + case ts.SyntaxKind.ComputedPropertyName: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.ExportSpecifier: + case ts.SyntaxKind.ExportAssignment: + case ts.SyntaxKind.ImportDeclaration: + case ts.SyntaxKind.ExternalModuleReference: + case ts.SyntaxKind.Decorator: + case ts.SyntaxKind.TaggedTemplateExpression: + case ts.SyntaxKind.TemplateSpan: + case ts.SyntaxKind.ExpressionWithTypeArguments: + case ts.SyntaxKind.TypeOfExpression: + case ts.SyntaxKind.AwaitExpression: + case ts.SyntaxKind.YieldExpression: + case ts.SyntaxKind.LiteralType: + case ts.SyntaxKind.JsxAttributes: + case ts.SyntaxKind.JsxOpeningElement: + case ts.SyntaxKind.JsxClosingElement: + case ts.SyntaxKind.IfStatement: + case ts.SyntaxKind.CaseClause: + case ts.SyntaxKind.SwitchStatement: + return true; + case ts.SyntaxKind.PropertyAccessExpression: + return parent.expression === node; + case ts.SyntaxKind.QualifiedName: + return parent.left === node; + case ts.SyntaxKind.ShorthandPropertyAssignment: + return parent.objectAssignmentInitializer === node || + !isInDestructuringAssignment(parent); + case ts.SyntaxKind.PropertyAssignment: + return parent.initializer === node && !isInDestructuringAssignment(parent); + case ts.SyntaxKind.SpreadAssignment: + case ts.SyntaxKind.SpreadElement: + case ts.SyntaxKind.ArrayLiteralExpression: + return !isInDestructuringAssignment(parent); + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.AsExpression: + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.PostfixUnaryExpression: + case ts.SyntaxKind.PrefixUnaryExpression: + case ts.SyntaxKind.NonNullExpression: + node = parent; + break; + case ts.SyntaxKind.ForStatement: + return parent.condition === node; + case ts.SyntaxKind.ForInStatement: + case ts.SyntaxKind.ForOfStatement: + return parent.expression === node; + case ts.SyntaxKind.ConditionalExpression: + if (parent.condition === node) + return true; + node = parent; + break; + case ts.SyntaxKind.PropertyDeclaration: + case ts.SyntaxKind.BindingElement: + case ts.SyntaxKind.VariableDeclaration: + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.EnumMember: + return parent.initializer === node; + case ts.SyntaxKind.ImportEqualsDeclaration: + return parent.moduleReference === node; + case ts.SyntaxKind.CommaListExpression: + if (parent.elements[parent.elements.length - 1] !== node) + return false; + node = parent; + break; + case ts.SyntaxKind.BinaryExpression: + if (parent.right === node) { + if (parent.operatorToken.kind === ts.SyntaxKind.CommaToken) { + node = parent; + break; + } + return true; + } + switch (parent.operatorToken.kind) { + case ts.SyntaxKind.CommaToken: + case ts.SyntaxKind.EqualsToken: + return false; + case ts.SyntaxKind.EqualsEqualsEqualsToken: + case ts.SyntaxKind.EqualsEqualsToken: + case ts.SyntaxKind.ExclamationEqualsEqualsToken: + case ts.SyntaxKind.ExclamationEqualsToken: + case ts.SyntaxKind.InstanceOfKeyword: + case ts.SyntaxKind.PlusToken: + case ts.SyntaxKind.MinusToken: + case ts.SyntaxKind.AsteriskToken: + case ts.SyntaxKind.SlashToken: + case ts.SyntaxKind.PercentToken: + case ts.SyntaxKind.AsteriskAsteriskToken: + case ts.SyntaxKind.GreaterThanToken: + case ts.SyntaxKind.GreaterThanGreaterThanToken: + case ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken: + case ts.SyntaxKind.GreaterThanEqualsToken: + case ts.SyntaxKind.LessThanToken: + case ts.SyntaxKind.LessThanLessThanToken: + case ts.SyntaxKind.LessThanEqualsToken: + case ts.SyntaxKind.AmpersandToken: + case ts.SyntaxKind.BarToken: + case ts.SyntaxKind.CaretToken: + case ts.SyntaxKind.BarBarToken: + case ts.SyntaxKind.AmpersandAmpersandToken: + case ts.SyntaxKind.InKeyword: + return true; + default: + node = parent; + } + break; + default: + return false; + } } - }; - -/** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or - * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the - * closest element that is smaller than or greater than the one we are - * searching for, respectively, if the exact element cannot be found. - * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ -BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - source = this._findSourceIndex(source); - if (source < 0) { - return { - line: null, - column: null, - lastColumn: null - }; +} +exports.isExpressionValueUsed = isExpressionValueUsed; +function isInDestructuringAssignment(node) { + switch (node.kind) { + case ts.SyntaxKind.ShorthandPropertyAssignment: + if (node.objectAssignmentInitializer !== undefined) + return true; + case ts.SyntaxKind.PropertyAssignment: + case ts.SyntaxKind.SpreadAssignment: + node = node.parent; + break; + case ts.SyntaxKind.SpreadElement: + if (node.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression) + return false; + node = node.parent; } - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } + while (true) { + switch (node.parent.kind) { + case ts.SyntaxKind.BinaryExpression: + return node.parent.left === node && + node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken; + case ts.SyntaxKind.ForOfStatement: + return node.parent.initializer === node; + case ts.SyntaxKind.ArrayLiteralExpression: + case ts.SyntaxKind.ObjectLiteralExpression: + node = node.parent; + break; + case ts.SyntaxKind.SpreadAssignment: + case ts.SyntaxKind.PropertyAssignment: + node = node.parent.parent; + break; + case ts.SyntaxKind.SpreadElement: + if (node.parent.parent.kind !== ts.SyntaxKind.ArrayLiteralExpression) + return false; + node = node.parent.parent; + break; + default: + return false; + } } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - -exports.BasicSourceMapConsumer = BasicSourceMapConsumer; - -/** - * An IndexedSourceMapConsumer instance represents a parsed source map which - * we can query for information. It differs from BasicSourceMapConsumer in - * that it takes "indexed" source maps (i.e. ones with a "sections" field) as - * input. - * - * The first parameter is a raw source map (either as a JSON string, or already - * parsed to an object). According to the spec for indexed source maps, they - * have the following attributes: - * - * - version: Which version of the source map spec this map is following. - * - file: Optional. The generated file this source map is associated with. - * - sections: A list of section definitions. - * - * Each value under the "sections" field has two fields: - * - offset: The offset into the original specified at which this section - * begins to apply, defined as an object with a "line" and "column" - * field. - * - map: A source map definition. This source map could also be indexed, - * but doesn't have to be. - * - * Instead of the "map" field, it's also possible to have a "url" field - * specifying a URL to retrieve a source map from, but that's currently - * unsupported. - * - * Here's an example source map, taken from the source map spec[0], but - * modified to omit a section which uses the "url" field. - * - * { - * version : 3, - * file: "app.js", - * sections: [{ - * offset: {line:100, column:10}, - * map: { - * version : 3, - * file: "section.js", - * sources: ["foo.js", "bar.js"], - * names: ["src", "maps", "are", "fun"], - * mappings: "AAAA,E;;ABCDE;" - * } - * }], - * } - * - * The second parameter, if given, is a string whose value is the URL - * at which the source map was found. This URL is used to compute the - * sources array. - * - * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt - */ -function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (s) { - if (s.url) { - // The url field will require support for asynchronicity. - // See https://github.com/mozilla/source-map/issues/16 - throw new Error('Support for url field in sections not implemented.'); +} +var AccessKind; +(function (AccessKind) { + AccessKind[AccessKind["None"] = 0] = "None"; + AccessKind[AccessKind["Read"] = 1] = "Read"; + AccessKind[AccessKind["Write"] = 2] = "Write"; + AccessKind[AccessKind["Delete"] = 4] = "Delete"; + AccessKind[AccessKind["ReadWrite"] = 3] = "ReadWrite"; + AccessKind[AccessKind["Modification"] = 6] = "Modification"; +})(AccessKind = exports.AccessKind || (exports.AccessKind = {})); +function getAccessKind(node) { + const parent = node.parent; + switch (parent.kind) { + case ts.SyntaxKind.DeleteExpression: + return 4; + case ts.SyntaxKind.PostfixUnaryExpression: + return 3; + case ts.SyntaxKind.PrefixUnaryExpression: + return parent.operator === ts.SyntaxKind.PlusPlusToken || + parent.operator === ts.SyntaxKind.MinusMinusToken + ? 3 + : 1; + case ts.SyntaxKind.BinaryExpression: + return parent.right === node + ? 1 + : !isAssignmentKind(parent.operatorToken.kind) + ? 1 + : parent.operatorToken.kind === ts.SyntaxKind.EqualsToken + ? 2 + : 3; + case ts.SyntaxKind.ShorthandPropertyAssignment: + return parent.objectAssignmentInitializer === node + ? 1 + : isInDestructuringAssignment(parent) + ? 2 + : 1; + case ts.SyntaxKind.PropertyAssignment: + return parent.name === node + ? 0 + : isInDestructuringAssignment(parent) + ? 2 + : 1; + case ts.SyntaxKind.ArrayLiteralExpression: + case ts.SyntaxKind.SpreadElement: + case ts.SyntaxKind.SpreadAssignment: + return isInDestructuringAssignment(parent) + ? 2 + : 1; + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.NonNullExpression: + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.AsExpression: + return getAccessKind(parent); + case ts.SyntaxKind.ForOfStatement: + case ts.SyntaxKind.ForInStatement: + return parent.initializer === node + ? 2 + : 1; + case ts.SyntaxKind.ExpressionWithTypeArguments: + return parent.parent.token === ts.SyntaxKind.ExtendsKeyword && + parent.parent.parent.kind !== ts.SyntaxKind.InterfaceDeclaration + ? 1 + : 0; + case ts.SyntaxKind.ComputedPropertyName: + case ts.SyntaxKind.ExpressionStatement: + case ts.SyntaxKind.TypeOfExpression: + case ts.SyntaxKind.ElementAccessExpression: + case ts.SyntaxKind.ForStatement: + case ts.SyntaxKind.IfStatement: + case ts.SyntaxKind.DoStatement: + case ts.SyntaxKind.WhileStatement: + case ts.SyntaxKind.SwitchStatement: + case ts.SyntaxKind.WithStatement: + case ts.SyntaxKind.ThrowStatement: + case ts.SyntaxKind.CallExpression: + case ts.SyntaxKind.NewExpression: + case ts.SyntaxKind.TaggedTemplateExpression: + case ts.SyntaxKind.JsxExpression: + case ts.SyntaxKind.Decorator: + case ts.SyntaxKind.TemplateSpan: + case ts.SyntaxKind.JsxOpeningElement: + case ts.SyntaxKind.JsxSelfClosingElement: + case ts.SyntaxKind.JsxSpreadAttribute: + case ts.SyntaxKind.VoidExpression: + case ts.SyntaxKind.ReturnStatement: + case ts.SyntaxKind.AwaitExpression: + case ts.SyntaxKind.YieldExpression: + case ts.SyntaxKind.ConditionalExpression: + case ts.SyntaxKind.CaseClause: + case ts.SyntaxKind.JsxElement: + return 1; + case ts.SyntaxKind.ArrowFunction: + return parent.body === node + ? 1 + : 2; + case ts.SyntaxKind.PropertyDeclaration: + case ts.SyntaxKind.VariableDeclaration: + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.EnumMember: + case ts.SyntaxKind.BindingElement: + case ts.SyntaxKind.JsxAttribute: + return parent.initializer === node + ? 1 + : 0; + case ts.SyntaxKind.PropertyAccessExpression: + return parent.expression === node + ? 1 + : 0; + case ts.SyntaxKind.ExportAssignment: + return parent.isExportEquals + ? 1 + : 0; } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var offsetColumn = util.getArg(offset, 'column'); - - if (offsetLine < lastOffset.line || - (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { - throw new Error('Section offsets must be ordered and non-overlapping.'); + return 0; +} +exports.getAccessKind = getAccessKind; +function isReassignmentTarget(node) { + return (getAccessKind(node) & 2) !== 0; +} +exports.isReassignmentTarget = isReassignmentTarget; +function canHaveJsDoc(node) { + const kind = node.kind; + switch (kind) { + case ts.SyntaxKind.Parameter: + case ts.SyntaxKind.CallSignature: + case ts.SyntaxKind.ConstructSignature: + case ts.SyntaxKind.MethodSignature: + case ts.SyntaxKind.PropertySignature: + case ts.SyntaxKind.ArrowFunction: + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.SpreadAssignment: + case ts.SyntaxKind.ShorthandPropertyAssignment: + case ts.SyntaxKind.PropertyAssignment: + case ts.SyntaxKind.FunctionExpression: + case ts.SyntaxKind.FunctionDeclaration: + case ts.SyntaxKind.LabeledStatement: + case ts.SyntaxKind.ExpressionStatement: + case ts.SyntaxKind.VariableStatement: + case ts.SyntaxKind.Constructor: + case ts.SyntaxKind.MethodDeclaration: + case ts.SyntaxKind.PropertyDeclaration: + case ts.SyntaxKind.GetAccessor: + case ts.SyntaxKind.SetAccessor: + case ts.SyntaxKind.ClassDeclaration: + case ts.SyntaxKind.ClassExpression: + case ts.SyntaxKind.InterfaceDeclaration: + case ts.SyntaxKind.TypeAliasDeclaration: + case ts.SyntaxKind.EnumMember: + case ts.SyntaxKind.EnumDeclaration: + case ts.SyntaxKind.ModuleDeclaration: + case ts.SyntaxKind.ImportEqualsDeclaration: + case ts.SyntaxKind.IndexSignature: + case ts.SyntaxKind.FunctionType: + case ts.SyntaxKind.ConstructorType: + case ts.SyntaxKind.JSDocFunctionType: + case ts.SyntaxKind.EndOfFileToken: + case ts.SyntaxKind.ExportDeclaration: + return true; + default: + return false; } - lastOffset = offset; - - return { - generatedOffset: { - // The offset fields are 0-based, but we use 1-based indices when - // encoding/decoding from VLQ. - generatedLine: offsetLine + 1, - generatedColumn: offsetColumn + 1 - }, - consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) +} +exports.canHaveJsDoc = canHaveJsDoc; +function getJsDoc(node, sourceFile) { + if (node.kind === ts.SyntaxKind.EndOfFileToken) + return parseJsDocWorker(node, sourceFile || node.parent); + const result = []; + for (const child of node.getChildren(sourceFile)) { + if (!node_1.isJsDoc(child)) + break; + result.push(child); } - }); + return result; } - -IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); -IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - -/** - * The version of the source mapping spec that we are consuming. - */ -IndexedSourceMapConsumer.prototype._version = 3; - -/** - * The list of original sources. - */ -Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { - sources.push(this._sections[i].consumer.sources[j]); - } +exports.getJsDoc = getJsDoc; +function parseJsDocOfNode(node, considerTrailingComments, sourceFile = node.getSourceFile()) { + if (canHaveJsDoc(node) && node.kind !== ts.SyntaxKind.EndOfFileToken) { + const result = getJsDoc(node, sourceFile); + if (result.length !== 0 || !considerTrailingComments) + return result; } - return sources; - } -}); - -/** - * Returns the original source, line, and column information for the generated - * source's line and column positions provided. The only argument is an object - * with the following properties: - * - * - line: The line number in the generated source. The line number - * is 1-based. - * - column: The column number in the generated source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - source: The original source file, or null. - * - line: The line number in the original source, or null. The - * line number is 1-based. - * - column: The column number in the original source, or null. The - * column number is 0-based. - * - name: The original identifier, or null. - */ -IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - // Find the section containing the generated position we're trying to map - // to an original position. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; + return parseJsDocWorker(node, sourceFile, considerTrailingComments); +} +exports.parseJsDocOfNode = parseJsDocOfNode; +function parseJsDocWorker(node, sourceFile, considerTrailingComments) { + const nodeStart = node.getStart(sourceFile); + const start = ts[considerTrailingComments && isSameLine(sourceFile, node.pos, nodeStart) + ? 'forEachTrailingCommentRange' + : 'forEachLeadingCommentRange'](sourceFile.text, node.pos, (pos, _end, kind) => kind === ts.SyntaxKind.MultiLineCommentTrivia && sourceFile.text[pos + 2] === '*' ? { pos } : undefined); + if (start === undefined) + return []; + const startPos = start.pos; + const text = sourceFile.text.slice(startPos, nodeStart); + const newSourceFile = ts.createSourceFile('jsdoc.ts', `${text}var a;`, sourceFile.languageVersion); + const result = getJsDoc(newSourceFile.statements[0], newSourceFile); + for (const doc of result) + updateNode(doc, node); + return result; + function updateNode(n, parent) { + n.pos += startPos; + n.end += startPos; + n.parent = parent; + return ts.forEachChild(n, (child) => updateNode(child, n), (children) => { + children.pos += startPos; + children.end += startPos; + for (const child of children) + updateNode(child, n); + }); + } +} +var ImportKind; +(function (ImportKind) { + ImportKind[ImportKind["ImportDeclaration"] = 1] = "ImportDeclaration"; + ImportKind[ImportKind["ImportEquals"] = 2] = "ImportEquals"; + ImportKind[ImportKind["ExportFrom"] = 4] = "ExportFrom"; + ImportKind[ImportKind["DynamicImport"] = 8] = "DynamicImport"; + ImportKind[ImportKind["Require"] = 16] = "Require"; + ImportKind[ImportKind["ImportType"] = 32] = "ImportType"; + ImportKind[ImportKind["All"] = 63] = "All"; + ImportKind[ImportKind["AllImports"] = 59] = "AllImports"; + ImportKind[ImportKind["AllStaticImports"] = 3] = "AllStaticImports"; + ImportKind[ImportKind["AllImportExpressions"] = 24] = "AllImportExpressions"; + ImportKind[ImportKind["AllRequireLike"] = 18] = "AllRequireLike"; + ImportKind[ImportKind["AllNestedImports"] = 56] = "AllNestedImports"; + ImportKind[ImportKind["AllTopLevelImports"] = 7] = "AllTopLevelImports"; +})(ImportKind = exports.ImportKind || (exports.ImportKind = {})); +function findImports(sourceFile, kinds) { + const result = []; + for (const node of findImportLikeNodes(sourceFile, kinds)) { + switch (node.kind) { + case ts.SyntaxKind.ImportDeclaration: + addIfTextualLiteral(node.moduleSpecifier); + break; + case ts.SyntaxKind.ImportEqualsDeclaration: + addIfTextualLiteral(node.moduleReference.expression); + break; + case ts.SyntaxKind.ExportDeclaration: + addIfTextualLiteral(node.moduleSpecifier); + break; + case ts.SyntaxKind.CallExpression: + addIfTextualLiteral(node.arguments[0]); + break; + case ts.SyntaxKind.ImportType: + if (node_1.isLiteralTypeNode(node.argument)) + addIfTextualLiteral(node.argument.literal); + break; + default: + throw new Error('unexpected node'); } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var section = this._sections[sectionIndex]; - - if (!section) { - return { - source: null, - line: null, - column: null, - name: null - }; } - - return section.consumer.originalPositionFor({ - line: needle.generatedLine - - (section.generatedOffset.generatedLine - 1), - column: needle.generatedColumn - - (section.generatedOffset.generatedLine === needle.generatedLine - ? section.generatedOffset.generatedColumn - 1 - : 0), - bias: aArgs.bias - }); - }; - -/** - * Return true if we have the source content for every source in the source - * map, false otherwise. - */ -IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_hasContentsOfAllSources() { - return this._sections.every(function (s) { - return s.consumer.hasContentsOfAllSources(); - }); - }; - -/** - * Returns the original source content. The only argument is the url of the - * original source file. Returns null if no original source content is - * available. - */ -IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } + return result; + function addIfTextualLiteral(node) { + if (node_1.isTextualLiteral(node)) + result.push(node); } - if (nullOnMissing) { - return null; +} +exports.findImports = findImports; +function findImportLikeNodes(sourceFile, kinds) { + return new ImportFinder(sourceFile, kinds).find(); +} +exports.findImportLikeNodes = findImportLikeNodes; +class ImportFinder { + constructor(_sourceFile, _options) { + this._sourceFile = _sourceFile; + this._options = _options; + this._result = []; } - else { - throw new Error('"' + aSource + '" is not in the SourceMap.'); + find() { + if (this._sourceFile.isDeclarationFile) + this._options &= ~24; + if (this._options & 7) + this._findImports(this._sourceFile.statements); + if (this._options & 56) + this._findNestedImports(); + return this._result; } - }; - -/** - * Returns the generated line and column information for the original source, - * line, and column positions provided. The only argument is an object with - * the following properties: - * - * - source: The filename of the original source. - * - line: The line number in the original source. The line number - * is 1-based. - * - column: The column number in the original source. The column - * number is 0-based. - * - * and an object is returned with the following properties: - * - * - line: The line number in the generated source, or null. The - * line number is 1-based. - * - column: The column number in the generated source, or null. - * The column number is 0-based. - */ -IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - // Only consider this section if the requested source is in the list of - // sources of the consumer. - if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { - continue; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var ret = { - line: generatedPosition.line + - (section.generatedOffset.generatedLine - 1), - column: generatedPosition.column + - (section.generatedOffset.generatedLine === generatedPosition.line - ? section.generatedOffset.generatedColumn - 1 - : 0) - }; - return ret; - } + _findImports(statements) { + for (const statement of statements) { + if (node_1.isImportDeclaration(statement)) { + if (this._options & 1) + this._result.push(statement); + } + else if (node_1.isImportEqualsDeclaration(statement)) { + if (this._options & 2 && + statement.moduleReference.kind === ts.SyntaxKind.ExternalModuleReference) + this._result.push(statement); + } + else if (node_1.isExportDeclaration(statement)) { + if (statement.moduleSpecifier !== undefined && this._options & 4) + this._result.push(statement); + } + else if (node_1.isModuleDeclaration(statement)) { + this._findImportsInModule(statement); + } + } } - - return { - line: null, - column: null - }; - }; - -/** - * Parse the mappings in a string in to a data structure which we can easily - * query (the ordered arrays in the `this.__generatedMappings` and - * `this.__originalMappings` properties). - */ -IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = null; - if (mapping.name) { - name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(name); + _findImportsInModule(declaration) { + if (declaration.body === undefined) + return; + if (declaration.body.kind === ts.SyntaxKind.ModuleDeclaration) + return this._findImportsInModule(declaration.body); + this._findImports(declaration.body.statements); + } + _findNestedImports() { + let re; + if ((this._options & 56) === 16) { + re = /\brequire\s*[ 'fred, barney, & pebbles' - */ -function unescape(string) { - string = toString(string); - return (string && reHasEscapedHtml.test(string)) - ? string.replace(reEscapedHtml, unescapeHtmlChar) - : string; } - -module.exports = unescape; - - -/***/ }), -/* 822 */ -/***/ (function(module) { - -"use strict"; - - -if (typeof process === 'undefined' || - !process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = { nextTick: nextTick }; -} else { - module.exports = process +function isStatementInAmbientContext(node) { + while (node.flags & ts.NodeFlags.NestedNamespace) + node = node.parent; + return hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword) || isAmbientModuleBlock(node.parent); } - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; +exports.isStatementInAmbientContext = isStatementInAmbientContext; +function isAmbientModuleBlock(node) { + while (node.kind === ts.SyntaxKind.ModuleBlock) { + do + node = node.parent; + while (node.flags & ts.NodeFlags.NestedNamespace); + if (hasModifier(node.modifiers, ts.SyntaxKind.DeclareKeyword)) + return true; + node = node.parent; } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } + return false; } - - - -/***/ }), -/* 823 */, -/* 824 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -var freeGlobal = __webpack_require__(973); - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -module.exports = root; - - -/***/ }), -/* 825 */, -/* 826 */ -/***/ (function(module) { - -"use strict"; - - -/* eslint complexity: [2, 18], max-statements: [2, 33] */ -module.exports = function hasSymbols() { - if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } - if (typeof Symbol.iterator === 'symbol') { return true; } - - var obj = {}; - var sym = Symbol('test'); - var symObj = Object(sym); - if (typeof sym === 'string') { return false; } - - if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } - if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } - - // temp disabled per https://github.com/ljharb/object.assign/issues/17 - // if (sym instanceof Symbol) { return false; } - // temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 - // if (!(symObj instanceof Symbol)) { return false; } - - // if (typeof Symbol.prototype.toString !== 'function') { return false; } - // if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } - - var symVal = 42; - obj[sym] = symVal; - for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax - if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } - - if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } - - var syms = Object.getOwnPropertySymbols(obj); - if (syms.length !== 1 || syms[0] !== sym) { return false; } - - if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } - - if (typeof Object.getOwnPropertyDescriptor === 'function') { - var descriptor = Object.getOwnPropertyDescriptor(obj, sym); - if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } - } - - return true; -}; - - -/***/ }), -/* 827 */, -/* 828 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -/**/ - -var pna = __webpack_require__(822); -/**/ - -// undocumented cb() API, needed for core, not for public API -function destroy(err, cb) { - var _this = this; - - var readableDestroyed = this._readableState && this._readableState.destroyed; - var writableDestroyed = this._writableState && this._writableState.destroyed; - - if (readableDestroyed || writableDestroyed) { - if (cb) { - cb(err); - } else if (err && (!this._writableState || !this._writableState.errorEmitted)) { - pna.nextTick(emitErrorNT, this, err); - } - return this; - } - - // we set destroyed to true before firing error callbacks in order - // to make it re-entrance safe in case destroy() is called within callbacks - - if (this._readableState) { - this._readableState.destroyed = true; - } - - // if this is a duplex stream mark the writable part as destroyed as well - if (this._writableState) { - this._writableState.destroyed = true; - } - - this._destroy(err || null, function (err) { - if (!cb && err) { - pna.nextTick(emitErrorNT, _this, err); - if (_this._writableState) { - _this._writableState.errorEmitted = true; - } - } else if (cb) { - cb(err); - } - }); - - return this; +exports.isAmbientModuleBlock = isAmbientModuleBlock; +function getIIFE(func) { + let node = func.parent; + while (node.kind === ts.SyntaxKind.ParenthesizedExpression) + node = node.parent; + return node_1.isCallExpression(node) && func.end <= node.expression.end ? node : undefined; } - -function undestroy() { - if (this._readableState) { - this._readableState.destroyed = false; - this._readableState.reading = false; - this._readableState.ended = false; - this._readableState.endEmitted = false; - } - - if (this._writableState) { - this._writableState.destroyed = false; - this._writableState.ended = false; - this._writableState.ending = false; - this._writableState.finished = false; - this._writableState.errorEmitted = false; - } +exports.getIIFE = getIIFE; +function isStrictCompilerOptionEnabled(options, option) { + return (options.strict ? options[option] !== false : options[option] === true) && + (option !== 'strictPropertyInitialization' || isStrictCompilerOptionEnabled(options, 'strictNullChecks')); } - -function emitErrorNT(self, err) { - self.emit('error', err); +exports.isStrictCompilerOptionEnabled = isStrictCompilerOptionEnabled; +function isCompilerOptionEnabled(options, option) { + switch (option) { + case 'stripInternal': + return options.stripInternal === true && isCompilerOptionEnabled(options, 'declaration'); + case 'declaration': + return options.declaration || isCompilerOptionEnabled(options, 'composite'); + case 'incremental': + return options.incremental === undefined ? isCompilerOptionEnabled(options, 'composite') : options.incremental; + case 'skipDefaultLibCheck': + return options.skipDefaultLibCheck || isCompilerOptionEnabled(options, 'skipLibCheck'); + case 'suppressImplicitAnyIndexErrors': + return options.suppressImplicitAnyIndexErrors === true && isCompilerOptionEnabled(options, 'noImplicitAny'); + case 'allowSyntheticDefaultImports': + return options.allowSyntheticDefaultImports !== undefined + ? options.allowSyntheticDefaultImports + : isCompilerOptionEnabled(options, 'esModuleInterop') || options.module === ts.ModuleKind.System; + case 'noImplicitAny': + case 'noImplicitThis': + case 'strictNullChecks': + case 'strictFunctionTypes': + case 'strictPropertyInitialization': + case 'alwaysStrict': + case 'strictBindCallApply': + return isStrictCompilerOptionEnabled(options, option); + } + return options[option] === true; } - -module.exports = { - destroy: destroy, - undestroy: undestroy -}; - -/***/ }), -/* 829 */ -/***/ (function(__unusedmodule, exports) { - -/* -*- Mode: js; js-indent-level: 2; -*- */ -/* - * Copyright 2011 Mozilla Foundation and contributors - * Licensed under the New BSD license. See LICENSE or: - * http://opensource.org/licenses/BSD-3-Clause - */ - -// It turns out that some (most?) JavaScript engines don't self-host -// `Array.prototype.sort`. This makes sense because C++ will likely remain -// faster than JS when doing raw CPU-intensive sorting. However, when using a -// custom comparator function, calling back and forth between the VM's C++ and -// JIT'd JS is rather slow *and* loses JIT type information, resulting in -// worse generated code for the comparator function than would be optimal. In -// fact, when sorting with a comparator, these costs outweigh the benefits of -// sorting in C++. By using our own JS-implemented Quick Sort (below), we get -// a ~3500ms mean speed-up in `bench/bench.html`. - -/** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ -function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; +exports.isCompilerOptionEnabled = isCompilerOptionEnabled; +function isAmbientModule(node) { + return node.name.kind === ts.SyntaxKind.StringLiteral || (node.flags & ts.NodeFlags.GlobalAugmentation) !== 0; } - -/** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ -function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); +exports.isAmbientModule = isAmbientModule; +function getCheckJsDirective(source) { + let directive; + ts.forEachLeadingCommentRange(source, (ts.getShebang(source) || '').length, (pos, end, kind) => { + if (kind === ts.SyntaxKind.SingleLineCommentTrivia) { + const text = source.slice(pos, end); + const match = /^\/{2,3}\s*@ts-(no)?check(?:\s|$)/i.exec(text); + if (match !== null) + directive = { pos, end, enabled: match[1] === undefined }; + } + }); + return directive; } - -/** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ -function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot) <= 0) { - i += 1; - swap(ary, i, j); - } +exports.getCheckJsDirective = getCheckJsDirective; +function isConstAssertion(node) { + return node_1.isTypeReferenceNode(node.type) && + node.type.typeName.kind === ts.SyntaxKind.Identifier && + node.type.typeName.escapedText === 'const'; +} +exports.isConstAssertion = isConstAssertion; +function isInConstContext(node) { + let current = node; + while (true) { + const parent = current.parent; + outer: switch (parent.kind) { + case ts.SyntaxKind.TypeAssertionExpression: + case ts.SyntaxKind.AsExpression: + return isConstAssertion(parent); + case ts.SyntaxKind.PrefixUnaryExpression: + if (current.kind !== ts.SyntaxKind.NumericLiteral) + return false; + switch (parent.operator) { + case ts.SyntaxKind.PlusToken: + case ts.SyntaxKind.MinusToken: + current = parent; + break outer; + default: + return false; + } + case ts.SyntaxKind.PropertyAssignment: + if (parent.initializer !== current) + return false; + current = parent.parent; + break; + case ts.SyntaxKind.ShorthandPropertyAssignment: + current = parent.parent; + break; + case ts.SyntaxKind.ParenthesizedExpression: + case ts.SyntaxKind.ArrayLiteralExpression: + case ts.SyntaxKind.ObjectLiteralExpression: + current = parent; + break; + default: + return false; + } } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } } - -/** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ -exports.quickSort = function (ary, comparator) { - doQuickSort(ary, comparator, 0, ary.length - 1); -}; - - -/***/ }), -/* 830 */, -/* 831 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -/**/ - -var objectKeys = Object.keys || function (obj) { - var keys = []; - - for (var key in obj) { - keys.push(key); - } - - return keys; -}; -/**/ - - -module.exports = Duplex; - -var Readable = __webpack_require__(226); - -var Writable = __webpack_require__(241); - -__webpack_require__(689)(Duplex, Readable); - -{ - // Allow the keys array to be GC'ed. - var keys = objectKeys(Writable.prototype); - - for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; - } +exports.isInConstContext = isInConstContext; +function isReadonlyAssignmentDeclaration(node, checker) { + if (!isBindableObjectDefinePropertyCall(node)) + return false; + const descriptorType = checker.getTypeAtLocation(node.arguments[2]); + if (descriptorType.getProperty('value') === undefined) + return descriptorType.getProperty('set') === undefined; + const writableProp = descriptorType.getProperty('writable'); + if (writableProp === undefined) + return false; + const writableType = writableProp.valueDeclaration !== undefined && node_1.isPropertyAssignment(writableProp.valueDeclaration) + ? checker.getTypeAtLocation(writableProp.valueDeclaration.initializer) + : checker.getTypeOfSymbolAtLocation(writableProp, node.arguments[2]); + return type_1.isBooleanLiteralType(writableType, false); } - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - Readable.call(this, options); - Writable.call(this, options); - this.allowHalfOpen = true; - - if (options) { - if (options.readable === false) this.readable = false; - if (options.writable === false) this.writable = false; - - if (options.allowHalfOpen === false) { - this.allowHalfOpen = false; - this.once('end', onend); - } - } +exports.isReadonlyAssignmentDeclaration = isReadonlyAssignmentDeclaration; +function isBindableObjectDefinePropertyCall(node) { + return node.arguments.length === 3 && + node_1.isEntityNameExpression(node.arguments[0]) && + node_1.isNumericOrStringLikeLiteral(node.arguments[1]) && + node_1.isPropertyAccessExpression(node.expression) && + node.expression.name.escapedText === 'defineProperty' && + node_1.isIdentifier(node.expression.expression) && + node.expression.expression.escapedText === 'Object'; } - -Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.highWaterMark; - } -}); -Object.defineProperty(Duplex.prototype, 'writableBuffer', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState && this._writableState.getBuffer(); - } -}); -Object.defineProperty(Duplex.prototype, 'writableLength', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - return this._writableState.length; - } -}); // the no-half-open enforcer - -function onend() { - // If the writable side ended, then we're ok. - if (this._writableState.ended) return; // no more data can be written. - // But allow more writes to happen in this tick. - - process.nextTick(onEndNT, this); +exports.isBindableObjectDefinePropertyCall = isBindableObjectDefinePropertyCall; +function isWellKnownSymbolLiterally(node) { + return ts.isPropertyAccessExpression(node) && + ts.isIdentifier(node.expression) && + node.expression.escapedText === 'Symbol'; } - -function onEndNT(self) { - self.end(); +exports.isWellKnownSymbolLiterally = isWellKnownSymbolLiterally; +function getPropertyNameOfWellKnownSymbol(node) { + return { + displayName: `[Symbol.${node.name.text}]`, + symbolName: ('__@' + node.name.text), + }; } - -Object.defineProperty(Duplex.prototype, 'destroyed', { - // making it explicit this property is not enumerable - // because otherwise some prototype manipulation in - // userland will fail - enumerable: false, - get: function get() { - if (this._readableState === undefined || this._writableState === undefined) { - return false; +exports.getPropertyNameOfWellKnownSymbol = getPropertyNameOfWellKnownSymbol; +function getLateBoundPropertyNames(node, checker) { + const result = { + known: true, + names: [], + }; + node = unwrapParentheses(node); + if (isWellKnownSymbolLiterally(node)) { + result.names.push(getPropertyNameOfWellKnownSymbol(node)); } - - return this._readableState.destroyed && this._writableState.destroyed; - }, - set: function set(value) { - // we ignore the value if the stream - // has not been initialized yet - if (this._readableState === undefined || this._writableState === undefined) { - return; - } // backward compatibility, the user is explicitly - // managing destroyed - - - this._readableState.destroyed = value; - this._writableState.destroyed = value; - } -}); - -/***/ }), -/* 832 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -module.exports = __webpack_require__(271).default; - - -/***/ }), -/* 833 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SemVer = __webpack_require__(369) -const Range = __webpack_require__(986) -const gt = __webpack_require__(136) - -const minVersion = (range, loose) => { - range = new Range(range, loose) - - let minver = new SemVer('0.0.0') - if (range.test(minver)) { - return minver - } - - minver = new SemVer('0.0.0-0') - if (range.test(minver)) { - return minver - } - - minver = null - for (let i = 0; i < range.set.length; ++i) { - const comparators = range.set[i] - - comparators.forEach((comparator) => { - // Clone to avoid manipulating the comparator's semver object. - const compver = new SemVer(comparator.semver.version) - switch (comparator.operator) { - case '>': - if (compver.prerelease.length === 0) { - compver.patch++ - } else { - compver.prerelease.push(0) - } - compver.raw = compver.format() - /* fallthrough */ - case '': - case '>=': - if (!minver || gt(minver, compver)) { - minver = compver - } - break - case '<': - case '<=': - /* Ignore maximum versions */ - break - /* istanbul ignore next */ - default: - throw new Error(`Unexpected operation: ${comparator.operator}`) - } - }) - } - - if (minver && range.test(minver)) { - return minver - } - - return null + else { + const type = checker.getTypeAtLocation(node); + for (const key of type_1.unionTypeParts(checker.getBaseConstraintOfType(type) || type)) { + const propertyName = type_1.getPropertyNameFromType(key); + if (propertyName) { + result.names.push(propertyName); + } + else { + result.known = false; + } + } + } + return result; } -module.exports = minVersion - - -/***/ }), -/* 834 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SemVer = __webpack_require__(369) -const minor = (a, loose) => new SemVer(a, loose).minor -module.exports = minor +exports.getLateBoundPropertyNames = getLateBoundPropertyNames; +function getLateBoundPropertyNamesOfPropertyName(node, checker) { + const staticName = getPropertyName(node); + return staticName !== undefined + ? { known: true, names: [{ displayName: staticName, symbolName: ts.escapeLeadingUnderscores(staticName) }] } + : getLateBoundPropertyNames(node.expression, checker); +} +exports.getLateBoundPropertyNamesOfPropertyName = getLateBoundPropertyNamesOfPropertyName; +function getSingleLateBoundPropertyNameOfPropertyName(node, checker) { + const staticName = getPropertyName(node); + if (staticName !== undefined) + return { displayName: staticName, symbolName: ts.escapeLeadingUnderscores(staticName) }; + const { expression } = node; + return isWellKnownSymbolLiterally(expression) + ? getPropertyNameOfWellKnownSymbol(expression) + : type_1.getPropertyNameFromType(checker.getTypeAtLocation(expression)); +} +exports.getSingleLateBoundPropertyNameOfPropertyName = getSingleLateBoundPropertyNameOfPropertyName; +function unwrapParentheses(node) { + while (node.kind === ts.SyntaxKind.ParenthesizedExpression) + node = node.expression; + return node; +} +exports.unwrapParentheses = unwrapParentheses; /***/ }), +/* 834 */, /* 835 */ /***/ (function(module) { @@ -251661,7 +252066,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 (Object.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; }; @@ -251695,6 +252100,9 @@ exports.defaultInputs = { }, netlifyConfigPath() { return core.getInput('netlify-config-path') || undefined; + }, + alias() { + return core.getInput('alias') || undefined; } }; @@ -264905,19 +265313,7 @@ exports.restEndpointMethods = restEndpointMethods; /***/ }), /* 843 */, -/* 844 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const Range = __webpack_require__(986) -const intersects = (r1, r2, options) => { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} -module.exports = intersects - - -/***/ }), +/* 844 */, /* 845 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -265206,7 +265602,7 @@ function obj(options, fn) { "use strict"; -const pTimeout = __webpack_require__(952); +const pTimeout = __webpack_require__(381); const symbolAsyncIterator = Symbol.asyncIterator || '@@asyncIterator'; @@ -265224,7 +265620,7 @@ const normalizeEmitter = emitter => { }; }; -const normalizeEvents = event => Array.isArray(event) ? event : [event]; +const toArray = value => Array.isArray(value) ? value : [value]; const multiple = (emitter, event, options) => { let cancel; @@ -265241,7 +265637,7 @@ const multiple = (emitter, event, options) => { } // Allow multiple events - const events = normalizeEvents(event); + const events = toArray(event); const items = []; const {addListener, removeListener} = normalizeEmitter(emitter); @@ -265330,7 +265726,7 @@ module.exports.iterator = (emitter, event, options) => { } // Allow multiple events - const events = normalizeEvents(event); + const events = toArray(event); options = { rejectionEvents: ['error'], @@ -265495,6 +265891,8 @@ module.exports.iterator = (emitter, event, options) => { }; }; +module.exports.TimeoutError = pTimeout.TimeoutError; + /***/ }), /* 850 */ @@ -265518,31 +265916,280 @@ function paginationMethodsPlugin (octokit) { /* 851 */, /* 852 */, /* 853 */ -/***/ (function(module) { +/***/ (function(module, __unusedexports, __webpack_require__) { -const numeric = /^[0-9]+$/ -const compareIdentifiers = (a, b) => { - const anum = numeric.test(a) - const bnum = numeric.test(b) +"use strict"; - if (anum && bnum) { - a = +a - b = +b - } - return a === b ? 0 - : (anum && !bnum) ? -1 - : (bnum && !anum) ? 1 - : a < b ? -1 - : 1 -} +var utils = __webpack_require__(139); +var formats = __webpack_require__(514); +var has = Object.prototype.hasOwnProperty; -const rcompareIdentifiers = (a, b) => compareIdentifiers(b, a) +var arrayPrefixGenerators = { + brackets: function brackets(prefix) { + return prefix + '[]'; + }, + comma: 'comma', + indices: function indices(prefix, key) { + return prefix + '[' + key + ']'; + }, + repeat: function repeat(prefix) { + return prefix; + } +}; -module.exports = { - compareIdentifiers, - rcompareIdentifiers -} +var isArray = Array.isArray; +var push = Array.prototype.push; +var pushToArray = function (arr, valueOrArray) { + push.apply(arr, isArray(valueOrArray) ? valueOrArray : [valueOrArray]); +}; + +var toISO = Date.prototype.toISOString; + +var defaultFormat = formats['default']; +var defaults = { + addQueryPrefix: false, + allowDots: false, + charset: 'utf-8', + charsetSentinel: false, + delimiter: '&', + encode: true, + encoder: utils.encode, + encodeValuesOnly: false, + format: defaultFormat, + formatter: formats.formatters[defaultFormat], + // deprecated + indices: false, + serializeDate: function serializeDate(date) { + return toISO.call(date); + }, + skipNulls: false, + strictNullHandling: false +}; + +var isNonNullishPrimitive = function isNonNullishPrimitive(v) { + return typeof v === 'string' + || typeof v === 'number' + || typeof v === 'boolean' + || typeof v === 'symbol' + || typeof v === 'bigint'; +}; + +var stringify = function stringify( + object, + prefix, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly, + charset +) { + var obj = object; + if (typeof filter === 'function') { + obj = filter(prefix, obj); + } else if (obj instanceof Date) { + obj = serializeDate(obj); + } else if (generateArrayPrefix === 'comma' && isArray(obj)) { + obj = utils.maybeMap(obj, function (value) { + if (value instanceof Date) { + return serializeDate(value); + } + return value; + }).join(','); + } + + if (obj === null) { + if (strictNullHandling) { + return encoder && !encodeValuesOnly ? encoder(prefix, defaults.encoder, charset, 'key') : prefix; + } + + obj = ''; + } + + if (isNonNullishPrimitive(obj) || utils.isBuffer(obj)) { + if (encoder) { + var keyValue = encodeValuesOnly ? prefix : encoder(prefix, defaults.encoder, charset, 'key'); + return [formatter(keyValue) + '=' + formatter(encoder(obj, defaults.encoder, charset, 'value'))]; + } + return [formatter(prefix) + '=' + formatter(String(obj))]; + } + + var values = []; + + if (typeof obj === 'undefined') { + return values; + } + + var objKeys; + if (isArray(filter)) { + objKeys = filter; + } else { + var keys = Object.keys(obj); + objKeys = sort ? keys.sort(sort) : keys; + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + var value = obj[key]; + + if (skipNulls && value === null) { + continue; + } + + var keyPrefix = isArray(obj) + ? typeof generateArrayPrefix === 'function' ? generateArrayPrefix(prefix, key) : prefix + : prefix + (allowDots ? '.' + key : '[' + key + ']'); + + pushToArray(values, stringify( + value, + keyPrefix, + generateArrayPrefix, + strictNullHandling, + skipNulls, + encoder, + filter, + sort, + allowDots, + serializeDate, + formatter, + encodeValuesOnly, + charset + )); + } + + return values; +}; + +var normalizeStringifyOptions = function normalizeStringifyOptions(opts) { + if (!opts) { + return defaults; + } + + if (opts.encoder !== null && opts.encoder !== undefined && typeof opts.encoder !== 'function') { + throw new TypeError('Encoder has to be a function.'); + } + + var charset = opts.charset || defaults.charset; + if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { + throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); + } + + var format = formats['default']; + if (typeof opts.format !== 'undefined') { + if (!has.call(formats.formatters, opts.format)) { + throw new TypeError('Unknown format option provided.'); + } + format = opts.format; + } + var formatter = formats.formatters[format]; + + var filter = defaults.filter; + if (typeof opts.filter === 'function' || isArray(opts.filter)) { + filter = opts.filter; + } + + return { + addQueryPrefix: typeof opts.addQueryPrefix === 'boolean' ? opts.addQueryPrefix : defaults.addQueryPrefix, + allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, + charset: charset, + charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, + delimiter: typeof opts.delimiter === 'undefined' ? defaults.delimiter : opts.delimiter, + encode: typeof opts.encode === 'boolean' ? opts.encode : defaults.encode, + encoder: typeof opts.encoder === 'function' ? opts.encoder : defaults.encoder, + encodeValuesOnly: typeof opts.encodeValuesOnly === 'boolean' ? opts.encodeValuesOnly : defaults.encodeValuesOnly, + filter: filter, + formatter: formatter, + serializeDate: typeof opts.serializeDate === 'function' ? opts.serializeDate : defaults.serializeDate, + skipNulls: typeof opts.skipNulls === 'boolean' ? opts.skipNulls : defaults.skipNulls, + sort: typeof opts.sort === 'function' ? opts.sort : null, + strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling + }; +}; + +module.exports = function (object, opts) { + var obj = object; + var options = normalizeStringifyOptions(opts); + + var objKeys; + var filter; + + if (typeof options.filter === 'function') { + filter = options.filter; + obj = filter('', obj); + } else if (isArray(options.filter)) { + filter = options.filter; + objKeys = filter; + } + + var keys = []; + + if (typeof obj !== 'object' || obj === null) { + return ''; + } + + var arrayFormat; + if (opts && opts.arrayFormat in arrayPrefixGenerators) { + arrayFormat = opts.arrayFormat; + } else if (opts && 'indices' in opts) { + arrayFormat = opts.indices ? 'indices' : 'repeat'; + } else { + arrayFormat = 'indices'; + } + + var generateArrayPrefix = arrayPrefixGenerators[arrayFormat]; + + if (!objKeys) { + objKeys = Object.keys(obj); + } + + if (options.sort) { + objKeys.sort(options.sort); + } + + for (var i = 0; i < objKeys.length; ++i) { + var key = objKeys[i]; + + if (options.skipNulls && obj[key] === null) { + continue; + } + pushToArray(keys, stringify( + obj[key], + key, + generateArrayPrefix, + options.strictNullHandling, + options.skipNulls, + options.encode ? options.encoder : null, + options.filter, + options.sort, + options.allowDots, + options.serializeDate, + options.formatter, + options.encodeValuesOnly, + options.charset + )); + } + + var joined = keys.join(options.delimiter); + var prefix = options.addQueryPrefix === true ? '?' : ''; + + if (options.charsetSentinel) { + if (options.charset === 'iso-8859-1') { + // encodeURIComponent('✓'), the "numeric entity" representation of a checkmark + prefix += 'utf8=%26%2310003%3B&'; + } else { + // encodeURIComponent('✓') + prefix += 'utf8=%E2%9C%93&'; + } + } + + return joined.length > 0 ? prefix + joined : ''; +}; /***/ }), @@ -266516,39 +267163,7 @@ module.exports = __webpack_require__(160).default; /***/ }), -/* 859 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -var replace = String.prototype.replace; -var percentTwenties = /%20/g; - -var util = __webpack_require__(733); - -var Format = { - RFC1738: 'RFC1738', - RFC3986: 'RFC3986' -}; - -module.exports = util.assign( - { - 'default': Format.RFC3986, - formatters: { - RFC1738: function (value) { - return replace.call(value, percentTwenties, '+'); - }, - RFC3986: function (value) { - return String(value); - } - } - }, - Format -); - - -/***/ }), +/* 859 */, /* 860 */, /* 861 */ /***/ (function(module) { @@ -267052,7 +267667,15 @@ module.exports = exports.default; /***/ }), -/* 871 */, +/* 871 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const SemVer = __webpack_require__(734) +const minor = (a, loose) => new SemVer(a, loose).minor +module.exports = minor + + +/***/ }), /* 872 */, /* 873 */, /* 874 */ @@ -267435,36 +268058,37 @@ Duplex.prototype._destroy = function (err, cb) { }; /***/ }), -/* 878 */, -/* 879 */ +/* 878 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const parse = __webpack_require__(658) -const eq = __webpack_require__(804) - -const diff = (version1, version2) => { - if (eq(version1, version2)) { +const SemVer = __webpack_require__(734) +const Range = __webpack_require__(33) +const minSatisfying = (versions, range, options) => { + let min = null + let minSV = null + let rangeObj = null + try { + rangeObj = new Range(range, options) + } catch (er) { return null - } else { - const v1 = parse(version1) - const v2 = parse(version2) - const hasPre = v1.prerelease.length || v2.prerelease.length - const prefix = hasPre ? 'pre' : '' - const defaultResult = hasPre ? 'prerelease' : '' - for (const key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return prefix + key - } + } + versions.forEach((v) => { + if (rangeObj.test(v)) { + // satisfies(v, range, options) + if (!min || minSV.compare(v) === 1) { + // compare(min, v, true) + min = v + minSV = new SemVer(min, options) } } - return defaultResult // may be undefined - } + }) + return min } -module.exports = diff +module.exports = minSatisfying /***/ }), +/* 879 */, /* 880 */ /***/ (function(module, exports, __webpack_require__) { @@ -269575,48 +270199,70 @@ if (util && util.inspect && util.inspect.custom) { "use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +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)) result[k] = mod[k]; + result["default"] = mod; + return result; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const visitor_keys_1 = __webpack_require__(408); -// eslint-disable-next-line @typescript-eslint/no-explicit-any -function isValidNode(x) { - return x !== null && typeof x === 'object' && typeof x.type === 'string'; -} -function getVisitorKeysForNode(allVisitorKeys, node) { - const keys = allVisitorKeys[node.type]; - return keys !== null && keys !== void 0 ? keys : []; -} -class SimpleTraverser { - constructor({ enter }) { - this.allVisitorKeys = visitor_keys_1.visitorKeys; - this.enter = enter; - } - traverse(node, parent) { - if (!isValidNode(node)) { - return; - } - this.enter(node, parent); - const keys = getVisitorKeysForNode(this.allVisitorKeys, node); - if (keys.length < 1) { - return; - } - for (const key of keys) { - const childOrChildren = node[key]; - if (Array.isArray(childOrChildren)) { - for (const child of childOrChildren) { - this.traverse(child, node); - } - } - else { - this.traverse(childOrChildren, node); - } - } +const debug_1 = __importDefault(__webpack_require__(784)); +const ts = __importStar(__webpack_require__(752)); +const shared_1 = __webpack_require__(769); +const log = debug_1.default('typescript-eslint:typescript-estree:createIsolatedProgram'); +/** + * @param code The code of the file being linted + * @returns Returns a new source file and program corresponding to the linted code + */ +function createIsolatedProgram(code, extra) { + log('Getting isolated program in %s mode for: %s', extra.jsx ? 'TSX' : 'TS', extra.filePath); + const compilerHost = { + fileExists() { + return true; + }, + getCanonicalFileName() { + return extra.filePath; + }, + getCurrentDirectory() { + return ''; + }, + getDirectories() { + return []; + }, + getDefaultLibFileName() { + return 'lib.d.ts'; + }, + // TODO: Support Windows CRLF + getNewLine() { + return '\n'; + }, + getSourceFile(filename) { + return ts.createSourceFile(filename, code, ts.ScriptTarget.Latest, + /* setParentNodes */ true, shared_1.getScriptKind(extra, filename)); + }, + readFile() { + return undefined; + }, + useCaseSensitiveFileNames() { + return true; + }, + writeFile() { + return null; + }, + }; + const program = ts.createProgram([extra.filePath], Object.assign({ noResolve: true, target: ts.ScriptTarget.Latest, jsx: extra.jsx ? ts.JsxEmit.Preserve : undefined }, shared_1.createDefaultCompilerOptionsFromExtra(extra)), compilerHost); + const ast = program.getSourceFile(extra.filePath); + if (!ast) { + throw new Error('Expected an ast to be returned for the single-file isolated program.'); } + return { ast, program }; } -function simpleTraverse(startingNode, options) { - new SimpleTraverser(options).traverse(startingNode, undefined); -} -exports.simpleTraverse = simpleTraverse; -//# sourceMappingURL=simple-traverse.js.map +exports.createIsolatedProgram = createIsolatedProgram; +//# sourceMappingURL=createIsolatedProgram.js.map /***/ }), /* 895 */ @@ -269832,69 +270478,8 @@ exports.withCustomRequest = withCustomRequest; /***/ }), -/* 899 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const compareBuild = __webpack_require__(50) -const sort = (list, loose) => list.sort((a, b) => compareBuild(a, b, loose)) -module.exports = sort - - -/***/ }), -/* 900 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -// just pre-load all the stuff that index.js lazily exports -const internalRe = __webpack_require__(590) -module.exports = { - re: internalRe.re, - src: internalRe.src, - tokens: internalRe.t, - SEMVER_SPEC_VERSION: __webpack_require__(627).SEMVER_SPEC_VERSION, - SemVer: __webpack_require__(369), - compareIdentifiers: __webpack_require__(853).compareIdentifiers, - rcompareIdentifiers: __webpack_require__(853).rcompareIdentifiers, - parse: __webpack_require__(658), - valid: __webpack_require__(64), - clean: __webpack_require__(386), - inc: __webpack_require__(767), - diff: __webpack_require__(879), - major: __webpack_require__(476), - minor: __webpack_require__(834), - patch: __webpack_require__(32), - prerelease: __webpack_require__(609), - compare: __webpack_require__(682), - rcompare: __webpack_require__(972), - compareLoose: __webpack_require__(467), - compareBuild: __webpack_require__(805), - sort: __webpack_require__(638), - rsort: __webpack_require__(150), - gt: __webpack_require__(136), - lt: __webpack_require__(342), - eq: __webpack_require__(804), - neq: __webpack_require__(335), - gte: __webpack_require__(618), - lte: __webpack_require__(495), - cmp: __webpack_require__(134), - coerce: __webpack_require__(719), - Comparator: __webpack_require__(123), - Range: __webpack_require__(986), - satisfies: __webpack_require__(121), - toComparators: __webpack_require__(770), - maxSatisfying: __webpack_require__(994), - minSatisfying: __webpack_require__(217), - minVersion: __webpack_require__(833), - validRange: __webpack_require__(292), - outside: __webpack_require__(750), - gtr: __webpack_require__(530), - ltr: __webpack_require__(589), - intersects: __webpack_require__(844), - simplifyRange: __webpack_require__(930), - subset: __webpack_require__(321), -} - - -/***/ }), +/* 899 */, +/* 900 */, /* 901 */ /***/ (function(__unusedmodule, exports) { @@ -270432,64 +271017,25 @@ module.exports = { isGoExe, zipGoExe } /* 908 */ /***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; - -const pLimit = __webpack_require__(22); - -class EndError extends Error { - constructor(value) { - super(); - this.value = value; - } -} - -// The input can also be a promise, so we await it -const testElement = async (element, tester) => tester(await element); - -// The input can also be a promise, so we `Promise.all()` them both -const finder = async element => { - const values = await Promise.all(element); - if (values[1] === true) { - throw new EndError(values[0]); - } - - return false; -}; - -const pLocate = async (iterable, tester, options) => { - options = { - concurrency: Infinity, - preserveOrder: true, - ...options - }; - - const limit = pLimit(options.concurrency); - - // Start all the promises concurrently with optional limit - const items = [...iterable].map(element => [element, limit(testElement, element, tester)]); - - // Check the promises either serially or concurrently - const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity); +const compare = __webpack_require__(386) +const gte = (a, b, loose) => compare(a, b, loose) >= 0 +module.exports = gte - try { - await Promise.all(items.map(element => checkLimit(finder, element))); - } catch (error) { - if (error instanceof EndError) { - return error.value; - } - throw error; - } -}; +/***/ }), +/* 909 */, +/* 910 */ +/***/ (function(module, __unusedexports, __webpack_require__) { -module.exports = pLocate; -// TODO: Remove this for the next major release -module.exports.default = pLocate; +const parse = __webpack_require__(147) +const clean = (version, options) => { + const s = parse(version.trim().replace(/^[=v]+/, ''), options) + return s ? s.version : null +} +module.exports = clean /***/ }), -/* 909 */, -/* 910 */, /* 911 */ /***/ (function(__unusedmodule, exports, __webpack_require__) { @@ -272633,67 +273179,609 @@ function hasNextPage (link) { /***/ }), -/* 930 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/* 930 */, +/* 931 */ +/***/ (function(module) { -// given a set of versions and a range, create a "simplified" range -// that includes the same versions that the original range does -// If the original range is shorter than the simplified one, return that. -const satisfies = __webpack_require__(121) -const compare = __webpack_require__(682) -module.exports = (versions, range, options) => { - const set = [] - let min = null - let prev = null - const v = versions.sort((a, b) => compare(a, b, options)) - for (const version of v) { - const included = satisfies(version, range, options) - if (included) { - prev = version - if (!min) - min = version - } else { - if (prev) { - set.push([min, prev]) - } - prev = null - min = null - } +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used to match words composed of alphanumeric characters. */ +var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + +/** Used to match Latin Unicode letters (excluding mathematical operators). */ +var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsComboSymbolsRange = '\\u20d0-\\u20f0', + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + +/** Used to compose unicode capture groups. */ +var rsApos = "['\u2019]", + rsAstral = '[' + rsAstralRange + ']', + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', + rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + +/** Used to match apostrophes. */ +var reApos = RegExp(rsApos, 'g'); + +/** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ +var reComboMark = RegExp(rsCombo, 'g'); + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** Used to match complex or compound words. */ +var reUnicodeWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', + rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, + rsUpper + '+' + rsOptUpperContr, + rsDigits, + rsEmoji +].join('|'), 'g'); + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); + +/** Used to detect strings that need a more robust regexp to match words. */ +var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + +/** Used to map Latin Unicode letters to basic Latin letters. */ +var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 'ss' +}; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ +function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array ? array.length : 0; + + if (initAccum && length) { + accumulator = array[++index]; } - if (min) - set.push([min, null]) + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; +} - const ranges = [] - for (const [min, max] of set) { - if (min === max) - ranges.push(min) - else if (!max && min === v[0]) - ranges.push('*') - else if (!max) - ranges.push(`>=${min}`) - else if (min === v[0]) - ranges.push(`<=${max}`) - else - ranges.push(`${min} - ${max}`) +/** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function asciiToArray(string) { + return string.split(''); +} + +/** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ +function asciiWords(string) { + return string.match(reAsciiWord) || []; +} + +/** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ +var deburrLetter = basePropertyOf(deburredLetters); + +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + +/** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ +function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); +} + +/** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +/** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function unicodeToArray(string) { + return string.match(reUnicode) || []; +} + +/** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ +function unicodeWords(string) { + return string.match(reUnicodeWord) || []; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); } - const simplified = ranges.join(' || ') - const original = typeof range.raw === 'string' ? range.raw : String(range) - return simplified.length < original.length ? simplified : range + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; } +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} -/***/ }), -/* 931 */ -/***/ (function(module, __unusedexports, __webpack_require__) { +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} -const Range = __webpack_require__(635) +/** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ +function createCaseFirst(methodName) { + return function(string) { + string = toString(string); -// Mostly just for testing and legacy API reasons -const toComparators = (range, options) => - new Range(range, options).set - .map(comp => comp.map(c => c.value).join(' ').trim().split(' ')) + var strSymbols = hasUnicode(string) + ? stringToArray(string) + : undefined; -module.exports = toComparators + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; +} + +/** + * Creates a function like `_.camelCase`. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ +function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); + }; +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar--'); + * // => 'fooBar' + * + * _.camelCase('__FOO_BAR__'); + * // => 'fooBar' + */ +var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? capitalize(word) : word); +}); + +/** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ +function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); +} + +/** + * Deburrs `string` by converting + * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) + * letters to basic Latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('déjà vu'); + * // => 'deja vu' + */ +function deburr(string) { + string = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); +} + +/** + * Converts the first character of `string` to upper case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.upperFirst('fred'); + * // => 'Fred' + * + * _.upperFirst('FRED'); + * // => 'FRED' + */ +var upperFirst = createCaseFirst('toUpperCase'); + +/** + * Splits `string` into an array of its words. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {RegExp|string} [pattern] The pattern to match words. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the words of `string`. + * @example + * + * _.words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + * _.words('fred, barney, & pebbles', /[^, ]+/g); + * // => ['fred', 'barney', '&', 'pebbles'] + */ +function words(string, pattern, guard) { + string = toString(string); + pattern = guard ? undefined : pattern; + + if (pattern === undefined) { + return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); + } + return string.match(pattern) || []; +} + +module.exports = camelCase; /***/ }), @@ -274262,7 +275350,7 @@ module.exports = implementation; "use strict"; -const pTimeout = __webpack_require__(980); +const pTimeout = __webpack_require__(381); const pWaitFor = async (condition, options) => { options = { @@ -274369,310 +275457,9 @@ module.exports = function(fn) { /* 949 */ /***/ (function(module, __unusedexports, __webpack_require__) { -var fs = __webpack_require__(747); -var path = __webpack_require__(622); -var caller = __webpack_require__(433); -var nodeModulesPaths = __webpack_require__(194); -var normalizeOptions = __webpack_require__(791); -var isCore = __webpack_require__(127); - -var defaultIsFile = function isFile(file, cb) { - fs.stat(file, function (err, stat) { - if (!err) { - return cb(null, stat.isFile() || stat.isFIFO()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); -}; - -var defaultIsDir = function isDirectory(dir, cb) { - fs.stat(dir, function (err, stat) { - if (!err) { - return cb(null, stat.isDirectory()); - } - if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); - return cb(err); - }); -}; - -var maybeUnwrapSymlink = function maybeUnwrapSymlink(x, opts, cb) { - if (!opts || !opts.preserveSymlinks) { - fs.realpath(x, function (realPathErr, realPath) { - if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); - else cb(null, realPathErr ? x : realPath); - }); - } else { - cb(null, x); - } -}; - -var getPackageCandidates = function getPackageCandidates(x, start, opts) { - var dirs = nodeModulesPaths(start, opts, x); - for (var i = 0; i < dirs.length; i++) { - dirs[i] = path.join(dirs[i], x); - } - return dirs; -}; - -module.exports = function resolve(x, options, callback) { - var cb = callback; - var opts = options; - if (typeof options === 'function') { - cb = opts; - opts = {}; - } - if (typeof x !== 'string') { - var err = new TypeError('Path must be a string.'); - return process.nextTick(function () { - cb(err); - }); - } - - opts = normalizeOptions(x, opts); - - var isFile = opts.isFile || defaultIsFile; - var isDirectory = opts.isDirectory || defaultIsDir; - var readFile = opts.readFile || fs.readFile; - var packageIterator = opts.packageIterator; - - var extensions = opts.extensions || ['.js']; - var basedir = opts.basedir || path.dirname(caller()); - var parent = opts.filename || basedir; - - opts.paths = opts.paths || []; - - // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory - var absoluteStart = path.resolve(basedir); - - maybeUnwrapSymlink( - absoluteStart, - opts, - function (err, realStart) { - if (err) cb(err); - else validateBasedir(realStart); - } - ); - - function validateBasedir(basedir) { - if (opts.basedir) { - var dirError = new TypeError('Provided basedir "' + basedir + '" is not a directory' + (opts.preserveSymlinks ? '' : ', or a symlink to a directory')); - dirError.code = 'INVALID_BASEDIR'; - isDirectory(basedir, function (err, result) { - if (err) return cb(err); - if (!result) { return cb(dirError); } - validBasedir(basedir); - }); - } else { - validBasedir(basedir); - } - } - - var res; - function validBasedir(basedir) { - if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { - res = path.resolve(basedir, x); - if (x === '..' || x.slice(-1) === '/') res += '/'; - if ((/\/$/).test(x) && res === basedir) { - loadAsDirectory(res, opts.package, onfile); - } else loadAsFile(res, opts.package, onfile); - } else if (isCore(x)) { - return cb(null, x); - } else loadNodeModules(x, basedir, function (err, n, pkg) { - if (err) cb(err); - else if (n) { - return maybeUnwrapSymlink(n, opts, function (err, realN) { - if (err) { - cb(err); - } else { - cb(null, realN, pkg); - } - }); - } else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); - } - }); - } - - function onfile(err, m, pkg) { - if (err) cb(err); - else if (m) cb(null, m, pkg); - else loadAsDirectory(res, function (err, d, pkg) { - if (err) cb(err); - else if (d) { - maybeUnwrapSymlink(d, opts, function (err, realD) { - if (err) { - cb(err); - } else { - cb(null, realD, pkg); - } - }); - } else { - var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); - moduleError.code = 'MODULE_NOT_FOUND'; - cb(moduleError); - } - }); - } - - function loadAsFile(x, thePackage, callback) { - var loadAsFilePackage = thePackage; - var cb = callback; - if (typeof loadAsFilePackage === 'function') { - cb = loadAsFilePackage; - loadAsFilePackage = undefined; - } - - var exts = [''].concat(extensions); - load(exts, x, loadAsFilePackage); - - function load(exts, x, loadPackage) { - if (exts.length === 0) return cb(null, undefined, loadPackage); - var file = x + exts[0]; - - var pkg = loadPackage; - if (pkg) onpkg(null, pkg); - else loadpkg(path.dirname(file), onpkg); - - function onpkg(err, pkg_, dir) { - pkg = pkg_; - if (err) return cb(err); - if (dir && pkg && opts.pathFilter) { - var rfile = path.relative(dir, file); - var rel = rfile.slice(0, rfile.length - exts[0].length); - var r = opts.pathFilter(pkg, x, rel); - if (r) return load( - [''].concat(extensions.slice()), - path.resolve(dir, r), - pkg - ); - } - isFile(file, onex); - } - function onex(err, ex) { - if (err) return cb(err); - if (ex) return cb(null, file, pkg); - load(exts.slice(1), x, pkg); - } - } - } - - function loadpkg(dir, cb) { - if (dir === '' || dir === '/') return cb(null); - if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { - return cb(null); - } - if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); - - maybeUnwrapSymlink(dir, opts, function (unwrapErr, pkgdir) { - if (unwrapErr) return loadpkg(path.dirname(dir), cb); - var pkgfile = path.join(pkgdir, 'package.json'); - isFile(pkgfile, function (err, ex) { - // on err, ex is false - if (!ex) return loadpkg(path.dirname(dir), cb); - - readFile(pkgfile, function (err, body) { - if (err) cb(err); - try { var pkg = JSON.parse(body); } catch (jsonErr) {} - - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile, dir); - } - cb(null, pkg, dir); - }); - }); - }); - } - - function loadAsDirectory(x, loadAsDirectoryPackage, callback) { - var cb = callback; - var fpkg = loadAsDirectoryPackage; - if (typeof fpkg === 'function') { - cb = fpkg; - fpkg = opts.package; - } - - maybeUnwrapSymlink(x, opts, function (unwrapErr, pkgdir) { - if (unwrapErr) return loadAsDirectory(path.dirname(x), fpkg, cb); - var pkgfile = path.join(pkgdir, 'package.json'); - isFile(pkgfile, function (err, ex) { - if (err) return cb(err); - if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); - - readFile(pkgfile, function (err, body) { - if (err) return cb(err); - try { - var pkg = JSON.parse(body); - } catch (jsonErr) {} - - if (pkg && opts.packageFilter) { - pkg = opts.packageFilter(pkg, pkgfile, pkgdir); - } - - if (pkg && pkg.main) { - if (typeof pkg.main !== 'string') { - var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); - mainError.code = 'INVALID_PACKAGE_MAIN'; - return cb(mainError); - } - if (pkg.main === '.' || pkg.main === './') { - pkg.main = 'index'; - } - loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); - - var dir = path.resolve(x, pkg.main); - loadAsDirectory(dir, pkg, function (err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - loadAsFile(path.join(x, 'index'), pkg, cb); - }); - }); - return; - } - - loadAsFile(path.join(x, '/index'), pkg, cb); - }); - }); - }); - } - - function processDirs(cb, dirs) { - if (dirs.length === 0) return cb(null, undefined); - var dir = dirs[0]; - - isDirectory(path.dirname(dir), isdir); - - function isdir(err, isdir) { - if (err) return cb(err); - if (!isdir) return processDirs(cb, dirs.slice(1)); - loadAsFile(dir, opts.package, onfile); - } - - function onfile(err, m, pkg) { - if (err) return cb(err); - if (m) return cb(null, m, pkg); - loadAsDirectory(dir, opts.package, ondir); - } - - function ondir(err, n, pkg) { - if (err) return cb(err); - if (n) return cb(null, n, pkg); - processDirs(cb, dirs.slice(1)); - } - } - function loadNodeModules(x, start, cb) { - var thunk = function () { return getPackageCandidates(x, start, opts); }; - processDirs( - cb, - packageIterator ? packageIterator(x, start, thunk, opts) : thunk() - ); - } -}; +const compareBuild = __webpack_require__(783) +const rsort = (list, loose) => list.sort((a, b) => compareBuild(b, a, loose)) +module.exports = rsort /***/ }), @@ -274742,57 +275529,7 @@ exports.checkBypass = checkBypass; /***/ }), /* 951 */, -/* 952 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - -const pFinally = __webpack_require__(697); - -class TimeoutError extends Error { - constructor(message) { - super(message); - this.name = 'TimeoutError'; - } -} - -module.exports = (promise, ms, fallback) => new Promise((resolve, reject) => { - if (typeof ms !== 'number' || ms < 0) { - throw new TypeError('Expected `ms` to be a positive number'); - } - - const timer = setTimeout(() => { - if (typeof fallback === 'function') { - try { - resolve(fallback()); - } catch (err) { - reject(err); - } - return; - } - - const message = typeof fallback === 'string' ? fallback : `Promise timed out after ${ms} milliseconds`; - const err = fallback instanceof Error ? fallback : new TimeoutError(message); - - if (typeof promise.cancel === 'function') { - promise.cancel(); - } - - reject(err); - }, ms); - - pFinally( - promise.then(resolve, reject), - () => { - clearTimeout(timer); - } - ); -}); - -module.exports.TimeoutError = TimeoutError; - - -/***/ }), +/* 952 */, /* 953 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -276517,7 +277254,18 @@ module.exports = options => { /***/ }), /* 967 */, -/* 968 */, +/* 968 */ +/***/ (function(module, __unusedexports, __webpack_require__) { + +const parse = __webpack_require__(584) +const valid = (version, options) => { + const v = parse(version, options) + return v ? v.version : null +} +module.exports = valid + + +/***/ }), /* 969 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -276569,22 +277317,30 @@ function onceStrict (fn) { /* 970 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(570) +const compare = __webpack_require__(340) const compareLoose = (a, b) => compare(a, b, true) module.exports = compareLoose /***/ }), -/* 971 */, -/* 972 */ +/* 971 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const compare = __webpack_require__(682) -const rcompare = (a, b, loose) => compare(b, a, loose) -module.exports = rcompare +const Range = __webpack_require__(33) +const validRange = (range, options) => { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, options).range || '*' + } catch (er) { + return null + } +} +module.exports = validRange /***/ }), +/* 972 */, /* 973 */ /***/ (function(module) { @@ -276604,7 +277360,7 @@ const { dirname } = __webpack_require__(622) const glob = __webpack_require__(120) const precinct = __webpack_require__(92) -const requirePackageName = __webpack_require__(332) +const requirePackageName = __webpack_require__(396) const promisify = __webpack_require__(799) const { resolvePathPreserveSymlinks, resolvePackage } = __webpack_require__(801) @@ -276612,15 +277368,15 @@ const { resolvePathPreserveSymlinks, resolvePackage } = __webpack_require__(801) const pGlob = promisify(glob) // Retrieve all the files recursively required by a Node.js file -const getDependencies = async function(handler, packageRoot) { +const getDependencies = async function(mainFile, packageRoot) { const packageJson = getPackageJson(packageRoot) const state = { localFiles: [], modulePaths: [] } try { - return await getFileDependencies(handler, packageJson, state) + return await getFileDependencies(mainFile, packageJson, state) } catch (error) { - error.message = `In file "${handler}": ${error.message}` + error.message = `In file "${mainFile}": ${error.message}` throw error } } @@ -276674,7 +277430,13 @@ const getLocalImportDependencies = async function(dependency, basedir, packageJs // When a file requires a module, we find its path inside `node_modules` and // use all its published files. We also recurse on the module's dependencies. const getModuleDependencies = async function(dependency, basedir, state, packageJson) { - const moduleName = requirePackageName(dependency.replace(BACKSLASH_REGEXP, '/')) + const moduleName = getModuleName(dependency) + + // Happens when doing require("@scope") (not "@scope/name") or other oddities + // Ignore those. + if (moduleName === null) { + return [] + } try { return await getModuleNameDependencies(moduleName, basedir, state) @@ -276683,10 +277445,18 @@ const getModuleDependencies = async function(dependency, basedir, state, package } } +// When doing require("moduleName/file/path"), only keep `moduleName` +const getModuleName = function(dependency) { + const dependencyA = dependency.replace(BACKSLASH_REGEXP, '/') + const moduleName = requirePackageName(dependencyA) + return moduleName +} + +// Windows path normalization const BACKSLASH_REGEXP = /\\/g const getModuleNameDependencies = async function(moduleName, basedir, state) { - if (isExludedModule(moduleName)) { + if (isExcludedModule(moduleName)) { return [] } @@ -276710,7 +277480,7 @@ const getModuleNameDependencies = async function(moduleName, basedir, state) { return [...publishedFiles, ...sideFiles, ...depsPaths] } -const isExludedModule = function(moduleName) { +const isExcludedModule = function(moduleName) { return EXCLUDED_MODULES.includes(moduleName) || moduleName.startsWith('@types/') } const EXCLUDED_MODULES = ['aws-sdk'] @@ -276982,123 +277752,9 @@ module.exports.sync = (source, destination, options) => { /***/ }), /* 979 */, -/* 980 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -"use strict"; - - -const pFinally = __webpack_require__(697); - -class TimeoutError extends Error { - constructor(message) { - super(message); - this.name = 'TimeoutError'; - } -} - -const pTimeout = (promise, milliseconds, fallback) => new Promise((resolve, reject) => { - if (typeof milliseconds !== 'number' || milliseconds < 0) { - throw new TypeError('Expected `milliseconds` to be a positive number'); - } - - if (milliseconds === Infinity) { - resolve(promise); - return; - } - - const timer = setTimeout(() => { - if (typeof fallback === 'function') { - try { - resolve(fallback()); - } catch (error) { - reject(error); - } - - return; - } - - const message = typeof fallback === 'string' ? fallback : `Promise timed out after ${milliseconds} milliseconds`; - const timeoutError = fallback instanceof Error ? fallback : new TimeoutError(message); - - if (typeof promise.cancel === 'function') { - promise.cancel(); - } - - reject(timeoutError); - }, milliseconds); - - // TODO: Use native `finally` keyword when targeting Node.js 10 - pFinally( - // eslint-disable-next-line promise/prefer-await-to-then - promise.then(resolve, reject), - () => { - clearTimeout(timer); - } - ); -}); - -module.exports = pTimeout; -// TODO: Remove this for the next major release -module.exports.default = pTimeout; - -module.exports.TimeoutError = TimeoutError; - - -/***/ }), +/* 980 */, /* 981 */, -/* 982 */ -/***/ (function(__unusedmodule, exports, __webpack_require__) { - -"use strict"; - -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -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)) result[k] = mod[k]; - result["default"] = mod; - return result; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const debug_1 = __importDefault(__webpack_require__(784)); -const path_1 = __importDefault(__webpack_require__(622)); -const ts = __importStar(__webpack_require__(752)); -const shared_1 = __webpack_require__(164); -const log = debug_1.default('typescript-eslint:typescript-estree:createDefaultProgram'); -/** - * @param code The code of the file being linted - * @param extra The config object - * @param extra.tsconfigRootDir The root directory for relative tsconfig paths - * @param extra.projects Provided tsconfig paths - * @returns If found, returns the source file corresponding to the code and the containing program - */ -function createDefaultProgram(code, extra) { - log('Getting default program for: %s', extra.filePath || 'unnamed file'); - if (!extra.projects || extra.projects.length !== 1) { - return undefined; - } - const tsconfigPath = shared_1.getTsconfigPath(extra.projects[0], extra); - const commandLine = ts.getParsedCommandLineOfConfigFile(tsconfigPath, shared_1.createDefaultCompilerOptionsFromExtra(extra), Object.assign(Object.assign({}, ts.sys), { onUnRecoverableConfigFileDiagnostic: () => { } })); - if (!commandLine) { - return undefined; - } - const compilerHost = ts.createCompilerHost(commandLine.options, - /* setParentNodes */ true); - const oldReadFile = compilerHost.readFile; - compilerHost.readFile = (fileName) => path_1.default.normalize(fileName) === path_1.default.normalize(extra.filePath) - ? code - : oldReadFile(fileName); - const program = ts.createProgram([extra.filePath], commandLine.options, compilerHost); - const ast = program.getSourceFile(extra.filePath); - return ast && { ast, program }; -} -exports.createDefaultProgram = createDefaultProgram; -//# sourceMappingURL=createDefaultProgram.js.map - -/***/ }), +/* 982 */, /* 983 */ /***/ (function(module, __unusedexports, __webpack_require__) { @@ -277111,7 +277767,7 @@ exports.createDefaultProgram = createDefaultProgram; */ var fs = __webpack_require__(747); var glob = __webpack_require__(120); -var async = __webpack_require__(225); +var async = __webpack_require__(233); var path = __webpack_require__(622); var util = __webpack_require__(108); @@ -290808,481 +291464,173 @@ exports.tokTypes = types; /* 986 */ /***/ (function(module, __unusedexports, __webpack_require__) { -// hoisted class for cyclic dependency -class Range { - constructor (range, options) { - if (!options || typeof options !== 'object') { - options = { - loose: !!options, - includePrerelease: false - } - } - - if (range instanceof Range) { - if ( - range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease - ) { - return range - } else { - return new Range(range.raw, options) - } - } - - if (range instanceof Comparator) { - // just put it in the set and return - this.raw = range.value - this.set = [[range]] - this.format() - return this - } +const Range = __webpack_require__(33) +const { ANY } = __webpack_require__(731) +const satisfies = __webpack_require__(586) +const compare = __webpack_require__(386) - this.options = options - this.loose = !!options.loose - this.includePrerelease = !!options.includePrerelease +// Complex range `r1 || r2 || ...` is a subset of `R1 || R2 || ...` iff: +// - Every simple range `r1, r2, ...` is a subset of some `R1, R2, ...` +// +// Simple range `c1 c2 ...` is a subset of simple range `C1 C2 ...` iff: +// - If c is only the ANY comparator +// - If C is only the ANY comparator, return true +// - Else return false +// - Let EQ be the set of = comparators in c +// - If EQ is more than one, return true (null set) +// - Let GT be the highest > or >= comparator in c +// - Let LT be the lowest < or <= comparator in c +// - If GT and LT, and GT.semver > LT.semver, return true (null set) +// - If EQ +// - If GT, and EQ does not satisfy GT, return true (null set) +// - If LT, and EQ does not satisfy LT, return true (null set) +// - If EQ satisfies every C, return true +// - Else return false +// - If GT +// - If GT is lower than any > or >= comp in C, return false +// - If GT is >=, and GT.semver does not satisfy every C, return false +// - If LT +// - If LT.semver is greater than that of any > comp in C, return false +// - If LT is <=, and LT.semver does not satisfy every C, return false +// - If any C is a = range, and GT or LT are set, return false +// - Else return true - // First, split based on boolean or || - this.raw = range - this.set = range - .split(/\s*\|\|\s*/) - // map the range to a 2d array of comparators - .map(range => this.parseRange(range.trim())) - // throw out any comparator lists that are empty - // this generally means that it was not a valid range, which is allowed - // in loose mode, but will still throw if the WHOLE range is invalid. - .filter(c => c.length) +const subset = (sub, dom, options) => { + sub = new Range(sub, options) + dom = new Range(dom, options) + let sawNonNull = false - if (!this.set.length) { - throw new TypeError(`Invalid SemVer Range: ${range}`) + OUTER: for (const simpleSub of sub.set) { + for (const simpleDom of dom.set) { + const isSub = simpleSubset(simpleSub, simpleDom, options) + sawNonNull = sawNonNull || isSub !== null + if (isSub) + continue OUTER } - - this.format() + // the null set is a subset of everything, but null simple ranges in + // a complex range should be ignored. so if we saw a non-null range, + // then we know this isn't a subset, but if EVERY simple range was null, + // then it is a subset. + if (sawNonNull) + return false } + return true +} - format () { - this.range = this.set - .map((comps) => { - return comps.join(' ').trim() - }) - .join('||') - .trim() - return this.range - } +const simpleSubset = (sub, dom, options) => { + if (sub.length === 1 && sub[0].semver === ANY) + return dom.length === 1 && dom[0].semver === ANY - toString () { - return this.range + const eqSet = new Set() + let gt, lt + for (const c of sub) { + if (c.operator === '>' || c.operator === '>=') + gt = higherGT(gt, c, options) + else if (c.operator === '<' || c.operator === '<=') + lt = lowerLT(lt, c, options) + else + eqSet.add(c.semver) } - parseRange (range) { - const loose = this.options.loose - range = range.trim() - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - const hr = loose ? re[t.HYPHENRANGELOOSE] : re[t.HYPHENRANGE] - range = range.replace(hr, hyphenReplace(this.options.includePrerelease)) - debug('hyphen replace', range) - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[t.COMPARATORTRIM], comparatorTrimReplace) - debug('comparator trim', range, re[t.COMPARATORTRIM]) - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[t.TILDETRIM], tildeTrimReplace) - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[t.CARETTRIM], caretTrimReplace) - - // normalize spaces - range = range.split(/\s+/).join(' ') - - // At this point, the range is completely trimmed and - // ready to be split into comparators. + if (eqSet.size > 1) + return null - const compRe = loose ? re[t.COMPARATORLOOSE] : re[t.COMPARATOR] - return range - .split(' ') - .map(comp => parseComparator(comp, this.options)) - .join(' ') - .split(/\s+/) - .map(comp => replaceGTE0(comp, this.options)) - // in loose mode, throw out any that are not valid comparators - .filter(this.options.loose ? comp => !!comp.match(compRe) : () => true) - .map(comp => new Comparator(comp, this.options)) + let gtltComp + if (gt && lt) { + gtltComp = compare(gt.semver, lt.semver, options) + if (gtltComp > 0) + return null + else if (gtltComp === 0 && (gt.operator !== '>=' || lt.operator !== '<=')) + return null } - intersects (range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required') - } - - return this.set.some((thisComparators) => { - return ( - isSatisfiable(thisComparators, options) && - range.set.some((rangeComparators) => { - return ( - isSatisfiable(rangeComparators, options) && - thisComparators.every((thisComparator) => { - return rangeComparators.every((rangeComparator) => { - return thisComparator.intersects(rangeComparator, options) - }) - }) - ) - }) - ) - }) - } + // will iterate one or zero times + for (const eq of eqSet) { + if (gt && !satisfies(eq, String(gt), options)) + return null - // if ANY of the sets match ALL of its comparators, then pass - test (version) { - if (!version) { - return false - } + if (lt && !satisfies(eq, String(lt), options)) + return null - if (typeof version === 'string') { - try { - version = new SemVer(version, this.options) - } catch (er) { + for (const c of dom) { + if (!satisfies(eq, String(c), options)) return false - } - } - - for (let i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) { - return true - } } - return false - } -} -module.exports = Range - -const Comparator = __webpack_require__(123) -const debug = __webpack_require__(487) -const SemVer = __webpack_require__(369) -const { - re, - t, - comparatorTrimReplace, - tildeTrimReplace, - caretTrimReplace -} = __webpack_require__(590) - -// take a set of comparators and determine whether there -// exists a version which can satisfy it -const isSatisfiable = (comparators, options) => { - let result = true - const remainingComparators = comparators.slice() - let testComparator = remainingComparators.pop() - - while (result && remainingComparators.length) { - result = remainingComparators.every((otherComparator) => { - return testComparator.intersects(otherComparator, options) - }) - - testComparator = remainingComparators.pop() + return true } - return result -} - -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -const parseComparator = (comp, options) => { - debug('comp', comp, options) - comp = replaceCarets(comp, options) - debug('caret', comp) - comp = replaceTildes(comp, options) - debug('tildes', comp) - comp = replaceXRanges(comp, options) - debug('xrange', comp) - comp = replaceStars(comp, options) - debug('stars', comp) - return comp -} - -const isX = id => !id || id.toLowerCase() === 'x' || id === '*' - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0-0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0-0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0-0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0-0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0-0 -const replaceTildes = (comp, options) => - comp.trim().split(/\s+/).map((comp) => { - return replaceTilde(comp, options) - }).join(' ') - -const replaceTilde = (comp, options) => { - const r = options.loose ? re[t.TILDELOOSE] : re[t.TILDE] - return comp.replace(r, (_, M, m, p, pr) => { - debug('tilde', comp, _, M, m, p, pr) - let ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0 <${+M + 1}.0.0-0` - } else if (isX(p)) { - // ~1.2 == >=1.2.0 <1.3.0-0 - ret = `>=${M}.${m}.0 <${M}.${+m + 1}.0-0` - } else if (pr) { - debug('replaceTilde pr', pr) - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } else { - // ~1.2.3 == >=1.2.3 <1.3.0-0 - ret = `>=${M}.${m}.${p - } <${M}.${+m + 1}.0-0` - } - - debug('tilde return', ret) - return ret - }) -} - -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0-0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0-0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0-0 -// ^1.2.3 --> >=1.2.3 <2.0.0-0 -// ^1.2.0 --> >=1.2.0 <2.0.0-0 -const replaceCarets = (comp, options) => - comp.trim().split(/\s+/).map((comp) => { - return replaceCaret(comp, options) - }).join(' ') - -const replaceCaret = (comp, options) => { - debug('caret', comp, options) - const r = options.loose ? re[t.CARETLOOSE] : re[t.CARET] - const z = options.includePrerelease ? '-0' : '' - return comp.replace(r, (_, M, m, p, pr) => { - debug('caret', comp, _, M, m, p, pr) - let ret - - if (isX(M)) { - ret = '' - } else if (isX(m)) { - ret = `>=${M}.0.0${z} <${+M + 1}.0.0-0` - } else if (isX(p)) { - if (M === '0') { - ret = `>=${M}.${m}.0${z} <${M}.${+m + 1}.0-0` - } else { - ret = `>=${M}.${m}.0${z} <${+M + 1}.0.0-0` - } - } else if (pr) { - debug('replaceCaret pr', pr) - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p}-${pr - } <${+M + 1}.0.0-0` - } - } else { - debug('no pr') - if (M === '0') { - if (m === '0') { - ret = `>=${M}.${m}.${p - }${z} <${M}.${m}.${+p + 1}-0` - } else { - ret = `>=${M}.${m}.${p - }${z} <${M}.${+m + 1}.0-0` - } - } else { - ret = `>=${M}.${m}.${p - } <${+M + 1}.0.0-0` - } - } - - debug('caret return', ret) - return ret - }) -} - -const replaceXRanges = (comp, options) => { - debug('replaceXRanges', comp, options) - return comp.split(/\s+/).map((comp) => { - return replaceXRange(comp, options) - }).join(' ') -} - -const replaceXRange = (comp, options) => { - comp = comp.trim() - const r = options.loose ? re[t.XRANGELOOSE] : re[t.XRANGE] - return comp.replace(r, (ret, gtlt, M, m, p, pr) => { - debug('xRange', comp, ret, gtlt, M, m, p, pr) - const xM = isX(M) - const xm = xM || isX(m) - const xp = xm || isX(p) - const anyX = xp - - if (gtlt === '=' && anyX) { - gtlt = '' + let higher, lower + let hasDomLT, hasDomGT + for (const c of dom) { + hasDomGT = hasDomGT || c.operator === '>' || c.operator === '>=' + hasDomLT = hasDomLT || c.operator === '<' || c.operator === '<=' + if (gt) { + if (c.operator === '>' || c.operator === '>=') { + higher = higherGT(gt, c, options) + if (higher === c) + return false + } else if (gt.operator === '>=' && !satisfies(gt.semver, String(c), options)) + return false } - - // if we're including prereleases in the match, then we need - // to fix this to -0, the lowest possible prerelease value - pr = options.includePrerelease ? '-0' : '' - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0-0' - } else { - // nothing is forbidden - ret = '*' - } - } else if (gtlt && anyX) { - // we know patch is an x, because we have any x at all. - // replace X with 0 - if (xm) { - m = 0 - } - p = 0 - - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - gtlt = '>=' - if (xm) { - M = +M + 1 - m = 0 - p = 0 - } else { - m = +m + 1 - p = 0 - } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<' - if (xm) { - M = +M + 1 - } else { - m = +m + 1 - } - } - - if (gtlt === '<') - pr = '-0' - - ret = `${gtlt + M}.${m}.${p}${pr}` - } else if (xm) { - ret = `>=${M}.0.0${pr} <${+M + 1}.0.0-0` - } else if (xp) { - ret = `>=${M}.${m}.0${pr - } <${M}.${+m + 1}.0-0` + if (lt) { + if (c.operator === '<' || c.operator === '<=') { + lower = lowerLT(lt, c, options) + if (lower === c) + return false + } else if (lt.operator === '<=' && !satisfies(lt.semver, String(c), options)) + return false } + if (!c.operator && (lt || gt) && gtltComp !== 0) + return false + } - debug('xRange return', ret) + // if there was a < or >, and nothing in the dom, then must be false + // UNLESS it was limited by another range in the other direction. + // Eg, >1.0.0 <1.0.1 is still a subset of <2.0.0 + if (gt && hasDomLT && !lt && gtltComp !== 0) + return false - return ret - }) -} + if (lt && hasDomGT && !gt && gtltComp !== 0) + return false -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -const replaceStars = (comp, options) => { - debug('replaceStars', comp, options) - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[t.STAR], '') + return true } -const replaceGTE0 = (comp, options) => { - debug('replaceGTE0', comp, options) - return comp.trim() - .replace(re[options.includePrerelease ? t.GTE0PRE : t.GTE0], '') +// >=1.2.3 is lower than >1.2.3 +const higherGT = (a, b, options) => { + if (!a) + return b + const comp = compare(a.semver, b.semver, options) + return comp > 0 ? a + : comp < 0 ? b + : b.operator === '>' && a.operator === '>=' ? b + : a } -// This function is passed to string.replace(re[t.HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0-0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0-0 -const hyphenReplace = incPr => ($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) => { - if (isX(fM)) { - from = '' - } else if (isX(fm)) { - from = `>=${fM}.0.0${incPr ? '-0' : ''}` - } else if (isX(fp)) { - from = `>=${fM}.${fm}.0${incPr ? '-0' : ''}` - } else if (fpr) { - from = `>=${from}` - } else { - from = `>=${from}${incPr ? '-0' : ''}` - } - - if (isX(tM)) { - to = '' - } else if (isX(tm)) { - to = `<${+tM + 1}.0.0-0` - } else if (isX(tp)) { - to = `<${tM}.${+tm + 1}.0-0` - } else if (tpr) { - to = `<=${tM}.${tm}.${tp}-${tpr}` - } else if (incPr) { - to = `<${tM}.${tm}.${+tp + 1}-0` - } else { - to = `<=${to}` - } - - return (`${from} ${to}`).trim() +// <=1.2.3 is higher than <1.2.3 +const lowerLT = (a, b, options) => { + if (!a) + return b + const comp = compare(a.semver, b.semver, options) + return comp < 0 ? a + : comp > 0 ? b + : b.operator === '<' && a.operator === '<=' ? b + : a } -const testSet = (set, version, options) => { - for (let i = 0; i < set.length; i++) { - if (!set[i].test(version)) { - return false - } - } - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (let i = 0; i < set.length; i++) { - debug(set[i].semver) - if (set[i].semver === Comparator.ANY) { - continue - } - - if (set[i].semver.prerelease.length > 0) { - const allowed = set[i].semver - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) { - return true - } - } - } - - // Version has a -pre, but it's not one of the ones we like. - return false - } - - return true -} +module.exports = subset /***/ }), /* 987 */ /***/ (function(module, __unusedexports, __webpack_require__) { -var isCore = __webpack_require__(127); +var isCore = __webpack_require__(528); var fs = __webpack_require__(747); var path = __webpack_require__(622); var caller = __webpack_require__(433); var nodeModulesPaths = __webpack_require__(194); -var normalizeOptions = __webpack_require__(791); +var normalizeOptions = __webpack_require__(590); var defaultIsFile = function isFile(file) { try { @@ -291519,27 +291867,7 @@ module.exports = getRawTag; /***/ }), -/* 989 */ -/***/ (function(module, __unusedexports, __webpack_require__) { - -const SemVer = __webpack_require__(243) - -const inc = (version, release, options, identifier) => { - if (typeof (options) === 'string') { - identifier = options - options = undefined - } - - try { - return new SemVer(version, options).inc(release, identifier).version - } catch (er) { - return null - } -} -module.exports = inc - - -/***/ }), +/* 989 */, /* 990 */ /***/ (function(module, exports, __webpack_require__) { @@ -292911,38 +293239,16 @@ exports.computeSourceURL = computeSourceURL; /***/ }), -/* 993 */, -/* 994 */ +/* 993 */ /***/ (function(module, __unusedexports, __webpack_require__) { -const SemVer = __webpack_require__(369) -const Range = __webpack_require__(986) - -const maxSatisfying = (versions, range, options) => { - let max = null - let maxSV = null - let rangeObj = null - try { - rangeObj = new Range(range, options) - } catch (er) { - return null - } - versions.forEach((v) => { - if (rangeObj.test(v)) { - // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { - // compare(max, v, true) - max = v - maxSV = new SemVer(max, options) - } - } - }) - return max -} -module.exports = maxSatisfying +const compare = __webpack_require__(386) +const neq = (a, b, loose) => compare(a, b, loose) !== 0 +module.exports = neq /***/ }), +/* 994 */, /* 995 */ /***/ (function(module) { @@ -293621,264 +293927,13 @@ module.exports = defaults; /* 997 */ /***/ (function(module, __unusedexports, __webpack_require__) { -"use strict"; - - -var utils = __webpack_require__(733); - -var has = Object.prototype.hasOwnProperty; -var isArray = Array.isArray; - -var defaults = { - allowDots: false, - allowPrototypes: false, - arrayLimit: 20, - charset: 'utf-8', - charsetSentinel: false, - comma: false, - decoder: utils.decode, - delimiter: '&', - depth: 5, - ignoreQueryPrefix: false, - interpretNumericEntities: false, - parameterLimit: 1000, - parseArrays: true, - plainObjects: false, - strictNullHandling: false -}; - -var interpretNumericEntities = function (str) { - return str.replace(/&#(\d+);/g, function ($0, numberStr) { - return String.fromCharCode(parseInt(numberStr, 10)); - }); -}; - -var parseArrayValue = function (val, options) { - if (val && typeof val === 'string' && options.comma && val.indexOf(',') > -1) { - return val.split(','); - } - - return val; -}; - -// This is what browsers will submit when the ✓ character occurs in an -// application/x-www-form-urlencoded body and the encoding of the page containing -// the form is iso-8859-1, or when the submitted form has an accept-charset -// attribute of iso-8859-1. Presumably also with other charsets that do not contain -// the ✓ character, such as us-ascii. -var isoSentinel = 'utf8=%26%2310003%3B'; // encodeURIComponent('✓') - -// These are the percent-encoded utf-8 octets representing a checkmark, indicating that the request actually is utf-8 encoded. -var charsetSentinel = 'utf8=%E2%9C%93'; // encodeURIComponent('✓') - -var parseValues = function parseQueryStringValues(str, options) { - var obj = {}; - var cleanStr = options.ignoreQueryPrefix ? str.replace(/^\?/, '') : str; - var limit = options.parameterLimit === Infinity ? undefined : options.parameterLimit; - var parts = cleanStr.split(options.delimiter, limit); - var skipIndex = -1; // Keep track of where the utf8 sentinel was found - var i; - - var charset = options.charset; - if (options.charsetSentinel) { - for (i = 0; i < parts.length; ++i) { - if (parts[i].indexOf('utf8=') === 0) { - if (parts[i] === charsetSentinel) { - charset = 'utf-8'; - } else if (parts[i] === isoSentinel) { - charset = 'iso-8859-1'; - } - skipIndex = i; - i = parts.length; // The eslint settings do not allow break; - } - } - } - - for (i = 0; i < parts.length; ++i) { - if (i === skipIndex) { - continue; - } - var part = parts[i]; - - var bracketEqualsPos = part.indexOf(']='); - var pos = bracketEqualsPos === -1 ? part.indexOf('=') : bracketEqualsPos + 1; - - var key, val; - if (pos === -1) { - key = options.decoder(part, defaults.decoder, charset, 'key'); - val = options.strictNullHandling ? null : ''; - } else { - key = options.decoder(part.slice(0, pos), defaults.decoder, charset, 'key'); - val = utils.maybeMap( - parseArrayValue(part.slice(pos + 1), options), - function (encodedVal) { - return options.decoder(encodedVal, defaults.decoder, charset, 'value'); - } - ); - } - - if (val && options.interpretNumericEntities && charset === 'iso-8859-1') { - val = interpretNumericEntities(val); - } - - if (part.indexOf('[]=') > -1) { - val = isArray(val) ? [val] : val; - } - - if (has.call(obj, key)) { - obj[key] = utils.combine(obj[key], val); - } else { - obj[key] = val; - } - } - - return obj; -}; - -var parseObject = function (chain, val, options, valuesParsed) { - var leaf = valuesParsed ? val : parseArrayValue(val, options); - - for (var i = chain.length - 1; i >= 0; --i) { - var obj; - var root = chain[i]; - - if (root === '[]' && options.parseArrays) { - obj = [].concat(leaf); - } else { - obj = options.plainObjects ? Object.create(null) : {}; - var cleanRoot = root.charAt(0) === '[' && root.charAt(root.length - 1) === ']' ? root.slice(1, -1) : root; - var index = parseInt(cleanRoot, 10); - if (!options.parseArrays && cleanRoot === '') { - obj = { 0: leaf }; - } else if ( - !isNaN(index) - && root !== cleanRoot - && String(index) === cleanRoot - && index >= 0 - && (options.parseArrays && index <= options.arrayLimit) - ) { - obj = []; - obj[index] = leaf; - } else { - obj[cleanRoot] = leaf; - } - } - - leaf = obj; // eslint-disable-line no-param-reassign - } - - return leaf; -}; - -var parseKeys = function parseQueryStringKeys(givenKey, val, options, valuesParsed) { - if (!givenKey) { - return; - } - - // Transform dot notation to bracket notation - var key = options.allowDots ? givenKey.replace(/\.([^.[]+)/g, '[$1]') : givenKey; - - // The regex chunks - - var brackets = /(\[[^[\]]*])/; - var child = /(\[[^[\]]*])/g; - - // Get the parent - - var segment = options.depth > 0 && brackets.exec(key); - var parent = segment ? key.slice(0, segment.index) : key; - - // Stash the parent if it exists - - var keys = []; - if (parent) { - // If we aren't using plain objects, optionally prefix keys that would overwrite object prototype properties - if (!options.plainObjects && has.call(Object.prototype, parent)) { - if (!options.allowPrototypes) { - return; - } - } - - keys.push(parent); - } - - // Loop through children appending to the array until we hit depth - - var i = 0; - while (options.depth > 0 && (segment = child.exec(key)) !== null && i < options.depth) { - i += 1; - if (!options.plainObjects && has.call(Object.prototype, segment[1].slice(1, -1))) { - if (!options.allowPrototypes) { - return; - } - } - keys.push(segment[1]); - } - - // If there's a remainder, just add whatever is left - - if (segment) { - keys.push('[' + key.slice(segment.index) + ']'); - } - - return parseObject(keys, val, options, valuesParsed); -}; - -var normalizeParseOptions = function normalizeParseOptions(opts) { - if (!opts) { - return defaults; - } - - if (opts.decoder !== null && opts.decoder !== undefined && typeof opts.decoder !== 'function') { - throw new TypeError('Decoder has to be a function.'); - } - - if (typeof opts.charset !== 'undefined' && opts.charset !== 'utf-8' && opts.charset !== 'iso-8859-1') { - throw new TypeError('The charset option must be either utf-8, iso-8859-1, or undefined'); - } - var charset = typeof opts.charset === 'undefined' ? defaults.charset : opts.charset; - - return { - allowDots: typeof opts.allowDots === 'undefined' ? defaults.allowDots : !!opts.allowDots, - allowPrototypes: typeof opts.allowPrototypes === 'boolean' ? opts.allowPrototypes : defaults.allowPrototypes, - arrayLimit: typeof opts.arrayLimit === 'number' ? opts.arrayLimit : defaults.arrayLimit, - charset: charset, - charsetSentinel: typeof opts.charsetSentinel === 'boolean' ? opts.charsetSentinel : defaults.charsetSentinel, - comma: typeof opts.comma === 'boolean' ? opts.comma : defaults.comma, - decoder: typeof opts.decoder === 'function' ? opts.decoder : defaults.decoder, - delimiter: typeof opts.delimiter === 'string' || utils.isRegExp(opts.delimiter) ? opts.delimiter : defaults.delimiter, - // eslint-disable-next-line no-implicit-coercion, no-extra-parens - depth: (typeof opts.depth === 'number' || opts.depth === false) ? +opts.depth : defaults.depth, - ignoreQueryPrefix: opts.ignoreQueryPrefix === true, - interpretNumericEntities: typeof opts.interpretNumericEntities === 'boolean' ? opts.interpretNumericEntities : defaults.interpretNumericEntities, - parameterLimit: typeof opts.parameterLimit === 'number' ? opts.parameterLimit : defaults.parameterLimit, - parseArrays: opts.parseArrays !== false, - plainObjects: typeof opts.plainObjects === 'boolean' ? opts.plainObjects : defaults.plainObjects, - strictNullHandling: typeof opts.strictNullHandling === 'boolean' ? opts.strictNullHandling : defaults.strictNullHandling - }; -}; - -module.exports = function (str, opts) { - var options = normalizeParseOptions(opts); - - if (str === '' || str === null || typeof str === 'undefined') { - return options.plainObjects ? Object.create(null) : {}; - } - - var tempObj = typeof str === 'string' ? parseValues(str, options) : str; - var obj = options.plainObjects ? Object.create(null) : {}; - - // Iterate over the keys and setup the new object - - var keys = Object.keys(tempObj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var newObj = parseKeys(key, tempObj[key], options, typeof str === 'string'); - obj = utils.merge(obj, newObj, options); - } - - return utils.compact(obj); -}; +const Range = __webpack_require__(33) +const intersects = (r1, r2, options) => { + r1 = new Range(r1, options) + r2 = new Range(r2, options) + return r1.intersects(r2) +} +module.exports = intersects /***/ }), diff --git a/package-lock.json b/package-lock.json index 6c2004de..0e8e1e40 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "actions-netlify", - "version": "1.1.1", + "version": "1.1.2", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -37,19 +37,19 @@ } }, "@babel/core": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.1.tgz", - "integrity": "sha512-u8XiZ6sMXW/gPmoP5ijonSUln4unazG291X0XAQ5h0s8qnAFr6BRRZGUEK+jtRWdmB0NTJQt7Uga25q8GetIIg==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.2.tgz", + "integrity": "sha512-KQmV9yguEjQsXqyOUGKjS4+3K8/DlOCE2pZcq4augdQmtTy5iv5EHtmMSJ7V4c1BIPjuwtZYqYLCq9Ga+hGBRQ==", "dev": true, "requires": { "@babel/code-frame": "^7.10.1", - "@babel/generator": "^7.10.1", + "@babel/generator": "^7.10.2", "@babel/helper-module-transforms": "^7.10.1", "@babel/helpers": "^7.10.1", - "@babel/parser": "^7.10.1", + "@babel/parser": "^7.10.2", "@babel/template": "^7.10.1", "@babel/traverse": "^7.10.1", - "@babel/types": "^7.10.1", + "@babel/types": "^7.10.2", "convert-source-map": "^1.7.0", "debug": "^4.1.0", "gensync": "^1.0.0-beta.1", @@ -70,12 +70,12 @@ } }, "@babel/generator": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.1.tgz", - "integrity": "sha512-AT0YPLQw9DI21tliuJIdplVfLHya6mcGa8ctkv7n4Qv+hYacJrKmNWIteAK1P9iyLikFIAkwqJ7HAOqIDLFfgA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.2.tgz", + "integrity": "sha512-AxfBNHNu99DTMvlUPlt1h2+Hn7knPpH5ayJ8OqDWSeLld+Fi2AYBTC/IejWDM9Edcii4UzZRCsbUt0WlSDsDsA==", "dev": true, "requires": { - "@babel/types": "^7.10.1", + "@babel/types": "^7.10.2", "jsesc": "^2.5.1", "lodash": "^4.17.13", "source-map": "^0.5.0" @@ -128,9 +128,9 @@ } }, "@babel/parser": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.1.tgz", - "integrity": "sha512-AUTksaz3FqugBkbTZ1i+lDLG5qy8hIzCaAxEtttU6C0BtZZU9pkNZtWSVAht4EW9kl46YBiyTGMp9xTTGqViNg==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.2.tgz", + "integrity": "sha512-PApSXlNMJyB4JiGVhCOlzKIif+TKFTvu0aQAhnTvfP/z3vVSN6ZypH5bfUNwFXXjRQtUEBNFd2PtmCmG2Py3qQ==", "dev": true }, "@babel/template": { @@ -162,9 +162,9 @@ } }, "@babel/types": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.1.tgz", - "integrity": "sha512-L2yqUOpf3tzlW9GVuipgLEcZxnO+96SzR6fjXMuxxNkIgFJ5+07mHCZ+HkHqaeZu8+3LKnNJJ1bKbjBETQAsrA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.1", @@ -272,9 +272,9 @@ "dev": true }, "@babel/types": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.1.tgz", - "integrity": "sha512-L2yqUOpf3tzlW9GVuipgLEcZxnO+96SzR6fjXMuxxNkIgFJ5+07mHCZ+HkHqaeZu8+3LKnNJJ1bKbjBETQAsrA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.1", @@ -300,9 +300,9 @@ "dev": true }, "@babel/types": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.1.tgz", - "integrity": "sha512-L2yqUOpf3tzlW9GVuipgLEcZxnO+96SzR6fjXMuxxNkIgFJ5+07mHCZ+HkHqaeZu8+3LKnNJJ1bKbjBETQAsrA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.1", @@ -363,9 +363,9 @@ } }, "@babel/parser": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.1.tgz", - "integrity": "sha512-AUTksaz3FqugBkbTZ1i+lDLG5qy8hIzCaAxEtttU6C0BtZZU9pkNZtWSVAht4EW9kl46YBiyTGMp9xTTGqViNg==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.2.tgz", + "integrity": "sha512-PApSXlNMJyB4JiGVhCOlzKIif+TKFTvu0aQAhnTvfP/z3vVSN6ZypH5bfUNwFXXjRQtUEBNFd2PtmCmG2Py3qQ==", "dev": true }, "@babel/template": { @@ -380,9 +380,9 @@ } }, "@babel/types": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.1.tgz", - "integrity": "sha512-L2yqUOpf3tzlW9GVuipgLEcZxnO+96SzR6fjXMuxxNkIgFJ5+07mHCZ+HkHqaeZu8+3LKnNJJ1bKbjBETQAsrA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.1", @@ -458,9 +458,9 @@ "dev": true }, "@babel/types": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.1.tgz", - "integrity": "sha512-L2yqUOpf3tzlW9GVuipgLEcZxnO+96SzR6fjXMuxxNkIgFJ5+07mHCZ+HkHqaeZu8+3LKnNJJ1bKbjBETQAsrA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.1", @@ -498,12 +498,12 @@ } }, "@babel/generator": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.1.tgz", - "integrity": "sha512-AT0YPLQw9DI21tliuJIdplVfLHya6mcGa8ctkv7n4Qv+hYacJrKmNWIteAK1P9iyLikFIAkwqJ7HAOqIDLFfgA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.2.tgz", + "integrity": "sha512-AxfBNHNu99DTMvlUPlt1h2+Hn7knPpH5ayJ8OqDWSeLld+Fi2AYBTC/IejWDM9Edcii4UzZRCsbUt0WlSDsDsA==", "dev": true, "requires": { - "@babel/types": "^7.10.1", + "@babel/types": "^7.10.2", "jsesc": "^2.5.1", "lodash": "^4.17.13", "source-map": "^0.5.0" @@ -556,9 +556,9 @@ } }, "@babel/parser": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.1.tgz", - "integrity": "sha512-AUTksaz3FqugBkbTZ1i+lDLG5qy8hIzCaAxEtttU6C0BtZZU9pkNZtWSVAht4EW9kl46YBiyTGMp9xTTGqViNg==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.2.tgz", + "integrity": "sha512-PApSXlNMJyB4JiGVhCOlzKIif+TKFTvu0aQAhnTvfP/z3vVSN6ZypH5bfUNwFXXjRQtUEBNFd2PtmCmG2Py3qQ==", "dev": true }, "@babel/template": { @@ -590,9 +590,9 @@ } }, "@babel/types": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.1.tgz", - "integrity": "sha512-L2yqUOpf3tzlW9GVuipgLEcZxnO+96SzR6fjXMuxxNkIgFJ5+07mHCZ+HkHqaeZu8+3LKnNJJ1bKbjBETQAsrA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.1", @@ -689,9 +689,9 @@ } }, "@babel/parser": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.1.tgz", - "integrity": "sha512-AUTksaz3FqugBkbTZ1i+lDLG5qy8hIzCaAxEtttU6C0BtZZU9pkNZtWSVAht4EW9kl46YBiyTGMp9xTTGqViNg==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.2.tgz", + "integrity": "sha512-PApSXlNMJyB4JiGVhCOlzKIif+TKFTvu0aQAhnTvfP/z3vVSN6ZypH5bfUNwFXXjRQtUEBNFd2PtmCmG2Py3qQ==", "dev": true }, "@babel/template": { @@ -706,9 +706,9 @@ } }, "@babel/types": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.1.tgz", - "integrity": "sha512-L2yqUOpf3tzlW9GVuipgLEcZxnO+96SzR6fjXMuxxNkIgFJ5+07mHCZ+HkHqaeZu8+3LKnNJJ1bKbjBETQAsrA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.1", @@ -804,12 +804,12 @@ } }, "@babel/generator": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.1.tgz", - "integrity": "sha512-AT0YPLQw9DI21tliuJIdplVfLHya6mcGa8ctkv7n4Qv+hYacJrKmNWIteAK1P9iyLikFIAkwqJ7HAOqIDLFfgA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.10.2.tgz", + "integrity": "sha512-AxfBNHNu99DTMvlUPlt1h2+Hn7knPpH5ayJ8OqDWSeLld+Fi2AYBTC/IejWDM9Edcii4UzZRCsbUt0WlSDsDsA==", "dev": true, "requires": { - "@babel/types": "^7.10.1", + "@babel/types": "^7.10.2", "jsesc": "^2.5.1", "lodash": "^4.17.13", "source-map": "^0.5.0" @@ -862,9 +862,9 @@ } }, "@babel/parser": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.1.tgz", - "integrity": "sha512-AUTksaz3FqugBkbTZ1i+lDLG5qy8hIzCaAxEtttU6C0BtZZU9pkNZtWSVAht4EW9kl46YBiyTGMp9xTTGqViNg==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.10.2.tgz", + "integrity": "sha512-PApSXlNMJyB4JiGVhCOlzKIif+TKFTvu0aQAhnTvfP/z3vVSN6ZypH5bfUNwFXXjRQtUEBNFd2PtmCmG2Py3qQ==", "dev": true }, "@babel/template": { @@ -896,9 +896,9 @@ } }, "@babel/types": { - "version": "7.10.1", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.1.tgz", - "integrity": "sha512-L2yqUOpf3tzlW9GVuipgLEcZxnO+96SzR6fjXMuxxNkIgFJ5+07mHCZ+HkHqaeZu8+3LKnNJJ1bKbjBETQAsrA==", + "version": "7.10.2", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.10.2.tgz", + "integrity": "sha512-AD3AwWBSz0AWF0AkCN9VPiWrvldXq+/e3cHa4J89vo4ymjz1XwrBFFVZmkJTsQIPNk+ZVomPSXUJqq8yyjZsng==", "dev": true, "requires": { "@babel/helper-validator-identifier": "^7.10.1", @@ -1552,9 +1552,9 @@ "integrity": "sha512-Nk1NswVrUtI7SDbyn/uvITYeIG5iukKlhsu/6fg4k1G5RMHqMDtVHy+2qcOhKmkf7Qc3ZkIKKd2mQfM6zg2cxw==" }, "@netlify/zip-it-and-ship-it": { - "version": "0.4.0-19", - "resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-0.4.0-19.tgz", - "integrity": "sha512-QjGw5d8iTa9JLqFzMJw2DPYAmG0q7mfZsahf5rPPCmdNty/HkmNTkSswgxuTX+BCXsfjCnfCGbVZbM+8crIT0w==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@netlify/zip-it-and-ship-it/-/zip-it-and-ship-it-1.2.0.tgz", + "integrity": "sha512-aNbB0DcS2t0Iw6OqGVb5YezElyL9teflPPT8k9kDLaW7BDkYt/6eWSReGNnDGfIrEDUsq0GxBLK+wQTw+WeXNQ==", "requires": { "archiver": "^3.0.0", "common-path-prefix": "^2.0.0", @@ -1563,6 +1563,8 @@ "end-of-stream": "^1.4.4", "find-up": "^4.1.0", "glob": "^7.1.6", + "junk": "^3.1.0", + "locate-path": "^5.0.0", "make-dir": "^3.0.2", "p-map": "^3.0.0", "path-exists": "^4.0.0", @@ -1815,9 +1817,9 @@ } }, "@types/babel__core": { - "version": "7.1.7", - "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.7.tgz", - "integrity": "sha512-RL62NqSFPCDK2FM1pSDH0scHpJvsXtZNiYlMB73DgPBaG1E38ZYVL+ei5EkWRbr+KC4YNiAUNBnRj+bgwpgjMw==", + "version": "7.1.8", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.8.tgz", + "integrity": "sha512-KXBiQG2OXvaPWFPDS1rD8yV9vO0OuWIqAEqLsbfX0oU2REN5KuoMnZ1gClWcBhO5I3n6oTVAmrMufOvRqdmFTQ==", "dev": true, "requires": { "@babel/parser": "^7.1.0", @@ -1847,9 +1849,9 @@ } }, "@types/babel__traverse": { - "version": "7.0.11", - "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.11.tgz", - "integrity": "sha512-ddHK5icION5U6q11+tV2f9Mo6CZVuT8GJKld2q9LqHSZbvLbH34Kcu2yFGckZut453+eQU6btIA3RihmnRgI+Q==", + "version": "7.0.12", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.0.12.tgz", + "integrity": "sha512-t4CoEokHTfcyfb4hUaF9oOHu9RmmNWnm1CP0YmMqOOfClKascOmvlEM736vlqeScuGvBDsHkf8R2INd4DWreQA==", "dev": true, "requires": { "@babel/types": "^7.3.0" @@ -1876,9 +1878,9 @@ } }, "@types/istanbul-lib-coverage": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.2.tgz", - "integrity": "sha512-rsZg7eL+Xcxsxk2XlBt9KcG8nOp9iYdKCOikY9x2RFJCyOdNj4MKPQty0e8oZr29vVAzKXr1BmR+kZauti3o1w==", + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.3.tgz", + "integrity": "sha512-sz7iLqvVUg1gIedBOvlkxPlc8/uVzyS5OwGz1cKjXzkl3FpL3al0crU8YGU1WoHkxn0Wxbw5tyi6hvzJKNzFsw==", "dev": true }, "@types/istanbul-lib-report": { @@ -1917,9 +1919,9 @@ "dev": true }, "@types/node": { - "version": "12.12.42", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.42.tgz", - "integrity": "sha512-R/9QdYFLL9dE9l5cWWzWIZByVGFd7lk7JVOJ7KD+E1SJ4gni7XJRLz9QTjyYQiHIqEAgku9VgxdLjMlhhUaAFg==" + "version": "12.12.47", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.47.tgz", + "integrity": "sha512-yzBInQFhdY8kaZmqoL2+3U5dSTMrKaYcb561VU+lDzAYvqt+2lojvBEy+hmpSNuXnPTx7m9+04CzWYOUqWME2A==" }, "@types/normalize-package-data": { "version": "2.4.0", @@ -2016,68 +2018,34 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", - "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.2.0.tgz", + "integrity": "sha512-UbJBsk+xO9dIFKtj16+m42EvUvsjZbbgQ2O5xSTSfVT1Z3yGkL90DVu0Hd3029FZ5/uBgl+F3Vo8FAcEcqc6aQ==", "dev": true, "requires": { "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "2.34.0", + "@typescript-eslint/typescript-estree": "3.2.0", "eslint-scope": "^5.0.0", "eslint-utils": "^2.0.0" } }, "@typescript-eslint/parser": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.0.2.tgz", - "integrity": "sha512-80Z7s83e8QXHNUspqVlWwb4t5gdz/1bBBmafElbK1wwAwiD/yvJsFyHRxlEpNrt4rdK6eB3p+2WEFkEDHAKk9w==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.2.0.tgz", + "integrity": "sha512-Vhu+wwdevDLVDjK1lIcoD6ZbuOa93fzqszkaO3iCnmrScmKwyW/AGkzc2UvfE5TCoCXqq7Jyt6SOXjsIlpqF4A==", "dev": true, "requires": { "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "3.0.2", - "@typescript-eslint/typescript-estree": "3.0.2", + "@typescript-eslint/experimental-utils": "3.2.0", + "@typescript-eslint/typescript-estree": "3.2.0", "eslint-visitor-keys": "^1.1.0" - }, - "dependencies": { - "@typescript-eslint/experimental-utils": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.0.2.tgz", - "integrity": "sha512-4Wc4EczvoY183SSEnKgqAfkj1eLtRgBQ04AAeG+m4RhTVyaazxc1uI8IHf0qLmu7xXe9j1nn+UoDJjbmGmuqXQ==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/typescript-estree": "3.0.2", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" - } - }, - "@typescript-eslint/typescript-estree": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.0.2.tgz", - "integrity": "sha512-cs84mxgC9zQ6viV8MEcigfIKQmKtBkZNDYf8Gru2M+MhnA6z9q0NFMZm2IEzKqAwN8lY5mFVd1Z8DiHj6zQ3Tw==", - "dev": true, - "requires": { - "debug": "^4.1.1", - "eslint-visitor-keys": "^1.1.0", - "glob": "^7.1.6", - "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" - } - }, - "semver": { - "version": "7.3.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", - "dev": true - } } }, "@typescript-eslint/typescript-estree": { - "version": "2.34.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", - "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.2.0.tgz", + "integrity": "sha512-uh+Y2QO7dxNrdLw7mVnjUqkwO/InxEqwN0wF+Za6eo3coxls9aH9kQ/5rSvW2GcNanebRTmsT5w1/92lAOb1bA==", + "dev": true, "requires": { "debug": "^4.1.1", "eslint-visitor-keys": "^1.1.0", @@ -2091,7 +2059,8 @@ "semver": { "version": "7.3.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", - "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true } } }, @@ -3271,6 +3240,27 @@ "ast-module-types": "^2.6.0", "node-source-walk": "^4.2.0", "typescript": "^3.8.3" + }, + "dependencies": { + "@typescript-eslint/typescript-estree": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", + "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==" + } } }, "diff-sequences": { @@ -3369,9 +3359,9 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "escodegen": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.1.tgz", - "integrity": "sha512-Bmt7NcRySdIfNPfU2ZoXDrrXsG9ZjvDxcAlMfDUgRBjLOWTuIACXPBFJH7Z+cLb40JeQco5toikyc9t9P8E9SQ==", + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.14.2.tgz", + "integrity": "sha512-InuOIiKk8wwuOFg6x9BQXbzjrQhtyXh46K9bqVTPzSo2FnyMBaYGBMC6PhQy7yxxil9vIedFBweQBMK74/7o8A==", "requires": { "esprima": "^4.0.1", "estraverse": "^4.2.0", @@ -3744,6 +3734,41 @@ "dev": true, "requires": { "@typescript-eslint/experimental-utils": "^2.5.0" + }, + "dependencies": { + "@typescript-eslint/experimental-utils": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.34.0.tgz", + "integrity": "sha512-eS6FTkq+wuMJ+sgtuNTtcqavWXqsflWcfBnlYhg/nS4aZ1leewkXGbvBhaapn1q6qf4M71bsR1tez5JTRMuqwA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/typescript-estree": "2.34.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + } + }, + "@typescript-eslint/typescript-estree": { + "version": "2.34.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.34.0.tgz", + "integrity": "sha512-OMAr+nJWKdlVM9LOqCqh3pQQPwxHAN7Du8DR6dmwCrAmxtiXQnhHJ6tBNtf+cggqfo51SG/FCwnKhXCIM7hnVg==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "eslint-visitor-keys": "^1.1.0", + "glob": "^7.1.6", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "semver": { + "version": "7.3.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz", + "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", + "dev": true + } } }, "eslint-plugin-jsx-a11y": { @@ -3825,9 +3850,9 @@ "dev": true }, "eslint-scope": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz", - "integrity": "sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.0.tgz", + "integrity": "sha512-iiGRvtxWqgtx5m8EyQUJihBloE4EnYeGE/bz1wSPwJE6tZuJUtHlhqDM4Xj2ukE8Dyy1+HCZ4hE0fzIVMzb58w==", "dev": true, "requires": { "esrecurse": "^4.1.0", @@ -4115,9 +4140,9 @@ "dev": true }, "fast-deep-equal": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.1.tgz", - "integrity": "sha512-8UEa58QDLauDNfpbrX55Q9jrGHThw2ZMdOky5Gl1CDtVeJDPVrG4Jxx1N8jw2gkWaff5UUuX1KJd+9zGe2B+ZA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true }, "fast-diff": { @@ -5432,9 +5457,9 @@ "dev": true }, "acorn": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", - "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz", + "integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==", "dev": true }, "acorn-globals": { @@ -5497,9 +5522,9 @@ "dev": true }, "chalk": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", - "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", + "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "dev": true, "requires": { "ansi-styles": "^4.1.0", @@ -6804,9 +6829,9 @@ }, "dependencies": { "acorn": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.2.0.tgz", - "integrity": "sha512-apwXVmYVpQ34m/i71vrApRrRKCWQnZZF1+npOD0WV5xZFfwWOmKGQ2RWlfdy9vWITsenisM8M0Qeq8agcFHNiQ==", + "version": "7.3.1", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-7.3.1.tgz", + "integrity": "sha512-tLc0wSnatxAQHVHUapaHdz72pi9KUyHjq5KyHjGg9Y8Ifdc79pTh2XvI6I1/chZbnM7QtNKzh66ooDogPZSleA==", "dev": true } } @@ -6878,6 +6903,11 @@ "object.assign": "^4.1.0" } }, + "junk": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/junk/-/junk-3.1.0.tgz", + "integrity": "sha512-pBxcB3LFc8QVgdggvZWyeys+hnrNWg4OcZIU/1X59k5jQdLBlCsYGRQaz234SqoRLTCgMH00fY0xRJH+F9METQ==" + }, "kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -7254,12 +7284,12 @@ "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==" }, "netlify": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/netlify/-/netlify-4.1.7.tgz", - "integrity": "sha512-MMI84bLb1QrkAadnNRvglcUbje+hJNQo3ZEUAYJSUiQ4QPpIp9cuayFtfJ/N/dYRPehNiH7B6ZbSZ9FfmpUyVA==", + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/netlify/-/netlify-4.3.1.tgz", + "integrity": "sha512-Paowbvr0Gm0uTkiDz56jB7zsCIyKvZCKEC5ujH9lpVrxUYSp9D3jp969iilP0vopBR/x0tSFPT5dOb2nIvM/Aw==", "requires": { "@netlify/open-api": "^0.15.0", - "@netlify/zip-it-and-ship-it": "^0.4.0-19", + "@netlify/zip-it-and-ship-it": "^1.2.0", "backoff": "^2.5.0", "clean-deep": "^3.3.0", "filter-obj": "^2.0.1", @@ -7583,11 +7613,11 @@ "dev": true }, "p-event": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-event/-/p-event-4.1.0.tgz", - "integrity": "sha512-4vAd06GCsgflX4wHN1JqrMzBh/8QZ4j+rzp0cd2scXRwuBEv+QR3wrVA5aLhWDLw4y2WgDKvzWF3CCLmVM1UgA==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/p-event/-/p-event-4.2.0.tgz", + "integrity": "sha512-KXatOjCRXXkSePPb1Nbi0p0m+gQAwdlbhi4wQKJPI1HsMQS9g+Sqp2o+QHziPr7eYJyOZet836KoHEVM1mwOrQ==", "requires": { - "p-timeout": "^2.0.1" + "p-timeout": "^3.1.0" } }, "p-finally": { @@ -7622,9 +7652,9 @@ } }, "p-timeout": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-2.0.1.tgz", - "integrity": "sha512-88em58dDVB/KzPEx1X0N3LwFfYZPyDc4B6eF38M1rk9VTZMbxXXgjugz8mmwpS9Ox4BDZ+t6t3QP5+/gazweIA==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", + "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", "requires": { "p-finally": "^1.0.0" } @@ -7641,16 +7671,6 @@ "integrity": "sha512-0Uy19uhxbssHelu9ynDMcON6BmMk6pH8551CvxROhiz3Vx+yC4RqxjyIDk2V4ll0g9177RKT++PK4zcV58uJ7A==", "requires": { "p-timeout": "^3.0.0" - }, - "dependencies": { - "p-timeout": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/p-timeout/-/p-timeout-3.2.0.tgz", - "integrity": "sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==", - "requires": { - "p-finally": "^1.0.0" - } - } } }, "parallel-transform": { @@ -7794,9 +7814,9 @@ "dev": true }, "postcss": { - "version": "7.0.31", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.31.tgz", - "integrity": "sha512-a937VDHE1ftkjk+8/7nj/mrjtmkn69xxzJgRETXdAUU+IgOYPQNJF17haGWbeDxSyk++HA14UA98FurvPyBJOA==", + "version": "7.0.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-7.0.32.tgz", + "integrity": "sha512-03eXong5NLnNCD05xscnGKGDZ98CyzoqPSMjOe6SuoQY7Z2hIj0Ld1g/O/UQRuOle2aRtiIRDg9tDcTGAkLfKw==", "requires": { "chalk": "^2.4.2", "source-map": "^0.6.1", @@ -9437,9 +9457,9 @@ } }, "typescript": { - "version": "3.9.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.3.tgz", - "integrity": "sha512-D/wqnB2xzNFIcoBG9FG8cXRDjiqSTbG2wd8DMZeQyJlP1vfTkIxH4GKveWaEBYySKIg+USu+E+EDIR47SqnaMQ==" + "version": "3.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.5.tgz", + "integrity": "sha512-hSAifV3k+i6lEoCJ2k6R2Z/rp/H3+8sdmcn5NrS3/3kE7+RyZXm9aqvxWqjEXHAd8b0pShatpcdMTvEdvAJltQ==" }, "union-value": { "version": "1.0.1", diff --git a/package.json b/package.json index add61868..884b1987 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "actions-netlify", - "version": "1.1.1", + "version": "1.1.2", "private": true, "description": "GitHub Actions for Netlify", "main": "lib/main.js", @@ -26,12 +26,12 @@ "dependencies": { "@actions/core": "^1.2.4", "@actions/github": "^2.2.0", - "netlify": "^4.1.7" + "netlify": "^4.3.1" }, "devDependencies": { "@types/jest": "^25.2.3", - "@types/node": "^12.12.42", - "@typescript-eslint/parser": "^3.0.2", + "@types/node": "^12.12.47", + "@typescript-eslint/parser": "^3.2.0", "@zeit/ncc": "^0.22.3", "eslint": "^5.16.0", "eslint-plugin-github": "^2.0.0", @@ -41,6 +41,6 @@ "js-yaml": "^3.14.0", "prettier": "^2.0.5", "ts-jest": "^25.5.1", - "typescript": "^3.9.3" + "typescript": "^3.9.5" } } diff --git a/src/inputs.ts b/src/inputs.ts index b1d97587..4b1b7f87 100644 --- a/src/inputs.ts +++ b/src/inputs.ts @@ -10,6 +10,7 @@ export interface Inputs { githubToken(): string overwritesPullRequestComment(): boolean netlifyConfigPath(): string | undefined + alias(): string | undefined } export const defaultInputs: Inputs = { @@ -41,5 +42,8 @@ export const defaultInputs: Inputs = { }, netlifyConfigPath() { return core.getInput('netlify-config-path') || undefined + }, + alias() { + return core.getInput('alias') || undefined } } diff --git a/src/main.ts b/src/main.ts index 3b11127d..b39ffe0b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -70,6 +70,7 @@ async function run(inputs: Inputs): Promise { const enableCommitComment: boolean = inputs.enableCommitComment() const overwritesPullRequestComment: boolean = inputs.overwritesPullRequestComment() const netlifyConfigPath: string | undefined = inputs.netlifyConfigPath() + const alias: string | undefined = inputs.alias() const isDraft: boolean = productionBranch === undefined || context.ref !== `refs/heads/${productionBranch}` @@ -82,7 +83,8 @@ async function run(inputs: Inputs): Promise { const deploy = await netlifyClient.deploy(siteId, deployFolder, { draft: isDraft, message: deployMessage, - configPath: netlifyConfigPath + configPath: netlifyConfigPath, + branch: alias }) // Create a message const message = isDraft diff --git a/tsconfig.json b/tsconfig.json index b12f49d3..9b08198d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,5 +8,5 @@ "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ }, - "exclude": ["node_modules", "**/*.test.ts"] + "exclude": ["node_modules", "**/*.test.ts", "dist"] }