From d52ab187a6593a7e8d39b9ebafd56d71932c7b8f Mon Sep 17 00:00:00 2001 From: Charles Lyding <19598772+clydin@users.noreply.github.com> Date: Thu, 15 Aug 2024 15:09:05 -0400 Subject: [PATCH] build: update yarn to v4.4.0 --- .bazelrc | 4 +- .github/workflows/ci.yml | 26 +- .../workflows/deploy-dev-app-main-push.yml | 4 +- .github/workflows/pr.yml | 24 +- .github/workflows/scheduled-ci.yml | 2 +- .gitignore | 7 + .husky/commit-msg | 2 +- .husky/pre-commit | 4 +- .husky/prepare-commit-msg | 2 +- .../{yarn-1.22.17.cjs => yarn-1.22.19.cjs} | 44745 ++++++++-------- .yarn/releases/yarn-4.4.0.cjs | 925 + .yarnrc | 6 - .yarnrc.yml | 3 + BUILD.bazel | 4 +- WORKSPACE | 8 +- package.json | 24 +- renovate.json | 1 + scripts/build-docs-content.mts | 2 +- scripts/build-packages-dist.mts | 2 +- scripts/deploy-dev-app.js | 6 +- scripts/docs-deploy/docs-deps-install.mts | 2 +- scripts/run-component-tests.js | 4 +- yarn.lock | 39064 ++++++++------ 23 files changed, 45796 insertions(+), 39075 deletions(-) rename .yarn/releases/{yarn-1.22.17.cjs => yarn-1.22.19.cjs} (99%) create mode 100755 .yarn/releases/yarn-4.4.0.cjs delete mode 100644 .yarnrc create mode 100644 .yarnrc.yml diff --git a/.bazelrc b/.bazelrc index 6b962f953b5b..cc52195e7a63 100644 --- a/.bazelrc +++ b/.bazelrc @@ -45,10 +45,10 @@ test --test_output=errors # Configures script to do version stamping. # See https://docs.bazel.build/versions/master/user-manual.html#flag--workspace_status_command -build:release --workspace_status_command="yarn -s ng-dev:stamp --mode=release" +build:release --workspace_status_command="yarn ng-dev:stamp --mode=release" build:release --stamp -build:snapshot-build --workspace_status_command="yarn -s ng-dev:stamp --mode=snapshot" +build:snapshot-build --workspace_status_command="yarn ng-dev:stamp --mode=snapshot" build:snapshot-build --stamp #################################### diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 18df1d7ca7c3..58b5756d0621 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: with: cache-node-modules: true - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Checking package externals run: | bazel build //:package_externals @@ -43,7 +43,7 @@ jobs: - name: Check code lint run: yarn tslint - name: Check for circular dependencies - run: yarn -s ts-circular-deps:check + run: yarn ts-circular-deps:check - uses: ./.github/actions/slack if: failure() with: @@ -62,7 +62,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Check API Goldens run: yarn bazel test tools/public_api_guard/... - uses: ./.github/actions/slack @@ -83,7 +83,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run e2e tests run: yarn e2e --flaky_test_attempts=2 - uses: ./.github/actions/slack @@ -104,7 +104,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run integration tests run: yarn integration-tests - name: Running size integration tests @@ -128,7 +128,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run linker AOT tests run: yarn test-linker-aot - uses: ./.github/actions/slack @@ -149,7 +149,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run linker JIT tests run: yarn test-linker-jit - uses: ./.github/actions/slack @@ -170,7 +170,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run tests run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/... - uses: ./.github/actions/slack @@ -191,7 +191,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run tests run: bazel build --build_tag_filters=-docs-package,-release-package -- src/... - uses: ./.github/actions/slack @@ -212,7 +212,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Build and Verify Release Output run: yarn build-and-check-release-output - name: Verify tooling setup @@ -243,7 +243,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Build and Verify Release Output run: yarn build-and-check-release-output - name: Verify tooling setup @@ -274,7 +274,7 @@ jobs: with: cache-node-modules: true - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Setup Saucelabs Variables @@ -294,7 +294,7 @@ jobs: with: cache-node-modules: true - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Setup Saucelabs Variables diff --git a/.github/workflows/deploy-dev-app-main-push.yml b/.github/workflows/deploy-dev-app-main-push.yml index a09b9508a173..dddc8303261c 100644 --- a/.github/workflows/deploy-dev-app-main-push.yml +++ b/.github/workflows/deploy-dev-app-main-push.yml @@ -25,11 +25,11 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Building dev-app run: | - yarn -s bazel build //src/dev-app:web_package --symlink_prefix=dist/ + yarn bazel build //src/dev-app:web_package --symlink_prefix=dist/ cp -R dist/bin/src/dev-app/web_package dist/dev-app-web-pkg - name: Configure Firebase deploy target diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 477e2ab3f810..baab21000076 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -23,7 +23,7 @@ jobs: with: cache-node-modules: true - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Checking package externals run: | bazel build //:package_externals @@ -41,7 +41,7 @@ jobs: - name: Check code lint run: yarn tslint - name: Check for circular dependencies - run: yarn -s ts-circular-deps:check + run: yarn ts-circular-deps:check - name: Check code format run: yarn ng-dev format changed --check ${{ github.event.pull_request.base.sha }} # Commit message check is last intentionally, because the caretaker can fix it @@ -61,7 +61,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Check API Goldens run: yarn bazel test tools/public_api_guard/... @@ -77,7 +77,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run e2e tests run: yarn e2e --flaky_test_attempts=2 @@ -93,7 +93,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run integration tests run: yarn integration-tests - name: Running size integration tests @@ -112,7 +112,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run linker AOT tests run: yarn test-linker-aot @@ -128,7 +128,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run linker JIT tests run: yarn test-linker-jit @@ -144,7 +144,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run tests run: bazel test --build_tag_filters=-e2e --test_tag_filters=-e2e --build_tests_only -- src/... @@ -160,7 +160,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Run tests run: bazel build --build_tag_filters=-docs-package,-release-package -- src/... @@ -176,7 +176,7 @@ jobs: - name: Setup Bazel RBE uses: angular/dev-infra/github-actions/bazel/configure-remote@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Build and Verify Release Output run: yarn build-and-check-release-output - name: Verify tooling setup @@ -204,7 +204,7 @@ jobs: # Checking out the pull request commit is intended here as we need to run the changed code tests. ref: ${{ github.event.pull_request.head.sha }} - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Setup Saucelabs Variables @@ -226,7 +226,7 @@ jobs: # Checking out the pull request commit is intended here as we need to run the changed code tests. ref: ${{ github.event.pull_request.head.sha }} - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Setup Bazel uses: angular/dev-infra/github-actions/bazel/setup@89624a6442b75b5cda33c5e9b5c8c4f87ca4f13d - name: Setup Saucelabs Variables diff --git a/.github/workflows/scheduled-ci.yml b/.github/workflows/scheduled-ci.yml index 73f49915f634..2ab315c9fcb3 100644 --- a/.github/workflows/scheduled-ci.yml +++ b/.github/workflows/scheduled-ci.yml @@ -75,7 +75,7 @@ jobs: with: cache-node-modules: true - name: Install node modules - run: yarn install --frozen-lockfile + run: yarn install --immutable - name: Check Docs Site run: yarn ci-docs-monitor-test - uses: ./.github/actions/slack diff --git a/.gitignore b/.gitignore index c00c29cdc19e..18e003d35966 100644 --- a/.gitignore +++ b/.gitignore @@ -23,6 +23,13 @@ node_modules /src/packages /src/pubspec.lock +# Yarn +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions # IDEs /.idea diff --git a/.husky/commit-msg b/.husky/commit-msg index 5de69ce0b147..71e76cf25e02 100755 --- a/.husky/commit-msg +++ b/.husky/commit-msg @@ -3,4 +3,4 @@ . "$(dirname $0)/_/husky.sh" # Ahead of creating the commit, validate the commit message. -yarn -s ng-dev commit-message pre-commit-validate --file $1; +yarn ng-dev commit-message pre-commit-validate --file $1; diff --git a/.husky/pre-commit b/.husky/pre-commit index 7c7220b3d4de..8a3e88ca23bf 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -4,8 +4,8 @@ # Allow for the formatting command to fail without exiting the script. set +e -yarn -s ng-dev format staged 2>/dev/null +yarn ng-dev format staged 2>/dev/null if [ $? -ne 0 ]; then echo "WARNING: failed to run file formatting (ng-dev format staged)" -fi \ No newline at end of file +fi diff --git a/.husky/prepare-commit-msg b/.husky/prepare-commit-msg index fdf5c9b17f59..e1f4785fce2a 100755 --- a/.husky/prepare-commit-msg +++ b/.husky/prepare-commit-msg @@ -3,4 +3,4 @@ . "$(dirname $0)/_/husky.sh" # When a commit is started, restore the previous commit message draft if it exists. -yarn -s ng-dev commit-message restore-commit-message-draft $1 $2; +yarn ng-dev commit-message restore-commit-message-draft $1 $2; diff --git a/.yarn/releases/yarn-1.22.17.cjs b/.yarn/releases/yarn-1.22.19.cjs similarity index 99% rename from .yarn/releases/yarn-1.22.17.cjs rename to .yarn/releases/yarn-1.22.19.cjs index 3cf00ad6264d..bca1f214f68d 100755 --- a/.yarn/releases/yarn-1.22.17.cjs +++ b/.yarn/releases/yarn-1.22.19.cjs @@ -65,7 +65,7 @@ module.exports = /******/ __webpack_require__.p = ""; /******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 549); +/******/ return __webpack_require__(__webpack_require__.s = 517); /******/ }) /************************************************************************/ /******/ ([ @@ -98,192 +98,192 @@ module.exports = require("path"); /* unused harmony export __makeTemplateObject */ /* unused harmony export __importStar */ /* unused harmony export __importDefault */ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ -/* global Reflect, Promise */ - -var extendStatics = function(d, b) { - extendStatics = Object.setPrototypeOf || - ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || - function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; - return extendStatics(d, b); -}; - -function __extends(d, b) { - extendStatics(d, b); - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -} - -var __assign = function() { - __assign = Object.assign || function __assign(t) { - for (var s, i = 1, n = arguments.length; i < n; i++) { - s = arguments[i]; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; - } - return t; - } - return __assign.apply(this, arguments); -} - -function __rest(s, e) { - var t = {}; - for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) - t[p] = s[p]; - if (s != null && typeof Object.getOwnPropertySymbols === "function") - for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) - t[p[i]] = s[p[i]]; - return t; -} - -function __decorate(decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -} - -function __param(paramIndex, decorator) { - return function (target, key) { decorator(target, key, paramIndex); } -} - -function __metadata(metadataKey, metadataValue) { - if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); -} - -function __awaiter(thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -} - -function __generator(thisArg, body) { - var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; - return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; - function verb(n) { return function (v) { return step([n, v]); }; } - function step(op) { - if (f) throw new TypeError("Generator is already executing."); - while (_) try { - if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; - if (y = 0, t) op = [op[0] & 2, t.value]; - switch (op[0]) { - case 0: case 1: t = op; break; - case 4: _.label++; return { value: op[1], done: false }; - case 5: _.label++; y = op[1]; op = [0]; continue; - case 7: op = _.ops.pop(); _.trys.pop(); continue; - default: - if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } - if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } - if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } - if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } - if (t[2]) _.ops.pop(); - _.trys.pop(); continue; - } - op = body.call(thisArg, _); - } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } - if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; - } -} - -function __exportStar(m, exports) { - for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; -} - -function __values(o) { - var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; - if (m) return m.call(o); - return { - next: function () { - if (o && i >= o.length) o = void 0; - return { value: o && o[i++], done: !o }; - } - }; -} - -function __read(o, n) { - var m = typeof Symbol === "function" && o[Symbol.iterator]; - if (!m) return o; - var i = m.call(o), r, ar = [], e; - try { - while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); - } - catch (error) { e = { error: error }; } - finally { - try { - if (r && !r.done && (m = i["return"])) m.call(i); - } - finally { if (e) throw e.error; } - } - return ar; -} - -function __spread() { - for (var ar = [], i = 0; i < arguments.length; i++) - ar = ar.concat(__read(arguments[i])); - return ar; -} - -function __await(v) { - return this instanceof __await ? (this.v = v, this) : new __await(v); -} - -function __asyncGenerator(thisArg, _arguments, generator) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g = generator.apply(thisArg, _arguments || []), i, q = []; - return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; - function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } - function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } - function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } - function fulfill(value) { resume("next", value); } - function reject(value) { resume("throw", value); } - function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } -} - -function __asyncDelegator(o) { - var i, p; - return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; - function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } -} - -function __asyncValues(o) { - if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m = o[Symbol.asyncIterator], i; - return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); - function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } - function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } -} - -function __makeTemplateObject(cooked, raw) { - if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } - return cooked; -}; - -function __importStar(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; -} - -function __importDefault(mod) { - return (mod && mod.__esModule) ? mod : { default: mod }; -} +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ +/* global Reflect, Promise */ + +var extendStatics = function(d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); +}; + +function __extends(d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +} + +var __assign = function() { + __assign = Object.assign || function __assign(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; + } + return t; + } + return __assign.apply(this, arguments); +} + +function __rest(s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0) + t[p[i]] = s[p[i]]; + return t; +} + +function __decorate(decorators, target, key, desc) { + var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); + else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; + return c > 3 && r && Object.defineProperty(target, key, r), r; +} + +function __param(paramIndex, decorator) { + return function (target, key) { decorator(target, key, paramIndex); } +} + +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue); +} + +function __awaiter(thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +} + +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; + return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; + function verb(n) { return function (v) { return step([n, v]); }; } + function step(op) { + if (f) throw new TypeError("Generator is already executing."); + while (_) try { + if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; + if (y = 0, t) op = [op[0] & 2, t.value]; + switch (op[0]) { + case 0: case 1: t = op; break; + case 4: _.label++; return { value: op[1], done: false }; + case 5: _.label++; y = op[1]; op = [0]; continue; + case 7: op = _.ops.pop(); _.trys.pop(); continue; + default: + if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } + if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } + if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } + if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } + if (t[2]) _.ops.pop(); + _.trys.pop(); continue; + } + op = body.call(thisArg, _); + } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } + if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; + } +} + +function __exportStar(m, exports) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} + +function __values(o) { + var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; + if (m) return m.call(o); + return { + next: function () { + if (o && i >= o.length) o = void 0; + return { value: o && o[i++], done: !o }; + } + }; +} + +function __read(o, n) { + var m = typeof Symbol === "function" && o[Symbol.iterator]; + if (!m) return o; + var i = m.call(o), r, ar = [], e; + try { + while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); + } + catch (error) { e = { error: error }; } + finally { + try { + if (r && !r.done && (m = i["return"])) m.call(i); + } + finally { if (e) throw e.error; } + } + return ar; +} + +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; +} + +function __await(v) { + return this instanceof __await ? (this.v = v, this) : new __await(v); +} + +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var g = generator.apply(thisArg, _arguments || []), i, q = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i; + function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; } + function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } } + function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); } + function fulfill(value) { resume("next", value); } + function reject(value) { resume("throw", value); } + function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); } +} + +function __asyncDelegator(o) { + var i, p; + return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i; + function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v; } : f; } +} + +function __asyncValues(o) { + if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); + var m = o[Symbol.asyncIterator], i; + return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i); + function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; } + function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); } +} + +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; } + return cooked; +}; + +function __importStar(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; +} + +function __importDefault(mod) { + return (mod && mod.__esModule) ? mod : { default: mod }; +} /***/ }), @@ -295,7 +295,7 @@ function __importDefault(mod) { exports.__esModule = true; -var _promise = __webpack_require__(227); +var _promise = __webpack_require__(224); var _promise2 = _interopRequireDefault(_promise); @@ -1423,7 +1423,7 @@ function _load_path() { var _blockingQueue; function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(111)); + return _blockingQueue = _interopRequireDefault(__webpack_require__(110)); } var _promise; @@ -1447,7 +1447,7 @@ function _load_map() { var _fsNormalized; function _load_fsNormalized() { - return _fsNormalized = __webpack_require__(219); + return _fsNormalized = __webpack_require__(216); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -1565,7 +1565,13 @@ class ResponseError extends Error { } exports.ResponseError = ResponseError; -class OneTimePasswordError extends Error {} +class OneTimePasswordError extends Error { + constructor(notice) { + super(); + this.notice = notice; + } + +} exports.OneTimePasswordError = OneTimePasswordError; /***/ }), @@ -1836,7 +1842,7 @@ const os = __webpack_require__(46); const path = __webpack_require__(0); const userHome = __webpack_require__(67).default; -var _require = __webpack_require__(225); +var _require = __webpack_require__(222); const getCacheDir = _require.getCacheDir, getConfigDir = _require.getConfigDir, @@ -2610,7 +2616,7 @@ exports.hyphenate = hyphenate; exports.camelCase = camelCase; exports.compareSortedArrays = compareSortedArrays; exports.sleep = sleep; -const _camelCase = __webpack_require__(230); +const _camelCase = __webpack_require__(227); function sortAlpha(a, b) { // sort alphabetically in a deterministic way @@ -2999,7 +3005,7 @@ exports.default = Lockfile; exports.__esModule = true; -var _assign = __webpack_require__(591); +var _assign = __webpack_require__(559); var _assign2 = _interopRequireDefault(_assign); @@ -5255,11 +5261,11 @@ function nullify(obj = {}) { "use strict"; -const escapeStringRegexp = __webpack_require__(388); -const ansiStyles = __webpack_require__(506); -const stdoutColor = __webpack_require__(598).stdout; +const escapeStringRegexp = __webpack_require__(382); +const ansiStyles = __webpack_require__(474); +const stdoutColor = __webpack_require__(566).stdout; -const template = __webpack_require__(599); +const template = __webpack_require__(567); const isSimpleWindowsTerm = process.platform === 'win32' && !(process.env.TERM || '').toLowerCase().startsWith('xterm'); @@ -6041,13 +6047,13 @@ function _load_objectPath() { var _hooks; function _load_hooks() { - return _hooks = __webpack_require__(374); + return _hooks = __webpack_require__(368); } var _index; function _load_index() { - return _index = _interopRequireDefault(__webpack_require__(221)); + return _index = _interopRequireDefault(__webpack_require__(218)); } var _errors; @@ -6059,7 +6065,7 @@ function _load_errors() { var _integrityChecker; function _load_integrityChecker() { - return _integrityChecker = _interopRequireDefault(__webpack_require__(209)); + return _integrityChecker = _interopRequireDefault(__webpack_require__(206)); } var _lockfile; @@ -6077,31 +6083,31 @@ function _load_lockfile2() { var _packageFetcher; function _load_packageFetcher() { - return _packageFetcher = _interopRequireWildcard(__webpack_require__(211)); + return _packageFetcher = _interopRequireWildcard(__webpack_require__(208)); } var _packageInstallScripts; function _load_packageInstallScripts() { - return _packageInstallScripts = _interopRequireDefault(__webpack_require__(557)); + return _packageInstallScripts = _interopRequireDefault(__webpack_require__(525)); } var _packageCompatibility; function _load_packageCompatibility() { - return _packageCompatibility = _interopRequireWildcard(__webpack_require__(210)); + return _packageCompatibility = _interopRequireWildcard(__webpack_require__(207)); } var _packageResolver; function _load_packageResolver() { - return _packageResolver = _interopRequireDefault(__webpack_require__(366)); + return _packageResolver = _interopRequireDefault(__webpack_require__(360)); } var _packageLinker; function _load_packageLinker() { - return _packageLinker = _interopRequireDefault(__webpack_require__(212)); + return _packageLinker = _interopRequireDefault(__webpack_require__(209)); } var _index2; @@ -6119,7 +6125,7 @@ function _load_index3() { var _autoclean; function _load_autoclean() { - return _autoclean = __webpack_require__(354); + return _autoclean = __webpack_require__(348); } var _constants; @@ -6155,7 +6161,7 @@ function _load_yarnVersion() { var _generatePnpMap; function _load_generatePnpMap() { - return _generatePnpMap = __webpack_require__(579); + return _generatePnpMap = __webpack_require__(547); } var _workspaceLayout; @@ -6167,7 +6173,7 @@ function _load_workspaceLayout() { var _resolutionMap; function _load_resolutionMap() { - return _resolutionMap = _interopRequireDefault(__webpack_require__(215)); + return _resolutionMap = _interopRequireDefault(__webpack_require__(212)); } var _guessName; @@ -6179,14 +6185,14 @@ function _load_guessName() { var _audit; function _load_audit() { - return _audit = _interopRequireDefault(__webpack_require__(353)); + return _audit = _interopRequireDefault(__webpack_require__(347)); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const deepEqual = __webpack_require__(631); +const deepEqual = __webpack_require__(599); const emoji = __webpack_require__(302); const invariant = __webpack_require__(9); @@ -25250,7 +25256,7 @@ function _load_constants() { var _blockingQueue; function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(111)); + return _blockingQueue = _interopRequireDefault(__webpack_require__(110)); } var _errors; @@ -25530,7 +25536,7 @@ function queue(arr, promiseProducer, concurrency = Infinity) { /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty -module.exports = !__webpack_require__(113)(function () { +module.exports = !__webpack_require__(112)(function () { return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7; }); @@ -25677,7 +25683,7 @@ exports.registryNames = exports.registries = undefined; var _yarnRegistry; function _load_yarnRegistry() { - return _yarnRegistry = _interopRequireDefault(__webpack_require__(559)); + return _yarnRegistry = _interopRequireDefault(__webpack_require__(527)); } var _npmRegistry; @@ -26638,7 +26644,7 @@ function getPrioritizedHash (algo1, algo2) { // If you have no idea what ASN.1 or BER is, see this: // ftp://ftp.rsa.com/pub/pkcs/ascii/layman.asc -var Ber = __webpack_require__(514); +var Ber = __webpack_require__(482); @@ -26670,7 +26676,7 @@ exports.home = undefined; var _rootUser; function _load_rootUser() { - return _rootUser = _interopRequireDefault(__webpack_require__(224)); + return _rootUser = _interopRequireDefault(__webpack_require__(221)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -26745,8 +26751,8 @@ module.exports = function (it, key) { /***/ (function(module, exports, __webpack_require__) { var anObject = __webpack_require__(35); -var IE8_DOM_DEFINE = __webpack_require__(238); -var toPrimitive = __webpack_require__(255); +var IE8_DOM_DEFINE = __webpack_require__(235); +var toPrimitive = __webpack_require__(252); var dP = Object.defineProperty; exports.f = __webpack_require__(52) ? Object.defineProperty : function defineProperty(O, P, Attributes) { @@ -29627,13 +29633,13 @@ function _load_baseResolver() { var _npmResolver; function _load_npmResolver() { - return _npmResolver = _interopRequireDefault(__webpack_require__(218)); + return _npmResolver = _interopRequireDefault(__webpack_require__(215)); } var _yarnResolver; function _load_yarnResolver() { - return _yarnResolver = _interopRequireDefault(__webpack_require__(576)); + return _yarnResolver = _interopRequireDefault(__webpack_require__(544)); } var _gitResolver; @@ -29645,55 +29651,55 @@ function _load_gitResolver() { var _tarballResolver; function _load_tarballResolver() { - return _tarballResolver = _interopRequireDefault(__webpack_require__(574)); + return _tarballResolver = _interopRequireDefault(__webpack_require__(542)); } var _githubResolver; function _load_githubResolver() { - return _githubResolver = _interopRequireDefault(__webpack_require__(367)); + return _githubResolver = _interopRequireDefault(__webpack_require__(361)); } var _fileResolver; function _load_fileResolver() { - return _fileResolver = _interopRequireDefault(__webpack_require__(216)); + return _fileResolver = _interopRequireDefault(__webpack_require__(213)); } var _linkResolver; function _load_linkResolver() { - return _linkResolver = _interopRequireDefault(__webpack_require__(368)); + return _linkResolver = _interopRequireDefault(__webpack_require__(362)); } var _gitlabResolver; function _load_gitlabResolver() { - return _gitlabResolver = _interopRequireDefault(__webpack_require__(572)); + return _gitlabResolver = _interopRequireDefault(__webpack_require__(540)); } var _gistResolver; function _load_gistResolver() { - return _gistResolver = _interopRequireDefault(__webpack_require__(217)); + return _gistResolver = _interopRequireDefault(__webpack_require__(214)); } var _bitbucketResolver; function _load_bitbucketResolver() { - return _bitbucketResolver = _interopRequireDefault(__webpack_require__(571)); + return _bitbucketResolver = _interopRequireDefault(__webpack_require__(539)); } var _hostedGitResolver; function _load_hostedGitResolver() { - return _hostedGitResolver = __webpack_require__(110); + return _hostedGitResolver = __webpack_require__(109); } var _registryResolver; function _load_registryResolver() { - return _registryResolver = _interopRequireDefault(__webpack_require__(573)); + return _registryResolver = _interopRequireDefault(__webpack_require__(541)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -31349,7 +31355,7 @@ try { } catch (er) {} var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __webpack_require__(229) +var expand = __webpack_require__(226) var plTypes = { '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, @@ -32632,19 +32638,19 @@ function _load_fs() { var _npmResolver; function _load_npmResolver() { - return _npmResolver = _interopRequireDefault(__webpack_require__(218)); + return _npmResolver = _interopRequireDefault(__webpack_require__(215)); } var _envReplace; function _load_envReplace() { - return _envReplace = _interopRequireDefault(__webpack_require__(577)); + return _envReplace = _interopRequireDefault(__webpack_require__(545)); } var _baseRegistry; function _load_baseRegistry() { - return _baseRegistry = _interopRequireDefault(__webpack_require__(558)); + return _baseRegistry = _interopRequireDefault(__webpack_require__(526)); } var _misc; @@ -32656,7 +32662,7 @@ function _load_misc() { var _path; function _load_path() { - return _path = __webpack_require__(377); + return _path = __webpack_require__(371); } var _normalizeUrl; @@ -32686,7 +32692,7 @@ function _load_errors() { var _login; function _load_login() { - return _login = __webpack_require__(108); + return _login = __webpack_require__(107); } var _path2; @@ -32792,7 +32798,7 @@ class NpmRegistry extends (_baseRegistry || _load_baseRegistry()).default { let resolved = pathname; if (!REGEX_REGISTRY_PREFIX.test(pathname)) { - resolved = (_url || _load_url()).default.resolve((0, (_misc || _load_misc()).addSuffix)(registry, '/'), pathname); + resolved = (_url || _load_url()).default.resolve((0, (_misc || _load_misc()).addSuffix)(registry, '/'), `./${pathname}`); } if (REGEX_REGISTRY_ENFORCED_HTTPS.test(resolved)) { @@ -32867,6 +32873,10 @@ class NpmRegistry extends (_baseRegistry || _load_baseRegistry()).default { } _this.reporter.info(_this.reporter.lang('twoFactorAuthenticationEnabled')); + if (error.notice) { + _this.reporter.info(error.notice); + } + _this.otp = yield (0, (_login || _load_login()).getOneTimePassword)(_this.reporter); _this.requestManager.clearCache(); @@ -33410,7 +33420,7 @@ var EE = __webpack_require__(77).EventEmitter var path = __webpack_require__(0) var assert = __webpack_require__(28) var isAbsolute = __webpack_require__(101) -var globSync = __webpack_require__(272) +var globSync = __webpack_require__(269) var common = __webpack_require__(141) var alphasort = common.alphasort var alphasorti = common.alphasorti @@ -34973,280 +34983,6 @@ function parseWithConflict(str, fileLoc) { "use strict"; - -module.exports = { - copy: copy, - checkDataType: checkDataType, - checkDataTypes: checkDataTypes, - coerceToTypes: coerceToTypes, - toHash: toHash, - getProperty: getProperty, - escapeQuotes: escapeQuotes, - equal: __webpack_require__(205), - ucs2length: __webpack_require__(480), - varOccurences: varOccurences, - varReplace: varReplace, - cleanUpCode: cleanUpCode, - finalCleanUpCode: finalCleanUpCode, - schemaHasRules: schemaHasRules, - schemaHasRulesExcept: schemaHasRulesExcept, - toQuotedString: toQuotedString, - getPathExpr: getPathExpr, - getPath: getPath, - getData: getData, - unescapeFragment: unescapeFragment, - unescapeJsonPointer: unescapeJsonPointer, - escapeFragment: escapeFragment, - escapeJsonPointer: escapeJsonPointer -}; - - -function copy(o, to) { - to = to || {}; - for (var key in o) to[key] = o[key]; - return to; -} - - -function checkDataType(dataType, data, negate) { - var EQUAL = negate ? ' !== ' : ' === ' - , AND = negate ? ' || ' : ' && ' - , OK = negate ? '!' : '' - , NOT = negate ? '' : '!'; - switch (dataType) { - case 'null': return data + EQUAL + 'null'; - case 'array': return OK + 'Array.isArray(' + data + ')'; - case 'object': return '(' + OK + data + AND + - 'typeof ' + data + EQUAL + '"object"' + AND + - NOT + 'Array.isArray(' + data + '))'; - case 'integer': return '(typeof ' + data + EQUAL + '"number"' + AND + - NOT + '(' + data + ' % 1)' + - AND + data + EQUAL + data + ')'; - default: return 'typeof ' + data + EQUAL + '"' + dataType + '"'; - } -} - - -function checkDataTypes(dataTypes, data) { - switch (dataTypes.length) { - case 1: return checkDataType(dataTypes[0], data, true); - default: - var code = ''; - var types = toHash(dataTypes); - if (types.array && types.object) { - code = types.null ? '(': '(!' + data + ' || '; - code += 'typeof ' + data + ' !== "object")'; - delete types.null; - delete types.array; - delete types.object; - } - if (types.number) delete types.integer; - for (var t in types) - code += (code ? ' && ' : '' ) + checkDataType(t, data, true); - - return code; - } -} - - -var COERCE_TO_TYPES = toHash([ 'string', 'number', 'integer', 'boolean', 'null' ]); -function coerceToTypes(optionCoerceTypes, dataTypes) { - if (Array.isArray(dataTypes)) { - var types = []; - for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); - return paths[lvl - up]; - } - - if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); - data = 'data' + ((lvl - up) || ''); - if (!jsonPointer) return data; - } - - var expr = data; - var segments = jsonPointer.split('/'); - for (var i=0; i= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); + return paths[lvl - up]; + } + + if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); + data = 'data' + ((lvl - up) || ''); + if (!jsonPointer) return data; + } + + var expr = data; + var segments = jsonPointer.split('/'); + for (var i=0; i*/ -var util = __webpack_require__(114); +var util = __webpack_require__(113); util.inherits = __webpack_require__(61); /**/ @@ -37754,7 +37764,7 @@ function _load_index() { var _baseReporter; function _load_baseReporter() { - return _baseReporter = _interopRequireDefault(__webpack_require__(109)); + return _baseReporter = _interopRequireDefault(__webpack_require__(108)); } var _buildSubCommands2; @@ -37784,25 +37794,25 @@ function _load_add() { var _remove; function _load_remove() { - return _remove = __webpack_require__(359); + return _remove = __webpack_require__(353); } var _upgrade; function _load_upgrade() { - return _upgrade = __webpack_require__(208); + return _upgrade = __webpack_require__(205); } var _upgradeInteractive; function _load_upgradeInteractive() { - return _upgradeInteractive = __webpack_require__(362); + return _upgradeInteractive = __webpack_require__(356); } var _packageLinker; function _load_packageLinker() { - return _packageLinker = __webpack_require__(212); + return _packageLinker = __webpack_require__(209); } var _constants; @@ -38022,7 +38032,7 @@ function _load_lockfile() { var _packageReference; function _load_packageReference() { - return _packageReference = _interopRequireDefault(__webpack_require__(365)); + return _packageReference = _interopRequireDefault(__webpack_require__(359)); } var _index; @@ -38046,13 +38056,13 @@ function _load_constants() { var _version; function _load_version() { - return _version = _interopRequireWildcard(__webpack_require__(226)); + return _version = _interopRequireWildcard(__webpack_require__(223)); } var _workspaceResolver; function _load_workspaceResolver() { - return _workspaceResolver = _interopRequireDefault(__webpack_require__(570)); + return _workspaceResolver = _interopRequireDefault(__webpack_require__(538)); } var _fs; @@ -38618,7 +38628,7 @@ function _load_misc() { var _version; function _load_version() { - return _version = _interopRequireWildcard(__webpack_require__(226)); + return _version = _interopRequireWildcard(__webpack_require__(223)); } var _guessName; @@ -38642,7 +38652,7 @@ function _load_exoticResolver() { var _git; function _load_git() { - return _git = _interopRequireDefault(__webpack_require__(220)); + return _git = _interopRequireDefault(__webpack_require__(217)); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -38899,13 +38909,13 @@ function _load_errors() { var _util; function _load_util() { - return _util = __webpack_require__(222); + return _util = __webpack_require__(219); } var _typos; function _load_typos() { - return _typos = _interopRequireDefault(__webpack_require__(587)); + return _typos = _interopRequireDefault(__webpack_require__(555)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -39112,12 +39122,12 @@ module.exports = document && document.documentElement; var LIBRARY = __webpack_require__(93); var $export = __webpack_require__(60); -var redefine = __webpack_require__(251); +var redefine = __webpack_require__(248); var hide = __webpack_require__(42); var Iterators = __webpack_require__(54); -var $iterCreate = __webpack_require__(242); +var $iterCreate = __webpack_require__(239); var setToStringTag = __webpack_require__(95); -var getPrototypeOf = __webpack_require__(248); +var getPrototypeOf = __webpack_require__(245); var ITERATOR = __webpack_require__(21)('iterator'); var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next` var FF_ITERATOR = '@@iterator'; @@ -39263,7 +39273,7 @@ module.exports = function (O, D) { /***/ (function(module, exports, __webpack_require__) { var ctx = __webpack_require__(70); -var invoke = __webpack_require__(239); +var invoke = __webpack_require__(236); var html = __webpack_require__(128); var cel = __webpack_require__(92); var global = __webpack_require__(17); @@ -40186,7 +40196,7 @@ var origRealpathSync = fs.realpathSync var version = process.version var ok = /^v[0-5]\./.test(version) -var old = __webpack_require__(271) +var old = __webpack_require__(268) function newError (er) { return er && er.syscall === 'realpath' && ( @@ -42827,13 +42837,13 @@ exports.extractWorkspaces = extractWorkspaces; var _executeLifecycleScript; function _load_executeLifecycleScript() { - return _executeLifecycleScript = __webpack_require__(112); + return _executeLifecycleScript = __webpack_require__(111); } var _path; function _load_path() { - return _path = __webpack_require__(377); + return _path = __webpack_require__(371); } var _conversion; @@ -42845,7 +42855,7 @@ function _load_conversion() { var _index; function _load_index() { - return _index = _interopRequireDefault(__webpack_require__(221)); + return _index = _interopRequireDefault(__webpack_require__(218)); } var _errors; @@ -42869,13 +42879,13 @@ function _load_constants() { var _packageConstraintResolver; function _load_packageConstraintResolver() { - return _packageConstraintResolver = _interopRequireDefault(__webpack_require__(555)); + return _packageConstraintResolver = _interopRequireDefault(__webpack_require__(523)); } var _requestManager; function _load_requestManager() { - return _requestManager = _interopRequireDefault(__webpack_require__(378)); + return _requestManager = _interopRequireDefault(__webpack_require__(372)); } var _index2; @@ -42901,7 +42911,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const crypto = __webpack_require__(11); -const detectIndent = __webpack_require__(635); +const detectIndent = __webpack_require__(603); const invariant = __webpack_require__(9); const path = __webpack_require__(0); const micromatch = __webpack_require__(115); @@ -43942,28 +43952,28 @@ function extractWorkspaces(manifest) { /* 163 */ /***/ (function(module, exports) { -module.exports = function(module) { - if(!module.webpackPolyfill) { - module.deprecate = function() {}; - module.paths = []; - // module.parent = undefined by default - if(!module.children) module.children = []; - Object.defineProperty(module, "loaded", { - enumerable: true, - get: function() { - return module.l; - } - }); - Object.defineProperty(module, "id", { - enumerable: true, - get: function() { - return module.i; - } - }); - module.webpackPolyfill = 1; - } - return module; -}; +module.exports = function(module) { + if(!module.webpackPolyfill) { + module.deprecate = function() {}; + module.paths = []; + // module.parent = undefined by default + if(!module.children) module.children = []; + Object.defineProperty(module, "loaded", { + enumerable: true, + get: function() { + return module.l; + } + }); + Object.defineProperty(module, "id", { + enumerable: true, + get: function() { + return module.i; + } + }); + module.webpackPolyfill = 1; + } + return module; +}; /***/ }), @@ -44045,7 +44055,7 @@ function _load_index() { var _list; function _load_list() { - return _list = __webpack_require__(358); + return _list = __webpack_require__(352); } var _install; @@ -44669,7 +44679,7 @@ function _load_fs() { var _filter; function _load_filter() { - return _filter = __webpack_require__(372); + return _filter = __webpack_require__(366); } var _errors; @@ -44744,7 +44754,7 @@ function _load_asyncToGenerator() { var _index; function _load_index() { - return _index = _interopRequireDefault(__webpack_require__(221)); + return _index = _interopRequireDefault(__webpack_require__(218)); } var _constants; @@ -44762,7 +44772,7 @@ function _load_fs() { var _mutex; function _load_mutex() { - return _mutex = _interopRequireDefault(__webpack_require__(375)); + return _mutex = _interopRequireDefault(__webpack_require__(369)); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -45154,7 +45164,7 @@ module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) { /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) -var $keys = __webpack_require__(249); +var $keys = __webpack_require__(246); var enumBugKeys = __webpack_require__(127); module.exports = Object.keys || function keys(O) { @@ -45391,7 +45401,7 @@ module.exports = { "use strict"; var chalk = __webpack_require__(30); -var figures = __webpack_require__(270); +var figures = __webpack_require__(267); /** * Separator object @@ -46303,7 +46313,7 @@ function readSSHPrivate(type, buf, options) { var rounds = kdfOptsBuf.readInt(); var cinf = utils.opensshCipherInfo(cipher); if (bcrypt === undefined) { - bcrypt = __webpack_require__(379); + bcrypt = __webpack_require__(373); } if (typeof (options.passphrase) === 'string') { @@ -46424,7 +46434,7 @@ function write(key, options) { kdfopts = kdfssh.toBuffer(); if (bcrypt === undefined) { - bcrypt = __webpack_require__(379); + bcrypt = __webpack_require__(373); } var pass = new Uint8Array(passphrase); var salti = new Uint8Array(salt); @@ -46502,7 +46512,7 @@ function write(key, options) { /* 194 */ /***/ (function(module, exports, __webpack_require__) { -var chownr = __webpack_require__(600) +var chownr = __webpack_require__(568) var tar = __webpack_require__(460) var pump = __webpack_require__(781) var mkdirp = __webpack_require__(145) @@ -46853,7 +46863,7 @@ function mkdirfix (name, opts, cb) { /* 195 */ /***/ (function(module, exports) { -module.exports = {"name":"yarn","installationMethod":"unknown","version":"1.22.17","license":"BSD-2-Clause","preferGlobal":true,"description":"📦🐈 Fast, reliable, and secure dependency management.","dependencies":{"@zkochan/cmd-shim":"^3.1.0","babel-runtime":"^6.26.0","bytes":"^3.0.0","camelcase":"^4.0.0","chalk":"^2.1.0","cli-table3":"^0.4.0","commander":"^2.9.0","death":"^1.0.0","debug":"^3.0.0","deep-equal":"^1.0.1","detect-indent":"^5.0.0","dnscache":"^1.0.1","glob":"^7.1.1","gunzip-maybe":"^1.4.0","hash-for-dep":"^1.2.3","imports-loader":"^0.8.0","ini":"^1.3.4","inquirer":"^6.2.0","invariant":"^2.2.0","is-builtin-module":"^2.0.0","is-ci":"^1.0.10","is-webpack-bundle":"^1.0.0","js-yaml":"^3.13.1","leven":"^2.0.0","loud-rejection":"^1.2.0","micromatch":"^2.3.11","mkdirp":"^0.5.1","node-emoji":"^1.6.1","normalize-url":"^2.0.0","npm-logical-tree":"^1.2.1","object-path":"^0.11.2","proper-lockfile":"^2.0.0","puka":"^1.0.0","read":"^1.0.7","request":"^2.87.0","request-capture-har":"^1.2.2","rimraf":"^2.5.0","semver":"^5.1.0","ssri":"^5.3.0","strip-ansi":"^4.0.0","strip-bom":"^3.0.0","tar-fs":"^1.16.0","tar-stream":"^1.6.1","uuid":"^3.0.1","v8-compile-cache":"^2.0.0","validate-npm-package-license":"^3.0.4","yn":"^2.0.0"},"devDependencies":{"babel-core":"^6.26.0","babel-eslint":"^7.2.3","babel-loader":"^6.2.5","babel-plugin-array-includes":"^2.0.3","babel-plugin-inline-import":"^3.0.0","babel-plugin-transform-builtin-extend":"^1.1.2","babel-plugin-transform-inline-imports-commonjs":"^1.0.0","babel-plugin-transform-runtime":"^6.4.3","babel-preset-env":"^1.6.0","babel-preset-flow":"^6.23.0","babel-preset-stage-0":"^6.0.0","babylon":"^6.5.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.3.0","eslint-config-fb-strict":"^22.0.0","eslint-plugin-babel":"^5.0.0","eslint-plugin-flowtype":"^2.35.0","eslint-plugin-jasmine":"^2.6.2","eslint-plugin-jest":"^21.0.0","eslint-plugin-jsx-a11y":"^6.0.2","eslint-plugin-prefer-object-spread":"^1.2.1","eslint-plugin-prettier":"^2.1.2","eslint-plugin-react":"^7.1.0","eslint-plugin-relay":"^0.0.28","eslint-plugin-yarn-internal":"file:scripts/eslint-rules","execa":"^0.11.0","fancy-log":"^1.3.2","flow-bin":"^0.66.0","git-release-notes":"^3.0.0","gulp":"^4.0.0","gulp-babel":"^7.0.0","gulp-if":"^2.0.1","gulp-newer":"^1.0.0","gulp-plumber":"^1.0.1","gulp-sourcemaps":"^2.2.0","jest":"^22.4.4","jsinspect":"^0.12.6","minimatch":"^3.0.4","mock-stdin":"^0.3.0","prettier":"^1.5.2","string-replace-loader":"^2.1.1","temp":"^0.8.3","webpack":"^2.1.0-beta.25","yargs":"^6.3.0"},"resolutions":{"sshpk":"^1.14.2"},"engines":{"node":">=4.0.0"},"repository":"yarnpkg/yarn","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"scripts":{"build":"gulp build","build-bundle":"node ./scripts/build-webpack.js","build-chocolatey":"powershell ./scripts/build-chocolatey.ps1","build-deb":"./scripts/build-deb.sh","build-dist":"bash ./scripts/build-dist.sh","build-win-installer":"scripts\\build-windows-installer.bat","changelog":"git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md","dupe-check":"yarn jsinspect ./src","lint":"eslint . && flow check","pkg-tests":"yarn --cwd packages/pkg-tests jest yarn.test.js","prettier":"eslint src __tests__ --fix","release-branch":"./scripts/release-branch.sh","test":"yarn lint && yarn test-only","test-only":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose","test-only-debug":"node --inspect-brk --max_old_space_size=4096 node_modules/jest/bin/jest.js --runInBand --verbose","test-coverage":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --coverage --verbose","watch":"gulp watch","commit":"git-cz"},"jest":{"collectCoverageFrom":["src/**/*.js"],"testEnvironment":"node","modulePathIgnorePatterns":["__tests__/fixtures/","packages/pkg-tests/pkg-tests-fixtures","dist/"],"testPathIgnorePatterns":["__tests__/(fixtures|__mocks__)/","updates/","_(temp|mock|install|init|helpers).js$","packages/pkg-tests"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}} +module.exports = {"name":"yarn","installationMethod":"unknown","version":"1.22.19","packageManager":"yarn@1.22.17","license":"BSD-2-Clause","preferGlobal":true,"description":"📦🐈 Fast, reliable, and secure dependency management.","dependencies":{"@zkochan/cmd-shim":"^3.1.0","babel-runtime":"^6.26.0","bytes":"^3.0.0","camelcase":"^4.0.0","chalk":"^2.1.0","cli-table3":"^0.4.0","commander":"^2.9.0","death":"^1.0.0","debug":"^3.0.0","deep-equal":"^1.0.1","detect-indent":"^5.0.0","dnscache":"^1.0.1","glob":"^7.1.1","gunzip-maybe":"^1.4.0","hash-for-dep":"^1.2.3","imports-loader":"^0.8.0","ini":"^1.3.4","inquirer":"^6.2.0","invariant":"^2.2.0","is-builtin-module":"^2.0.0","is-ci":"^1.0.10","is-webpack-bundle":"^1.0.0","js-yaml":"^3.13.1","leven":"^2.0.0","loud-rejection":"^1.2.0","micromatch":"^2.3.11","mkdirp":"^0.5.1","node-emoji":"^1.6.1","normalize-url":"^2.0.0","npm-logical-tree":"^1.2.1","object-path":"^0.11.2","proper-lockfile":"^2.0.0","puka":"^1.0.0","read":"^1.0.7","request":"^2.87.0","request-capture-har":"^1.2.2","rimraf":"^2.5.0","semver":"^5.1.0","ssri":"^5.3.0","strip-ansi":"^4.0.0","strip-bom":"^3.0.0","tar-fs":"^1.16.0","tar-stream":"^1.6.1","uuid":"^3.0.1","v8-compile-cache":"^2.0.0","validate-npm-package-license":"^3.0.4","yn":"^2.0.0"},"devDependencies":{"babel-core":"^6.26.0","babel-eslint":"^7.2.3","babel-loader":"^6.2.5","babel-plugin-array-includes":"^2.0.3","babel-plugin-inline-import":"^3.0.0","babel-plugin-transform-builtin-extend":"^1.1.2","babel-plugin-transform-inline-imports-commonjs":"^1.0.0","babel-plugin-transform-runtime":"^6.4.3","babel-preset-env":"^1.6.0","babel-preset-flow":"^6.23.0","babel-preset-stage-0":"^6.0.0","babylon":"^6.5.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.3.0","eslint-config-fb-strict":"^22.0.0","eslint-plugin-babel":"^5.0.0","eslint-plugin-flowtype":"^2.35.0","eslint-plugin-jasmine":"^2.6.2","eslint-plugin-jest":"^21.0.0","eslint-plugin-jsx-a11y":"^6.0.2","eslint-plugin-prefer-object-spread":"^1.2.1","eslint-plugin-prettier":"^2.1.2","eslint-plugin-react":"^7.1.0","eslint-plugin-relay":"^0.0.28","eslint-plugin-yarn-internal":"file:scripts/eslint-rules","execa":"^0.11.0","fancy-log":"^1.3.2","flow-bin":"^0.66.0","git-release-notes":"^3.0.0","gulp":"^4.0.0","gulp-babel":"^7.0.0","gulp-if":"^2.0.1","gulp-newer":"^1.0.0","gulp-plumber":"^1.0.1","gulp-sourcemaps":"^2.2.0","jest":"^22.4.4","jsinspect":"^0.12.6","minimatch":"^3.0.4","mock-stdin":"^0.3.0","prettier":"^1.5.2","string-replace-loader":"^2.1.1","temp":"^0.8.3","webpack":"^2.1.0-beta.25","yargs":"^6.3.0"},"resolutions":{"sshpk":"^1.14.2"},"engines":{"node":">=4.0.0"},"repository":"yarnpkg/yarn","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"scripts":{"build":"gulp build","build-bundle":"node ./scripts/build-webpack.js","build-chocolatey":"powershell ./scripts/build-chocolatey.ps1","build-deb":"./scripts/build-deb.sh","build-dist":"bash ./scripts/build-dist.sh","build-win-installer":"scripts\\build-windows-installer.bat","changelog":"git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md","dupe-check":"yarn jsinspect ./src","lint":"eslint . && flow check","pkg-tests":"yarn --cwd packages/pkg-tests jest yarn.test.js","prettier":"eslint src __tests__ --fix","release-branch":"./scripts/release-branch.sh","test":"yarn lint && yarn test-only","test-only":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose","test-only-debug":"node --inspect-brk --max_old_space_size=4096 node_modules/jest/bin/jest.js --runInBand --verbose","test-coverage":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --coverage --verbose","watch":"gulp watch","commit":"git-cz"},"jest":{"collectCoverageFrom":["src/**/*.js"],"testEnvironment":"node","modulePathIgnorePatterns":["__tests__/fixtures/","packages/pkg-tests/pkg-tests-fixtures","dist/"],"testPathIgnorePatterns":["__tests__/(fixtures|__mocks__)/","updates/","_(temp|mock|install|init|helpers).js$","packages/pkg-tests"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}} /***/ }), /* 196 */ @@ -47027,7 +47037,7 @@ Object.defineProperty(exports, "__esModule", { var _consoleReporter; function _load_consoleReporter() { - return _consoleReporter = __webpack_require__(561); + return _consoleReporter = __webpack_require__(529); } Object.defineProperty(exports, 'ConsoleReporter', { @@ -47040,7 +47050,7 @@ Object.defineProperty(exports, 'ConsoleReporter', { var _bufferReporter; function _load_bufferReporter() { - return _bufferReporter = __webpack_require__(560); + return _bufferReporter = __webpack_require__(528); } Object.defineProperty(exports, 'BufferReporter', { @@ -47053,7 +47063,7 @@ Object.defineProperty(exports, 'BufferReporter', { var _eventReporter; function _load_eventReporter() { - return _eventReporter = __webpack_require__(565); + return _eventReporter = __webpack_require__(533); } Object.defineProperty(exports, 'EventReporter', { @@ -47066,7 +47076,7 @@ Object.defineProperty(exports, 'EventReporter', { var _jsonReporter; function _load_jsonReporter() { - return _jsonReporter = __webpack_require__(214); + return _jsonReporter = __webpack_require__(211); } Object.defineProperty(exports, 'JSONReporter', { @@ -47079,7 +47089,7 @@ Object.defineProperty(exports, 'JSONReporter', { var _noopReporter; function _load_noopReporter() { - return _noopReporter = __webpack_require__(569); + return _noopReporter = __webpack_require__(537); } Object.defineProperty(exports, 'NoopReporter', { @@ -47092,7 +47102,7 @@ Object.defineProperty(exports, 'NoopReporter', { var _baseReporter; function _load_baseReporter() { - return _baseReporter = __webpack_require__(109); + return _baseReporter = __webpack_require__(108); } Object.defineProperty(exports, 'Reporter', { @@ -47379,387 +47389,6 @@ function normalizePathEnvVar (nodePath) { /***/ }), /* 203 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var resolve = __webpack_require__(204); - -module.exports = { - Validation: errorSubclass(ValidationError), - MissingRef: errorSubclass(MissingRefError) -}; - - -function ValidationError(errors) { - this.message = 'validation failed'; - this.errors = errors; - this.ajv = this.validation = true; -} - - -MissingRefError.message = function (baseId, ref) { - return 'can\'t resolve reference ' + ref + ' from id ' + baseId; -}; - - -function MissingRefError(baseId, ref, message) { - this.message = message || MissingRefError.message(baseId, ref); - this.missingRef = resolve.url(baseId, ref); - this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef)); -} - - -function errorSubclass(Subclass) { - Subclass.prototype = Object.create(Error.prototype); - Subclass.prototype.constructor = Subclass; - return Subclass; -} - - -/***/ }), -/* 204 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var url = __webpack_require__(24) - , equal = __webpack_require__(205) - , util = __webpack_require__(107) - , SchemaObject = __webpack_require__(339) - , traverse = __webpack_require__(503); - -module.exports = resolve; - -resolve.normalizeId = normalizeId; -resolve.fullPath = getFullPath; -resolve.url = resolveUrl; -resolve.ids = resolveIds; -resolve.inlineRef = inlineRef; -resolve.schema = resolveSchema; - -/** - * [resolve and compile the references ($ref)] - * @this Ajv - * @param {Function} compile reference to schema compilation funciton (localCompile) - * @param {Object} root object with information about the root schema for the current schema - * @param {String} ref reference to resolve - * @return {Object|Function} schema object (if the schema can be inlined) or validation function - */ -function resolve(compile, root, ref) { - /* jshint validthis: true */ - var refVal = this._refs[ref]; - if (typeof refVal == 'string') { - if (this._refs[refVal]) refVal = this._refs[refVal]; - else return resolve.call(this, compile, root, refVal); - } - - refVal = refVal || this._schemas[ref]; - if (refVal instanceof SchemaObject) { - return inlineRef(refVal.schema, this._opts.inlineRefs) - ? refVal.schema - : refVal.validate || this._compile(refVal); - } - - var res = resolveSchema.call(this, root, ref); - var schema, v, baseId; - if (res) { - schema = res.schema; - root = res.root; - baseId = res.baseId; - } - - if (schema instanceof SchemaObject) { - v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId); - } else if (schema !== undefined) { - v = inlineRef(schema, this._opts.inlineRefs) - ? schema - : compile.call(this, schema, root, undefined, baseId); - } - - return v; -} - - -/** - * Resolve schema, its root and baseId - * @this Ajv - * @param {Object} root root object with properties schema, refVal, refs - * @param {String} ref reference to resolve - * @return {Object} object with properties schema, root, baseId - */ -function resolveSchema(root, ref) { - /* jshint validthis: true */ - var p = url.parse(ref, false, true) - , refPath = _getFullPath(p) - , baseId = getFullPath(this._getId(root.schema)); - if (refPath !== baseId) { - var id = normalizeId(refPath); - var refVal = this._refs[id]; - if (typeof refVal == 'string') { - return resolveRecursive.call(this, root, refVal, p); - } else if (refVal instanceof SchemaObject) { - if (!refVal.validate) this._compile(refVal); - root = refVal; - } else { - refVal = this._schemas[id]; - if (refVal instanceof SchemaObject) { - if (!refVal.validate) this._compile(refVal); - if (id == normalizeId(ref)) - return { schema: refVal, root: root, baseId: baseId }; - root = refVal; - } else { - return; - } - } - if (!root.schema) return; - baseId = getFullPath(this._getId(root.schema)); - } - return getJsonPointer.call(this, p, baseId, root.schema, root); -} - - -/* @this Ajv */ -function resolveRecursive(root, ref, parsedRef) { - /* jshint validthis: true */ - var res = resolveSchema.call(this, root, ref); - if (res) { - var schema = res.schema; - var baseId = res.baseId; - root = res.root; - var id = this._getId(schema); - if (id) baseId = resolveUrl(baseId, id); - return getJsonPointer.call(this, parsedRef, baseId, schema, root); - } -} - - -var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']); -/* @this Ajv */ -function getJsonPointer(parsedRef, baseId, schema, root) { - /* jshint validthis: true */ - parsedRef.hash = parsedRef.hash || ''; - if (parsedRef.hash.slice(0,2) != '#/') return; - var parts = parsedRef.hash.split('/'); - - for (var i = 1; i < parts.length; i++) { - var part = parts[i]; - if (part) { - part = util.unescapeFragment(part); - schema = schema[part]; - if (schema === undefined) break; - var id; - if (!PREVENT_SCOPE_CHANGE[part]) { - id = this._getId(schema); - if (id) baseId = resolveUrl(baseId, id); - if (schema.$ref) { - var $ref = resolveUrl(baseId, schema.$ref); - var res = resolveSchema.call(this, root, $ref); - if (res) { - schema = res.schema; - root = res.root; - baseId = res.baseId; - } - } - } - } - } - if (schema !== undefined && schema !== root.schema) - return { schema: schema, root: root, baseId: baseId }; -} - - -var SIMPLE_INLINED = util.toHash([ - 'type', 'format', 'pattern', - 'maxLength', 'minLength', - 'maxProperties', 'minProperties', - 'maxItems', 'minItems', - 'maximum', 'minimum', - 'uniqueItems', 'multipleOf', - 'required', 'enum' -]); -function inlineRef(schema, limit) { - if (limit === false) return false; - if (limit === undefined || limit === true) return checkNoRef(schema); - else if (limit) return countKeys(schema) <= limit; -} - - -function checkNoRef(schema) { - var item; - if (Array.isArray(schema)) { - for (var i=0; i All rights reserved. @@ -47778,7 +47407,7 @@ module.exports = { /***/ }), -/* 207 */ +/* 204 */ /***/ (function(module, exports) { // Copyright 2011 Mark Cavage All rights reserved. @@ -47820,7 +47449,7 @@ module.exports = { /***/ }), -/* 208 */ +/* 205 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48100,7 +47729,7 @@ function hasWrapper(commander, args) { const requireLockfile = exports.requireLockfile = true; /***/ }), -/* 209 */ +/* 206 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48144,7 +47773,7 @@ function _load_misc() { var _packageNameUtils; function _load_packageNameUtils() { - return _packageNameUtils = __webpack_require__(223); + return _packageNameUtils = __webpack_require__(220); } var _workspaceLayout; @@ -48722,7 +48351,7 @@ class InstallationIntegrityChecker { exports.default = InstallationIntegrityChecker; /***/ }), -/* 210 */ +/* 207 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -48989,7 +48618,7 @@ function shouldCheck(manifest, options) { } /***/ }), -/* 211 */ +/* 208 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49116,7 +48745,7 @@ function _load_errors() { var _index; function _load_index() { - return _index = _interopRequireWildcard(__webpack_require__(552)); + return _index = _interopRequireWildcard(__webpack_require__(520)); } var _fs; @@ -49215,7 +48844,7 @@ function fetch(pkgs, config) { } /***/ }), -/* 212 */ +/* 209 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -49256,7 +48885,7 @@ let linkBin = exports.linkBin = (() => { var _packageHoister; function _load_packageHoister() { - return _packageHoister = _interopRequireDefault(__webpack_require__(556)); + return _packageHoister = _interopRequireDefault(__webpack_require__(524)); } var _constants; @@ -49292,7 +48921,7 @@ function _load_fs() { var _mutex; function _load_mutex() { - return _mutex = _interopRequireDefault(__webpack_require__(375)); + return _mutex = _interopRequireDefault(__webpack_require__(369)); } var _semver; @@ -50355,7 +49984,7 @@ class PackageLinker { exports.default = PackageLinker; /***/ }), -/* 213 */ +/* 210 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -50446,7 +50075,7 @@ function clearNthLine(stdout, n) { } /***/ }), -/* 214 */ +/* 211 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -50465,7 +50094,7 @@ function _load_extends() { var _baseReporter; function _load_baseReporter() { - return _baseReporter = _interopRequireDefault(__webpack_require__(109)); + return _baseReporter = _interopRequireDefault(__webpack_require__(108)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -50640,7 +50269,7 @@ class JSONReporter extends (_baseReporter || _load_baseReporter()).default { exports.default = JSONReporter; /***/ }), -/* 215 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -50678,13 +50307,13 @@ function _load_normalizePattern() { var _parsePackagePath; function _load_parsePackagePath() { - return _parsePackagePath = _interopRequireDefault(__webpack_require__(376)); + return _parsePackagePath = _interopRequireDefault(__webpack_require__(370)); } var _parsePackagePath2; function _load_parsePackagePath2() { - return _parsePackagePath2 = __webpack_require__(376); + return _parsePackagePath2 = __webpack_require__(370); } var _resolvers; @@ -50788,7 +50417,7 @@ const shouldUpdateLockfile = exports.shouldUpdateLockfile = (lockfileEntry, reso }; /***/ }), -/* 216 */ +/* 213 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -50926,7 +50555,7 @@ FileResolver.protocol = 'file'; FileResolver.prefixMatcher = /^\.{1,2}\//; /***/ }), -/* 217 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -51002,7 +50631,7 @@ exports.default = GistResolver; GistResolver.protocol = 'gist'; /***/ }), -/* 218 */ +/* 215 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -51021,7 +50650,7 @@ function _load_asyncToGenerator() { var _cache; function _load_cache() { - return _cache = __webpack_require__(355); + return _cache = __webpack_require__(349); } var _errors; @@ -51033,7 +50662,7 @@ function _load_errors() { var _registryResolver; function _load_registryResolver() { - return _registryResolver = _interopRequireDefault(__webpack_require__(575)); + return _registryResolver = _interopRequireDefault(__webpack_require__(543)); } var _npmRegistry; @@ -51063,7 +50692,7 @@ function _load_constants() { var _packageNameUtils; function _load_packageNameUtils() { - return _packageNameUtils = __webpack_require__(223); + return _packageNameUtils = __webpack_require__(220); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } @@ -51291,7 +50920,7 @@ exports.default = NpmResolver; NpmResolver.registry = NPM_REGISTRY_ID; /***/ }), -/* 219 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -51489,7 +51118,7 @@ const copyWithBuffer = (() => { }; /***/ }), -/* 220 */ +/* 217 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -51556,13 +51185,13 @@ function _load_errors() { var _gitSpawn; function _load_gitSpawn() { - return _gitSpawn = __webpack_require__(373); + return _gitSpawn = __webpack_require__(367); } var _gitRefResolver; function _load_gitRefResolver() { - return _gitRefResolver = __webpack_require__(581); + return _gitRefResolver = __webpack_require__(549); } var _crypto; @@ -52133,7 +51762,7 @@ class Git { exports.default = Git; /***/ }), -/* 221 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52152,7 +51781,7 @@ function _load_asyncToGenerator() { var _resolveRelative; function _load_resolveRelative() { - return _resolveRelative = _interopRequireDefault(__webpack_require__(586)); + return _resolveRelative = _interopRequireDefault(__webpack_require__(554)); } var _validate; @@ -52164,7 +51793,7 @@ function _load_validate() { var _fix; function _load_fix() { - return _fix = _interopRequireDefault(__webpack_require__(583)); + return _fix = _interopRequireDefault(__webpack_require__(551)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -52220,7 +51849,7 @@ exports.default = (() => { })(); /***/ }), -/* 222 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52349,7 +51978,7 @@ function extractRepositoryUrl(repository) { } /***/ }), -/* 223 */ +/* 220 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52373,7 +52002,7 @@ function getSystemParams() { } /***/ }), -/* 224 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52401,7 +52030,7 @@ function isRootUser(uid) { } /***/ }), -/* 225 */ +/* 222 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52467,7 +52096,7 @@ function getLocalAppDataDir() { } /***/ }), -/* 226 */ +/* 223 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52487,13 +52116,13 @@ function explodeHashedUrl(url) { } /***/ }), -/* 227 */ +/* 224 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(233), __esModule: true }; +module.exports = { "default": __webpack_require__(230), __esModule: true }; /***/ }), -/* 228 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52559,11 +52188,11 @@ function range(a, b, str) { /***/ }), -/* 229 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { -var concatMap = __webpack_require__(232); -var balanced = __webpack_require__(228); +var concatMap = __webpack_require__(229); +var balanced = __webpack_require__(225); module.exports = expandTop; @@ -52766,7 +52395,7 @@ function expand(str, isTop) { /***/ }), -/* 230 */ +/* 227 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -52837,7 +52466,7 @@ module.exports = function (str) { /***/ }), -/* 231 */ +/* 228 */ /***/ (function(module, exports) { function Caseless (dict) { @@ -52910,7 +52539,7 @@ module.exports.httpify = function (resp, headers) { /***/ }), -/* 232 */ +/* 229 */ /***/ (function(module, exports) { module.exports = function (xs, fn) { @@ -52929,27 +52558,27 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 233 */ +/* 230 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(259); +__webpack_require__(256); +__webpack_require__(258); __webpack_require__(261); -__webpack_require__(264); +__webpack_require__(257); +__webpack_require__(259); __webpack_require__(260); -__webpack_require__(262); -__webpack_require__(263); module.exports = __webpack_require__(31).Promise; /***/ }), -/* 234 */ +/* 231 */ /***/ (function(module, exports) { module.exports = function () { /* empty */ }; /***/ }), -/* 235 */ +/* 232 */ /***/ (function(module, exports) { module.exports = function (it, Constructor, name, forbiddenField) { @@ -52960,14 +52589,14 @@ module.exports = function (it, Constructor, name, forbiddenField) { /***/ }), -/* 236 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes var toIObject = __webpack_require__(98); var toLength = __webpack_require__(136); -var toAbsoluteIndex = __webpack_require__(254); +var toAbsoluteIndex = __webpack_require__(251); module.exports = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIObject($this); @@ -52989,15 +52618,15 @@ module.exports = function (IS_INCLUDES) { /***/ }), -/* 237 */ +/* 234 */ /***/ (function(module, exports, __webpack_require__) { var ctx = __webpack_require__(70); -var call = __webpack_require__(241); -var isArrayIter = __webpack_require__(240); +var call = __webpack_require__(238); +var isArrayIter = __webpack_require__(237); var anObject = __webpack_require__(35); var toLength = __webpack_require__(136); -var getIterFn = __webpack_require__(257); +var getIterFn = __webpack_require__(254); var BREAK = {}; var RETURN = {}; var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) { @@ -53020,16 +52649,16 @@ exports.RETURN = RETURN; /***/ }), -/* 238 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = !__webpack_require__(52) && !__webpack_require__(113)(function () { +module.exports = !__webpack_require__(52) && !__webpack_require__(112)(function () { return Object.defineProperty(__webpack_require__(92)('div'), 'a', { get: function () { return 7; } }).a != 7; }); /***/ }), -/* 239 */ +/* 236 */ /***/ (function(module, exports) { // fast apply, http://jsperf.lnkit.com/fast-apply/5 @@ -53051,7 +52680,7 @@ module.exports = function (fn, args, that) { /***/ }), -/* 240 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { // check on default Array iterator @@ -53065,7 +52694,7 @@ module.exports = function (it) { /***/ }), -/* 241 */ +/* 238 */ /***/ (function(module, exports, __webpack_require__) { // call something on iterator step with safe closing on error @@ -53083,12 +52712,12 @@ module.exports = function (iterator, fn, value, entries) { /***/ }), -/* 242 */ +/* 239 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var create = __webpack_require__(246); +var create = __webpack_require__(243); var descriptor = __webpack_require__(132); var setToStringTag = __webpack_require__(95); var IteratorPrototype = {}; @@ -53103,7 +52732,7 @@ module.exports = function (Constructor, NAME, next) { /***/ }), -/* 243 */ +/* 240 */ /***/ (function(module, exports, __webpack_require__) { var ITERATOR = __webpack_require__(21)('iterator'); @@ -53131,7 +52760,7 @@ module.exports = function (exec, skipClosing) { /***/ }), -/* 244 */ +/* 241 */ /***/ (function(module, exports) { module.exports = function (done, value) { @@ -53140,7 +52769,7 @@ module.exports = function (done, value) { /***/ }), -/* 245 */ +/* 242 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(17); @@ -53215,12 +52844,12 @@ module.exports = function () { /***/ }), -/* 246 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) var anObject = __webpack_require__(35); -var dPs = __webpack_require__(247); +var dPs = __webpack_require__(244); var enumBugKeys = __webpack_require__(127); var IE_PROTO = __webpack_require__(96)('IE_PROTO'); var Empty = function () { /* empty */ }; @@ -53262,7 +52891,7 @@ module.exports = Object.create || function create(O, Properties) { /***/ }), -/* 247 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { var dP = __webpack_require__(72); @@ -53281,7 +52910,7 @@ module.exports = __webpack_require__(52) ? Object.defineProperties : function de /***/ }), -/* 248 */ +/* 245 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) @@ -53300,12 +52929,12 @@ module.exports = Object.getPrototypeOf || function (O) { /***/ }), -/* 249 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { var has = __webpack_require__(71); var toIObject = __webpack_require__(98); -var arrayIndexOf = __webpack_require__(236)(false); +var arrayIndexOf = __webpack_require__(233)(false); var IE_PROTO = __webpack_require__(96)('IE_PROTO'); module.exports = function (object, names) { @@ -53323,7 +52952,7 @@ module.exports = function (object, names) { /***/ }), -/* 250 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { var hide = __webpack_require__(42); @@ -53336,14 +52965,14 @@ module.exports = function (target, src, safe) { /***/ }), -/* 251 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(42); /***/ }), -/* 252 */ +/* 249 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53364,7 +52993,7 @@ module.exports = function (KEY) { /***/ }), -/* 253 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(97); @@ -53387,7 +53016,7 @@ module.exports = function (TO_STRING) { /***/ }), -/* 254 */ +/* 251 */ /***/ (function(module, exports, __webpack_require__) { var toInteger = __webpack_require__(97); @@ -53400,7 +53029,7 @@ module.exports = function (index, length) { /***/ }), -/* 255 */ +/* 252 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) @@ -53418,7 +53047,7 @@ module.exports = function (it, S) { /***/ }), -/* 256 */ +/* 253 */ /***/ (function(module, exports, __webpack_require__) { var global = __webpack_require__(17); @@ -53428,7 +53057,7 @@ module.exports = navigator && navigator.userAgent || ''; /***/ }), -/* 257 */ +/* 254 */ /***/ (function(module, exports, __webpack_require__) { var classof = __webpack_require__(126); @@ -53442,13 +53071,13 @@ module.exports = __webpack_require__(31).getIteratorMethod = function (it) { /***/ }), -/* 258 */ +/* 255 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var addToUnscopables = __webpack_require__(234); -var step = __webpack_require__(244); +var addToUnscopables = __webpack_require__(231); +var step = __webpack_require__(241); var Iterators = __webpack_require__(54); var toIObject = __webpack_require__(98); @@ -53483,13 +53112,13 @@ addToUnscopables('entries'); /***/ }), -/* 259 */ +/* 256 */ /***/ (function(module, exports) { /***/ }), -/* 260 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53501,14 +53130,14 @@ var classof = __webpack_require__(126); var $export = __webpack_require__(60); var isObject = __webpack_require__(53); var aFunction = __webpack_require__(68); -var anInstance = __webpack_require__(235); -var forOf = __webpack_require__(237); +var anInstance = __webpack_require__(232); +var forOf = __webpack_require__(234); var speciesConstructor = __webpack_require__(134); var task = __webpack_require__(135).set; -var microtask = __webpack_require__(245)(); +var microtask = __webpack_require__(242)(); var newPromiseCapabilityModule = __webpack_require__(94); var perform = __webpack_require__(130); -var userAgent = __webpack_require__(256); +var userAgent = __webpack_require__(253); var promiseResolve = __webpack_require__(131); var PROMISE = 'Promise'; var TypeError = global.TypeError; @@ -53684,7 +53313,7 @@ if (!USE_NATIVE) { this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled this._n = false; // <- notify }; - Internal.prototype = __webpack_require__(250)($Promise.prototype, { + Internal.prototype = __webpack_require__(247)($Promise.prototype, { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function then(onFulfilled, onRejected) { var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); @@ -53716,7 +53345,7 @@ if (!USE_NATIVE) { $export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise }); __webpack_require__(95)($Promise, PROMISE); -__webpack_require__(252)(PROMISE); +__webpack_require__(249)(PROMISE); Wrapper = __webpack_require__(31)[PROMISE]; // statics @@ -53735,7 +53364,7 @@ $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x); } }); -$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(243)(function (iter) { +$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(240)(function (iter) { $Promise.all(iter)['catch'](empty); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) @@ -53782,12 +53411,12 @@ $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(243)(functio /***/ }), -/* 261 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var $at = __webpack_require__(253)(true); +var $at = __webpack_require__(250)(true); // 21.1.3.27 String.prototype[@@iterator]() __webpack_require__(129)(String, 'String', function (iterated) { @@ -53806,7 +53435,7 @@ __webpack_require__(129)(String, 'String', function (iterated) { /***/ }), -/* 262 */ +/* 259 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53833,7 +53462,7 @@ $export($export.P + $export.R, 'Promise', { 'finally': function (onFinally) { /***/ }), -/* 263 */ +/* 260 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -53852,10 +53481,10 @@ $export($export.S, 'Promise', { 'try': function (callbackfn) { /***/ }), -/* 264 */ +/* 261 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(258); +__webpack_require__(255); var global = __webpack_require__(17); var hide = __webpack_require__(42); var Iterators = __webpack_require__(54); @@ -53877,7 +53506,7 @@ for (var i = 0; i < DOMIterables.length; i++) { /***/ }), -/* 265 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54078,7 +53707,7 @@ function localstorage() { /***/ }), -/* 266 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54087,14 +53716,14 @@ function localstorage() { */ if (typeof process === 'undefined' || process.type === 'renderer') { - module.exports = __webpack_require__(265); + module.exports = __webpack_require__(262); } else { - module.exports = __webpack_require__(267); + module.exports = __webpack_require__(264); } /***/ }), -/* 267 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -54286,7 +53915,7 @@ exports.enable(load()); /***/ }), -/* 268 */ +/* 265 */ /***/ (function(module, exports, __webpack_require__) { (function webpackUniversalModuleDefinition(root, factory) { @@ -61000,7 +60629,7 @@ return /******/ (function(modules) { // webpackBootstrap ; /***/ }), -/* 269 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61124,12 +60753,12 @@ module.exports = function extend() { /***/ }), -/* 270 */ +/* 267 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const escapeStringRegexp = __webpack_require__(388); +const escapeStringRegexp = __webpack_require__(382); const platform = process.platform; @@ -61278,7 +60907,7 @@ module.exports = Object.assign(fn, figures); /***/ }), -/* 271 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { // Copyright Joyent, Inc. and other Node contributors. @@ -61587,7 +61216,7 @@ exports.realpath = function realpath(p, cache, cb) { /***/ }), -/* 272 */ +/* 269 */ /***/ (function(module, exports, __webpack_require__) { module.exports = globSync @@ -62078,6 +61707,387 @@ GlobSync.prototype._makeAbs = function (f) { } +/***/ }), +/* 270 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var resolve = __webpack_require__(271); + +module.exports = { + Validation: errorSubclass(ValidationError), + MissingRef: errorSubclass(MissingRefError) +}; + + +function ValidationError(errors) { + this.message = 'validation failed'; + this.errors = errors; + this.ajv = this.validation = true; +} + + +MissingRefError.message = function (baseId, ref) { + return 'can\'t resolve reference ' + ref + ' from id ' + baseId; +}; + + +function MissingRefError(baseId, ref, message) { + this.message = message || MissingRefError.message(baseId, ref); + this.missingRef = resolve.url(baseId, ref); + this.missingSchema = resolve.normalizeId(resolve.fullPath(this.missingRef)); +} + + +function errorSubclass(Subclass) { + Subclass.prototype = Object.create(Error.prototype); + Subclass.prototype.constructor = Subclass; + return Subclass; +} + + +/***/ }), +/* 271 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var url = __webpack_require__(24) + , equal = __webpack_require__(272) + , util = __webpack_require__(114) + , SchemaObject = __webpack_require__(386) + , traverse = __webpack_require__(677); + +module.exports = resolve; + +resolve.normalizeId = normalizeId; +resolve.fullPath = getFullPath; +resolve.url = resolveUrl; +resolve.ids = resolveIds; +resolve.inlineRef = inlineRef; +resolve.schema = resolveSchema; + +/** + * [resolve and compile the references ($ref)] + * @this Ajv + * @param {Function} compile reference to schema compilation funciton (localCompile) + * @param {Object} root object with information about the root schema for the current schema + * @param {String} ref reference to resolve + * @return {Object|Function} schema object (if the schema can be inlined) or validation function + */ +function resolve(compile, root, ref) { + /* jshint validthis: true */ + var refVal = this._refs[ref]; + if (typeof refVal == 'string') { + if (this._refs[refVal]) refVal = this._refs[refVal]; + else return resolve.call(this, compile, root, refVal); + } + + refVal = refVal || this._schemas[ref]; + if (refVal instanceof SchemaObject) { + return inlineRef(refVal.schema, this._opts.inlineRefs) + ? refVal.schema + : refVal.validate || this._compile(refVal); + } + + var res = resolveSchema.call(this, root, ref); + var schema, v, baseId; + if (res) { + schema = res.schema; + root = res.root; + baseId = res.baseId; + } + + if (schema instanceof SchemaObject) { + v = schema.validate || compile.call(this, schema.schema, root, undefined, baseId); + } else if (schema !== undefined) { + v = inlineRef(schema, this._opts.inlineRefs) + ? schema + : compile.call(this, schema, root, undefined, baseId); + } + + return v; +} + + +/** + * Resolve schema, its root and baseId + * @this Ajv + * @param {Object} root root object with properties schema, refVal, refs + * @param {String} ref reference to resolve + * @return {Object} object with properties schema, root, baseId + */ +function resolveSchema(root, ref) { + /* jshint validthis: true */ + var p = url.parse(ref, false, true) + , refPath = _getFullPath(p) + , baseId = getFullPath(this._getId(root.schema)); + if (refPath !== baseId) { + var id = normalizeId(refPath); + var refVal = this._refs[id]; + if (typeof refVal == 'string') { + return resolveRecursive.call(this, root, refVal, p); + } else if (refVal instanceof SchemaObject) { + if (!refVal.validate) this._compile(refVal); + root = refVal; + } else { + refVal = this._schemas[id]; + if (refVal instanceof SchemaObject) { + if (!refVal.validate) this._compile(refVal); + if (id == normalizeId(ref)) + return { schema: refVal, root: root, baseId: baseId }; + root = refVal; + } else { + return; + } + } + if (!root.schema) return; + baseId = getFullPath(this._getId(root.schema)); + } + return getJsonPointer.call(this, p, baseId, root.schema, root); +} + + +/* @this Ajv */ +function resolveRecursive(root, ref, parsedRef) { + /* jshint validthis: true */ + var res = resolveSchema.call(this, root, ref); + if (res) { + var schema = res.schema; + var baseId = res.baseId; + root = res.root; + var id = this._getId(schema); + if (id) baseId = resolveUrl(baseId, id); + return getJsonPointer.call(this, parsedRef, baseId, schema, root); + } +} + + +var PREVENT_SCOPE_CHANGE = util.toHash(['properties', 'patternProperties', 'enum', 'dependencies', 'definitions']); +/* @this Ajv */ +function getJsonPointer(parsedRef, baseId, schema, root) { + /* jshint validthis: true */ + parsedRef.hash = parsedRef.hash || ''; + if (parsedRef.hash.slice(0,2) != '#/') return; + var parts = parsedRef.hash.split('/'); + + for (var i = 1; i < parts.length; i++) { + var part = parts[i]; + if (part) { + part = util.unescapeFragment(part); + schema = schema[part]; + if (schema === undefined) break; + var id; + if (!PREVENT_SCOPE_CHANGE[part]) { + id = this._getId(schema); + if (id) baseId = resolveUrl(baseId, id); + if (schema.$ref) { + var $ref = resolveUrl(baseId, schema.$ref); + var res = resolveSchema.call(this, root, $ref); + if (res) { + schema = res.schema; + root = res.root; + baseId = res.baseId; + } + } + } + } + } + if (schema !== undefined && schema !== root.schema) + return { schema: schema, root: root, baseId: baseId }; +} + + +var SIMPLE_INLINED = util.toHash([ + 'type', 'format', 'pattern', + 'maxLength', 'minLength', + 'maxProperties', 'minProperties', + 'maxItems', 'minItems', + 'maximum', 'minimum', + 'uniqueItems', 'multipleOf', + 'required', 'enum' +]); +function inlineRef(schema, limit) { + if (limit === false) return false; + if (limit === undefined || limit === true) return checkNoRef(schema); + else if (limit) return countKeys(schema) <= limit; +} + + +function checkNoRef(schema) { + var item; + if (Array.isArray(schema)) { + for (var i=0; i', - $notOp = $isMax ? '>' : '<', - $errorKeyword = undefined; - if ($isDataExcl) { - var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), - $exclusive = 'exclusive' + $lvl, - $exclType = 'exclType' + $lvl, - $exclIsNumber = 'exclIsNumber' + $lvl, - $opExpr = 'op' + $lvl, - $opStr = '\' + ' + $opExpr + ' + \''; - out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; - $schemaValueExcl = 'schemaExcl' + $lvl; - out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; - var $errorKeyword = $exclusiveKeyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';'; - } else { - var $exclIsNumber = typeof $schemaExcl == 'number', - $opStr = $op; - if ($exclIsNumber && $isData) { - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; - } else { - if ($exclIsNumber && $schema === undefined) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $schemaValue = $schemaExcl; - $notOp += '='; - } else { - if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); - if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { - $exclusive = true; - $errorKeyword = $exclusiveKeyword; - $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; - $notOp += '='; - } else { - $exclusive = false; - $opStr += '='; - } - } - var $opExpr = '\'' + $opStr + '\''; - out += ' if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; - } - } - $errorKeyword = $errorKeyword || $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be ' + ($opStr) + ' '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - - -/***/ }), -/* 341 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -module.exports = function generate__limitItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $op = $keyword == 'maxItems' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxItems') { - out += 'more'; - } else { - out += 'less'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - - -/***/ }), -/* 342 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -module.exports = function generate__limitLength(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $op = $keyword == 'maxLength' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - if (it.opts.unicode === false) { - out += ' ' + ($data) + '.length '; - } else { - out += ' ucs2length(' + ($data) + ') '; - } - out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be '; - if ($keyword == 'maxLength') { - out += 'longer'; - } else { - out += 'shorter'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' characters\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - - -/***/ }), -/* 343 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -module.exports = function generate__limitProperties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $op = $keyword == 'maxProperties' ? '>' : '<'; - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; - } - out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; - var $errorKeyword = $keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have '; - if ($keyword == 'maxProperties') { - out += 'more'; - } else { - out += 'less'; - } - out += ' than '; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + ($schema); - } - out += ' properties\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += '} '; - if ($breakOnError) { - out += ' else { '; - } - return out; -} - - -/***/ }), -/* 344 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -module.exports = function generate_validate(it, $keyword, $ruleType) { - var out = ''; - var $async = it.schema.$async === true, - $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'), - $id = it.self._getId(it.schema); - if (it.isTop) { - if ($async) { - it.async = true; - var $es7 = it.opts.async == 'es7'; - it.yieldAwait = $es7 ? 'await' : 'yield'; - } - out += ' var validate = '; - if ($async) { - if ($es7) { - out += ' (async function '; - } else { - if (it.opts.async != '*') { - out += 'co.wrap'; - } - out += '(function* '; - } - } else { - out += ' (function '; - } - out += ' (data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; '; - if ($id && (it.opts.sourceCode || it.opts.processCode)) { - out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' '; - } - } - if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) { - var $keyword = 'false schema'; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - if (it.schema === false) { - if (it.isTop) { - $breakOnError = true; - } else { - out += ' var ' + ($valid) + ' = false; '; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'boolean schema is false\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } else { - if (it.isTop) { - if ($async) { - out += ' return data; '; - } else { - out += ' validate.errors = null; return true; '; - } - } else { - out += ' var ' + ($valid) + ' = true; '; - } - } - if (it.isTop) { - out += ' }); return validate; '; - } - return out; - } - if (it.isTop) { - var $top = it.isTop, - $lvl = it.level = 0, - $dataLvl = it.dataLevel = 0, - $data = 'data'; - it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); - it.baseId = it.baseId || it.rootId; - delete it.isTop; - it.dataPathArr = [undefined]; - out += ' var vErrors = null; '; - out += ' var errors = 0; '; - out += ' if (rootData === undefined) rootData = data; '; - } else { - var $lvl = it.level, - $dataLvl = it.dataLevel, - $data = 'data' + ($dataLvl || ''); - if ($id) it.baseId = it.resolve.url(it.baseId, $id); - if ($async && !it.async) throw new Error('async schema in sync schema'); - out += ' var errs_' + ($lvl) + ' = errors;'; - } - var $valid = 'valid' + $lvl, - $breakOnError = !it.opts.allErrors, - $closingBraces1 = '', - $closingBraces2 = ''; - var $errorKeyword; - var $typeSchema = it.schema.type, - $typeIsArray = Array.isArray($typeSchema); - if ($typeIsArray && $typeSchema.length == 1) { - $typeSchema = $typeSchema[0]; - $typeIsArray = false; - } - if (it.schema.$ref && $refKeywords) { - if (it.opts.extendRefs == 'fail') { - throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); - } else if (it.opts.extendRefs !== true) { - $refKeywords = false; - it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); - } - } - if ($typeSchema) { - if (it.opts.coerceTypes) { - var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); - } - var $rulesGroup = it.RULES.types[$typeSchema]; - if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) { - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type', - $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; - out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { '; - if ($coerceToTypes) { - var $dataType = 'dataType' + $lvl, - $coerced = 'coerced' + $lvl; - out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; '; - if (it.opts.coerceTypes == 'array') { - out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; '; - } - out += ' var ' + ($coerced) + ' = undefined; '; - var $bracesCoercion = ''; - var arr1 = $coerceToTypes; - if (arr1) { - var $type, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $type = arr1[$i += 1]; - if ($i) { - out += ' if (' + ($coerced) + ' === undefined) { '; - $bracesCoercion += '}'; - } - if (it.opts.coerceTypes == 'array' && $type != 'array') { - out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } '; - } - if ($type == 'string') { - out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; - } else if ($type == 'number' || $type == 'integer') { - out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; - if ($type == 'integer') { - out += ' && !(' + ($data) + ' % 1)'; - } - out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; - } else if ($type == 'boolean') { - out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; - } else if ($type == 'null') { - out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; - } else if (it.opts.coerceTypes == 'array' && $type == 'array') { - out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; - } - } - } - out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' ' + ($data) + ' = ' + ($coerced) + '; '; - if (!$dataLvl) { - out += 'if (' + ($parentData) + ' !== undefined)'; - } - out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } '; - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - } - out += ' } '; - } - } - if (it.schema.$ref && !$refKeywords) { - out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; - if ($breakOnError) { - out += ' } if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } else { - if (it.opts.v5 && it.schema.patternGroups) { - it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); - } - var arr2 = it.RULES; - if (arr2) { - var $rulesGroup, i2 = -1, - l2 = arr2.length - 1; - while (i2 < l2) { - $rulesGroup = arr2[i2 += 1]; - if ($shouldUseGroup($rulesGroup)) { - if ($rulesGroup.type) { - out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { '; - } - if (it.opts.useDefaults && !it.compositeRule) { - if ($rulesGroup.type == 'object' && it.schema.properties) { - var $schema = it.schema.properties, - $schemaKeys = Object.keys($schema); - var arr3 = $schemaKeys; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $sch = $schema[$propertyKey]; - if ($sch.default !== undefined) { - var $passData = $data + it.util.getProperty($propertyKey); - out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { - var arr4 = it.schema.items; - if (arr4) { - var $sch, $i = -1, - l4 = arr4.length - 1; - while ($i < l4) { - $sch = arr4[$i += 1]; - if ($sch.default !== undefined) { - var $passData = $data + '[' + $i + ']'; - out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; - if (it.opts.useDefaults == 'shared') { - out += ' ' + (it.useDefault($sch.default)) + ' '; - } else { - out += ' ' + (JSON.stringify($sch.default)) + ' '; - } - out += '; '; - } - } - } - } - } - var arr5 = $rulesGroup.rules; - if (arr5) { - var $rule, i5 = -1, - l5 = arr5.length - 1; - while (i5 < l5) { - $rule = arr5[i5 += 1]; - if ($shouldUseRule($rule)) { - var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); - if ($code) { - out += ' ' + ($code) + ' '; - if ($breakOnError) { - $closingBraces1 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces1) + ' '; - $closingBraces1 = ''; - } - if ($rulesGroup.type) { - out += ' } '; - if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { - out += ' else { '; - var $schemaPath = it.schemaPath + '.type', - $errSchemaPath = it.errSchemaPath + '/type'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be '; - if ($typeIsArray) { - out += '' + ($typeSchema.join(",")); - } else { - out += '' + ($typeSchema); - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - } - } - if ($breakOnError) { - out += ' if (errors === '; - if ($top) { - out += '0'; - } else { - out += 'errs_' + ($lvl); - } - out += ') { '; - $closingBraces2 += '}'; - } - } - } - } - } - if ($breakOnError) { - out += ' ' + ($closingBraces2) + ' '; - } - if ($top) { - if ($async) { - out += ' if (errors === 0) return data; '; - out += ' else throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; '; - out += ' return errors === 0; '; - } - out += ' }); return validate;'; - } else { - out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; - } - out = it.util.cleanUpCode(out); - if ($top) { - out = it.util.finalCleanUpCode(out, $async); - } - - function $shouldUseGroup($rulesGroup) { - var rules = $rulesGroup.rules; - for (var i = 0; i < rules.length; i++) - if ($shouldUseRule(rules[i])) return true; - } - - function $shouldUseRule($rule) { - return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); - } - - function $ruleImplementsSomeKeyword($rule) { - var impl = $rule.implements; - for (var i = 0; i < impl.length; i++) - if (it.schema[impl[i]] !== undefined) return true; - } - return out; -} - - -/***/ }), -/* 345 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = __webpack_require__(509)().Promise - - -/***/ }), -/* 346 */ /***/ (function(module, exports) { // API @@ -72278,10 +71397,10 @@ function clean(key) /***/ }), -/* 347 */ +/* 341 */ /***/ (function(module, exports, __webpack_require__) { -var defer = __webpack_require__(518); +var defer = __webpack_require__(486); // API module.exports = async; @@ -72318,11 +71437,11 @@ function async(callback) /***/ }), -/* 348 */ +/* 342 */ /***/ (function(module, exports, __webpack_require__) { -var async = __webpack_require__(347) - , abort = __webpack_require__(346) +var async = __webpack_require__(341) + , abort = __webpack_require__(340) ; // API @@ -72399,7 +71518,7 @@ function runJob(iterator, key, item, callback) /***/ }), -/* 349 */ +/* 343 */ /***/ (function(module, exports) { // API @@ -72442,11 +71561,11 @@ function state(list, sortMethod) /***/ }), -/* 350 */ +/* 344 */ /***/ (function(module, exports, __webpack_require__) { -var abort = __webpack_require__(346) - , async = __webpack_require__(347) +var abort = __webpack_require__(340) + , async = __webpack_require__(341) ; // API @@ -72477,12 +71596,12 @@ function terminator(callback) /***/ }), -/* 351 */ +/* 345 */ /***/ (function(module, exports, __webpack_require__) { -var iterate = __webpack_require__(348) - , initState = __webpack_require__(349) - , terminator = __webpack_require__(350) +var iterate = __webpack_require__(342) + , initState = __webpack_require__(343) + , terminator = __webpack_require__(344) ; // Public API @@ -72558,7 +71677,7 @@ function descending(a, b) /***/ }), -/* 352 */ +/* 346 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72573,7 +71692,7 @@ exports.default = { }; /***/ }), -/* 353 */ +/* 347 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72647,13 +71766,13 @@ function _load_promise() { var _hoistedTreeBuilder; function _load_hoistedTreeBuilder() { - return _hoistedTreeBuilder = __webpack_require__(554); + return _hoistedTreeBuilder = __webpack_require__(522); } var _getTransitiveDevDependencies; function _load_getTransitiveDevDependencies() { - return _getTransitiveDevDependencies = __webpack_require__(580); + return _getTransitiveDevDependencies = __webpack_require__(548); } var _install; @@ -72890,7 +72009,7 @@ class Audit { exports.default = Audit; /***/ }), -/* 354 */ +/* 348 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73132,7 +72251,7 @@ function _load_index() { var _filter; function _load_filter() { - return _filter = __webpack_require__(372); + return _filter = __webpack_require__(366); } var _constants; @@ -73217,7 +72336,7 @@ function hasWrapper(commander) { } /***/ }), -/* 355 */ +/* 349 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73465,7 +72584,7 @@ function setFlags(commander) { } /***/ }), -/* 356 */ +/* 350 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73934,13 +73053,13 @@ function _load_errors() { var _integrityChecker; function _load_integrityChecker() { - return _integrityChecker = _interopRequireDefault(__webpack_require__(209)); + return _integrityChecker = _interopRequireDefault(__webpack_require__(206)); } var _integrityChecker2; function _load_integrityChecker2() { - return _integrityChecker2 = __webpack_require__(209); + return _integrityChecker2 = __webpack_require__(206); } var _lockfile; @@ -73988,7 +73107,7 @@ function setFlags(commander) { } /***/ }), -/* 357 */ +/* 351 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74144,7 +73263,7 @@ function setFlags(commander) { } /***/ }), -/* 358 */ +/* 352 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74494,7 +73613,7 @@ function getDevDeps(manifest) { } /***/ }), -/* 359 */ +/* 353 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74715,7 +73834,7 @@ function hasWrapper(commander, args) { } /***/ }), -/* 360 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75047,19 +74166,19 @@ exports.hasWrapper = hasWrapper; var _executeLifecycleScript; function _load_executeLifecycleScript() { - return _executeLifecycleScript = __webpack_require__(112); + return _executeLifecycleScript = __webpack_require__(111); } var _dynamicRequire; function _load_dynamicRequire() { - return _dynamicRequire = __webpack_require__(371); + return _dynamicRequire = __webpack_require__(365); } var _hooks; function _load_hooks() { - return _hooks = __webpack_require__(374); + return _hooks = __webpack_require__(368); } var _errors; @@ -75071,7 +74190,7 @@ function _load_errors() { var _packageCompatibility; function _load_packageCompatibility() { - return _packageCompatibility = __webpack_require__(210); + return _packageCompatibility = __webpack_require__(207); } var _fs; @@ -75136,7 +74255,7 @@ function hasWrapper(commander, args) { } /***/ }), -/* 361 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75251,7 +74370,7 @@ function _load_buildSubCommands() { var _login; function _load_login() { - return _login = __webpack_require__(108); + return _login = __webpack_require__(107); } var _npmRegistry; @@ -75367,7 +74486,7 @@ exports.hasWrapper = hasWrapper; exports.examples = examples; /***/ }), -/* 362 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75616,19 +74735,19 @@ function _load_add() { var _upgrade; function _load_upgrade() { - return _upgrade = __webpack_require__(208); + return _upgrade = __webpack_require__(205); } var _colorForVersions; function _load_colorForVersions() { - return _colorForVersions = _interopRequireDefault(__webpack_require__(369)); + return _colorForVersions = _interopRequireDefault(__webpack_require__(363)); } var _colorizeDiff; function _load_colorizeDiff() { - return _colorizeDiff = _interopRequireDefault(__webpack_require__(370)); + return _colorizeDiff = _interopRequireDefault(__webpack_require__(364)); } var _install; @@ -75658,7 +74777,7 @@ function hasWrapper(commander, args) { } /***/ }), -/* 363 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75884,7 +75003,7 @@ function _load_index() { var _executeLifecycleScript; function _load_executeLifecycleScript() { - return _executeLifecycleScript = __webpack_require__(112); + return _executeLifecycleScript = __webpack_require__(111); } var _errors; @@ -75896,7 +75015,7 @@ function _load_errors() { var _gitSpawn; function _load_gitSpawn() { - return _gitSpawn = __webpack_require__(373); + return _gitSpawn = __webpack_require__(367); } var _fs; @@ -75945,7 +75064,7 @@ function hasWrapper(commander, args) { } /***/ }), -/* 364 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76014,7 +75133,7 @@ const tarFs = __webpack_require__(194); const url = __webpack_require__(24); const fs = __webpack_require__(4); const stream = __webpack_require__(23); -const gunzip = __webpack_require__(656); +const gunzip = __webpack_require__(624); const invariant = __webpack_require__(9); const ssri = __webpack_require__(65); @@ -76389,7 +75508,7 @@ function urlParts(requestUrl) { } /***/ }), -/* 365 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76529,7 +75648,7 @@ class PackageReference { exports.default = PackageReference; /***/ }), -/* 366 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76566,13 +75685,13 @@ function _load_normalizePattern() { var _requestManager; function _load_requestManager() { - return _requestManager = _interopRequireDefault(__webpack_require__(378)); + return _requestManager = _interopRequireDefault(__webpack_require__(372)); } var _blockingQueue; function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(111)); + return _blockingQueue = _interopRequireDefault(__webpack_require__(110)); } var _lockfile; @@ -76596,13 +75715,13 @@ function _load_workspaceLayout() { var _resolutionMap; function _load_resolutionMap() { - return _resolutionMap = _interopRequireDefault(__webpack_require__(215)); + return _resolutionMap = _interopRequireDefault(__webpack_require__(212)); } var _resolutionMap2; function _load_resolutionMap2() { - return _resolutionMap2 = __webpack_require__(215); + return _resolutionMap2 = __webpack_require__(212); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -77463,7 +76582,7 @@ class PackageResolver { exports.default = PackageResolver; /***/ }), -/* 367 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77476,7 +76595,7 @@ Object.defineProperty(exports, "__esModule", { var _hostedGitResolver; function _load_hostedGitResolver() { - return _hostedGitResolver = _interopRequireDefault(__webpack_require__(110)); + return _hostedGitResolver = _interopRequireDefault(__webpack_require__(109)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -77522,7 +76641,7 @@ GitHubResolver.protocol = 'github'; GitHubResolver.hostname = 'github.com'; /***/ }), -/* 368 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77602,7 +76721,7 @@ exports.default = LinkResolver; LinkResolver.protocol = 'link'; /***/ }), -/* 369 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77643,7 +76762,7 @@ function _load_constants() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/* 370 */ +/* 364 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77667,7 +76786,7 @@ exports.default = function (from, to, reporter) { }; /***/ }), -/* 371 */ +/* 365 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77677,7 +76796,7 @@ exports.default = function (from, to, reporter) { exports.dynamicRequire = true ? require : require; // eslint-disable-line /***/ }), -/* 372 */ +/* 366 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77919,7 +77038,7 @@ function filterOverridenGitignores(files) { } /***/ }), -/* 373 */ +/* 367 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77977,7 +77096,7 @@ const spawn = exports.spawn = (args, opts = {}) => { }; /***/ }), -/* 374 */ +/* 368 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78010,7 +77129,7 @@ function callThroughHook(type, fn, context) { } /***/ }), -/* 375 */ +/* 369 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78038,7 +77157,7 @@ exports.default = key => { }; /***/ }), -/* 376 */ +/* 370 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78065,7 +77184,7 @@ function isValidPackagePath(input) { } /***/ }), -/* 377 */ +/* 371 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78099,7 +77218,7 @@ function resolveWithHome(path) { } /***/ }), -/* 378 */ +/* 372 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78130,7 +77249,7 @@ function _load_url() { var _dnscache; function _load_dnscache() { - return _dnscache = _interopRequireDefault(__webpack_require__(637)); + return _dnscache = _interopRequireDefault(__webpack_require__(605)); } var _invariant; @@ -78154,7 +77273,7 @@ function _load_errors() { var _blockingQueue; function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(111)); + return _blockingQueue = _interopRequireDefault(__webpack_require__(110)); } var _constants; @@ -78546,9 +77665,8 @@ class RequestManager { if (res.statusCode === 401 && res.headers['www-authenticate']) { const authMethods = res.headers['www-authenticate'].split(/,\s*/).map(s => s.toLowerCase()); - if (authMethods.indexOf('otp') !== -1) { - reject(new (_errors || _load_errors()).OneTimePasswordError()); + reject(new (_errors || _load_errors()).OneTimePasswordError(res.headers['npm-notice'])); return; } } @@ -78660,7 +77778,7 @@ class RequestManager { exports.default = RequestManager; /***/ }), -/* 379 */ +/* 373 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79223,11 +78341,11 @@ module.exports = { /***/ }), -/* 380 */ +/* 374 */ /***/ (function(module, exports, __webpack_require__) { -var bufferFill = __webpack_require__(594) -var allocUnsafe = __webpack_require__(593) +var bufferFill = __webpack_require__(562) +var allocUnsafe = __webpack_require__(561) module.exports = function alloc (size, fill, encoding) { if (typeof size !== 'number') { @@ -79261,7 +78379,7 @@ module.exports = function alloc (size, fill, encoding) { /***/ }), -/* 381 */ +/* 375 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79307,7 +78425,7 @@ exports.toggle = (force, stream) => { /***/ }), -/* 382 */ +/* 376 */ /***/ (function(module, exports, __webpack_require__) { var objectAssign = __webpack_require__(303); @@ -79617,7 +78735,7 @@ module.exports = { /***/ }), -/* 383 */ +/* 377 */ /***/ (function(module, exports) { @@ -79860,11 +78978,11 @@ function isObject(val) { /***/ }), -/* 384 */ +/* 378 */ /***/ (function(module, exports, __webpack_require__) { /* MIT license */ -var cssKeywords = __webpack_require__(610); +var cssKeywords = __webpack_require__(578); // NOTE: conversions should only return primitive values (i.e. arrays, or // values that give correct `typeof` results). @@ -80734,13 +79852,13 @@ convert.rgb.gray = function (rgb) { /***/ }), -/* 385 */ +/* 379 */ /***/ (function(module, exports, __webpack_require__) { var util = __webpack_require__(3); var Stream = __webpack_require__(23).Stream; -var DelayedStream = __webpack_require__(634); -var defer = __webpack_require__(622); +var DelayedStream = __webpack_require__(602); +var defer = __webpack_require__(590); module.exports = CombinedStream; function CombinedStream() { @@ -80929,7 +80047,7 @@ CombinedStream.prototype._emitError = function(err) { /***/ }), -/* 386 */ +/* 380 */ /***/ (function(module, exports, __webpack_require__) { var stream = __webpack_require__(102) @@ -81170,14 +80288,14 @@ module.exports = Duplexify /***/ }), -/* 387 */ +/* 381 */ /***/ (function(module, exports, __webpack_require__) { var crypto = __webpack_require__(11); var BigInteger = __webpack_require__(81).BigInteger; var ECPointFp = __webpack_require__(139).ECPointFp; var Buffer = __webpack_require__(15).Buffer; -exports.ECCurves = __webpack_require__(638); +exports.ECCurves = __webpack_require__(606); // zero prepad function unstupid(hex,len) @@ -81234,7 +80352,7 @@ exports.ECKey = function(curve, key, isPublic) /***/ }), -/* 388 */ +/* 382 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -81252,7 +80370,7 @@ module.exports = function (str) { /***/ }), -/* 389 */ +/* 383 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -81318,7 +80436,7 @@ module.exports = function (data, opts) { /***/ }), -/* 390 */ +/* 384 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -81346,12 +80464,12 @@ function clone (obj) { /***/ }), -/* 391 */ +/* 385 */ /***/ (function(module, exports, __webpack_require__) { var fs = __webpack_require__(4) -var polyfills = __webpack_require__(655) -var legacy = __webpack_require__(654) +var polyfills = __webpack_require__(623) +var legacy = __webpack_require__(622) var queue = [] var util = __webpack_require__(3) @@ -81375,7 +80493,7 @@ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { }) } -module.exports = patch(__webpack_require__(390)) +module.exports = patch(__webpack_require__(384)) if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) { module.exports = patch(fs) } @@ -81613,6 +80731,897 @@ function retry () { } +/***/ }), +/* 386 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var util = __webpack_require__(114); + +module.exports = SchemaObject; + +function SchemaObject(obj) { + util.copy(obj, this); +} + + +/***/ }), +/* 387 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +module.exports = function generate__limit(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $isMax = $keyword == 'maximum', + $exclusiveKeyword = $isMax ? 'exclusiveMaximum' : 'exclusiveMinimum', + $schemaExcl = it.schema[$exclusiveKeyword], + $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data, + $op = $isMax ? '<' : '>', + $notOp = $isMax ? '>' : '<', + $errorKeyword = undefined; + if ($isDataExcl) { + var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr), + $exclusive = 'exclusive' + $lvl, + $exclType = 'exclType' + $lvl, + $exclIsNumber = 'exclIsNumber' + $lvl, + $opExpr = 'op' + $lvl, + $opStr = '\' + ' + $opExpr + ' + \''; + out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; '; + $schemaValueExcl = 'schemaExcl' + $lvl; + out += ' var ' + ($exclusive) + '; var ' + ($exclType) + ' = typeof ' + ($schemaValueExcl) + '; if (' + ($exclType) + ' != \'boolean\' && ' + ($exclType) + ' != \'undefined\' && ' + ($exclType) + ' != \'number\') { '; + var $errorKeyword = $exclusiveKeyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_exclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($exclType) + ' == \'number\' ? ( (' + ($exclusive) + ' = ' + ($schemaValue) + ' === undefined || ' + ($schemaValueExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ') ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValueExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) : ( (' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true) ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaValue) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';'; + } else { + var $exclIsNumber = typeof $schemaExcl == 'number', + $opStr = $op; + if ($exclIsNumber && $isData) { + var $opExpr = '\'' + $opStr + '\''; + out += ' if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ( ' + ($schemaValue) + ' === undefined || ' + ($schemaExcl) + ' ' + ($op) + '= ' + ($schemaValue) + ' ? ' + ($data) + ' ' + ($notOp) + '= ' + ($schemaExcl) + ' : ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' ) || ' + ($data) + ' !== ' + ($data) + ') { '; + } else { + if ($exclIsNumber && $schema === undefined) { + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; + $schemaValue = $schemaExcl; + $notOp += '='; + } else { + if ($exclIsNumber) $schemaValue = Math[$isMax ? 'min' : 'max']($schemaExcl, $schema); + if ($schemaExcl === ($exclIsNumber ? $schemaValue : true)) { + $exclusive = true; + $errorKeyword = $exclusiveKeyword; + $errSchemaPath = it.errSchemaPath + '/' + $exclusiveKeyword; + $notOp += '='; + } else { + $exclusive = false; + $opStr += '='; + } + } + var $opExpr = '\'' + $opStr + '\''; + out += ' if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($data) + ' ' + ($notOp) + ' ' + ($schemaValue) + ' || ' + ($data) + ' !== ' + ($data) + ') { '; + } + } + $errorKeyword = $errorKeyword || $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ' + ($schemaValue) + ', exclusive: ' + ($exclusive) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be ' + ($opStr) + ' '; + if ($isData) { + out += '\' + ' + ($schemaValue); + } else { + out += '' + ($schemaValue) + '\''; + } + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + + +/***/ }), +/* 388 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +module.exports = function generate__limitItems(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxItems' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' ' + ($data) + '.length ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have '; + if ($keyword == 'maxItems') { + out += 'more'; + } else { + out += 'less'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' items\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + + +/***/ }), +/* 389 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +module.exports = function generate__limitLength(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxLength' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + if (it.opts.unicode === false) { + out += ' ' + ($data) + '.length '; + } else { + out += ' ucs2length(' + ($data) + ') '; + } + out += ' ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitLength') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT be '; + if ($keyword == 'maxLength') { + out += 'longer'; + } else { + out += 'shorter'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' characters\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + + +/***/ }), +/* 390 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +module.exports = function generate__limitProperties(it, $keyword, $ruleType) { + var out = ' '; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $isData = it.opts.$data && $schema && $schema.$data, + $schemaValue; + if ($isData) { + out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; + $schemaValue = 'schema' + $lvl; + } else { + $schemaValue = $schema; + } + var $op = $keyword == 'maxProperties' ? '>' : '<'; + out += 'if ( '; + if ($isData) { + out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'number\') || '; + } + out += ' Object.keys(' + ($data) + ').length ' + ($op) + ' ' + ($schemaValue) + ') { '; + var $errorKeyword = $keyword; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || '_limitProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schemaValue) + ' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should NOT have '; + if ($keyword == 'maxProperties') { + out += 'more'; + } else { + out += 'less'; + } + out += ' than '; + if ($isData) { + out += '\' + ' + ($schemaValue) + ' + \''; + } else { + out += '' + ($schema); + } + out += ' properties\' '; + } + if (it.opts.verbose) { + out += ' , schema: '; + if ($isData) { + out += 'validate.schema' + ($schemaPath); + } else { + out += '' + ($schema); + } + out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += '} '; + if ($breakOnError) { + out += ' else { '; + } + return out; +} + + +/***/ }), +/* 391 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + +module.exports = function generate_validate(it, $keyword, $ruleType) { + var out = ''; + var $async = it.schema.$async === true, + $refKeywords = it.util.schemaHasRulesExcept(it.schema, it.RULES.all, '$ref'), + $id = it.self._getId(it.schema); + if (it.isTop) { + if ($async) { + it.async = true; + var $es7 = it.opts.async == 'es7'; + it.yieldAwait = $es7 ? 'await' : 'yield'; + } + out += ' var validate = '; + if ($async) { + if ($es7) { + out += ' (async function '; + } else { + if (it.opts.async != '*') { + out += 'co.wrap'; + } + out += '(function* '; + } + } else { + out += ' (function '; + } + out += ' (data, dataPath, parentData, parentDataProperty, rootData) { \'use strict\'; '; + if ($id && (it.opts.sourceCode || it.opts.processCode)) { + out += ' ' + ('/\*# sourceURL=' + $id + ' */') + ' '; + } + } + if (typeof it.schema == 'boolean' || !($refKeywords || it.schema.$ref)) { + var $keyword = 'false schema'; + var $lvl = it.level; + var $dataLvl = it.dataLevel; + var $schema = it.schema[$keyword]; + var $schemaPath = it.schemaPath + it.util.getProperty($keyword); + var $errSchemaPath = it.errSchemaPath + '/' + $keyword; + var $breakOnError = !it.opts.allErrors; + var $errorKeyword; + var $data = 'data' + ($dataLvl || ''); + var $valid = 'valid' + $lvl; + if (it.schema === false) { + if (it.isTop) { + $breakOnError = true; + } else { + out += ' var ' + ($valid) + ' = false; '; + } + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'false schema') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + if (it.opts.messages !== false) { + out += ' , message: \'boolean schema is false\' '; + } + if (it.opts.verbose) { + out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } else { + if (it.isTop) { + if ($async) { + out += ' return data; '; + } else { + out += ' validate.errors = null; return true; '; + } + } else { + out += ' var ' + ($valid) + ' = true; '; + } + } + if (it.isTop) { + out += ' }); return validate; '; + } + return out; + } + if (it.isTop) { + var $top = it.isTop, + $lvl = it.level = 0, + $dataLvl = it.dataLevel = 0, + $data = 'data'; + it.rootId = it.resolve.fullPath(it.self._getId(it.root.schema)); + it.baseId = it.baseId || it.rootId; + delete it.isTop; + it.dataPathArr = [undefined]; + out += ' var vErrors = null; '; + out += ' var errors = 0; '; + out += ' if (rootData === undefined) rootData = data; '; + } else { + var $lvl = it.level, + $dataLvl = it.dataLevel, + $data = 'data' + ($dataLvl || ''); + if ($id) it.baseId = it.resolve.url(it.baseId, $id); + if ($async && !it.async) throw new Error('async schema in sync schema'); + out += ' var errs_' + ($lvl) + ' = errors;'; + } + var $valid = 'valid' + $lvl, + $breakOnError = !it.opts.allErrors, + $closingBraces1 = '', + $closingBraces2 = ''; + var $errorKeyword; + var $typeSchema = it.schema.type, + $typeIsArray = Array.isArray($typeSchema); + if ($typeIsArray && $typeSchema.length == 1) { + $typeSchema = $typeSchema[0]; + $typeIsArray = false; + } + if (it.schema.$ref && $refKeywords) { + if (it.opts.extendRefs == 'fail') { + throw new Error('$ref: validation keywords used in schema at path "' + it.errSchemaPath + '" (see option extendRefs)'); + } else if (it.opts.extendRefs !== true) { + $refKeywords = false; + it.logger.warn('$ref: keywords ignored in schema at path "' + it.errSchemaPath + '"'); + } + } + if ($typeSchema) { + if (it.opts.coerceTypes) { + var $coerceToTypes = it.util.coerceToTypes(it.opts.coerceTypes, $typeSchema); + } + var $rulesGroup = it.RULES.types[$typeSchema]; + if ($coerceToTypes || $typeIsArray || $rulesGroup === true || ($rulesGroup && !$shouldUseGroup($rulesGroup))) { + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type'; + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type', + $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; + out += ' if (' + (it.util[$method]($typeSchema, $data, true)) + ') { '; + if ($coerceToTypes) { + var $dataType = 'dataType' + $lvl, + $coerced = 'coerced' + $lvl; + out += ' var ' + ($dataType) + ' = typeof ' + ($data) + '; '; + if (it.opts.coerceTypes == 'array') { + out += ' if (' + ($dataType) + ' == \'object\' && Array.isArray(' + ($data) + ')) ' + ($dataType) + ' = \'array\'; '; + } + out += ' var ' + ($coerced) + ' = undefined; '; + var $bracesCoercion = ''; + var arr1 = $coerceToTypes; + if (arr1) { + var $type, $i = -1, + l1 = arr1.length - 1; + while ($i < l1) { + $type = arr1[$i += 1]; + if ($i) { + out += ' if (' + ($coerced) + ' === undefined) { '; + $bracesCoercion += '}'; + } + if (it.opts.coerceTypes == 'array' && $type != 'array') { + out += ' if (' + ($dataType) + ' == \'array\' && ' + ($data) + '.length == 1) { ' + ($coerced) + ' = ' + ($data) + ' = ' + ($data) + '[0]; ' + ($dataType) + ' = typeof ' + ($data) + '; } '; + } + if ($type == 'string') { + out += ' if (' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\') ' + ($coerced) + ' = \'\' + ' + ($data) + '; else if (' + ($data) + ' === null) ' + ($coerced) + ' = \'\'; '; + } else if ($type == 'number' || $type == 'integer') { + out += ' if (' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' === null || (' + ($dataType) + ' == \'string\' && ' + ($data) + ' && ' + ($data) + ' == +' + ($data) + ' '; + if ($type == 'integer') { + out += ' && !(' + ($data) + ' % 1)'; + } + out += ')) ' + ($coerced) + ' = +' + ($data) + '; '; + } else if ($type == 'boolean') { + out += ' if (' + ($data) + ' === \'false\' || ' + ($data) + ' === 0 || ' + ($data) + ' === null) ' + ($coerced) + ' = false; else if (' + ($data) + ' === \'true\' || ' + ($data) + ' === 1) ' + ($coerced) + ' = true; '; + } else if ($type == 'null') { + out += ' if (' + ($data) + ' === \'\' || ' + ($data) + ' === 0 || ' + ($data) + ' === false) ' + ($coerced) + ' = null; '; + } else if (it.opts.coerceTypes == 'array' && $type == 'array') { + out += ' if (' + ($dataType) + ' == \'string\' || ' + ($dataType) + ' == \'number\' || ' + ($dataType) + ' == \'boolean\' || ' + ($data) + ' == null) ' + ($coerced) + ' = [' + ($data) + ']; '; + } + } + } + out += ' ' + ($bracesCoercion) + ' if (' + ($coerced) + ' === undefined) { '; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } else { '; + var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', + $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; + out += ' ' + ($data) + ' = ' + ($coerced) + '; '; + if (!$dataLvl) { + out += 'if (' + ($parentData) + ' !== undefined)'; + } + out += ' ' + ($parentData) + '[' + ($parentDataProperty) + '] = ' + ($coerced) + '; } '; + } else { + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + } + out += ' } '; + } + } + if (it.schema.$ref && !$refKeywords) { + out += ' ' + (it.RULES.all.$ref.code(it, '$ref')) + ' '; + if ($breakOnError) { + out += ' } if (errors === '; + if ($top) { + out += '0'; + } else { + out += 'errs_' + ($lvl); + } + out += ') { '; + $closingBraces2 += '}'; + } + } else { + if (it.opts.v5 && it.schema.patternGroups) { + it.logger.warn('keyword "patternGroups" is deprecated and disabled. Use option patternGroups: true to enable.'); + } + var arr2 = it.RULES; + if (arr2) { + var $rulesGroup, i2 = -1, + l2 = arr2.length - 1; + while (i2 < l2) { + $rulesGroup = arr2[i2 += 1]; + if ($shouldUseGroup($rulesGroup)) { + if ($rulesGroup.type) { + out += ' if (' + (it.util.checkDataType($rulesGroup.type, $data)) + ') { '; + } + if (it.opts.useDefaults && !it.compositeRule) { + if ($rulesGroup.type == 'object' && it.schema.properties) { + var $schema = it.schema.properties, + $schemaKeys = Object.keys($schema); + var arr3 = $schemaKeys; + if (arr3) { + var $propertyKey, i3 = -1, + l3 = arr3.length - 1; + while (i3 < l3) { + $propertyKey = arr3[i3 += 1]; + var $sch = $schema[$propertyKey]; + if ($sch.default !== undefined) { + var $passData = $data + it.util.getProperty($propertyKey); + out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; + if (it.opts.useDefaults == 'shared') { + out += ' ' + (it.useDefault($sch.default)) + ' '; + } else { + out += ' ' + (JSON.stringify($sch.default)) + ' '; + } + out += '; '; + } + } + } + } else if ($rulesGroup.type == 'array' && Array.isArray(it.schema.items)) { + var arr4 = it.schema.items; + if (arr4) { + var $sch, $i = -1, + l4 = arr4.length - 1; + while ($i < l4) { + $sch = arr4[$i += 1]; + if ($sch.default !== undefined) { + var $passData = $data + '[' + $i + ']'; + out += ' if (' + ($passData) + ' === undefined) ' + ($passData) + ' = '; + if (it.opts.useDefaults == 'shared') { + out += ' ' + (it.useDefault($sch.default)) + ' '; + } else { + out += ' ' + (JSON.stringify($sch.default)) + ' '; + } + out += '; '; + } + } + } + } + } + var arr5 = $rulesGroup.rules; + if (arr5) { + var $rule, i5 = -1, + l5 = arr5.length - 1; + while (i5 < l5) { + $rule = arr5[i5 += 1]; + if ($shouldUseRule($rule)) { + var $code = $rule.code(it, $rule.keyword, $rulesGroup.type); + if ($code) { + out += ' ' + ($code) + ' '; + if ($breakOnError) { + $closingBraces1 += '}'; + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces1) + ' '; + $closingBraces1 = ''; + } + if ($rulesGroup.type) { + out += ' } '; + if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { + out += ' else { '; + var $schemaPath = it.schemaPath + '.type', + $errSchemaPath = it.errSchemaPath + '/type'; + var $$outStack = $$outStack || []; + $$outStack.push(out); + out = ''; /* istanbul ignore else */ + if (it.createErrors !== false) { + out += ' { keyword: \'' + ($errorKeyword || 'type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' } '; + if (it.opts.messages !== false) { + out += ' , message: \'should be '; + if ($typeIsArray) { + out += '' + ($typeSchema.join(",")); + } else { + out += '' + ($typeSchema); + } + out += '\' '; + } + if (it.opts.verbose) { + out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + } + out += ' } '; + } else { + out += ' {} '; + } + var __err = out; + out = $$outStack.pop(); + if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ + if (it.async) { + out += ' throw new ValidationError([' + (__err) + ']); '; + } else { + out += ' validate.errors = [' + (__err) + ']; return false; '; + } + } else { + out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + } + out += ' } '; + } + } + if ($breakOnError) { + out += ' if (errors === '; + if ($top) { + out += '0'; + } else { + out += 'errs_' + ($lvl); + } + out += ') { '; + $closingBraces2 += '}'; + } + } + } + } + } + if ($breakOnError) { + out += ' ' + ($closingBraces2) + ' '; + } + if ($top) { + if ($async) { + out += ' if (errors === 0) return data; '; + out += ' else throw new ValidationError(vErrors); '; + } else { + out += ' validate.errors = vErrors; '; + out += ' return errors === 0; '; + } + out += ' }); return validate;'; + } else { + out += ' var ' + ($valid) + ' = errors === errs_' + ($lvl) + ';'; + } + out = it.util.cleanUpCode(out); + if ($top) { + out = it.util.finalCleanUpCode(out, $async); + } + + function $shouldUseGroup($rulesGroup) { + var rules = $rulesGroup.rules; + for (var i = 0; i < rules.length; i++) + if ($shouldUseRule(rules[i])) return true; + } + + function $shouldUseRule($rule) { + return it.schema[$rule.keyword] !== undefined || ($rule.implements && $ruleImplementsSomeKeyword($rule)); + } + + function $ruleImplementsSomeKeyword($rule) { + var impl = $rule.implements; + for (var i = 0; i < impl.length; i++) + if (it.schema[impl[i]] !== undefined) return true; + } + return out; +} + + /***/ }), /* 392 */ /***/ (function(module, exports, __webpack_require__) { @@ -81825,7 +81834,7 @@ module.exports = UI; "use strict"; -var ansiEscapes = __webpack_require__(504); +var ansiEscapes = __webpack_require__(472); /** * Move cursor left by `x` @@ -81896,7 +81905,7 @@ module.exports = [["a140","",62],["a180","",32],["a240","",62],["a280", "use strict"; -module.exports = __webpack_require__(601).isCI +module.exports = __webpack_require__(569).isCI /***/ }), @@ -82793,7 +82802,7 @@ function _isUint8Array(obj) { /**/ /**/ -var util = __webpack_require__(114); +var util = __webpack_require__(113); util.inherits = __webpack_require__(61); /**/ @@ -83822,7 +83831,7 @@ module.exports = Transform; var Duplex = __webpack_require__(116); /**/ -var util = __webpack_require__(114); +var util = __webpack_require__(113); util.inherits = __webpack_require__(61); /**/ @@ -84038,7 +84047,7 @@ var Duplex; Writable.WritableState = WritableState; /**/ -var util = __webpack_require__(114); +var util = __webpack_require__(113); util.inherits = __webpack_require__(61); /**/ @@ -88360,7 +88369,7 @@ function simpleEnd(buf) { /***/ (function(module, exports, __webpack_require__) { var toBuffer = __webpack_require__(462) -var alloc = __webpack_require__(380) +var alloc = __webpack_require__(374) var ZEROS = '0000000000000000000' var SEVENS = '7777777777777777777' @@ -88964,7 +88973,7 @@ module.exports = function (arg) { var util = __webpack_require__(3); var onExit = __webpack_require__(451); -var currentlyUnhandled = __webpack_require__(629); +var currentlyUnhandled = __webpack_require__(597); var installed = false; @@ -89006,7 +89015,7 @@ module.exports = function (log) { "use strict"; -const fs = __webpack_require__(391); +const fs = __webpack_require__(385); const path = __webpack_require__(0); const retry = __webpack_require__(819); const syncFs = __webpack_require__(779); @@ -89392,2038 +89401,1417 @@ module.exports.checkSync = checkSync; "use strict"; +const x = module.exports; +const ESC = '\u001B['; +const OSC = '\u001B]'; +const BEL = '\u0007'; +const SEP = ';'; +const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'; -var KEYWORDS = [ - 'multipleOf', - 'maximum', - 'exclusiveMaximum', - 'minimum', - 'exclusiveMinimum', - 'maxLength', - 'minLength', - 'pattern', - 'additionalItems', - 'maxItems', - 'minItems', - 'uniqueItems', - 'maxProperties', - 'minProperties', - 'required', - 'additionalProperties', - 'enum', - 'format', - 'const' -]; - -module.exports = function (metaSchema, keywordsJsonPointers) { - for (var i=0; i { + if (typeof x !== 'number') { + throw new TypeError('The `x` argument is required'); + } - for (j=0; j { + if (typeof x !== 'number') { + throw new TypeError('The `x` argument is required'); + } -/***/ }), -/* 473 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -var compileSchema = __webpack_require__(478) - , resolve = __webpack_require__(204) - , Cache = __webpack_require__(474) - , SchemaObject = __webpack_require__(339) - , stableStringify = __webpack_require__(389) - , formats = __webpack_require__(477) - , rules = __webpack_require__(479) - , $dataMetaSchema = __webpack_require__(472) - , patternGroups = __webpack_require__(500) - , util = __webpack_require__(107) - , co = __webpack_require__(383); + let ret = ''; -module.exports = Ajv; + if (x < 0) { + ret += ESC + (-x) + 'D'; + } else if (x > 0) { + ret += ESC + x + 'C'; + } -Ajv.prototype.validate = validate; -Ajv.prototype.compile = compile; -Ajv.prototype.addSchema = addSchema; -Ajv.prototype.addMetaSchema = addMetaSchema; -Ajv.prototype.validateSchema = validateSchema; -Ajv.prototype.getSchema = getSchema; -Ajv.prototype.removeSchema = removeSchema; -Ajv.prototype.addFormat = addFormat; -Ajv.prototype.errorsText = errorsText; + if (y < 0) { + ret += ESC + (-y) + 'A'; + } else if (y > 0) { + ret += ESC + y + 'B'; + } -Ajv.prototype._addSchema = _addSchema; -Ajv.prototype._compile = _compile; + return ret; +}; -Ajv.prototype.compileAsync = __webpack_require__(476); -var customKeyword = __webpack_require__(499); -Ajv.prototype.addKeyword = customKeyword.add; -Ajv.prototype.getKeyword = customKeyword.get; -Ajv.prototype.removeKeyword = customKeyword.remove; +x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A'; +x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B'; +x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C'; +x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D'; -var errorClasses = __webpack_require__(203); -Ajv.ValidationError = errorClasses.Validation; -Ajv.MissingRefError = errorClasses.MissingRef; -Ajv.$dataMetaSchema = $dataMetaSchema; +x.cursorLeft = ESC + 'G'; +x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's'); +x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u'); +x.cursorGetPosition = ESC + '6n'; +x.cursorNextLine = ESC + 'E'; +x.cursorPrevLine = ESC + 'F'; +x.cursorHide = ESC + '?25l'; +x.cursorShow = ESC + '?25h'; -var META_SCHEMA_ID = 'http://json-schema.org/draft-06/schema'; +x.eraseLines = count => { + let clear = ''; -var META_IGNORE_OPTIONS = [ 'removeAdditional', 'useDefaults', 'coerceTypes' ]; -var META_SUPPORT_DATA = ['/properties']; + for (let i = 0; i < count; i++) { + clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : ''); + } -/** - * Creates validator instance. - * Usage: `Ajv(opts)` - * @param {Object} opts optional options - * @return {Object} ajv instance - */ -function Ajv(opts) { - if (!(this instanceof Ajv)) return new Ajv(opts); - opts = this._opts = util.copy(opts) || {}; - setLogger(this); - this._schemas = {}; - this._refs = {}; - this._fragments = {}; - this._formats = formats(opts.format); - var schemaUriFormat = this._schemaUriFormat = this._formats['uri-reference']; - this._schemaUriFormatFunc = function (str) { return schemaUriFormat.test(str); }; + if (count) { + clear += x.cursorLeft; + } - this._cache = opts.cache || new Cache; - this._loadingSchemas = {}; - this._compilations = []; - this.RULES = rules(); - this._getId = chooseGetId(opts); + return clear; +}; - opts.loopRequired = opts.loopRequired || Infinity; - if (opts.errorDataPath == 'property') opts._errorDataPathProperty = true; - if (opts.serialize === undefined) opts.serialize = stableStringify; - this._metaOpts = getMetaSchemaOptions(this); +x.eraseEndLine = ESC + 'K'; +x.eraseStartLine = ESC + '1K'; +x.eraseLine = ESC + '2K'; +x.eraseDown = ESC + 'J'; +x.eraseUp = ESC + '1J'; +x.eraseScreen = ESC + '2J'; +x.scrollUp = ESC + 'S'; +x.scrollDown = ESC + 'T'; - if (opts.formats) addInitialFormats(this); - addDraft6MetaSchema(this); - if (typeof opts.meta == 'object') this.addMetaSchema(opts.meta); - addInitialSchemas(this); - if (opts.patternGroups) patternGroups(this); -} +x.clearScreen = '\u001Bc'; +x.beep = BEL; +x.link = (text, url) => { + return [ + OSC, + '8', + SEP, + SEP, + url, + BEL, + text, + OSC, + '8', + SEP, + SEP, + BEL + ].join(''); +}; +x.image = (buf, opts) => { + opts = opts || {}; -/** - * Validate data using schema - * Schema will be compiled and cached (using serialized JSON as key. [fast-json-stable-stringify](https://github.com/epoberezkin/fast-json-stable-stringify) is used to serialize. - * @this Ajv - * @param {String|Object} schemaKeyRef key, ref or schema object - * @param {Any} data to be validated - * @return {Boolean} validation result. Errors from the last validation will be available in `ajv.errors` (and also in compiled schema: `schema.errors`). - */ -function validate(schemaKeyRef, data) { - var v; - if (typeof schemaKeyRef == 'string') { - v = this.getSchema(schemaKeyRef); - if (!v) throw new Error('no schema with key or ref "' + schemaKeyRef + '"'); - } else { - var schemaObj = this._addSchema(schemaKeyRef); - v = schemaObj.validate || this._compile(schemaObj); - } + let ret = OSC + '1337;File=inline=1'; - var valid = v(data); - if (v.$async === true) - return this._opts.async == '*' ? co(valid) : valid; - this.errors = v.errors; - return valid; -} + if (opts.width) { + ret += `;width=${opts.width}`; + } + if (opts.height) { + ret += `;height=${opts.height}`; + } -/** - * Create validating function for passed schema. - * @this Ajv - * @param {Object} schema schema object - * @param {Boolean} _meta true if schema is a meta-schema. Used internally to compile meta schemas of custom keywords. - * @return {Function} validating function - */ -function compile(schema, _meta) { - var schemaObj = this._addSchema(schema, undefined, _meta); - return schemaObj.validate || this._compile(schemaObj); -} + if (opts.preserveAspectRatio === false) { + ret += ';preserveAspectRatio=0'; + } + return ret + ':' + buf.toString('base64') + BEL; +}; -/** - * Adds schema to the instance. - * @this Ajv - * @param {Object|Array} schema schema or array of schemas. If array is passed, `key` and other parameters will be ignored. - * @param {String} key Optional schema key. Can be passed to `validate` method instead of schema object or id/ref. One schema per instance can have empty `id` and `key`. - * @param {Boolean} _skipValidation true to skip schema validation. Used internally, option validateSchema should be used instead. - * @param {Boolean} _meta true if schema is a meta-schema. Used internally, addMetaSchema should be used instead. - * @return {Ajv} this for method chaining - */ -function addSchema(schema, key, _skipValidation, _meta) { - if (Array.isArray(schema)){ - for (var i=0; i OSC + '50;CurrentDir=' + (cwd || process.cwd()) + BEL; -/** - * Add schema that will be used to validate other schemas - * options in META_IGNORE_OPTIONS are alway set to false - * @this Ajv - * @param {Object} schema schema object - * @param {String} key optional schema key - * @param {Boolean} skipValidation true to skip schema validation, can be used to override validateSchema option for meta-schema - * @return {Ajv} this for method chaining - */ -function addMetaSchema(schema, key, skipValidation) { - this.addSchema(schema, key, skipValidation, true); - return this; -} +/***/ }), +/* 473 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Validate schema - * @this Ajv - * @param {Object} schema schema to validate - * @param {Boolean} throwOrLogError pass true to throw (or log) an error if invalid - * @return {Boolean} true if schema is valid - */ -function validateSchema(schema, throwOrLogError) { - var $schema = schema.$schema; - if ($schema !== undefined && typeof $schema != 'string') - throw new Error('$schema must be a string'); - $schema = $schema || this._opts.defaultMeta || defaultMeta(this); - if (!$schema) { - this.logger.warn('meta-schema not available'); - this.errors = null; - return true; - } - var currentUriFormat = this._formats.uri; - this._formats.uri = typeof currentUriFormat == 'function' - ? this._schemaUriFormatFunc - : this._schemaUriFormat; - var valid; - try { valid = this.validate($schema, schema); } - finally { this._formats.uri = currentUriFormat; } - if (!valid && throwOrLogError) { - var message = 'schema is invalid: ' + this.errorsText(); - if (this._opts.validateSchema == 'log') this.logger.error(message); - else throw new Error(message); - } - return valid; -} +"use strict"; +module.exports = function () { + return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; +}; -function defaultMeta(self) { - var meta = self._opts.meta; - self._opts.defaultMeta = typeof meta == 'object' - ? self._getId(meta) || meta - : self.getSchema(META_SCHEMA_ID) - ? META_SCHEMA_ID - : undefined; - return self._opts.defaultMeta; -} +/***/ }), +/* 474 */ +/***/ (function(module, exports, __webpack_require__) { -/** - * Get compiled schema from the instance by `key` or `ref`. - * @this Ajv - * @param {String} keyRef `key` that was passed to `addSchema` or full schema reference (`schema.id` or resolved id). - * @return {Function} schema validating function (with property `schema`). - */ -function getSchema(keyRef) { - var schemaObj = _getSchemaObj(this, keyRef); - switch (typeof schemaObj) { - case 'object': return schemaObj.validate || this._compile(schemaObj); - case 'string': return this.getSchema(schemaObj); - case 'undefined': return _getSchemaFragment(this, keyRef); - } -} +"use strict"; +/* WEBPACK VAR INJECTION */(function(module) { +const colorConvert = __webpack_require__(576); +const wrapAnsi16 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${code + offset}m`; +}; -function _getSchemaFragment(self, ref) { - var res = resolve.schema.call(self, { schema: {} }, ref); - if (res) { - var schema = res.schema - , root = res.root - , baseId = res.baseId; - var v = compileSchema.call(self, schema, root, undefined, baseId); - self._fragments[ref] = new SchemaObject({ - ref: ref, - fragment: true, - schema: schema, - root: root, - baseId: baseId, - validate: v - }); - return v; - } -} +const wrapAnsi256 = (fn, offset) => function () { + const code = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};5;${code}m`; +}; +const wrapAnsi16m = (fn, offset) => function () { + const rgb = fn.apply(colorConvert, arguments); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; -function _getSchemaObj(self, keyRef) { - keyRef = resolve.normalizeId(keyRef); - return self._schemas[keyRef] || self._refs[keyRef] || self._fragments[keyRef]; -} +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + // Bright color + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], -/** - * Remove cached schema(s). - * If no parameter is passed all schemas but meta-schemas are removed. - * If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed. - * Even if schema is referenced by other schemas it still can be removed as other schemas have local references. - * @this Ajv - * @param {String|Object|RegExp} schemaKeyRef key, ref, pattern to match key/ref or schema object - * @return {Ajv} this for method chaining - */ -function removeSchema(schemaKeyRef) { - if (schemaKeyRef instanceof RegExp) { - _removeAllSchemas(this, this._schemas, schemaKeyRef); - _removeAllSchemas(this, this._refs, schemaKeyRef); - return this; - } - switch (typeof schemaKeyRef) { - case 'undefined': - _removeAllSchemas(this, this._schemas); - _removeAllSchemas(this, this._refs); - this._cache.clear(); - return this; - case 'string': - var schemaObj = _getSchemaObj(this, schemaKeyRef); - if (schemaObj) this._cache.del(schemaObj.cacheKey); - delete this._schemas[schemaKeyRef]; - delete this._refs[schemaKeyRef]; - return this; - case 'object': - var serialize = this._opts.serialize; - var cacheKey = serialize ? serialize(schemaKeyRef) : schemaKeyRef; - this._cache.del(cacheKey); - var id = this._getId(schemaKeyRef); - if (id) { - id = resolve.normalizeId(id); - delete this._schemas[id]; - delete this._refs[id]; - } - } - return this; -} + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + // Fix humans + styles.color.grey = styles.color.gray; -function _removeAllSchemas(self, schemas, regex) { - for (var keyRef in schemas) { - var schemaObj = schemas[keyRef]; - if (!schemaObj.meta && (!regex || regex.test(keyRef))) { - self._cache.del(schemaObj.cacheKey); - delete schemas[keyRef]; - } - } -} + for (const groupName of Object.keys(styles)) { + const group = styles[groupName]; + for (const styleName of Object.keys(group)) { + const style = group[styleName]; -/* @this Ajv */ -function _addSchema(schema, skipValidation, meta, shouldAddSchema) { - if (typeof schema != 'object' && typeof schema != 'boolean') - throw new Error('schema should be object or boolean'); - var serialize = this._opts.serialize; - var cacheKey = serialize ? serialize(schema) : schema; - var cached = this._cache.get(cacheKey); - if (cached) return cached; + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; - shouldAddSchema = shouldAddSchema || this._opts.addUsedSchema !== false; + group[styleName] = styles[styleName]; - var id = resolve.normalizeId(this._getId(schema)); - if (id && shouldAddSchema) checkUnique(this, id); + codes.set(style[0], style[1]); + } - var willValidate = this._opts.validateSchema !== false && !skipValidation; - var recursiveMeta; - if (willValidate && !(recursiveMeta = id && id == resolve.normalizeId(schema.$schema))) - this.validateSchema(schema, true); + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); - var localRefs = resolve.ids.call(this, schema); + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + } - var schemaObj = new SchemaObject({ - id: id, - schema: schema, - localRefs: localRefs, - cacheKey: cacheKey, - meta: meta - }); + const ansi2ansi = n => n; + const rgb2rgb = (r, g, b) => [r, g, b]; - if (id[0] != '#' && shouldAddSchema) this._refs[id] = schemaObj; - this._cache.put(cacheKey, schemaObj); + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; - if (willValidate && recursiveMeta) this.validateSchema(schema, true); + styles.color.ansi = { + ansi: wrapAnsi16(ansi2ansi, 0) + }; + styles.color.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 0) + }; + styles.color.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 0) + }; - return schemaObj; -} + styles.bgColor.ansi = { + ansi: wrapAnsi16(ansi2ansi, 10) + }; + styles.bgColor.ansi256 = { + ansi256: wrapAnsi256(ansi2ansi, 10) + }; + styles.bgColor.ansi16m = { + rgb: wrapAnsi16m(rgb2rgb, 10) + }; + for (let key of Object.keys(colorConvert)) { + if (typeof colorConvert[key] !== 'object') { + continue; + } -/* @this Ajv */ -function _compile(schemaObj, root) { - if (schemaObj.compiling) { - schemaObj.validate = callValidate; - callValidate.schema = schemaObj.schema; - callValidate.errors = null; - callValidate.root = root ? root : callValidate; - if (schemaObj.schema.$async === true) - callValidate.$async = true; - return callValidate; - } - schemaObj.compiling = true; + const suite = colorConvert[key]; - var currentOpts; - if (schemaObj.meta) { - currentOpts = this._opts; - this._opts = this._metaOpts; - } + if (key === 'ansi16') { + key = 'ansi'; + } - var v; - try { v = compileSchema.call(this, schemaObj.schema, root, schemaObj.localRefs); } - finally { - schemaObj.compiling = false; - if (schemaObj.meta) this._opts = currentOpts; - } + if ('ansi16' in suite) { + styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); + styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); + } - schemaObj.validate = v; - schemaObj.refs = v.refs; - schemaObj.refVal = v.refVal; - schemaObj.root = v.root; - return v; + if ('ansi256' in suite) { + styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); + styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); + } + if ('rgb' in suite) { + styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); + styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); + } + } - function callValidate() { - var _validate = schemaObj.validate; - var result = _validate.apply(null, arguments); - callValidate.errors = _validate.errors; - return result; - } + return styles; } +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); -function chooseGetId(opts) { - switch (opts.schemaId) { - case '$id': return _get$Id; - case 'id': return _getId; - default: return _get$IdOrId; - } -} +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(163)(module))) -/* @this Ajv */ -function _getId(schema) { - if (schema.$id) this.logger.warn('schema $id ignored', schema.$id); - return schema.id; -} +/***/ }), +/* 475 */ +/***/ (function(module, exports) { -/* @this Ajv */ -function _get$Id(schema) { - if (schema.id) this.logger.warn('schema id ignored', schema.id); - return schema.$id; +function webpackEmptyContext(req) { + throw new Error("Cannot find module '" + req + "'."); } +webpackEmptyContext.keys = function() { return []; }; +webpackEmptyContext.resolve = webpackEmptyContext; +module.exports = webpackEmptyContext; +webpackEmptyContext.id = 475; +/***/ }), +/* 476 */ +/***/ (function(module, exports, __webpack_require__) { -function _get$IdOrId(schema) { - if (schema.$id && schema.id && schema.$id != schema.id) - throw new Error('schema $id is different from id'); - return schema.$id || schema.id; -} +"use strict"; + // global key for user preferred registration +var REGISTRATION_KEY = '@@any-promise/REGISTRATION', + // Prior registration (preferred or detected) + registered = null /** - * Convert array of error message objects to string - * @this Ajv - * @param {Array} errors optional array of validation errors, if not passed errors from the instance are used. - * @param {Object} options optional options with properties `separator` and `dataVar`. - * @return {String} human readable string with all errors descriptions + * Registers the given implementation. An implementation must + * be registered prior to any call to `require("any-promise")`, + * typically on application load. + * + * If called with no arguments, will return registration in + * following priority: + * + * For Node.js: + * + * 1. Previous registration + * 2. global.Promise if node.js version >= 0.12 + * 3. Auto detected promise based on first sucessful require of + * known promise libraries. Note this is a last resort, as the + * loaded library is non-deterministic. node.js >= 0.12 will + * always use global.Promise over this priority list. + * 4. Throws error. + * + * For Browser: + * + * 1. Previous registration + * 2. window.Promise + * 3. Throws error. + * + * Options: + * + * Promise: Desired Promise constructor + * global: Boolean - Should the registration be cached in a global variable to + * allow cross dependency/bundle registration? (default true) */ -function errorsText(errors, options) { - errors = errors || this.errors; - if (!errors) return 'No errors'; - options = options || {}; - var separator = options.separator === undefined ? ', ' : options.separator; - var dataVar = options.dataVar === undefined ? 'data' : options.dataVar; +module.exports = function(root, loadImplementation){ + return function register(implementation, opts){ + implementation = implementation || null + opts = opts || {} + // global registration unless explicitly {global: false} in options (default true) + var registerGlobal = opts.global !== false; - var text = ''; - for (var i=0; i + * + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. + */ -var Cache = module.exports = function Cache() { - this._cache = {}; +module.exports = function (arr) { + return flat(arr, []); }; +function flat(arr, res) { + var i = 0, cur; + var len = arr.length; + for (; i < len; i++) { + cur = arr[i]; + Array.isArray(cur) ? flat(cur, res) : res.push(cur); + } + return res; +} + -Cache.prototype.put = function Cache_put(key, value) { - this._cache[key] = value; -}; +/***/ }), +/* 479 */ +/***/ (function(module, exports, __webpack_require__) { +"use strict"; -Cache.prototype.get = function Cache_get(key) { - return this._cache[key]; -}; +module.exports = function (arr, predicate, ctx) { + if (typeof Array.prototype.findIndex === 'function') { + return arr.findIndex(predicate, ctx); + } + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } -Cache.prototype.del = function Cache_del(key) { - delete this._cache[key]; -}; + var list = Object(arr); + var len = list.length; + if (len === 0) { + return -1; + } -Cache.prototype.clear = function Cache_clear() { - this._cache = {}; + for (var i = 0; i < len; i++) { + if (predicate.call(ctx, list[i], i, list)) { + return i; + } + } + + return -1; }; /***/ }), -/* 475 */ +/* 480 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -//all requires must be explicit because browserify won't work with dynamic requires -module.exports = { - '$ref': __webpack_require__(496), - allOf: __webpack_require__(481), - anyOf: __webpack_require__(482), - const: __webpack_require__(483), - contains: __webpack_require__(484), - dependencies: __webpack_require__(486), - 'enum': __webpack_require__(487), - format: __webpack_require__(488), - items: __webpack_require__(489), - maximum: __webpack_require__(340), - minimum: __webpack_require__(340), - maxItems: __webpack_require__(341), - minItems: __webpack_require__(341), - maxLength: __webpack_require__(342), - minLength: __webpack_require__(342), - maxProperties: __webpack_require__(343), - minProperties: __webpack_require__(343), - multipleOf: __webpack_require__(490), - not: __webpack_require__(491), - oneOf: __webpack_require__(492), - pattern: __webpack_require__(493), - properties: __webpack_require__(494), - propertyNames: __webpack_require__(495), - required: __webpack_require__(497), - uniqueItems: __webpack_require__(498), - validate: __webpack_require__(344) +var rawAsap = __webpack_require__(481); +var freeTasks = []; + +/** + * Calls a task as soon as possible after returning, in its own event, with + * priority over IO events. An exception thrown in a task can be handled by + * `process.on("uncaughtException") or `domain.on("error")`, but will otherwise + * crash the process. If the error is handled, all subsequent tasks will + * resume. + * + * @param {{call}} task A callable object, typically a function that takes no + * arguments. + */ +module.exports = asap; +function asap(task) { + var rawTask; + if (freeTasks.length) { + rawTask = freeTasks.pop(); + } else { + rawTask = new RawTask(); + } + rawTask.task = task; + rawTask.domain = process.domain; + rawAsap(rawTask); +} + +function RawTask() { + this.task = null; + this.domain = null; +} + +RawTask.prototype.call = function () { + if (this.domain) { + this.domain.enter(); + } + var threw = true; + try { + this.task.call(); + threw = false; + // If the task throws an exception (presumably) Node.js restores the + // domain stack for the next event. + if (this.domain) { + this.domain.exit(); + } + } finally { + // We use try/finally and a threw flag to avoid messing up stack traces + // when we catch and release errors. + if (threw) { + // In Node.js, uncaught exceptions are considered fatal errors. + // Re-throw them to interrupt flushing! + // Ensure that flushing continues if an uncaught exception is + // suppressed listening process.on("uncaughtException") or + // domain.on("error"). + rawAsap.requestFlush(); + } + // If the task threw an error, we do not want to exit the domain here. + // Exiting the domain would prevent the domain from catching the error. + this.task = null; + this.domain = null; + freeTasks.push(this); + } }; + /***/ }), -/* 476 */ +/* 481 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var MissingRefError = __webpack_require__(203).MissingRef; +var domain; // The domain module is executed on demand +var hasSetImmediate = typeof setImmediate === "function"; -module.exports = compileAsync; +// Use the fastest means possible to execute a task in its own turn, with +// priority over other events including network IO events in Node.js. +// +// An exception thrown by a task will permanently interrupt the processing of +// subsequent tasks. The higher level `asap` function ensures that if an +// exception is thrown by a task, that the task queue will continue flushing as +// soon as possible, but if you use `rawAsap` directly, you are responsible to +// either ensure that no exceptions are thrown from your task, or to manually +// call `rawAsap.requestFlush` if an exception is thrown. +module.exports = rawAsap; +function rawAsap(task) { + if (!queue.length) { + requestFlush(); + flushing = true; + } + // Avoids a function call + queue[queue.length] = task; +} +var queue = []; +// Once a flush has been requested, no further calls to `requestFlush` are +// necessary until the next `flush` completes. +var flushing = false; +// The position of the next task to execute in the task queue. This is +// preserved between calls to `flush` so that it can be resumed if +// a task throws an exception. +var index = 0; +// If a task schedules additional tasks recursively, the task queue can grow +// unbounded. To prevent memory excaustion, the task queue will periodically +// truncate already-completed tasks. +var capacity = 1024; -/** - * Creates validating function for passed schema with asynchronous loading of missing schemas. - * `loadSchema` option should be a function that accepts schema uri and returns promise that resolves with the schema. - * @this Ajv - * @param {Object} schema schema object - * @param {Boolean} meta optional true to compile meta-schema; this parameter can be skipped - * @param {Function} callback an optional node-style callback, it is called with 2 parameters: error (or null) and validating function. - * @return {Promise} promise that resolves with a validating function. - */ -function compileAsync(schema, meta, callback) { - /* eslint no-shadow: 0 */ - /* global Promise */ - /* jshint validthis: true */ - var self = this; - if (typeof this._opts.loadSchema != 'function') - throw new Error('options.loadSchema should be a function'); +// The flush function processes all tasks that have been scheduled with +// `rawAsap` unless and until one of those tasks throws an exception. +// If a task throws an exception, `flush` ensures that its state will remain +// consistent and will resume where it left off when called again. +// However, `flush` does not make any arrangements to be called again if an +// exception is thrown. +function flush() { + while (index < queue.length) { + var currentIndex = index; + // Advance the index before calling the task. This ensures that we will + // begin flushing on the next task the task throws an error. + index = index + 1; + queue[currentIndex].call(); + // Prevent leaking memory for long chains of recursive calls to `asap`. + // If we call `asap` within tasks scheduled by `asap`, the queue will + // grow, but to avoid an O(n) walk for every task we execute, we don't + // shift tasks off the queue after they have been executed. + // Instead, we periodically shift 1024 tasks off the queue. + if (index > capacity) { + // Manually shift all values starting at the index back to the + // beginning of the queue. + for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) { + queue[scan] = queue[scan + index]; + } + queue.length -= index; + index = 0; + } + } + queue.length = 0; + index = 0; + flushing = false; +} - if (typeof meta == 'function') { - callback = meta; - meta = undefined; - } +rawAsap.requestFlush = requestFlush; +function requestFlush() { + // Ensure flushing is not bound to any domain. + // It is not sufficient to exit the domain, because domains exist on a stack. + // To execute code outside of any domain, the following dance is necessary. + var parentDomain = process.domain; + if (parentDomain) { + if (!domain) { + // Lazy execute the domain module. + // Only employed if the user elects to use domains. + domain = __webpack_require__(965); + } + domain.active = process.domain = null; + } - var p = loadMetaSchemaOf(schema).then(function () { - var schemaObj = self._addSchema(schema, undefined, meta); - return schemaObj.validate || _compileAsync(schemaObj); - }); + // `setImmediate` is slower that `process.nextTick`, but `process.nextTick` + // cannot handle recursion. + // `requestFlush` will only be called recursively from `asap.js`, to resume + // flushing after an error is thrown into a domain. + // Conveniently, `setImmediate` was introduced in the same version + // `process.nextTick` started throwing recursion errors. + if (flushing && hasSetImmediate) { + setImmediate(flush); + } else { + process.nextTick(flush); + } - if (callback) { - p.then( - function(v) { callback(null, v); }, - callback - ); - } + if (parentDomain) { + domain.active = process.domain = parentDomain; + } +} - return p; +/***/ }), +/* 482 */ +/***/ (function(module, exports, __webpack_require__) { - function loadMetaSchemaOf(sch) { - var $schema = sch.$schema; - return $schema && !self.getSchema($schema) - ? compileAsync.call(self, { $ref: $schema }, true) - : Promise.resolve(); - } +// Copyright 2011 Mark Cavage All rights reserved. +var errors = __webpack_require__(203); +var types = __webpack_require__(204); - function _compileAsync(schemaObj) { - try { return self._compile(schemaObj); } - catch(e) { - if (e instanceof MissingRefError) return loadMissingSchema(e); - throw e; - } +var Reader = __webpack_require__(483); +var Writer = __webpack_require__(484); - function loadMissingSchema(e) { - var ref = e.missingSchema; - if (added(ref)) throw new Error('Schema ' + ref + ' is loaded but ' + e.missingRef + ' cannot be resolved'); +// --- Exports - var schemaPromise = self._loadingSchemas[ref]; - if (!schemaPromise) { - schemaPromise = self._loadingSchemas[ref] = self._opts.loadSchema(ref); - schemaPromise.then(removePromise, removePromise); - } +module.exports = { - return schemaPromise.then(function (sch) { - if (!added(ref)) { - return loadMetaSchemaOf(sch).then(function () { - if (!added(ref)) self.addSchema(sch, ref, undefined, meta); - }); - } - }).then(function() { - return _compileAsync(schemaObj); - }); + Reader: Reader, - function removePromise() { - delete self._loadingSchemas[ref]; - } + Writer: Writer - function added(ref) { - return self._refs[ref] || self._schemas[ref]; - } - } - } +}; + +for (var t in types) { + if (types.hasOwnProperty(t)) + module.exports[t] = types[t]; +} +for (var e in errors) { + if (errors.hasOwnProperty(e)) + module.exports[e] = errors[e]; } /***/ }), -/* 477 */ +/* 483 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - - -var util = __webpack_require__(107); +// Copyright 2011 Mark Cavage All rights reserved. -var DATE = /^\d\d\d\d-(\d\d)-(\d\d)$/; -var DAYS = [0,31,29,31,30,31,30,31,31,30,31,30,31]; -var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i; -var HOSTNAME = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i; -var URI = /^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; -var URIREF = /^(?:[a-z][a-z0-9+\-.]*:)?(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'"()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'"()*+,;=:@]|%[0-9a-f]{2})*)*)?(?:\?(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'"()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i; -// uri-template: https://tools.ietf.org/html/rfc6570 -var URITEMPLATE = /^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i; -// For the source: https://gist.github.com/dperini/729294 -// For test cases: https://mathiasbynens.be/demo/url-regex -// @todo Delete current URL in favour of the commented out URL rule when this issue is fixed https://github.com/eslint/eslint/issues/7983. -// var URL = /^(?:(?:https?|ftp):\/\/)(?:\S+(?::\S*)?@)?(?:(?!10(?:\.\d{1,3}){3})(?!127(?:\.\d{1,3}){3})(?!169\.254(?:\.\d{1,3}){2})(?!192\.168(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)(?:\.(?:[a-z\u{00a1}-\u{ffff}0-9]+-?)*[a-z\u{00a1}-\u{ffff}0-9]+)*(?:\.(?:[a-z\u{00a1}-\u{ffff}]{2,})))(?::\d{2,5})?(?:\/[^\s]*)?$/iu; -var URL = /^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?@)?(?:(?!10(?:\.[0-9]{1,3}){3})(?!127(?:\.[0-9]{1,3}){3})(?!169\.254(?:\.[0-9]{1,3}){2})(?!192\.168(?:\.[0-9]{1,3}){2})(?!172\.(?:1[6-9]|2[0-9]|3[01])(?:\.[0-9]{1,3}){2})(?:[1-9][0-9]?|1[0-9][0-9]|2[01][0-9]|22[0-3])(?:\.(?:1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}(?:\.(?:[1-9][0-9]?|1[0-9][0-9]|2[0-4][0-9]|25[0-4]))|(?:(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)(?:\.(?:(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+-?)*(?:[0-9KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+)*(?:\.(?:(?:[KSa-z\xA1-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]){2,})))(?::[0-9]{2,5})?(?:\/(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)?$/i; -var UUID = /^(?:urn:uuid:)?[0-9a-f]{8}-(?:[0-9a-f]{4}-){3}[0-9a-f]{12}$/i; -var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$|^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i; -var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/; +var assert = __webpack_require__(28); +var Buffer = __webpack_require__(15).Buffer; +var ASN1 = __webpack_require__(204); +var errors = __webpack_require__(203); -module.exports = formats; -function formats(mode) { - mode = mode == 'full' ? 'full' : 'fast'; - return util.copy(formats[mode]); -} +// --- Globals +var newInvalidAsn1Error = errors.newInvalidAsn1Error; -formats.fast = { - // date: http://tools.ietf.org/html/rfc3339#section-5.6 - date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/, - // date-time: http://tools.ietf.org/html/rfc3339#section-5.6 - time: /^[0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)?$/i, - 'date-time': /^\d\d\d\d-[0-1]\d-[0-3]\d[t\s][0-2]\d:[0-5]\d:[0-5]\d(?:\.\d+)?(?:z|[+-]\d\d:\d\d)$/i, - // uri: https://github.com/mafintosh/is-my-json-valid/blob/master/formats.js - uri: /^(?:[a-z][a-z0-9+-.]*)(?::|\/)\/?[^\s]*$/i, - 'uri-reference': /^(?:(?:[a-z][a-z0-9+-.]*:)?\/\/)?[^\s]*$/i, - 'uri-template': URITEMPLATE, - url: URL, - // email (sources from jsen validator): - // http://stackoverflow.com/questions/201323/using-a-regular-expression-to-validate-an-email-address#answer-8829363 - // http://www.w3.org/TR/html5/forms.html#valid-e-mail-address (search for 'willful violation') - email: /^[a-z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*$/i, - hostname: HOSTNAME, - // optimized https://www.safaribooksonline.com/library/view/regular-expressions-cookbook/9780596802837/ch07s16.html - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - // optimized http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - // uuid: http://tools.ietf.org/html/rfc4122 - uuid: UUID, - // JSON-pointer: https://tools.ietf.org/html/rfc6901 - // uri fragment: https://tools.ietf.org/html/rfc3986#appendix-A - 'json-pointer': JSON_POINTER, - // relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00 - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; -formats.full = { - date: date, - time: time, - 'date-time': date_time, - uri: uri, - 'uri-reference': URIREF, - 'uri-template': URITEMPLATE, - url: URL, - email: /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&''*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i, - hostname: hostname, - ipv4: /^(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)$/, - ipv6: /^\s*(?:(?:(?:[0-9a-f]{1,4}:){7}(?:[0-9a-f]{1,4}|:))|(?:(?:[0-9a-f]{1,4}:){6}(?::[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){5}(?:(?:(?::[0-9a-f]{1,4}){1,2})|:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(?:(?:[0-9a-f]{1,4}:){4}(?:(?:(?::[0-9a-f]{1,4}){1,3})|(?:(?::[0-9a-f]{1,4})?:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){3}(?:(?:(?::[0-9a-f]{1,4}){1,4})|(?:(?::[0-9a-f]{1,4}){0,2}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){2}(?:(?:(?::[0-9a-f]{1,4}){1,5})|(?:(?::[0-9a-f]{1,4}){0,3}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?:(?:[0-9a-f]{1,4}:){1}(?:(?:(?::[0-9a-f]{1,4}){1,6})|(?:(?::[0-9a-f]{1,4}){0,4}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(?::(?:(?:(?::[0-9a-f]{1,4}){1,7})|(?:(?::[0-9a-f]{1,4}){0,5}:(?:(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(?:\.(?:25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(?:%.+)?\s*$/i, - regex: regex, - uuid: UUID, - 'json-pointer': JSON_POINTER, - 'relative-json-pointer': RELATIVE_JSON_POINTER -}; +// --- API +function Reader(data) { + if (!data || !Buffer.isBuffer(data)) + throw new TypeError('data must be a node Buffer'); -function date(str) { - // full-date from http://tools.ietf.org/html/rfc3339#section-5.6 - var matches = str.match(DATE); - if (!matches) return false; + this._buf = data; + this._size = data.length; - var month = +matches[1]; - var day = +matches[2]; - return month >= 1 && month <= 12 && day >= 1 && day <= DAYS[month]; + // These hold the "current" state + this._len = 0; + this._offset = 0; } +Object.defineProperty(Reader.prototype, 'length', { + enumerable: true, + get: function () { return (this._len); } +}); -function time(str, full) { - var matches = str.match(TIME); - if (!matches) return false; +Object.defineProperty(Reader.prototype, 'offset', { + enumerable: true, + get: function () { return (this._offset); } +}); - var hour = matches[1]; - var minute = matches[2]; - var second = matches[3]; - var timeZone = matches[5]; - return hour <= 23 && minute <= 59 && second <= 59 && (!full || timeZone); -} +Object.defineProperty(Reader.prototype, 'remain', { + get: function () { return (this._size - this._offset); } +}); + +Object.defineProperty(Reader.prototype, 'buffer', { + get: function () { return (this._buf.slice(this._offset)); } +}); -var DATE_TIME_SEPARATOR = /t|\s/i; -function date_time(str) { - // http://tools.ietf.org/html/rfc3339#section-5.6 - var dateTime = str.split(DATE_TIME_SEPARATOR); - return dateTime.length == 2 && date(dateTime[0]) && time(dateTime[1], true); -} +/** + * Reads a single byte and advances offset; you can pass in `true` to make this + * a "peek" operation (i.e., get the byte, but don't advance the offset). + * + * @param {Boolean} peek true means don't move offset. + * @return {Number} the next byte, null if not enough data. + */ +Reader.prototype.readByte = function (peek) { + if (this._size - this._offset < 1) + return null; + var b = this._buf[this._offset] & 0xff; -function hostname(str) { - // https://tools.ietf.org/html/rfc1034#section-3.5 - // https://tools.ietf.org/html/rfc1123#section-2 - return str.length <= 255 && HOSTNAME.test(str); -} + if (!peek) + this._offset += 1; + return b; +}; -var NOT_URI_FRAGMENT = /\/|:/; -function uri(str) { - // http://jmrware.com/articles/2009/uri_regexp/URI_regex.html + optional protocol + required "." - return NOT_URI_FRAGMENT.test(str) && URI.test(str); -} +Reader.prototype.peek = function () { + return this.readByte(true); +}; -var Z_ANCHOR = /[^\\]\\Z/; -function regex(str) { - if (Z_ANCHOR.test(str)) return false; - try { - new RegExp(str); - return true; - } catch(e) { - return false; - } -} +/** + * Reads a (potentially) variable length off the BER buffer. This call is + * not really meant to be called directly, as callers have to manipulate + * the internal buffer afterwards. + * + * As a result of this call, you can call `Reader.length`, until the + * next thing called that does a readLength. + * + * @return {Number} the amount of offset to advance the buffer. + * @throws {InvalidAsn1Error} on bad ASN.1 + */ +Reader.prototype.readLength = function (offset) { + if (offset === undefined) + offset = this._offset; -/***/ }), -/* 478 */ -/***/ (function(module, exports, __webpack_require__) { + if (offset >= this._size) + return null; -"use strict"; + var lenB = this._buf[offset++] & 0xff; + if (lenB === null) + return null; + if ((lenB & 0x80) === 0x80) { + lenB &= 0x7f; -var resolve = __webpack_require__(204) - , util = __webpack_require__(107) - , errorClasses = __webpack_require__(203) - , stableStringify = __webpack_require__(389); + if (lenB === 0) + throw newInvalidAsn1Error('Indefinite length not supported'); -var validateGenerator = __webpack_require__(344); + if (lenB > 4) + throw newInvalidAsn1Error('encoding too long'); -/** - * Functions below are used inside compiled validations function - */ + if (this._size - offset < lenB) + return null; -var co = __webpack_require__(383); -var ucs2length = util.ucs2length; -var equal = __webpack_require__(205); + this._len = 0; + for (var i = 0; i < lenB; i++) + this._len = (this._len << 8) + (this._buf[offset++] & 0xff); -// this error is thrown by async schemas to return validation errors via exception -var ValidationError = errorClasses.Validation; + } else { + // Wasn't a variable length + this._len = lenB; + } -module.exports = compile; + return offset; +}; /** - * Compiles schema to validation function - * @this Ajv - * @param {Object} schema schema object - * @param {Object} root object with information about the root schema for this schema - * @param {Object} localRefs the hash of local references inside the schema (created by resolve.id), used for inline resolution - * @param {String} baseId base ID for IDs in the schema - * @return {Function} validation function + * Parses the next sequence in this BER buffer. + * + * To get the length of the sequence, call `Reader.length`. + * + * @return {Number} the sequence's tag. */ -function compile(schema, root, localRefs, baseId) { - /* jshint validthis: true, evil: true */ - /* eslint no-shadow: 0 */ - var self = this - , opts = this._opts - , refVal = [ undefined ] - , refs = {} - , patterns = [] - , patternsHash = {} - , defaults = [] - , defaultsHash = {} - , customRules = []; +Reader.prototype.readSequence = function (tag) { + var seq = this.peek(); + if (seq === null) + return null; + if (tag !== undefined && tag !== seq) + throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + + ': got 0x' + seq.toString(16)); - root = root || { schema: schema, refVal: refVal, refs: refs }; + var o = this.readLength(this._offset + 1); // stored in `length` + if (o === null) + return null; - var c = checkCompiling.call(this, schema, root, baseId); - var compilation = this._compilations[c.index]; - if (c.compiling) return (compilation.callValidate = callValidate); + this._offset = o; + return seq; +}; - var formats = this._formats; - var RULES = this.RULES; - try { - var v = localCompile(schema, root, localRefs, baseId); - compilation.validate = v; - var cv = compilation.callValidate; - if (cv) { - cv.schema = v.schema; - cv.errors = null; - cv.refs = v.refs; - cv.refVal = v.refVal; - cv.root = v.root; - cv.$async = v.$async; - if (opts.sourceCode) cv.source = v.source; - } - return v; - } finally { - endCompiling.call(this, schema, root, baseId); - } +Reader.prototype.readInt = function () { + return this._readTag(ASN1.Integer); +}; - function callValidate() { - var validate = compilation.validate; - var result = validate.apply(null, arguments); - callValidate.errors = validate.errors; - return result; - } - function localCompile(_schema, _root, localRefs, baseId) { - var isRoot = !_root || (_root && _root.schema == _schema); - if (_root.schema != root.schema) - return compile.call(self, _schema, _root, localRefs, baseId); +Reader.prototype.readBoolean = function () { + return (this._readTag(ASN1.Boolean) === 0 ? false : true); +}; - var $async = _schema.$async === true; - var sourceCode = validateGenerator({ - isTop: true, - schema: _schema, - isRoot: isRoot, - baseId: baseId, - root: _root, - schemaPath: '', - errSchemaPath: '#', - errorPath: '""', - MissingRefError: errorClasses.MissingRef, - RULES: RULES, - validate: validateGenerator, - util: util, - resolve: resolve, - resolveRef: resolveRef, - usePattern: usePattern, - useDefault: useDefault, - useCustomRule: useCustomRule, - opts: opts, - formats: formats, - logger: self.logger, - self: self - }); +Reader.prototype.readEnumeration = function () { + return this._readTag(ASN1.Enumeration); +}; - sourceCode = vars(refVal, refValCode) + vars(patterns, patternCode) - + vars(defaults, defaultCode) + vars(customRules, customRuleCode) - + sourceCode; - if (opts.processCode) sourceCode = opts.processCode(sourceCode); - // console.log('\n\n\n *** \n', JSON.stringify(sourceCode)); - var validate; - try { - var makeValidate = new Function( - 'self', - 'RULES', - 'formats', - 'root', - 'refVal', - 'defaults', - 'customRules', - 'co', - 'equal', - 'ucs2length', - 'ValidationError', - sourceCode - ); +Reader.prototype.readString = function (tag, retbuf) { + if (!tag) + tag = ASN1.OctetString; - validate = makeValidate( - self, - RULES, - formats, - root, - refVal, - defaults, - customRules, - co, - equal, - ucs2length, - ValidationError - ); + var b = this.peek(); + if (b === null) + return null; - refVal[0] = validate; - } catch(e) { - self.logger.error('Error compiling schema, function code:', sourceCode); - throw e; - } + if (b !== tag) + throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + + ': got 0x' + b.toString(16)); - validate.schema = _schema; - validate.errors = null; - validate.refs = refs; - validate.refVal = refVal; - validate.root = isRoot ? validate : _root; - if ($async) validate.$async = true; - if (opts.sourceCode === true) { - validate.source = { - code: sourceCode, - patterns: patterns, - defaults: defaults - }; - } + var o = this.readLength(this._offset + 1); // stored in `length` - return validate; - } + if (o === null) + return null; - function resolveRef(baseId, ref, isRoot) { - ref = resolve.url(baseId, ref); - var refIndex = refs[ref]; - var _refVal, refCode; - if (refIndex !== undefined) { - _refVal = refVal[refIndex]; - refCode = 'refVal[' + refIndex + ']'; - return resolvedRef(_refVal, refCode); - } - if (!isRoot && root.refs) { - var rootRefId = root.refs[ref]; - if (rootRefId !== undefined) { - _refVal = root.refVal[rootRefId]; - refCode = addLocalRef(ref, _refVal); - return resolvedRef(_refVal, refCode); - } - } + if (this.length > this._size - o) + return null; - refCode = addLocalRef(ref); - var v = resolve.call(self, localCompile, root, ref); - if (v === undefined) { - var localSchema = localRefs && localRefs[ref]; - if (localSchema) { - v = resolve.inlineRef(localSchema, opts.inlineRefs) - ? localSchema - : compile.call(self, localSchema, root, localRefs, baseId); - } - } + this._offset = o; - if (v === undefined) { - removeLocalRef(ref); - } else { - replaceLocalRef(ref, v); - return resolvedRef(v, refCode); - } - } + if (this.length === 0) + return retbuf ? Buffer.alloc(0) : ''; - function addLocalRef(ref, v) { - var refId = refVal.length; - refVal[refId] = v; - refs[ref] = refId; - return 'refVal' + refId; - } + var str = this._buf.slice(this._offset, this._offset + this.length); + this._offset += this.length; - function removeLocalRef(ref) { - delete refs[ref]; - } + return retbuf ? str : str.toString('utf8'); +}; - function replaceLocalRef(ref, v) { - var refId = refs[ref]; - refVal[refId] = v; - } +Reader.prototype.readOID = function (tag) { + if (!tag) + tag = ASN1.OID; - function resolvedRef(refVal, code) { - return typeof refVal == 'object' || typeof refVal == 'boolean' - ? { code: code, schema: refVal, inline: true } - : { code: code, $async: refVal && refVal.$async }; - } + var b = this.readString(tag, true); + if (b === null) + return null; - function usePattern(regexStr) { - var index = patternsHash[regexStr]; - if (index === undefined) { - index = patternsHash[regexStr] = patterns.length; - patterns[index] = regexStr; - } - return 'pattern' + index; - } + var values = []; + var value = 0; - function useDefault(value) { - switch (typeof value) { - case 'boolean': - case 'number': - return '' + value; - case 'string': - return util.toQuotedString(value); - case 'object': - if (value === null) return 'null'; - var valueStr = stableStringify(value); - var index = defaultsHash[valueStr]; - if (index === undefined) { - index = defaultsHash[valueStr] = defaults.length; - defaults[index] = value; - } - return 'default' + index; + for (var i = 0; i < b.length; i++) { + var byte = b[i] & 0xff; + + value <<= 7; + value += byte & 0x7f; + if ((byte & 0x80) === 0) { + values.push(value); + value = 0; } } - function useCustomRule(rule, schema, parentSchema, it) { - var validateSchema = rule.definition.validateSchema; - if (validateSchema && self._opts.validateSchema !== false) { - var valid = validateSchema(schema); - if (!valid) { - var message = 'keyword schema is invalid: ' + self.errorsText(validateSchema.errors); - if (self._opts.validateSchema == 'log') self.logger.error(message); - else throw new Error(message); - } - } + value = values.shift(); + values.unshift(value % 40); + values.unshift((value / 40) >> 0); - var compile = rule.definition.compile - , inline = rule.definition.inline - , macro = rule.definition.macro; + return values.join('.'); +}; - var validate; - if (compile) { - validate = compile.call(self, schema, parentSchema, it); - } else if (macro) { - validate = macro.call(self, schema, parentSchema, it); - if (opts.validateSchema !== false) self.validateSchema(validate, true); - } else if (inline) { - validate = inline.call(self, it, rule.keyword, schema, parentSchema); - } else { - validate = rule.definition.validate; - if (!validate) return; - } - if (validate === undefined) - throw new Error('custom keyword "' + rule.keyword + '"failed to compile'); +Reader.prototype._readTag = function (tag) { + assert.ok(tag !== undefined); - var index = customRules.length; - customRules[index] = validate; + var b = this.peek(); - return { - code: 'customRule' + index, - validate: validate - }; - } -} + if (b === null) + return null; + if (b !== tag) + throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + + ': got 0x' + b.toString(16)); -/** - * Checks if the schema is currently compiled - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Object} object with properties "index" (compilation index) and "compiling" (boolean) - */ -function checkCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var index = compIndex.call(this, schema, root, baseId); - if (index >= 0) return { index: index, compiling: true }; - index = this._compilations.length; - this._compilations[index] = { - schema: schema, - root: root, - baseId: baseId - }; - return { index: index, compiling: false }; -} + var o = this.readLength(this._offset + 1); // stored in `length` + if (o === null) + return null; + if (this.length > 4) + throw newInvalidAsn1Error('Integer too long: ' + this.length); -/** - * Removes the schema from the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - */ -function endCompiling(schema, root, baseId) { - /* jshint validthis: true */ - var i = compIndex.call(this, schema, root, baseId); - if (i >= 0) this._compilations.splice(i, 1); -} + if (this.length > this._size - o) + return null; + this._offset = o; + var fb = this._buf[this._offset]; + var value = 0; -/** - * Index of schema compilation in the currently compiled list - * @this Ajv - * @param {Object} schema schema to compile - * @param {Object} root root object - * @param {String} baseId base schema ID - * @return {Integer} compilation index - */ -function compIndex(schema, root, baseId) { - /* jshint validthis: true */ - for (var i=0; i> 0; +}; -function defaultCode(i) { - return 'var default' + i + ' = defaults[' + i + '];'; -} +// --- Exported API -function refValCode(i, refVal) { - return refVal[i] === undefined ? '' : 'var refVal' + i + ' = refVal[' + i + '];'; -} +module.exports = Reader; -function customRuleCode(i) { - return 'var customRule' + i + ' = customRules[' + i + '];'; -} +/***/ }), +/* 484 */ +/***/ (function(module, exports, __webpack_require__) { +// Copyright 2011 Mark Cavage All rights reserved. -function vars(arr, statement) { - if (!arr.length) return ''; - var code = ''; - for (var i=0; i= 0xD800 && value <= 0xDBFF && pos < len) { - // high surrogate, and there is a next character - value = str.charCodeAt(pos); - if ((value & 0xFC00) == 0xDC00) pos++; // low surrogate - } + // A list of offsets in the buffer where we need to insert + // sequence tag/len pairs. + this._seq = []; +} + +Object.defineProperty(Writer.prototype, 'buffer', { + get: function () { + if (this._seq.length) + throw newInvalidAsn1Error(this._seq.length + ' unended sequence(s)'); + + return (this._buf.slice(0, this._offset)); } - return length; +}); + +Writer.prototype.writeByte = function (b) { + if (typeof (b) !== 'number') + throw new TypeError('argument must be a Number'); + + this._ensure(1); + this._buf[this._offset++] = b; }; -/***/ }), -/* 481 */ -/***/ (function(module, exports, __webpack_require__) { +Writer.prototype.writeInt = function (i, tag) { + if (typeof (i) !== 'number') + throw new TypeError('argument must be a Number'); + if (typeof (tag) !== 'number') + tag = ASN1.Integer; -"use strict"; + var sz = 4; -module.exports = function generate_allOf(it, $keyword, $ruleType) { - var out = ' '; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $currentBaseId = $it.baseId, - $allSchemasEmpty = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - $allSchemasEmpty = false; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($breakOnError) { - if ($allSchemasEmpty) { - out += ' if (true) { '; - } else { - out += ' ' + ($closingBraces.slice(0, -1)) + ' '; - } + while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000 >> 0)) && + (sz > 1)) { + sz--; + i <<= 8; } - out = it.util.cleanUpCode(out); - return out; -} - -/***/ }), -/* 482 */ -/***/ (function(module, exports, __webpack_require__) { + if (sz > 4) + throw newInvalidAsn1Error('BER ints cannot be > 0xffffffff'); -"use strict"; + this._ensure(2 + sz); + this._buf[this._offset++] = tag; + this._buf[this._offset++] = sz; -module.exports = function generate_anyOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $noEmptySchema = $schema.every(function($sch) { - return it.util.schemaHasRules($sch, it.RULES.all); - }); - if ($noEmptySchema) { - var $currentBaseId = $it.baseId; - out += ' var ' + ($errs) + ' = errors; var ' + ($valid) + ' = false; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - out += ' ' + ($valid) + ' = ' + ($valid) + ' || ' + ($nextValid) + '; if (!' + ($valid) + ') { '; - $closingBraces += '}'; - } - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should match some schema in anyOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } - out = it.util.cleanUpCode(out); - } else { - if ($breakOnError) { - out += ' if (true) { '; - } + while (sz-- > 0) { + this._buf[this._offset++] = ((i & 0xff000000) >>> 24); + i <<= 8; } - return out; -} +}; -/***/ }), -/* 483 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; +Writer.prototype.writeNull = function () { + this.writeByte(ASN1.Null); + this.writeByte(0x00); +}; -module.exports = function generate_const(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (!$isData) { - out += ' var schema' + ($lvl) + ' = validate.schema' + ($schemaPath) + ';'; - } - out += 'var ' + ($valid) + ' = equal(' + ($data) + ', schema' + ($lvl) + '); if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('const') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should be equal to constant\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' }'; - if ($breakOnError) { - out += ' else { '; + +Writer.prototype.writeEnumeration = function (i, tag) { + if (typeof (i) !== 'number') + throw new TypeError('argument must be a Number'); + if (typeof (tag) !== 'number') + tag = ASN1.Enumeration; + + return this.writeInt(i, tag); +}; + + +Writer.prototype.writeBoolean = function (b, tag) { + if (typeof (b) !== 'boolean') + throw new TypeError('argument must be a Boolean'); + if (typeof (tag) !== 'number') + tag = ASN1.Boolean; + + this._ensure(3); + this._buf[this._offset++] = tag; + this._buf[this._offset++] = 0x01; + this._buf[this._offset++] = b ? 0xff : 0x00; +}; + + +Writer.prototype.writeString = function (s, tag) { + if (typeof (s) !== 'string') + throw new TypeError('argument must be a string (was: ' + typeof (s) + ')'); + if (typeof (tag) !== 'number') + tag = ASN1.OctetString; + + var len = Buffer.byteLength(s); + this.writeByte(tag); + this.writeLength(len); + if (len) { + this._ensure(len); + this._buf.write(s, this._offset); + this._offset += len; } - return out; -} +}; -/***/ }), -/* 484 */ -/***/ (function(module, exports, __webpack_require__) { +Writer.prototype.writeBuffer = function (buf, tag) { + if (typeof (tag) !== 'number') + throw new TypeError('tag must be a number'); + if (!Buffer.isBuffer(buf)) + throw new TypeError('argument must be a buffer'); -"use strict"; + this.writeByte(tag); + this.writeLength(buf.length); + this._ensure(buf.length); + buf.copy(this._buf, this._offset, 0, buf.length); + this._offset += buf.length; +}; -module.exports = function generate_contains(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId, - $nonEmptySchema = it.util.schemaHasRules($schema, it.RULES.all); - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($nonEmptySchema) { - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($nextValid) + ' = false; for (var ' + ($idx) + ' = 0; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; + +Writer.prototype.writeStringArray = function (strings) { + if ((!strings instanceof Array)) + throw new TypeError('argument must be an Array[String]'); + + var self = this; + strings.forEach(function (s) { + self.writeString(s); + }); +}; + +// This is really to solve DER cases, but whatever for now +Writer.prototype.writeOID = function (s, tag) { + if (typeof (s) !== 'string') + throw new TypeError('argument must be a string'); + if (typeof (tag) !== 'number') + tag = ASN1.OID; + + if (!/^([0-9]+\.){3,}[0-9]+$/.test(s)) + throw new Error('argument is not a valid OID string'); + + function encodeOctet(bytes, octet) { + if (octet < 128) { + bytes.push(octet); + } else if (octet < 16384) { + bytes.push((octet >>> 7) | 0x80); + bytes.push(octet & 0x7F); + } else if (octet < 2097152) { + bytes.push((octet >>> 14) | 0x80); + bytes.push(((octet >>> 7) | 0x80) & 0xFF); + bytes.push(octet & 0x7F); + } else if (octet < 268435456) { + bytes.push((octet >>> 21) | 0x80); + bytes.push(((octet >>> 14) | 0x80) & 0xFF); + bytes.push(((octet >>> 7) | 0x80) & 0xFF); + bytes.push(octet & 0x7F); } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; + bytes.push(((octet >>> 28) | 0x80) & 0xFF); + bytes.push(((octet >>> 21) | 0x80) & 0xFF); + bytes.push(((octet >>> 14) | 0x80) & 0xFF); + bytes.push(((octet >>> 7) | 0x80) & 0xFF); + bytes.push(octet & 0x7F); } - out += ' if (' + ($nextValid) + ') break; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($closingBraces) + ' if (!' + ($nextValid) + ') {'; - } else { - out += ' if (' + ($data) + '.length == 0) {'; } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('contains') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should contain a valid item\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; + + var tmp = s.split('.'); + var bytes = []; + bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10)); + tmp.slice(2).forEach(function (b) { + encodeOctet(bytes, parseInt(b, 10)); + }); + + var self = this; + this._ensure(2 + bytes.length); + this.writeByte(tag); + this.writeLength(bytes.length); + bytes.forEach(function (b) { + self.writeByte(b); + }); +}; + + +Writer.prototype.writeLength = function (len) { + if (typeof (len) !== 'number') + throw new TypeError('argument must be a Number'); + + this._ensure(4); + + if (len <= 0x7f) { + this._buf[this._offset++] = len; + } else if (len <= 0xff) { + this._buf[this._offset++] = 0x81; + this._buf[this._offset++] = len; + } else if (len <= 0xffff) { + this._buf[this._offset++] = 0x82; + this._buf[this._offset++] = len >> 8; + this._buf[this._offset++] = len; + } else if (len <= 0xffffff) { + this._buf[this._offset++] = 0x83; + this._buf[this._offset++] = len >> 16; + this._buf[this._offset++] = len >> 8; + this._buf[this._offset++] = len; } else { - out += ' {} '; + throw newInvalidAsn1Error('Length too long (> 4 bytes)'); } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } +}; + +Writer.prototype.startSequence = function (tag) { + if (typeof (tag) !== 'number') + tag = ASN1.Sequence | ASN1.Constructor; + + this.writeByte(tag); + this._seq.push(this._offset); + this._ensure(3); + this._offset += 3; +}; + + +Writer.prototype.endSequence = function () { + var seq = this._seq.pop(); + var start = seq + 3; + var len = this._offset - start; + + if (len <= 0x7f) { + this._shift(start, len, -2); + this._buf[seq] = len; + } else if (len <= 0xff) { + this._shift(start, len, -1); + this._buf[seq] = 0x81; + this._buf[seq + 1] = len; + } else if (len <= 0xffff) { + this._buf[seq] = 0x82; + this._buf[seq + 1] = len >> 8; + this._buf[seq + 2] = len; + } else if (len <= 0xffffff) { + this._shift(start, len, 1); + this._buf[seq] = 0x83; + this._buf[seq + 1] = len >> 16; + this._buf[seq + 2] = len >> 8; + this._buf[seq + 3] = len; } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - if ($nonEmptySchema) { - out += ' errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; + throw newInvalidAsn1Error('Sequence too long'); } - if (it.opts.allErrors) { - out += ' } '; +}; + + +Writer.prototype._shift = function (start, len, shift) { + assert.ok(start !== undefined); + assert.ok(len !== undefined); + assert.ok(shift); + + this._buf.copy(this._buf, start + shift, start, start + len); + this._offset += shift; +}; + +Writer.prototype._ensure = function (len) { + assert.ok(len); + + if (this._size - this._offset < len) { + var sz = this._size * this._options.growthFactor; + if (sz - this._offset < len) + sz += len; + + var buf = Buffer.alloc(sz); + + this._buf.copy(buf, 0, 0, this._offset); + this._buf = buf; + this._size = sz; } - out = it.util.cleanUpCode(out); - return out; -} +}; + + + +// --- Exported API + +module.exports = Writer; /***/ }), /* 485 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; - -module.exports = function generate_custom(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $errorKeyword; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $rule = this, - $definition = 'definition' + $lvl, - $rDef = $rule.definition, - $closingBraces = ''; - var $compile, $inline, $macro, $ruleValidate, $validateCode; - if ($isData && $rDef.$data) { - $validateCode = 'keywordValidate' + $lvl; - var $validateSchema = $rDef.validateSchema; - out += ' var ' + ($definition) + ' = RULES.custom[\'' + ($keyword) + '\'].definition; var ' + ($validateCode) + ' = ' + ($definition) + '.validate;'; - } else { - $ruleValidate = it.useCustomRule($rule, $schema, it.schema, it); - if (!$ruleValidate) return; - $schemaValue = 'validate.schema' + $schemaPath; - $validateCode = $ruleValidate.code; - $compile = $rDef.compile; - $inline = $rDef.inline; - $macro = $rDef.macro; - } - var $ruleErrs = $validateCode + '.errors', - $i = 'i' + $lvl, - $ruleErr = 'ruleErr' + $lvl, - $asyncKeyword = $rDef.async; - if ($asyncKeyword && !it.async) throw new Error('async keyword in sync schema'); - if (!($inline || $macro)) { - out += '' + ($ruleErrs) + ' = null;'; - } - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if ($isData && $rDef.$data) { - $closingBraces += '}'; - out += ' if (' + ($schemaValue) + ' === undefined) { ' + ($valid) + ' = true; } else { '; - if ($validateSchema) { - $closingBraces += '}'; - out += ' ' + ($valid) + ' = ' + ($definition) + '.validateSchema(' + ($schemaValue) + '); if (' + ($valid) + ') { '; - } - } - if ($inline) { - if ($rDef.statements) { - out += ' ' + ($ruleValidate.validate) + ' '; - } else { - out += ' ' + ($valid) + ' = ' + ($ruleValidate.validate) + '; '; - } - } else if ($macro) { - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - $it.schema = $ruleValidate.validate; - $it.schemaPath = ''; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it).replace(/validate\.schema/g, $validateCode); - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' ' + ($code); - } else { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - out += ' ' + ($validateCode) + '.call( '; - if (it.opts.passContext) { - out += 'this'; - } else { - out += 'self'; - } - if ($compile || $rDef.schema === false) { - out += ' , ' + ($data) + ' '; - } else { - out += ' , ' + ($schemaValue) + ' , ' + ($data) + ' , validate.schema' + (it.schemaPath) + ' '; - } - out += ' , (dataPath || \'\')'; - if (it.errorPath != '""') { - out += ' + ' + (it.errorPath); - } - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ' , rootData ) '; - var def_callRuleValidate = out; - out = $$outStack.pop(); - if ($rDef.errors === false) { - out += ' ' + ($valid) + ' = '; - if ($asyncKeyword) { - out += '' + (it.yieldAwait); - } - out += '' + (def_callRuleValidate) + '; '; - } else { - if ($asyncKeyword) { - $ruleErrs = 'customErrors' + $lvl; - out += ' var ' + ($ruleErrs) + ' = null; try { ' + ($valid) + ' = ' + (it.yieldAwait) + (def_callRuleValidate) + '; } catch (e) { ' + ($valid) + ' = false; if (e instanceof ValidationError) ' + ($ruleErrs) + ' = e.errors; else throw e; } '; - } else { - out += ' ' + ($ruleErrs) + ' = null; ' + ($valid) + ' = ' + (def_callRuleValidate) + '; '; - } - } - } - if ($rDef.modifying) { - out += ' if (' + ($parentData) + ') ' + ($data) + ' = ' + ($parentData) + '[' + ($parentDataProperty) + '];'; - } - out += '' + ($closingBraces); - if ($rDef.valid) { - if ($breakOnError) { - out += ' if (true) { '; - } - } else { - out += ' if ( '; - if ($rDef.valid === undefined) { - out += ' !'; - if ($macro) { - out += '' + ($nextValid); - } else { - out += '' + ($valid); - } - } else { - out += ' ' + (!$rDef.valid) + ' '; - } - out += ') { '; - $errorKeyword = $rule.keyword; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'custom') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { keyword: \'' + ($rule.keyword) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should pass "' + ($rule.keyword) + '" keyword validation\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - var def_customError = out; - out = $$outStack.pop(); - if ($inline) { - if ($rDef.errors) { - if ($rDef.errors != 'full') { - out += ' for (var ' + ($i) + '=' + ($errs) + '; ' + ($i) + '= 0) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } else { - throw new Error('unknown format "' + $schema + '" is used in schema at path "' + it.errSchemaPath + '"'); - } - } - var $isObject = typeof $format == 'object' && !($format instanceof RegExp) && $format.validate; - var $formatType = $isObject && $format.type || 'string'; - if ($isObject) { - var $async = $format.async === true; - $format = $format.validate; - } - if ($formatType != $ruleType) { - if ($breakOnError) { - out += ' if (true) { '; - } - return out; - } - if ($async) { - if (!it.async) throw new Error('async format in sync schema'); - var $formatRef = 'formats' + it.util.getProperty($schema) + '.validate'; - out += ' if (!(' + (it.yieldAwait) + ' ' + ($formatRef) + '(' + ($data) + '))) { '; - } else { - out += ' if (! '; - var $formatRef = 'formats' + it.util.getProperty($schema); - if ($isObject) $formatRef += '.validate'; - if (typeof $format == 'function') { - out += ' ' + ($formatRef) + '(' + ($data) + ') '; - } else { - out += ' ' + ($formatRef) + '.test(' + ($data) + ') '; - } - out += ') { '; - } - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match format "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - return out; +// Public API +module.exports = serial; + +/** + * Runs iterator over provided array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serial(list, iterator, callback) +{ + return serialOrdered(list, iterator, null, callback); } @@ -91659,954 +90891,794 @@ module.exports = function generate_format(it, $keyword, $ruleType) { /* 489 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; -module.exports = function generate_items(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $idx = 'i' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $currentBaseId = it.baseId; - out += 'var ' + ($errs) + ' = errors;var ' + ($valid) + ';'; - if (Array.isArray($schema)) { - var $additionalItems = it.schema.additionalItems; - if ($additionalItems === false) { - out += ' ' + ($valid) + ' = ' + ($data) + '.length <= ' + ($schema.length) + '; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have more than ' + ($schema.length) + ' items\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - $closingBraces += '}'; - out += ' else { '; - } - } - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($i) + ') { '; - var $passData = $data + '[' + $i + ']'; - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - $it.errorPath = it.util.getPathExpr(it.errorPath, $i, it.opts.jsonPointers, true); - $it.dataPathArr[$dataNxt] = $i; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if (typeof $additionalItems == 'object' && it.util.schemaHasRules($additionalItems, it.RULES.all)) { - $it.schema = $additionalItems; - $it.schemaPath = it.schemaPath + '.additionalItems'; - $it.errSchemaPath = it.errSchemaPath + '/additionalItems'; - out += ' ' + ($nextValid) + ' = true; if (' + ($data) + '.length > ' + ($schema.length) + ') { for (var ' + ($idx) + ' = ' + ($schema.length) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } else if (it.util.schemaHasRules($schema, it.RULES.all)) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' for (var ' + ($idx) + ' = ' + (0) + '; ' + ($idx) + ' < ' + ($data) + '.length; ' + ($idx) + '++) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $idx, it.opts.jsonPointers, true); - var $passData = $data + '[' + $idx + ']'; - $it.dataPathArr[$dataNxt] = $idx; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' }'; - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; +/*! + * Copyright 2010 LearnBoost + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Module dependencies. + */ + +var crypto = __webpack_require__(11) + , parse = __webpack_require__(24).parse + ; + +/** + * Valid keys. + */ + +var keys = + [ 'acl' + , 'location' + , 'logging' + , 'notification' + , 'partNumber' + , 'policy' + , 'requestPayment' + , 'torrent' + , 'uploadId' + , 'uploads' + , 'versionId' + , 'versioning' + , 'versions' + , 'website' + ] + +/** + * Return an "Authorization" header value with the given `options` + * in the form of "AWS :" + * + * @param {Object} options + * @return {String} + * @api private + */ + +function authorization (options) { + return 'AWS ' + options.key + ':' + sign(options) +} + +module.exports = authorization +module.exports.authorization = authorization + +/** + * Simple HMAC-SHA1 Wrapper + * + * @param {Object} options + * @return {String} + * @api private + */ + +function hmacSha1 (options) { + return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64') +} + +module.exports.hmacSha1 = hmacSha1 + +/** + * Create a base64 sha1 HMAC for `options`. + * + * @param {Object} options + * @return {String} + * @api private + */ + +function sign (options) { + options.message = stringToSign(options) + return hmacSha1(options) +} +module.exports.sign = sign + +/** + * Create a base64 sha1 HMAC for `options`. + * + * Specifically to be used with S3 presigned URLs + * + * @param {Object} options + * @return {String} + * @api private + */ + +function signQuery (options) { + options.message = queryStringToSign(options) + return hmacSha1(options) +} +module.exports.signQuery= signQuery + +/** + * Return a string for sign() with the given `options`. + * + * Spec: + * + * \n + * \n + * \n + * \n + * [headers\n] + * + * + * @param {Object} options + * @return {String} + * @api private + */ + +function stringToSign (options) { + var headers = options.amazonHeaders || '' + if (headers) headers += '\n' + var r = + [ options.verb + , options.md5 + , options.contentType + , options.date ? options.date.toUTCString() : '' + , headers + options.resource + ] + return r.join('\n') +} +module.exports.stringToSign = stringToSign + +/** + * Return a string for sign() with the given `options`, but is meant exclusively + * for S3 presigned URLs + * + * Spec: + * + * \n + * + * + * @param {Object} options + * @return {String} + * @api private + */ + +function queryStringToSign (options){ + return 'GET\n\n\n' + options.date + '\n' + options.resource +} +module.exports.queryStringToSign = queryStringToSign + +/** + * Perform the following: + * + * - ignore non-amazon headers + * - lowercase fields + * - sort lexicographically + * - trim whitespace between ":" + * - join with newline + * + * @param {Object} headers + * @return {String} + * @api private + */ + +function canonicalizeHeaders (headers) { + var buf = [] + , fields = Object.keys(headers) + ; + for (var i = 0, len = fields.length; i < len; ++i) { + var field = fields[i] + , val = headers[field] + , field = field.toLowerCase() + ; + if (0 !== field.indexOf('x-amz')) continue + buf.push(field + ':' + val) } - out = it.util.cleanUpCode(out); - return out; + return buf.sort().join('\n') +} +module.exports.canonicalizeHeaders = canonicalizeHeaders + +/** + * Perform the following: + * + * - ignore non sub-resources + * - sort lexicographically + * + * @param {String} resource + * @return {String} + * @api private + */ + +function canonicalizeResource (resource) { + var url = parse(resource, true) + , path = url.pathname + , buf = [] + ; + + Object.keys(url.query).forEach(function(key){ + if (!~keys.indexOf(key)) return + var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key]) + buf.push(key + val) + }) + + return path + (buf.length ? '?' + buf.sort().join('&') : '') } +module.exports.canonicalizeResource = canonicalizeResource /***/ }), /* 490 */ /***/ (function(module, exports, __webpack_require__) { -"use strict"; +var aws4 = exports, + url = __webpack_require__(24), + querystring = __webpack_require__(197), + crypto = __webpack_require__(11), + lru = __webpack_require__(491), + credentialsCache = lru(1000) -module.exports = function generate_multipleOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - out += 'var division' + ($lvl) + ';if ('; - if ($isData) { - out += ' ' + ($schemaValue) + ' !== undefined && ( typeof ' + ($schemaValue) + ' != \'number\' || '; +// http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html + +function hmac(key, string, encoding) { + return crypto.createHmac('sha256', key).update(string, 'utf8').digest(encoding) +} + +function hash(string, encoding) { + return crypto.createHash('sha256').update(string, 'utf8').digest(encoding) +} + +// This function assumes the string has already been percent encoded +function encodeRfc3986(urlEncodedString) { + return urlEncodedString.replace(/[!'()*]/g, function(c) { + return '%' + c.charCodeAt(0).toString(16).toUpperCase() + }) +} + +// request: { path | body, [host], [method], [headers], [service], [region] } +// credentials: { accessKeyId, secretAccessKey, [sessionToken] } +function RequestSigner(request, credentials) { + + if (typeof request === 'string') request = url.parse(request) + + var headers = request.headers = (request.headers || {}), + hostParts = this.matchHost(request.hostname || request.host || headers.Host || headers.host) + + this.request = request + this.credentials = credentials || this.defaultCredentials() + + this.service = request.service || hostParts[0] || '' + this.region = request.region || hostParts[1] || 'us-east-1' + + // SES uses a different domain from the service name + if (this.service === 'email') this.service = 'ses' + + if (!request.method && request.body) + request.method = 'POST' + + if (!headers.Host && !headers.host) { + headers.Host = request.hostname || request.host || this.createHost() + + // If a port is specified explicitly, use it as is + if (request.port) + headers.Host += ':' + request.port } - out += ' (division' + ($lvl) + ' = ' + ($data) + ' / ' + ($schemaValue) + ', '; - if (it.opts.multipleOfPrecision) { - out += ' Math.abs(Math.round(division' + ($lvl) + ') - division' + ($lvl) + ') > 1e-' + (it.opts.multipleOfPrecision) + ' '; + if (!request.hostname && !request.host) + request.hostname = headers.Host || headers.host + + this.isCodeCommitGit = this.service === 'codecommit' && request.method === 'GIT' +} + +RequestSigner.prototype.matchHost = function(host) { + var match = (host || '').match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/) + var hostParts = (match || []).slice(1, 3) + + // ES's hostParts are sometimes the other way round, if the value that is expected + // to be region equals ‘es’ switch them back + // e.g. search-cluster-name-aaaa00aaaa0aaa0aaaaaaa0aaa.us-east-1.es.amazonaws.com + if (hostParts[1] === 'es') + hostParts = hostParts.reverse() + + return hostParts +} + +// http://docs.aws.amazon.com/general/latest/gr/rande.html +RequestSigner.prototype.isSingleRegion = function() { + // Special case for S3 and SimpleDB in us-east-1 + if (['s3', 'sdb'].indexOf(this.service) >= 0 && this.region === 'us-east-1') return true + + return ['cloudfront', 'ls', 'route53', 'iam', 'importexport', 'sts'] + .indexOf(this.service) >= 0 +} + +RequestSigner.prototype.createHost = function() { + var region = this.isSingleRegion() ? '' : + (this.service === 's3' && this.region !== 'us-east-1' ? '-' : '.') + this.region, + service = this.service === 'ses' ? 'email' : this.service + return service + region + '.amazonaws.com' +} + +RequestSigner.prototype.prepareRequest = function() { + this.parsePath() + + var request = this.request, headers = request.headers, query + + if (request.signQuery) { + + this.parsedPath.query = query = this.parsedPath.query || {} + + if (this.credentials.sessionToken) + query['X-Amz-Security-Token'] = this.credentials.sessionToken + + if (this.service === 's3' && !query['X-Amz-Expires']) + query['X-Amz-Expires'] = 86400 + + if (query['X-Amz-Date']) + this.datetime = query['X-Amz-Date'] + else + query['X-Amz-Date'] = this.getDateTime() + + query['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256' + query['X-Amz-Credential'] = this.credentials.accessKeyId + '/' + this.credentialString() + query['X-Amz-SignedHeaders'] = this.signedHeaders() + } else { - out += ' division' + ($lvl) + ' !== parseInt(division' + ($lvl) + ') '; - } - out += ' ) '; - if ($isData) { - out += ' ) '; - } - out += ' ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should be multiple of '; - if ($isData) { - out += '\' + ' + ($schemaValue); - } else { - out += '' + ($schemaValue) + '\''; - } - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + + if (!request.doNotModifyHeaders && !this.isCodeCommitGit) { + if (request.body && !headers['Content-Type'] && !headers['content-type']) + headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8' + + if (request.body && !headers['Content-Length'] && !headers['content-length']) + headers['Content-Length'] = Buffer.byteLength(request.body) + + if (this.credentials.sessionToken && !headers['X-Amz-Security-Token'] && !headers['x-amz-security-token']) + headers['X-Amz-Security-Token'] = this.credentials.sessionToken + + if (this.service === 's3' && !headers['X-Amz-Content-Sha256'] && !headers['x-amz-content-sha256']) + headers['X-Amz-Content-Sha256'] = hash(this.request.body || '', 'hex') + + if (headers['X-Amz-Date'] || headers['x-amz-date']) + this.datetime = headers['X-Amz-Date'] || headers['x-amz-date'] + else + headers['X-Amz-Date'] = this.getDateTime() } - out += ' } '; - } else { - out += ' {} '; + + delete headers.Authorization + delete headers.authorization } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } +} + +RequestSigner.prototype.sign = function() { + if (!this.parsedPath) this.prepareRequest() + + if (this.request.signQuery) { + this.parsedPath.query['X-Amz-Signature'] = this.signature() } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; + this.request.headers.Authorization = this.authHeader() } - out += '} '; - if ($breakOnError) { - out += ' else { '; + + this.request.path = this.formatPath() + + return this.request +} + +RequestSigner.prototype.getDateTime = function() { + if (!this.datetime) { + var headers = this.request.headers, + date = new Date(headers.Date || headers.date || new Date) + + this.datetime = date.toISOString().replace(/[:\-]|\.\d{3}/g, '') + + // Remove the trailing 'Z' on the timestamp string for CodeCommit git access + if (this.isCodeCommitGit) this.datetime = this.datetime.slice(0, -1) } - return out; + return this.datetime } +RequestSigner.prototype.getDate = function() { + return this.getDateTime().substr(0, 8) +} -/***/ }), -/* 491 */ -/***/ (function(module, exports, __webpack_require__) { +RequestSigner.prototype.authHeader = function() { + return [ + 'AWS4-HMAC-SHA256 Credential=' + this.credentials.accessKeyId + '/' + this.credentialString(), + 'SignedHeaders=' + this.signedHeaders(), + 'Signature=' + this.signature(), + ].join(', ') +} -"use strict"; +RequestSigner.prototype.signature = function() { + var date = this.getDate(), + cacheKey = [this.credentials.secretAccessKey, date, this.region, this.service].join(), + kDate, kRegion, kService, kCredentials = credentialsCache.get(cacheKey) + if (!kCredentials) { + kDate = hmac('AWS4' + this.credentials.secretAccessKey, date) + kRegion = hmac(kDate, this.region) + kService = hmac(kRegion, this.service) + kCredentials = hmac(kService, 'aws4_request') + credentialsCache.set(cacheKey, kCredentials) + } + return hmac(kCredentials, this.stringToSign(), 'hex') +} -module.exports = function generate_not(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - if (it.util.schemaHasRules($schema, it.RULES.all)) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.createErrors = false; - var $allErrorsOption; - if ($it.opts.allErrors) { - $allErrorsOption = $it.opts.allErrors; - $it.opts.allErrors = false; - } - out += ' ' + (it.validate($it)) + ' '; - $it.createErrors = true; - if ($allErrorsOption) $it.opts.allErrors = $allErrorsOption; - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (' + ($nextValid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } '; - if (it.opts.allErrors) { - out += ' } '; - } +RequestSigner.prototype.stringToSign = function() { + return [ + 'AWS4-HMAC-SHA256', + this.getDateTime(), + this.credentialString(), + hash(this.canonicalString(), 'hex'), + ].join('\n') +} + +RequestSigner.prototype.canonicalString = function() { + if (!this.parsedPath) this.prepareRequest() + + var pathStr = this.parsedPath.path, + query = this.parsedPath.query, + headers = this.request.headers, + queryStr = '', + normalizePath = this.service !== 's3', + decodePath = this.service === 's3' || this.request.doNotEncodePath, + decodeSlashesInPath = this.service === 's3', + firstValOnly = this.service === 's3', + bodyHash + + if (this.service === 's3' && this.request.signQuery) { + bodyHash = 'UNSIGNED-PAYLOAD' + } else if (this.isCodeCommitGit) { + bodyHash = '' } else { - out += ' var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT be valid\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; + bodyHash = headers['X-Amz-Content-Sha256'] || headers['x-amz-content-sha256'] || + hash(this.request.body || '', 'hex') + } + + if (query) { + queryStr = encodeRfc3986(querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) { + if (!key) return obj + obj[key] = !Array.isArray(query[key]) ? query[key] : + (firstValOnly ? query[key][0] : query[key].slice().sort()) + return obj + }, {}))) + } + if (pathStr !== '/') { + if (normalizePath) pathStr = pathStr.replace(/\/{2,}/g, '/') + pathStr = pathStr.split('/').reduce(function(path, piece) { + if (normalizePath && piece === '..') { + path.pop() + } else if (!normalizePath || piece !== '.') { + if (decodePath) piece = decodeURIComponent(piece) + path.push(encodeRfc3986(encodeURIComponent(piece))) } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if ($breakOnError) { - out += ' if (false) { '; - } + return path + }, []).join('/') + if (pathStr[0] !== '/') pathStr = '/' + pathStr + if (decodeSlashesInPath) pathStr = pathStr.replace(/%2F/g, '/') } - return out; + + return [ + this.request.method || 'GET', + pathStr, + queryStr, + this.canonicalHeaders() + '\n', + this.signedHeaders(), + bodyHash, + ].join('\n') } +RequestSigner.prototype.canonicalHeaders = function() { + var headers = this.request.headers + function trimAll(header) { + return header.toString().trim().replace(/\s+/g, ' ') + } + return Object.keys(headers) + .sort(function(a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 }) + .map(function(key) { return key.toLowerCase() + ':' + trimAll(headers[key]) }) + .join('\n') +} -/***/ }), -/* 492 */ -/***/ (function(module, exports, __webpack_require__) { +RequestSigner.prototype.signedHeaders = function() { + return Object.keys(this.request.headers) + .map(function(key) { return key.toLowerCase() }) + .sort() + .join(';') +} -"use strict"; +RequestSigner.prototype.credentialString = function() { + return [ + this.getDate(), + this.region, + this.service, + 'aws4_request', + ].join('/') +} -module.exports = function generate_oneOf(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - out += 'var ' + ($errs) + ' = errors;var prevValid' + ($lvl) + ' = false;var ' + ($valid) + ' = false;'; - var $currentBaseId = $it.baseId; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var arr1 = $schema; - if (arr1) { - var $sch, $i = -1, - l1 = arr1.length - 1; - while ($i < l1) { - $sch = arr1[$i += 1]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - $it.schema = $sch; - $it.schemaPath = $schemaPath + '[' + $i + ']'; - $it.errSchemaPath = $errSchemaPath + '/' + $i; - out += ' ' + (it.validate($it)) + ' '; - $it.baseId = $currentBaseId; - } else { - out += ' var ' + ($nextValid) + ' = true; '; - } - if ($i) { - out += ' if (' + ($nextValid) + ' && prevValid' + ($lvl) + ') ' + ($valid) + ' = false; else { '; - $closingBraces += '}'; - } - out += ' if (' + ($nextValid) + ') ' + ($valid) + ' = prevValid' + ($lvl) + ' = true;'; - } +RequestSigner.prototype.defaultCredentials = function() { + var env = process.env + return { + accessKeyId: env.AWS_ACCESS_KEY_ID || env.AWS_ACCESS_KEY, + secretAccessKey: env.AWS_SECRET_ACCESS_KEY || env.AWS_SECRET_KEY, + sessionToken: env.AWS_SESSION_TOKEN, } - it.compositeRule = $it.compositeRule = $wasComposite; - out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; - if (it.opts.messages !== false) { - out += ' , message: \'should match exactly one schema in oneOf\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; +} + +RequestSigner.prototype.parsePath = function() { + var path = this.request.path || '/', + queryIx = path.indexOf('?'), + query = null + + if (queryIx >= 0) { + query = querystring.parse(path.slice(queryIx + 1)) + path = path.slice(0, queryIx) } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; - } + + // S3 doesn't always encode characters > 127 correctly and + // all services don't encode characters > 255 correctly + // So if there are non-reserved chars (and it's not already all % encoded), just encode them all + if (/[^0-9A-Za-z!'()*\-._~%/]/.test(path)) { + path = path.split('/').map(function(piece) { + return encodeURIComponent(decodeURIComponent(piece)) + }).join('/') } - out += '} else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; }'; - if (it.opts.allErrors) { - out += ' } '; + + this.parsedPath = { + path: path, + query: query, } - return out; +} + +RequestSigner.prototype.formatPath = function() { + var path = this.parsedPath.path, + query = this.parsedPath.query + + if (!query) return path + + // Services don't support empty query string keys + if (query[''] != null) delete query[''] + + return path + '?' + encodeRfc3986(querystring.stringify(query)) +} + +aws4.RequestSigner = RequestSigner + +aws4.sign = function(request, credentials) { + return new RequestSigner(request, credentials).sign() } /***/ }), -/* 493 */ -/***/ (function(module, exports, __webpack_require__) { +/* 491 */ +/***/ (function(module, exports) { -"use strict"; +module.exports = function(size) { + return new LruCache(size) +} -module.exports = function generate_pattern(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; +function LruCache(size) { + this.capacity = size | 0 + this.map = Object.create(null) + this.list = new DoublyLinkedList() +} + +LruCache.prototype.get = function(key) { + var node = this.map[key] + if (node == null) return undefined + this.used(node) + return node.val +} + +LruCache.prototype.set = function(key, val) { + var node = this.map[key] + if (node != null) { + node.val = val } else { - $schemaValue = $schema; + if (!this.capacity) this.prune() + if (!this.capacity) return false + node = new DoublyLinkedNode(key, val) + this.map[key] = node + this.capacity-- } - var $regexp = $isData ? '(new RegExp(' + $schemaValue + '))' : it.usePattern($schema); - out += 'if ( '; - if ($isData) { - out += ' (' + ($schemaValue) + ' !== undefined && typeof ' + ($schemaValue) + ' != \'string\') || '; + this.used(node) + return true +} + +LruCache.prototype.used = function(node) { + this.list.moveToFront(node) +} + +LruCache.prototype.prune = function() { + var node = this.list.pop() + if (node != null) { + delete this.map[node.key] + this.capacity++ } - out += ' !' + ($regexp) + '.test(' + ($data) + ') ) { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; - if ($isData) { - out += '' + ($schemaValue); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should match pattern "'; - if ($isData) { - out += '\' + ' + ($schemaValue) + ' + \''; - } else { - out += '' + (it.util.escapeQuotes($schema)); - } - out += '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + (it.util.toQuotedString($schema)); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; +} + + +function DoublyLinkedList() { + this.firstNode = null + this.lastNode = null +} + +DoublyLinkedList.prototype.moveToFront = function(node) { + if (this.firstNode == node) return + + this.remove(node) + + if (this.firstNode == null) { + this.firstNode = node + this.lastNode = node + node.prev = null + node.next = null } else { - out += ' {} '; + node.prev = null + node.next = this.firstNode + node.next.prev = node + this.firstNode = node } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; +} + +DoublyLinkedList.prototype.pop = function() { + var lastNode = this.lastNode + if (lastNode != null) { + this.remove(lastNode) } - out += '} '; - if ($breakOnError) { - out += ' else { '; + return lastNode +} + +DoublyLinkedList.prototype.remove = function(node) { + if (this.firstNode == node) { + this.firstNode = node.next + } else if (node.prev != null) { + node.prev.next = node.next } - return out; + if (this.lastNode == node) { + this.lastNode = node.prev + } else if (node.next != null) { + node.next.prev = node.prev + } +} + + +function DoublyLinkedNode(key, val) { + this.key = key + this.val = val + this.prev = null + this.next = null } /***/ }), -/* 494 */ +/* 492 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -module.exports = function generate_properties(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl; - var $schemaKeys = Object.keys($schema || {}), - $pProperties = it.schema.patternProperties || {}, - $pPropertyKeys = Object.keys($pProperties), - $aProperties = it.schema.additionalProperties, - $someProperties = $schemaKeys.length || $pPropertyKeys.length, - $noAdditional = $aProperties === false, - $additionalIsSchema = typeof $aProperties == 'object' && Object.keys($aProperties).length, - $removeAdditional = it.opts.removeAdditional, - $checkAdditional = $noAdditional || $additionalIsSchema || $removeAdditional, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - var $required = it.schema.required; - if ($required && !(it.opts.v5 && $required.$data) && $required.length < it.opts.loopRequired) var $requiredHash = it.util.toHash($required); - if (it.opts.patternGroups) { - var $pgProperties = it.schema.patternGroups || {}, - $pgPropertyKeys = Object.keys($pgProperties); - } - out += 'var ' + ($errs) + ' = errors;var ' + ($nextValid) + ' = true;'; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined;'; - } - if ($checkAdditional) { - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - if ($someProperties) { - out += ' var isAdditional' + ($lvl) + ' = !(false '; - if ($schemaKeys.length) { - if ($schemaKeys.length > 5) { - out += ' || validate.schema' + ($schemaPath) + '[' + ($key) + '] '; - } else { - var arr1 = $schemaKeys; - if (arr1) { - var $propertyKey, i1 = -1, - l1 = arr1.length - 1; - while (i1 < l1) { - $propertyKey = arr1[i1 += 1]; - out += ' || ' + ($key) + ' == ' + (it.util.toQuotedString($propertyKey)) + ' '; - } - } - } - } - if ($pPropertyKeys.length) { - var arr2 = $pPropertyKeys; - if (arr2) { - var $pProperty, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $pProperty = arr2[$i += 1]; - out += ' || ' + (it.usePattern($pProperty)) + '.test(' + ($key) + ') '; - } - } - } - if (it.opts.patternGroups && $pgPropertyKeys.length) { - var arr3 = $pgPropertyKeys; - if (arr3) { - var $pgProperty, $i = -1, - l3 = arr3.length - 1; - while ($i < l3) { - $pgProperty = arr3[$i += 1]; - out += ' || ' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ') '; - } - } - } - out += ' ); if (isAdditional' + ($lvl) + ') { '; - } - if ($removeAdditional == 'all') { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +exports.default = function (message) { + return { + useless: true, + run() { + throw new (_errors || _load_errors()).MessageError(message); + }, + setFlags: () => {}, + hasWrapper: () => true + }; +}; + +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(6); +} + +/***/ }), +/* 493 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.examples = exports.hasWrapper = exports.run = undefined; +exports.setFlags = setFlags; + +var _buildSubCommands2; + +function _load_buildSubCommands() { + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(59)); +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const notYetImplemented = () => Promise.reject(new Error('This command is not implemented yet.')); + +function setFlags(commander) { + commander.description('Has not been implemented yet'); +} + +var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).default)('access', { + public: notYetImplemented, + restricted: notYetImplemented, + grant: notYetImplemented, + revoke: notYetImplemented, + lsPackages: notYetImplemented, + lsCollaborators: notYetImplemented, + edit: notYetImplemented +}, ['WARNING: This command yet to be implemented.', 'public []', 'restricted []', 'grant []', 'revoke []', 'ls-packages [||]', 'ls-collaborators [ []]', 'edit []']); + +const run = _buildSubCommands.run, + hasWrapper = _buildSubCommands.hasWrapper, + examples = _buildSubCommands.examples; +exports.run = run; +exports.hasWrapper = hasWrapper; +exports.examples = examples; + +/***/ }), +/* 494 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = undefined; + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} + +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const binFolder = path.join(config.cwd, config.registryFolders[0], '.bin'); + if (args.length === 0) { + reporter.log(binFolder, { force: true }); } else { - var $currentErrorPath = it.errorPath; - var $additionalProperty = '\' + ' + $key + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - } - if ($noAdditional) { - if ($removeAdditional) { - out += ' delete ' + ($data) + '[' + ($key) + ']; '; - } else { - out += ' ' + ($nextValid) + ' = false; '; - var $currErrSchemaPath = $errSchemaPath; - $errSchemaPath = it.errSchemaPath + '/additionalProperties'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have additional properties\' '; - } - if (it.opts.verbose) { - out += ' , schema: false , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - out += ' break; '; - } - } - } else if ($additionalIsSchema) { - if ($removeAdditional == 'failing') { - out += ' var ' + ($errs) + ' = errors; '; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - out += ' if (!' + ($nextValid) + ') { errors = ' + ($errs) + '; if (validate.errors !== null) { if (errors) validate.errors.length = errors; else validate.errors = null; } delete ' + ($data) + '[' + ($key) + ']; } '; - it.compositeRule = $it.compositeRule = $wasComposite; - } else { - $it.schema = $aProperties; - $it.schemaPath = it.schemaPath + '.additionalProperties'; - $it.errSchemaPath = it.errSchemaPath + '/additionalProperties'; - $it.errorPath = it.opts._errorDataPathProperty ? it.errorPath : it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - } - } - it.errorPath = $currentErrorPath; - } - if ($someProperties) { - out += ' } '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - var $useDefaults = it.opts.useDefaults && !it.compositeRule; - if ($schemaKeys.length) { - var arr4 = $schemaKeys; - if (arr4) { - var $propertyKey, i4 = -1, - l4 = arr4.length - 1; - while (i4 < l4) { - $propertyKey = arr4[i4 += 1]; - var $sch = $schema[$propertyKey]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - var $prop = it.util.getProperty($propertyKey), - $passData = $data + $prop, - $hasDefault = $useDefaults && $sch.default !== undefined; - $it.schema = $sch; - $it.schemaPath = $schemaPath + $prop; - $it.errSchemaPath = $errSchemaPath + '/' + it.util.escapeFragment($propertyKey); - $it.errorPath = it.util.getPath(it.errorPath, $propertyKey, it.opts.jsonPointers); - $it.dataPathArr[$dataNxt] = it.util.toQuotedString($propertyKey); - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - $code = it.util.varReplace($code, $nextData, $passData); - var $useData = $passData; - } else { - var $useData = $nextData; - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; '; - } - if ($hasDefault) { - out += ' ' + ($code) + ' '; - } else { - if ($requiredHash && $requiredHash[$propertyKey]) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = false; '; - var $currentErrorPath = it.errorPath, - $currErrSchemaPath = $errSchemaPath, - $missingProperty = it.util.escapeQuotes($propertyKey); - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - $errSchemaPath = it.errSchemaPath + '/required'; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - $errSchemaPath = $currErrSchemaPath; - it.errorPath = $currentErrorPath; - out += ' } else { '; - } else { - if ($breakOnError) { - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { ' + ($nextValid) + ' = true; } else { '; - } else { - out += ' if (' + ($useData) + ' !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ' ) { '; - } - } - out += ' ' + ($code) + ' } '; - } - } - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - if ($pPropertyKeys.length) { - var arr5 = $pPropertyKeys; - if (arr5) { - var $pProperty, i5 = -1, - l5 = arr5.length - 1; - while (i5 < l5) { - $pProperty = arr5[i5 += 1]; - var $sch = $pProperties[$pProperty]; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternProperties' + it.util.getProperty($pProperty); - $it.errSchemaPath = it.errSchemaPath + '/patternProperties/' + it.util.escapeFragment($pProperty); - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' if (' + (it.usePattern($pProperty)) + '.test(' + ($key) + ')) { '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else ' + ($nextValid) + ' = true; '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - } - } - } - } - if (it.opts.patternGroups && $pgPropertyKeys.length) { - var arr6 = $pgPropertyKeys; - if (arr6) { - var $pgProperty, i6 = -1, - l6 = arr6.length - 1; - while (i6 < l6) { - $pgProperty = arr6[i6 += 1]; - var $pgSchema = $pgProperties[$pgProperty], - $sch = $pgSchema.schema; - if (it.util.schemaHasRules($sch, it.RULES.all)) { - $it.schema = $sch; - $it.schemaPath = it.schemaPath + '.patternGroups' + it.util.getProperty($pgProperty) + '.schema'; - $it.errSchemaPath = it.errSchemaPath + '/patternGroups/' + it.util.escapeFragment($pgProperty) + '/schema'; - out += ' var pgPropCount' + ($lvl) + ' = 0; '; - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' if (' + (it.usePattern($pgProperty)) + '.test(' + ($key) + ')) { pgPropCount' + ($lvl) + '++; '; - $it.errorPath = it.util.getPathExpr(it.errorPath, $key, it.opts.jsonPointers); - var $passData = $data + '[' + $key + ']'; - $it.dataPathArr[$dataNxt] = $key; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - if ($breakOnError) { - out += ' if (!' + ($nextValid) + ') break; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else ' + ($nextValid) + ' = true; '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - $closingBraces += '}'; - } - var $pgMin = $pgSchema.minimum, - $pgMax = $pgSchema.maximum; - if ($pgMin !== undefined || $pgMax !== undefined) { - out += ' var ' + ($valid) + ' = true; '; - var $currErrSchemaPath = $errSchemaPath; - if ($pgMin !== undefined) { - var $limit = $pgMin, - $reason = 'minimum', - $moreOrLess = 'less'; - out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' >= ' + ($pgMin) + '; '; - $errSchemaPath = it.errSchemaPath + '/patternGroups/minimum'; - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($pgMax !== undefined) { - out += ' else '; - } - } - if ($pgMax !== undefined) { - var $limit = $pgMax, - $reason = 'maximum', - $moreOrLess = 'more'; - out += ' ' + ($valid) + ' = pgPropCount' + ($lvl) + ' <= ' + ($pgMax) + '; '; - $errSchemaPath = it.errSchemaPath + '/patternGroups/maximum'; - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have ' + ($moreOrLess) + ' than ' + ($limit) + ' properties matching pattern "' + (it.util.escapeQuotes($pgProperty)) + '"\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - } - $errSchemaPath = $currErrSchemaPath; - if ($breakOnError) { - out += ' if (' + ($valid) + ') { '; - $closingBraces += '}'; - } - } - } + const binEntries = yield (0, (_run || _load_run()).getBinEntries)(config); + + const binName = args[0]; + const binPath = binEntries.get(binName); + + if (binPath) { + reporter.log(binPath, { force: true }); + } else { + reporter.error(reporter.lang('packageBinaryNotFound', binName)); } } - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; - } - out = it.util.cleanUpCode(out); - return out; + }); + + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); + +exports.hasWrapper = hasWrapper; +exports.setFlags = setFlags; + +var _run; + +function _load_run() { + return _run = __webpack_require__(354); +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const path = __webpack_require__(0); + +function hasWrapper(commander) { + return false; } +function setFlags(commander) { + commander.description('Displays the location of the yarn bin folder.'); +} /***/ }), /* 495 */ @@ -92614,87 +91686,119 @@ module.exports = function generate_properties(it, $keyword, $ruleType) { "use strict"; -module.exports = function generate_propertyNames(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $errs = 'errs__' + $lvl; - var $it = it.util.copy(it); - var $closingBraces = ''; - $it.level++; - var $nextValid = 'valid' + $it.level; - if (it.util.schemaHasRules($schema, it.RULES.all)) { - $it.schema = $schema; - $it.schemaPath = $schemaPath; - $it.errSchemaPath = $errSchemaPath; - var $key = 'key' + $lvl, - $idx = 'idx' + $lvl, - $i = 'i' + $lvl, - $invalidName = '\' + ' + $key + ' + \'', - $dataNxt = $it.dataLevel = it.dataLevel + 1, - $nextData = 'data' + $dataNxt, - $dataProperties = 'dataProperties' + $lvl, - $ownProperties = it.opts.ownProperties, - $currentBaseId = it.baseId; - out += ' var ' + ($errs) + ' = errors; '; - if ($ownProperties) { - out += ' var ' + ($dataProperties) + ' = undefined; '; - } - if ($ownProperties) { - out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; '; - } else { - out += ' for (var ' + ($key) + ' in ' + ($data) + ') { '; - } - out += ' var startErrs' + ($lvl) + ' = errors; '; - var $passData = $key; - var $wasComposite = it.compositeRule; - it.compositeRule = $it.compositeRule = true; - var $code = it.validate($it); - $it.baseId = $currentBaseId; - if (it.util.varOccurences($code, $nextData) < 2) { - out += ' ' + (it.util.varReplace($code, $nextData, $passData)) + ' '; - } else { - out += ' var ' + ($nextData) + ' = ' + ($passData) + '; ' + ($code) + ' '; - } - it.compositeRule = $it.compositeRule = $wasComposite; - out += ' if (!' + ($nextValid) + ') { for (var ' + ($i) + '=startErrs' + ($lvl) + '; ' + ($i) + ' 2) { + return false; } - out += ' } '; - } else { - out += ' {} '; + const key = args[0]; + var _args$ = args[1]; + const val = _args$ === undefined ? true : _args$; + + const yarnConfig = config.registries.yarn; + yield yarnConfig.saveHomeConfig({ [key]: val }); + reporter.success(reporter.lang('configSet', key, val)); + return true; + })(); + }, + + get(config, reporter, flags, args) { + if (args.length !== 1) { + return false; } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError(vErrors); '; - } else { - out += ' validate.errors = vErrors; return false; '; + + reporter.log(String(config.getOption(args[0])), { force: true }); + return true; + }, + + delete: (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + if (args.length !== 1) { + return false; } + + const key = args[0]; + const yarnConfig = config.registries.yarn; + yield yarnConfig.saveHomeConfig({ [key]: undefined }); + reporter.success(reporter.lang('configDelete', key)); + return true; + }); + + function _delete(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); } - if ($breakOnError) { - out += ' break; '; + + return _delete; + })(), + + list(config, reporter, flags, args) { + if (args.length) { + return false; } - out += ' } }'; - } - if ($breakOnError) { - out += ' ' + ($closingBraces) + ' if (' + ($errs) + ' == errors) {'; + + reporter.info(reporter.lang('configYarn')); + reporter.inspect(config.registries.yarn.config); + + reporter.info(reporter.lang('configNpm')); + reporter.inspect(config.registries.npm.config); + + return true; + }, + + current(config, reporter, flags, args) { + if (args.length) { + return false; + } + + reporter.log(JSON.stringify(config, CONFIG_KEYS, 2), { force: true }); + + return true; } - out = it.util.cleanUpCode(out); - return out; -} +}); +const run = _buildSubCommands.run, + examples = _buildSubCommands.examples; +exports.run = run; +exports.examples = examples; /***/ }), /* 496 */ @@ -92702,129 +91806,139 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) { "use strict"; -module.exports = function generate_ref(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $async, $refCode; - if ($schema == '#' || $schema == '#/') { - if (it.isRoot) { - $async = it.async; - $refCode = 'validate'; - } else { - $async = it.root.schema.$async === true; - $refCode = 'root.refVal[0]'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = undefined; + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} + +var _extends2; + +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(20)); +} + +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const builderName = args[0], + rest = args.slice(1); + + + if (!builderName) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('invalidPackageName')); } - } else { - var $refVal = it.resolveRef(it.baseId, $schema, it.isRoot); - if ($refVal === undefined) { - var $message = it.MissingRefError.message(it.baseId, $schema); - if (it.opts.missingRefs == 'fail') { - it.logger.error($message); - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \'can\\\'t resolve reference ' + (it.util.escapeQuotes($schema)) + '\' '; - } - if (it.opts.verbose) { - out += ' , schema: ' + (it.util.toQuotedString($schema)) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - if ($breakOnError) { - out += ' if (false) { '; - } - } else if (it.opts.missingRefs == 'ignore') { - it.logger.warn($message); - if ($breakOnError) { - out += ' if (true) { '; - } - } else { - throw new it.MissingRefError(it.baseId, $schema, $message); - } - } else if ($refVal.inline) { - var $it = it.util.copy(it); - $it.level++; - var $nextValid = 'valid' + $it.level; - $it.schema = $refVal.schema; - $it.schemaPath = ''; - $it.errSchemaPath = $schema; - var $code = it.validate($it).replace(/validate\.schema/g, $refVal.code); - out += ' ' + ($code) + ' '; - if ($breakOnError) { - out += ' if (' + ($nextValid) + ') { '; - } + + var _coerceCreatePackageN = coerceCreatePackageName(builderName); + + const packageName = _coerceCreatePackageN.fullName, + commandName = _coerceCreatePackageN.name; + + + const linkLoc = path.join(config.linkFolder, commandName); + if (yield (_fs || _load_fs()).exists(linkLoc)) { + reporter.info(reporter.lang('linkUsing', packageName)); } else { - $async = $refVal.$async === true; - $refCode = $refVal.code; + yield (0, (_global || _load_global()).run)(config, reporter, {}, ['add', packageName]); } + + const binFolder = yield (0, (_global || _load_global()).getBinFolder)(config, {}); + const command = path.resolve(binFolder, commandName); + const env = yield (0, (_executeLifecycleScript || _load_executeLifecycleScript()).makeEnv)('create', config.cwd, config); + + yield (_child || _load_child()).spawn(command, rest, { stdio: `inherit`, shell: true, env }); + }); + + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); + +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; +exports.parsePackageName = parsePackageName; +exports.coerceCreatePackageName = coerceCreatePackageName; + +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(6); +} + +var _child; + +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(50)); +} + +var _executeLifecycleScript; + +function _load_executeLifecycleScript() { + return _executeLifecycleScript = __webpack_require__(111); +} + +var _fs; + +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(5)); +} + +var _global; + +function _load_global() { + return _global = __webpack_require__(121); +} + +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const path = __webpack_require__(0); + +function setFlags(commander) { + commander.description('Creates new projects from any create-* starter kits.'); +} + +function hasWrapper(commander, args) { + return true; +} + +function parsePackageName(str) { + if (str.charAt(0) === '/') { + throw new Error(`Name should not start with "/", got "${str}"`); } - if ($refCode) { - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; - if (it.opts.passContext) { - out += ' ' + ($refCode) + '.call(this, '; - } else { - out += ' ' + ($refCode) + '( '; - } - out += ' ' + ($data) + ', (dataPath || \'\')'; - if (it.errorPath != '""') { - out += ' + ' + (it.errorPath); - } - var $parentData = $dataLvl ? 'data' + (($dataLvl - 1) || '') : 'parentData', - $parentDataProperty = $dataLvl ? it.dataPathArr[$dataLvl] : 'parentDataProperty'; - out += ' , ' + ($parentData) + ' , ' + ($parentDataProperty) + ', rootData) '; - var __callValidate = out; - out = $$outStack.pop(); - if ($async) { - if (!it.async) throw new Error('async schema referenced by sync schema'); - if ($breakOnError) { - out += ' var ' + ($valid) + '; '; - } - out += ' try { ' + (it.yieldAwait) + ' ' + (__callValidate) + '; '; - if ($breakOnError) { - out += ' ' + ($valid) + ' = true; '; - } - out += ' } catch (e) { if (!(e instanceof ValidationError)) throw e; if (vErrors === null) vErrors = e.errors; else vErrors = vErrors.concat(e.errors); errors = vErrors.length; '; - if ($breakOnError) { - out += ' ' + ($valid) + ' = false; '; - } - out += ' } '; - if ($breakOnError) { - out += ' if (' + ($valid) + ') { '; - } - } else { - out += ' if (!' + (__callValidate) + ') { if (vErrors === null) vErrors = ' + ($refCode) + '.errors; else vErrors = vErrors.concat(' + ($refCode) + '.errors); errors = vErrors.length; } '; - if ($breakOnError) { - out += ' else { '; - } - } + if (str.charAt(0) === '.') { + throw new Error(`Name should not start with ".", got "${str}"`); } - return out; + const parts = str.split('/'); + const isScoped = str.charAt(0) === '@'; + if (isScoped && parts[0] === '@') { + throw new Error(`Scope should not be empty, got "${str}"`); + } + const scope = isScoped ? parts[0] : ''; + const name = parts[isScoped ? 1 : 0] || ''; + const path = parts.slice(isScoped ? 2 : 1).join('/'); + const fullName = [scope, name].filter(Boolean).join('/'); + const full = [scope, name, path].filter(Boolean).join('/'); + + return { fullName, name, scope, path, full }; } +function coerceCreatePackageName(str) { + const pkgNameObj = parsePackageName(str); + const coercedName = pkgNameObj.name !== '' ? `create-${pkgNameObj.name}` : `create`; + const coercedPkgNameObj = (0, (_extends2 || _load_extends()).default)({}, pkgNameObj, { + name: coercedName, + fullName: [pkgNameObj.scope, coercedName].filter(Boolean).join('/'), + full: [pkgNameObj.scope, coercedName, pkgNameObj.path].filter(Boolean).join('/') + }); + return coercedPkgNameObj; +} /***/ }), /* 497 */ @@ -92832,2852 +91946,2194 @@ module.exports = function generate_ref(it, $keyword, $ruleType) { "use strict"; -module.exports = function generate_required(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - var $vSchema = 'schema' + $lvl; - if (!$isData) { - if ($schema.length < it.opts.loopRequired && it.schema.properties && Object.keys(it.schema.properties).length) { - var $required = []; - var arr1 = $schema; - if (arr1) { - var $property, i1 = -1, - l1 = arr1.length - 1; - while (i1 < l1) { - $property = arr1[i1 += 1]; - var $propertySch = it.schema.properties[$property]; - if (!($propertySch && it.util.schemaHasRules($propertySch, it.RULES.all))) { - $required[$required.length] = $property; - } - } - } - } else { - var $required = $schema; - } - } - if ($isData || $required.length) { - var $currentErrorPath = it.errorPath, - $loopRequired = $isData || $required.length >= it.opts.loopRequired, - $ownProperties = it.opts.ownProperties; - if ($breakOnError) { - out += ' var missing' + ($lvl) + '; '; - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - out += ' var ' + ($valid) + ' = true; '; - if ($isData) { - out += ' if (schema' + ($lvl) + ' === undefined) ' + ($valid) + ' = true; else if (!Array.isArray(schema' + ($lvl) + ')) ' + ($valid) + ' = false; else {'; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { ' + ($valid) + ' = ' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] !== undefined '; - if ($ownProperties) { - out += ' && Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += '; if (!' + ($valid) + ') break; } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } else { - out += ' if ( '; - var arr2 = $required; - if (arr2) { - var $propertyKey, $i = -1, - l2 = arr2.length - 1; - while ($i < l2) { - $propertyKey = arr2[$i += 1]; - if ($i) { - out += ' || '; - } - var $prop = it.util.getProperty($propertyKey), - $useData = $data + $prop; - out += ' ( ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') && (missing' + ($lvl) + ' = ' + (it.util.toQuotedString(it.opts.jsonPointers ? $propertyKey : $prop)) + ') ) '; - } - } - out += ') { '; - var $propertyPath = 'missing' + $lvl, - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.opts.jsonPointers ? it.util.getPathExpr($currentErrorPath, $propertyPath, true) : $currentErrorPath + ' + ' + $propertyPath; - } - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } else { '; - } - } else { - if ($loopRequired) { - if (!$isData) { - out += ' var ' + ($vSchema) + ' = validate.schema' + ($schemaPath) + '; '; - } - var $i = 'i' + $lvl, - $propertyPath = 'schema' + $lvl + '[' + $i + ']', - $missingProperty = '\' + ' + $propertyPath + ' + \''; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPathExpr($currentErrorPath, $propertyPath, it.opts.jsonPointers); - } - if ($isData) { - out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } else if (' + ($vSchema) + ' !== undefined) { '; - } - out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', ' + ($vSchema) + '[' + ($i) + ']) '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } } '; - if ($isData) { - out += ' } '; - } - } else { - var arr3 = $required; - if (arr3) { - var $propertyKey, i3 = -1, - l3 = arr3.length - 1; - while (i3 < l3) { - $propertyKey = arr3[i3 += 1]; - var $prop = it.util.getProperty($propertyKey), - $missingProperty = it.util.escapeQuotes($propertyKey), - $useData = $data + $prop; - if (it.opts._errorDataPathProperty) { - it.errorPath = it.util.getPath($currentErrorPath, $propertyKey, it.opts.jsonPointers); - } - out += ' if ( ' + ($useData) + ' === undefined '; - if ($ownProperties) { - out += ' || ! Object.prototype.hasOwnProperty.call(' + ($data) + ', \'' + (it.util.escapeQuotes($propertyKey)) + '\') '; - } - out += ') { var err = '; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; - if (it.opts.messages !== false) { - out += ' , message: \''; - if (it.opts._errorDataPathProperty) { - out += 'is a required property'; - } else { - out += 'should have required property \\\'' + ($missingProperty) + '\\\''; - } - out += '\' '; - } - if (it.opts.verbose) { - out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } '; - } - } - } - } - it.errorPath = $currentErrorPath; - } else if ($breakOnError) { - out += ' if (true) {'; - } - return out; -} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = undefined; -/***/ }), -/* 498 */ -/***/ (function(module, exports, __webpack_require__) { +var _asyncToGenerator2; -"use strict"; +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} -module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { - var out = ' '; - var $lvl = it.level; - var $dataLvl = it.dataLevel; - var $schema = it.schema[$keyword]; - var $schemaPath = it.schemaPath + it.util.getProperty($keyword); - var $errSchemaPath = it.errSchemaPath + '/' + $keyword; - var $breakOnError = !it.opts.allErrors; - var $data = 'data' + ($dataLvl || ''); - var $valid = 'valid' + $lvl; - var $isData = it.opts.$data && $schema && $schema.$data, - $schemaValue; - if ($isData) { - out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; '; - $schemaValue = 'schema' + $lvl; - } else { - $schemaValue = $schema; - } - if (($schema || $isData) && it.opts.uniqueItems !== false) { - if ($isData) { - out += ' var ' + ($valid) + '; if (' + ($schemaValue) + ' === false || ' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'boolean\') ' + ($valid) + ' = false; else { '; - } - out += ' var ' + ($valid) + ' = true; if (' + ($data) + '.length > 1) { var i = ' + ($data) + '.length, j; outer: for (;i--;) { for (j = i; j--;) { if (equal(' + ($data) + '[i], ' + ($data) + '[j])) { ' + ($valid) + ' = false; break outer; } } } } '; - if ($isData) { - out += ' } '; - } - out += ' if (!' + ($valid) + ') { '; - var $$outStack = $$outStack || []; - $$outStack.push(out); - out = ''; /* istanbul ignore else */ - if (it.createErrors !== false) { - out += ' { keyword: \'' + ('uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; - if (it.opts.messages !== false) { - out += ' , message: \'should NOT have duplicate items (items ## \' + j + \' and \' + i + \' are identical)\' '; - } - if (it.opts.verbose) { - out += ' , schema: '; - if ($isData) { - out += 'validate.schema' + ($schemaPath); - } else { - out += '' + ($schema); - } - out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' '; - } - out += ' } '; - } else { - out += ' {} '; - } - var __err = out; - out = $$outStack.pop(); - if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */ - if (it.async) { - out += ' throw new ValidationError([' + (__err) + ']); '; - } else { - out += ' validate.errors = [' + (__err) + ']; return false; '; - } - } else { - out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; '; - } - out += ' } '; - if ($breakOnError) { - out += ' else { '; - } - } else { - if ($breakOnError) { - out += ' if (true) { '; +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const env = yield (0, (_executeLifecycleScript || _load_executeLifecycleScript()).makeEnv)(`exec`, config.cwd, config); + + if (args.length < 1) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('execMissingCommand')); } - } - return out; -} + const execName = args[0], + rest = args.slice(1); -/***/ }), -/* 499 */ -/***/ (function(module, exports, __webpack_require__) { + yield (_child || _load_child()).spawn(execName, rest, { stdio: 'inherit', env }); + }); -"use strict"; + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; -var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; -var customRuleCode = __webpack_require__(485); +var _errors; -module.exports = { - add: addKeyword, - get: getKeyword, - remove: removeKeyword -}; +function _load_errors() { + return _errors = __webpack_require__(6); +} -/** - * Define custom keyword - * @this Ajv - * @param {String} keyword custom keyword, should be unique (including different from all standard, custom and macro keywords). - * @param {Object} definition keyword definition object with properties `type` (type(s) which the keyword applies to), `validate` or `compile`. - * @return {Ajv} this for method chaining - */ -function addKeyword(keyword, definition) { - /* jshint validthis: true */ - /* eslint no-shadow: 0 */ - var RULES = this.RULES; +var _child; - if (RULES.keywords[keyword]) - throw new Error('Keyword ' + keyword + ' is already defined'); +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(50)); +} - if (!IDENTIFIER.test(keyword)) - throw new Error('Keyword ' + keyword + ' is not a valid identifier'); +var _executeLifecycleScript; - if (definition) { - if (definition.macro && definition.valid !== undefined) - throw new Error('"valid" option cannot be used with macro keywords'); +function _load_executeLifecycleScript() { + return _executeLifecycleScript = __webpack_require__(111); +} - var dataType = definition.type; - if (Array.isArray(dataType)) { - var i, len = dataType.length; - for (i=0; i { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + let manifest; + if (flags.useManifest) { + manifest = yield config.readJson(flags.useManifest); + } else { + manifest = yield config.readRootManifest(); + } + if (!manifest.name) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('noName')); + } + if (!manifest.version) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('noVersion')); } - var rule = { - keyword: keyword, - definition: definition, - custom: true, - code: customRuleCode, - implements: definition.implements + const entry = { + name: manifest.name, + version: manifest.version, + resolved: flags.resolved, + registry: flags.registry || manifest._registry, + optionalDependencies: manifest.optionalDependencies, + dependencies: manifest.dependencies }; - ruleGroup.rules.push(rule); - RULES.custom[keyword] = rule; - } + const pattern = flags.pattern || `${entry.name}@${entry.version}`; + reporter.log((0, (_lockfile || _load_lockfile()).stringify)({ + [pattern]: (0, (_lockfile || _load_lockfile()).implodeEntry)(pattern, entry) + })); + }); + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); - function checkDataType(dataType) { - if (!RULES.types[dataType]) throw new Error('Unknown type ' + dataType); - } +exports.hasWrapper = hasWrapper; +exports.setFlags = setFlags; - return this; +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(6); } +var _lockfile; -/** - * Get keyword - * @this Ajv - * @param {String} keyword pre-defined or custom keyword. - * @return {Object|Boolean} custom keyword definition, `true` if it is a predefined keyword, `false` otherwise. - */ -function getKeyword(keyword) { - /* jshint validthis: true */ - var rule = this.RULES.custom[keyword]; - return rule ? rule.definition : this.RULES.keywords[keyword] || false; +function _load_lockfile() { + return _lockfile = __webpack_require__(19); } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/** - * Remove keyword - * @this Ajv - * @param {String} keyword pre-defined or custom keyword. - * @return {Ajv} this for method chaining - */ -function removeKeyword(keyword) { - /* jshint validthis: true */ - var RULES = this.RULES; - delete RULES.keywords[keyword]; - delete RULES.all[keyword]; - delete RULES.custom[keyword]; - for (var i=0; i', 'description'); + commander.option('--resolved ', 'description'); + commander.option('--registry ', 'description'); } +const examples = exports.examples = ['generate-lock-entry', 'generate-lock-entry --use-manifest ./package.json', 'generate-lock-entry --resolved local-file.tgz#hash']; /***/ }), -/* 500 */ +/* 499 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var META_SCHEMA_ID = 'http://json-schema.org/draft-06/schema'; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.hasWrapper = hasWrapper; +exports.setFlags = setFlags; +exports.run = run; -module.exports = function (ajv) { - var defaultMeta = ajv._opts.defaultMeta; - var metaSchemaRef = typeof defaultMeta == 'string' - ? { $ref: defaultMeta } - : ajv.getSchema(META_SCHEMA_ID) - ? { $ref: META_SCHEMA_ID } - : {}; +var _index; - ajv.addKeyword('patternGroups', { - // implemented in properties.jst - metaSchema: { - type: 'object', - additionalProperties: { - type: 'object', - required: [ 'schema' ], - properties: { - maximum: { - type: 'integer', - minimum: 0 - }, - minimum: { - type: 'integer', - minimum: 0 - }, - schema: metaSchemaRef - }, - additionalProperties: false - } - } - }); - ajv.RULES.all.properties.implements.push('patternGroups'); -}; +function _load_index() { + return _index = _interopRequireDefault(__webpack_require__(334)); +} +var _constants; -/***/ }), -/* 501 */ -/***/ (function(module, exports) { +function _load_constants() { + return _constants = _interopRequireWildcard(__webpack_require__(8)); +} -module.exports = {"$schema":"http://json-schema.org/draft-06/schema#","$id":"https://raw.githubusercontent.com/epoberezkin/ajv/master/lib/refs/$data.json#","description":"Meta-schema for $data reference (JSON-schema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false} +var _misc; -/***/ }), -/* 502 */ -/***/ (function(module, exports) { +function _load_misc() { + return _misc = __webpack_require__(18); +} -module.exports = {"$schema":"http://json-schema.org/draft-06/schema#","$id":"http://json-schema.org/draft-06/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"title":{"type":"string"},"description":{"type":"string"},"default":{},"examples":{"type":"array","items":{}},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":{}},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":{},"enum":{"type":"array","minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":{}} +var _aliases; -/***/ }), -/* 503 */ -/***/ (function(module, exports, __webpack_require__) { +function _load_aliases() { + return _aliases = _interopRequireDefault(__webpack_require__(346)); +} -"use strict"; +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var traverse = module.exports = function (schema, opts, cb) { - if (typeof opts == 'function') { - cb = opts; - opts = {}; - } - _traverse(opts, cb, schema, '', schema); -}; +const chalk = __webpack_require__(30); +function hasWrapper(flags, args) { + return false; +} -traverse.keywords = { - additionalItems: true, - items: true, - contains: true, - additionalProperties: true, - propertyNames: true, - not: true -}; +function setFlags(commander) { + commander.description('Displays help information.'); +} -traverse.arrayKeywords = { - items: true, - allOf: true, - anyOf: true, - oneOf: true -}; +function run(config, reporter, commander, args) { + if (args.length) { + const commandName = args.shift(); + if (Object.prototype.hasOwnProperty.call((_index || _load_index()).default, commandName)) { + const command = (_index || _load_index()).default[commandName]; + if (command) { + command.setFlags(commander); + const examples = (command.examples || []).map(example => ` $ yarn ${example}`); + if (examples.length) { + commander.on('--help', () => { + reporter.log(reporter.lang('helpExamples', reporter.rawText(examples.join('\n')))); + }); + } + // eslint-disable-next-line yarn-internal/warn-language + commander.on('--help', () => reporter.log(' ' + command.getDocsInfo + '\n')); + commander.help(); + return Promise.resolve(); + } + } + } -traverse.propsKeywords = { - definitions: true, - properties: true, - patternProperties: true, - dependencies: true -}; + commander.on('--help', () => { + const commandsText = []; + for (var _iterator = Object.keys((_index || _load_index()).default).sort((_misc || _load_misc()).sortAlpha), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; -traverse.skipKeywords = { - enum: true, - const: true, - required: true, - maximum: true, - minimum: true, - exclusiveMaximum: true, - exclusiveMinimum: true, - multipleOf: true, - maxLength: true, - minLength: true, - pattern: true, - format: true, - maxItems: true, - minItems: true, - uniqueItems: true, - maxProperties: true, - minProperties: true -}; + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; + } + const name = _ref; -function _traverse(opts, cb, schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex) { - if (schema && typeof schema == 'object' && !Array.isArray(schema)) { - cb(schema, jsonPtr, rootSchema, parentJsonPtr, parentKeyword, parentSchema, keyIndex); - for (var key in schema) { - var sch = schema[key]; - if (Array.isArray(sch)) { - if (key in traverse.arrayKeywords) { - for (var i=0; i (_aliases || _load_aliases()).default[key]).indexOf(name) > -1) { + continue; + } + if ((_aliases || _load_aliases()).default[name]) { + commandsText.push(` - ${(0, (_misc || _load_misc()).hyphenate)(name)} / ${(_aliases || _load_aliases()).default[name]}`); + } else { + commandsText.push(` - ${(0, (_misc || _load_misc()).hyphenate)(name)}`); } } - } -} + reporter.log(reporter.lang('helpCommands', reporter.rawText(commandsText.join('\n')))); + reporter.log(reporter.lang('helpCommandsMore', reporter.rawText(chalk.bold('yarn help COMMAND')))); + reporter.log(reporter.lang('helpLearnMore', reporter.rawText(chalk.bold((_constants || _load_constants()).YARN_DOCS)))); + }); + commander.options.sort((_misc || _load_misc()).sortOptionsByFlags); -function escapeJsonPtr(str) { - return str.replace(/~/g, '~0').replace(/\//g, '~1'); + commander.help(); + return Promise.resolve(); } - /***/ }), -/* 504 */ +/* 500 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const x = module.exports; -const ESC = '\u001B['; -const OSC = '\u001B]'; -const BEL = '\u0007'; -const SEP = ';'; -const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'; -x.cursorTo = (x, y) => { - if (typeof x !== 'number') { - throw new TypeError('The `x` argument is required'); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = exports.Import = exports.noArguments = undefined; - if (typeof y !== 'number') { - return ESC + (x + 1) + 'G'; - } +var _asyncToGenerator2; - return ESC + (y + 1) + ';' + (x + 1) + 'H'; -}; +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} -x.cursorMove = (x, y) => { - if (typeof x !== 'number') { - throw new TypeError('The `x` argument is required'); - } +let run = exports.run = (() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const imp = new Import(flags, config, reporter, new (_lockfile || _load_lockfile()).default({ cache: {} })); + yield imp.init(); + }); - let ret = ''; + return function run(_x, _x2, _x3, _x4) { + return _ref5.apply(this, arguments); + }; +})(); - if (x < 0) { - ret += ESC + (-x) + 'D'; - } else if (x > 0) { - ret += ESC + x + 'C'; - } +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; - if (y < 0) { - ret += ESC + (-y) + 'A'; - } else if (y > 0) { - ret += ESC + y + 'B'; - } +var _install; - return ret; -}; +function _load_install() { + return _install = __webpack_require__(34); +} -x.cursorUp = count => ESC + (typeof count === 'number' ? count : 1) + 'A'; -x.cursorDown = count => ESC + (typeof count === 'number' ? count : 1) + 'B'; -x.cursorForward = count => ESC + (typeof count === 'number' ? count : 1) + 'C'; -x.cursorBackward = count => ESC + (typeof count === 'number' ? count : 1) + 'D'; +var _check; -x.cursorLeft = ESC + 'G'; -x.cursorSavePosition = ESC + (isTerminalApp ? '7' : 's'); -x.cursorRestorePosition = ESC + (isTerminalApp ? '8' : 'u'); -x.cursorGetPosition = ESC + '6n'; -x.cursorNextLine = ESC + 'E'; -x.cursorPrevLine = ESC + 'F'; -x.cursorHide = ESC + '?25l'; -x.cursorShow = ESC + '?25h'; +function _load_check() { + return _check = __webpack_require__(350); +} -x.eraseLines = count => { - let clear = ''; +var _errors; - for (let i = 0; i < count; i++) { - clear += x.eraseLine + (i < count - 1 ? x.cursorUp() : ''); - } +function _load_errors() { + return _errors = __webpack_require__(6); +} - if (count) { - clear += x.cursorLeft; - } +var _index; - return clear; -}; +function _load_index() { + return _index = __webpack_require__(78); +} -x.eraseEndLine = ESC + 'K'; -x.eraseStartLine = ESC + '1K'; -x.eraseLine = ESC + '2K'; -x.eraseDown = ESC + 'J'; -x.eraseUp = ESC + '1J'; -x.eraseScreen = ESC + '2J'; -x.scrollUp = ESC + 'S'; -x.scrollDown = ESC + 'T'; +var _baseResolver; -x.clearScreen = '\u001Bc'; -x.beep = BEL; +function _load_baseResolver() { + return _baseResolver = _interopRequireDefault(__webpack_require__(123)); +} -x.link = (text, url) => { - return [ - OSC, - '8', - SEP, - SEP, - url, - BEL, - text, - OSC, - '8', - SEP, - SEP, - BEL - ].join(''); -}; +var _hostedGitResolver; -x.image = (buf, opts) => { - opts = opts || {}; +function _load_hostedGitResolver() { + return _hostedGitResolver = _interopRequireDefault(__webpack_require__(109)); +} - let ret = OSC + '1337;File=inline=1'; +var _hostedGitResolver2; - if (opts.width) { - ret += `;width=${opts.width}`; - } +function _load_hostedGitResolver2() { + return _hostedGitResolver2 = __webpack_require__(109); +} - if (opts.height) { - ret += `;height=${opts.height}`; - } +var _gistResolver; - if (opts.preserveAspectRatio === false) { - ret += ';preserveAspectRatio=0'; - } +function _load_gistResolver() { + return _gistResolver = _interopRequireDefault(__webpack_require__(214)); +} - return ret + ':' + buf.toString('base64') + BEL; -}; +var _gistResolver2; -x.iTerm = {}; +function _load_gistResolver2() { + return _gistResolver2 = __webpack_require__(214); +} -x.iTerm.setCwd = cwd => OSC + '50;CurrentDir=' + (cwd || process.cwd()) + BEL; +var _gitResolver; +function _load_gitResolver() { + return _gitResolver = _interopRequireDefault(__webpack_require__(124)); +} -/***/ }), -/* 505 */ -/***/ (function(module, exports, __webpack_require__) { +var _fileResolver; -"use strict"; +function _load_fileResolver() { + return _fileResolver = _interopRequireDefault(__webpack_require__(213)); +} -module.exports = function () { - return /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-PRZcf-nqry=><]/g; -}; +var _packageResolver; +function _load_packageResolver() { + return _packageResolver = _interopRequireDefault(__webpack_require__(360)); +} -/***/ }), -/* 506 */ -/***/ (function(module, exports, __webpack_require__) { +var _packageRequest; -"use strict"; -/* WEBPACK VAR INJECTION */(function(module) { -const colorConvert = __webpack_require__(608); +function _load_packageRequest() { + return _packageRequest = _interopRequireDefault(__webpack_require__(122)); +} -const wrapAnsi16 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${code + offset}m`; -}; +var _packageReference; -const wrapAnsi256 = (fn, offset) => function () { - const code = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};5;${code}m`; -}; +function _load_packageReference() { + return _packageReference = _interopRequireDefault(__webpack_require__(359)); +} -const wrapAnsi16m = (fn, offset) => function () { - const rgb = fn.apply(colorConvert, arguments); - return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; -}; +var _packageFetcher; -function assembleStyles() { - const codes = new Map(); - const styles = { - modifier: { - reset: [0, 0], - // 21 isn't widely supported and 22 does the same thing - bold: [1, 22], - dim: [2, 22], - italic: [3, 23], - underline: [4, 24], - inverse: [7, 27], - hidden: [8, 28], - strikethrough: [9, 29] - }, - color: { - black: [30, 39], - red: [31, 39], - green: [32, 39], - yellow: [33, 39], - blue: [34, 39], - magenta: [35, 39], - cyan: [36, 39], - white: [37, 39], - gray: [90, 39], +function _load_packageFetcher() { + return _packageFetcher = _interopRequireWildcard(__webpack_require__(208)); +} - // Bright color - redBright: [91, 39], - greenBright: [92, 39], - yellowBright: [93, 39], - blueBright: [94, 39], - magentaBright: [95, 39], - cyanBright: [96, 39], - whiteBright: [97, 39] - }, - bgColor: { - bgBlack: [40, 49], - bgRed: [41, 49], - bgGreen: [42, 49], - bgYellow: [43, 49], - bgBlue: [44, 49], - bgMagenta: [45, 49], - bgCyan: [46, 49], - bgWhite: [47, 49], +var _packageLinker; - // Bright color - bgBlackBright: [100, 49], - bgRedBright: [101, 49], - bgGreenBright: [102, 49], - bgYellowBright: [103, 49], - bgBlueBright: [104, 49], - bgMagentaBright: [105, 49], - bgCyanBright: [106, 49], - bgWhiteBright: [107, 49] - } - }; +function _load_packageLinker() { + return _packageLinker = _interopRequireDefault(__webpack_require__(209)); +} - // Fix humans - styles.color.grey = styles.color.gray; +var _packageCompatibility; - for (const groupName of Object.keys(styles)) { - const group = styles[groupName]; +function _load_packageCompatibility() { + return _packageCompatibility = _interopRequireWildcard(__webpack_require__(207)); +} - for (const styleName of Object.keys(group)) { - const style = group[styleName]; +var _lockfile; - styles[styleName] = { - open: `\u001B[${style[0]}m`, - close: `\u001B[${style[1]}m` - }; +function _load_lockfile() { + return _lockfile = _interopRequireDefault(__webpack_require__(19)); +} - group[styleName] = styles[styleName]; +var _normalizePattern9; - codes.set(style[0], style[1]); - } +function _load_normalizePattern() { + return _normalizePattern9 = __webpack_require__(37); +} - Object.defineProperty(styles, groupName, { - value: group, - enumerable: false - }); +var _logicalDependencyTree; - Object.defineProperty(styles, 'codes', { - value: codes, - enumerable: false - }); - } +function _load_logicalDependencyTree() { + return _logicalDependencyTree = __webpack_require__(550); +} - const ansi2ansi = n => n; - const rgb2rgb = (r, g, b) => [r, g, b]; +var _fs; - styles.color.close = '\u001B[39m'; - styles.bgColor.close = '\u001B[49m'; +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(5)); +} - styles.color.ansi = { - ansi: wrapAnsi16(ansi2ansi, 0) - }; - styles.color.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 0) - }; - styles.color.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 0) - }; +var _misc; - styles.bgColor.ansi = { - ansi: wrapAnsi16(ansi2ansi, 10) - }; - styles.bgColor.ansi256 = { - ansi256: wrapAnsi256(ansi2ansi, 10) - }; - styles.bgColor.ansi16m = { - rgb: wrapAnsi16m(rgb2rgb, 10) - }; - - for (let key of Object.keys(colorConvert)) { - if (typeof colorConvert[key] !== 'object') { - continue; - } - - const suite = colorConvert[key]; - - if (key === 'ansi16') { - key = 'ansi'; - } +function _load_misc() { + return _misc = _interopRequireWildcard(__webpack_require__(18)); +} - if ('ansi16' in suite) { - styles.color.ansi[key] = wrapAnsi16(suite.ansi16, 0); - styles.bgColor.ansi[key] = wrapAnsi16(suite.ansi16, 10); - } +var _constants; - if ('ansi256' in suite) { - styles.color.ansi256[key] = wrapAnsi256(suite.ansi256, 0); - styles.bgColor.ansi256[key] = wrapAnsi256(suite.ansi256, 10); - } +function _load_constants() { + return _constants = __webpack_require__(8); +} - if ('rgb' in suite) { - styles.color.ansi16m[key] = wrapAnsi16m(suite.rgb, 0); - styles.bgColor.ansi16m[key] = wrapAnsi16m(suite.rgb, 10); - } - } +var _semver; - return styles; +function _load_semver() { + return _semver = _interopRequireDefault(__webpack_require__(22)); } -// Make the export immutable -Object.defineProperty(module, 'exports', { - enumerable: true, - get: assembleStyles -}); +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(163)(module))) +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/***/ }), -/* 507 */ -/***/ (function(module, exports) { +const invariant = __webpack_require__(9); +const path = __webpack_require__(0); +const uuid = __webpack_require__(120); +const ssri = __webpack_require__(65); +const nodeVersion = process.versions.node.split('-')[0]; -function webpackEmptyContext(req) { - throw new Error("Cannot find module '" + req + "'."); -} -webpackEmptyContext.keys = function() { return []; }; -webpackEmptyContext.resolve = webpackEmptyContext; -module.exports = webpackEmptyContext; -webpackEmptyContext.id = 507; +const noArguments = exports.noArguments = true; -/***/ }), -/* 508 */ -/***/ (function(module, exports, __webpack_require__) { +class ImportResolver extends (_baseResolver || _load_baseResolver()).default { + getCwd() { + if (this.request.parentRequest) { + const parent = this.resolver.getStrictResolvedPattern(this.request.parentRequest.pattern); + invariant(parent._loc, 'expected package location'); + return path.dirname(parent._loc); + } + return this.config.cwd; + } -"use strict"; + resolveHostedGit(info, Resolver) { + var _normalizePattern = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); - // global key for user preferred registration -var REGISTRATION_KEY = '@@any-promise/REGISTRATION', - // Prior registration (preferred or detected) - registered = null + const range = _normalizePattern.range; -/** - * Registers the given implementation. An implementation must - * be registered prior to any call to `require("any-promise")`, - * typically on application load. - * - * If called with no arguments, will return registration in - * following priority: - * - * For Node.js: - * - * 1. Previous registration - * 2. global.Promise if node.js version >= 0.12 - * 3. Auto detected promise based on first sucessful require of - * known promise libraries. Note this is a last resort, as the - * loaded library is non-deterministic. node.js >= 0.12 will - * always use global.Promise over this priority list. - * 4. Throws error. - * - * For Browser: - * - * 1. Previous registration - * 2. window.Promise - * 3. Throws error. - * - * Options: - * - * Promise: Desired Promise constructor - * global: Boolean - Should the registration be cached in a global variable to - * allow cross dependency/bundle registration? (default true) - */ -module.exports = function(root, loadImplementation){ - return function register(implementation, opts){ - implementation = implementation || null - opts = opts || {} - // global registration unless explicitly {global: false} in options (default true) - var registerGlobal = opts.global !== false; + const exploded = (0, (_hostedGitResolver2 || _load_hostedGitResolver2()).explodeHostedGitFragment)(range, this.reporter); + const hash = info.gitHead; + invariant(hash, 'expected package gitHead'); + const url = Resolver.getTarballUrl(exploded, hash); + info._uid = hash; + info._remote = { + resolved: url, + type: 'tarball', + registry: this.registry, + reference: url, + hash: null + }; + return info; + } - // load any previous global registration - if(registered === null && registerGlobal){ - registered = root[REGISTRATION_KEY] || null - } + resolveGist(info, Resolver) { + var _normalizePattern2 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); - if(registered !== null - && implementation !== null - && registered.implementation !== implementation){ - // Throw error if attempting to redefine implementation - throw new Error('any-promise already defined as "'+registered.implementation+ - '". You can only register an implementation before the first '+ - ' call to require("any-promise") and an implementation cannot be changed') - } + const range = _normalizePattern2.range; - if(registered === null){ - // use provided implementation - if(implementation !== null && typeof opts.Promise !== 'undefined'){ - registered = { - Promise: opts.Promise, - implementation: implementation - } - } else { - // require implementation if implementation is specified but not provided - registered = loadImplementation(implementation) - } + var _explodeGistFragment = (0, (_gistResolver2 || _load_gistResolver2()).explodeGistFragment)(range, this.reporter); - if(registerGlobal){ - // register preference globally in case multiple installations - root[REGISTRATION_KEY] = registered - } - } + const id = _explodeGistFragment.id; - return registered + const hash = info.gitHead; + invariant(hash, 'expected package gitHead'); + const url = `https://gist.github.com/${id}.git`; + info._uid = hash; + info._remote = { + resolved: `${url}#${hash}`, + type: 'git', + registry: this.registry, + reference: url, + hash + }; + return info; } -} - - -/***/ }), -/* 509 */ -/***/ (function(module, exports, __webpack_require__) { -"use strict"; + resolveGit(info, Resolver) { + const url = info._resolved; + const hash = info.gitHead; + invariant(url, 'expected package _resolved'); + invariant(hash, 'expected package gitHead'); + info._uid = hash; + info._remote = { + resolved: `${url}#${hash}`, + type: 'git', + registry: this.registry, + reference: url, + hash + }; + return info; + } -module.exports = __webpack_require__(508)(global, loadImplementation); + resolveFile(info, Resolver) { + var _normalizePattern3 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); -/** - * Node.js version of loadImplementation. - * - * Requires the given implementation and returns the registration - * containing {Promise, implementation} - * - * If implementation is undefined or global.Promise, loads it - * Otherwise uses require - */ -function loadImplementation(implementation){ - var impl = null + const range = _normalizePattern3.range; - if(shouldPreferGlobalPromise(implementation)){ - // if no implementation or env specified use global.Promise - impl = { - Promise: global.Promise, - implementation: 'global.Promise' - } - } else if(implementation){ - // if implementation specified, require it - var lib = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()) - impl = { - Promise: lib.Promise || lib, - implementation: implementation + let loc = (_misc || _load_misc()).removePrefix(range, 'file:'); + if (!path.isAbsolute(loc)) { + loc = path.join(this.config.cwd, loc); } - } else { - // try to auto detect implementation. This is non-deterministic - // and should prefer other branches, but this is our last chance - // to load something without throwing error - impl = tryAutoDetect() + info._uid = info.version; + info._remote = { + type: 'copy', + registry: this.registry, + hash: `${uuid.v4()}-${new Date().getTime()}`, + reference: loc + }; + return info; } - if(impl === null){ - throw new Error('Cannot find any-promise implementation nor'+ - ' global.Promise. You must install polyfill or call'+ - ' require("any-promise/register") with your preferred'+ - ' implementation, e.g. require("any-promise/register/bluebird")'+ - ' on application load prior to any require("any-promise").') + resolveRegistry(info) { + let url = info._resolved; + const hash = info._shasum; + invariant(url, 'expected package _resolved'); + invariant(hash, 'expected package _shasum'); + if (this.config.getOption('registry') === (_constants || _load_constants()).YARN_REGISTRY) { + url = url.replace((_constants || _load_constants()).NPM_REGISTRY_RE, (_constants || _load_constants()).YARN_REGISTRY); + } + info._uid = info.version; + info._remote = { + resolved: `${url}#${hash}`, + type: 'tarball', + registry: this.registry, + reference: url, + integrity: info._integrity ? ssri.parse(info._integrity) : ssri.fromHex(hash, 'sha1'), + hash + }; + return info; } - return impl -} + resolveImport(info) { + var _normalizePattern4 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); -/** - * Determines if the global.Promise should be preferred if an implementation - * has not been registered. - */ -function shouldPreferGlobalPromise(implementation){ - if(implementation){ - return implementation === 'global.Promise' - } else if(typeof global.Promise !== 'undefined'){ - // Load global promise if implementation not specified - // Versions < 0.11 did not have global Promise - // Do not use for version < 0.12 as version 0.11 contained buggy versions - var version = (/v(\d+)\.(\d+)\.(\d+)/).exec(process.version) - return !(version && +version[1] == 0 && +version[2] < 12) + const range = _normalizePattern4.range; + + const Resolver = (0, (_index || _load_index()).getExoticResolver)(range); + if (Resolver && Resolver.prototype instanceof (_hostedGitResolver || _load_hostedGitResolver()).default) { + return this.resolveHostedGit(info, Resolver); + } else if (Resolver && Resolver === (_gistResolver || _load_gistResolver()).default) { + return this.resolveGist(info, Resolver); + } else if (Resolver && Resolver === (_gitResolver || _load_gitResolver()).default) { + return this.resolveGit(info, Resolver); + } else if (Resolver && Resolver === (_fileResolver || _load_fileResolver()).default) { + return this.resolveFile(info, Resolver); + } + return this.resolveRegistry(info); } - // do not have global.Promise or another implementation was specified - return false -} + resolveLocation(loc) { + var _this = this; -/** - * Look for common libs as last resort there is no guarantee that - * this will return a desired implementation or even be deterministic. - * The priority is also nearly arbitrary. We are only doing this - * for older versions of Node.js <0.12 that do not have a reasonable - * global.Promise implementation and we the user has not registered - * the preference. This preserves the behavior of any-promise <= 0.1 - * and may be deprecated or removed in the future - */ -function tryAutoDetect(){ - var libs = [ - "es6-promise", - "promise", - "native-promise-only", - "bluebird", - "rsvp", - "when", - "q", - "pinkie", - "lie", - "vow"] - var i = 0, len = libs.length - for(; i < len; i++){ - try { - return loadImplementation(libs[i]) - } catch(e){} + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const info = yield _this.config.tryManifest(loc, 'npm', false); + if (!info) { + return null; + } + return _this.resolveImport(info); + })(); } - return null -} + resolveFixedVersion(fixedVersionPattern) { + var _this2 = this; -/***/ }), -/* 510 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; -/*! - * arr-flatten - * - * Copyright (c) 2014-2017, Jon Schlinkert. - * Released under the MIT License. - */ + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + var _normalizePattern5 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(fixedVersionPattern); + const range = _normalizePattern5.range; + const exoticResolver = (0, (_index || _load_index()).getExoticResolver)(range); + const manifest = exoticResolver ? yield _this2.request.findExoticVersionInfo(exoticResolver, range) : yield _this2.request.findVersionOnRegistry(fixedVersionPattern); + return manifest; + })(); + } -module.exports = function (arr) { - return flat(arr, []); -}; + _resolveFromFixedVersions() { + var _this3 = this; -function flat(arr, res) { - var i = 0, cur; - var len = arr.length; - for (; i < len; i++) { - cur = arr[i]; - Array.isArray(cur) ? flat(cur, res) : res.push(cur); - } - return res; -} + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + invariant(_this3.request instanceof ImportPackageRequest, 'request must be ImportPackageRequest'); + var _normalizePattern6 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(_this3.pattern); -/***/ }), -/* 511 */ -/***/ (function(module, exports, __webpack_require__) { + const name = _normalizePattern6.name; -"use strict"; + invariant(_this3.request.dependencyTree instanceof (_logicalDependencyTree || _load_logicalDependencyTree()).LogicalDependencyTree, 'dependencyTree on request must be LogicalDependencyTree'); + const fixedVersionPattern = _this3.request.dependencyTree.getFixedVersionPattern(name, _this3.request.parentNames); + const info = yield _this3.config.getCache(`import-resolver-${fixedVersionPattern}`, function () { + return _this3.resolveFixedVersion(fixedVersionPattern); + }); + if (info) { + return info; + } + throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('importResolveFailed', name, _this3.getCwd())); + })(); + } -module.exports = function (arr, predicate, ctx) { - if (typeof Array.prototype.findIndex === 'function') { - return arr.findIndex(predicate, ctx); - } + _resolveFromNodeModules() { + var _this4 = this; - if (typeof predicate !== 'function') { - throw new TypeError('predicate must be a function'); - } + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + var _normalizePattern7 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(_this4.pattern); - var list = Object(arr); - var len = list.length; + const name = _normalizePattern7.name; - if (len === 0) { - return -1; - } + let cwd = _this4.getCwd(); + while (!path.relative(_this4.config.cwd, cwd).startsWith('..')) { + const loc = path.join(cwd, 'node_modules', name); + const info = yield _this4.config.getCache(`import-resolver-${loc}`, function () { + return _this4.resolveLocation(loc); + }); + if (info) { + return info; + } + cwd = path.resolve(cwd, '../..'); + } + throw new (_errors || _load_errors()).MessageError(_this4.reporter.lang('importResolveFailed', name, _this4.getCwd())); + })(); + } - for (var i = 0; i < len; i++) { - if (predicate.call(ctx, list[i], i, list)) { - return i; - } - } + resolve() { + if (this.request instanceof ImportPackageRequest && this.request.dependencyTree) { + return this._resolveFromFixedVersions(); + } else { + return this._resolveFromNodeModules(); + } + } +} - return -1; -}; +class ImportPackageRequest extends (_packageRequest || _load_packageRequest()).default { + constructor(req, dependencyTree, resolver) { + super(req, resolver); + this.import = this.parentRequest instanceof ImportPackageRequest ? this.parentRequest.import : true; + this.dependencyTree = dependencyTree; + } + getRootName() { + return this.resolver instanceof ImportPackageResolver && this.resolver.rootName || 'root'; + } -/***/ }), -/* 512 */ -/***/ (function(module, exports, __webpack_require__) { + getParentHumanName() { + return [this.getRootName()].concat(this.parentNames).join(' > '); + } -"use strict"; + reportResolvedRangeMatch(info, resolved) { + if (info.version === resolved.version) { + return; + } + this.reporter.warn(this.reporter.lang('importResolvedRangeMatch', resolved.version, resolved.name, info.version, this.getParentHumanName())); + } + _findResolvedManifest(info) { + var _normalizePattern8 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); -var rawAsap = __webpack_require__(513); -var freeTasks = []; + const range = _normalizePattern8.range, + name = _normalizePattern8.name; -/** - * Calls a task as soon as possible after returning, in its own event, with - * priority over IO events. An exception thrown in a task can be handled by - * `process.on("uncaughtException") or `domain.on("error")`, but will otherwise - * crash the process. If the error is handled, all subsequent tasks will - * resume. - * - * @param {{call}} task A callable object, typically a function that takes no - * arguments. - */ -module.exports = asap; -function asap(task) { - var rawTask; - if (freeTasks.length) { - rawTask = freeTasks.pop(); - } else { - rawTask = new RawTask(); + const solvedRange = (_semver || _load_semver()).default.validRange(range) ? info.version : range; + const resolved = this.resolver.getExactVersionMatch(name, solvedRange, info); + if (resolved) { + return resolved; } - rawTask.task = task; - rawTask.domain = process.domain; - rawAsap(rawTask); -} + invariant(info._remote, 'expected package remote'); + const ref = new (_packageReference || _load_packageReference()).default(this, info, info._remote); + info._reference = ref; + return info; + } -function RawTask() { - this.task = null; - this.domain = null; -} + resolveToExistingVersion(info) { + const resolved = this._findResolvedManifest(info); + invariant(resolved, 'should have found a resolved reference'); + const ref = resolved._reference; + invariant(ref, 'should have a package reference'); + ref.addRequest(this); + ref.addPattern(this.pattern, resolved); + ref.addOptional(this.optional); + } -RawTask.prototype.call = function () { - if (this.domain) { - this.domain.enter(); - } - var threw = true; - try { - this.task.call(); - threw = false; - // If the task throws an exception (presumably) Node.js restores the - // domain stack for the next event. - if (this.domain) { - this.domain.exit(); - } - } finally { - // We use try/finally and a threw flag to avoid messing up stack traces - // when we catch and release errors. - if (threw) { - // In Node.js, uncaught exceptions are considered fatal errors. - // Re-throw them to interrupt flushing! - // Ensure that flushing continues if an uncaught exception is - // suppressed listening process.on("uncaughtException") or - // domain.on("error"). - rawAsap.requestFlush(); - } - // If the task threw an error, we do not want to exit the domain here. - // Exiting the domain would prevent the domain from catching the error. - this.task = null; - this.domain = null; - freeTasks.push(this); + findVersionInfo() { + if (!this.import) { + this.reporter.verbose(this.reporter.lang('skippingImport', this.pattern, this.getParentHumanName())); + return super.findVersionInfo(); } -}; - + const resolver = new ImportResolver(this, this.pattern); + return resolver.resolve().catch(() => { + this.import = false; + this.reporter.warn(this.reporter.lang('importFailed', this.pattern, this.getParentHumanName())); + return super.findVersionInfo(); + }); + } +} +class ImportPackageResolver extends (_packageResolver || _load_packageResolver()).default { + constructor(config, lockfile) { + super(config, lockfile); + this.next = []; + this.rootName = 'root'; + } -/***/ }), -/* 513 */ -/***/ (function(module, exports, __webpack_require__) { + find(req) { + this.next.push(req); + return Promise.resolve(); + } -"use strict"; + findOne(req) { + var _this5 = this; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (_this5.activity) { + _this5.activity.tick(req.pattern); + } + const request = new ImportPackageRequest(req, _this5.dependencyTree, _this5); + yield request.find({ fresh: false }); + })(); + } -var domain; // The domain module is executed on demand -var hasSetImmediate = typeof setImmediate === "function"; + findAll(deps) { + var _this6 = this; -// Use the fastest means possible to execute a task in its own turn, with -// priority over other events including network IO events in Node.js. -// -// An exception thrown by a task will permanently interrupt the processing of -// subsequent tasks. The higher level `asap` function ensures that if an -// exception is thrown by a task, that the task queue will continue flushing as -// soon as possible, but if you use `rawAsap` directly, you are responsible to -// either ensure that no exceptions are thrown from your task, or to manually -// call `rawAsap.requestFlush` if an exception is thrown. -module.exports = rawAsap; -function rawAsap(task) { - if (!queue.length) { - requestFlush(); - flushing = true; - } - // Avoids a function call - queue[queue.length] = task; -} + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + yield Promise.all(deps.map(function (dep) { + return _this6.findOne(dep); + })); + deps = _this6.next; + _this6.next = []; + if (!deps.length) { + // all required package versions have been discovered, so now packages that + // resolved to existing versions can be resolved to their best available version + _this6.resolvePackagesWithExistingVersions(); + return; + } + yield _this6.findAll(deps); + })(); + } -var queue = []; -// Once a flush has been requested, no further calls to `requestFlush` are -// necessary until the next `flush` completes. -var flushing = false; -// The position of the next task to execute in the task queue. This is -// preserved between calls to `flush` so that it can be resumed if -// a task throws an exception. -var index = 0; -// If a task schedules additional tasks recursively, the task queue can grow -// unbounded. To prevent memory excaustion, the task queue will periodically -// truncate already-completed tasks. -var capacity = 1024; + resetOptional() { + for (const pattern in this.patterns) { + const ref = this.patterns[pattern]._reference; + invariant(ref, 'expected reference'); + ref.optional = null; + for (var _iterator = ref.requests, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref; -// The flush function processes all tasks that have been scheduled with -// `rawAsap` unless and until one of those tasks throws an exception. -// If a task throws an exception, `flush` ensures that its state will remain -// consistent and will resume where it left off when called again. -// However, `flush` does not make any arrangements to be called again if an -// exception is thrown. -function flush() { - while (index < queue.length) { - var currentIndex = index; - // Advance the index before calling the task. This ensures that we will - // begin flushing on the next task the task throws an error. - index = index + 1; - queue[currentIndex].call(); - // Prevent leaking memory for long chains of recursive calls to `asap`. - // If we call `asap` within tasks scheduled by `asap`, the queue will - // grow, but to avoid an O(n) walk for every task we execute, we don't - // shift tasks off the queue after they have been executed. - // Instead, we periodically shift 1024 tasks off the queue. - if (index > capacity) { - // Manually shift all values starting at the index back to the - // beginning of the queue. - for (var scan = 0, newLength = queue.length - index; scan < newLength; scan++) { - queue[scan] = queue[scan + index]; - } - queue.length -= index; - index = 0; + if (_isArray) { + if (_i >= _iterator.length) break; + _ref = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref = _i.value; } - } - queue.length = 0; - index = 0; - flushing = false; -} -rawAsap.requestFlush = requestFlush; -function requestFlush() { - // Ensure flushing is not bound to any domain. - // It is not sufficient to exit the domain, because domains exist on a stack. - // To execute code outside of any domain, the following dance is necessary. - var parentDomain = process.domain; - if (parentDomain) { - if (!domain) { - // Lazy execute the domain module. - // Only employed if the user elects to use domains. - domain = __webpack_require__(965); - } - domain.active = process.domain = null; - } + const req = _ref; - // `setImmediate` is slower that `process.nextTick`, but `process.nextTick` - // cannot handle recursion. - // `requestFlush` will only be called recursively from `asap.js`, to resume - // flushing after an error is thrown into a domain. - // Conveniently, `setImmediate` was introduced in the same version - // `process.nextTick` started throwing recursion errors. - if (flushing && hasSetImmediate) { - setImmediate(flush); - } else { - process.nextTick(flush); + ref.addOptional(req.optional); + } } + } - if (parentDomain) { - domain.active = process.domain = parentDomain; - } -} + init(deps, { isFlat, isFrozen, workspaceLayout } = { isFlat: false, isFrozen: false, workspaceLayout: undefined }) { + var _this7 = this; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this7.flat = Boolean(isFlat); + const activity = _this7.activity = _this7.reporter.activity(); + yield _this7.findAll(deps); + _this7.resetOptional(); + activity.end(); + _this7.activity = null; + })(); + } +} -/***/ }), -/* 514 */ -/***/ (function(module, exports, __webpack_require__) { +class Import extends (_install || _load_install()).Install { + constructor(flags, config, reporter, lockfile) { + super(flags, config, reporter, lockfile); + this.resolver = new ImportPackageResolver(this.config, this.lockfile); + this.linker = new (_packageLinker || _load_packageLinker()).default(config, this.resolver); + } + createLogicalDependencyTree(packageJson, packageLock) { + invariant(packageJson, 'package.json should exist'); + invariant(packageLock, 'package-lock.json should exist'); + invariant(this.resolver instanceof ImportPackageResolver, 'resolver should be an ImportPackageResolver'); + try { + this.resolver.dependencyTree = new (_logicalDependencyTree || _load_logicalDependencyTree()).LogicalDependencyTree(packageJson, packageLock); + } catch (e) { + throw new (_errors || _load_errors()).MessageError(this.reporter.lang('importSourceFilesCorrupted')); + } + } + getExternalLockfileContents() { + var _this8 = this; -// Copyright 2011 Mark Cavage All rights reserved. + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + try { + var _ref2 = yield Promise.all([(_fs || _load_fs()).readFile(path.join(_this8.config.cwd, (_constants || _load_constants()).NODE_PACKAGE_JSON)), (_fs || _load_fs()).readFile(path.join(_this8.config.cwd, (_constants || _load_constants()).NPM_LOCK_FILENAME))]); -var errors = __webpack_require__(206); -var types = __webpack_require__(207); + const packageJson = _ref2[0], + packageLock = _ref2[1]; -var Reader = __webpack_require__(515); -var Writer = __webpack_require__(516); + return { packageJson, packageLock }; + } catch (e) { + return { packageJson: null, packageLock: null }; + } + })(); + } + init() { + var _this9 = this; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (yield (_fs || _load_fs()).exists(path.join(_this9.config.cwd, (_constants || _load_constants()).LOCKFILE_FILENAME))) { + throw new (_errors || _load_errors()).MessageError(_this9.reporter.lang('lockfileExists')); + } -// --- Exports + var _ref3 = yield _this9.getExternalLockfileContents(); -module.exports = { + const packageJson = _ref3.packageJson, + packageLock = _ref3.packageLock; - Reader: Reader, + const importSource = packageJson && packageLock && (_semver || _load_semver()).default.satisfies(nodeVersion, '>=5.0.0') ? 'package-lock.json' : 'node_modules'; + if (importSource === 'package-lock.json') { + _this9.reporter.info(_this9.reporter.lang('importPackageLock')); + _this9.createLogicalDependencyTree(packageJson, packageLock); + } + if (importSource === 'node_modules') { + _this9.reporter.info(_this9.reporter.lang('importNodeModules')); + yield (0, (_check || _load_check()).verifyTreeCheck)(_this9.config, _this9.reporter, {}, []); + } - Writer: Writer + var _ref4 = yield _this9.fetchRequestFromCwd(); -}; + const requests = _ref4.requests, + patterns = _ref4.patterns, + manifest = _ref4.manifest; -for (var t in types) { - if (types.hasOwnProperty(t)) - module.exports[t] = types[t]; + if (manifest.name && _this9.resolver instanceof ImportPackageResolver) { + _this9.resolver.rootName = manifest.name; + } + yield _this9.resolver.init(requests, { isFlat: _this9.flags.flat, isFrozen: _this9.flags.frozenLockfile }); + const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this9.resolver.getManifests(), _this9.config); + _this9.resolver.updateManifests(manifests); + yield (_packageCompatibility || _load_packageCompatibility()).check(_this9.resolver.getManifests(), _this9.config, _this9.flags.ignoreEngines); + yield _this9.linker.resolvePeerModules(); + yield _this9.saveLockfileAndIntegrity(patterns); + return patterns; + })(); + } } -for (var e in errors) { - if (errors.hasOwnProperty(e)) - module.exports[e] = errors[e]; + +exports.Import = Import; +function setFlags(commander) { + commander.description('Generates yarn.lock from an npm package-lock.json file or an existing npm-installed node_modules folder.'); } +function hasWrapper(commander, args) { + return true; +} /***/ }), -/* 515 */ +/* 501 */ /***/ (function(module, exports, __webpack_require__) { -// Copyright 2011 Mark Cavage All rights reserved. - -var assert = __webpack_require__(28); -var Buffer = __webpack_require__(15).Buffer; - -var ASN1 = __webpack_require__(207); -var errors = __webpack_require__(206); - - -// --- Globals - -var newInvalidAsn1Error = errors.newInvalidAsn1Error; +"use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = undefined; -// --- API +var _asyncToGenerator2; -function Reader(data) { - if (!data || !Buffer.isBuffer(data)) - throw new TypeError('data must be a node Buffer'); +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} - this._buf = data; - this._size = data.length; +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + if (args.length > 2) { + reporter.error(reporter.lang('tooManyArguments', 2)); + return; + } - // These hold the "current" state - this._len = 0; - this._offset = 0; -} + let packageName = args.shift() || '.'; -Object.defineProperty(Reader.prototype, 'length', { - enumerable: true, - get: function () { return (this._len); } -}); + // Handle the case when we are referencing a local package. + if (packageName === '.') { + packageName = (yield config.readRootManifest()).name; + } -Object.defineProperty(Reader.prototype, 'offset', { - enumerable: true, - get: function () { return (this._offset); } -}); + const packageInput = (_npmRegistry || _load_npmRegistry()).default.escapeName(packageName); -Object.defineProperty(Reader.prototype, 'remain', { - get: function () { return (this._size - this._offset); } -}); + var _parsePackageName = (0, (_parsePackageName2 || _load_parsePackageName()).default)(packageInput); -Object.defineProperty(Reader.prototype, 'buffer', { - get: function () { return (this._buf.slice(this._offset)); } -}); + const name = _parsePackageName.name, + version = _parsePackageName.version; -/** - * Reads a single byte and advances offset; you can pass in `true` to make this - * a "peek" operation (i.e., get the byte, but don't advance the offset). - * - * @param {Boolean} peek true means don't move offset. - * @return {Number} the next byte, null if not enough data. - */ -Reader.prototype.readByte = function (peek) { - if (this._size - this._offset < 1) - return null; + let result; + try { + result = yield config.registries.npm.request(name, { unfiltered: true }); + } catch (e) { + reporter.error(reporter.lang('infoFail')); + return; + } + if (!result) { + reporter.error(reporter.lang('infoFail')); + return; + } - var b = this._buf[this._offset] & 0xff; + result = clean(result); - if (!peek) - this._offset += 1; + const versions = result.versions; + // $FlowFixMe + result.versions = Object.keys(versions).sort(semver.compareLoose); + result.version = version || result['dist-tags'].latest; + result = Object.assign(result, versions[result.version]); - return b; -}; + const fieldPath = args.shift(); + const fields = fieldPath ? fieldPath.split('.') : []; + // Readmes can be long so exclude them unless explicitly asked for. + if (fields[0] !== 'readme') { + delete result.readme; + } -Reader.prototype.peek = function () { - return this.readByte(true); -}; + result = fields.reduce(function (prev, cur) { + return prev && prev[cur]; + }, result); + reporter.inspect(result); + }); + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); -/** - * Reads a (potentially) variable length off the BER buffer. This call is - * not really meant to be called directly, as callers have to manipulate - * the internal buffer afterwards. - * - * As a result of this call, you can call `Reader.length`, until the - * next thing called that does a readLength. - * - * @return {Number} the amount of offset to advance the buffer. - * @throws {InvalidAsn1Error} on bad ASN.1 - */ -Reader.prototype.readLength = function (offset) { - if (offset === undefined) - offset = this._offset; +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; - if (offset >= this._size) - return null; +var _npmRegistry; - var lenB = this._buf[offset++] & 0xff; - if (lenB === null) - return null; +function _load_npmRegistry() { + return _npmRegistry = _interopRequireDefault(__webpack_require__(88)); +} - if ((lenB & 0x80) === 0x80) { - lenB &= 0x7f; +var _parsePackageName2; - if (lenB === 0) - throw newInvalidAsn1Error('Indefinite length not supported'); +function _load_parsePackageName() { + return _parsePackageName2 = _interopRequireDefault(__webpack_require__(556)); +} - if (lenB > 4) - throw newInvalidAsn1Error('encoding too long'); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - if (this._size - offset < lenB) - return null; +const semver = __webpack_require__(22); - this._len = 0; - for (var i = 0; i < lenB; i++) - this._len = (this._len << 8) + (this._buf[offset++] & 0xff); +function clean(object) { + if (Array.isArray(object)) { + const result = []; + object.forEach(item => { + item = clean(item); + if (item) { + result.push(item); + } + }); + return result; + } else if (typeof object === 'object') { + const result = {}; + for (const key in object) { + if (key.startsWith('_')) { + continue; + } + const item = clean(object[key]); + if (item) { + result[key] = item; + } + } + return result; + } else if (object) { + return object; } else { - // Wasn't a variable length - this._len = lenB; + return null; } +} - return offset; -}; - +function setFlags(commander) { + commander.description('Shows information about a package.'); +} -/** - * Parses the next sequence in this BER buffer. - * - * To get the length of the sequence, call `Reader.length`. - * - * @return {Number} the sequence's tag. - */ -Reader.prototype.readSequence = function (tag) { - var seq = this.peek(); - if (seq === null) - return null; - if (tag !== undefined && tag !== seq) - throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + - ': got 0x' + seq.toString(16)); +function hasWrapper(commander, args) { + return true; +} - var o = this.readLength(this._offset + 1); // stored in `length` - if (o === null) - return null; +/***/ }), +/* 502 */ +/***/ (function(module, exports, __webpack_require__) { - this._offset = o; - return seq; -}; +"use strict"; -Reader.prototype.readInt = function () { - return this._readTag(ASN1.Integer); -}; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getGitConfigInfo = exports.run = exports.shouldRunInCurrentCwd = undefined; +var _asyncToGenerator2; -Reader.prototype.readBoolean = function () { - return (this._readTag(ASN1.Boolean) === 0 ? false : true); -}; +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const installVersion = flags[`2`] ? `berry` : flags.install; + const forwardedArgs = process.argv.slice(process.argv.indexOf('init', 2) + 1); -Reader.prototype.readEnumeration = function () { - return this._readTag(ASN1.Enumeration); -}; + if (installVersion) { + if (flags[`2`] && process.env.COREPACK_ROOT) { + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [path.join(process.env.COREPACK_ROOT, 'dist/corepack.js'), `yarn@${flags.install || `stable`}`, `init`, ...forwardedArgs, `--install=self`], { + stdio: 'inherit', + cwd: config.cwd + }); + } else { + const lockfilePath = path.resolve(config.cwd, 'yarn.lock'); + if (!(yield (_fs || _load_fs()).exists(lockfilePath))) { + yield (_fs || _load_fs()).writeFile(lockfilePath, ''); + } + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [process.argv[1], 'policies', 'set-version', installVersion, '--silent'], { + stdio: 'inherit', + cwd: config.cwd + }); + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [process.argv[1], 'init', ...forwardedArgs], { + stdio: 'inherit', + cwd: config.cwd + }); + } + return; + } + const manifests = yield config.getRootManifests(); -Reader.prototype.readString = function (tag, retbuf) { - if (!tag) - tag = ASN1.OctetString; + let repository = {}; + const author = { + name: config.getOption('init-author-name'), + email: config.getOption('init-author-email'), + url: config.getOption('init-author-url') + }; + if (yield (_fs || _load_fs()).exists(path.join(config.cwd, '.git'))) { + // get git origin of the cwd + try { + repository = { + type: 'git', + url: yield (_child || _load_child()).spawn('git', ['config', 'remote.origin.url'], { + cwd: config.cwd + }) + }; + } catch (ex) { + // Ignore - Git repo may not have an origin URL yet (eg. if it only exists locally) + } - var b = this.peek(); - if (b === null) - return null; + if (author.name === undefined) { + author.name = yield getGitConfigInfo('user.name'); + } - if (b !== tag) - throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + - ': got 0x' + b.toString(16)); + if (author.email === undefined) { + author.email = yield getGitConfigInfo('user.email'); + } + } - var o = this.readLength(this._offset + 1); // stored in `length` + const keys = [{ + key: 'name', + question: 'name', + default: path.basename(config.cwd), + validation: (_validate || _load_validate()).isValidPackageName, + validationError: 'invalidPackageName' + }, { + key: 'version', + question: 'version', + default: String(config.getOption('init-version')) + }, { + key: 'description', + question: 'description', + default: '' + }, { + key: 'main', + question: 'entry point', + default: 'index.js' + }, { + key: 'repository', + question: 'repository url', + default: (0, (_util || _load_util()).extractRepositoryUrl)(repository) + }, { + key: 'author', + question: 'author', + default: (0, (_util || _load_util()).stringifyPerson)(author) + }, { + key: 'license', + question: 'license', + default: String(config.getOption('init-license')) + }, { + key: 'private', + question: 'private', + default: config.getOption('init-private') || '', + inputFormatter: yn + }]; - if (o === null) - return null; + // get answers + const pkg = {}; + for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref2; - if (this.length > this._size - o) - return null; + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } - this._offset = o; + const entry = _ref2; + const yes = flags.yes, + privateFlag = flags.private; + const manifestKey = entry.key; + let question = entry.question, + def = entry.default; - if (this.length === 0) - return retbuf ? Buffer.alloc(0) : ''; - var str = this._buf.slice(this._offset, this._offset + this.length); - this._offset += this.length; + for (var _iterator4 = (_index || _load_index()).registryNames, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { + var _ref5; - return retbuf ? str : str.toString('utf8'); -}; + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref5 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref5 = _i4.value; + } -Reader.prototype.readOID = function (tag) { - if (!tag) - tag = ASN1.OID; + const registryName = _ref5; + const object = manifests[registryName].object; - var b = this.readString(tag, true); - if (b === null) - return null; + let val = objectPath.get(object, manifestKey); + if (!val) { + break; + } + if (typeof val === 'object') { + if (manifestKey === 'author') { + val = (0, (_util || _load_util()).stringifyPerson)(val); + } else if (manifestKey === 'repository') { + val = (0, (_util || _load_util()).extractRepositoryUrl)(val); + } + } + def = val; + } - var values = []; - var value = 0; + if (manifestKey === 'private' && privateFlag) { + def = true; + } - for (var i = 0; i < b.length; i++) { - var byte = b[i] & 0xff; + if (def) { + question += ` (${String(def)})`; + } - value <<= 7; - value += byte & 0x7f; - if ((byte & 0x80) === 0) { - values.push(value); - value = 0; + let answer; + let validAnswer = false; + + if (yes) { + answer = def; + } else { + // loop until a valid answer is provided, if validation is on entry + if (entry.validation) { + while (!validAnswer) { + answer = (yield reporter.question(question)) || def; + // validate answer + if (entry.validation(String(answer))) { + validAnswer = true; + } else { + reporter.error(reporter.lang('invalidPackageName')); + } + } + } else { + answer = (yield reporter.question(question)) || def; + } + } + + if (answer) { + if (entry.inputFormatter) { + answer = entry.inputFormatter(answer); + } + objectPath.set(pkg, manifestKey, answer); + } } - } - value = values.shift(); - values.unshift(value % 40); - values.unshift((value / 40) >> 0); + if (pkg.repository && (_githubResolver || _load_githubResolver()).default.isVersion(pkg.repository)) { + pkg.repository = `https://github.com/${pkg.repository}`; + } - return values.join('.'); -}; + // save answers + const targetManifests = []; + for (var _iterator2 = (_index || _load_index()).registryNames, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; + } -Reader.prototype._readTag = function (tag) { - assert.ok(tag !== undefined); + const registryName = _ref3; - var b = this.peek(); + const info = manifests[registryName]; + if (info.exists) { + targetManifests.push(info); + } + } + if (!targetManifests.length) { + targetManifests.push(manifests.npm); + } + for (var _iterator3 = targetManifests, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref4; - if (b === null) - return null; + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref4 = _i3.value; + } - if (b !== tag) - throw newInvalidAsn1Error('Expected 0x' + tag.toString(16) + - ': got 0x' + b.toString(16)); + const targetManifest = _ref4; - var o = this.readLength(this._offset + 1); // stored in `length` - if (o === null) - return null; + Object.assign(targetManifest.object, pkg); + reporter.success(`Saved ${path.basename(targetManifest.loc)}`); + } - if (this.length > 4) - throw newInvalidAsn1Error('Integer too long: ' + this.length); + yield config.saveRootManifests(manifests); + }); - if (this.length > this._size - o) - return null; - this._offset = o; + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); - var fb = this._buf[this._offset]; - var value = 0; +let getGitConfigInfo = exports.getGitConfigInfo = (() => { + var _ref6 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (credential, spawn = (_child || _load_child()).spawn) { + try { + // try to get author default based on git config + return yield spawn('git', ['config', credential]); + } catch (e) { + return ''; + } + }); - for (var i = 0; i < this.length; i++) { - value <<= 8; - value |= (this._buf[this._offset++] & 0xff); - } + return function getGitConfigInfo(_x5) { + return _ref6.apply(this, arguments); + }; +})(); - if ((fb & 0x80) === 0x80 && i !== 4) - value -= (1 << (i * 8)); +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; - return value >> 0; -}; +var _util; +function _load_util() { + return _util = __webpack_require__(219); +} +var _index; -// --- Exported API +function _load_index() { + return _index = __webpack_require__(58); +} -module.exports = Reader; +var _githubResolver; +function _load_githubResolver() { + return _githubResolver = _interopRequireDefault(__webpack_require__(361)); +} -/***/ }), -/* 516 */ -/***/ (function(module, exports, __webpack_require__) { +var _child; -// Copyright 2011 Mark Cavage All rights reserved. +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(50)); +} -var assert = __webpack_require__(28); -var Buffer = __webpack_require__(15).Buffer; -var ASN1 = __webpack_require__(207); -var errors = __webpack_require__(206); +var _fs; +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(5)); +} -// --- Globals +var _validate; -var newInvalidAsn1Error = errors.newInvalidAsn1Error; +function _load_validate() { + return _validate = _interopRequireWildcard(__webpack_require__(125)); +} -var DEFAULT_OPTS = { - size: 1024, - growthFactor: 8 -}; +var _constants; +function _load_constants() { + return _constants = __webpack_require__(8); +} -// --- Helpers +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } -function merge(from, to) { - assert.ok(from); - assert.equal(typeof (from), 'object'); - assert.ok(to); - assert.equal(typeof (to), 'object'); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - var keys = Object.getOwnPropertyNames(from); - keys.forEach(function (key) { - if (to[key]) - return; +const objectPath = __webpack_require__(304); - var value = Object.getOwnPropertyDescriptor(from, key); - Object.defineProperty(to, key, value); - }); +const path = __webpack_require__(0); +const yn = __webpack_require__(962); - return to; +function setFlags(commander) { + commander.description('Interactively creates or updates a package.json file.'); + commander.option('-y, --yes', 'use default options'); + commander.option('-p, --private', 'use default options and private true'); + commander.option('-i, --install ', 'install a specific Yarn release'); + commander.option('-2', 'generates the project using Yarn 2'); } +function hasWrapper(commander, args) { + return true; +} +const shouldRunInCurrentCwd = exports.shouldRunInCurrentCwd = true; -// --- API +/***/ }), +/* 503 */ +/***/ (function(module, exports, __webpack_require__) { -function Writer(options) { - options = merge(DEFAULT_OPTS, options || {}); +"use strict"; - this._buf = Buffer.alloc(options.size || 1024); - this._size = this._buf.length; - this._offset = 0; - this._options = options; - // A list of offsets in the buffer where we need to insert - // sequence tag/len pairs. - this._seq = []; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.examples = exports.run = undefined; + +var _extends2; + +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(20)); } -Object.defineProperty(Writer.prototype, 'buffer', { - get: function () { - if (this._seq.length) - throw newInvalidAsn1Error(this._seq.length + ' unended sequence(s)'); +var _asyncToGenerator2; - return (this._buf.slice(0, this._offset)); - } -}); +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} -Writer.prototype.writeByte = function (b) { - if (typeof (b) !== 'number') - throw new TypeError('argument must be a Number'); +let getManifests = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, flags) { + const lockfile = yield (_lockfile || _load_lockfile()).default.fromDirectory(config.cwd); + const install = new (_install || _load_install()).Install((0, (_extends2 || _load_extends()).default)({ skipIntegrityCheck: true }, flags), config, new (_baseReporter || _load_baseReporter()).default(), lockfile); + yield install.hydrate(true); - this._ensure(1); - this._buf[this._offset++] = b; -}; + let manifests = install.resolver.getManifests(); + // sort by name + manifests = manifests.sort(function (a, b) { + if (!a.name && !b.name) { + return 0; + } -Writer.prototype.writeInt = function (i, tag) { - if (typeof (i) !== 'number') - throw new TypeError('argument must be a Number'); - if (typeof (tag) !== 'number') - tag = ASN1.Integer; + if (!a.name) { + return 1; + } - var sz = 4; + if (!b.name) { + return -1; + } - while ((((i & 0xff800000) === 0) || ((i & 0xff800000) === 0xff800000 >> 0)) && - (sz > 1)) { - sz--; - i <<= 8; - } + return a.name.localeCompare(b.name); + }); - if (sz > 4) - throw newInvalidAsn1Error('BER ints cannot be > 0xffffffff'); + // filter ignored manifests + manifests = manifests.filter(function (manifest) { + const ref = manifest._reference; + return !!ref && !ref.ignore; + }); - this._ensure(2 + sz); - this._buf[this._offset++] = tag; - this._buf[this._offset++] = sz; + return manifests; + }); - while (sz-- > 0) { - this._buf[this._offset++] = ((i & 0xff000000) >>> 24); - i <<= 8; - } + return function getManifests(_x, _x2) { + return _ref.apply(this, arguments); + }; +})(); -}; +let list = (() => { + var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const manifests = yield getManifests(config, flags); + const manifestsByLicense = new Map(); + for (var _iterator = manifests, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref4; -Writer.prototype.writeNull = function () { - this.writeByte(ASN1.Null); - this.writeByte(0x00); -}; + if (_isArray) { + if (_i >= _iterator.length) break; + _ref4 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref4 = _i.value; + } + const _ref3 = _ref4; + const name = _ref3.name, + version = _ref3.version, + license = _ref3.license, + repository = _ref3.repository, + homepage = _ref3.homepage, + author = _ref3.author; -Writer.prototype.writeEnumeration = function (i, tag) { - if (typeof (i) !== 'number') - throw new TypeError('argument must be a Number'); - if (typeof (tag) !== 'number') - tag = ASN1.Enumeration; + const licenseKey = license || 'UNKNOWN'; + const url = repository ? repository.url : homepage; + const vendorUrl = homepage || author && author.url; + const vendorName = author && author.name; - return this.writeInt(i, tag); -}; + if (!manifestsByLicense.has(licenseKey)) { + manifestsByLicense.set(licenseKey, new Map()); + } + const byLicense = manifestsByLicense.get(licenseKey); + invariant(byLicense, 'expected value'); + byLicense.set(`${name}@${version}`, { + name, + version, + url, + vendorUrl, + vendorName + }); + } -Writer.prototype.writeBoolean = function (b, tag) { - if (typeof (b) !== 'boolean') - throw new TypeError('argument must be a Boolean'); - if (typeof (tag) !== 'number') - tag = ASN1.Boolean; + if (flags.json) { + const body = []; - this._ensure(3); - this._buf[this._offset++] = tag; - this._buf[this._offset++] = 0x01; - this._buf[this._offset++] = b ? 0xff : 0x00; -}; + manifestsByLicense.forEach(function (license, licenseKey) { + license.forEach(function ({ name, version, url, vendorUrl, vendorName }) { + body.push([name, version, licenseKey, url || 'Unknown', vendorUrl || 'Unknown', vendorName || 'Unknown']); + }); + }); + reporter.table(['Name', 'Version', 'License', 'URL', 'VendorUrl', 'VendorName'], body); + } else { + const trees = []; -Writer.prototype.writeString = function (s, tag) { - if (typeof (s) !== 'string') - throw new TypeError('argument must be a string (was: ' + typeof (s) + ')'); - if (typeof (tag) !== 'number') - tag = ASN1.OctetString; + manifestsByLicense.forEach(function (license, licenseKey) { + const licenseTree = []; - var len = Buffer.byteLength(s); - this.writeByte(tag); - this.writeLength(len); - if (len) { - this._ensure(len); - this._buf.write(s, this._offset); - this._offset += len; - } -}; + license.forEach(function ({ name, version, url, vendorUrl, vendorName }) { + const children = []; + if (url) { + children.push({ name: `${reporter.format.bold('URL:')} ${url}` }); + } -Writer.prototype.writeBuffer = function (buf, tag) { - if (typeof (tag) !== 'number') - throw new TypeError('tag must be a number'); - if (!Buffer.isBuffer(buf)) - throw new TypeError('argument must be a buffer'); + if (vendorUrl) { + children.push({ name: `${reporter.format.bold('VendorUrl:')} ${vendorUrl}` }); + } - this.writeByte(tag); - this.writeLength(buf.length); - this._ensure(buf.length); - buf.copy(this._buf, this._offset, 0, buf.length); - this._offset += buf.length; -}; + if (vendorName) { + children.push({ name: `${reporter.format.bold('VendorName:')} ${vendorName}` }); + } + licenseTree.push({ + name: `${name}@${version}`, + children + }); + }); -Writer.prototype.writeStringArray = function (strings) { - if ((!strings instanceof Array)) - throw new TypeError('argument must be an Array[String]'); + trees.push({ + name: licenseKey, + children: licenseTree + }); + }); - var self = this; - strings.forEach(function (s) { - self.writeString(s); + reporter.tree('licenses', trees, { force: true }); + } }); -}; -// This is really to solve DER cases, but whatever for now -Writer.prototype.writeOID = function (s, tag) { - if (typeof (s) !== 'string') - throw new TypeError('argument must be a string'); - if (typeof (tag) !== 'number') - tag = ASN1.OID; + return function list(_x3, _x4, _x5, _x6) { + return _ref2.apply(this, arguments); + }; +})(); - if (!/^([0-9]+\.){3,}[0-9]+$/.test(s)) - throw new Error('argument is not a valid OID string'); +exports.hasWrapper = hasWrapper; +exports.setFlags = setFlags; - function encodeOctet(bytes, octet) { - if (octet < 128) { - bytes.push(octet); - } else if (octet < 16384) { - bytes.push((octet >>> 7) | 0x80); - bytes.push(octet & 0x7F); - } else if (octet < 2097152) { - bytes.push((octet >>> 14) | 0x80); - bytes.push(((octet >>> 7) | 0x80) & 0xFF); - bytes.push(octet & 0x7F); - } else if (octet < 268435456) { - bytes.push((octet >>> 21) | 0x80); - bytes.push(((octet >>> 14) | 0x80) & 0xFF); - bytes.push(((octet >>> 7) | 0x80) & 0xFF); - bytes.push(octet & 0x7F); - } else { - bytes.push(((octet >>> 28) | 0x80) & 0xFF); - bytes.push(((octet >>> 21) | 0x80) & 0xFF); - bytes.push(((octet >>> 14) | 0x80) & 0xFF); - bytes.push(((octet >>> 7) | 0x80) & 0xFF); - bytes.push(octet & 0x7F); - } - } +var _baseReporter; - var tmp = s.split('.'); - var bytes = []; - bytes.push(parseInt(tmp[0], 10) * 40 + parseInt(tmp[1], 10)); - tmp.slice(2).forEach(function (b) { - encodeOctet(bytes, parseInt(b, 10)); - }); +function _load_baseReporter() { + return _baseReporter = _interopRequireDefault(__webpack_require__(108)); +} - var self = this; - this._ensure(2 + bytes.length); - this.writeByte(tag); - this.writeLength(bytes.length); - bytes.forEach(function (b) { - self.writeByte(b); - }); -}; +var _install; +function _load_install() { + return _install = __webpack_require__(34); +} -Writer.prototype.writeLength = function (len) { - if (typeof (len) !== 'number') - throw new TypeError('argument must be a Number'); +var _lockfile; - this._ensure(4); +function _load_lockfile() { + return _lockfile = _interopRequireDefault(__webpack_require__(19)); +} - if (len <= 0x7f) { - this._buf[this._offset++] = len; - } else if (len <= 0xff) { - this._buf[this._offset++] = 0x81; - this._buf[this._offset++] = len; - } else if (len <= 0xffff) { - this._buf[this._offset++] = 0x82; - this._buf[this._offset++] = len >> 8; - this._buf[this._offset++] = len; - } else if (len <= 0xffffff) { - this._buf[this._offset++] = 0x83; - this._buf[this._offset++] = len >> 16; - this._buf[this._offset++] = len >> 8; - this._buf[this._offset++] = len; - } else { - throw newInvalidAsn1Error('Length too long (> 4 bytes)'); - } -}; +var _buildSubCommands2; -Writer.prototype.startSequence = function (tag) { - if (typeof (tag) !== 'number') - tag = ASN1.Sequence | ASN1.Constructor; +function _load_buildSubCommands() { + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(59)); +} - this.writeByte(tag); - this._seq.push(this._offset); - this._ensure(3); - this._offset += 3; -}; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +const invariant = __webpack_require__(9); -Writer.prototype.endSequence = function () { - var seq = this._seq.pop(); - var start = seq + 3; - var len = this._offset - start; +function hasWrapper(flags, args) { + return args[0] != 'generate-disclaimer'; +} - if (len <= 0x7f) { - this._shift(start, len, -2); - this._buf[seq] = len; - } else if (len <= 0xff) { - this._shift(start, len, -1); - this._buf[seq] = 0x81; - this._buf[seq + 1] = len; - } else if (len <= 0xffff) { - this._buf[seq] = 0x82; - this._buf[seq + 1] = len >> 8; - this._buf[seq + 2] = len; - } else if (len <= 0xffffff) { - this._shift(start, len, 1); - this._buf[seq] = 0x83; - this._buf[seq + 1] = len >> 16; - this._buf[seq + 2] = len >> 8; - this._buf[seq + 3] = len; - } else { - throw newInvalidAsn1Error('Sequence too long'); - } -}; +function setFlags(commander) { + commander.description('Lists licenses for installed packages.'); +} +var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).default)('licenses', { + ls(config, reporter, flags, args) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + reporter.warn(`\`yarn licenses ls\` is deprecated. Please use \`yarn licenses list\`.`); + yield list(config, reporter, flags, args); + })(); + }, -Writer.prototype._shift = function (start, len, shift) { - assert.ok(start !== undefined); - assert.ok(len !== undefined); - assert.ok(shift); + list(config, reporter, flags, args) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + yield list(config, reporter, flags, args); + })(); + }, - this._buf.copy(this._buf, start + shift, start, start + len); - this._offset += shift; -}; + generateDisclaimer(config, reporter, flags, args) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + /* eslint-disable no-console */ -Writer.prototype._ensure = function (len) { - assert.ok(len); + // `reporter.log` dumps a bunch of ANSI escapes to clear the current line and + // is for abstracting the console output so it can be consumed by other tools + // (JSON output being the primary one). This command is only for text consumption + // and you should just be dumping it to a TXT file. Using a reporter here has the + // potential to mess up the output since it might print ansi escapes. + const manifests = yield getManifests(config, flags); + const manifest = yield config.readRootManifest(); - if (this._size - this._offset < len) { - var sz = this._size * this._options.growthFactor; - if (sz - this._offset < len) - sz += len; + // Create a map of license text to manifest so that packages with exactly + // the same license text are grouped together. + const manifestsByLicense = new Map(); + for (var _iterator2 = manifests, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref5; - var buf = Buffer.alloc(sz); + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref5 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref5 = _i2.value; + } - this._buf.copy(buf, 0, 0, this._offset); - this._buf = buf; - this._size = sz; - } -}; + const manifest = _ref5; + const licenseText = manifest.licenseText, + noticeText = manifest.noticeText; + + let licenseKey; + if (!licenseText) { + continue; + } + if (!noticeText) { + licenseKey = licenseText; + } else { + licenseKey = `${licenseText}\n\nNOTICE\n\n${noticeText}`; + } + if (!manifestsByLicense.has(licenseKey)) { + manifestsByLicense.set(licenseKey, new Map()); + } -// --- Exported API + const byLicense = manifestsByLicense.get(licenseKey); + invariant(byLicense, 'expected value'); + byLicense.set(manifest.name, manifest); + } -module.exports = Writer; + console.log('THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED ' + `IN PORTIONS OF THE ${String(manifest.name).toUpperCase().replace(/-/g, ' ')} PRODUCT.`); + console.log(); + for (var _iterator3 = manifestsByLicense, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref7; -/***/ }), -/* 517 */ -/***/ (function(module, exports, __webpack_require__) { + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref7 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref7 = _i3.value; + } -module.exports = -{ - parallel : __webpack_require__(519), - serial : __webpack_require__(520), - serialOrdered : __webpack_require__(351) -}; + const _ref6 = _ref7; + const licenseKey = _ref6[0]; + const manifests = _ref6[1]; + console.log('-----'); + console.log(); -/***/ }), -/* 518 */ -/***/ (function(module, exports) { + const names = []; + const urls = []; + for (var _iterator4 = manifests, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { + var _ref9; -module.exports = defer; + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref9 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref9 = _i4.value; + } -/** - * Runs provided function on next iteration of the event loop - * - * @param {function} fn - function to run - */ -function defer(fn) -{ - var nextTick = typeof setImmediate == 'function' - ? setImmediate - : ( - typeof process == 'object' && typeof process.nextTick == 'function' - ? process.nextTick - : null - ); + const _ref8 = _ref9; + const name = _ref8[0]; + const repository = _ref8[1].repository; - if (nextTick) - { - nextTick(fn); - } - else - { - setTimeout(fn, 0); + names.push(name); + if (repository && repository.url) { + urls.push(manifests.size === 1 ? repository.url : `${repository.url} (${name})`); + } + } + + const heading = []; + heading.push(`The following software may be included in this product: ${names.join(', ')}.`); + if (urls.length > 0) { + heading.push(`A copy of the source code may be downloaded from ${urls.join(', ')}.`); + } + heading.push('This software contains the following license and notice below:'); + + console.log(heading.join(' ')); + console.log(); + + if (licenseKey) { + console.log(licenseKey.trim()); + } else { + // what do we do here? base it on `license`? + } + + console.log(); + } + })(); } -} +}); +const run = _buildSubCommands.run, + examples = _buildSubCommands.examples; +exports.run = run; +exports.examples = examples; /***/ }), -/* 519 */ +/* 504 */ /***/ (function(module, exports, __webpack_require__) { -var iterate = __webpack_require__(348) - , initState = __webpack_require__(349) - , terminator = __webpack_require__(350) - ; - -// Public API -module.exports = parallel; - -/** - * Runs iterator over provided array elements in parallel - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function parallel(list, iterator, callback) -{ - var state = initState(list); +"use strict"; - while (state.index < (state['keyedList'] || list).length) - { - iterate(list, iterator, state, function(error, result) - { - if (error) - { - callback(error, result); - return; - } - // looks like it's the last one - if (Object.keys(state.jobs).length === 0) - { - callback(null, state.results); - return; - } - }); +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = undefined; - state.index++; - } +var _asyncToGenerator2; - return terminator.bind(state, callback); +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + yield config.registries.yarn.saveHomeConfig({ + username: undefined, + email: undefined + }); -/***/ }), -/* 520 */ -/***/ (function(module, exports, __webpack_require__) { + reporter.success(reporter.lang('clearedCredentials')); + }); -var serialOrdered = __webpack_require__(351); + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); -// Public API -module.exports = serial; +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; -/** - * Runs iterator over provided array elements in series - * - * @param {array|object} list - array or object (named list) to iterate over - * @param {function} iterator - iterator to run - * @param {function} callback - invoked when all elements processed - * @returns {function} - jobs terminator - */ -function serial(list, iterator, callback) -{ - return serialOrdered(list, iterator, null, callback); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function setFlags(commander) { + commander.description('Clears registry username and email.'); } +function hasWrapper(commander, args) { + return true; +} /***/ }), -/* 521 */ +/* 505 */ /***/ (function(module, exports, __webpack_require__) { +"use strict"; -/*! - * Copyright 2010 LearnBoost - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Module dependencies. - */ -var crypto = __webpack_require__(11) - , parse = __webpack_require__(24).parse - ; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = undefined; -/** - * Valid keys. - */ +var _extends2; -var keys = - [ 'acl' - , 'location' - , 'logging' - , 'notification' - , 'partNumber' - , 'policy' - , 'requestPayment' - , 'torrent' - , 'uploadId' - , 'uploads' - , 'versionId' - , 'versioning' - , 'versions' - , 'website' - ] +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(20)); +} -/** - * Return an "Authorization" header value with the given `options` - * in the form of "AWS :" - * - * @param {Object} options - * @return {String} - * @api private - */ +var _asyncToGenerator2; -function authorization (options) { - return 'AWS ' + options.key + ':' + sign(options) +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } -module.exports = authorization -module.exports.authorization = authorization - -/** - * Simple HMAC-SHA1 Wrapper - * - * @param {Object} options - * @return {String} - * @api private - */ - -function hmacSha1 (options) { - return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64') -} - -module.exports.hmacSha1 = hmacSha1 +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const pnpPath = `${config.lockfileFolder}/${(_constants || _load_constants()).PNP_FILENAME}`; -/** - * Create a base64 sha1 HMAC for `options`. - * - * @param {Object} options - * @return {String} - * @api private - */ + let nodeOptions = process.env.NODE_OPTIONS || ''; + if (yield (_fs || _load_fs()).exists(pnpPath)) { + nodeOptions = `--require ${pnpPath} ${nodeOptions}`; + } -function sign (options) { - options.message = stringToSign(options) - return hmacSha1(options) -} -module.exports.sign = sign + try { + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, args, { + stdio: 'inherit', + cwd: flags.into || config.cwd, + env: (0, (_extends2 || _load_extends()).default)({}, process.env, { NODE_OPTIONS: nodeOptions }) + }); + } catch (err) { + throw err; + } + }); -/** - * Create a base64 sha1 HMAC for `options`. - * - * Specifically to be used with S3 presigned URLs - * - * @param {Object} options - * @return {String} - * @api private - */ + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); -function signQuery (options) { - options.message = queryStringToSign(options) - return hmacSha1(options) -} -module.exports.signQuery= signQuery +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; -/** - * Return a string for sign() with the given `options`. - * - * Spec: - * - * \n - * \n - * \n - * \n - * [headers\n] - * - * - * @param {Object} options - * @return {String} - * @api private - */ +var _child; -function stringToSign (options) { - var headers = options.amazonHeaders || '' - if (headers) headers += '\n' - var r = - [ options.verb - , options.md5 - , options.contentType - , options.date ? options.date.toUTCString() : '' - , headers + options.resource - ] - return r.join('\n') +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(50)); } -module.exports.stringToSign = stringToSign -/** - * Return a string for sign() with the given `options`, but is meant exclusively - * for S3 presigned URLs - * - * Spec: - * - * \n - * - * - * @param {Object} options - * @return {String} - * @api private - */ +var _fs; -function queryStringToSign (options){ - return 'GET\n\n\n' + options.date + '\n' + options.resource +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(5)); } -module.exports.queryStringToSign = queryStringToSign -/** - * Perform the following: - * - * - ignore non-amazon headers - * - lowercase fields - * - sort lexicographically - * - trim whitespace between ":" - * - join with newline - * - * @param {Object} headers - * @return {String} - * @api private - */ +var _constants; -function canonicalizeHeaders (headers) { - var buf = [] - , fields = Object.keys(headers) - ; - for (var i = 0, len = fields.length; i < len; ++i) { - var field = fields[i] - , val = headers[field] - , field = field.toLowerCase() - ; - if (0 !== field.indexOf('x-amz')) continue - buf.push(field + ':' + val) - } - return buf.sort().join('\n') +function _load_constants() { + return _constants = __webpack_require__(8); } -module.exports.canonicalizeHeaders = canonicalizeHeaders -/** - * Perform the following: - * - * - ignore non sub-resources - * - sort lexicographically - * - * @param {String} resource - * @return {String} - * @api private - */ - -function canonicalizeResource (resource) { - var url = parse(resource, true) - , path = url.pathname - , buf = [] - ; +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - Object.keys(url.query).forEach(function(key){ - if (!~keys.indexOf(key)) return - var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key]) - buf.push(key + val) - }) +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - return path + (buf.length ? '?' + buf.sort().join('&') : '') +function setFlags(commander) { + commander.description('Runs Node with the same version that the one used by Yarn itself, and by default from the project root'); + commander.usage('node [--into PATH] [... args]'); + commander.option('--into ', 'Sets the cwd to the specified location'); } -module.exports.canonicalizeResource = canonicalizeResource +function hasWrapper(commander, args) { + return true; +} /***/ }), -/* 522 */ +/* 506 */ /***/ (function(module, exports, __webpack_require__) { -var aws4 = exports, - url = __webpack_require__(24), - querystring = __webpack_require__(197), - crypto = __webpack_require__(11), - lru = __webpack_require__(523), - credentialsCache = lru(1000) - -// http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html - -function hmac(key, string, encoding) { - return crypto.createHmac('sha256', key).update(string, 'utf8').digest(encoding) -} - -function hash(string, encoding) { - return crypto.createHash('sha256').update(string, 'utf8').digest(encoding) -} - -// This function assumes the string has already been percent encoded -function encodeRfc3986(urlEncodedString) { - return urlEncodedString.replace(/[!'()*]/g, function(c) { - return '%' + c.charCodeAt(0).toString(16).toUpperCase() - }) -} - -// request: { path | body, [host], [method], [headers], [service], [region] } -// credentials: { accessKeyId, secretAccessKey, [sessionToken] } -function RequestSigner(request, credentials) { - - if (typeof request === 'string') request = url.parse(request) - - var headers = request.headers = (request.headers || {}), - hostParts = this.matchHost(request.hostname || request.host || headers.Host || headers.host) - - this.request = request - this.credentials = credentials || this.defaultCredentials() - - this.service = request.service || hostParts[0] || '' - this.region = request.region || hostParts[1] || 'us-east-1' - - // SES uses a different domain from the service name - if (this.service === 'email') this.service = 'ses' - - if (!request.method && request.body) - request.method = 'POST' - - if (!headers.Host && !headers.host) { - headers.Host = request.hostname || request.host || this.createHost() - - // If a port is specified explicitly, use it as is - if (request.port) - headers.Host += ':' + request.port - } - if (!request.hostname && !request.host) - request.hostname = headers.Host || headers.host +"use strict"; - this.isCodeCommitGit = this.service === 'codecommit' && request.method === 'GIT' -} -RequestSigner.prototype.matchHost = function(host) { - var match = (host || '').match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/) - var hostParts = (match || []).slice(1, 3) +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = exports.requireLockfile = undefined; - // ES's hostParts are sometimes the other way round, if the value that is expected - // to be region equals ‘es’ switch them back - // e.g. search-cluster-name-aaaa00aaaa0aaa0aaaaaaa0aaa.us-east-1.es.amazonaws.com - if (hostParts[1] === 'es') - hostParts = hostParts.reverse() +var _extends2; - return hostParts +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(20)); } -// http://docs.aws.amazon.com/general/latest/gr/rande.html -RequestSigner.prototype.isSingleRegion = function() { - // Special case for S3 and SimpleDB in us-east-1 - if (['s3', 'sdb'].indexOf(this.service) >= 0 && this.region === 'us-east-1') return true - - return ['cloudfront', 'ls', 'route53', 'iam', 'importexport', 'sts'] - .indexOf(this.service) >= 0 -} +var _asyncToGenerator2; -RequestSigner.prototype.createHost = function() { - var region = this.isSingleRegion() ? '' : - (this.service === 's3' && this.region !== 'us-east-1' ? '-' : '.') + this.region, - service = this.service === 'ses' ? 'email' : this.service - return service + region + '.amazonaws.com' +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } -RequestSigner.prototype.prepareRequest = function() { - this.parsePath() - - var request = this.request, headers = request.headers, query +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const lockfile = yield (_lockfile || _load_lockfile()).default.fromDirectory(config.lockfileFolder); + const install = new (_install || _load_install()).Install((0, (_extends2 || _load_extends()).default)({}, flags, { includeWorkspaceDeps: true }), config, reporter, lockfile); + let deps = yield (_packageRequest || _load_packageRequest()).default.getOutdatedPackages(lockfile, install, config, reporter); - if (request.signQuery) { + if (args.length) { + const requested = new Set(args); - this.parsedPath.query = query = this.parsedPath.query || {} + deps = deps.filter(function ({ name }) { + return requested.has(name); + }); + } - if (this.credentials.sessionToken) - query['X-Amz-Security-Token'] = this.credentials.sessionToken + const getNameFromHint = function getNameFromHint(hint) { + return hint ? `${hint}Dependencies` : 'dependencies'; + }; + const colorizeName = function colorizeName({ current, latest, name }) { + return reporter.format[(0, (_colorForVersions || _load_colorForVersions()).default)(current, latest)](name); + }; - if (this.service === 's3' && !query['X-Amz-Expires']) - query['X-Amz-Expires'] = 86400 + if (deps.length) { + const usesWorkspaces = !!config.workspaceRootFolder; + const body = deps.map(function (info) { + const row = [colorizeName(info), info.current, (0, (_colorizeDiff || _load_colorizeDiff()).default)(info.current, info.wanted, reporter), reporter.format.cyan(info.latest), info.workspaceName || '', getNameFromHint(info.hint), reporter.format.cyan(info.url)]; + if (!usesWorkspaces) { + row.splice(4, 1); + } + return row; + }); - if (query['X-Amz-Date']) - this.datetime = query['X-Amz-Date'] - else - query['X-Amz-Date'] = this.getDateTime() + const red = reporter.format.red(''); + const yellow = reporter.format.yellow(''); + const green = reporter.format.green(''); + reporter.info(reporter.lang('legendColorsForVersionUpdates', red, yellow, green)); - query['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256' - query['X-Amz-Credential'] = this.credentials.accessKeyId + '/' + this.credentialString() - query['X-Amz-SignedHeaders'] = this.signedHeaders() + const header = ['Package', 'Current', 'Wanted', 'Latest', 'Workspace', 'Package Type', 'URL']; + if (!usesWorkspaces) { + header.splice(4, 1); + } + reporter.table(header, body); - } else { + return 1; + } + return 0; + }); - if (!request.doNotModifyHeaders && !this.isCodeCommitGit) { - if (request.body && !headers['Content-Type'] && !headers['content-type']) - headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8' + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); - if (request.body && !headers['Content-Length'] && !headers['content-length']) - headers['Content-Length'] = Buffer.byteLength(request.body) +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; - if (this.credentials.sessionToken && !headers['X-Amz-Security-Token'] && !headers['x-amz-security-token']) - headers['X-Amz-Security-Token'] = this.credentials.sessionToken +var _packageRequest; - if (this.service === 's3' && !headers['X-Amz-Content-Sha256'] && !headers['x-amz-content-sha256']) - headers['X-Amz-Content-Sha256'] = hash(this.request.body || '', 'hex') +function _load_packageRequest() { + return _packageRequest = _interopRequireDefault(__webpack_require__(122)); +} - if (headers['X-Amz-Date'] || headers['x-amz-date']) - this.datetime = headers['X-Amz-Date'] || headers['x-amz-date'] - else - headers['X-Amz-Date'] = this.getDateTime() - } +var _lockfile; - delete headers.Authorization - delete headers.authorization - } +function _load_lockfile() { + return _lockfile = _interopRequireDefault(__webpack_require__(19)); } -RequestSigner.prototype.sign = function() { - if (!this.parsedPath) this.prepareRequest() +var _install; - if (this.request.signQuery) { - this.parsedPath.query['X-Amz-Signature'] = this.signature() - } else { - this.request.headers.Authorization = this.authHeader() - } +function _load_install() { + return _install = __webpack_require__(34); +} - this.request.path = this.formatPath() +var _colorForVersions; - return this.request +function _load_colorForVersions() { + return _colorForVersions = _interopRequireDefault(__webpack_require__(363)); } -RequestSigner.prototype.getDateTime = function() { - if (!this.datetime) { - var headers = this.request.headers, - date = new Date(headers.Date || headers.date || new Date) - - this.datetime = date.toISOString().replace(/[:\-]|\.\d{3}/g, '') +var _colorizeDiff; - // Remove the trailing 'Z' on the timestamp string for CodeCommit git access - if (this.isCodeCommitGit) this.datetime = this.datetime.slice(0, -1) - } - return this.datetime +function _load_colorizeDiff() { + return _colorizeDiff = _interopRequireDefault(__webpack_require__(364)); } -RequestSigner.prototype.getDate = function() { - return this.getDateTime().substr(0, 8) -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -RequestSigner.prototype.authHeader = function() { - return [ - 'AWS4-HMAC-SHA256 Credential=' + this.credentials.accessKeyId + '/' + this.credentialString(), - 'SignedHeaders=' + this.signedHeaders(), - 'Signature=' + this.signature(), - ].join(', ') -} +const requireLockfile = exports.requireLockfile = true; -RequestSigner.prototype.signature = function() { - var date = this.getDate(), - cacheKey = [this.credentials.secretAccessKey, date, this.region, this.service].join(), - kDate, kRegion, kService, kCredentials = credentialsCache.get(cacheKey) - if (!kCredentials) { - kDate = hmac('AWS4' + this.credentials.secretAccessKey, date) - kRegion = hmac(kDate, this.region) - kService = hmac(kRegion, this.service) - kCredentials = hmac(kService, 'aws4_request') - credentialsCache.set(cacheKey, kCredentials) - } - return hmac(kCredentials, this.stringToSign(), 'hex') +function setFlags(commander) { + commander.description('Checks for outdated package dependencies.'); + commander.usage('outdated [packages ...]'); } -RequestSigner.prototype.stringToSign = function() { - return [ - 'AWS4-HMAC-SHA256', - this.getDateTime(), - this.credentialString(), - hash(this.canonicalString(), 'hex'), - ].join('\n') +function hasWrapper(commander, args) { + return true; } -RequestSigner.prototype.canonicalString = function() { - if (!this.parsedPath) this.prepareRequest() - - var pathStr = this.parsedPath.path, - query = this.parsedPath.query, - headers = this.request.headers, - queryStr = '', - normalizePath = this.service !== 's3', - decodePath = this.service === 's3' || this.request.doNotEncodePath, - decodeSlashesInPath = this.service === 's3', - firstValOnly = this.service === 's3', - bodyHash +/***/ }), +/* 507 */ +/***/ (function(module, exports, __webpack_require__) { - if (this.service === 's3' && this.request.signQuery) { - bodyHash = 'UNSIGNED-PAYLOAD' - } else if (this.isCodeCommitGit) { - bodyHash = '' - } else { - bodyHash = headers['X-Amz-Content-Sha256'] || headers['x-amz-content-sha256'] || - hash(this.request.body || '', 'hex') - } +"use strict"; - if (query) { - queryStr = encodeRfc3986(querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) { - if (!key) return obj - obj[key] = !Array.isArray(query[key]) ? query[key] : - (firstValOnly ? query[key][0] : query[key].slice().sort()) - return obj - }, {}))) - } - if (pathStr !== '/') { - if (normalizePath) pathStr = pathStr.replace(/\/{2,}/g, '/') - pathStr = pathStr.split('/').reduce(function(path, piece) { - if (normalizePath && piece === '..') { - path.pop() - } else if (!normalizePath || piece !== '.') { - if (decodePath) piece = decodeURIComponent(piece) - path.push(encodeRfc3986(encodeURIComponent(piece))) - } - return path - }, []).join('/') - if (pathStr[0] !== '/') pathStr = '/' + pathStr - if (decodeSlashesInPath) pathStr = pathStr.replace(/%2F/g, '/') - } - return [ - this.request.method || 'GET', - pathStr, - queryStr, - this.canonicalHeaders() + '\n', - this.signedHeaders(), - bodyHash, - ].join('\n') -} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.examples = exports.hasWrapper = exports.run = exports.mutate = undefined; -RequestSigner.prototype.canonicalHeaders = function() { - var headers = this.request.headers - function trimAll(header) { - return header.toString().trim().replace(/\s+/g, ' ') - } - return Object.keys(headers) - .sort(function(a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 }) - .map(function(key) { return key.toLowerCase() + ':' + trimAll(headers[key]) }) - .join('\n') -} +var _asyncToGenerator2; -RequestSigner.prototype.signedHeaders = function() { - return Object.keys(this.request.headers) - .map(function(key) { return key.toLowerCase() }) - .sort() - .join(';') +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } -RequestSigner.prototype.credentialString = function() { - return [ - this.getDate(), - this.region, - this.service, - 'aws4_request', - ].join('/') -} +let mutate = exports.mutate = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (args, config, reporter, buildMessages, mutator) { + if (args.length !== 2 && args.length !== 1) { + return false; + } -RequestSigner.prototype.defaultCredentials = function() { - var env = process.env - return { - accessKeyId: env.AWS_ACCESS_KEY_ID || env.AWS_ACCESS_KEY, - secretAccessKey: env.AWS_SECRET_ACCESS_KEY || env.AWS_SECRET_KEY, - sessionToken: env.AWS_SESSION_TOKEN, - } -} + const username = args.shift(); + const name = yield (0, (_tag || _load_tag()).getName)(args, config); + if (!(0, (_validate || _load_validate()).isValidPackageName)(name)) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('invalidPackageName')); + } -RequestSigner.prototype.parsePath = function() { - var path = this.request.path || '/', - queryIx = path.indexOf('?'), - query = null + const msgs = buildMessages(username, name); + reporter.step(1, 3, reporter.lang('loggingIn')); + const revoke = yield (0, (_login || _load_login()).getToken)(config, reporter, name); - if (queryIx >= 0) { - query = querystring.parse(path.slice(queryIx + 1)) - path = path.slice(0, queryIx) - } + reporter.step(2, 3, msgs.info); + const user = yield config.registries.npm.request(`-/user/org.couchdb.user:${username}`); + let error = false; + if (user) { + // get package + const pkg = yield config.registries.npm.request((_npmRegistry || _load_npmRegistry()).default.escapeName(name)); + if (pkg) { + pkg.maintainers = pkg.maintainers || []; + error = mutator({ name: user.name, email: user.email }, pkg); + } else { + error = true; + reporter.error(reporter.lang('unknownPackage', name)); + } - // S3 doesn't always encode characters > 127 correctly and - // all services don't encode characters > 255 correctly - // So if there are non-reserved chars (and it's not already all % encoded), just encode them all - if (/[^0-9A-Za-z!'()*\-._~%/]/.test(path)) { - path = path.split('/').map(function(piece) { - return encodeURIComponent(decodeURIComponent(piece)) - }).join('/') - } + // update package + if (pkg && !error) { + const res = yield config.registries.npm.request(`${(_npmRegistry || _load_npmRegistry()).default.escapeName(name)}/-rev/${pkg._rev}`, { + method: 'PUT', + body: { + _id: pkg._id, + _rev: pkg._rev, + maintainers: pkg.maintainers + } + }); - this.parsedPath = { - path: path, - query: query, - } -} + if (res != null && res.success) { + reporter.success(msgs.success); + } else { + error = true; + reporter.error(msgs.error); + } + } + } else { + error = true; + reporter.error(reporter.lang('unknownUser', username)); + } -RequestSigner.prototype.formatPath = function() { - var path = this.parsedPath.path, - query = this.parsedPath.query + reporter.step(3, 3, reporter.lang('revokingToken')); + yield revoke(); - if (!query) return path + if (error) { + throw new Error(); + } else { + return true; + } + }); - // Services don't support empty query string keys - if (query[''] != null) delete query[''] + return function mutate(_x, _x2, _x3, _x4, _x5) { + return _ref.apply(this, arguments); + }; +})(); - return path + '?' + encodeRfc3986(querystring.stringify(query)) -} +let list = (() => { + var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + if (args.length > 1) { + return false; + } + const name = yield (0, (_tag || _load_tag()).getName)(args, config); + reporter.step(1, 1, reporter.lang('ownerGetting', name)); + const pkg = yield config.registries.npm.request(name, { unfiltered: true }); + if (pkg) { + const owners = pkg.maintainers; + if (!owners || !owners.length) { + reporter.warn(reporter.lang('ownerNone')); + } else { + for (var _iterator = owners, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref3; -aws4.RequestSigner = RequestSigner + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } -aws4.sign = function(request, credentials) { - return new RequestSigner(request, credentials).sign() -} + const owner = _ref3; + reporter.info(`${owner.name} <${owner.email}>`); + } + } + } else { + reporter.error(reporter.lang('ownerGettingFailed')); + } -/***/ }), -/* 523 */ -/***/ (function(module, exports) { + if (pkg) { + return true; + } else { + throw new Error(); + } + }); -module.exports = function(size) { - return new LruCache(size) -} + return function list(_x6, _x7, _x8, _x9) { + return _ref2.apply(this, arguments); + }; +})(); -function LruCache(size) { - this.capacity = size | 0 - this.map = Object.create(null) - this.list = new DoublyLinkedList() -} +exports.setFlags = setFlags; -LruCache.prototype.get = function(key) { - var node = this.map[key] - if (node == null) return undefined - this.used(node) - return node.val -} +var _errors; -LruCache.prototype.set = function(key, val) { - var node = this.map[key] - if (node != null) { - node.val = val - } else { - if (!this.capacity) this.prune() - if (!this.capacity) return false - node = new DoublyLinkedNode(key, val) - this.map[key] = node - this.capacity-- - } - this.used(node) - return true +function _load_errors() { + return _errors = __webpack_require__(6); } -LruCache.prototype.used = function(node) { - this.list.moveToFront(node) -} +var _buildSubCommands2; -LruCache.prototype.prune = function() { - var node = this.list.pop() - if (node != null) { - delete this.map[node.key] - this.capacity++ - } +function _load_buildSubCommands() { + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(59)); } +var _validate; -function DoublyLinkedList() { - this.firstNode = null - this.lastNode = null +function _load_validate() { + return _validate = __webpack_require__(125); } -DoublyLinkedList.prototype.moveToFront = function(node) { - if (this.firstNode == node) return - - this.remove(node) +var _tag; - if (this.firstNode == null) { - this.firstNode = node - this.lastNode = node - node.prev = null - node.next = null - } else { - node.prev = null - node.next = this.firstNode - node.next.prev = node - this.firstNode = node - } +function _load_tag() { + return _tag = __webpack_require__(355); } -DoublyLinkedList.prototype.pop = function() { - var lastNode = this.lastNode - if (lastNode != null) { - this.remove(lastNode) - } - return lastNode -} +var _login; -DoublyLinkedList.prototype.remove = function(node) { - if (this.firstNode == node) { - this.firstNode = node.next - } else if (node.prev != null) { - node.prev.next = node.next - } - if (this.lastNode == node) { - this.lastNode = node.prev - } else if (node.next != null) { - node.next.prev = node.prev - } +function _load_login() { + return _login = __webpack_require__(107); } +var _npmRegistry; -function DoublyLinkedNode(key, val) { - this.key = key - this.val = val - this.prev = null - this.next = null +function _load_npmRegistry() { + return _npmRegistry = _interopRequireDefault(__webpack_require__(88)); } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -/***/ }), -/* 524 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - +function remove(config, reporter, flags, args) { + return mutate(args, config, reporter, (username, name) => ({ + info: reporter.lang('ownerRemoving', username, name), + success: reporter.lang('ownerRemoved'), + error: reporter.lang('ownerRemoveError') + }), (user, pkg) => { + let found = false; -Object.defineProperty(exports, "__esModule", { - value: true -}); + pkg.maintainers = pkg.maintainers.filter(o => { + const match = o.name === user.name; + found = found || match; + return !match; + }); -exports.default = function (message) { - return { - useless: true, - run() { - throw new (_errors || _load_errors()).MessageError(message); - }, - setFlags: () => {}, - hasWrapper: () => true - }; -}; + if (!found) { + reporter.error(reporter.lang('userNotAnOwner', user.name)); + } -var _errors; + return found; + }); +} -function _load_errors() { - return _errors = __webpack_require__(6); +function setFlags(commander) { + commander.description('Manages package owners.'); } -/***/ }), -/* 525 */ -/***/ (function(module, exports, __webpack_require__) { +var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).default)('owner', { + add(config, reporter, flags, args) { + return mutate(args, config, reporter, (username, name) => ({ + info: reporter.lang('ownerAdding', username, name), + success: reporter.lang('ownerAdded'), + error: reporter.lang('ownerAddingFailed') + }), (user, pkg) => { + for (var _iterator2 = pkg.maintainers, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref4; -"use strict"; + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref4 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref4 = _i2.value; + } + const owner = _ref4; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.examples = exports.hasWrapper = exports.run = undefined; -exports.setFlags = setFlags; + if (owner.name === user) { + reporter.error(reporter.lang('ownerAlready')); + return true; + } + } -var _buildSubCommands2; + pkg.maintainers.push(user); -function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(59)); -} + return false; + }); + }, -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + rm(config, reporter, flags, args) { + reporter.warn(`\`yarn owner rm\` is deprecated. Please use \`yarn owner remove\`.`); + return remove(config, reporter, flags, args); + }, -const notYetImplemented = () => Promise.reject(new Error('This command is not implemented yet.')); + remove(config, reporter, flags, args) { + return remove(config, reporter, flags, args); + }, -function setFlags(commander) { - commander.description('Has not been implemented yet'); -} + ls(config, reporter, flags, args) { + reporter.warn(`\`yarn owner ls\` is deprecated. Please use \`yarn owner list\`.`); + return list(config, reporter, flags, args); + }, -var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).default)('access', { - public: notYetImplemented, - restricted: notYetImplemented, - grant: notYetImplemented, - revoke: notYetImplemented, - lsPackages: notYetImplemented, - lsCollaborators: notYetImplemented, - edit: notYetImplemented -}, ['WARNING: This command yet to be implemented.', 'public []', 'restricted []', 'grant []', 'revoke []', 'ls-packages [||]', 'ls-collaborators [ []]', 'edit []']); + list(config, reporter, flags, args) { + return list(config, reporter, flags, args); + } +}, ['add [[<@scope>/]]', 'remove [[<@scope>/]]', 'list [<@scope>/]']); const run = _buildSubCommands.run, hasWrapper = _buildSubCommands.hasWrapper, @@ -95687,7 +94143,7 @@ exports.hasWrapper = hasWrapper; exports.examples = examples; /***/ }), -/* 526 */ +/* 508 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -95696,7 +94152,13 @@ exports.examples = examples; Object.defineProperty(exports, "__esModule", { value: true }); -exports.run = undefined; +exports.examples = exports.setFlags = exports.run = undefined; + +var _extends2; + +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(20)); +} var _asyncToGenerator2; @@ -95704,173 +94166,273 @@ function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } -let run = exports.run = (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - const binFolder = path.join(config.cwd, config.registryFolders[0], '.bin'); - if (args.length === 0) { - reporter.log(binFolder, { force: true }); - } else { - const binEntries = yield (0, (_run || _load_run()).getBinEntries)(config); +let fetchReleases = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, { includePrereleases = false } = {}) { + const token = process.env.GITHUB_TOKEN; + const tokenUrlParameter = token ? `?access_token=${token}` : ''; - const binName = args[0]; - const binPath = binEntries.get(binName); + const request = yield config.requestManager.request({ + url: `https://api.github.com/repos/yarnpkg/yarn/releases${tokenUrlParameter}`, + json: true + }); - if (binPath) { - reporter.log(binPath, { force: true }); - } else { - reporter.error(reporter.lang('packageBinaryNotFound', binName)); + const releases = request.filter(function (release) { + if (release.draft) { + return false; } - } + + if (release.prerelease && !includePrereleases) { + return false; + } + + // $FlowFixMe + release.version = semver.coerce(release.tag_name); + + if (!release.version) { + return false; + } + + if (!getBundleAsset(release)) { + return false; + } + + return true; + }); + + releases.sort(function (a, b) { + // $FlowFixMe + return -semver.compare(a.version, b.version); + }); + + return releases; }); - return function run(_x, _x2, _x3, _x4) { + return function fetchReleases(_x) { return _ref.apply(this, arguments); }; })(); exports.hasWrapper = hasWrapper; -exports.setFlags = setFlags; -var _run; +var _yarnVersion; -function _load_run() { - return _run = __webpack_require__(360); +function _load_yarnVersion() { + return _yarnVersion = __webpack_require__(105); } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const path = __webpack_require__(0); +var _child; -function hasWrapper(commander) { - return false; +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(50)); } -function setFlags(commander) { - commander.description('Displays the location of the yarn bin folder.'); +var _buildSubCommands2; + +function _load_buildSubCommands() { + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(59)); } -/***/ }), -/* 527 */ -/***/ (function(module, exports, __webpack_require__) { +var _rc; -"use strict"; +function _load_rc() { + return _rc = __webpack_require__(335); +} +var _fs; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.examples = exports.run = undefined; +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(5)); +} -var _asyncToGenerator2; +var _lockfile; -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +function _load_lockfile() { + return _lockfile = __webpack_require__(19); } -exports.hasWrapper = hasWrapper; -exports.setFlags = setFlags; +var _semver; -var _buildSubCommands2; +function _load_semver() { + return _semver = __webpack_require__(170); +} -function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(59)); +var _constants; + +function _load_constants() { + return _constants = __webpack_require__(8); } +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const CONFIG_KEYS = [ -// 'reporter', -'registryFolders', 'linkedModules', -// 'registries', -'cache', 'cwd', 'looseSemver', 'commandName', 'preferOffline', 'modulesFolder', 'globalFolder', 'linkFolder', 'offline', 'binLinks', 'ignorePlatform', 'ignoreScripts', 'disablePrepublish', 'nonInteractive', 'workspaceRootFolder', 'lockfileFolder', 'networkConcurrency', 'childConcurrency', 'networkTimeout', 'workspacesEnabled', 'workspacesNohoistEnabled', 'pruneOfflineMirror', 'enableMetaFolder', 'enableLockfileVersions', 'linkFileDependencies', 'cacheFolder', 'tempFolder', 'production']; -/* eslint object-shorthand: 0 */ +/* eslint-disable max-len */ -function hasWrapper(flags, args) { - return args[0] !== 'get'; +const V2_NAMES = ['berry', 'stable', 'canary', 'v2', '2']; + +const isLocalFile = version => version.match(/^\.{0,2}[\\/]/) || path.isAbsolute(version); +const isV2Version = version => (0, (_semver || _load_semver()).satisfiesWithPrereleases)(version, '>=2.0.0'); + +const chalk = __webpack_require__(30); +const invariant = __webpack_require__(9); +const path = __webpack_require__(0); +const semver = __webpack_require__(22); + +function getBundleAsset(release) { + return release.assets.find(asset => { + return asset.name.match(/^yarn-[0-9]+\.[0-9]+\.[0-9]+\.js$/); + }); } -function setFlags(commander) { - commander.description('Manages the yarn configuration files.'); +function fetchBundle(config, url) { + return config.requestManager.request({ + url, + buffer: true + }); } -var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).default)('config', { - set(config, reporter, flags, args) { +function hasWrapper(flags, args) { + return false; +} + +var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).default)('policies', { + setVersion(config, reporter, flags, args) { return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (args.length === 0 || args.length > 2) { - return false; - } - const key = args[0]; - var _args$ = args[1]; - const val = _args$ === undefined ? true : _args$; + const initialRange = args[0] || 'latest'; + let range = initialRange; - const yarnConfig = config.registries.yarn; - yield yarnConfig.saveHomeConfig({ [key]: val }); - reporter.success(reporter.lang('configSet', key, val)); - return true; - })(); - }, + let allowRc = flags.rc; - get(config, reporter, flags, args) { - if (args.length !== 1) { - return false; - } + if (range === 'rc') { + reporter.log(`${chalk.yellow(`Warning:`)} Your current Yarn binary is currently Yarn ${(_yarnVersion || _load_yarnVersion()).version}; to avoid potential breaking changes, 'set version rc' won't receive upgrades past the 1.22.x branch.\n To upgrade to the latest versions, run ${chalk.cyan(`yarn set version`)} ${chalk.yellow.underline(`canary`)} instead. Sorry for the inconvenience.\n`); - reporter.log(String(config.getOption(args[0])), { force: true }); - return true; - }, + range = '*'; + allowRc = true; + } - delete: (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - if (args.length !== 1) { - return false; + if (range === 'latest') { + reporter.log(`${chalk.yellow(`Warning:`)} Your current Yarn binary is currently Yarn ${(_yarnVersion || _load_yarnVersion()).version}; to avoid potential breaking changes, 'set version latest' won't receive upgrades past the 1.22.x branch.\n To upgrade to the latest versions, run ${chalk.cyan(`yarn set version`)} ${chalk.yellow.underline(`stable`)} instead. Sorry for the inconvenience.\n`); + + range = '*'; } - const key = args[0]; - const yarnConfig = config.registries.yarn; - yield yarnConfig.saveHomeConfig({ [key]: undefined }); - reporter.success(reporter.lang('configDelete', key)); - return true; - }); + if (range === 'classic') { + range = '*'; + } - function _delete(_x, _x2, _x3, _x4) { - return _ref.apply(this, arguments); - } + let bundleUrl; + let bundleVersion; + const isV2 = false; - return _delete; - })(), + if (range === 'nightly' || range === 'nightlies') { + reporter.log(`${chalk.yellow(`Warning:`)} Nightlies only exist for Yarn 1.x; starting from 2.x onwards, you should use 'canary' instead`); - list(config, reporter, flags, args) { - if (args.length) { - return false; - } + bundleUrl = 'https://nightly.yarnpkg.com/latest.js'; + bundleVersion = 'nightly'; + } else if (V2_NAMES.includes(range) || isLocalFile(range) || isV2Version(range)) { + const normalizedRange = range === `canary` ? `canary` : `stable`; - reporter.info(reporter.lang('configYarn')); - reporter.inspect(config.registries.yarn.config); + if (process.env.COREPACK_ROOT) { + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [path.join(process.env.COREPACK_ROOT, 'dist/corepack.js'), `yarn@${normalizedRange}`, `set`, `version`, normalizedRange], { + stdio: 'inherit', + cwd: config.cwd + }); - reporter.info(reporter.lang('configNpm')); - reporter.inspect(config.registries.npm.config); + return; + } else { + const bundle = yield fetchBundle(config, 'https://github.com/yarnpkg/berry/raw/master/packages/yarnpkg-cli/bin/yarn.js'); - return true; - }, + const yarnPath = path.resolve(config.lockfileFolder, `.yarn/releases/yarn-stable-temp.cjs`); + yield (_fs || _load_fs()).mkdirp(path.dirname(yarnPath)); + yield (_fs || _load_fs()).writeFile(yarnPath, bundle); + yield (_fs || _load_fs()).chmod(yarnPath, 0o755); - current(config, reporter, flags, args) { - if (args.length) { - return false; - } + try { + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [yarnPath, 'set', 'version', range], { + stdio: 'inherit', + cwd: config.lockfileFolder, + env: (0, (_extends2 || _load_extends()).default)({}, process.env, { + YARN_IGNORE_PATH: `1` + }) + }); + } catch (err) { + // eslint-disable-next-line no-process-exit + process.exit(1); + } - reporter.log(JSON.stringify(config, CONFIG_KEYS, 2), { force: true }); + return; + } + } else { + reporter.log(`Resolving ${chalk.yellow(initialRange)} to a url...`); - return true; + let releases = []; + + try { + releases = yield fetchReleases(config, { + includePrereleases: allowRc + }); + } catch (e) { + reporter.error(e.message); + return; + } + + const release = releases.find(function (release) { + // $FlowFixMe + return semver.satisfies(release.version, range); + }); + + if (!release) { + throw new Error(`Release not found: ${range}`); + } + + const asset = getBundleAsset(release); + invariant(asset, 'The bundle asset should exist'); + + bundleUrl = asset.browser_download_url; + bundleVersion = release.version.version; + } + + reporter.log(`Downloading ${chalk.green(bundleUrl)}...`); + + const bundle = yield fetchBundle(config, bundleUrl); + + const yarnPath = path.resolve(config.lockfileFolder, `.yarn/releases/yarn-${bundleVersion}.cjs`); + reporter.log(`Saving it into ${chalk.magenta(yarnPath)}...`); + yield (_fs || _load_fs()).mkdirp(path.dirname(yarnPath)); + yield (_fs || _load_fs()).writeFile(yarnPath, bundle); + yield (_fs || _load_fs()).chmod(yarnPath, 0o755); + + const targetPath = path.relative(config.lockfileFolder, yarnPath).replace(/\\/g, '/'); + + if (isV2) { + const rcPath = `${config.lockfileFolder}/.yarnrc.yml`; + reporter.log(`Updating ${chalk.magenta(rcPath)}...`); + + yield (_fs || _load_fs()).writeFilePreservingEol(rcPath, `yarnPath: ${JSON.stringify(targetPath)}\n`); + } else { + const rcPath = `${config.lockfileFolder}/.yarnrc`; + reporter.log(`Updating ${chalk.magenta(rcPath)}...`); + + const rc = (0, (_rc || _load_rc()).getRcConfigForFolder)(config.lockfileFolder); + rc['yarn-path'] = targetPath; + + yield (_fs || _load_fs()).writeFilePreservingEol(rcPath, `${(0, (_lockfile || _load_lockfile()).stringify)(rc)}\n`); + } + + reporter.log(`Done!`); + })(); } }); const run = _buildSubCommands.run, + setFlags = _buildSubCommands.setFlags, examples = _buildSubCommands.examples; exports.run = run; +exports.setFlags = setFlags; exports.examples = examples; /***/ }), -/* 528 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -95887,68 +94449,185 @@ function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } -var _extends2; +let publish = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, pkg, flags, dir) { + let access = flags.access; -function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(20)); -} + // if no access level is provided, check package.json for `publishConfig.access` + // see: https://docs.npmjs.com/files/package.json#publishconfig + if (!access && pkg && pkg.publishConfig && pkg.publishConfig.access) { + access = pkg.publishConfig.access; + } -let run = exports.run = (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - const builderName = args[0], - rest = args.slice(1); + // validate access argument + if (access && access !== 'public' && access !== 'restricted') { + throw new (_errors || _load_errors()).MessageError(config.reporter.lang('invalidAccess')); + } + // TODO this might modify package.json, do we need to reload it? + yield config.executeLifecycleScript('prepublish'); + yield config.executeLifecycleScript('prepare'); + yield config.executeLifecycleScript('prepublishOnly'); + yield config.executeLifecycleScript('prepack'); - if (!builderName) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('invalidPackageName')); + // get tarball stream + const stat = yield (_fs || _load_fs()).lstat(dir); + let stream; + if (stat.isDirectory()) { + stream = yield (0, (_pack || _load_pack()).pack)(config); + } else if (stat.isFile()) { + stream = fs2.createReadStream(dir); + } else { + throw new Error("Don't know how to handle this file type"); } + const buffer = yield new Promise(function (resolve, reject) { + const data = []; + invariant(stream, 'expected stream'); + stream.on('data', data.push.bind(data)).on('end', function () { + return resolve(Buffer.concat(data)); + }).on('error', reject); + }); - var _coerceCreatePackageN = coerceCreatePackageName(builderName); + yield config.executeLifecycleScript('postpack'); - const packageName = _coerceCreatePackageN.fullName, - commandName = _coerceCreatePackageN.name; + // copy normalized package and remove internal keys as they may be sensitive or yarn specific + pkg = Object.assign({}, pkg); + for (const key in pkg) { + if (key[0] === '_') { + delete pkg[key]; + } + } + const tag = flags.tag || 'latest'; + const tbName = `${pkg.name}-${pkg.version}.tgz`; + const tbURI = `${pkg.name}/-/${tbName}`; - const linkLoc = path.join(config.linkFolder, commandName); - if (yield (_fs || _load_fs()).exists(linkLoc)) { - reporter.info(reporter.lang('linkUsing', packageName)); - } else { - yield (0, (_global || _load_global()).run)(config, reporter, {}, ['add', packageName]); - } + // create body + const root = { + _id: pkg.name, + access, + name: pkg.name, + description: pkg.description, + 'dist-tags': { + [tag]: pkg.version + }, + versions: { + [pkg.version]: pkg + }, + readme: pkg.readme || '', + _attachments: { + [tbName]: { + content_type: 'application/octet-stream', + data: buffer.toString('base64'), + length: buffer.length + } + } + }; - const binFolder = yield (0, (_global || _load_global()).getBinFolder)(config, {}); - const command = path.resolve(binFolder, commandName); - const env = yield (0, (_executeLifecycleScript || _load_executeLifecycleScript()).makeEnv)('create', config.cwd, config); + pkg._id = `${pkg.name}@${pkg.version}`; + pkg.dist = pkg.dist || {}; + pkg.dist.shasum = crypto.createHash('sha1').update(buffer).digest('hex'); + pkg.dist.integrity = ssri.fromData(buffer).toString(); - yield (_child || _load_child()).spawn(command, rest, { stdio: `inherit`, shell: true, env }); + const registry = String(config.getOption('registry')); + pkg.dist.tarball = url.resolve(registry, tbURI).replace(/^https:\/\//, 'http://'); + + // publish package + try { + yield config.registries.npm.request((_npmRegistry || _load_npmRegistry()).default.escapeName(pkg.name), { + registry: pkg && pkg.publishConfig && pkg.publishConfig.registry, + method: 'PUT', + body: root + }); + } catch (error) { + throw new (_errors || _load_errors()).MessageError(config.reporter.lang('publishFail', error.message)); + } + + yield config.executeLifecycleScript('publish'); + yield config.executeLifecycleScript('postpublish'); }); - return function run(_x, _x2, _x3, _x4) { + return function publish(_x, _x2, _x3, _x4) { return _ref.apply(this, arguments); }; })(); +let run = exports.run = (() => { + var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + // validate arguments + const dir = args[0] ? (_path || _load_path()).default.resolve(config.cwd, args[0]) : config.cwd; + if (args.length > 1) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('tooManyArguments', 1)); + } + if (!(yield (_fs || _load_fs()).exists(dir))) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('unknownFolderOrTarball')); + } + + const stat = yield (_fs || _load_fs()).lstat(dir); + let publishPath = dir; + if (stat.isDirectory()) { + config.cwd = (_path || _load_path()).default.resolve(dir); + publishPath = config.cwd; + } + + // validate package fields that are required for publishing + // $FlowFixMe + const pkg = yield config.readRootManifest(); + if (pkg.private) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('publishPrivate')); + } + if (!pkg.name) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('noName')); + } + + let registry = ''; + + if (pkg && pkg.publishConfig && pkg.publishConfig.registry) { + registry = pkg.publishConfig.registry; + } + + reporter.step(1, 4, reporter.lang('bumpingVersion')); + const commitVersion = yield (0, (_version || _load_version()).setVersion)(config, reporter, flags, [], false); + + // + reporter.step(2, 4, reporter.lang('loggingIn')); + const revoke = yield (0, (_login || _load_login()).getToken)(config, reporter, pkg.name, flags, registry); + + // + reporter.step(3, 4, reporter.lang('publishing')); + yield publish(config, pkg, flags, publishPath); + yield commitVersion(); + reporter.success(reporter.lang('published')); + + // + reporter.step(4, 4, reporter.lang('revokingToken')); + yield revoke(); + }); + + return function run(_x5, _x6, _x7, _x8) { + return _ref2.apply(this, arguments); + }; +})(); + exports.setFlags = setFlags; exports.hasWrapper = hasWrapper; -exports.parsePackageName = parsePackageName; -exports.coerceCreatePackageName = coerceCreatePackageName; -var _errors; +var _npmRegistry; -function _load_errors() { - return _errors = __webpack_require__(6); +function _load_npmRegistry() { + return _npmRegistry = _interopRequireDefault(__webpack_require__(88)); } -var _child; +var _errors; -function _load_child() { - return _child = _interopRequireWildcard(__webpack_require__(50)); +function _load_errors() { + return _errors = __webpack_require__(6); } -var _executeLifecycleScript; +var _version; -function _load_executeLifecycleScript() { - return _executeLifecycleScript = __webpack_require__(112); +function _load_version() { + return _version = __webpack_require__(357); } var _fs; @@ -95957,60 +94636,290 @@ function _load_fs() { return _fs = _interopRequireWildcard(__webpack_require__(5)); } -var _global; +var _pack; -function _load_global() { - return _global = __webpack_require__(121); +function _load_pack() { + return _pack = __webpack_require__(166); +} + +var _login; + +function _load_login() { + return _login = __webpack_require__(107); +} + +var _path; + +function _load_path() { + return _path = _interopRequireDefault(__webpack_require__(0)); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const path = __webpack_require__(0); +const invariant = __webpack_require__(9); + +const crypto = __webpack_require__(11); +const url = __webpack_require__(24); +const fs2 = __webpack_require__(4); +const ssri = __webpack_require__(65); function setFlags(commander) { - commander.description('Creates new projects from any create-* starter kits.'); + (0, (_version || _load_version()).setFlags)(commander); + commander.description('Publishes a package to the npm registry.'); + commander.usage('publish [|] [--tag ] [--access ]'); + commander.option('--access [access]', 'access'); + commander.option('--tag [tag]', 'tag'); } function hasWrapper(commander, args) { return true; } -function parsePackageName(str) { - if (str.charAt(0) === '/') { - throw new Error(`Name should not start with "/", got "${str}"`); - } - if (str.charAt(0) === '.') { - throw new Error(`Name should not start with ".", got "${str}"`); +/***/ }), +/* 510 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.examples = exports.hasWrapper = exports.run = undefined; + +var _extends2; + +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(20)); +} + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); +} + +let removeTeamUser = (() => { + var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (parts, config, reporter) { + reporter.step(2, 3, reporter.lang('teamRemovingUser')); + reporter.inspect((yield config.registries.npm.request(`team/${parts.scope}/${parts.team}/user`, { + method: 'DELETE', + body: { + user: parts.user + } + }))); + return true; + }); + + return function removeTeamUser(_x5, _x6, _x7) { + return _ref2.apply(this, arguments); + }; +})(); + +let list = (() => { + var _ref3 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (parts, config, reporter) { + reporter.step(2, 3, reporter.lang('teamListing')); + const uriParams = '?format=cli'; + if (parts.team) { + reporter.inspect((yield config.registries.npm.request(`team/${parts.scope}/${parts.team}/user${uriParams}`))); + } else { + reporter.inspect((yield config.registries.npm.request(`org/${parts.scope}/team${uriParams}`))); + } + return true; + }); + + return function list(_x8, _x9, _x10) { + return _ref3.apply(this, arguments); + }; +})(); + +exports.setFlags = setFlags; + +var _buildSubCommands2; + +function _load_buildSubCommands() { + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(59)); +} + +var _login; + +function _load_login() { + return _login = __webpack_require__(107); +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function explodeScopeTeam(arg, requireTeam, reporter) { + var _arg$split = arg.split(':'); + + const scope = _arg$split[0], + team = _arg$split[1], + parts = _arg$split.slice(2); + + if (parts.length) { + return false; } - const parts = str.split('/'); - const isScoped = str.charAt(0) === '@'; - if (isScoped && parts[0] === '@') { - throw new Error(`Scope should not be empty, got "${str}"`); + + if (requireTeam && !team) { + return false; } - const scope = isScoped ? parts[0] : ''; - const name = parts[isScoped ? 1 : 0] || ''; - const path = parts.slice(isScoped ? 2 : 1).join('/'); - const fullName = [scope, name].filter(Boolean).join('/'); - const full = [scope, name, path].filter(Boolean).join('/'); - return { fullName, name, scope, path, full }; + return { + scope: scope || '', + team: team || '', + user: '' + }; } -function coerceCreatePackageName(str) { - const pkgNameObj = parsePackageName(str); - const coercedName = pkgNameObj.name !== '' ? `create-${pkgNameObj.name}` : `create`; - const coercedPkgNameObj = (0, (_extends2 || _load_extends()).default)({}, pkgNameObj, { - name: coercedName, - fullName: [pkgNameObj.scope, coercedName].filter(Boolean).join('/'), - full: [pkgNameObj.scope, coercedName, pkgNameObj.path].filter(Boolean).join('/') - }); - return coercedPkgNameObj; +function warnDeprecation(reporter, deprecationWarning) { + const command = 'yarn team'; + reporter.warn(reporter.lang('deprecatedCommand', `${command} ${deprecationWarning.deprecatedCommand}`, `${command} ${deprecationWarning.currentCommand}`)); +} + +function wrapRequired(callback, requireTeam, deprecationInfo) { + return (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + if (deprecationInfo) { + warnDeprecation(reporter, deprecationInfo); + } + + if (!args.length) { + return false; + } + + const parts = explodeScopeTeam(args[0], requireTeam, reporter); + if (!parts) { + return false; + } + + reporter.step(1, 3, reporter.lang('loggingIn')); + const revoke = yield (0, (_login || _load_login()).getToken)(config, reporter); + + const res = yield callback(parts, config, reporter, flags, args); + if (!res) { + return res; + } + + reporter.step(3, 3, reporter.lang('revokingToken')); + yield revoke(); + return true; + }); + + return function (_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; + })(); +} + +function wrapRequiredTeam(callback, requireTeam = true, subCommandDeprecated) { + return wrapRequired(function (parts, config, reporter, flags, args) { + if (args.length === 1) { + return callback(parts, config, reporter, flags, args); + } else { + return false; + } + }, requireTeam, subCommandDeprecated); +} + +function wrapRequiredUser(callback, subCommandDeprecated) { + return wrapRequired(function (parts, config, reporter, flags, args) { + if (args.length === 2) { + return callback((0, (_extends2 || _load_extends()).default)({ + user: args[1] + }, parts), config, reporter, flags, args); + } else { + return false; + } + }, true, subCommandDeprecated); +} + +function setFlags(commander) { + commander.description('Maintain team memberships'); } +var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).default)('team', { + create: wrapRequiredTeam((() => { + var _ref4 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (parts, config, reporter, flags, args) { + reporter.step(2, 3, reporter.lang('teamCreating')); + reporter.inspect((yield config.registries.npm.request(`team/${parts.scope}`, { + method: 'PUT', + body: { + team: parts.team + } + }))); + return true; + }); + + return function (_x11, _x12, _x13, _x14, _x15) { + return _ref4.apply(this, arguments); + }; + })()), + + destroy: wrapRequiredTeam((() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (parts, config, reporter, flags, args) { + reporter.step(2, 3, reporter.lang('teamRemoving')); + reporter.inspect((yield config.registries.npm.request(`team/${parts.scope}/${parts.team}`, { + method: 'DELETE' + }))); + return true; + }); + + return function (_x16, _x17, _x18, _x19, _x20) { + return _ref5.apply(this, arguments); + }; + })()), + + add: wrapRequiredUser((() => { + var _ref6 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (parts, config, reporter, flags, args) { + reporter.step(2, 3, reporter.lang('teamAddingUser')); + reporter.inspect((yield config.registries.npm.request(`team/${parts.scope}/${parts.team}/user`, { + method: 'PUT', + body: { + user: parts.user + } + }))); + return true; + }); + + return function (_x21, _x22, _x23, _x24, _x25) { + return _ref6.apply(this, arguments); + }; + })()), + + rm: wrapRequiredUser(function (parts, config, reporter, flags, args) { + removeTeamUser(parts, config, reporter); + }, { + deprecatedCommand: 'rm', + currentCommand: 'remove' + }), + + remove: wrapRequiredUser(function (parts, config, reporter, flags, args) { + removeTeamUser(parts, config, reporter); + }), + + ls: wrapRequiredTeam(function (parts, config, reporter, flags, args) { + list(parts, config, reporter); + }, false, { + deprecatedCommand: 'ls', + currentCommand: 'list' + }), + + list: wrapRequiredTeam(function (parts, config, reporter, flags, args) { + list(parts, config, reporter); + }, false) +}, ['create ', 'destroy ', 'add ', 'remove ', 'list |']); + +const run = _buildSubCommands.run, + hasWrapper = _buildSubCommands.hasWrapper, + examples = _buildSubCommands.examples; +exports.run = run; +exports.hasWrapper = hasWrapper; +exports.examples = examples; + /***/ }), -/* 529 */ +/* 511 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -96029,16 +94938,63 @@ function _load_asyncToGenerator() { let run = exports.run = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - const env = yield (0, (_executeLifecycleScript || _load_executeLifecycleScript()).makeEnv)(`exec`, config.cwd, config); + if (args.length) { + for (var _iterator = args, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref2; - if (args.length < 1) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('execMissingCommand')); - } + if (_isArray) { + if (_i >= _iterator.length) break; + _ref2 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref2 = _i.value; + } - const execName = args[0], - rest = args.slice(1); + const name = _ref2; - yield (_child || _load_child()).spawn(execName, rest, { stdio: 'inherit', env }); + const linkLoc = path.join(config.linkFolder, name); + if (yield (_fs || _load_fs()).exists(linkLoc)) { + yield (_fs || _load_fs()).unlink(path.join((yield (0, (_link || _load_link()).getRegistryFolder)(config, name)), name)); + reporter.success(reporter.lang('linkDisusing', name)); + reporter.info(reporter.lang('linkDisusingMessage', name)); + } else { + throw new (_errors || _load_errors()).MessageError(reporter.lang('linkMissing', name)); + } + } + } else { + // remove from registry + const manifest = yield config.readRootManifest(); + const name = manifest.name; + if (!name) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('unknownPackageName')); + } + + const linkLoc = path.join(config.linkFolder, name); + if (yield (_fs || _load_fs()).exists(linkLoc)) { + // If there is a `bin` defined in the package.json, + // link each bin to the global bin + if (manifest.bin) { + const globalBinFolder = yield (0, (_global || _load_global()).getBinFolder)(config, flags); + for (const binName in manifest.bin) { + const binDestLoc = path.join(globalBinFolder, binName); + if (yield (_fs || _load_fs()).exists(binDestLoc)) { + yield (_fs || _load_fs()).unlink(binDestLoc); + if (process.platform === 'win32') { + yield (_fs || _load_fs()).unlink(binDestLoc + '.cmd'); + } + } + } + } + + yield (_fs || _load_fs()).unlink(linkLoc); + + reporter.success(reporter.lang('linkUnregistered', name)); + reporter.info(reporter.lang('linkUnregisteredMessage', name)); + } else { + throw new (_errors || _load_errors()).MessageError(reporter.lang('linkMissing', name)); + } + } }); return function run(_x, _x2, _x3, _x4) { @@ -96055,30 +95011,40 @@ function _load_errors() { return _errors = __webpack_require__(6); } -var _child; +var _fs; -function _load_child() { - return _child = _interopRequireWildcard(__webpack_require__(50)); +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(5)); } -var _executeLifecycleScript; +var _link; -function _load_executeLifecycleScript() { - return _executeLifecycleScript = __webpack_require__(112); +function _load_link() { + return _link = __webpack_require__(351); +} + +var _global; + +function _load_global() { + return _global = __webpack_require__(121); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function setFlags(commander) {} +const path = __webpack_require__(0); + +function setFlags(commander) { + commander.description('Unlink a previously created symlink for a package.'); +} function hasWrapper(commander, args) { return true; } /***/ }), -/* 530 */ +/* 512 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -96087,7 +95053,7 @@ function hasWrapper(commander, args) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.examples = exports.run = undefined; +exports.clearAll = exports.clearSome = exports.run = undefined; var _asyncToGenerator2; @@ -96097,31 +95063,47 @@ function _load_asyncToGenerator() { let run = exports.run = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - let manifest; - if (flags.useManifest) { - manifest = yield config.readJson(flags.useManifest); - } else { - manifest = yield config.readRootManifest(); + if (!config.plugnplayEnabled) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('unplugDisabled')); } - if (!manifest.name) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('noName')); + if (!args.length && flags.clear) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('tooFewArguments', 1)); } - if (!manifest.version) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('noVersion')); + if (args.length && flags.clearAll) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('noArguments')); } - const entry = { - name: manifest.name, - version: manifest.version, - resolved: flags.resolved, - registry: flags.registry || manifest._registry, - optionalDependencies: manifest.optionalDependencies, - dependencies: manifest.dependencies - }; - const pattern = flags.pattern || `${entry.name}@${entry.version}`; - reporter.log((0, (_lockfile || _load_lockfile()).stringify)({ - [pattern]: (0, (_lockfile || _load_lockfile()).implodeEntry)(pattern, entry) - })); + if (flags.clearAll) { + yield clearAll(config); + } else if (flags.clear) { + yield clearSome(config, new Set(args)); + } else if (args.length > 0) { + const lockfile = yield (_lockfile || _load_lockfile()).default.fromDirectory(config.lockfileFolder, reporter); + yield (0, (_install || _load_install()).wrapLifecycle)(config, flags, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const install = new (_install || _load_install()).Install(flags, config, reporter, lockfile); + install.linker.unplugged = args; + yield install.init(); + })); + } + + const unpluggedPackageFolders = yield config.listUnpluggedPackageFolders(); + + for (var _iterator = unpluggedPackageFolders.values(), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref3; + + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; + } + + const target = _ref3; + + reporter.log(target, { force: true }); + } }); return function run(_x, _x2, _x3, _x4) { @@ -96129,147 +95111,121 @@ let run = exports.run = (() => { }; })(); -exports.hasWrapper = hasWrapper; -exports.setFlags = setFlags; +let clearSome = exports.clearSome = (() => { + var _ref4 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, filters) { + const unpluggedPackageFolders = yield config.listUnpluggedPackageFolders(); + const removeList = []; -var _errors; + for (var _iterator2 = unpluggedPackageFolders.entries(), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref6; -function _load_errors() { - return _errors = __webpack_require__(6); -} + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref6 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref6 = _i2.value; + } -var _lockfile; + const _ref5 = _ref6; + const unpluggedName = _ref5[0]; + const target = _ref5[1]; -function _load_lockfile() { - return _lockfile = __webpack_require__(19); -} + var _ref8 = yield (_fs || _load_fs()).readJson(path.join(target, 'package.json')); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + const name = _ref8.name; -function hasWrapper(commander, args) { - return false; -} + const toBeRemoved = filters.has(name); -function setFlags(commander) { - commander.description('Generates a lock file entry.'); - commander.option('--use-manifest ', 'description'); - commander.option('--resolved ', 'description'); - commander.option('--registry ', 'description'); -} + if (toBeRemoved) { + removeList.push(path.join(config.getUnpluggedPath(), unpluggedName)); + } + } -const examples = exports.examples = ['generate-lock-entry', 'generate-lock-entry --use-manifest ./package.json', 'generate-lock-entry --resolved local-file.tgz#hash']; + if (removeList.length === unpluggedPackageFolders.size) { + yield (_fs || _load_fs()).unlink(config.getUnpluggedPath()); + } else { + for (var _iterator3 = removeList, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref7; -/***/ }), -/* 531 */ -/***/ (function(module, exports, __webpack_require__) { + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref7 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref7 = _i3.value; + } -"use strict"; + const unpluggedPackagePath = _ref7; + + yield (_fs || _load_fs()).unlink(unpluggedPackagePath); + } + } + }); + return function clearSome(_x5, _x6) { + return _ref4.apply(this, arguments); + }; +})(); + +let clearAll = exports.clearAll = (() => { + var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config) { + yield (_fs || _load_fs()).unlink(config.getUnpluggedPath()); + }); + + return function clearAll(_x7) { + return _ref9.apply(this, arguments); + }; +})(); -Object.defineProperty(exports, "__esModule", { - value: true -}); exports.hasWrapper = hasWrapper; exports.setFlags = setFlags; -exports.run = run; -var _index; +var _lockfile; -function _load_index() { - return _index = _interopRequireDefault(__webpack_require__(334)); +function _load_lockfile() { + return _lockfile = _interopRequireDefault(__webpack_require__(19)); } -var _constants; +var _install; -function _load_constants() { - return _constants = _interopRequireWildcard(__webpack_require__(8)); +function _load_install() { + return _install = __webpack_require__(34); } -var _misc; +var _errors; -function _load_misc() { - return _misc = __webpack_require__(18); +function _load_errors() { + return _errors = __webpack_require__(6); } -var _aliases; +var _fs; -function _load_aliases() { - return _aliases = _interopRequireDefault(__webpack_require__(352)); +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(5)); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const chalk = __webpack_require__(30); +const path = __webpack_require__(0); -function hasWrapper(flags, args) { - return false; +function hasWrapper(commander) { + return true; } function setFlags(commander) { - commander.description('Displays help information.'); -} - -function run(config, reporter, commander, args) { - if (args.length) { - const commandName = args.shift(); - if (Object.prototype.hasOwnProperty.call((_index || _load_index()).default, commandName)) { - const command = (_index || _load_index()).default[commandName]; - if (command) { - command.setFlags(commander); - const examples = (command.examples || []).map(example => ` $ yarn ${example}`); - if (examples.length) { - commander.on('--help', () => { - reporter.log(reporter.lang('helpExamples', reporter.rawText(examples.join('\n')))); - }); - } - // eslint-disable-next-line yarn-internal/warn-language - commander.on('--help', () => reporter.log(' ' + command.getDocsInfo + '\n')); - commander.help(); - return Promise.resolve(); - } - } - } - - commander.on('--help', () => { - const commandsText = []; - for (var _iterator = Object.keys((_index || _load_index()).default).sort((_misc || _load_misc()).sortAlpha), _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; - } - - const name = _ref; - - if ((_index || _load_index()).default[name].useless || Object.keys((_aliases || _load_aliases()).default).map(key => (_aliases || _load_aliases()).default[key]).indexOf(name) > -1) { - continue; - } - if ((_aliases || _load_aliases()).default[name]) { - commandsText.push(` - ${(0, (_misc || _load_misc()).hyphenate)(name)} / ${(_aliases || _load_aliases()).default[name]}`); - } else { - commandsText.push(` - ${(0, (_misc || _load_misc()).hyphenate)(name)}`); - } - } - reporter.log(reporter.lang('helpCommands', reporter.rawText(commandsText.join('\n')))); - reporter.log(reporter.lang('helpCommandsMore', reporter.rawText(chalk.bold('yarn help COMMAND')))); - reporter.log(reporter.lang('helpLearnMore', reporter.rawText(chalk.bold((_constants || _load_constants()).YARN_DOCS)))); - }); - - commander.options.sort((_misc || _load_misc()).sortOptionsByFlags); - - commander.help(); - return Promise.resolve(); + commander.description('Temporarily copies a package (with an optional @range suffix) outside of the global cache for debugging purposes'); + commander.usage('unplug [packages ...] [flags]'); + commander.option('--clear', 'Delete the selected packages'); + commander.option('--clear-all', 'Delete all unplugged packages'); } /***/ }), -/* 532 */ +/* 513 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -96278,7 +95234,7 @@ function run(config, reporter, commander, args) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.run = exports.Import = exports.noArguments = undefined; +exports.run = undefined; var _asyncToGenerator2; @@ -96287,611 +95243,478 @@ function _load_asyncToGenerator() { } let run = exports.run = (() => { - var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - const imp = new Import(flags, config, reporter, new (_lockfile || _load_lockfile()).default({ cache: {} })); - yield imp.init(); + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const versions = { yarn: (_yarnVersion || _load_yarnVersion()).version }; + + const pkg = yield config.maybeReadManifest(config.cwd); + if (pkg && pkg.name && pkg.version) { + versions[pkg.name] = pkg.version; + } + + Object.assign(versions, process.versions); + + reporter.inspect(versions); }); return function run(_x, _x2, _x3, _x4) { - return _ref5.apply(this, arguments); + return _ref.apply(this, arguments); }; })(); exports.setFlags = setFlags; exports.hasWrapper = hasWrapper; -var _install; +var _yarnVersion; -function _load_install() { - return _install = __webpack_require__(34); +function _load_yarnVersion() { + return _yarnVersion = __webpack_require__(105); } -var _check; +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _load_check() { - return _check = __webpack_require__(356); +function setFlags(commander) { + commander.description('Displays version information of currently installed Yarn, Node.js, and its dependencies.'); } -var _errors; - -function _load_errors() { - return _errors = __webpack_require__(6); +function hasWrapper(commander, args) { + return true; } -var _index; +/***/ }), +/* 514 */ +/***/ (function(module, exports, __webpack_require__) { -function _load_index() { - return _index = __webpack_require__(78); -} +"use strict"; -var _baseResolver; -function _load_baseResolver() { - return _baseResolver = _interopRequireDefault(__webpack_require__(123)); -} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = exports.requireLockfile = undefined; -var _hostedGitResolver; +var _asyncToGenerator2; -function _load_hostedGitResolver() { - return _hostedGitResolver = _interopRequireDefault(__webpack_require__(110)); +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } -var _hostedGitResolver2; - -function _load_hostedGitResolver2() { - return _hostedGitResolver2 = __webpack_require__(110); -} +let cleanQuery = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, query) { + // if a location was passed then turn it into a hash query + if (path.isAbsolute(query) && (yield (_fs || _load_fs()).exists(query))) { + // absolute path + query = path.relative(config.cwd, query); + } -var _gistResolver; + // remove references to node_modules with hashes + query = query.replace(/([\\/]|^)node_modules[\\/]/g, '#'); -function _load_gistResolver() { - return _gistResolver = _interopRequireDefault(__webpack_require__(217)); -} + // remove trailing hashes + query = query.replace(/^#+/g, ''); -var _gistResolver2; + // remove trailing paths from each part of the query, skip second part of path for scoped packages + let queryParts = query.split('#'); + queryParts = queryParts.map(function (part) { + let parts = part.split(/[\\/]/g); -function _load_gistResolver2() { - return _gistResolver2 = __webpack_require__(217); -} - -var _gitResolver; - -function _load_gitResolver() { - return _gitResolver = _interopRequireDefault(__webpack_require__(124)); -} + if (part[0] === '@') { + parts = parts.slice(0, 2); + } else { + parts = parts.slice(0, 1); + } -var _fileResolver; + return parts.join('/'); + }); + query = queryParts.join('#'); -function _load_fileResolver() { - return _fileResolver = _interopRequireDefault(__webpack_require__(216)); -} + return query; + }); -var _packageResolver; + return function cleanQuery(_x, _x2) { + return _ref.apply(this, arguments); + }; +})(); -function _load_packageResolver() { - return _packageResolver = _interopRequireDefault(__webpack_require__(366)); -} +let getPackageSize = (() => { + var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (tuple) { + const loc = tuple[0]; -var _packageRequest; -function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(122)); -} + const files = yield (_fs || _load_fs()).walk(loc, null, new Set([(_constants || _load_constants()).METADATA_FILENAME, (_constants || _load_constants()).TARBALL_FILENAME])); -var _packageReference; + const sizes = yield Promise.all(files.map(function (walkFile) { + return (_fs || _load_fs()).getFileSizeOnDisk(walkFile.absolute); + })); -function _load_packageReference() { - return _packageReference = _interopRequireDefault(__webpack_require__(365)); -} + return sum(sizes); + }); -var _packageFetcher; + return function getPackageSize(_x3) { + return _ref2.apply(this, arguments); + }; +})(); -function _load_packageFetcher() { - return _packageFetcher = _interopRequireWildcard(__webpack_require__(211)); -} +let run = exports.run = (() => { + var _ref6 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + if (!args.length) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('missingWhyDependency')); + } + if (args.length > 1) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('tooManyArguments', 1)); + } -var _packageLinker; + const query = yield cleanQuery(config, args[0]); -function _load_packageLinker() { - return _packageLinker = _interopRequireDefault(__webpack_require__(212)); -} + reporter.step(1, 4, reporter.lang('whyStart', args[0]), emoji.get('thinking_face')); -var _packageCompatibility; + // init + reporter.step(2, 4, reporter.lang('whyInitGraph'), emoji.get('truck')); + const lockfile = yield (_lockfile || _load_lockfile()).default.fromDirectory(config.lockfileFolder, reporter); + const install = new (_install || _load_install()).Install(flags, config, reporter, lockfile); -function _load_packageCompatibility() { - return _packageCompatibility = _interopRequireWildcard(__webpack_require__(210)); -} + var _ref7 = yield install.fetchRequestFromCwd(); -var _lockfile; + const depRequests = _ref7.requests, + patterns = _ref7.patterns, + workspaceLayout = _ref7.workspaceLayout; -function _load_lockfile() { - return _lockfile = _interopRequireDefault(__webpack_require__(19)); -} + yield install.resolver.init(depRequests, { + isFlat: install.flags.flat, + isFrozen: install.flags.frozenLockfile, + workspaceLayout + }); + const hoisted = yield install.linker.getFlatHoistedTree(patterns); -var _normalizePattern9; + // finding + reporter.step(3, 4, reporter.lang('whyFinding'), emoji.get('mag')); -function _load_normalizePattern() { - return _normalizePattern9 = __webpack_require__(37); -} + const matches = queryWhy(query, hoisted); -var _logicalDependencyTree; + if (matches.length <= 0) { + reporter.error(reporter.lang('whyUnknownMatch')); + return; + } -function _load_logicalDependencyTree() { - return _logicalDependencyTree = __webpack_require__(582); -} + const processMatch = (() => { + var _ref8 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (match) { + const matchInfo = match[1]; -var _fs; + const matchRef = matchInfo.pkg._reference; + invariant(matchRef, 'expected reference'); -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(5)); -} + const distinctMatchPatterns = new Set(matchRef.patterns); + const reasons = []; -var _misc; + // reason: dependency of these modules + if (matchInfo.originalParentPath.length > 0) { + reasons.push({ + type: 'whyDependedOn', + typeSimple: 'whyDependedOnSimple', + value: toStandardPathString(matchInfo.originalParentPath) + }); + } -function _load_misc() { - return _misc = _interopRequireWildcard(__webpack_require__(18)); -} + // reason: exists in manifest + let rootType; + for (var _iterator3 = distinctMatchPatterns, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref9; -var _constants; + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref9 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref9 = _i3.value; + } -function _load_constants() { - return _constants = __webpack_require__(8); -} + const pattern = _ref9; -var _semver; + rootType = install.rootPatternsToOrigin[pattern]; + if (rootType) { + reasons.push({ + type: 'whySpecified', + typeSimple: 'whySpecifiedSimple', + value: rootType + }); + } + } -function _load_semver() { - return _semver = _interopRequireDefault(__webpack_require__(22)); -} + // reason: this is hoisted from these modules + for (var _iterator4 = matchInfo.previousPaths, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { + var _ref10; -function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref10 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref10 = _i4.value; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + const path = _ref10; -const invariant = __webpack_require__(9); -const path = __webpack_require__(0); -const uuid = __webpack_require__(120); -const ssri = __webpack_require__(65); -const nodeVersion = process.versions.node.split('-')[0]; + reasons.push({ + type: 'whyHoistedFrom', + typeSimple: 'whyHoistedFromSimple', + value: toStandardPathString(path) + }); + } -const noArguments = exports.noArguments = true; + // package sizes + let packageSize = 0; + let directSizes = []; + let transitiveSizes = []; + try { + packageSize = yield getPackageSize(match); + } catch (e) {} -class ImportResolver extends (_baseResolver || _load_baseResolver()).default { - getCwd() { - if (this.request.parentRequest) { - const parent = this.resolver.getStrictResolvedPattern(this.request.parentRequest.pattern); - invariant(parent._loc, 'expected package location'); - return path.dirname(parent._loc); - } - return this.config.cwd; - } + const dependencies = Array.from(collect(hoisted, new Set(), match)); + const transitiveDependencies = Array.from(collect(hoisted, new Set(), match, { recursive: true })); - resolveHostedGit(info, Resolver) { - var _normalizePattern = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); + try { + directSizes = yield Promise.all(dependencies.map(getPackageSize)); + transitiveSizes = yield Promise.all(transitiveDependencies.map(getPackageSize)); + } catch (e) {} - const range = _normalizePattern.range; + const transitiveKeys = new Set(transitiveDependencies.map(function ([, info]) { + return info.key; + })); + const sharedDependencies = getSharedDependencies(hoisted, transitiveKeys); - const exploded = (0, (_hostedGitResolver2 || _load_hostedGitResolver2()).explodeHostedGitFragment)(range, this.reporter); - const hash = info.gitHead; - invariant(hash, 'expected package gitHead'); - const url = Resolver.getTarballUrl(exploded, hash); - info._uid = hash; - info._remote = { - resolved: url, - type: 'tarball', - registry: this.registry, - reference: url, - hash: null - }; - return info; - } + // prepare output: populate reporter + reporter.info(reporter.lang('whyMatch', `${matchInfo.key}@${matchInfo.pkg.version}`)); + // + // reason: hoisted/nohoist + if (matchInfo.isNohoist) { + reasons.push({ + type: 'whyNotHoisted', + typeSimple: 'whyNotHoistedSimple', + value: matchInfo.nohoistList + }); + } else if (query === matchInfo.originalKey) { + reporter.info(reporter.lang('whyHoistedTo', matchInfo.key)); + } - resolveGist(info, Resolver) { - var _normalizePattern2 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); + if (reasons.length === 1) { + reporter.info(reporter.lang(reasons[0].typeSimple, reasons[0].value)); + } else if (reasons.length > 1) { + reporter.info(reporter.lang('whyReasons')); + reporter.list('reasons', reasons.map(function (reason) { + return reporter.lang(reason.type, reason.value); + })); + } else { + reporter.error(reporter.lang('whyWhoKnows')); + } - const range = _normalizePattern2.range; + if (packageSize) { + // stats: file size of this dependency without any dependencies + reporter.info(reporter.lang('whyDiskSizeWithout', bytes(packageSize))); - var _explodeGistFragment = (0, (_gistResolver2 || _load_gistResolver2()).explodeGistFragment)(range, this.reporter); + // stats: file size of this dependency including dependencies that aren't shared + reporter.info(reporter.lang('whyDiskSizeUnique', bytes(packageSize + sum(directSizes)))); - const id = _explodeGistFragment.id; + // stats: file size of this dependency including dependencies + reporter.info(reporter.lang('whyDiskSizeTransitive', bytes(packageSize + sum(transitiveSizes)))); - const hash = info.gitHead; - invariant(hash, 'expected package gitHead'); - const url = `https://gist.github.com/${id}.git`; - info._uid = hash; - info._remote = { - resolved: `${url}#${hash}`, - type: 'git', - registry: this.registry, - reference: url, - hash - }; - return info; - } + // stats: shared transitive dependencies + reporter.info(reporter.lang('whySharedDependencies', sharedDependencies.size)); + } + }); - resolveGit(info, Resolver) { - const url = info._resolved; - const hash = info.gitHead; - invariant(url, 'expected package _resolved'); - invariant(hash, 'expected package gitHead'); - info._uid = hash; - info._remote = { - resolved: `${url}#${hash}`, - type: 'git', - registry: this.registry, - reference: url, - hash - }; - return info; - } + return function processMatch(_x8) { + return _ref8.apply(this, arguments); + }; + })(); - resolveFile(info, Resolver) { - var _normalizePattern3 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); + reporter.step(4, 4, reporter.lang('whyCalculating'), emoji.get('aerial_tramway')); + for (var _iterator5 = matches, _isArray5 = Array.isArray(_iterator5), _i5 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) { + var _ref11; - const range = _normalizePattern3.range; + if (_isArray5) { + if (_i5 >= _iterator5.length) break; + _ref11 = _iterator5[_i5++]; + } else { + _i5 = _iterator5.next(); + if (_i5.done) break; + _ref11 = _i5.value; + } - let loc = (_misc || _load_misc()).removePrefix(range, 'file:'); - if (!path.isAbsolute(loc)) { - loc = path.join(this.config.cwd, loc); - } - info._uid = info.version; - info._remote = { - type: 'copy', - registry: this.registry, - hash: `${uuid.v4()}-${new Date().getTime()}`, - reference: loc - }; - return info; - } + const match = _ref11; - resolveRegistry(info) { - let url = info._resolved; - const hash = info._shasum; - invariant(url, 'expected package _resolved'); - invariant(hash, 'expected package _shasum'); - if (this.config.getOption('registry') === (_constants || _load_constants()).YARN_REGISTRY) { - url = url.replace((_constants || _load_constants()).NPM_REGISTRY_RE, (_constants || _load_constants()).YARN_REGISTRY); + yield processMatch(match); } - info._uid = info.version; - info._remote = { - resolved: `${url}#${hash}`, - type: 'tarball', - registry: this.registry, - reference: url, - integrity: info._integrity ? ssri.parse(info._integrity) : ssri.fromHex(hash, 'sha1'), - hash - }; - return info; - } + }); - resolveImport(info) { - var _normalizePattern4 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); + return function run(_x4, _x5, _x6, _x7) { + return _ref6.apply(this, arguments); + }; +})(); - const range = _normalizePattern4.range; +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; +exports.queryWhy = queryWhy; - const Resolver = (0, (_index || _load_index()).getExoticResolver)(range); - if (Resolver && Resolver.prototype instanceof (_hostedGitResolver || _load_hostedGitResolver()).default) { - return this.resolveHostedGit(info, Resolver); - } else if (Resolver && Resolver === (_gistResolver || _load_gistResolver()).default) { - return this.resolveGist(info, Resolver); - } else if (Resolver && Resolver === (_gitResolver || _load_gitResolver()).default) { - return this.resolveGit(info, Resolver); - } else if (Resolver && Resolver === (_fileResolver || _load_fileResolver()).default) { - return this.resolveFile(info, Resolver); - } - return this.resolveRegistry(info); - } +var _install; - resolveLocation(loc) { - var _this = this; +function _load_install() { + return _install = __webpack_require__(34); +} - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const info = yield _this.config.tryManifest(loc, 'npm', false); - if (!info) { - return null; - } - return _this.resolveImport(info); - })(); - } +var _constants; - resolveFixedVersion(fixedVersionPattern) { - var _this2 = this; +function _load_constants() { + return _constants = __webpack_require__(8); +} - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - var _normalizePattern5 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(fixedVersionPattern); +var _fs; - const range = _normalizePattern5.range; +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(5)); +} - const exoticResolver = (0, (_index || _load_index()).getExoticResolver)(range); - const manifest = exoticResolver ? yield _this2.request.findExoticVersionInfo(exoticResolver, range) : yield _this2.request.findVersionOnRegistry(fixedVersionPattern); - return manifest; - })(); - } +var _lockfile; - _resolveFromFixedVersions() { - var _this3 = this; +function _load_lockfile() { + return _lockfile = _interopRequireDefault(__webpack_require__(19)); +} - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - invariant(_this3.request instanceof ImportPackageRequest, 'request must be ImportPackageRequest'); +var _errors; - var _normalizePattern6 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(_this3.pattern); +function _load_errors() { + return _errors = __webpack_require__(6); +} - const name = _normalizePattern6.name; +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - invariant(_this3.request.dependencyTree instanceof (_logicalDependencyTree || _load_logicalDependencyTree()).LogicalDependencyTree, 'dependencyTree on request must be LogicalDependencyTree'); - const fixedVersionPattern = _this3.request.dependencyTree.getFixedVersionPattern(name, _this3.request.parentNames); - const info = yield _this3.config.getCache(`import-resolver-${fixedVersionPattern}`, function () { - return _this3.resolveFixedVersion(fixedVersionPattern); - }); - if (info) { - return info; - } - throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('importResolveFailed', name, _this3.getCwd())); - })(); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - _resolveFromNodeModules() { - var _this4 = this; +const requireLockfile = exports.requireLockfile = true; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - var _normalizePattern7 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(_this4.pattern); +const invariant = __webpack_require__(9); +const bytes = __webpack_require__(564); +const emoji = __webpack_require__(302); +const path = __webpack_require__(0); - const name = _normalizePattern7.name; +function sum(array) { + return array.length ? array.reduce((a, b) => a + b, 0) : 0; +} - let cwd = _this4.getCwd(); - while (!path.relative(_this4.config.cwd, cwd).startsWith('..')) { - const loc = path.join(cwd, 'node_modules', name); - const info = yield _this4.config.getCache(`import-resolver-${loc}`, function () { - return _this4.resolveLocation(loc); - }); - if (info) { - return info; - } - cwd = path.resolve(cwd, '../..'); - } - throw new (_errors || _load_errors()).MessageError(_this4.reporter.lang('importResolveFailed', name, _this4.getCwd())); - })(); - } +function collect(hoistManifests, allDependencies, dependency, { recursive } = { recursive: false }) { + const depInfo = dependency[1]; - resolve() { - if (this.request instanceof ImportPackageRequest && this.request.dependencyTree) { - return this._resolveFromFixedVersions(); - } else { - return this._resolveFromNodeModules(); - } - } -} + const deps = depInfo.pkg.dependencies; -class ImportPackageRequest extends (_packageRequest || _load_packageRequest()).default { - constructor(req, dependencyTree, resolver) { - super(req, resolver); - this.import = this.parentRequest instanceof ImportPackageRequest ? this.parentRequest.import : true; - this.dependencyTree = dependencyTree; + if (!deps) { + return allDependencies; } - getRootName() { - return this.resolver instanceof ImportPackageResolver && this.resolver.rootName || 'root'; - } + const dependencyKeys = new Set(Object.keys(deps)); + const directDependencies = []; - getParentHumanName() { - return [this.getRootName()].concat(this.parentNames).join(' > '); - } + for (var _iterator = hoistManifests, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + var _ref3; - reportResolvedRangeMatch(info, resolved) { - if (info.version === resolved.version) { - return; + if (_isArray) { + if (_i >= _iterator.length) break; + _ref3 = _iterator[_i++]; + } else { + _i = _iterator.next(); + if (_i.done) break; + _ref3 = _i.value; } - this.reporter.warn(this.reporter.lang('importResolvedRangeMatch', resolved.version, resolved.name, info.version, this.getParentHumanName())); - } - _findResolvedManifest(info) { - var _normalizePattern8 = (0, (_normalizePattern9 || _load_normalizePattern()).normalizePattern)(this.pattern); + const dep = _ref3; + const info = dep[1]; - const range = _normalizePattern8.range, - name = _normalizePattern8.name; - const solvedRange = (_semver || _load_semver()).default.validRange(range) ? info.version : range; - const resolved = this.resolver.getExactVersionMatch(name, solvedRange, info); - if (resolved) { - return resolved; + if (!allDependencies.has(dep) && dependencyKeys.has(info.key)) { + allDependencies.add(dep); + directDependencies.push(dep); } - invariant(info._remote, 'expected package remote'); - const ref = new (_packageReference || _load_packageReference()).default(this, info, info._remote); - info._reference = ref; - return info; } - resolveToExistingVersion(info) { - const resolved = this._findResolvedManifest(info); - invariant(resolved, 'should have found a resolved reference'); - const ref = resolved._reference; - invariant(ref, 'should have a package reference'); - ref.addRequest(this); - ref.addPattern(this.pattern, resolved); - ref.addOptional(this.optional); + if (recursive) { + directDependencies.forEach(dependency => collect(hoistManifests, allDependencies, dependency, { recursive: true })); } - findVersionInfo() { - if (!this.import) { - this.reporter.verbose(this.reporter.lang('skippingImport', this.pattern, this.getParentHumanName())); - return super.findVersionInfo(); - } - const resolver = new ImportResolver(this, this.pattern); - return resolver.resolve().catch(() => { - this.import = false; - this.reporter.warn(this.reporter.lang('importFailed', this.pattern, this.getParentHumanName())); - return super.findVersionInfo(); - }); - } + return allDependencies; } -class ImportPackageResolver extends (_packageResolver || _load_packageResolver()).default { - constructor(config, lockfile) { - super(config, lockfile); - this.next = []; - this.rootName = 'root'; - } - - find(req) { - this.next.push(req); - return Promise.resolve(); - } - - findOne(req) { - var _this5 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (_this5.activity) { - _this5.activity.tick(req.pattern); - } - const request = new ImportPackageRequest(req, _this5.dependencyTree, _this5); - yield request.find({ fresh: false }); - })(); - } - - findAll(deps) { - var _this6 = this; +function getSharedDependencies(hoistManifests, transitiveKeys) { + const sharedDependencies = new Set(); + for (var _iterator2 = hoistManifests, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref5; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - yield Promise.all(deps.map(function (dep) { - return _this6.findOne(dep); - })); - deps = _this6.next; - _this6.next = []; - if (!deps.length) { - // all required package versions have been discovered, so now packages that - // resolved to existing versions can be resolved to their best available version - _this6.resolvePackagesWithExistingVersions(); - return; - } - yield _this6.findAll(deps); - })(); - } + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref5 = _iterator2[_i2++]; + } else { + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref5 = _i2.value; + } - resetOptional() { - for (const pattern in this.patterns) { - const ref = this.patterns[pattern]._reference; - invariant(ref, 'expected reference'); - ref.optional = null; - for (var _iterator = ref.requests, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { - var _ref; + const _ref4 = _ref5; + const info = _ref4[1]; - if (_isArray) { - if (_i >= _iterator.length) break; - _ref = _iterator[_i++]; - } else { - _i = _iterator.next(); - if (_i.done) break; - _ref = _i.value; + if (!transitiveKeys.has(info.key) && info.pkg.dependencies) { + Object.keys(info.pkg.dependencies).forEach(dependency => { + if (transitiveKeys.has(dependency) && !sharedDependencies.has(dependency)) { + sharedDependencies.add(dependency); } - - const req = _ref; - - ref.addOptional(req.optional); - } + }); } } - - init(deps, { isFlat, isFrozen, workspaceLayout } = { isFlat: false, isFrozen: false, workspaceLayout: undefined }) { - var _this7 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this7.flat = Boolean(isFlat); - const activity = _this7.activity = _this7.reporter.activity(); - yield _this7.findAll(deps); - _this7.resetOptional(); - activity.end(); - _this7.activity = null; - })(); - } + return sharedDependencies; } -class Import extends (_install || _load_install()).Install { - constructor(flags, config, reporter, lockfile) { - super(flags, config, reporter, lockfile); - this.resolver = new ImportPackageResolver(this.config, this.lockfile); - this.linker = new (_packageLinker || _load_packageLinker()).default(config, this.resolver); - } - createLogicalDependencyTree(packageJson, packageLock) { - invariant(packageJson, 'package.json should exist'); - invariant(packageLock, 'package-lock.json should exist'); - invariant(this.resolver instanceof ImportPackageResolver, 'resolver should be an ImportPackageResolver'); - try { - this.resolver.dependencyTree = new (_logicalDependencyTree || _load_logicalDependencyTree()).LogicalDependencyTree(packageJson, packageLock); - } catch (e) { - throw new (_errors || _load_errors()).MessageError(this.reporter.lang('importSourceFilesCorrupted')); - } - } - getExternalLockfileContents() { - var _this8 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - try { - var _ref2 = yield Promise.all([(_fs || _load_fs()).readFile(path.join(_this8.config.cwd, (_constants || _load_constants()).NODE_PACKAGE_JSON)), (_fs || _load_fs()).readFile(path.join(_this8.config.cwd, (_constants || _load_constants()).NPM_LOCK_FILENAME))]); +function setFlags(commander) { + commander.description('Identifies why a package has been installed, detailing which other packages depend on it.'); +} - const packageJson = _ref2[0], - packageLock = _ref2[1]; +function hasWrapper(commander, args) { + return true; +} - return { packageJson, packageLock }; - } catch (e) { - return { packageJson: null, packageLock: null }; - } - })(); +// to conform to the current standard '#' as package tree separator +function toStandardPathString(pathString) { + const str = pathString.replace(/\//g, '#'); + if (str[0] === '#') { + return str.slice(1); } - init() { - var _this9 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (yield (_fs || _load_fs()).exists(path.join(_this9.config.cwd, (_constants || _load_constants()).LOCKFILE_FILENAME))) { - throw new (_errors || _load_errors()).MessageError(_this9.reporter.lang('lockfileExists')); - } - - var _ref3 = yield _this9.getExternalLockfileContents(); - - const packageJson = _ref3.packageJson, - packageLock = _ref3.packageLock; + return str; +} - const importSource = packageJson && packageLock && (_semver || _load_semver()).default.satisfies(nodeVersion, '>=5.0.0') ? 'package-lock.json' : 'node_modules'; - if (importSource === 'package-lock.json') { - _this9.reporter.info(_this9.reporter.lang('importPackageLock')); - _this9.createLogicalDependencyTree(packageJson, packageLock); - } - if (importSource === 'node_modules') { - _this9.reporter.info(_this9.reporter.lang('importNodeModules')); - yield (0, (_check || _load_check()).verifyTreeCheck)(_this9.config, _this9.reporter, {}, []); - } +function queryWhy(pattern, hoisted) { + const nohoistPattern = `#${pattern}`; + const found = []; + for (var _iterator6 = hoisted, _isArray6 = Array.isArray(_iterator6), _i6 = 0, _iterator6 = _isArray6 ? _iterator6 : _iterator6[Symbol.iterator]();;) { + var _ref13; - var _ref4 = yield _this9.fetchRequestFromCwd(); + if (_isArray6) { + if (_i6 >= _iterator6.length) break; + _ref13 = _iterator6[_i6++]; + } else { + _i6 = _iterator6.next(); + if (_i6.done) break; + _ref13 = _i6.value; + } - const requests = _ref4.requests, - patterns = _ref4.patterns, - manifest = _ref4.manifest; + const _ref12 = _ref13; + const loc = _ref12[0]; + const info = _ref12[1]; - if (manifest.name && _this9.resolver instanceof ImportPackageResolver) { - _this9.resolver.rootName = manifest.name; - } - yield _this9.resolver.init(requests, { isFlat: _this9.flags.flat, isFrozen: _this9.flags.frozenLockfile }); - const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this9.resolver.getManifests(), _this9.config); - _this9.resolver.updateManifests(manifests); - yield (_packageCompatibility || _load_packageCompatibility()).check(_this9.resolver.getManifests(), _this9.config, _this9.flags.ignoreEngines); - yield _this9.linker.resolvePeerModules(); - yield _this9.saveLockfileAndIntegrity(patterns); - return patterns; - })(); + if (info.key === pattern || info.previousPaths.indexOf(pattern) >= 0 || info.key.endsWith(nohoistPattern)) { + found.push([loc, info]); + } } -} - -exports.Import = Import; -function setFlags(commander) { - commander.description('Generates yarn.lock from an npm package-lock.json file or an existing npm-installed node_modules folder.'); -} - -function hasWrapper(commander, args) { - return true; + return found; } /***/ }), -/* 533 */ +/* 515 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -96910,58 +95733,45 @@ function _load_asyncToGenerator() { let run = exports.run = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - if (args.length > 2) { - reporter.error(reporter.lang('tooManyArguments', 2)); - return; - } + const workspaceRootFolder = config.workspaceRootFolder; - let packageName = args.shift() || '.'; - // Handle the case when we are referencing a local package. - if (packageName === '.') { - packageName = (yield config.readRootManifest()).name; + if (!workspaceRootFolder) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceRootNotFound', config.cwd)); } - const packageInput = (_npmRegistry || _load_npmRegistry()).default.escapeName(packageName); + if (args.length < 1) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceMissingWorkspace')); + } - var _parsePackageName = (0, (_parsePackageName2 || _load_parsePackageName()).default)(packageInput); + if (args.length < 2) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceMissingCommand')); + } - const name = _parsePackageName.name, - version = _parsePackageName.version; + const manifest = yield config.findManifest(workspaceRootFolder, false); + invariant(manifest && manifest.workspaces, 'We must find a manifest with a "workspaces" property'); + const workspaces = yield config.resolveWorkspaces(workspaceRootFolder, manifest); - let result; - try { - result = yield config.registries.npm.request(name, { unfiltered: true }); - } catch (e) { - reporter.error(reporter.lang('infoFail')); - return; - } - if (!result) { - reporter.error(reporter.lang('infoFail')); - return; - } + var _ref2 = args || []; - result = clean(result); + const workspaceName = _ref2[0], + rest = _ref2.slice(1); - const versions = result.versions; - // $FlowFixMe - result.versions = Object.keys(versions).sort(semver.compareLoose); - result.version = version || result['dist-tags'].latest; - result = Object.assign(result, versions[result.version]); + if (!Object.prototype.hasOwnProperty.call(workspaces, workspaceName)) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceUnknownWorkspace', workspaceName)); + } - const fieldPath = args.shift(); - const fields = fieldPath ? fieldPath.split('.') : []; + const workspace = workspaces[workspaceName]; - // Readmes can be long so exclude them unless explicitly asked for. - if (fields[0] !== 'readme') { - delete result.readme; + try { + yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [(_constants || _load_constants()).YARN_BIN_PATH, ...rest], { + stdio: 'inherit', + cwd: workspace.loc + }); + } catch (err) { + throw err; } - - result = fields.reduce(function (prev, cur) { - return prev && prev[cur]; - }, result); - reporter.inspect(result); }); return function run(_x, _x2, _x3, _x4) { @@ -96972,62 +95782,38 @@ let run = exports.run = (() => { exports.setFlags = setFlags; exports.hasWrapper = hasWrapper; -var _npmRegistry; +var _errors; -function _load_npmRegistry() { - return _npmRegistry = _interopRequireDefault(__webpack_require__(88)); +function _load_errors() { + return _errors = __webpack_require__(6); } -var _parsePackageName2; +var _child; -function _load_parsePackageName() { - return _parsePackageName2 = _interopRequireDefault(__webpack_require__(588)); +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(50)); } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } +var _constants; -const semver = __webpack_require__(22); +function _load_constants() { + return _constants = __webpack_require__(8); +} -function clean(object) { - if (Array.isArray(object)) { - const result = []; - object.forEach(item => { - item = clean(item); - if (item) { - result.push(item); - } - }); - return result; - } else if (typeof object === 'object') { - const result = {}; - for (const key in object) { - if (key.startsWith('_')) { - continue; - } +function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } - const item = clean(object[key]); - if (item) { - result[key] = item; - } - } - return result; - } else if (object) { - return object; - } else { - return null; - } -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function setFlags(commander) { - commander.description('Shows information about a package.'); -} +const invariant = __webpack_require__(9); + +function setFlags(commander) {} function hasWrapper(commander, args) { return true; } /***/ }), -/* 534 */ +/* 516 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -97036,7 +95822,7 @@ function hasWrapper(commander, args) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.getGitConfigInfo = exports.run = exports.shouldRunInCurrentCwd = undefined; +exports.examples = exports.setFlags = exports.run = exports.runScript = exports.info = undefined; var _asyncToGenerator2; @@ -97044,104 +95830,23 @@ function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } -let run = exports.run = (() => { +let info = exports.info = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - const installVersion = flags[`2`] ? `berry` : flags.install; - const forwardedArgs = process.argv.slice(process.argv.indexOf('init', 2) + 1); - - if (installVersion) { - if (flags[`2`] && process.env.COREPACK_ROOT) { - yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [path.join(process.env.COREPACK_ROOT, 'dist/corepack.js'), `yarn@${flags.install || `stable`}`, `init`, ...forwardedArgs, `--install=self`], { - stdio: 'inherit', - cwd: config.cwd - }); - } else { - const lockfilePath = path.resolve(config.cwd, 'yarn.lock'); - if (!(yield (_fs || _load_fs()).exists(lockfilePath))) { - yield (_fs || _load_fs()).writeFile(lockfilePath, ''); - } - yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [process.argv[1], 'policies', 'set-version', installVersion, '--silent'], { - stdio: 'inherit', - cwd: config.cwd - }); - yield (_child || _load_child()).spawn((_constants || _load_constants()).NODE_BIN_PATH, [process.argv[1], 'init', ...forwardedArgs], { - stdio: 'inherit', - cwd: config.cwd - }); - } - return; - } + const workspaceRootFolder = config.workspaceRootFolder; - const manifests = yield config.getRootManifests(); - let repository = {}; - const author = { - name: config.getOption('init-author-name'), - email: config.getOption('init-author-email'), - url: config.getOption('init-author-url') - }; - if (yield (_fs || _load_fs()).exists(path.join(config.cwd, '.git'))) { - // get git origin of the cwd - try { - repository = { - type: 'git', - url: yield (_child || _load_child()).spawn('git', ['config', 'remote.origin.url'], { - cwd: config.cwd - }) - }; - } catch (ex) { - // Ignore - Git repo may not have an origin URL yet (eg. if it only exists locally) - } + if (!workspaceRootFolder) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceRootNotFound', config.cwd)); + } - if (author.name === undefined) { - author.name = yield getGitConfigInfo('user.name'); - } + const manifest = yield config.findManifest(workspaceRootFolder, false); + invariant(manifest && manifest.workspaces, 'We must find a manifest with a "workspaces" property'); - if (author.email === undefined) { - author.email = yield getGitConfigInfo('user.email'); - } - } + const workspaces = yield config.resolveWorkspaces(workspaceRootFolder, manifest); - const keys = [{ - key: 'name', - question: 'name', - default: path.basename(config.cwd), - validation: (_validate || _load_validate()).isValidPackageName, - validationError: 'invalidPackageName' - }, { - key: 'version', - question: 'version', - default: String(config.getOption('init-version')) - }, { - key: 'description', - question: 'description', - default: '' - }, { - key: 'main', - question: 'entry point', - default: 'index.js' - }, { - key: 'repository', - question: 'repository url', - default: (0, (_util || _load_util()).extractRepositoryUrl)(repository) - }, { - key: 'author', - question: 'author', - default: (0, (_util || _load_util()).stringifyPerson)(author) - }, { - key: 'license', - question: 'license', - default: String(config.getOption('init-license')) - }, { - key: 'private', - question: 'private', - default: config.getOption('init-private') || '', - inputFormatter: yn - }]; + const publicData = {}; - // get answers - const pkg = {}; - for (var _iterator = keys, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { + for (var _iterator = Object.keys(workspaces), _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) { var _ref2; if (_isArray) { @@ -97153,169 +95858,136 @@ let run = exports.run = (() => { _ref2 = _i.value; } - const entry = _ref2; - const yes = flags.yes, - privateFlag = flags.private; - const manifestKey = entry.key; - let question = entry.question, - def = entry.default; + const workspaceName = _ref2; + var _workspaces$workspace = workspaces[workspaceName]; + const loc = _workspaces$workspace.loc, + manifest = _workspaces$workspace.manifest; - for (var _iterator4 = (_index || _load_index()).registryNames, _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { - var _ref5; + const workspaceDependencies = new Set(); + const mismatchedWorkspaceDependencies = new Set(); - if (_isArray4) { - if (_i4 >= _iterator4.length) break; - _ref5 = _iterator4[_i4++]; + for (var _iterator2 = (_constants || _load_constants()).DEPENDENCY_TYPES, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { + var _ref3; + + if (_isArray2) { + if (_i2 >= _iterator2.length) break; + _ref3 = _iterator2[_i2++]; } else { - _i4 = _iterator4.next(); - if (_i4.done) break; - _ref5 = _i4.value; + _i2 = _iterator2.next(); + if (_i2.done) break; + _ref3 = _i2.value; } - const registryName = _ref5; - const object = manifests[registryName].object; + const dependencyType = _ref3; - let val = objectPath.get(object, manifestKey); - if (!val) { - break; - } - if (typeof val === 'object') { - if (manifestKey === 'author') { - val = (0, (_util || _load_util()).stringifyPerson)(val); - } else if (manifestKey === 'repository') { - val = (0, (_util || _load_util()).extractRepositoryUrl)(val); + if (dependencyType !== 'peerDependencies') { + for (var _iterator3 = Object.keys(manifest[dependencyType] || {}), _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { + var _ref4; + + if (_isArray3) { + if (_i3 >= _iterator3.length) break; + _ref4 = _iterator3[_i3++]; + } else { + _i3 = _iterator3.next(); + if (_i3.done) break; + _ref4 = _i3.value; + } + + const dependencyName = _ref4; + + if (Object.prototype.hasOwnProperty.call(workspaces, dependencyName)) { + invariant(manifest && manifest[dependencyType], 'The request should exist'); + const requestedRange = manifest[dependencyType][dependencyName]; + if (semver.satisfies(workspaces[dependencyName].manifest.version, requestedRange)) { + workspaceDependencies.add(dependencyName); + } else { + mismatchedWorkspaceDependencies.add(dependencyName); + } + } } } - def = val; - } - - if (manifestKey === 'private' && privateFlag) { - def = true; } - if (def) { - question += ` (${String(def)})`; - } - - let answer; - let validAnswer = false; - - if (yes) { - answer = def; - } else { - // loop until a valid answer is provided, if validation is on entry - if (entry.validation) { - while (!validAnswer) { - answer = (yield reporter.question(question)) || def; - // validate answer - if (entry.validation(String(answer))) { - validAnswer = true; - } else { - reporter.error(reporter.lang('invalidPackageName')); - } - } - } else { - answer = (yield reporter.question(question)) || def; - } - } - - if (answer) { - if (entry.inputFormatter) { - answer = entry.inputFormatter(answer); - } - objectPath.set(pkg, manifestKey, answer); - } + publicData[workspaceName] = { + location: path.relative(config.lockfileFolder, loc).replace(/\\/g, '/'), + workspaceDependencies: Array.from(workspaceDependencies), + mismatchedWorkspaceDependencies: Array.from(mismatchedWorkspaceDependencies) + }; } - if (pkg.repository && (_githubResolver || _load_githubResolver()).default.isVersion(pkg.repository)) { - pkg.repository = `https://github.com/${pkg.repository}`; - } + reporter.log(JSON.stringify(publicData, null, 2), { force: true }); + }); - // save answers - const targetManifests = []; - for (var _iterator2 = (_index || _load_index()).registryNames, _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) { - var _ref3; + return function info(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); - if (_isArray2) { - if (_i2 >= _iterator2.length) break; - _ref3 = _iterator2[_i2++]; - } else { - _i2 = _iterator2.next(); - if (_i2.done) break; - _ref3 = _i2.value; - } +let runScript = exports.runScript = (() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const workspaceRootFolder = config.workspaceRootFolder; - const registryName = _ref3; - const info = manifests[registryName]; - if (info.exists) { - targetManifests.push(info); - } - } - if (!targetManifests.length) { - targetManifests.push(manifests.npm); + if (!workspaceRootFolder) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceRootNotFound', config.cwd)); } - for (var _iterator3 = targetManifests, _isArray3 = Array.isArray(_iterator3), _i3 = 0, _iterator3 = _isArray3 ? _iterator3 : _iterator3[Symbol.iterator]();;) { - var _ref4; - if (_isArray3) { - if (_i3 >= _iterator3.length) break; - _ref4 = _iterator3[_i3++]; - } else { - _i3 = _iterator3.next(); - if (_i3.done) break; - _ref4 = _i3.value; - } + const manifest = yield config.findManifest(workspaceRootFolder, false); + invariant(manifest && manifest.workspaces, 'We must find a manifest with a "workspaces" property'); - const targetManifest = _ref4; + const workspaces = yield config.resolveWorkspaces(workspaceRootFolder, manifest); - Object.assign(targetManifest.object, pkg); - reporter.success(`Saved ${path.basename(targetManifest.loc)}`); - } + try { + for (var _iterator4 = Object.keys(workspaces), _isArray4 = Array.isArray(_iterator4), _i4 = 0, _iterator4 = _isArray4 ? _iterator4 : _iterator4[Symbol.iterator]();;) { + var _ref6; - yield config.saveRootManifests(manifests); - }); + if (_isArray4) { + if (_i4 >= _iterator4.length) break; + _ref6 = _iterator4[_i4++]; + } else { + _i4 = _iterator4.next(); + if (_i4.done) break; + _ref6 = _i4.value; + } - return function run(_x, _x2, _x3, _x4) { - return _ref.apply(this, arguments); - }; -})(); + const workspaceName = _ref6; + const loc = workspaces[workspaceName].loc; -let getGitConfigInfo = exports.getGitConfigInfo = (() => { - var _ref6 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (credential, spawn = (_child || _load_child()).spawn) { - try { - // try to get author default based on git config - return yield spawn('git', ['config', credential]); - } catch (e) { - return ''; + reporter.log(`${os.EOL}> ${workspaceName}`); + yield (_child || _load_child()).spawn((_constants2 || _load_constants2()).NODE_BIN_PATH, [(_constants2 || _load_constants2()).YARN_BIN_PATH, 'run', ...args], { + stdio: 'inherit', + cwd: loc + }); + } + } catch (err) { + throw err; } }); - return function getGitConfigInfo(_x5) { - return _ref6.apply(this, arguments); + return function runScript(_x5, _x6, _x7, _x8) { + return _ref5.apply(this, arguments); }; })(); -exports.setFlags = setFlags; exports.hasWrapper = hasWrapper; -var _util; +var _errors; -function _load_util() { - return _util = __webpack_require__(222); +function _load_errors() { + return _errors = __webpack_require__(6); } -var _index; +var _buildSubCommands2; -function _load_index() { - return _index = __webpack_require__(58); +function _load_buildSubCommands() { + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(59)); } -var _githubResolver; +var _constants; -function _load_githubResolver() { - return _githubResolver = _interopRequireDefault(__webpack_require__(367)); +function _load_constants() { + return _constants = __webpack_require__(8); } var _child; @@ -97324,58 +95996,56 @@ function _load_child() { return _child = _interopRequireWildcard(__webpack_require__(50)); } -var _fs; - -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(5)); -} - -var _validate; - -function _load_validate() { - return _validate = _interopRequireWildcard(__webpack_require__(125)); -} - -var _constants; +var _constants2; -function _load_constants() { - return _constants = __webpack_require__(8); +function _load_constants2() { + return _constants2 = __webpack_require__(8); } function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const objectPath = __webpack_require__(304); - +const invariant = __webpack_require__(9); const path = __webpack_require__(0); -const yn = __webpack_require__(962); - -function setFlags(commander) { - commander.description('Interactively creates or updates a package.json file.'); - commander.option('-y, --yes', 'use default options'); - commander.option('-p, --private', 'use default options and private true'); - commander.option('-i, --install ', 'install a specific Yarn release'); - commander.option('-2', 'generates the project using Yarn 2'); -} +const os = __webpack_require__(46); +const semver = __webpack_require__(22); function hasWrapper(commander, args) { return true; } -const shouldRunInCurrentCwd = exports.shouldRunInCurrentCwd = true; +var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).default)('workspaces', { + info(config, reporter, flags, args) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + yield info(config, reporter, flags, args); + })(); + }, + run(config, reporter, flags, args) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + yield runScript(config, reporter, flags, args); + })(); + } +}); + +const run = _buildSubCommands.run, + setFlags = _buildSubCommands.setFlags, + examples = _buildSubCommands.examples; +exports.run = run; +exports.setFlags = setFlags; +exports.examples = examples; /***/ }), -/* 535 */ +/* 517 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; - +/* WEBPACK VAR INJECTION */(function(module) { Object.defineProperty(exports, "__esModule", { value: true }); -exports.examples = exports.run = undefined; +exports.autoRun = exports.main = undefined; var _extends2; @@ -97389,573 +96059,827 @@ function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(2)); } -let getManifests = (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, flags) { - const lockfile = yield (_lockfile || _load_lockfile()).default.fromDirectory(config.cwd); - const install = new (_install || _load_install()).Install((0, (_extends2 || _load_extends()).default)({ skipIntegrityCheck: true }, flags), config, new (_baseReporter || _load_baseReporter()).default(), lockfile); - yield install.hydrate(true); +let main = exports.main = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* ({ + startArgs, + args, + endArgs + }) { + const collect = function collect(val, acc) { + acc.push(val); + return acc; + }; - let manifests = install.resolver.getManifests(); + (0, (_loudRejection || _load_loudRejection()).default)(); + (0, (_signalHandler || _load_signalHandler()).default)(); - // sort by name - manifests = manifests.sort(function (a, b) { - if (!a.name && !b.name) { - return 0; - } + // set global options + (_commander || _load_commander()).default.version((_yarnVersion || _load_yarnVersion()).version, '-v, --version'); + (_commander || _load_commander()).default.usage('[command] [flags]'); + (_commander || _load_commander()).default.option('--no-default-rc', 'prevent Yarn from automatically detecting yarnrc and npmrc files'); + (_commander || _load_commander()).default.option('--use-yarnrc ', 'specifies a yarnrc file that Yarn should use (.yarnrc only, not .npmrc)', collect, []); + (_commander || _load_commander()).default.option('--verbose', 'output verbose messages on internal operations'); + (_commander || _load_commander()).default.option('--offline', 'trigger an error if any required dependencies are not available in local cache'); + (_commander || _load_commander()).default.option('--prefer-offline', 'use network only if dependencies are not available in local cache'); + (_commander || _load_commander()).default.option('--enable-pnp, --pnp', "enable the Plug'n'Play installation"); + (_commander || _load_commander()).default.option('--disable-pnp', "disable the Plug'n'Play installation"); + (_commander || _load_commander()).default.option('--strict-semver'); + (_commander || _load_commander()).default.option('--json', 'format Yarn log messages as lines of JSON (see jsonlines.org)'); + (_commander || _load_commander()).default.option('--ignore-scripts', "don't run lifecycle scripts"); + (_commander || _load_commander()).default.option('--har', 'save HAR output of network traffic'); + (_commander || _load_commander()).default.option('--ignore-platform', 'ignore platform checks'); + (_commander || _load_commander()).default.option('--ignore-engines', 'ignore engines check'); + (_commander || _load_commander()).default.option('--ignore-optional', 'ignore optional dependencies'); + (_commander || _load_commander()).default.option('--force', 'install and build packages even if they were built before, overwrite lockfile'); + (_commander || _load_commander()).default.option('--skip-integrity-check', 'run install without checking if node_modules is installed'); + (_commander || _load_commander()).default.option('--check-files', 'install will verify file tree of packages for consistency'); + (_commander || _load_commander()).default.option('--no-bin-links', "don't generate bin links when setting up packages"); + (_commander || _load_commander()).default.option('--flat', 'only allow one version of a package'); + (_commander || _load_commander()).default.option('--prod, --production [prod]', '', (_conversion || _load_conversion()).boolify); + (_commander || _load_commander()).default.option('--no-lockfile', "don't read or generate a lockfile"); + (_commander || _load_commander()).default.option('--pure-lockfile', "don't generate a lockfile"); + (_commander || _load_commander()).default.option('--frozen-lockfile', "don't generate a lockfile and fail if an update is needed"); + (_commander || _load_commander()).default.option('--update-checksums', 'update package checksums from current repository'); + (_commander || _load_commander()).default.option('--link-duplicates', 'create hardlinks to the repeated modules in node_modules'); + (_commander || _load_commander()).default.option('--link-folder ', 'specify a custom folder to store global links'); + (_commander || _load_commander()).default.option('--global-folder ', 'specify a custom folder to store global packages'); + (_commander || _load_commander()).default.option('--modules-folder ', 'rather than installing modules into the node_modules folder relative to the cwd, output them here'); + (_commander || _load_commander()).default.option('--preferred-cache-folder ', 'specify a custom folder to store the yarn cache if possible'); + (_commander || _load_commander()).default.option('--cache-folder ', 'specify a custom folder that must be used to store the yarn cache'); + (_commander || _load_commander()).default.option('--mutex [:specifier]', 'use a mutex to ensure only one yarn instance is executing'); + (_commander || _load_commander()).default.option('--emoji [bool]', 'enable emoji in output', (_conversion || _load_conversion()).boolify, process.platform === 'darwin' || process.env.TERM_PROGRAM === 'Hyper' || process.env.TERM_PROGRAM === 'HyperTerm' || process.env.TERM_PROGRAM === 'Terminus'); + (_commander || _load_commander()).default.option('-s, --silent', 'skip Yarn console logs, other types of logs (script output) will be printed'); + (_commander || _load_commander()).default.option('--cwd ', 'working directory to use', process.cwd()); + (_commander || _load_commander()).default.option('--proxy ', ''); + (_commander || _load_commander()).default.option('--https-proxy ', ''); + (_commander || _load_commander()).default.option('--registry ', 'override configuration registry'); + (_commander || _load_commander()).default.option('--no-progress', 'disable progress bar'); + (_commander || _load_commander()).default.option('--network-concurrency ', 'maximum number of concurrent network requests', parseInt); + (_commander || _load_commander()).default.option('--network-timeout ', 'TCP timeout for network requests', parseInt); + (_commander || _load_commander()).default.option('--non-interactive', 'do not show interactive prompts'); + (_commander || _load_commander()).default.option('--scripts-prepend-node-path [bool]', 'prepend the node executable dir to the PATH in scripts', (_conversion || _load_conversion()).boolify); + (_commander || _load_commander()).default.option('--no-node-version-check', 'do not warn when using a potentially unsupported Node version'); + (_commander || _load_commander()).default.option('--focus', 'Focus on a single workspace by installing remote copies of its sibling workspaces.'); + (_commander || _load_commander()).default.option('--otp ', 'one-time password for two factor authentication'); - if (!a.name) { - return 1; - } + // if -v is the first command, then always exit after returning the version + if (args[0] === '-v') { + console.log((_yarnVersion || _load_yarnVersion()).version.trim()); + process.exitCode = 0; + return; + } - if (!b.name) { - return -1; - } + // get command name + const firstNonFlagIndex = args.findIndex(function (arg, idx, arr) { + const isOption = arg.startsWith('-'); + const prev = idx > 0 && arr[idx - 1]; + const prevOption = prev && prev.startsWith('-') && (_commander || _load_commander()).default.optionFor(prev); + const boundToPrevOption = prevOption && (prevOption.optional || prevOption.required); - return a.name.localeCompare(b.name); + return !isOption && !boundToPrevOption; }); + let preCommandArgs; + let commandName = ''; + if (firstNonFlagIndex > -1) { + preCommandArgs = args.slice(0, firstNonFlagIndex); + commandName = args[firstNonFlagIndex]; + args = args.slice(firstNonFlagIndex + 1); + } else { + preCommandArgs = args; + args = []; + } - // filter ignored manifests - manifests = manifests.filter(function (manifest) { - const ref = manifest._reference; - return !!ref && !ref.ignore; - }); + let isKnownCommand = Object.prototype.hasOwnProperty.call((_index3 || _load_index3()).default, commandName); + const isHelp = function isHelp(arg) { + return arg === '--help' || arg === '-h'; + }; + const helpInPre = preCommandArgs.findIndex(isHelp); + const helpInArgs = args.findIndex(isHelp); + const setHelpMode = function setHelpMode() { + if (isKnownCommand) { + args.unshift(commandName); + } + commandName = 'help'; + isKnownCommand = true; + }; - return manifests; - }); + if (helpInPre > -1) { + preCommandArgs.splice(helpInPre); + setHelpMode(); + } else if (isKnownCommand && helpInArgs === 0) { + args.splice(helpInArgs); + setHelpMode(); + } - return function getManifests(_x, _x2) { - return _ref.apply(this, arguments); - }; -})(); + if (!commandName) { + commandName = 'install'; + isKnownCommand = true; + } + if (commandName === 'set' && args[0] === 'version') { + commandName = 'policies'; + args.splice(0, 1, 'set-version'); + isKnownCommand = true; + } + if (!isKnownCommand) { + // if command is not recognized, then set default to `run` + args.unshift(commandName); + commandName = 'run'; + } + const command = (_index3 || _load_index3()).default[commandName]; -let list = (() => { - var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - const manifests = yield getManifests(config, flags); - const manifestsByLicense = new Map(); + let warnAboutRunDashDash = false; + // we are using "yarn