diff --git a/.idea/dictionaries/develar.xml b/.idea/dictionaries/develar.xml index 67f66f3e66..6bc099ba39 100644 --- a/.idea/dictionaries/develar.xml +++ b/.idea/dictionaries/develar.xml @@ -65,6 +65,7 @@ enoent eperm evolvehq + fcopy ffmpeg finishpage flattennpmmodules diff --git a/docs/Options.md b/docs/Options.md index 5bc9e0c682..9efaa37819 100644 --- a/docs/Options.md +++ b/docs/Options.md @@ -258,6 +258,7 @@ Configuration Options * `artifactName` String - The [artifact file name pattern](https://github.com/electron-userland/electron-builder/wiki/Options#artifact-file-name-pattern). Defaults to `${productName} Setup ${version}.${ext}`. * `unicode` = `true` Boolean - Whether to create [Unicode installer](http://nsis.sourceforge.net/Docs/Chapter1.html#intro-unicode). * `deleteAppDataOnUninstall` = `false` Boolean - *one-click installer only.* Whether to delete app data on uninstall. + * `packElevateHelper` = `true` Boolean - Whether to pack the elevate executable (required for electron-updater if per-machine installer used or can be used in the future). Ignored if `perMachine` is set to `true`. * `nsisWeb` - Web Installer specific options. * `appPackageUrl` String - The application package download URL. Optional — by default computed using publish configuration. diff --git a/docs/api/electron-builder-util.md b/docs/api/electron-builder-util.md index 611193251b..e3aef138ad 100644 --- a/docs/api/electron-builder-util.md +++ b/docs/api/electron-builder-util.md @@ -83,7 +83,8 @@ * [.FileCopier](#FileCopier) * [`.copy(src, dest, stat)`](#module_electron-builder-util/out/fs.FileCopier+copy) ⇒ Promise<void> * [`.copyDir(src, destination, filter, transformer, isUseHardLink)`](#module_electron-builder-util/out/fs.copyDir) ⇒ Promise<any> - * [`.copyFile(src, dest, stats, isUseHardLink)`](#module_electron-builder-util/out/fs.copyFile) ⇒ Promise<any> + * [`.copyFile(src, dest, isEnsureDir)`](#module_electron-builder-util/out/fs.copyFile) ⇒ Promise<any> + * [`.copyOrLinkFile(src, dest, stats, isUseHardLink)`](#module_electron-builder-util/out/fs.copyOrLinkFile) ⇒ Promise<any> * [`.exists(file)`](#module_electron-builder-util/out/fs.exists) ⇒ Promise<Boolean> * [`.statOrNull(file)`](#module_electron-builder-util/out/fs.statOrNull) ⇒ Promise< \| module:fs.Stats> * [`.unlinkIfExists(file)`](#module_electron-builder-util/out/fs.unlinkIfExists) ⇒ Promise<String \| void> @@ -122,10 +123,23 @@ Hard links is used if supported and allowed. -### `electron-builder-util/out/fs.copyFile(src, dest, stats, isUseHardLink)` ⇒ Promise<any> +### `electron-builder-util/out/fs.copyFile(src, dest, isEnsureDir)` ⇒ Promise<any> +**Kind**: method of [electron-builder-util/out/fs](#module_electron-builder-util/out/fs) + +| Param | Type | +| --- | --- | +| src | String | +| dest | String | +| isEnsureDir | | + + + +### `electron-builder-util/out/fs.copyOrLinkFile(src, dest, stats, isUseHardLink)` ⇒ Promise<any> Hard links is used if supported and allowed. File permission is fixed — allow execute for all if owner can, allow read for all if owner can. +ensureDir is not called, dest parent dir must exists + **Kind**: method of [electron-builder-util/out/fs](#module_electron-builder-util/out/fs) | Param | Type | diff --git a/package.json b/package.json index 0a7cc122f8..a339ade346 100644 --- a/package.json +++ b/package.json @@ -40,6 +40,7 @@ "electron-download-tf": "4.3.1", "electron-is-dev": "^0.1.2", "electron-osx-sign": "0.4.6", + "fcopy-pre-bundled": "^0.1.2", "fs-extra-p": "^4.3.0", "hosted-git-info": "^2.4.2", "ini": "^1.3.4", diff --git a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts index 6ee50f1241..d7ec562734 100644 --- a/packages/electron-builder-squirrel-windows/src/squirrelPack.ts +++ b/packages/electron-builder-squirrel-windows/src/squirrelPack.ts @@ -3,7 +3,7 @@ import { debug, exec, execWine, prepareArgs, spawn } from "electron-builder-util import { copyFile, walk } from "electron-builder-util/out/fs" import { log } from "electron-builder-util/out/log" import { WinPackager } from "electron-builder/out/winPackager" -import { copy, createWriteStream, ensureDir, remove, stat, unlink } from "fs-extra-p" +import { createWriteStream, ensureDir, remove, stat, unlink } from "fs-extra-p" import * as path from "path" const archiver = require("archiver") @@ -50,7 +50,7 @@ export interface SquirrelOptions { export async function buildInstaller(options: SquirrelOptions, outputDirectory: string, setupExe: string, packager: WinPackager, appOutDir: string) { const appUpdate = await packager.getTempFile("Update.exe") await BluebirdPromise.all([ - copy(path.join(options.vendorPath, "Update.exe"), appUpdate) + copyFile(path.join(options.vendorPath, "Update.exe"), appUpdate) .then(() => packager.sign(appUpdate)), BluebirdPromise.all([remove(`${outputDirectory.replace(/\\/g, "/")}/*-full.nupkg`), remove(path.join(outputDirectory, "RELEASES"))]) .then(() => ensureDir(outputDirectory)) @@ -79,7 +79,7 @@ export async function buildInstaller(options: SquirrelOptions, outputDirectory: await BluebirdPromise.all([ pack(options, appOutDir, appUpdate, nupkgPath, version, packager), - copy(path.join(options.vendorPath, "Setup.exe"), setupPath), + copyFile(path.join(options.vendorPath, "Setup.exe"), setupPath), ]) embeddedArchive.file(nupkgPath, {name: packageName}) @@ -233,7 +233,7 @@ async function encodedZip(archive: any, dir: string, prefix: string, vendorPath: // createExecutableStubForExe if (file.endsWith(".exe") && !file.includes("squirrel.exe")) { const tempFile = await packager.getTempFile("stub.exe") - await copyFile(path.join(vendorPath, "StubExecutable.exe"), tempFile, null, false) + await copyFile(path.join(vendorPath, "StubExecutable.exe"), tempFile) await execWine(path.join(vendorPath, "WriteZipToSetup.exe"), ["--copy-stub-resources", file, tempFile]) await packager.sign(tempFile) diff --git a/packages/electron-builder-util/package.json b/packages/electron-builder-util/package.json index 6c4c6c5534..1b9d89c8c7 100644 --- a/packages/electron-builder-util/package.json +++ b/packages/electron-builder-util/package.json @@ -12,6 +12,7 @@ ], "dependencies": { "fs-extra-p": "^4.3.0", + "fcopy-pre-bundled": "^0.1.2", "is-ci": "^1.0.10", "stat-mode": "^0.2.2", "bluebird-lst": "^1.0.2", diff --git a/packages/electron-builder-util/src/fs.ts b/packages/electron-builder-util/src/fs.ts index bc46a5c48d..3f7ee5f66d 100644 --- a/packages/electron-builder-util/src/fs.ts +++ b/packages/electron-builder-util/src/fs.ts @@ -1,5 +1,6 @@ import BluebirdPromise from "bluebird-lst" -import { access, createReadStream, createWriteStream, link, lstat, mkdirs, readdir, readlink, stat, Stats, symlink, unlink, writeFile } from "fs-extra-p" +import fcopy from "fcopy-pre-bundled" +import { access, ensureDir, link, lstat, readdir, readlink, stat, Stats, symlink, unlink, writeFile } from "fs-extra-p" import isCi from "is-ci" import * as path from "path" import Mode from "stat-mode" @@ -109,11 +110,17 @@ export async function walk(initialDirPath: string, filter?: Filter | null, consu const _isUseHardLink = process.platform != "win32" && process.env.USE_HARD_LINKS !== "false" && (isCi || process.env.USE_HARD_LINKS === "true") +export function copyFile(src: string, dest: string, isEnsureDir = true) { + return (isEnsureDir ? ensureDir(path.dirname(dest)) : BluebirdPromise.resolve()).then(() => copyOrLinkFile(src, dest, null, false)) +} + /** * Hard links is used if supported and allowed. * File permission is fixed — allow execute for all if owner can, allow read for all if owner can. + * + * ensureDir is not called, dest parent dir must exists */ -export function copyFile(src: string, dest: string, stats?: Stats | null, isUseHardLink = _isUseHardLink): Promise { +export function copyOrLinkFile(src: string, dest: string, stats?: Stats | null, isUseHardLink = _isUseHardLink): Promise { if (stats != null) { const originalModeNumber = stats.mode const mode = new Mode(stats) @@ -146,17 +153,7 @@ export function copyFile(src: string, dest: string, stats?: Stats | null, isUseH } return new BluebirdPromise(function (resolve, reject) { - const readStream = createReadStream(src) - const writeStream = createWriteStream(dest, stats == null ? undefined : {mode: stats.mode}) - - readStream.on("error", reject) - writeStream.on("error", reject) - - writeStream.on("open", function () { - readStream.pipe(writeStream) - }) - - writeStream.once("close", resolve) + fcopy(src, dest, stats == null ? undefined : {mode: stats.mode}, error => error == null ? resolve() : reject(error)) }) } @@ -181,7 +178,7 @@ export class FileCopier { } } } - await copyFile(src, dest, stat, (!this.isUseHardLink || this.isUseHardLinkFunction == null) ? this.isUseHardLink : this.isUseHardLinkFunction(dest)) + await copyOrLinkFile(src, dest, stat, (!this.isUseHardLink || this.isUseHardLinkFunction == null) ? this.isUseHardLink : this.isUseHardLinkFunction(dest)) } catch (e) { // files are copied concurrently, so, we must not check here currentIsUseHardLink — our code can be executed after that other handler will set currentIsUseHardLink to false @@ -192,7 +189,7 @@ export class FileCopier { this.isUseHardLink = false } - await copyFile(src, dest, stat, false) + await copyOrLinkFile(src, dest, stat, false) } else { throw e @@ -219,7 +216,7 @@ export function copyDir(src: string, destination: string, filter?: Filter, trans } if (!createdSourceDirs.has(parent)) { - await mkdirs(parent.replace(src, destination)) + await ensureDir(parent.replace(src, destination)) createdSourceDirs.add(parent) } diff --git a/packages/electron-builder-util/tsconfig.json b/packages/electron-builder-util/tsconfig.json index 1480d0c051..468ddded04 100644 --- a/packages/electron-builder-util/tsconfig.json +++ b/packages/electron-builder-util/tsconfig.json @@ -18,6 +18,7 @@ "../../typings/debug.d.ts", "../../typings/node-emoji.d.ts", "../../typings/pretty-ms.d.ts", - "../../typings/ansi-escapes.d.ts" + "../../typings/ansi-escapes.d.ts", + "../../typings/fcopy-pre-bundled.d.ts" ] } \ No newline at end of file diff --git a/packages/electron-builder/src/codeSign.ts b/packages/electron-builder/src/codeSign.ts index 6955aad3c6..fefa8a9a33 100644 --- a/packages/electron-builder/src/codeSign.ts +++ b/packages/electron-builder/src/codeSign.ts @@ -1,11 +1,11 @@ import BluebirdPromise from "bluebird-lst" import { randomBytes } from "crypto" import { exec, getCacheDirectory, getTempName, isEmptyOrSpaces } from "electron-builder-util" -import { statOrNull } from "electron-builder-util/out/fs" +import { copyFile, statOrNull } from "electron-builder-util/out/fs" import { httpExecutor } from "electron-builder-util/out/nodeHttpExecutor" import { all, executeFinally } from "electron-builder-util/out/promise" import { TmpDir } from "electron-builder-util/out/tmp" -import { copy, deleteFile, outputFile, rename } from "fs-extra-p" +import { deleteFile, outputFile, rename } from "fs-extra-p" import isCi from "is-ci" import { homedir } from "os" import * as path from "path" @@ -73,7 +73,7 @@ async function createCustomCertKeychain() { const keychainPath = path.join(getCacheDirectory(), "electron-builder-root-certs.keychain") const results = await BluebirdPromise.all([ exec("security", ["list-keychains"]), - copy(path.join(__dirname, "..", "certs", "root_certs.keychain"), tmpKeychainPath) + copyFile(path.join(__dirname, "..", "certs", "root_certs.keychain"), tmpKeychainPath) .then(() => rename(tmpKeychainPath, keychainPath)), ]) const list = results[0] diff --git a/packages/electron-builder/src/fileMatcher.ts b/packages/electron-builder/src/fileMatcher.ts index 9dcd39bf09..7461fb80e9 100644 --- a/packages/electron-builder/src/fileMatcher.ts +++ b/packages/electron-builder/src/fileMatcher.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" import { asArray, debug } from "electron-builder-util" -import { copyDir, copyFile, Filter, statOrNull } from "electron-builder-util/out/fs" +import { copyDir, copyOrLinkFile, Filter, statOrNull } from "electron-builder-util/out/fs" import { warn } from "electron-builder-util/out/log" import { mkdirs } from "fs-extra-p" import { Minimatch } from "minimatch" @@ -183,11 +183,11 @@ export function copyFiles(patterns: Array | null): Promise { const toStat = await statOrNull(pattern.to) // https://github.com/electron-userland/electron-builder/issues/1245 if (toStat != null && toStat.isDirectory()) { - return await copyFile(pattern.from, path.join(pattern.to, path.basename(pattern.from)), fromStat) + return await copyOrLinkFile(pattern.from, path.join(pattern.to, path.basename(pattern.from)), fromStat) } await mkdirs(path.dirname(pattern.to)) - return await copyFile(pattern.from, pattern.to, fromStat) + return await copyOrLinkFile(pattern.from, pattern.to, fromStat) } if (pattern.isEmpty() || pattern.containsOnlyIgnore()) { diff --git a/packages/electron-builder/src/packager/mac.ts b/packages/electron-builder/src/packager/mac.ts index fadaf738cf..fcefeb234d 100644 --- a/packages/electron-builder/src/packager/mac.ts +++ b/packages/electron-builder/src/packager/mac.ts @@ -1,9 +1,9 @@ import { AsarIntegrity } from "asar-integrity" import BluebirdPromise from "bluebird-lst" import { asArray, getPlatformIconFileName, use } from "electron-builder-util" -import { copyFile, unlinkIfExists } from "electron-builder-util/out/fs" +import { copyFile, copyOrLinkFile, unlinkIfExists } from "electron-builder-util/out/fs" import { warn } from "electron-builder-util/out/log" -import { copy, readFile, rename, unlink, utimes, writeFile } from "fs-extra-p" +import { readFile, rename, unlink, utimes, writeFile } from "fs-extra-p" import * as path from "path" import { build as buildPlist, parse as parsePlist } from "plist" import { normalizeExt, PlatformPackager } from "../platformPackager" @@ -116,7 +116,7 @@ export async function createApp(packager: PlatformPackager, appOutDir: stri let iconFile = appPlist.CFBundleIconFile if (customIcon != null) { iconFile = path.basename(customIcon) - await copyFile(customIcon, path.join(resourcesPath, iconFile)) + await copyOrLinkFile(customIcon, path.join(resourcesPath, iconFile)) } const result = { @@ -152,7 +152,7 @@ export async function createApp(packager: PlatformPackager, appOutDir: stri if (icon != null) { promises.push(unlink(path.join(resourcesPath, oldIcon))) - promises.push(copy(icon, path.join(resourcesPath, appPlist.CFBundleIconFile))) + promises.push(copyFile(icon, path.join(resourcesPath, appPlist.CFBundleIconFile))) } await BluebirdPromise.all(promises) diff --git a/packages/electron-builder/src/targets/appx.ts b/packages/electron-builder/src/targets/appx.ts index 9897cd5585..53cc346250 100644 --- a/packages/electron-builder/src/targets/appx.ts +++ b/packages/electron-builder/src/targets/appx.ts @@ -1,8 +1,8 @@ import BluebirdPromise from "bluebird-lst" import { Arch, getArchSuffix, Target } from "electron-builder-core" import { spawn, use } from "electron-builder-util" -import { copyDir } from "electron-builder-util/out/fs" -import { copy, emptyDir, readFile, writeFile } from "fs-extra-p" +import { copyDir, copyFile } from "electron-builder-util/out/fs" +import { emptyDir, readFile, writeFile } from "fs-extra-p" import { release } from "os" import * as path from "path" import sanitizeFileName from "sanitize-filename" @@ -55,9 +55,9 @@ export default class AppXTarget extends Target { BluebirdPromise.map(["44x44", "50x50", "150x150", "310x150"], size => { const target = path.join(preAppx, "assets", `${safeName}.${size}.png`) if (resourceList.includes(`${size}.png`)) { - return copy(path.join(packager.buildResourcesDir, `${size}.png`), target) + return copyFile(path.join(packager.buildResourcesDir, `${size}.png`), target) } - return copy(path.join(vendorPath, "appxAssets", `SampleAppx.${size}.png`), target) + return copyFile(path.join(vendorPath, "appxAssets", `SampleAppx.${size}.png`), target) }), copyDir(appOutDir, path.join(preAppx, "app")), this.writeManifest(templatePath, preAppx, safeName, arch, publisher) diff --git a/packages/electron-builder/src/targets/dmg.ts b/packages/electron-builder/src/targets/dmg.ts index d6849ddc79..ba76e0ff90 100644 --- a/packages/electron-builder/src/targets/dmg.ts +++ b/packages/electron-builder/src/targets/dmg.ts @@ -2,10 +2,10 @@ import BluebirdPromise from "bluebird-lst" import { Arch, Target } from "electron-builder-core" import { debug, exec, isEmptyOrSpaces, spawn, use } from "electron-builder-util" import { deepAssign } from "electron-builder-util/out/deepAssign" -import { exists, statOrNull } from "electron-builder-util/out/fs" +import { copyFile, exists, statOrNull } from "electron-builder-util/out/fs" import { log, warn } from "electron-builder-util/out/log" import { executeFinally } from "electron-builder-util/out/promise" -import { copy, outputFile, readFile, remove, unlink } from "fs-extra-p" +import { outputFile, readFile, remove, unlink } from "fs-extra-p" import * as path from "path" import sanitizeFileName from "sanitize-filename" import { DmgOptions, MacOptions } from "../options/macOptions" @@ -33,7 +33,7 @@ export class DmgTarget extends Target { const backgroundDir = path.join(tempDir, ".background") const backgroundFilename = specification.background == null ? null : path.basename(specification.background) if (backgroundFilename != null) { - await copy(path.resolve(packager.info.projectDir, specification.background!), path.join(backgroundDir, backgroundFilename)) + await copyFile(path.resolve(packager.info.projectDir, specification.background!), path.join(backgroundDir, backgroundFilename)) } let preallocatedSize = 32 * 1024 @@ -98,7 +98,7 @@ export class DmgTarget extends Target { } else { const volumeIcon = `${volumePath}/.VolumeIcon.icns` - promises.push(copy((await packager.getResource(specification.icon))!, volumeIcon)) + promises.push(copyFile((await packager.getResource(specification.icon))!, volumeIcon)) env.volumeIcon = volumeIcon } diff --git a/packages/electron-builder/src/targets/nsis.ts b/packages/electron-builder/src/targets/nsis.ts index 9b006a8e39..1d4dcb6ce4 100644 --- a/packages/electron-builder/src/targets/nsis.ts +++ b/packages/electron-builder/src/targets/nsis.ts @@ -111,7 +111,7 @@ export class NsisTarget extends Target { } if (isPackElevateHelper !== false) { - await copyFile(path.join(await nsisPathPromise, "elevate.exe"), path.join(appOutDir, "resources", "elevate.exe"), null, false) + await copyFile(path.join(await nsisPathPromise, "elevate.exe"), path.join(appOutDir, "resources", "elevate.exe"), false) } const packager = this.packager diff --git a/packages/electron-builder/src/targets/snap.ts b/packages/electron-builder/src/targets/snap.ts index 2c12c2f515..98065c83d2 100644 --- a/packages/electron-builder/src/targets/snap.ts +++ b/packages/electron-builder/src/targets/snap.ts @@ -1,7 +1,8 @@ import { Arch, Target, toLinuxArchString } from "electron-builder-core" import { replaceDefault, spawn } from "electron-builder-util" +import { copyFile } from "electron-builder-util/out/fs" import { log } from "electron-builder-util/out/log" -import { copy, emptyDir, outputFile } from "fs-extra-p" +import { emptyDir, outputFile } from "fs-extra-p" import { safeDump } from "js-yaml" import { homedir } from "os" import * as path from "path" @@ -45,7 +46,7 @@ export default class SnapTarget extends Target { await this.helper.icons if (this.helper.maxIconPath != null) { snap.icon = "snap/gui/icon.png" - await copy(this.helper.maxIconPath, path.join(snapDir, "gui", "icon.png")) + await copyFile(this.helper.maxIconPath, path.join(snapDir, "gui", "icon.png")) } const desktopFile = await this.helper.computeDesktopEntry(this.options, `${packager.executableName}`, path.join(snapDir, "gui", `${snap.name}.desktop`), { diff --git a/packages/electron-builder/src/yarn.ts b/packages/electron-builder/src/yarn.ts index f913c9a707..0f099a459b 100644 --- a/packages/electron-builder/src/yarn.ts +++ b/packages/electron-builder/src/yarn.ts @@ -55,8 +55,7 @@ function installDependencies(appDir: string, frameworkInfo: DesktopFrameworkInfo let execPath = process.env.npm_execpath || process.env.NPM_CLI_JS const execArgs = ["install", "--production"] - const isYarn = isYarnPath(execPath) - if (!isYarn) { + if (!isYarnPath(execPath)) { if (process.env.NPM_NO_BIN_LINKS === "true") { execArgs.push("--no-bin-links") } diff --git a/test/src/ArtifactPublisherTest.ts b/test/src/ArtifactPublisherTest.ts index 22141373fe..a73f18acd0 100644 --- a/test/src/ArtifactPublisherTest.ts +++ b/test/src/ArtifactPublisherTest.ts @@ -1,12 +1,12 @@ import { HttpError } from "electron-builder-http" import { CancellationToken } from "electron-builder-http/out/CancellationToken" import { S3Options } from "electron-builder-http/out/publishOptions" +import { copyFile } from "electron-builder-util/out/fs" import { TmpDir } from "electron-builder-util/out/tmp" import { createPublisher } from "electron-builder/out/publish/PublishManager" import { PublishContext } from "electron-publish" import { BintrayPublisher } from "electron-publish/out/BintrayPublisher" import { GitHubPublisher } from "electron-publish/out/gitHubPublisher" -import { copy } from "fs-extra-p" import isCi from "is-ci" import { join } from "path" @@ -82,7 +82,7 @@ test("Bintray upload", async () => { const tmpDir = new TmpDir() const artifactPath = await tmpDir.getTempFile(`icon-${version}.icns`) - await copy(iconPath, artifactPath) + await copyFile(iconPath, artifactPath) //noinspection SpellCheckingInspection const publisher = new BintrayPublisher(publishContext, {provider: "bintray", owner: "actperepo", package: "test", repo: "generic", token: "5df2cadec86dff91392e4c419540785813c3db15"}, version) diff --git a/test/src/mac/dmgTest.ts b/test/src/mac/dmgTest.ts index 421e9795e4..72f4311f7b 100644 --- a/test/src/mac/dmgTest.ts +++ b/test/src/mac/dmgTest.ts @@ -1,8 +1,9 @@ import BluebirdPromise from "bluebird-lst" import { Platform } from "electron-builder" +import { copyFile } from "electron-builder-util/out/fs" import { PlatformPackager } from "electron-builder/out/platformPackager" import { attachAndExecute } from "electron-builder/out/targets/dmg" -import { copy, remove, writeFile } from "fs-extra-p" +import { remove, writeFile } from "fs-extra-p" import * as path from "path" import { assertThat } from "../helpers/fileAssert" import { app, assertPack, copyTestAsset } from "../helpers/packTester" @@ -47,10 +48,10 @@ test.ifAll.ifMac("custom background - new way", () => { }, }, { projectDirCreated: projectDir => BluebirdPromise.all([ - copy(path.join(__dirname, "..", "..", "..", "packages", "electron-builder", "templates", "dmg", "background.tiff"), path.join(projectDir, customBackground)), + copyFile(path.join(__dirname, "..", "..", "..", "packages", "electron-builder", "templates", "dmg", "background.tiff"), path.join(projectDir, customBackground)), // copy, but not rename to test that default icon is not used - copy(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "customIcon.icns")), - copy(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "foo.icns")), + copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "customIcon.icns")), + copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "foo.icns")), ]), }) }) diff --git a/test/src/mac/macPackagerTest.ts b/test/src/mac/macPackagerTest.ts index f7a84d7922..82dc5bac35 100644 --- a/test/src/mac/macPackagerTest.ts +++ b/test/src/mac/macPackagerTest.ts @@ -1,6 +1,6 @@ import BluebirdPromise from "bluebird-lst" import { createTargets, DIR_TARGET, Platform } from "electron-builder" -import { copyFile } from "electron-builder-util/out/fs" +import { copyOrLinkFile } from "electron-builder-util/out/fs" import { readJson } from "fs-extra-p" import * as path from "path" import { assertThat } from "../helpers/fileAssert" @@ -54,8 +54,8 @@ test.ifMac("one-package", app({ }, { signed: true, projectDirCreated: projectDir => BluebirdPromise.all([ - copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "foo.icns")), - copyFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "someFoo.icns")), + copyOrLinkFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "foo.icns")), + copyOrLinkFile(path.join(projectDir, "build", "icon.icns"), path.join(projectDir, "build", "someFoo.icns")), ]), checkMacApp: async (appDir, info) => { expect(info).toMatchSnapshot() diff --git a/test/vendor/yarn.js b/test/vendor/yarn.js index e850754153..e266c20552 100755 --- a/test/vendor/yarn.js +++ b/test/vendor/yarn.js @@ -2,41 +2,41 @@ /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; - +/******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { - +/******/ /******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) +/******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; - +/******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; - +/******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - +/******/ /******/ // Flag the module as loaded /******/ module.l = true; - +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } - - +/******/ +/******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; - +/******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; - +/******/ /******/ // identity function for calling harmony imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; - +/******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { @@ -47,7 +47,7 @@ /******/ }); /******/ } /******/ }; - +/******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? @@ -56,15 +56,15 @@ /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; - +/******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; - +/******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; - +/******/ /******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 631); +/******/ return __webpack_require__(__webpack_require__.s = 638); /******/ }) /************************************************************************/ /******/ ([ @@ -76,7 +76,7 @@ exports.__esModule = true; -var _promise = __webpack_require__(388); +var _promise = __webpack_require__(397); var _promise2 = _interopRequireDefault(_promise); @@ -173,12 +173,25 @@ let buildActionsForCopy = (() => { let build = (() => { var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (data) { const src = data.src, - dest = data.dest; + dest = data.dest, + type = data.type; const onFresh = data.onFresh || noop; const onDone = data.onDone || noop; files.add(dest); + if (type === 'symlink') { + yield mkdirp(path.dirname(dest)); + onFresh(); + actions.push({ + type: 'symlink', + dest, + linkname: src + }); + onDone(); + return; + } + if (events.ignoreBasenames.indexOf(path.basename(src)) >= 0) { // ignored file return; @@ -258,9 +271,9 @@ let buildActionsForCopy = (() => { onFresh(); const linkname = yield readlink(src); actions.push({ - type: 'symlink', dest, - linkname + linkname, + type: 'symlink' }); onDone(); } else if (srcStat.isDirectory()) { @@ -283,14 +296,14 @@ let buildActionsForCopy = (() => { } for (const file of srcFiles) { queue.push({ - onFresh, - src: path.join(src, file), dest: path.join(dest, file), + onFresh, onDone: function () { if (--remaining === 0) { onDone(); } - } + }, + src: path.join(src, file) }); } } else if (srcStat.isFile()) { @@ -573,36 +586,25 @@ let copyBulk = exports.copyBulk = (() => { const cleanup = function () { return delete currentlyWriting[data.dest]; }; - return currentlyWriting[data.dest] = new Promise(function (resolve, reject) { - const readStream = fs.createReadStream(data.src); - const writeStream = fs.createWriteStream(data.dest, { mode: data.mode }); - - reporter.verbose(reporter.lang('verboseFileCopy', data.src, data.dest)); - - readStream.on('error', reject); - writeStream.on('error', reject); - - writeStream.on('open', function () { - readStream.pipe(writeStream); - }); - - writeStream.once('close', function () { + reporter.verbose(reporter.lang('verboseFileCopy', data.src, data.dest)); + return currentlyWriting[data.dest] = readFileBuffer(data.src).then(function (d) { + return writeFile(data.dest, d, { mode: data.mode }); + }).then(function () { + return new Promise(function (resolve, reject) { fs.utimes(data.dest, data.atime, data.mtime, function (err) { if (err) { reject(err); } else { - events.onProgress(data.dest); - cleanup(); resolve(); } }); }); - }).then(function (arg) { + }).then(function () { + events.onProgress(data.dest); cleanup(); - return arg; - }).catch(function (arg) { + }, function (err) { cleanup(); - throw arg; + throw err; }); }); @@ -925,19 +927,19 @@ exports.normalizeOS = normalizeOS; var _blockingQueue; function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(80)); + return _blockingQueue = _interopRequireDefault(__webpack_require__(84)); } var _promise; function _load_promise() { - return _promise = _interopRequireWildcard(__webpack_require__(61)); + return _promise = _interopRequireWildcard(__webpack_require__(64)); } var _promise2; function _load_promise2() { - return _promise2 = __webpack_require__(61); + return _promise2 = __webpack_require__(64); } var _map; @@ -950,10 +952,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const fs = __webpack_require__(5); +const fs = __webpack_require__(6); -const globModule = __webpack_require__(144); -const os = __webpack_require__(107); +const globModule = __webpack_require__(146); +const os = __webpack_require__(113); const path = __webpack_require__(1); const lockQueue = exports.lockQueue = new (_blockingQueue || _load_blockingQueue()).default('fs lock'); @@ -966,8 +968,8 @@ const readdir = exports.readdir = (0, (_promise2 || _load_promise2()).promisify) const rename = exports.rename = (0, (_promise2 || _load_promise2()).promisify)(fs.rename); const access = exports.access = (0, (_promise2 || _load_promise2()).promisify)(fs.access); const stat = exports.stat = (0, (_promise2 || _load_promise2()).promisify)(fs.stat); -const unlink = exports.unlink = (0, (_promise2 || _load_promise2()).promisify)(__webpack_require__(594)); -const mkdirp = exports.mkdirp = (0, (_promise2 || _load_promise2()).promisify)(__webpack_require__(154)); +const unlink = exports.unlink = (0, (_promise2 || _load_promise2()).promisify)(__webpack_require__(602)); +const mkdirp = exports.mkdirp = (0, (_promise2 || _load_promise2()).promisify)(__webpack_require__(156)); const exists = exports.exists = (0, (_promise2 || _load_promise2()).promisify)(fs.exists, true); const lstat = exports.lstat = (0, (_promise2 || _load_promise2()).promisify)(fs.lstat); const chmod = exports.chmod = (0, (_promise2 || _load_promise2()).promisify)(fs.chmod); @@ -977,8 +979,8 @@ const glob = exports.glob = (0, (_promise2 || _load_promise2()).promisify)(globM const CONCURRENT_QUEUE_ITEMS = 4; const fsSymlink = (0, (_promise2 || _load_promise2()).promisify)(fs.symlink); -const invariant = __webpack_require__(7); -const stripBOM = __webpack_require__(261); +const invariant = __webpack_require__(5); +const stripBOM = __webpack_require__(266); const noop = () => {}; @@ -1045,18 +1047,6 @@ const lf = new Buffer('\n', 'utf8')[0]; /***/ }), /* 5 */ -/***/ (function(module, exports) { - -module.exports = require("fs"); - -/***/ }), -/* 6 */ -/***/ (function(module, exports) { - -module.exports = require("crypto"); - -/***/ }), -/* 7 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -1115,6 +1105,18 @@ var invariant = function(condition, format, a, b, c, d, e, f) { module.exports = invariant; +/***/ }), +/* 6 */ +/***/ (function(module, exports) { + +module.exports = require("fs"); + +/***/ }), +/* 7 */ +/***/ (function(module, exports) { + +module.exports = require("crypto"); + /***/ }), /* 8 */ /***/ (function(module, exports, __webpack_require__) { @@ -1127,7 +1129,7 @@ Object.defineProperty(exports, "__esModule", { }); exports.getPathKey = getPathKey; const path = __webpack_require__(1); -const userHome = __webpack_require__(122).default; +const userHome = __webpack_require__(86).default; const DEPENDENCY_TYPES = exports.DEPENDENCY_TYPES = ['devDependencies', 'dependencies', 'optionalDependencies', 'peerDependencies']; @@ -1447,7 +1449,7 @@ exports.addSuffix = addSuffix; exports.hyphenate = hyphenate; exports.camelCase = camelCase; exports.compareSortedArrays = compareSortedArrays; -const _camelCase = __webpack_require__(395); +const _camelCase = __webpack_require__(404); function has2xxResponse(res) { return res.responseCode >= 200 && res.responseCode < 300; @@ -1541,11 +1543,11 @@ module.exports = require("url"); exports.__esModule = true; -var _isIterable2 = __webpack_require__(386); +var _isIterable2 = __webpack_require__(395); var _isIterable3 = _interopRequireDefault(_isIterable2); -var _getIterator2 = __webpack_require__(385); +var _getIterator2 = __webpack_require__(394); var _getIterator3 = _interopRequireDefault(_getIterator2); @@ -1610,7 +1612,7 @@ module.exports = { var assert = __webpack_require__(9); var PrivateKey = __webpack_require__(19); -var crypto = __webpack_require__(6); +var crypto = __webpack_require__(7); var MAX_CLASS_DEPTH = 3; @@ -1797,7 +1799,7 @@ function calculateDSAPublic(g, p, x) { assert.buffer(p); assert.buffer(x); try { - var bigInt = __webpack_require__(45).BigInteger; + var bigInt = __webpack_require__(39).BigInteger; } catch (e) { throw (new Error('To load a PKCS#8 format DSA private key, ' + 'the node jsbn library is required.')); @@ -1814,7 +1816,7 @@ function addRSAMissing(key) { assert.object(key); assertCompatible(key, PrivateKey, [1, 1]); try { - var bigInt = __webpack_require__(45).BigInteger; + var bigInt = __webpack_require__(39).BigInteger; } catch (e) { throw (new Error('To write a PEM private key from ' + 'this source, the node jsbn lib is required.')); @@ -1910,7 +1912,7 @@ function _load_asyncToGenerator() { var _parse; function _load_parse() { - return _parse = __webpack_require__(77); + return _parse = __webpack_require__(80); } Object.defineProperty(exports, 'parse', { @@ -1923,7 +1925,7 @@ Object.defineProperty(exports, 'parse', { var _stringify; function _load_stringify() { - return _stringify = __webpack_require__(78); + return _stringify = __webpack_require__(81); } Object.defineProperty(exports, 'stringify', { @@ -1944,13 +1946,13 @@ function _load_misc() { var _packageRequest; function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); } var _parse2; function _load_parse2() { - return _parse2 = _interopRequireDefault(__webpack_require__(77)); + return _parse2 = _interopRequireDefault(__webpack_require__(80)); } var _constants; @@ -1969,7 +1971,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); const path = __webpack_require__(1); function getName(pattern) { @@ -2017,6 +2019,7 @@ class Lockfile { return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { // read the manifest in this directory const lockfileLoc = path.join(dir, (_constants || _load_constants()).LOCKFILE_FILENAME); + let lockfile; let rawLockfile = ''; @@ -2118,11 +2121,11 @@ exports.default = Lockfile; "use strict"; -var escapeStringRegexp = __webpack_require__(228); -var ansiStyles = __webpack_require__(309); +var escapeStringRegexp = __webpack_require__(230); +var ansiStyles = __webpack_require__(314); var stripAnsi = __webpack_require__(162); -var hasAnsi = __webpack_require__(496); -var supportsColor = __webpack_require__(396); +var hasAnsi = __webpack_require__(503); +var supportsColor = __webpack_require__(405); var defineProps = Object.defineProperties; var isSimpleWindowsTerm = process.platform === 'win32' && !/^xterm/i.test(process.env.TERM); @@ -2413,23 +2416,23 @@ module.exports = { /* 18 */ /***/ (function(module, exports, __webpack_require__) { -// Copyright 2015 Joyent, Inc. +// Copyright 2017 Joyent, Inc. module.exports = Key; var assert = __webpack_require__(9); var algs = __webpack_require__(17); -var crypto = __webpack_require__(6); -var Fingerprint = __webpack_require__(70); +var crypto = __webpack_require__(7); +var Fingerprint = __webpack_require__(73); var Signature = __webpack_require__(33); -var DiffieHellman = __webpack_require__(610); +var DiffieHellman = __webpack_require__(261).DiffieHellman; var errs = __webpack_require__(32); var utils = __webpack_require__(13); var PrivateKey = __webpack_require__(19); var edCompat; try { - edCompat = __webpack_require__(256); + edCompat = __webpack_require__(262); } catch (e) { /* Just continue through, and bail out if we try to use it. */ } @@ -2438,13 +2441,13 @@ var InvalidAlgorithmError = errs.InvalidAlgorithmError; var KeyParseError = errs.KeyParseError; var formats = {}; -formats['auto'] = __webpack_require__(257); +formats['auto'] = __webpack_require__(263); formats['pem'] = __webpack_require__(40); formats['pkcs1'] = __webpack_require__(160); -formats['pkcs8'] = __webpack_require__(71); -formats['rfc4253'] = __webpack_require__(47); -formats['ssh'] = __webpack_require__(258); -formats['ssh-private'] = __webpack_require__(101); +formats['pkcs8'] = __webpack_require__(74); +formats['rfc4253'] = __webpack_require__(48); +formats['ssh'] = __webpack_require__(264); +formats['ssh-private'] = __webpack_require__(107); formats['openssh'] = formats['ssh-private']; function Key(opts) { @@ -2586,6 +2589,7 @@ Key.prototype.createVerify = function (hashAlgo) { assert.ok(v, 'failed to create verifier'); var oldVerify = v.verify.bind(v); var key = this.toBuffer('pkcs8'); + var curve = this.curve; var self = this; v.verify = function (signature, fmt) { if (Signature.isSignature(signature, [2, 0])) { @@ -2594,6 +2598,9 @@ Key.prototype.createVerify = function (hashAlgo) { if (signature.hashAlgorithm && signature.hashAlgorithm !== hashAlgo) return (false); + if (signature.curve && self.type === 'ecdsa' && + signature.curve !== curve) + return (false); return (oldVerify(key, signature.toBuffer('asn1'))); } else if (typeof (signature) === 'string' || @@ -2689,23 +2696,26 @@ Key._oldVersionDetect = function (obj) { /* 19 */ /***/ (function(module, exports, __webpack_require__) { -// Copyright 2015 Joyent, Inc. +// Copyright 2017 Joyent, Inc. module.exports = PrivateKey; var assert = __webpack_require__(9); var algs = __webpack_require__(17); -var crypto = __webpack_require__(6); -var Fingerprint = __webpack_require__(70); +var crypto = __webpack_require__(7); +var Fingerprint = __webpack_require__(73); var Signature = __webpack_require__(33); var errs = __webpack_require__(32); var util = __webpack_require__(2); var utils = __webpack_require__(13); +var dhe = __webpack_require__(261); +var generateECDSA = dhe.generateECDSA; +var generateED25519 = dhe.generateED25519; var edCompat; var ed; try { - edCompat = __webpack_require__(256); + edCompat = __webpack_require__(262); } catch (e) { /* Just continue through, and bail out if we try to use it. */ } @@ -2717,12 +2727,12 @@ var KeyParseError = errs.KeyParseError; var KeyEncryptedError = errs.KeyEncryptedError; var formats = {}; -formats['auto'] = __webpack_require__(257); +formats['auto'] = __webpack_require__(263); formats['pem'] = __webpack_require__(40); formats['pkcs1'] = __webpack_require__(160); -formats['pkcs8'] = __webpack_require__(71); -formats['rfc4253'] = __webpack_require__(47); -formats['ssh-private'] = __webpack_require__(101); +formats['pkcs8'] = __webpack_require__(74); +formats['rfc4253'] = __webpack_require__(48); +formats['ssh-private'] = __webpack_require__(107); formats['openssh'] = formats['ssh-private']; formats['ssh'] = formats['ssh-private']; @@ -2778,7 +2788,7 @@ PrivateKey.prototype.derive = function (newType, newSize) { if (this.type === 'ed25519' && newType === 'curve25519') { if (ed === undefined) - ed = __webpack_require__(148); + ed = __webpack_require__(150); priv = this.part.r.data; if (priv[0] === 0x00) @@ -2797,7 +2807,7 @@ PrivateKey.prototype.derive = function (newType, newSize) { })); } else if (this.type === 'curve25519' && newType === 'ed25519') { if (ed === undefined) - ed = __webpack_require__(148); + ed = __webpack_require__(150); priv = this.part.r.data; if (priv[0] === 0x00) @@ -2854,12 +2864,14 @@ PrivateKey.prototype.createSign = function (hashAlgo) { var oldSign = v.sign.bind(v); var key = this.toBuffer('pkcs1'); var type = this.type; + var curve = this.curve; v.sign = function () { var sig = oldSign(key); if (typeof (sig) === 'string') sig = new Buffer(sig, 'binary'); sig = Signature.parse(sig, type, 'asn1'); sig.hashAlgorithm = hashAlgo; + sig.curve = curve; return (sig); }; return (v); @@ -2899,6 +2911,25 @@ PrivateKey.isPrivateKey = function (obj, ver) { return (utils.isCompatible(obj, PrivateKey, ver)); }; +PrivateKey.generate = function (type, options) { + if (options === undefined) + options = {}; + assert.object(options, 'options'); + + switch (type) { + case 'ecdsa': + if (options.curve === undefined) + options.curve = 'nistp256'; + assert.string(options.curve, 'options.curve'); + return (generateECDSA(options.curve)); + case 'ed25519': + return (generateED25519()); + default: + throw (new Error('Key generation not supported with key ' + + 'type "' + type + '"')); + } +}; + /* * API versions for PrivateKey: * [1,0] -- initial ver @@ -20063,7 +20094,7 @@ exports.registryNames = exports.registries = undefined; var _yarnRegistry; function _load_yarnRegistry() { - return _yarnRegistry = _interopRequireDefault(__webpack_require__(357)); + return _yarnRegistry = _interopRequireDefault(__webpack_require__(364)); } var _npmRegistry; @@ -20117,9 +20148,9 @@ function nullify() { /* 25 */ /***/ (function(module, exports, __webpack_require__) { -var store = __webpack_require__(221)('wks') - , uid = __webpack_require__(223) - , Symbol = __webpack_require__(28).Symbol +var store = __webpack_require__(222)('wks') + , uid = __webpack_require__(224) + , Symbol = __webpack_require__(29).Symbol , USE_SYMBOL = typeof Symbol == 'function'; var $exports = module.exports = function(name){ @@ -20131,3191 +20162,3756 @@ $exports.store = store; /***/ }), /* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.wrapLifecycle = exports.run = exports.Install = undefined; - -var _asyncToGenerator2; +/***/ (function(module, exports) { -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); -} +exports = module.exports = SemVer; -let run = exports.run = (() => { - var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - let lockfile; - if (flags.lockfile === false) { - lockfile = new (_wrapper || _load_wrapper()).default(); - } else { - lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.cwd, reporter); - } +// The debug function is excluded entirely from the minified version. +/* nomin */ var debug; +/* nomin */ if (typeof process === 'object' && + /* nomin */ process.env && + /* nomin */ process.env.NODE_DEBUG && + /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) + /* nomin */ debug = function() { + /* nomin */ var args = Array.prototype.slice.call(arguments, 0); + /* nomin */ args.unshift('SEMVER'); + /* nomin */ console.log.apply(console, args); + /* nomin */ }; +/* nomin */ else + /* nomin */ debug = function() {}; - if (args.length) { - const exampleArgs = args.slice(); - if (flags.saveDev) { - exampleArgs.push('--dev'); - } - if (flags.savePeer) { - exampleArgs.push('--peer'); - } - if (flags.saveOptional) { - exampleArgs.push('--optional'); - } - if (flags.saveExact) { - exampleArgs.push('--exact'); - } - if (flags.saveTilde) { - exampleArgs.push('--tilde'); - } - let command = 'add'; - if (flags.global) { - command = 'global add'; - } - throw new (_errors || _load_errors()).MessageError(reporter.lang('installCommandRenamed', `yarn ${command} ${exampleArgs.join(' ')}`)); - } +// Note: this is the semver.org version of the spec that it implements +// Not necessarily the package version of this code. +exports.SEMVER_SPEC_VERSION = '2.0.0'; - yield wrapLifecycle(config, flags, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const install = new Install(flags, config, reporter, lockfile); - yield install.init(); - })); - }); +var MAX_LENGTH = 256; +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; - return function run(_x15, _x16, _x17, _x18) { - return _ref9.apply(this, arguments); - }; -})(); +// The actual regexps go on exports.re +var re = exports.re = []; +var src = exports.src = []; +var R = 0; -let wrapLifecycle = exports.wrapLifecycle = (() => { - var _ref11 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, flags, factory) { - yield config.executeLifecycleScript('preinstall'); +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. - yield factory(); +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. - // npm behaviour, seems kinda funky but yay compatibility - yield config.executeLifecycleScript('install'); - yield config.executeLifecycleScript('postinstall'); +var NUMERICIDENTIFIER = R++; +src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; +var NUMERICIDENTIFIERLOOSE = R++; +src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; - if (!config.production) { - yield config.executeLifecycleScript('prepublish'); - yield config.executeLifecycleScript('prepare'); - } - }); - return function wrapLifecycle(_x19, _x20, _x21) { - return _ref11.apply(this, arguments); - }; -})(); +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. -exports.hasWrapper = hasWrapper; -exports.setFlags = setFlags; +var NONNUMERICIDENTIFIER = R++; +src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; -var _index; -function _load_index() { - return _index = _interopRequireDefault(__webpack_require__(206)); -} +// ## Main Version +// Three dot-separated numeric identifiers. -var _errors; +var MAINVERSION = R++; +src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')\\.' + + '(' + src[NUMERICIDENTIFIER] + ')'; -function _load_errors() { - return _errors = __webpack_require__(3); -} +var MAINVERSIONLOOSE = R++; +src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + + '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; -var _integrityChecker; +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. -function _load_integrityChecker() { - return _integrityChecker = _interopRequireDefault(__webpack_require__(113)); -} +var PRERELEASEIDENTIFIER = R++; +src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; -var _wrapper; +var PRERELEASEIDENTIFIERLOOSE = R++; +src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + + '|' + src[NONNUMERICIDENTIFIER] + ')'; -function _load_wrapper() { - return _wrapper = _interopRequireDefault(__webpack_require__(15)); -} -var _stringify; +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. -function _load_stringify() { - return _stringify = _interopRequireDefault(__webpack_require__(78)); -} +var PRERELEASE = R++; +src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + + '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; -var _packageFetcher; +var PRERELEASELOOSE = R++; +src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + + '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; -function _load_packageFetcher() { - return _packageFetcher = _interopRequireDefault(__webpack_require__(198)); -} +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. -var _packageInstallScripts; +var BUILDIDENTIFIER = R++; +src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; -function _load_packageInstallScripts() { - return _packageInstallScripts = _interopRequireDefault(__webpack_require__(352)); -} +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. -var _packageCompatibility; +var BUILD = R++; +src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + + '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; -function _load_packageCompatibility() { - return _packageCompatibility = _interopRequireDefault(__webpack_require__(197)); -} -var _packageResolver; +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. -function _load_packageResolver() { - return _packageResolver = _interopRequireDefault(__webpack_require__(199)); -} +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. -var _packageLinker; +var FULL = R++; +var FULLPLAIN = 'v?' + src[MAINVERSION] + + src[PRERELEASE] + '?' + + src[BUILD] + '?'; -function _load_packageLinker() { - return _packageLinker = _interopRequireDefault(__webpack_require__(114)); -} +src[FULL] = '^' + FULLPLAIN + '$'; -var _packageRequest; +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + + src[PRERELEASELOOSE] + '?' + + src[BUILD] + '?'; -function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); -} +var LOOSE = R++; +src[LOOSE] = '^' + LOOSEPLAIN + '$'; -var _index2; +var GTLT = R++; +src[GTLT] = '((?:<|>)?=?)'; -function _load_index2() { - return _index2 = __webpack_require__(23); -} +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +var XRANGEIDENTIFIERLOOSE = R++; +src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; +var XRANGEIDENTIFIER = R++; +src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; -var _clean; +var XRANGEPLAIN = R++; +src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + + '(?:' + src[PRERELEASE] + ')?' + + src[BUILD] + '?' + + ')?)?'; -function _load_clean() { - return _clean = __webpack_require__(185); -} +var XRANGEPLAINLOOSE = R++; +src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + + '(?:' + src[PRERELEASELOOSE] + ')?' + + src[BUILD] + '?' + + ')?)?'; -var _constants; +var XRANGE = R++; +src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; +var XRANGELOOSE = R++; +src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; -function _load_constants() { - return _constants = _interopRequireWildcard(__webpack_require__(8)); -} +// Tilde ranges. +// Meaning is "reasonably at or greater than" +var LONETILDE = R++; +src[LONETILDE] = '(?:~>?)'; -var _fs; +var TILDETRIM = R++; +src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; +re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); +var tildeTrimReplace = '$1~'; -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(4)); -} +var TILDE = R++; +src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; +var TILDELOOSE = R++; +src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; -var _map; +// Caret ranges. +// Meaning is "at least and backwards compatible with" +var LONECARET = R++; +src[LONECARET] = '(?:\\^)'; -function _load_map() { - return _map = _interopRequireDefault(__webpack_require__(24)); -} +var CARETTRIM = R++; +src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; +re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); +var caretTrimReplace = '$1^'; -var _yarnVersion; +var CARET = R++; +src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; +var CARETLOOSE = R++; +src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; -function _load_yarnVersion() { - return _yarnVersion = __webpack_require__(62); -} +// A simple gt/lt/eq thing, or just "" to indicate "any version" +var COMPARATORLOOSE = R++; +src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; +var COMPARATOR = R++; +src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; -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 }; } +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +var COMPARATORTRIM = R++; +src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + + '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; -const emoji = __webpack_require__(242); +// this one has to use the /g flag +re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); +var comparatorTrimReplace = '$1$2$3'; -const invariant = __webpack_require__(7); -const isCI = __webpack_require__(147); -const path = __webpack_require__(1); -const semver = __webpack_require__(27); -const ONE_DAY = 1000 * 60 * 60 * 24; +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +var HYPHENRANGE = R++; +src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAIN] + ')' + + '\\s*$'; -/** - * Try and detect the installation method for Yarn and provide a command to update it with. - */ +var HYPHENRANGELOOSE = R++; +src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s+-\\s+' + + '(' + src[XRANGEPLAINLOOSE] + ')' + + '\\s*$'; -function getUpdateCommand(installationMethod) { - if (installationMethod === 'tar') { - return `curl -o- -L ${(_constants || _load_constants()).YARN_INSTALLER_SH} | bash`; - } +// Star ranges basically just allow anything at all. +var STAR = R++; +src[STAR] = '(<|>)?=?\\s*\\*'; - if (installationMethod === 'homebrew') { - return 'brew upgrade yarn'; - } +// Compile to actual regexp objects. +// All are flag-free, unless they were created above with a flag. +for (var i = 0; i < R; i++) { + debug(i, src[i]); + if (!re[i]) + re[i] = new RegExp(src[i]); +} - if (installationMethod === 'deb') { - return 'sudo apt-get update && sudo apt-get install yarn'; - } +exports.parse = parse; +function parse(version, loose) { + if (version instanceof SemVer) + return version; - if (installationMethod === 'rpm') { - return 'sudo yum install yarn'; - } + if (typeof version !== 'string') + return null; - if (installationMethod === 'npm') { - return 'npm upgrade --global yarn'; - } + if (version.length > MAX_LENGTH) + return null; - if (installationMethod === 'chocolatey') { - return 'choco upgrade yarn'; - } + var r = loose ? re[LOOSE] : re[FULL]; + if (!r.test(version)) + return null; - if (installationMethod === 'apk') { - return 'apk update && apk add -u yarn'; + try { + return new SemVer(version, loose); + } catch (er) { + return null; } +} - return null; +exports.valid = valid; +function valid(version, loose) { + var v = parse(version, loose); + return v ? v.version : null; } -function getUpdateInstaller(installationMethod) { - // Windows - if (installationMethod === 'msi') { - return (_constants || _load_constants()).YARN_INSTALLER_MSI; - } - return null; +exports.clean = clean; +function clean(version, loose) { + var s = parse(version.trim().replace(/^[=v]+/, ''), loose); + return s ? s.version : null; } -function normalizeFlags(config, rawFlags) { - const flags = { - // install - har: !!rawFlags.har, - ignorePlatform: !!rawFlags.ignorePlatform, - ignoreEngines: !!rawFlags.ignoreEngines, - ignoreScripts: !!rawFlags.ignoreScripts, - ignoreOptional: !!rawFlags.ignoreOptional, - force: !!rawFlags.force, - flat: !!rawFlags.flat, - lockfile: rawFlags.lockfile !== false, - pureLockfile: !!rawFlags.pureLockfile, - skipIntegrityCheck: !!rawFlags.skipIntegrityCheck, - frozenLockfile: !!rawFlags.frozenLockfile, - linkDuplicates: !!rawFlags.linkDuplicates, - checkFiles: !!rawFlags.checkFiles, - - // add - peer: !!rawFlags.peer, - dev: !!rawFlags.dev, - optional: !!rawFlags.optional, - exact: !!rawFlags.exact, - tilde: !!rawFlags.tilde - }; +exports.SemVer = SemVer; - if (config.getOption('ignore-scripts')) { - flags.ignoreScripts = true; +function SemVer(version, loose) { + if (version instanceof SemVer) { + if (version.loose === loose) + return version; + else + version = version.version; + } else if (typeof version !== 'string') { + throw new TypeError('Invalid Version: ' + version); } - if (config.getOption('ignore-platform')) { - flags.ignorePlatform = true; - } + if (version.length > MAX_LENGTH) + throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - if (config.getOption('ignore-engines')) { - flags.ignoreEngines = true; - } + if (!(this instanceof SemVer)) + return new SemVer(version, loose); - if (config.getOption('ignore-optional')) { - flags.ignoreOptional = true; - } + debug('SemVer', version, loose); + this.loose = loose; + var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); - if (config.getOption('force')) { - flags.force = true; - } + if (!m) + throw new TypeError('Invalid Version: ' + version); - return flags; -} + this.raw = version; -class Install { - constructor(flags, config, reporter, lockfile) { - this.rootManifestRegistries = []; - this.rootPatternsToOrigin = (0, (_map || _load_map()).default)(); - this.resolutions = (0, (_map || _load_map()).default)(); - this.lockfile = lockfile; - this.reporter = reporter; - this.config = config; - this.flags = normalizeFlags(config, flags); - - this.resolver = new (_packageResolver || _load_packageResolver()).default(config, lockfile); - this.fetcher = new (_packageFetcher || _load_packageFetcher()).default(config, this.resolver); - this.integrityChecker = new (_integrityChecker || _load_integrityChecker()).default(config); - this.compatibility = new (_packageCompatibility || _load_packageCompatibility()).default(config, this.resolver, this.flags.ignoreEngines); - this.linker = new (_packageLinker || _load_packageLinker()).default(config, this.resolver); - this.scripts = new (_packageInstallScripts || _load_packageInstallScripts()).default(config, this.resolver, this.flags.force); - } - - /** - * Create a list of dependency requests from the current directories manifests. - */ - - fetchRequestFromCwd() { - var _this = this; + // these are actually numbers + this.major = +m[1]; + this.minor = +m[2]; + this.patch = +m[3]; - let excludePatterns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - let ignoreUnusedPatterns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const patterns = []; - const deps = []; - const manifest = {}; + if (this.major > MAX_SAFE_INTEGER || this.major < 0) + throw new TypeError('Invalid major version') - const ignorePatterns = []; - const usedPatterns = []; + if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) + throw new TypeError('Invalid minor version') - // exclude package names that are in install args - const excludeNames = []; - for (const pattern of excludePatterns) { - // can't extract a package name from this - if ((_packageRequest || _load_packageRequest()).default.getExoticResolver(pattern)) { - continue; - } + if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) + throw new TypeError('Invalid patch version') - // extract the name - const parts = (_packageRequest || _load_packageRequest()).default.normalizePattern(pattern); - excludeNames.push(parts.name); + // numberify any prerelease numeric ids + if (!m[4]) + this.prerelease = []; + else + this.prerelease = m[4].split('.').map(function(id) { + if (/^[0-9]+$/.test(id)) { + var num = +id; + if (num >= 0 && num < MAX_SAFE_INTEGER) + return num; } + return id; + }); - for (const registry of Object.keys((_index2 || _load_index2()).registries)) { - const filename = (_index2 || _load_index2()).registries[registry].filename; + this.build = m[5] ? m[5].split('.') : []; + this.format(); +} - const loc = path.join(_this.config.cwd, filename); - if (!(yield (_fs || _load_fs()).exists(loc))) { - continue; - } +SemVer.prototype.format = function() { + this.version = this.major + '.' + this.minor + '.' + this.patch; + if (this.prerelease.length) + this.version += '-' + this.prerelease.join('.'); + return this.version; +}; - _this.rootManifestRegistries.push(registry); - const projectManifestJson = yield _this.config.readJson(loc); - yield (0, (_index || _load_index()).default)(projectManifestJson, _this.config.cwd, _this.config, true); +SemVer.prototype.toString = function() { + return this.version; +}; - const rootCwd = _this.config.cwd; - // if project has workspaces we aggreagate all dependences from workspaces into root - if (projectManifestJson.workspaces && _this.config.workspacesExperimental) { - if (!projectManifestJson.private) { - throw new (_errors || _load_errors()).MessageError(_this.reporter.lang('workspacesRequirePrivateProjects')); - } - for (const workspace of projectManifestJson.workspaces) { - for (const workspaceLoc of yield (_fs || _load_fs()).glob(path.join(rootCwd, workspace, filename))) { - const workspaceCwd = path.dirname(workspaceLoc); - const workspaceJson = yield _this.config.readJson(workspaceLoc); - yield (0, (_index || _load_index()).default)(workspaceJson, workspaceCwd, _this.config, true); - for (const type of ['dependencies', 'devDependencies', 'optionalDependencies']) { - if (workspaceJson[type]) { - for (const key in workspaceJson[type]) { - if (projectManifestJson[type] && projectManifestJson[type][key] && projectManifestJson[type][key] !== workspaceJson[type][key]) { - // TODO conflicts should still be installed inside workspaces' folders - throw new (_errors || _load_errors()).MessageError(_this.reporter.lang('workspacesIncompatibleDependencies', key, workspaceCwd, rootCwd)); - } - projectManifestJson[type][key] = workspaceJson[type][key]; - } - } - } - } - } - } +SemVer.prototype.compare = function(other) { + debug('SemVer.compare', this.version, this.loose, other); + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); - Object.assign(_this.resolutions, projectManifestJson.resolutions); - Object.assign(manifest, projectManifestJson); + return this.compareMain(other) || this.comparePre(other); +}; - const pushDeps = function (depType, _ref, isUsed) { - let hint = _ref.hint, - optional = _ref.optional; +SemVer.prototype.compareMain = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); - if (ignoreUnusedPatterns && !isUsed) { - return; - } - // We only take unused dependencies into consideration to get deterministic hoisting. - // Since flat mode doesn't care about hoisting and everything is top level and specified then we can safely - // leave these out. - if (_this.flags.flat && !isUsed) { - return; - } - const depMap = projectManifestJson[depType]; - for (const name in depMap) { - if (excludeNames.indexOf(name) >= 0) { - continue; - } + return compareIdentifiers(this.major, other.major) || + compareIdentifiers(this.minor, other.minor) || + compareIdentifiers(this.patch, other.patch); +}; - let pattern = name; - if (!_this.lockfile.getLocked(pattern, true)) { - // when we use --save we save the dependency to the lockfile with just the name rather than the - // version combo - pattern += '@' + depMap[name]; - } +SemVer.prototype.comparePre = function(other) { + if (!(other instanceof SemVer)) + other = new SemVer(other, this.loose); - // normalization made sure packages are mentioned only once - if (isUsed) { - usedPatterns.push(pattern); - } else { - ignorePatterns.push(pattern); - } + // NOT having a prerelease is > having one + if (this.prerelease.length && !other.prerelease.length) + return -1; + else if (!this.prerelease.length && other.prerelease.length) + return 1; + else if (!this.prerelease.length && !other.prerelease.length) + return 0; - _this.rootPatternsToOrigin[pattern] = depType; - patterns.push(pattern); - deps.push({ pattern, registry, hint, optional }); - } - }; + var i = 0; + do { + var a = this.prerelease[i]; + var b = other.prerelease[i]; + debug('prerelease compare', i, a, b); + if (a === undefined && b === undefined) + return 0; + else if (b === undefined) + return 1; + else if (a === undefined) + return -1; + else if (a === b) + continue; + else + return compareIdentifiers(a, b); + } while (++i); +}; - pushDeps('dependencies', { hint: null, optional: false }, true); - pushDeps('devDependencies', { hint: 'dev', optional: false }, !_this.config.production); - pushDeps('optionalDependencies', { hint: 'optional', optional: true }, !_this.flags.ignoreOptional); +// preminor will bump the version up to the next minor release, and immediately +// down to pre-release. premajor and prepatch work the same way. +SemVer.prototype.inc = function(release, identifier) { + switch (release) { + case 'premajor': + this.prerelease.length = 0; + this.patch = 0; + this.minor = 0; + this.major++; + this.inc('pre', identifier); + break; + case 'preminor': + this.prerelease.length = 0; + this.patch = 0; + this.minor++; + this.inc('pre', identifier); + break; + case 'prepatch': + // If this is already a prerelease, it will bump to the next version + // drop any prereleases that might already exist, since they are not + // relevant at this point. + this.prerelease.length = 0; + this.inc('patch', identifier); + this.inc('pre', identifier); + break; + // If the input is a non-prerelease version, this acts the same as + // prepatch. + case 'prerelease': + if (this.prerelease.length === 0) + this.inc('patch', identifier); + this.inc('pre', identifier); + break; - break; + case 'major': + // If this is a pre-major version, bump up to the same major version. + // Otherwise increment major. + // 1.0.0-5 bumps to 1.0.0 + // 1.1.0 bumps to 2.0.0 + if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) + this.major++; + this.minor = 0; + this.patch = 0; + this.prerelease = []; + break; + case 'minor': + // If this is a pre-minor version, bump up to the same minor version. + // Otherwise increment minor. + // 1.2.0-5 bumps to 1.2.0 + // 1.2.1 bumps to 1.3.0 + if (this.patch !== 0 || this.prerelease.length === 0) + this.minor++; + this.patch = 0; + this.prerelease = []; + break; + case 'patch': + // If this is not a pre-release version, it will increment the patch. + // If it is a pre-release it will bump up to the same patch version. + // 1.2.0-5 patches to 1.2.0 + // 1.2.0 patches to 1.2.1 + if (this.prerelease.length === 0) + this.patch++; + this.prerelease = []; + break; + // This probably shouldn't be used publicly. + // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. + case 'pre': + if (this.prerelease.length === 0) + this.prerelease = [0]; + else { + var i = this.prerelease.length; + while (--i >= 0) { + if (typeof this.prerelease[i] === 'number') { + this.prerelease[i]++; + i = -2; + } + } + if (i === -1) // didn't increment anything + this.prerelease.push(0); } - - // inherit root flat flag - if (manifest.flat) { - _this.flags.flat = true; + if (identifier) { + // 1.2.0-beta.1 bumps to 1.2.0-beta.2, + // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 + if (this.prerelease[0] === identifier) { + if (isNaN(this.prerelease[1])) + this.prerelease = [identifier, 0]; + } else + this.prerelease = [identifier, 0]; } + break; - return { - requests: deps, - patterns, - manifest, - usedPatterns, - ignorePatterns - }; - })(); + default: + throw new Error('invalid increment argument: ' + release); } + this.format(); + this.raw = this.version; + return this; +}; - /** - * TODO description - */ - - prepareRequests(requests) { - return requests; +exports.inc = inc; +function inc(version, release, loose, identifier) { + if (typeof(loose) === 'string') { + identifier = loose; + loose = undefined; } - preparePatterns(patterns) { - return patterns; + try { + return new SemVer(version, loose).inc(release, identifier).version; + } catch (er) { + return null; } +} - bailout(patterns) { - var _this2 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (_this2.flags.skipIntegrityCheck || _this2.flags.force) { - return false; - } - const lockfileCache = _this2.lockfile.cache; - if (!lockfileCache) { - return false; +exports.diff = diff; +function diff(version1, version2) { + if (eq(version1, version2)) { + return null; + } else { + var v1 = parse(version1); + var v2 = parse(version2); + if (v1.prerelease.length || v2.prerelease.length) { + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return 'pre'+key; + } + } } - const match = yield _this2.integrityChecker.check(patterns, lockfileCache, _this2.flags); - if (_this2.flags.frozenLockfile && match.missingPatterns.length > 0) { - throw new (_errors || _load_errors()).MessageError(_this2.reporter.lang('frozenLockfileError')); + return 'prerelease'; + } + for (var key in v1) { + if (key === 'major' || key === 'minor' || key === 'patch') { + if (v1[key] !== v2[key]) { + return key; + } } + } + } +} - const haveLockfile = yield (_fs || _load_fs()).exists(path.join(_this2.config.cwd, (_constants || _load_constants()).LOCKFILE_FILENAME)); - - if (match.integrityMatches && haveLockfile) { - _this2.reporter.success(_this2.reporter.lang('upToDate')); - return true; - } +exports.compareIdentifiers = compareIdentifiers; - if (!patterns.length && !match.integrityFileMissing) { - _this2.reporter.success(_this2.reporter.lang('nothingToInstall')); - yield _this2.createEmptyManifestFolders(); - yield _this2.saveLockfileAndIntegrity(patterns); - return true; - } +var numeric = /^[0-9]+$/; +function compareIdentifiers(a, b) { + var anum = numeric.test(a); + var bnum = numeric.test(b); - return false; - })(); + if (anum && bnum) { + a = +a; + b = +b; } - /** - * Produce empty folders for all used root manifests. - */ + return (anum && !bnum) ? -1 : + (bnum && !anum) ? 1 : + a < b ? -1 : + a > b ? 1 : + 0; +} - createEmptyManifestFolders() { - var _this3 = this; +exports.rcompareIdentifiers = rcompareIdentifiers; +function rcompareIdentifiers(a, b) { + return compareIdentifiers(b, a); +} - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (_this3.config.modulesFolder) { - // already created - return; - } +exports.major = major; +function major(a, loose) { + return new SemVer(a, loose).major; +} - for (const registryName of _this3.rootManifestRegistries) { - const folder = _this3.config.registries[registryName].folder; +exports.minor = minor; +function minor(a, loose) { + return new SemVer(a, loose).minor; +} - yield (_fs || _load_fs()).mkdirp(path.join(_this3.config.cwd, folder)); - } - })(); - } +exports.patch = patch; +function patch(a, loose) { + return new SemVer(a, loose).patch; +} - /** - * TODO description - */ +exports.compare = compare; +function compare(a, b, loose) { + return new SemVer(a, loose).compare(b); +} - markIgnored(patterns) { - for (const pattern of patterns) { - const manifest = this.resolver.getStrictResolvedPattern(pattern); - const ref = manifest._reference; - invariant(ref, 'expected package reference'); +exports.compareLoose = compareLoose; +function compareLoose(a, b) { + return compare(a, b, true); +} - // just mark the package as ignored. if the package is used by a required package, the hoister - // will take care of that. - ref.ignore = true; - } - } +exports.rcompare = rcompare; +function rcompare(a, b, loose) { + return compare(b, a, loose); +} - /** - * TODO description - */ +exports.sort = sort; +function sort(list, loose) { + return list.sort(function(a, b) { + return exports.compare(a, b, loose); + }); +} - init() { - var _this4 = this; +exports.rsort = rsort; +function rsort(list, loose) { + return list.sort(function(a, b) { + return exports.rcompare(a, b, loose); + }); +} - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this4.checkUpdate(); +exports.gt = gt; +function gt(a, b, loose) { + return compare(a, b, loose) > 0; +} - // warn if we have a shrinkwrap - if (yield (_fs || _load_fs()).exists(path.join(_this4.config.cwd, 'npm-shrinkwrap.json'))) { - _this4.reporter.warn(_this4.reporter.lang('shrinkwrapWarning')); - } +exports.lt = lt; +function lt(a, b, loose) { + return compare(a, b, loose) < 0; +} - let flattenedTopLevelPatterns = []; - const steps = []; +exports.eq = eq; +function eq(a, b, loose) { + return compare(a, b, loose) === 0; +} - var _ref2 = yield _this4.fetchRequestFromCwd(); +exports.neq = neq; +function neq(a, b, loose) { + return compare(a, b, loose) !== 0; +} - const depRequests = _ref2.requests, - rawPatterns = _ref2.patterns, - ignorePatterns = _ref2.ignorePatterns; +exports.gte = gte; +function gte(a, b, loose) { + return compare(a, b, loose) >= 0; +} - let topLevelPatterns = []; +exports.lte = lte; +function lte(a, b, loose) { + return compare(a, b, loose) <= 0; +} - const artifacts = yield _this4.integrityChecker.getArtifacts(); - if (artifacts) { - _this4.linker.setArtifacts(artifacts); - _this4.scripts.setArtifacts(artifacts); - } +exports.cmp = cmp; +function cmp(a, op, b, loose) { + var ret; + switch (op) { + case '===': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a === b; + break; + case '!==': + if (typeof a === 'object') a = a.version; + if (typeof b === 'object') b = b.version; + ret = a !== b; + break; + case '': case '=': case '==': ret = eq(a, b, loose); break; + case '!=': ret = neq(a, b, loose); break; + case '>': ret = gt(a, b, loose); break; + case '>=': ret = gte(a, b, loose); break; + case '<': ret = lt(a, b, loose); break; + case '<=': ret = lte(a, b, loose); break; + default: throw new TypeError('Invalid operator: ' + op); + } + return ret; +} - steps.push((() => { - var _ref3 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - _this4.reporter.step(curr, total, _this4.reporter.lang('resolvingPackages'), emoji.get('mag')); - yield _this4.resolver.init(_this4.prepareRequests(depRequests), _this4.flags.flat); - topLevelPatterns = _this4.preparePatterns(rawPatterns); - flattenedTopLevelPatterns = yield _this4.flatten(topLevelPatterns); - return { bailout: yield _this4.bailout(topLevelPatterns) }; - }); +exports.Comparator = Comparator; +function Comparator(comp, loose) { + if (comp instanceof Comparator) { + if (comp.loose === loose) + return comp; + else + comp = comp.value; + } - return function (_x3, _x4) { - return _ref3.apply(this, arguments); - }; - })()); + if (!(this instanceof Comparator)) + return new Comparator(comp, loose); - steps.push((() => { - var _ref4 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - _this4.markIgnored(ignorePatterns); - _this4.reporter.step(curr, total, _this4.reporter.lang('fetchingPackages'), emoji.get('truck')); - yield _this4.fetcher.init(); - yield _this4.compatibility.init(); - }); + debug('comparator', comp, loose); + this.loose = loose; + this.parse(comp); - return function (_x5, _x6) { - return _ref4.apply(this, arguments); - }; - })()); + if (this.semver === ANY) + this.value = ''; + else + this.value = this.operator + this.semver.version; - steps.push((() => { - var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - // remove integrity hash to make this operation atomic - yield _this4.integrityChecker.removeIntegrityFile(); - _this4.reporter.step(curr, total, _this4.reporter.lang('linkingDependencies'), emoji.get('link')); - yield _this4.linker.init(flattenedTopLevelPatterns, _this4.flags.linkDuplicates); - }); + debug('comp', this); +} - return function (_x7, _x8) { - return _ref5.apply(this, arguments); - }; - })()); +var ANY = {}; +Comparator.prototype.parse = function(comp) { + var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var m = comp.match(r); - steps.push((() => { - var _ref6 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - _this4.reporter.step(curr, total, _this4.flags.force ? _this4.reporter.lang('rebuildingPackages') : _this4.reporter.lang('buildingFreshPackages'), emoji.get('page_with_curl')); + if (!m) + throw new TypeError('Invalid comparator: ' + comp); - if (_this4.flags.ignoreScripts) { - _this4.reporter.warn(_this4.reporter.lang('ignoredScripts')); - } else { - yield _this4.scripts.init(flattenedTopLevelPatterns); - } - }); + this.operator = m[1]; + if (this.operator === '=') + this.operator = ''; - return function (_x9, _x10) { - return _ref6.apply(this, arguments); - }; - })()); + // if it literally is just '>' or '' then allow anything. + if (!m[2]) + this.semver = ANY; + else + this.semver = new SemVer(m[2], this.loose); +}; - if (_this4.flags.har) { - steps.push((() => { - var _ref7 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - const formattedDate = new Date().toISOString().replace(/:/g, '-'); - const filename = `yarn-install_${formattedDate}.har`; - _this4.reporter.step(curr, total, _this4.reporter.lang('savingHar', filename), emoji.get('black_circle_for_record')); - yield _this4.config.requestManager.saveHar(filename); - }); +Comparator.prototype.toString = function() { + return this.value; +}; - return function (_x11, _x12) { - return _ref7.apply(this, arguments); - }; - })()); - } +Comparator.prototype.test = function(version) { + debug('Comparator.test', version, this.loose); - if (yield _this4.shouldClean()) { - steps.push((() => { - var _ref8 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { - _this4.reporter.step(curr, total, _this4.reporter.lang('cleaningModules'), emoji.get('recycle')); - yield (0, (_clean || _load_clean()).clean)(_this4.config, _this4.reporter); - }); + if (this.semver === ANY) + return true; - return function (_x13, _x14) { - return _ref8.apply(this, arguments); - }; - })()); - } + if (typeof version === 'string') + version = new SemVer(version, this.loose); - let currentStep = 0; - for (const step of steps) { - const stepResult = yield step(++currentStep, steps.length); - if (stepResult && stepResult.bailout) { - _this4.maybeOutputUpdate(); - return flattenedTopLevelPatterns; - } - } + return cmp(version, this.operator, this.semver, this.loose); +}; - // fin! - yield _this4.saveLockfileAndIntegrity(topLevelPatterns); - _this4.maybeOutputUpdate(); - _this4.config.requestManager.clearCache(); - return flattenedTopLevelPatterns; - })(); - } - /** - * Check if we should run the cleaning step. - */ +exports.Range = Range; +function Range(range, loose) { + if ((range instanceof Range) && range.loose === loose) + return range; - shouldClean() { - return (_fs || _load_fs()).exists(path.join(this.config.cwd, (_constants || _load_constants()).CLEAN_FILENAME)); + if (!(this instanceof Range)) + return new Range(range, loose); + + this.loose = loose; + + // First, split based on boolean or || + this.raw = range; + this.set = range.split(/\s*\|\|\s*/).map(function(range) { + return this.parseRange(range.trim()); + }, this).filter(function(c) { + // throw out any that are not relevant for whatever reason + return c.length; + }); + + if (!this.set.length) { + throw new TypeError('Invalid SemVer Range: ' + range); } - /** - * TODO - */ + this.format(); +} - flatten(patterns) { - var _this5 = this; +Range.prototype.format = function() { + this.range = this.set.map(function(comps) { + return comps.join(' ').trim(); + }).join('||').trim(); + return this.range; +}; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (!_this5.flags.flat) { - return patterns; - } +Range.prototype.toString = function() { + return this.range; +}; - const flattenedPatterns = []; +Range.prototype.parseRange = function(range) { + var loose = this.loose; + range = range.trim(); + debug('range', range, loose); + // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` + var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; + range = range.replace(hr, hyphenReplace); + debug('hyphen replace', range); + // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` + range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); + debug('comparator trim', range, re[COMPARATORTRIM]); - for (const name of _this5.resolver.getAllDependencyNamesByLevelOrder(patterns)) { - const infos = _this5.resolver.getAllInfoForPackageName(name).filter(function (manifest) { - const ref = manifest._reference; - invariant(ref, 'expected package reference'); - return !ref.ignore; - }); + // `~ 1.2.3` => `~1.2.3` + range = range.replace(re[TILDETRIM], tildeTrimReplace); - if (infos.length === 0) { - continue; - } + // `^ 1.2.3` => `^1.2.3` + range = range.replace(re[CARETTRIM], caretTrimReplace); - if (infos.length === 1) { - // single version of this package - // take out a single pattern as multiple patterns may have resolved to this package - flattenedPatterns.push(_this5.resolver.patternsByPackage[name][0]); - continue; - } + // normalize spaces + range = range.split(/\s+/).join(' '); - const options = infos.map(function (info) { - const ref = info._reference; - invariant(ref, 'expected reference'); - return { - // TODO `and is required by {PARENT}`, - name: _this5.reporter.lang('manualVersionResolutionOption', ref.patterns.join(', '), info.version), + // At this point, the range is completely trimmed and + // ready to be split into comparators. - value: info.version - }; - }); - const versions = infos.map(function (info) { - return info.version; - }); - let version; + var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; + var set = range.split(' ').map(function(comp) { + return parseComparator(comp, loose); + }).join(' ').split(/\s+/); + if (this.loose) { + // in loose mode, throw out any that are not valid comparators + set = set.filter(function(comp) { + return !!comp.match(compRe); + }); + } + set = set.map(function(comp) { + return new Comparator(comp, loose); + }); - const resolutionVersion = _this5.resolutions[name]; - if (resolutionVersion && versions.indexOf(resolutionVersion) >= 0) { - // use json `resolution` version - version = resolutionVersion; - } else { - version = yield _this5.reporter.select(_this5.reporter.lang('manualVersionResolution', name), _this5.reporter.lang('answer'), options); - _this5.resolutions[name] = version; - } + return set; +}; - flattenedPatterns.push(_this5.resolver.collapseAllVersionsOfPackage(name, version)); - } +// Mostly just for testing and legacy API reasons +exports.toComparators = toComparators; +function toComparators(range, loose) { + return new Range(range, loose).set.map(function(comp) { + return comp.map(function(c) { + return c.value; + }).join(' ').trim().split(' '); + }); +} - // save resolutions to their appropriate root manifest - if (Object.keys(_this5.resolutions).length) { - const manifests = yield _this5.config.getRootManifests(); +// comprised of xranges, tildes, stars, and gtlt's at this point. +// already replaced the hyphen ranges +// turn into a set of JUST comparators. +function parseComparator(comp, loose) { + debug('comp', comp); + comp = replaceCarets(comp, loose); + debug('caret', comp); + comp = replaceTildes(comp, loose); + debug('tildes', comp); + comp = replaceXRanges(comp, loose); + debug('xrange', comp); + comp = replaceStars(comp, loose); + debug('stars', comp); + return comp; +} - for (const name in _this5.resolutions) { - const version = _this5.resolutions[name]; +function isX(id) { + return !id || id.toLowerCase() === 'x' || id === '*'; +} - const patterns = _this5.resolver.patternsByPackage[name]; - if (!patterns) { - continue; - } +// ~, ~> --> * (any, kinda silly) +// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 +// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 +// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 +// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 +// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 +function replaceTildes(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceTilde(comp, loose); + }).join(' '); +} - let manifest; - for (const pattern of patterns) { - manifest = _this5.resolver.getResolvedPattern(pattern); - if (manifest) { - break; - } - } - invariant(manifest, 'expected manifest'); +function replaceTilde(comp, loose) { + var r = loose ? re[TILDELOOSE] : re[TILDE]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('tilde', comp, _, M, m, p, pr); + var ret; - const ref = manifest._reference; - invariant(ref, 'expected reference'); + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) + // ~1.2 == >=1.2.0 <1.3.0 + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else if (pr) { + debug('replaceTilde pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + // ~1.2.3 == >=1.2.3 <1.3.0 + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; - const object = manifests[ref.registry].object; - object.resolutions = object.resolutions || {}; - object.resolutions[name] = version; - } + debug('tilde return', ret); + return ret; + }); +} - yield _this5.config.saveRootManifests(manifests); - } +// ^ --> * (any, kinda silly) +// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 +// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 +// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 +// ^1.2.3 --> >=1.2.3 <2.0.0 +// ^1.2.0 --> >=1.2.0 <2.0.0 +function replaceCarets(comp, loose) { + return comp.trim().split(/\s+/).map(function(comp) { + return replaceCaret(comp, loose); + }).join(' '); +} - return flattenedPatterns; - })(); - } +function replaceCaret(comp, loose) { + debug('caret', comp, loose); + var r = loose ? re[CARETLOOSE] : re[CARET]; + return comp.replace(r, function(_, M, m, p, pr) { + debug('caret', comp, _, M, m, p, pr); + var ret; - /** - * Remove offline tarballs that are no longer required - */ + if (isX(M)) + ret = ''; + else if (isX(m)) + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + else if (isX(p)) { + if (M === '0') + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + else + ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; + } else if (pr) { + debug('replaceCaret pr', pr); + if (pr.charAt(0) !== '-') + pr = '-' + pr; + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + pr + + ' <' + (+M + 1) + '.0.0'; + } else { + debug('no pr'); + if (M === '0') { + if (m === '0') + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + m + '.' + (+p + 1); + else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + M + '.' + (+m + 1) + '.0'; + } else + ret = '>=' + M + '.' + m + '.' + p + + ' <' + (+M + 1) + '.0.0'; + } - pruneOfflineMirror(lockfile) { - var _this6 = this; + debug('caret return', ret); + return ret; + }); +} - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const mirror = _this6.config.getOfflineMirrorPath(); - if (!mirror) { - return; - } +function replaceXRanges(comp, loose) { + debug('replaceXRanges', comp, loose); + return comp.split(/\s+/).map(function(comp) { + return replaceXRange(comp, loose); + }).join(' '); +} - const requiredTarballs = new Set(); - for (const dependency in lockfile) { - const resolved = lockfile[dependency].resolved; - const basename = path.basename(resolved.split('#')[0]); - if (resolved) { - if (dependency[0] === '@' && basename[0] !== '@') { - requiredTarballs.add(`${dependency.split('/')[0]}-${basename}`); - } - requiredTarballs.add(basename); - } +function replaceXRange(comp, loose) { + comp = comp.trim(); + var r = loose ? re[XRANGELOOSE] : re[XRANGE]; + return comp.replace(r, function(ret, gtlt, M, m, p, pr) { + debug('xRange', comp, ret, gtlt, M, m, p, pr); + var xM = isX(M); + var xm = xM || isX(m); + var xp = xm || isX(p); + var anyX = xp; + + if (gtlt === '=' && anyX) + gtlt = ''; + + if (xM) { + if (gtlt === '>' || gtlt === '<') { + // nothing is allowed + ret = '<0.0.0'; + } else { + // nothing is forbidden + ret = '*'; } + } else if (gtlt && anyX) { + // replace X with 0 + if (xm) + m = 0; + if (xp) + p = 0; - const mirrorTarballs = yield (_fs || _load_fs()).walk(mirror); - for (const tarball of mirrorTarballs) { - if (!requiredTarballs.has(tarball.basename)) { - yield (_fs || _load_fs()).unlink(tarball.absolute); + if (gtlt === '>') { + // >1 => >=2.0.0 + // >1.2 => >=1.3.0 + // >1.2.3 => >= 1.2.4 + gtlt = '>='; + if (xm) { + M = +M + 1; + m = 0; + p = 0; + } else if (xp) { + m = +m + 1; + p = 0; } + } else if (gtlt === '<=') { + // <=0.7.x is actually <0.8.0, since any 0.7.x should + // pass. Similarly, <=7.x is actually <8.0.0, etc. + gtlt = '<'; + if (xm) + M = +M + 1; + else + m = +m + 1; } - })(); - } - /** - * Save updated integrity and lockfiles. - */ + ret = gtlt + M + '.' + m + '.' + p; + } else if (xm) { + ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; + } else if (xp) { + ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; + } - saveLockfileAndIntegrity(patterns) { - var _this7 = this; + debug('xRange return', ret); - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // --no-lockfile or --pure-lockfile flag - if (_this7.flags.lockfile === false || _this7.flags.pureLockfile) { - return; - } + return ret; + }); +} - const lockfileBasedOnResolver = _this7.lockfile.getLockfile(_this7.resolver.patterns); +// Because * is AND-ed with everything else in the comparator, +// and '' means "any version", just remove the *s entirely. +function replaceStars(comp, loose) { + debug('replaceStars', comp, loose); + // Looseness is ignored here. star is always as loose as it gets! + return comp.trim().replace(re[STAR], ''); +} - if (_this7.config.pruneOfflineMirror) { - yield _this7.pruneOfflineMirror(lockfileBasedOnResolver); - } +// This function is passed to string.replace(re[HYPHENRANGE]) +// M, m, patch, prerelease, build +// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 +// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do +// 1.2 - 3.4 => >=1.2.0 <3.5.0 +function hyphenReplace($0, + from, fM, fm, fp, fpr, fb, + to, tM, tm, tp, tpr, tb) { - // write integrity hash - yield _this7.integrityChecker.save(patterns, lockfileBasedOnResolver, _this7.flags, _this7.resolver.usedRegistries, _this7.scripts.getArtifacts()); + if (isX(fM)) + from = ''; + else if (isX(fm)) + from = '>=' + fM + '.0.0'; + else if (isX(fp)) + from = '>=' + fM + '.' + fm + '.0'; + else + from = '>=' + from; - const lockFileHasAllPatterns = patterns.filter(function (p) { - return !_this7.lockfile.getLocked(p); - }).length === 0; - const resolverPatternsAreSameAsInLockfile = Object.keys(lockfileBasedOnResolver).filter(function (pattern) { - const manifest = _this7.lockfile.getLocked(pattern); - return !manifest || manifest.resolved !== lockfileBasedOnResolver[pattern].resolved; - }).length === 0; + if (isX(tM)) + to = ''; + else if (isX(tm)) + to = '<' + (+tM + 1) + '.0.0'; + else if (isX(tp)) + to = '<' + tM + '.' + (+tm + 1) + '.0'; + else if (tpr) + to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; + else + to = '<=' + to; - // remove command is followed by install with force, lockfile will be rewritten in any case then - if (lockFileHasAllPatterns && resolverPatternsAreSameAsInLockfile && patterns.length && !_this7.flags.force) { - return; - } + return (from + ' ' + to).trim(); +} - // build lockfile location - const loc = path.join(_this7.config.cwd, (_constants || _load_constants()).LOCKFILE_FILENAME); - // write lockfile - const lockSource = (0, (_stringify || _load_stringify()).default)(lockfileBasedOnResolver, false, _this7.config.disableLockfileVersions); - yield (_fs || _load_fs()).writeFilePreservingEol(loc, lockSource); +// if ANY of the sets match ALL of its comparators, then pass +Range.prototype.test = function(version) { + if (!version) + return false; - _this7._logSuccessSaveLockfile(); - })(); + if (typeof version === 'string') + version = new SemVer(version, this.loose); + + for (var i = 0; i < this.set.length; i++) { + if (testSet(this.set[i], version)) + return true; } + return false; +}; - _logSuccessSaveLockfile() { - this.reporter.success(this.reporter.lang('savedLockfile')); +function testSet(set, version) { + for (var i = 0; i < set.length; i++) { + if (!set[i].test(version)) + return false; } - /** - * Load the dependency graph of the current install. Only does package resolving and wont write to the cwd. - */ - hydrate(fetch, ignoreUnusedPatterns) { - var _this8 = this; + if (version.prerelease.length) { + // Find the set of versions that are allowed to have prereleases + // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 + // That should allow `1.2.3-pr.2` to pass. + // However, `1.2.4-alpha.notready` should NOT be allowed, + // even though it's within the range set by the comparators. + for (var i = 0; i < set.length; i++) { + debug(set[i].semver); + if (set[i].semver === ANY) + continue; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const request = yield _this8.fetchRequestFromCwd([], ignoreUnusedPatterns); - const depRequests = request.requests, - rawPatterns = request.patterns, - ignorePatterns = request.ignorePatterns; + if (set[i].semver.prerelease.length > 0) { + var allowed = set[i].semver; + if (allowed.major === version.major && + allowed.minor === version.minor && + allowed.patch === version.patch) + return true; + } + } + // Version has a -pre, but it's not one of the ones we like. + return false; + } - yield _this8.resolver.init(depRequests, _this8.flags.flat); - yield _this8.flatten(rawPatterns); - _this8.markIgnored(ignorePatterns); + return true; +} - if (fetch) { - // fetch packages, should hit cache most of the time - yield _this8.fetcher.init(); - yield _this8.compatibility.init(); +exports.satisfies = satisfies; +function satisfies(version, range, loose) { + try { + range = new Range(range, loose); + } catch (er) { + return false; + } + return range.test(version); +} - // expand minimal manifests - for (const manifest of _this8.resolver.getManifests()) { - const ref = manifest._reference; - invariant(ref, 'expected reference'); +exports.maxSatisfying = maxSatisfying; +function maxSatisfying(versions, range, loose) { + return versions.filter(function(version) { + return satisfies(version, range, loose); + }).sort(function(a, b) { + return rcompare(a, b, loose); + })[0] || null; +} - const loc = _this8.config.generateHardModulePath(ref); - const newPkg = yield _this8.config.readManifest(loc); - yield _this8.resolver.updateManifest(ref, newPkg); - } - } +exports.minSatisfying = minSatisfying; +function minSatisfying(versions, range, loose) { + return versions.filter(function(version) { + return satisfies(version, range, loose); + }).sort(function(a, b) { + return compare(a, b, loose); + })[0] || null; +} - return request; - })(); +exports.validRange = validRange; +function validRange(range, loose) { + try { + // Return '*' instead of '' so that truthiness works. + // This will throw if it's invalid anyway + return new Range(range, loose).range || '*'; + } catch (er) { + return null; } +} - /** - * Check for updates every day and output a nag message if there's a newer version. - */ - - checkUpdate() { - if (!process.stdout.isTTY || isCI) { - // don't show upgrade dialog on CI or non-TTY terminals - return; - } - - // don't check if disabled - if (this.config.getOption('disable-self-update-check')) { - return; - } +// Determine if version is less than all the versions possible in the range +exports.ltr = ltr; +function ltr(version, range, loose) { + return outside(version, range, '<', loose); +} - // only check for updates once a day - const lastUpdateCheck = Number(this.config.getOption('lastUpdateCheck')) || 0; - if (lastUpdateCheck && Date.now() - lastUpdateCheck < ONE_DAY) { - return; - } +// Determine if version is greater than all the versions possible in the range. +exports.gtr = gtr; +function gtr(version, range, loose) { + return outside(version, range, '>', loose); +} - // don't bug for updates on tagged releases - if ((_yarnVersion || _load_yarnVersion()).version.indexOf('-') >= 0) { - return; - } +exports.outside = outside; +function outside(version, range, hilo, loose) { + version = new SemVer(version, loose); + range = new Range(range, loose); - this._checkUpdate().catch(() => { - // swallow errors - }); + var gtfn, ltefn, ltfn, comp, ecomp; + switch (hilo) { + case '>': + gtfn = gt; + ltefn = lte; + ltfn = lt; + comp = '>'; + ecomp = '>='; + break; + case '<': + gtfn = lt; + ltefn = gte; + ltfn = gt; + comp = '<'; + ecomp = '<='; + break; + default: + throw new TypeError('Must provide a hilo val of "<" or ">"'); } - _checkUpdate() { - var _this9 = this; + // If it satisifes the range it is not outside + if (satisfies(version, range, loose)) { + return false; + } - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - let latestVersion = yield _this9.config.requestManager.request({ - url: (_constants || _load_constants()).SELF_UPDATE_VERSION_URL - }); - invariant(typeof latestVersion === 'string', 'expected string'); - latestVersion = latestVersion.trim(); - if (!semver.valid(latestVersion)) { - return; - } + // From now on, variable terms are as if we're in "gtr" mode. + // but note that everything is flipped for the "ltr" function. - // ensure we only check for updates periodically - _this9.config.registries.yarn.saveHomeConfig({ - lastUpdateCheck: Date.now() - }); + for (var i = 0; i < range.set.length; ++i) { + var comparators = range.set[i]; - if (semver.gt(latestVersion, (_yarnVersion || _load_yarnVersion()).version)) { - const installationMethod = yield (0, (_yarnVersion || _load_yarnVersion()).getInstallationMethod)(); - _this9.maybeOutputUpdate = function () { - _this9.reporter.warn(_this9.reporter.lang('yarnOutdated', latestVersion, (_yarnVersion || _load_yarnVersion()).version)); + var high = null; + var low = null; - const command = getUpdateCommand(installationMethod); - if (command) { - _this9.reporter.info(_this9.reporter.lang('yarnOutdatedCommand')); - _this9.reporter.command(command); - } else { - const installer = getUpdateInstaller(installationMethod); - if (installer) { - _this9.reporter.info(_this9.reporter.lang('yarnOutdatedInstaller', installer)); - } - } - }; + comparators.forEach(function(comparator) { + if (comparator.semver === ANY) { + comparator = new Comparator('>=0.0.0') } - })(); - } - - /** - * Method to override with a possible upgrade message. - */ + high = high || comparator; + low = low || comparator; + if (gtfn(comparator.semver, high.semver, loose)) { + high = comparator; + } else if (ltfn(comparator.semver, low.semver, loose)) { + low = comparator; + } + }); - maybeOutputUpdate() {} -} + // If the edge version comparator has a operator then our version + // isn't outside it + if (high.operator === comp || high.operator === ecomp) { + return false; + } -exports.Install = Install; -function hasWrapper() { + // If the lowest version comparator has an operator and our version + // is less than it then it isn't higher than the range + if ((!low.operator || low.operator === comp) && + ltefn(version, low.semver)) { + return false; + } else if (low.operator === ecomp && ltfn(version, low.semver)) { + return false; + } + } return true; } -function setFlags(commander) { - commander.usage('install [flags]'); - commander.option('-g, --global', 'DEPRECATED'); - commander.option('-S, --save', 'DEPRECATED - save package to your `dependencies`'); - commander.option('-D, --save-dev', 'DEPRECATED - save package to your `devDependencies`'); - commander.option('-P, --save-peer', 'DEPRECATED - save package to your `peerDependencies`'); - commander.option('-O, --save-optional', 'DEPRECATED - save package to your `optionalDependencies`'); - commander.option('-E, --save-exact', 'DEPRECATED'); - commander.option('-T, --save-tilde', 'DEPRECATED'); +exports.prerelease = prerelease; +function prerelease(version, loose) { + var parsed = parse(version, loose); + return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; } + /***/ }), /* 27 */ -/***/ (function(module, exports) { +/***/ (function(module, exports, __webpack_require__) { -exports = module.exports = SemVer; +"use strict"; -// The debug function is excluded entirely from the minified version. -/* nomin */ var debug; -/* nomin */ if (typeof process === 'object' && - /* nomin */ process.env && - /* nomin */ process.env.NODE_DEBUG && - /* nomin */ /\bsemver\b/i.test(process.env.NODE_DEBUG)) - /* nomin */ debug = function() { - /* nomin */ var args = Array.prototype.slice.call(arguments, 0); - /* nomin */ args.unshift('SEMVER'); - /* nomin */ console.log.apply(console, args); - /* nomin */ }; -/* nomin */ else - /* nomin */ debug = function() {}; -// Note: this is the semver.org version of the spec that it implements -// Not necessarily the package version of this code. -exports.SEMVER_SPEC_VERSION = '2.0.0'; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.wrapLifecycle = exports.run = exports.Install = undefined; -var MAX_LENGTH = 256; -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; +var _asyncToGenerator2; -// The actual regexps go on exports.re -var re = exports.re = []; -var src = exports.src = []; -var R = 0; +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. +let run = exports.run = (() => { + var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + let lockfile; + if (flags.lockfile === false) { + lockfile = new (_wrapper || _load_wrapper()).default(); + } else { + lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.lockfileFolder, reporter); + } -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. + if (args.length) { + const exampleArgs = args.slice(); + if (flags.saveDev) { + exampleArgs.push('--dev'); + } + if (flags.savePeer) { + exampleArgs.push('--peer'); + } + if (flags.saveOptional) { + exampleArgs.push('--optional'); + } + if (flags.saveExact) { + exampleArgs.push('--exact'); + } + if (flags.saveTilde) { + exampleArgs.push('--tilde'); + } + let command = 'add'; + if (flags.global) { + command = 'global add'; + } + throw new (_errors || _load_errors()).MessageError(reporter.lang('installCommandRenamed', `yarn ${command} ${exampleArgs.join(' ')}`)); + } -var NUMERICIDENTIFIER = R++; -src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; -var NUMERICIDENTIFIERLOOSE = R++; -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; + yield wrapLifecycle(config, flags, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const install = new Install(flags, config, reporter, lockfile); + yield install.init(); + })); + }); + return function run(_x15, _x16, _x17, _x18) { + return _ref9.apply(this, arguments); + }; +})(); -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. +let wrapLifecycle = exports.wrapLifecycle = (() => { + var _ref11 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, flags, factory) { + yield config.executeLifecycleScript('preinstall'); -var NONNUMERICIDENTIFIER = R++; -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; + yield factory(); + // npm behaviour, seems kinda funky but yay compatibility + yield config.executeLifecycleScript('install'); + yield config.executeLifecycleScript('postinstall'); -// ## Main Version -// Three dot-separated numeric identifiers. + if (!config.production) { + yield config.executeLifecycleScript('prepublish'); + yield config.executeLifecycleScript('prepare'); + } + }); -var MAINVERSION = R++; -src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')'; + return function wrapLifecycle(_x19, _x20, _x21) { + return _ref11.apply(this, arguments); + }; +})(); -var MAINVERSIONLOOSE = R++; -src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; +exports.hasWrapper = hasWrapper; +exports.setFlags = setFlags; -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. +var _index; -var PRERELEASEIDENTIFIER = R++; -src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + - '|' + src[NONNUMERICIDENTIFIER] + ')'; +function _load_index() { + return _index = _interopRequireDefault(__webpack_require__(206)); +} -var PRERELEASEIDENTIFIERLOOSE = R++; -src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + - '|' + src[NONNUMERICIDENTIFIER] + ')'; +var _errors; +function _load_errors() { + return _errors = __webpack_require__(3); +} -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. +var _integrityChecker; -var PRERELEASE = R++; -src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + - '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; +function _load_integrityChecker() { + return _integrityChecker = _interopRequireDefault(__webpack_require__(119)); +} -var PRERELEASELOOSE = R++; -src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; +var _wrapper; -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. +function _load_wrapper() { + return _wrapper = _interopRequireDefault(__webpack_require__(15)); +} -var BUILDIDENTIFIER = R++; -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; +var _stringify; -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. +function _load_stringify() { + return _stringify = _interopRequireDefault(__webpack_require__(81)); +} -var BUILD = R++; -src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + - '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; +var _packageFetcher; +function _load_packageFetcher() { + return _packageFetcher = _interopRequireWildcard(__webpack_require__(198)); +} -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. +var _packageInstallScripts; -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. +function _load_packageInstallScripts() { + return _packageInstallScripts = _interopRequireDefault(__webpack_require__(359)); +} -var FULL = R++; -var FULLPLAIN = 'v?' + src[MAINVERSION] + - src[PRERELEASE] + '?' + - src[BUILD] + '?'; +var _packageCompatibility; -src[FULL] = '^' + FULLPLAIN + '$'; +function _load_packageCompatibility() { + return _packageCompatibility = _interopRequireWildcard(__webpack_require__(197)); +} -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + - src[PRERELEASELOOSE] + '?' + - src[BUILD] + '?'; +var _packageResolver; -var LOOSE = R++; -src[LOOSE] = '^' + LOOSEPLAIN + '$'; +function _load_packageResolver() { + return _packageResolver = _interopRequireDefault(__webpack_require__(199)); +} -var GTLT = R++; -src[GTLT] = '((?:<|>)?=?)'; +var _packageLinker; -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -var XRANGEIDENTIFIERLOOSE = R++; -src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; -var XRANGEIDENTIFIER = R++; -src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; +function _load_packageLinker() { + return _packageLinker = _interopRequireDefault(__webpack_require__(120)); +} -var XRANGEPLAIN = R++; -src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:' + src[PRERELEASE] + ')?' + - src[BUILD] + '?' + - ')?)?'; +var _packageRequest; -var XRANGEPLAINLOOSE = R++; -src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[PRERELEASELOOSE] + ')?' + - src[BUILD] + '?' + - ')?)?'; +function _load_packageRequest() { + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); +} -var XRANGE = R++; -src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; -var XRANGELOOSE = R++; -src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; +var _index2; -// Tilde ranges. -// Meaning is "reasonably at or greater than" -var LONETILDE = R++; -src[LONETILDE] = '(?:~>?)'; +function _load_index2() { + return _index2 = __webpack_require__(23); +} -var TILDETRIM = R++; -src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; -re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); -var tildeTrimReplace = '$1~'; +var _clean; -var TILDE = R++; -src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; -var TILDELOOSE = R++; -src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; +function _load_clean() { + return _clean = __webpack_require__(185); +} -// Caret ranges. -// Meaning is "at least and backwards compatible with" -var LONECARET = R++; -src[LONECARET] = '(?:\\^)'; +var _constants; -var CARETTRIM = R++; -src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; -re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); -var caretTrimReplace = '$1^'; +function _load_constants() { + return _constants = _interopRequireWildcard(__webpack_require__(8)); +} -var CARET = R++; -src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; -var CARETLOOSE = R++; -src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; +var _fs; -// A simple gt/lt/eq thing, or just "" to indicate "any version" -var COMPARATORLOOSE = R++; -src[COMPARATORLOOSE] = '^' + src[GTLT] + '\\s*(' + LOOSEPLAIN + ')$|^$'; -var COMPARATOR = R++; -src[COMPARATOR] = '^' + src[GTLT] + '\\s*(' + FULLPLAIN + ')$|^$'; +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); +} +var _map; -// An expression to strip any whitespace between the gtlt and the thing -// it modifies, so that `> 1.2.3` ==> `>1.2.3` -var COMPARATORTRIM = R++; -src[COMPARATORTRIM] = '(\\s*)' + src[GTLT] + - '\\s*(' + LOOSEPLAIN + '|' + src[XRANGEPLAIN] + ')'; +function _load_map() { + return _map = _interopRequireDefault(__webpack_require__(24)); +} -// this one has to use the /g flag -re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); -var comparatorTrimReplace = '$1$2$3'; +var _yarnVersion; +function _load_yarnVersion() { + return _yarnVersion = __webpack_require__(65); +} -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -var HYPHENRANGE = R++; -src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAIN] + ')' + - '\\s*$'; +var _workspaceLayout; -var HYPHENRANGELOOSE = R++; -src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s*$'; +function _load_workspaceLayout() { + return _workspaceLayout = _interopRequireDefault(__webpack_require__(66)); +} -// Star ranges basically just allow anything at all. -var STAR = R++; -src[STAR] = '(<|>)?=?\\s*\\*'; +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; } } -// Compile to actual regexp objects. -// All are flag-free, unless they were created above with a flag. -for (var i = 0; i < R; i++) { - debug(i, src[i]); - if (!re[i]) - re[i] = new RegExp(src[i]); -} +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -exports.parse = parse; -function parse(version, loose) { - if (version instanceof SemVer) - return version; +const emoji = __webpack_require__(244); +const invariant = __webpack_require__(5); +const isCI = __webpack_require__(149); +const path = __webpack_require__(1); +const semver = __webpack_require__(26); +const uuid = __webpack_require__(58); - if (typeof version !== 'string') - return null; +const ONE_DAY = 1000 * 60 * 60 * 24; - if (version.length > MAX_LENGTH) - return null; +/** + * Try and detect the installation method for Yarn and provide a command to update it with. + */ - var r = loose ? re[LOOSE] : re[FULL]; - if (!r.test(version)) - return null; +function getUpdateCommand(installationMethod) { + if (installationMethod === 'tar') { + return `curl -o- -L ${(_constants || _load_constants()).YARN_INSTALLER_SH} | bash`; + } - try { - return new SemVer(version, loose); - } catch (er) { - return null; + if (installationMethod === 'homebrew') { + return 'brew upgrade yarn'; } -} -exports.valid = valid; -function valid(version, loose) { - var v = parse(version, loose); - return v ? v.version : null; + if (installationMethod === 'deb') { + return 'sudo apt-get update && sudo apt-get install yarn'; + } + + if (installationMethod === 'rpm') { + return 'sudo yum install yarn'; + } + + if (installationMethod === 'npm') { + return 'npm upgrade --global yarn'; + } + + if (installationMethod === 'chocolatey') { + return 'choco upgrade yarn'; + } + + if (installationMethod === 'apk') { + return 'apk update && apk add -u yarn'; + } + + return null; } +function getUpdateInstaller(installationMethod) { + // Windows + if (installationMethod === 'msi') { + return (_constants || _load_constants()).YARN_INSTALLER_MSI; + } -exports.clean = clean; -function clean(version, loose) { - var s = parse(version.trim().replace(/^[=v]+/, ''), loose); - return s ? s.version : null; + return null; } -exports.SemVer = SemVer; +function normalizeFlags(config, rawFlags) { + const flags = { + // install + har: !!rawFlags.har, + ignorePlatform: !!rawFlags.ignorePlatform, + ignoreEngines: !!rawFlags.ignoreEngines, + ignoreScripts: !!rawFlags.ignoreScripts, + ignoreOptional: !!rawFlags.ignoreOptional, + force: !!rawFlags.force, + flat: !!rawFlags.flat, + lockfile: rawFlags.lockfile !== false, + pureLockfile: !!rawFlags.pureLockfile, + skipIntegrityCheck: !!rawFlags.skipIntegrityCheck, + frozenLockfile: !!rawFlags.frozenLockfile, + linkDuplicates: !!rawFlags.linkDuplicates, + checkFiles: !!rawFlags.checkFiles, -function SemVer(version, loose) { - if (version instanceof SemVer) { - if (version.loose === loose) - return version; - else - version = version.version; - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version); + // add + peer: !!rawFlags.peer, + dev: !!rawFlags.dev, + optional: !!rawFlags.optional, + exact: !!rawFlags.exact, + tilde: !!rawFlags.tilde + }; + + if (config.getOption('ignore-scripts')) { + flags.ignoreScripts = true; } - if (version.length > MAX_LENGTH) - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') + if (config.getOption('ignore-platform')) { + flags.ignorePlatform = true; + } - if (!(this instanceof SemVer)) - return new SemVer(version, loose); + if (config.getOption('ignore-engines')) { + flags.ignoreEngines = true; + } - debug('SemVer', version, loose); - this.loose = loose; - var m = version.trim().match(loose ? re[LOOSE] : re[FULL]); + if (config.getOption('ignore-optional')) { + flags.ignoreOptional = true; + } - if (!m) - throw new TypeError('Invalid Version: ' + version); + if (config.getOption('force')) { + flags.force = true; + } - this.raw = version; + return flags; +} - // these are actually numbers - this.major = +m[1]; - this.minor = +m[2]; - this.patch = +m[3]; +class Install { + constructor(flags, config, reporter, lockfile) { + this.rootManifestRegistries = []; + this.rootPatternsToOrigin = (0, (_map || _load_map()).default)(); + this.resolutions = (0, (_map || _load_map()).default)(); + this.lockfile = lockfile; + this.reporter = reporter; + this.config = config; + this.flags = normalizeFlags(config, flags); - if (this.major > MAX_SAFE_INTEGER || this.major < 0) - throw new TypeError('Invalid major version') + this.resolver = new (_packageResolver || _load_packageResolver()).default(config, lockfile); + this.integrityChecker = new (_integrityChecker || _load_integrityChecker()).default(config); + this.linker = new (_packageLinker || _load_packageLinker()).default(config, this.resolver); + this.scripts = new (_packageInstallScripts || _load_packageInstallScripts()).default(config, this.resolver, this.flags.force); + } - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) - throw new TypeError('Invalid minor version') + /** + * Create a list of dependency requests from the current directories manifests. + */ - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) - throw new TypeError('Invalid patch version') + fetchRequestFromCwd() { + var _this = this; - // numberify any prerelease numeric ids - if (!m[4]) - this.prerelease = []; - else - this.prerelease = m[4].split('.').map(function(id) { - if (/^[0-9]+$/.test(id)) { - var num = +id; - if (num >= 0 && num < MAX_SAFE_INTEGER) - return num; - } - return id; - }); + let excludePatterns = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + let ignoreUnusedPatterns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const patterns = []; + const deps = []; + const manifest = {}; - this.build = m[5] ? m[5].split('.') : []; - this.format(); -} + const ignorePatterns = []; + const usedPatterns = []; + let workspaceLayout; -SemVer.prototype.format = function() { - this.version = this.major + '.' + this.minor + '.' + this.patch; - if (this.prerelease.length) - this.version += '-' + this.prerelease.join('.'); - return this.version; -}; + // exclude package names that are in install args + const excludeNames = []; + for (const pattern of excludePatterns) { + // can't extract a package name from this + if ((_packageRequest || _load_packageRequest()).default.getExoticResolver(pattern)) { + continue; + } -SemVer.prototype.toString = function() { - return this.version; -}; + // extract the name + const parts = (_packageRequest || _load_packageRequest()).default.normalizePattern(pattern); + excludeNames.push(parts.name); + } -SemVer.prototype.compare = function(other) { - debug('SemVer.compare', this.version, this.loose, other); - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); + for (const registry of Object.keys((_index2 || _load_index2()).registries)) { + const filename = (_index2 || _load_index2()).registries[registry].filename; - return this.compareMain(other) || this.comparePre(other); -}; + const loc = path.join(_this.config.cwd, filename); + if (!(yield (_fs || _load_fs()).exists(loc))) { + continue; + } -SemVer.prototype.compareMain = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); + _this.rootManifestRegistries.push(registry); + const projectManifestJson = yield _this.config.readJson(loc); + yield (0, (_index || _load_index()).default)(projectManifestJson, _this.config.cwd, _this.config, true); - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch); -}; + Object.assign(_this.resolutions, projectManifestJson.resolutions); + Object.assign(manifest, projectManifestJson); -SemVer.prototype.comparePre = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.loose); + const pushDeps = function (depType, manifest, _ref, isUsed) { + let hint = _ref.hint, + optional = _ref.optional; - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) - return -1; - else if (!this.prerelease.length && other.prerelease.length) - return 1; - else if (!this.prerelease.length && !other.prerelease.length) - return 0; + if (ignoreUnusedPatterns && !isUsed) { + return; + } + // We only take unused dependencies into consideration to get deterministic hoisting. + // Since flat mode doesn't care about hoisting and everything is top level and specified then we can safely + // leave these out. + if (_this.flags.flat && !isUsed) { + return; + } + const depMap = manifest[depType]; + for (const name in depMap) { + if (excludeNames.indexOf(name) >= 0) { + continue; + } - var i = 0; - do { - var a = this.prerelease[i]; - var b = other.prerelease[i]; - debug('prerelease compare', i, a, b); - if (a === undefined && b === undefined) - return 0; - else if (b === undefined) - return 1; - else if (a === undefined) - return -1; - else if (a === b) - continue; - else - return compareIdentifiers(a, b); - } while (++i); -}; + let pattern = name; + if (!_this.lockfile.getLocked(pattern, true)) { + // when we use --save we save the dependency to the lockfile with just the name rather than the + // version combo + pattern += '@' + depMap[name]; + } -// preminor will bump the version up to the next minor release, and immediately -// down to pre-release. premajor and prepatch work the same way. -SemVer.prototype.inc = function(release, identifier) { - switch (release) { - case 'premajor': - this.prerelease.length = 0; - this.patch = 0; - this.minor = 0; - this.major++; - this.inc('pre', identifier); - break; - case 'preminor': - this.prerelease.length = 0; - this.patch = 0; - this.minor++; - this.inc('pre', identifier); - break; - case 'prepatch': - // If this is already a prerelease, it will bump to the next version - // drop any prereleases that might already exist, since they are not - // relevant at this point. - this.prerelease.length = 0; - this.inc('patch', identifier); - this.inc('pre', identifier); - break; - // If the input is a non-prerelease version, this acts the same as - // prepatch. - case 'prerelease': - if (this.prerelease.length === 0) - this.inc('patch', identifier); - this.inc('pre', identifier); - break; + // normalization made sure packages are mentioned only once + if (isUsed) { + usedPatterns.push(pattern); + } else { + ignorePatterns.push(pattern); + } - case 'major': - // If this is a pre-major version, bump up to the same major version. - // Otherwise increment major. - // 1.0.0-5 bumps to 1.0.0 - // 1.1.0 bumps to 2.0.0 - if (this.minor !== 0 || this.patch !== 0 || this.prerelease.length === 0) - this.major++; - this.minor = 0; - this.patch = 0; - this.prerelease = []; - break; - case 'minor': - // If this is a pre-minor version, bump up to the same minor version. - // Otherwise increment minor. - // 1.2.0-5 bumps to 1.2.0 - // 1.2.1 bumps to 1.3.0 - if (this.patch !== 0 || this.prerelease.length === 0) - this.minor++; - this.patch = 0; - this.prerelease = []; - break; - case 'patch': - // If this is not a pre-release version, it will increment the patch. - // If it is a pre-release it will bump up to the same patch version. - // 1.2.0-5 patches to 1.2.0 - // 1.2.0 patches to 1.2.1 - if (this.prerelease.length === 0) - this.patch++; - this.prerelease = []; - break; - // This probably shouldn't be used publicly. - // 1.0.0 "pre" would become 1.0.0-0 which is the wrong direction. - case 'pre': - if (this.prerelease.length === 0) - this.prerelease = [0]; - else { - var i = this.prerelease.length; - while (--i >= 0) { - if (typeof this.prerelease[i] === 'number') { - this.prerelease[i]++; - i = -2; + _this.rootPatternsToOrigin[pattern] = depType; + patterns.push(pattern); + deps.push({ pattern, registry, hint, optional }); + } + }; + + pushDeps('dependencies', projectManifestJson, { hint: null, optional: false }, true); + pushDeps('devDependencies', projectManifestJson, { hint: 'dev', optional: false }, !_this.config.production); + pushDeps('optionalDependencies', projectManifestJson, { hint: 'optional', optional: true }, !_this.flags.ignoreOptional); + + if (_this.config.workspacesEnabled) { + const workspaces = yield _this.config.resolveWorkspaces(path.dirname(loc), projectManifestJson); + workspaceLayout = new (_workspaceLayout || _load_workspaceLayout()).default(workspaces, _this.config); + // add virtual manifest that depends on all workspaces, this way package hoisters and resolvers will work fine + const virtualDependencyManifest = { + _uid: '', + name: `workspace-aggregator-${uuid.v4()}`, + version: '1.0.0', + _registry: 'npm', + _loc: '.', + dependencies: {} + }; + workspaceLayout.virtualManifestName = virtualDependencyManifest.name; + virtualDependencyManifest.dependencies = {}; + for (const workspaceName of Object.keys(workspaces)) { + virtualDependencyManifest.dependencies[workspaceName] = workspaces[workspaceName].manifest.version; } + const virtualDep = {}; + virtualDep[virtualDependencyManifest.name] = virtualDependencyManifest.version; + workspaces[virtualDependencyManifest.name] = { loc: '', manifest: virtualDependencyManifest }; + + pushDeps('workspaces', { workspaces: virtualDep }, { hint: 'workspaces', optional: false }, true); } - if (i === -1) // didn't increment anything - this.prerelease.push(0); + + break; } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) - this.prerelease = [identifier, 0]; - } else - this.prerelease = [identifier, 0]; + + // inherit root flat flag + if (manifest.flat) { + _this.flags.flat = true; } - break; - default: - throw new Error('invalid increment argument: ' + release); + return { + requests: deps, + patterns, + manifest, + usedPatterns, + ignorePatterns, + workspaceLayout + }; + })(); } - this.format(); - this.raw = this.version; - return this; -}; -exports.inc = inc; -function inc(version, release, loose, identifier) { - if (typeof(loose) === 'string') { - identifier = loose; - loose = undefined; + /** + * TODO description + */ + + prepareRequests(requests) { + return requests; } - try { - return new SemVer(version, loose).inc(release, identifier).version; - } catch (er) { - return null; + preparePatterns(patterns) { + return patterns; } -} -exports.diff = diff; -function diff(version1, version2) { - if (eq(version1, version2)) { - return null; - } else { - var v1 = parse(version1); - var v2 = parse(version2); - if (v1.prerelease.length || v2.prerelease.length) { - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return 'pre'+key; - } - } + bailout(patterns, workspaceLayout) { + var _this2 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (_this2.flags.skipIntegrityCheck || _this2.flags.force) { + return false; } - return 'prerelease'; - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return key; - } + const lockfileCache = _this2.lockfile.cache; + if (!lockfileCache) { + return false; + } + const match = yield _this2.integrityChecker.check(patterns, lockfileCache, _this2.flags, workspaceLayout); + if (_this2.flags.frozenLockfile && match.missingPatterns.length > 0) { + throw new (_errors || _load_errors()).MessageError(_this2.reporter.lang('frozenLockfileError')); } - } - } -} -exports.compareIdentifiers = compareIdentifiers; + const haveLockfile = yield (_fs || _load_fs()).exists(path.join(_this2.config.cwd, (_constants || _load_constants()).LOCKFILE_FILENAME)); -var numeric = /^[0-9]+$/; -function compareIdentifiers(a, b) { - var anum = numeric.test(a); - var bnum = numeric.test(b); + if (match.integrityMatches && haveLockfile) { + _this2.reporter.success(_this2.reporter.lang('upToDate')); + return true; + } - if (anum && bnum) { - a = +a; - b = +b; + if (!patterns.length && !match.integrityFileMissing) { + _this2.reporter.success(_this2.reporter.lang('nothingToInstall')); + yield _this2.createEmptyManifestFolders(); + yield _this2.saveLockfileAndIntegrity(patterns); + return true; + } + + return false; + })(); } - return (anum && !bnum) ? -1 : - (bnum && !anum) ? 1 : - a < b ? -1 : - a > b ? 1 : - 0; -} + /** + * Produce empty folders for all used root manifests. + */ -exports.rcompareIdentifiers = rcompareIdentifiers; -function rcompareIdentifiers(a, b) { - return compareIdentifiers(b, a); -} + createEmptyManifestFolders() { + var _this3 = this; -exports.major = major; -function major(a, loose) { - return new SemVer(a, loose).major; -} + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (_this3.config.modulesFolder) { + // already created + return; + } -exports.minor = minor; -function minor(a, loose) { - return new SemVer(a, loose).minor; -} + for (const registryName of _this3.rootManifestRegistries) { + const folder = _this3.config.registries[registryName].folder; -exports.patch = patch; -function patch(a, loose) { - return new SemVer(a, loose).patch; -} + yield (_fs || _load_fs()).mkdirp(path.join(_this3.config.cwd, folder)); + } + })(); + } -exports.compare = compare; -function compare(a, b, loose) { - return new SemVer(a, loose).compare(b); -} + /** + * TODO description + */ -exports.compareLoose = compareLoose; -function compareLoose(a, b) { - return compare(a, b, true); -} + markIgnored(patterns) { + for (const pattern of patterns) { + const manifest = this.resolver.getStrictResolvedPattern(pattern); + const ref = manifest._reference; + invariant(ref, 'expected package reference'); -exports.rcompare = rcompare; -function rcompare(a, b, loose) { - return compare(b, a, loose); -} + // just mark the package as ignored. if the package is used by a required package, the hoister + // will take care of that. + ref.ignore = true; + } + } -exports.sort = sort; -function sort(list, loose) { - return list.sort(function(a, b) { - return exports.compare(a, b, loose); - }); -} + /** + * TODO description + */ -exports.rsort = rsort; -function rsort(list, loose) { - return list.sort(function(a, b) { - return exports.rcompare(a, b, loose); - }); -} + init() { + var _this4 = this; -exports.gt = gt; -function gt(a, b, loose) { - return compare(a, b, loose) > 0; -} + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this4.checkUpdate(); -exports.lt = lt; -function lt(a, b, loose) { - return compare(a, b, loose) < 0; -} + // warn if we have a shrinkwrap + if (yield (_fs || _load_fs()).exists(path.join(_this4.config.cwd, 'npm-shrinkwrap.json'))) { + _this4.reporter.warn(_this4.reporter.lang('shrinkwrapWarning')); + } -exports.eq = eq; -function eq(a, b, loose) { - return compare(a, b, loose) === 0; -} + let flattenedTopLevelPatterns = []; + const steps = []; -exports.neq = neq; -function neq(a, b, loose) { - return compare(a, b, loose) !== 0; -} + var _ref2 = yield _this4.fetchRequestFromCwd(); -exports.gte = gte; -function gte(a, b, loose) { - return compare(a, b, loose) >= 0; -} + const depRequests = _ref2.requests, + rawPatterns = _ref2.patterns, + ignorePatterns = _ref2.ignorePatterns, + workspaceLayout = _ref2.workspaceLayout; -exports.lte = lte; -function lte(a, b, loose) { - return compare(a, b, loose) <= 0; -} + let topLevelPatterns = []; -exports.cmp = cmp; -function cmp(a, op, b, loose) { - var ret; - switch (op) { - case '===': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - ret = a === b; - break; - case '!==': - if (typeof a === 'object') a = a.version; - if (typeof b === 'object') b = b.version; - ret = a !== b; - break; - case '': case '=': case '==': ret = eq(a, b, loose); break; - case '!=': ret = neq(a, b, loose); break; - case '>': ret = gt(a, b, loose); break; - case '>=': ret = gte(a, b, loose); break; - case '<': ret = lt(a, b, loose); break; - case '<=': ret = lte(a, b, loose); break; - default: throw new TypeError('Invalid operator: ' + op); - } - return ret; -} + const artifacts = yield _this4.integrityChecker.getArtifacts(); + if (artifacts) { + _this4.linker.setArtifacts(artifacts); + _this4.scripts.setArtifacts(artifacts); + } -exports.Comparator = Comparator; -function Comparator(comp, loose) { - if (comp instanceof Comparator) { - if (comp.loose === loose) - return comp; - else - comp = comp.value; - } + steps.push((() => { + var _ref3 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + _this4.reporter.step(curr, total, _this4.reporter.lang('resolvingPackages'), emoji.get('mag')); + yield _this4.resolver.init(_this4.prepareRequests(depRequests), _this4.flags.flat, workspaceLayout); + topLevelPatterns = _this4.preparePatterns(rawPatterns); + flattenedTopLevelPatterns = yield _this4.flatten(topLevelPatterns); + return { bailout: yield _this4.bailout(topLevelPatterns, workspaceLayout) }; + }); - if (!(this instanceof Comparator)) - return new Comparator(comp, loose); + return function (_x3, _x4) { + return _ref3.apply(this, arguments); + }; + })()); - debug('comparator', comp, loose); - this.loose = loose; - this.parse(comp); + steps.push((() => { + var _ref4 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + _this4.markIgnored(ignorePatterns); + _this4.reporter.step(curr, total, _this4.reporter.lang('fetchingPackages'), emoji.get('truck')); + const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this4.resolver.getManifests(), _this4.config); + _this4.resolver.updateManifests(manifests); + yield (_packageCompatibility || _load_packageCompatibility()).check(_this4.resolver.getManifests(), _this4.config, _this4.flags.ignoreEngines); + }); - if (this.semver === ANY) - this.value = ''; - else - this.value = this.operator + this.semver.version; + return function (_x5, _x6) { + return _ref4.apply(this, arguments); + }; + })()); - debug('comp', this); -} + steps.push((() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + // remove integrity hash to make this operation atomic + yield _this4.integrityChecker.removeIntegrityFile(); + _this4.reporter.step(curr, total, _this4.reporter.lang('linkingDependencies'), emoji.get('link')); + yield _this4.linker.init(flattenedTopLevelPatterns, _this4.flags.linkDuplicates, workspaceLayout); + }); -var ANY = {}; -Comparator.prototype.parse = function(comp) { - var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; - var m = comp.match(r); + return function (_x7, _x8) { + return _ref5.apply(this, arguments); + }; + })()); - if (!m) - throw new TypeError('Invalid comparator: ' + comp); + steps.push((() => { + var _ref6 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + _this4.reporter.step(curr, total, _this4.flags.force ? _this4.reporter.lang('rebuildingPackages') : _this4.reporter.lang('buildingFreshPackages'), emoji.get('page_with_curl')); - this.operator = m[1]; - if (this.operator === '=') - this.operator = ''; + if (_this4.flags.ignoreScripts) { + _this4.reporter.warn(_this4.reporter.lang('ignoredScripts')); + } else { + yield _this4.scripts.init(flattenedTopLevelPatterns); + } + }); - // if it literally is just '>' or '' then allow anything. - if (!m[2]) - this.semver = ANY; - else - this.semver = new SemVer(m[2], this.loose); -}; + return function (_x9, _x10) { + return _ref6.apply(this, arguments); + }; + })()); -Comparator.prototype.toString = function() { - return this.value; -}; + if (_this4.flags.har) { + steps.push((() => { + var _ref7 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + const formattedDate = new Date().toISOString().replace(/:/g, '-'); + const filename = `yarn-install_${formattedDate}.har`; + _this4.reporter.step(curr, total, _this4.reporter.lang('savingHar', filename), emoji.get('black_circle_for_record')); + yield _this4.config.requestManager.saveHar(filename); + }); -Comparator.prototype.test = function(version) { - debug('Comparator.test', version, this.loose); + return function (_x11, _x12) { + return _ref7.apply(this, arguments); + }; + })()); + } - if (this.semver === ANY) - return true; + if (yield _this4.shouldClean()) { + steps.push((() => { + var _ref8 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (curr, total) { + _this4.reporter.step(curr, total, _this4.reporter.lang('cleaningModules'), emoji.get('recycle')); + yield (0, (_clean || _load_clean()).clean)(_this4.config, _this4.reporter); + }); - if (typeof version === 'string') - version = new SemVer(version, this.loose); + return function (_x13, _x14) { + return _ref8.apply(this, arguments); + }; + })()); + } - return cmp(version, this.operator, this.semver, this.loose); -}; + let currentStep = 0; + for (const step of steps) { + const stepResult = yield step(++currentStep, steps.length); + if (stepResult && stepResult.bailout) { + _this4.maybeOutputUpdate(); + return flattenedTopLevelPatterns; + } + } + // fin! + yield _this4.saveLockfileAndIntegrity(topLevelPatterns, workspaceLayout); + _this4.maybeOutputUpdate(); + _this4.config.requestManager.clearCache(); + return flattenedTopLevelPatterns; + })(); + } -exports.Range = Range; -function Range(range, loose) { - if ((range instanceof Range) && range.loose === loose) - return range; + /** + * Check if we should run the cleaning step. + */ - if (!(this instanceof Range)) - return new Range(range, loose); + shouldClean() { + return (_fs || _load_fs()).exists(path.join(this.config.cwd, (_constants || _load_constants()).CLEAN_FILENAME)); + } - this.loose = loose; + /** + * TODO + */ - // First, split based on boolean or || - this.raw = range; - this.set = range.split(/\s*\|\|\s*/).map(function(range) { - return this.parseRange(range.trim()); - }, this).filter(function(c) { - // throw out any that are not relevant for whatever reason - return c.length; - }); + flatten(patterns) { + var _this5 = this; - if (!this.set.length) { - throw new TypeError('Invalid SemVer Range: ' + range); - } + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (!_this5.flags.flat) { + return patterns; + } - this.format(); -} + const flattenedPatterns = []; -Range.prototype.format = function() { - this.range = this.set.map(function(comps) { - return comps.join(' ').trim(); - }).join('||').trim(); - return this.range; -}; + for (const name of _this5.resolver.getAllDependencyNamesByLevelOrder(patterns)) { + const infos = _this5.resolver.getAllInfoForPackageName(name).filter(function (manifest) { + const ref = manifest._reference; + invariant(ref, 'expected package reference'); + return !ref.ignore; + }); -Range.prototype.toString = function() { - return this.range; -}; + if (infos.length === 0) { + continue; + } -Range.prototype.parseRange = function(range) { - var loose = this.loose; - range = range.trim(); - debug('range', range, loose); - // `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4` - var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE]; - range = range.replace(hr, hyphenReplace); - debug('hyphen replace', range); - // `> 1.2.3 < 1.2.5` => `>1.2.3 <1.2.5` - range = range.replace(re[COMPARATORTRIM], comparatorTrimReplace); - debug('comparator trim', range, re[COMPARATORTRIM]); + if (infos.length === 1) { + // single version of this package + // take out a single pattern as multiple patterns may have resolved to this package + flattenedPatterns.push(_this5.resolver.patternsByPackage[name][0]); + continue; + } - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace); + const options = infos.map(function (info) { + const ref = info._reference; + invariant(ref, 'expected reference'); + return { + // TODO `and is required by {PARENT}`, + name: _this5.reporter.lang('manualVersionResolutionOption', ref.patterns.join(', '), info.version), - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace); + value: info.version + }; + }); + const versions = infos.map(function (info) { + return info.version; + }); + let version; - // normalize spaces - range = range.split(/\s+/).join(' '); + const resolutionVersion = _this5.resolutions[name]; + if (resolutionVersion && versions.indexOf(resolutionVersion) >= 0) { + // use json `resolution` version + version = resolutionVersion; + } else { + version = yield _this5.reporter.select(_this5.reporter.lang('manualVersionResolution', name), _this5.reporter.lang('answer'), options); + _this5.resolutions[name] = version; + } - // At this point, the range is completely trimmed and - // ready to be split into comparators. + flattenedPatterns.push(_this5.resolver.collapseAllVersionsOfPackage(name, version)); + } - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; - var set = range.split(' ').map(function(comp) { - return parseComparator(comp, loose); - }).join(' ').split(/\s+/); - if (this.loose) { - // in loose mode, throw out any that are not valid comparators - set = set.filter(function(comp) { - return !!comp.match(compRe); - }); - } - set = set.map(function(comp) { - return new Comparator(comp, loose); - }); + // save resolutions to their appropriate root manifest + if (Object.keys(_this5.resolutions).length) { + const manifests = yield _this5.config.getRootManifests(); - return set; -}; + for (const name in _this5.resolutions) { + const version = _this5.resolutions[name]; -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators; -function toComparators(range, loose) { - return new Range(range, loose).set.map(function(comp) { - return comp.map(function(c) { - return c.value; - }).join(' ').trim().split(' '); - }); -} + const patterns = _this5.resolver.patternsByPackage[name]; + if (!patterns) { + continue; + } -// comprised of xranges, tildes, stars, and gtlt's at this point. -// already replaced the hyphen ranges -// turn into a set of JUST comparators. -function parseComparator(comp, loose) { - debug('comp', comp); - comp = replaceCarets(comp, loose); - debug('caret', comp); - comp = replaceTildes(comp, loose); - debug('tildes', comp); - comp = replaceXRanges(comp, loose); - debug('xrange', comp); - comp = replaceStars(comp, loose); - debug('stars', comp); - return comp; -} + let manifest; + for (const pattern of patterns) { + manifest = _this5.resolver.getResolvedPattern(pattern); + if (manifest) { + break; + } + } + invariant(manifest, 'expected manifest'); -function isX(id) { - return !id || id.toLowerCase() === 'x' || id === '*'; -} + const ref = manifest._reference; + invariant(ref, 'expected reference'); -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~2.0, ~2.0.x, ~>2.0, ~>2.0.x --> >=2.0.0 <2.1.0 -// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0 -// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0 -// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0 -function replaceTildes(comp, loose) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceTilde(comp, loose); - }).join(' '); -} + const object = manifests[ref.registry].object; + object.resolutions = object.resolutions || {}; + object.resolutions[name] = version; + } -function replaceTilde(comp, loose) { - var r = loose ? re[TILDELOOSE] : re[TILDE]; - return comp.replace(r, function(_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr); - var ret; + yield _this5.config.saveRootManifests(manifests); + } - if (isX(M)) - ret = ''; - else if (isX(m)) - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - else if (isX(p)) - // ~1.2 == >=1.2.0 <1.3.0 - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - else if (pr) { - debug('replaceTilde pr', pr); - if (pr.charAt(0) !== '-') - pr = '-' + pr; - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - // ~1.2.3 == >=1.2.3 <1.3.0 - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0'; + return flattenedPatterns; + })(); + } - debug('tilde return', ret); - return ret; - }); -} + /** + * Remove offline tarballs that are no longer required + */ -// ^ --> * (any, kinda silly) -// ^2, ^2.x, ^2.x.x --> >=2.0.0 <3.0.0 -// ^2.0, ^2.0.x --> >=2.0.0 <3.0.0 -// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0 -// ^1.2.3 --> >=1.2.3 <2.0.0 -// ^1.2.0 --> >=1.2.0 <2.0.0 -function replaceCarets(comp, loose) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceCaret(comp, loose); - }).join(' '); -} + pruneOfflineMirror(lockfile) { + var _this6 = this; -function replaceCaret(comp, loose) { - debug('caret', comp, loose); - var r = loose ? re[CARETLOOSE] : re[CARET]; - return comp.replace(r, function(_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr); - var ret; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const mirror = _this6.config.getOfflineMirrorPath(); + if (!mirror) { + return; + } - if (isX(M)) - ret = ''; - else if (isX(m)) - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - else if (isX(p)) { - if (M === '0') - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - else - ret = '>=' + M + '.' + m + '.0 <' + (+M + 1) + '.0.0'; - } else if (pr) { - debug('replaceCaret pr', pr); - if (pr.charAt(0) !== '-') - pr = '-' + pr; - if (M === '0') { - if (m === '0') - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + m + '.' + (+p + 1); - else - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - ret = '>=' + M + '.' + m + '.' + p + pr + - ' <' + (+M + 1) + '.0.0'; - } else { - debug('no pr'); - if (M === '0') { - if (m === '0') - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + m + '.' + (+p + 1); - else - ret = '>=' + M + '.' + m + '.' + p + - ' <' + M + '.' + (+m + 1) + '.0'; - } else - ret = '>=' + M + '.' + m + '.' + p + - ' <' + (+M + 1) + '.0.0'; - } - - debug('caret return', ret); - return ret; - }); -} - -function replaceXRanges(comp, loose) { - debug('replaceXRanges', comp, loose); - return comp.split(/\s+/).map(function(comp) { - return replaceXRange(comp, loose); - }).join(' '); -} - -function replaceXRange(comp, loose) { - comp = comp.trim(); - var r = loose ? re[XRANGELOOSE] : re[XRANGE]; - return comp.replace(r, function(ret, gtlt, M, m, p, pr) { - debug('xRange', comp, ret, gtlt, M, m, p, pr); - var xM = isX(M); - var xm = xM || isX(m); - var xp = xm || isX(p); - var anyX = xp; - - if (gtlt === '=' && anyX) - gtlt = ''; - - if (xM) { - if (gtlt === '>' || gtlt === '<') { - // nothing is allowed - ret = '<0.0.0'; - } else { - // nothing is forbidden - ret = '*'; + const requiredTarballs = new Set(); + for (const dependency in lockfile) { + const resolved = lockfile[dependency].resolved; + const basename = path.basename(resolved.split('#')[0]); + if (resolved) { + if (dependency[0] === '@' && basename[0] !== '@') { + requiredTarballs.add(`${dependency.split('/')[0]}-${basename}`); + } + requiredTarballs.add(basename); + } } - } else if (gtlt && anyX) { - // replace X with 0 - if (xm) - m = 0; - if (xp) - p = 0; - if (gtlt === '>') { - // >1 => >=2.0.0 - // >1.2 => >=1.3.0 - // >1.2.3 => >= 1.2.4 - gtlt = '>='; - if (xm) { - M = +M + 1; - m = 0; - p = 0; - } else if (xp) { - m = +m + 1; - p = 0; + const mirrorFiles = yield (_fs || _load_fs()).walk(mirror); + for (const file of mirrorFiles) { + const isTarball = path.extname(file.basename) === '.tgz'; + if (isTarball && !requiredTarballs.has(file.basename)) { + yield (_fs || _load_fs()).unlink(file.absolute); } - } else if (gtlt === '<=') { - // <=0.7.x is actually <0.8.0, since any 0.7.x should - // pass. Similarly, <=7.x is actually <8.0.0, etc. - gtlt = '<'; - if (xm) - M = +M + 1; - else - m = +m + 1; } + })(); + } - ret = gtlt + M + '.' + m + '.' + p; - } else if (xm) { - ret = '>=' + M + '.0.0 <' + (+M + 1) + '.0.0'; - } else if (xp) { - ret = '>=' + M + '.' + m + '.0 <' + M + '.' + (+m + 1) + '.0'; - } + /** + * Save updated integrity and lockfiles. + */ - debug('xRange return', ret); + saveLockfileAndIntegrity(patterns, workspaceLayout) { + var _this7 = this; - return ret; - }); -} + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // --no-lockfile or --pure-lockfile flag + if (_this7.flags.lockfile === false || _this7.flags.pureLockfile) { + return; + } -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars(comp, loose) { - debug('replaceStars', comp, loose); - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], ''); -} + const resolvedPatterns = {}; + Object.keys(_this7.resolver.patterns).forEach(function (pattern) { + if (!workspaceLayout || !workspaceLayout.getManifestByPattern(pattern)) { + resolvedPatterns[pattern] = _this7.resolver.patterns[pattern]; + } + }); -// This function is passed to string.replace(re[HYPHENRANGE]) -// M, m, patch, prerelease, build -// 1.2 - 3.4.5 => >=1.2.0 <=3.4.5 -// 1.2.3 - 3.4 => >=1.2.0 <3.5.0 Any 3.4.x will do -// 1.2 - 3.4 => >=1.2.0 <3.5.0 -function hyphenReplace($0, - from, fM, fm, fp, fpr, fb, - to, tM, tm, tp, tpr, tb) { + // TODO this code is duplicated in a few places, need a common way to filter out workspace patterns from lockfile + patterns = patterns.filter(function (p) { + return !workspaceLayout || !workspaceLayout.getManifestByPattern(p); + }); - if (isX(fM)) - from = ''; - else if (isX(fm)) - from = '>=' + fM + '.0.0'; - else if (isX(fp)) - from = '>=' + fM + '.' + fm + '.0'; - else - from = '>=' + from; + const lockfileBasedOnResolver = _this7.lockfile.getLockfile(resolvedPatterns); - if (isX(tM)) - to = ''; - else if (isX(tm)) - to = '<' + (+tM + 1) + '.0.0'; - else if (isX(tp)) - to = '<' + tM + '.' + (+tm + 1) + '.0'; - else if (tpr) - to = '<=' + tM + '.' + tm + '.' + tp + '-' + tpr; - else - to = '<=' + to; + if (_this7.config.pruneOfflineMirror) { + yield _this7.pruneOfflineMirror(lockfileBasedOnResolver); + } - return (from + ' ' + to).trim(); -} + // write integrity hash + yield _this7.integrityChecker.save(patterns, lockfileBasedOnResolver, _this7.flags, _this7.resolver.usedRegistries, _this7.scripts.getArtifacts()); + const lockFileHasAllPatterns = patterns.every(function (p) { + return _this7.lockfile.getLocked(p); + }); + const resolverPatternsAreSameAsInLockfile = Object.keys(lockfileBasedOnResolver).every(function (pattern) { + const manifest = _this7.lockfile.getLocked(pattern); + return manifest && manifest.resolved === lockfileBasedOnResolver[pattern].resolved; + }); + // remove command is followed by install with force, lockfile will be rewritten in any case then + if (lockFileHasAllPatterns && resolverPatternsAreSameAsInLockfile && patterns.length && !_this7.flags.force) { + return; + } -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function(version) { - if (!version) - return false; + // build lockfile location + const loc = path.join(_this7.config.lockfileFolder, (_constants || _load_constants()).LOCKFILE_FILENAME); - if (typeof version === 'string') - version = new SemVer(version, this.loose); + // write lockfile + const lockSource = (0, (_stringify || _load_stringify()).default)(lockfileBasedOnResolver, false, _this7.config.enableLockfileVersions); + yield (_fs || _load_fs()).writeFilePreservingEol(loc, lockSource); - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version)) - return true; + _this7._logSuccessSaveLockfile(); + })(); } - return false; -}; -function testSet(set, version) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) - return false; + _logSuccessSaveLockfile() { + this.reporter.success(this.reporter.lang('savedLockfile')); } - if (version.prerelease.length) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (var i = 0; i < set.length; i++) { - debug(set[i].semver); - if (set[i].semver === ANY) - continue; + /** + * Load the dependency graph of the current install. Only does package resolving and wont write to the cwd. + */ + hydrate(ignoreUnusedPatterns) { + var _this8 = this; - if (set[i].semver.prerelease.length > 0) { - var allowed = set[i].semver; - if (allowed.major === version.major && - allowed.minor === version.minor && - allowed.patch === version.patch) - return true; - } - } + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const request = yield _this8.fetchRequestFromCwd([], ignoreUnusedPatterns); + const depRequests = request.requests, + rawPatterns = request.patterns, + ignorePatterns = request.ignorePatterns, + workspaceLayout = request.workspaceLayout; - // Version has a -pre, but it's not one of the ones we like. - return false; - } - return true; -} + yield _this8.resolver.init(depRequests, _this8.flags.flat, workspaceLayout); + yield _this8.flatten(rawPatterns); + _this8.markIgnored(ignorePatterns); -exports.satisfies = satisfies; -function satisfies(version, range, loose) { - try { - range = new Range(range, loose); - } catch (er) { - return false; - } - return range.test(version); -} + // fetch packages, should hit cache most of the time + const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this8.resolver.getManifests(), _this8.config); + _this8.resolver.updateManifests(manifests); + yield (_packageCompatibility || _load_packageCompatibility()).check(_this8.resolver.getManifests(), _this8.config, _this8.flags.ignoreEngines); -exports.maxSatisfying = maxSatisfying; -function maxSatisfying(versions, range, loose) { - return versions.filter(function(version) { - return satisfies(version, range, loose); - }).sort(function(a, b) { - return rcompare(a, b, loose); - })[0] || null; -} + // expand minimal manifests + for (const manifest of _this8.resolver.getManifests()) { + const ref = manifest._reference; + invariant(ref, 'expected reference'); + const type = ref.remote.type; + // link specifier won't ever hit cache -exports.minSatisfying = minSatisfying; -function minSatisfying(versions, range, loose) { - return versions.filter(function(version) { - return satisfies(version, range, loose); - }).sort(function(a, b) { - return compare(a, b, loose); - })[0] || null; -} + let loc = ''; + if (type === 'link') { + continue; + } else if (type === 'workspace') { + if (!ref.remote.reference) { + continue; + } + loc = ref.remote.reference; + } else { + loc = _this8.config.generateHardModulePath(ref); + } + const newPkg = yield _this8.config.readManifest(loc); + yield _this8.resolver.updateManifest(ref, newPkg); + } -exports.validRange = validRange; -function validRange(range, loose) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, loose).range || '*'; - } catch (er) { - return null; + return request; + })(); } -} -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr; -function ltr(version, range, loose) { - return outside(version, range, '<', loose); -} + /** + * Check for updates every day and output a nag message if there's a newer version. + */ -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr; -function gtr(version, range, loose) { - return outside(version, range, '>', loose); -} + checkUpdate() { + if (!process.stdout.isTTY || isCI) { + // don't show upgrade dialog on CI or non-TTY terminals + return; + } -exports.outside = outside; -function outside(version, range, hilo, loose) { - version = new SemVer(version, loose); - range = new Range(range, loose); + // don't check if disabled + if (this.config.getOption('disable-self-update-check')) { + return; + } - var gtfn, ltefn, ltfn, comp, ecomp; - switch (hilo) { - case '>': - gtfn = gt; - ltefn = lte; - ltfn = lt; - comp = '>'; - ecomp = '>='; - break; - case '<': - gtfn = lt; - ltefn = gte; - ltfn = gt; - comp = '<'; - ecomp = '<='; - break; - default: - throw new TypeError('Must provide a hilo val of "<" or ">"'); - } + // only check for updates once a day + const lastUpdateCheck = Number(this.config.getOption('lastUpdateCheck')) || 0; + if (lastUpdateCheck && Date.now() - lastUpdateCheck < ONE_DAY) { + return; + } - // If it satisifes the range it is not outside - if (satisfies(version, range, loose)) { - return false; + // don't bug for updates on tagged releases + if ((_yarnVersion || _load_yarnVersion()).version.indexOf('-') >= 0) { + return; + } + + this._checkUpdate().catch(() => { + // swallow errors + }); } - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. + _checkUpdate() { + var _this9 = this; - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i]; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + let latestVersion = yield _this9.config.requestManager.request({ + url: (_constants || _load_constants()).SELF_UPDATE_VERSION_URL + }); + invariant(typeof latestVersion === 'string', 'expected string'); + latestVersion = latestVersion.trim(); + if (!semver.valid(latestVersion)) { + return; + } - var high = null; - var low = null; + // ensure we only check for updates periodically + _this9.config.registries.yarn.saveHomeConfig({ + lastUpdateCheck: Date.now() + }); - comparators.forEach(function(comparator) { - if (comparator.semver === ANY) { - comparator = new Comparator('>=0.0.0') - } - high = high || comparator; - low = low || comparator; - if (gtfn(comparator.semver, high.semver, loose)) { - high = comparator; - } else if (ltfn(comparator.semver, low.semver, loose)) { - low = comparator; + if (semver.gt(latestVersion, (_yarnVersion || _load_yarnVersion()).version)) { + const installationMethod = yield (0, (_yarnVersion || _load_yarnVersion()).getInstallationMethod)(); + _this9.maybeOutputUpdate = function () { + _this9.reporter.warn(_this9.reporter.lang('yarnOutdated', latestVersion, (_yarnVersion || _load_yarnVersion()).version)); + + const command = getUpdateCommand(installationMethod); + if (command) { + _this9.reporter.info(_this9.reporter.lang('yarnOutdatedCommand')); + _this9.reporter.command(command); + } else { + const installer = getUpdateInstaller(installationMethod); + if (installer) { + _this9.reporter.info(_this9.reporter.lang('yarnOutdatedInstaller', installer)); + } + } + }; } - }); + })(); + } - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false; - } + /** + * Method to override with a possible upgrade message. + */ - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false; - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false; - } - } - return true; + maybeOutputUpdate() {} } -exports.prerelease = prerelease; -function prerelease(version, loose) { - var parsed = parse(version, loose); - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; +exports.Install = Install; +function hasWrapper() { + return true; } +function setFlags(commander) { + commander.usage('install [flags]'); + commander.option('-g, --global', 'DEPRECATED'); + commander.option('-S, --save', 'DEPRECATED - save package to your `dependencies`'); + commander.option('-D, --save-dev', 'DEPRECATED - save package to your `devDependencies`'); + commander.option('-P, --save-peer', 'DEPRECATED - save package to your `peerDependencies`'); + commander.option('-O, --save-optional', 'DEPRECATED - save package to your `optionalDependencies`'); + commander.option('-E, --save-exact', 'DEPRECATED'); + commander.option('-T, --save-tilde', 'DEPRECATED'); +} /***/ }), /* 28 */ -/***/ (function(module, exports) { +/***/ (function(module, exports, __webpack_require__) { -// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 -var global = module.exports = typeof window != 'undefined' && window.Math == Math - ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); -if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef +"use strict"; -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { -/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. +Object.defineProperty(exports, "__esModule", { + value: true +}); -;(function (undefined) { +var _asyncToGenerator2; - var objectTypes = { - 'function': true, - 'object': true - }; +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} - function checkGlobal(value) { - return (value && value.Object === Object) ? value : null; - } +var _slicedToArray2; - var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; - var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; - var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === 'object' && global); - var freeSelf = checkGlobal(objectTypes[typeof self] && self); - var freeWindow = checkGlobal(objectTypes[typeof window] && window); - var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; - var thisGlobal = checkGlobal(objectTypes[typeof this] && this); - var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); +function _load_slicedToArray() { + return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); +} - var Rx = { - internals: {}, - config: { - Promise: root.Promise - }, - helpers: { } - }; +var _validate; - // Defaults - var noop = Rx.helpers.noop = function () { }, - identity = Rx.helpers.identity = function (x) { return x; }, - defaultNow = Rx.helpers.defaultNow = Date.now, - defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); }, - defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); }, - defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); }, - defaultError = Rx.helpers.defaultError = function (err) { throw err; }, - isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; }, - isFunction = Rx.helpers.isFunction = (function () { +function _load_validate() { + return _validate = __webpack_require__(63); +} - var isFn = function (value) { - return typeof value == 'function' || false; - }; +var _wrapper; - // fallback for older versions of Chrome and Safari - if (isFn(/x/)) { - isFn = function(value) { - return typeof value == 'function' && toString.call(value) == '[object Function]'; - }; - } +function _load_wrapper() { + return _wrapper = _interopRequireDefault(__webpack_require__(15)); +} - return isFn; - }()); +var _packageReference; - function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;} +function _load_packageReference() { + return _packageReference = _interopRequireDefault(__webpack_require__(360)); +} - var errorObj = {e: {}}; - - function tryCatcherGen(tryCatchTarget) { - return function tryCatcher() { - try { - return tryCatchTarget.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } - }; - } +var _index; - var tryCatch = Rx.internals.tryCatch = function tryCatch(fn) { - if (!isFunction(fn)) { throw new TypeError('fn must be a function'); } - return tryCatcherGen(fn); - }; +function _load_index() { + return _index = _interopRequireWildcard(__webpack_require__(53)); +} - function thrower(e) { - throw e; - } +var _index2; - Rx.config.longStackSupport = false; - var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })(); - hasStacks = !!stacks.e && !!stacks.e.stack; +function _load_index2() { + return _index2 = __webpack_require__(53); +} - // All code after this point will be filtered from stack traces reported by RxJS - var rStartingLine = captureLine(), rFileName; +var _errors; - var STACK_JUMP_SEPARATOR = 'From previous event:'; +function _load_errors() { + return _errors = __webpack_require__(3); +} - function makeStackTraceLong(error, observable) { - // If possible, transform the error stack trace by removing Node and RxJS - // cruft, then concatenating with the stack trace of `observable`. - if (hasStacks && - observable.stack && - typeof error === 'object' && - error !== null && - error.stack && - error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1 - ) { - var stacks = []; - for (var o = observable; !!o; o = o.source) { - if (o.stack) { - stacks.unshift(o.stack); - } - } - stacks.unshift(error.stack); +var _misc; - var concatedStacks = stacks.join('\n' + STACK_JUMP_SEPARATOR + '\n'); - error.stack = filterStackString(concatedStacks); - } +function _load_misc() { + return _misc = __webpack_require__(10); +} + +var _constants; + +function _load_constants() { + return _constants = _interopRequireWildcard(__webpack_require__(8)); +} + +var _version; + +function _load_version() { + return _version = _interopRequireWildcard(__webpack_require__(127)); +} + +var _workspaceResolver; + +function _load_workspaceResolver() { + return _workspaceResolver = _interopRequireDefault(__webpack_require__(373)); +} + +var _fs; + +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); +} + +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__(1); +const invariant = __webpack_require__(5); +const semver = __webpack_require__(26); + +class PackageRequest { + constructor(req, resolver) { + this.parentRequest = req.parentRequest; + this.lockfile = resolver.lockfile; + this.registry = req.registry; + this.reporter = resolver.reporter; + this.resolver = resolver; + this.optional = req.optional; + this.pattern = req.pattern; + this.config = resolver.config; + this.foundInfo = null; + + resolver.usedRegistries.add(req.registry); } - function filterStackString(stackString) { - var lines = stackString.split('\n'), desiredLines = []; - for (var i = 0, len = lines.length; i < len; i++) { - var line = lines[i]; + static getExoticResolver(pattern) { + // TODO make this type more refined + for (const _ref of (0, (_misc || _load_misc()).entries)((_index || _load_index()).exotics)) { + var _ref2 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref, 2); - if (!isInternalFrame(line) && !isNodeFrame(line) && line) { - desiredLines.push(line); + const Resolver = _ref2[1]; + + if (Resolver.isVersion(pattern)) { + return Resolver; } } - return desiredLines.join('\n'); + return null; } - function isInternalFrame(stackLine) { - var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); - if (!fileNameAndLineNumber) { - return false; - } - var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1]; + getParentNames() { + const chain = []; - return fileName === rFileName && - lineNumber >= rStartingLine && - lineNumber <= rEndingLine; - } + let request = this.parentRequest; + while (request) { + const info = this.resolver.getStrictResolvedPattern(request.pattern); + chain.unshift(info.name); - function isNodeFrame(stackLine) { - return stackLine.indexOf('(module.js:') !== -1 || - stackLine.indexOf('(node.js:') !== -1; + request = request.parentRequest; + } + + return chain; } - function captureLine() { - if (!hasStacks) { return; } + getLocked(remoteType) { + // always prioritise root lockfile + const shrunk = this.lockfile.getLocked(this.pattern); - try { - throw new Error(); - } catch (e) { - var lines = e.stack.split('\n'); - var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2]; - var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); - if (!fileNameAndLineNumber) { return; } + if (shrunk && shrunk.resolved) { + const resolvedParts = (_version || _load_version()).explodeHashedUrl(shrunk.resolved); + // If it's a private git url set remote to 'git'. + const preferredRemoteType = resolvedParts.url.startsWith('git+ssh://') ? 'git' : remoteType; - rFileName = fileNameAndLineNumber[0]; - return fileNameAndLineNumber[1]; + return { + name: shrunk.name, + version: shrunk.version, + _uid: shrunk.uid, + _remote: { + resolved: shrunk.resolved, + type: preferredRemoteType, + reference: resolvedParts.url, + hash: resolvedParts.hash, + registry: shrunk.registry + }, + optionalDependencies: shrunk.optionalDependencies, + dependencies: shrunk.dependencies + }; + } else { + return null; } } - function getFileNameAndLineNumber(stackLine) { - // Named functions: 'at functionName (filename:lineNumber:columnNumber)' - var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); - if (attempt1) { return [attempt1[1], Number(attempt1[2])]; } - - // Anonymous functions: 'at filename:lineNumber:columnNumber' - var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); - if (attempt2) { return [attempt2[1], Number(attempt2[2])]; } + /** + * If the input pattern matches a registry one then attempt to find it on the registry. + * Otherwise fork off to an exotic resolver if one matches. + */ - // Firefox style: 'function@filename:lineNumber or @filename:lineNumber' - var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); - if (attempt3) { return [attempt3[1], Number(attempt3[2])]; } - } + findVersionOnRegistry(pattern) { + var _this = this; - var EmptyError = Rx.EmptyError = function() { - this.message = 'Sequence contains no elements.'; - Error.call(this); - }; - EmptyError.prototype = Object.create(Error.prototype); - EmptyError.prototype.name = 'EmptyError'; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + var _ref3 = yield _this.normalize(pattern); - var ObjectDisposedError = Rx.ObjectDisposedError = function() { - this.message = 'Object has been disposed'; - Error.call(this); - }; - ObjectDisposedError.prototype = Object.create(Error.prototype); - ObjectDisposedError.prototype.name = 'ObjectDisposedError'; + const range = _ref3.range, + name = _ref3.name; - var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () { - this.message = 'Argument out of range'; - Error.call(this); - }; - ArgumentOutOfRangeError.prototype = Object.create(Error.prototype); - ArgumentOutOfRangeError.prototype.name = 'ArgumentOutOfRangeError'; - var NotSupportedError = Rx.NotSupportedError = function (message) { - this.message = message || 'This operation is not supported'; - Error.call(this); - }; - NotSupportedError.prototype = Object.create(Error.prototype); - NotSupportedError.prototype.name = 'NotSupportedError'; + const exoticResolver = PackageRequest.getExoticResolver(range); + if (exoticResolver) { + let data = yield _this.findExoticVersionInfo(exoticResolver, range); - var NotImplementedError = Rx.NotImplementedError = function (message) { - this.message = message || 'This operation is not implemented'; - Error.call(this); - }; - NotImplementedError.prototype = Object.create(Error.prototype); - NotImplementedError.prototype.name = 'NotImplementedError'; + // clone data as we're manipulating it in place and this could be resolved multiple + // times + data = Object.assign({}, data); - var notImplemented = Rx.helpers.notImplemented = function () { - throw new NotImplementedError(); - }; + // this is so the returned package response uses the overridden name. ie. if the + // package's actual name is `bar`, but it's been specified in the manifest like: + // "foo": "http://foo.com/bar.tar.gz" + // then we use the foo name + data.name = name; - var notSupported = Rx.helpers.notSupported = function () { - throw new NotSupportedError(); - }; + return data; + } - // Shim in iterator support - var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || - '_es6shim_iterator_'; - // Bug for mozilla version - if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { - $iterator$ = '@@iterator'; + const Resolver = _this.getRegistryResolver(); + const resolver = new Resolver(_this, name, range); + return resolver.resolve(); + })(); } - var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined }; - - var isIterable = Rx.helpers.isIterable = function (o) { - return o && o[$iterator$] !== undefined; - }; + /** + * Get the registry resolver associated with this package request. + */ - var isArrayLike = Rx.helpers.isArrayLike = function (o) { - return o && o.length !== undefined; - }; + getRegistryResolver() { + const Resolver = (_index2 || _load_index2()).registries[this.registry]; + if (Resolver) { + return Resolver; + } else { + throw new (_errors || _load_errors()).MessageError(this.reporter.lang('unknownRegistryResolver', this.registry)); + } + } - Rx.helpers.iterator = $iterator$; + normalizeRange(pattern) { + var _this2 = this; - var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) { - if (typeof thisArg === 'undefined') { return func; } - switch(argCount) { - case 0: - return function() { - return func.call(thisArg) - }; - case 1: - return function(arg) { - return func.call(thisArg, arg); - }; - case 2: - return function(value, index) { - return func.call(thisArg, value, index); - }; - case 3: - return function(value, index, collection) { - return func.call(thisArg, value, index, collection); - }; - } + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (pattern.includes(':') || pattern.includes('@') || PackageRequest.getExoticResolver(pattern)) { + return Promise.resolve(pattern); + } - return function() { - return func.apply(thisArg, arguments); - }; - }; + if (yield (_fs || _load_fs()).exists(path.join(_this2.config.cwd, pattern))) { + return Promise.resolve(`file:${pattern}`); + } - /** Used to determine if values are of the language type Object */ - var dontEnums = ['toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor'], - dontEnumsLength = dontEnums.length; + return Promise.resolve(pattern); + })(); + } -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - weakMapTag = '[object WeakMap]'; + normalize(pattern) { + var _this3 = this; -var arrayBufferTag = '[object ArrayBuffer]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + var _PackageRequest$norma = PackageRequest.normalizePattern(pattern); -var typedArrayTags = {}; -typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = -typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = -typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = -typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = -typedArrayTags[uint32Tag] = true; -typedArrayTags[argsTag] = typedArrayTags[arrayTag] = -typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = -typedArrayTags[dateTag] = typedArrayTags[errorTag] = -typedArrayTags[funcTag] = typedArrayTags[mapTag] = -typedArrayTags[numberTag] = typedArrayTags[objectTag] = -typedArrayTags[regexpTag] = typedArrayTags[setTag] = -typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + const name = _PackageRequest$norma.name, + range = _PackageRequest$norma.range, + hasVersion = _PackageRequest$norma.hasVersion; -var objectProto = Object.prototype, - hasOwnProperty = objectProto.hasOwnProperty, - objToString = objectProto.toString, - MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + const newRange = yield _this3.normalizeRange(range); + return { name, range: newRange, hasVersion }; + })(); + } -var keys = Object.keys || (function() { - var hasOwnProperty = Object.prototype.hasOwnProperty, - hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), - dontEnums = [ - 'toString', - 'toLocaleString', - 'valueOf', - 'hasOwnProperty', - 'isPrototypeOf', - 'propertyIsEnumerable', - 'constructor' - ], - dontEnumsLength = dontEnums.length; + /** + * Explode and normalize a pattern into it's name and range. + */ - return function(obj) { - if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { - throw new TypeError('Object.keys called on non-object'); - } + static normalizePattern(pattern) { + let hasVersion = false; + let range = 'latest'; + let name = pattern; - var result = [], prop, i; + // if we're a scope then remove the @ and add it back later + let isScoped = false; + if (name[0] === '@') { + isScoped = true; + name = name.slice(1); + } - for (prop in obj) { - if (hasOwnProperty.call(obj, prop)) { - result.push(prop); - } - } + // take first part as the name + const parts = name.split('@'); + if (parts.length > 1) { + name = parts.shift(); + range = parts.join('@'); - if (hasDontEnumBug) { - for (i = 0; i < dontEnumsLength; i++) { - if (hasOwnProperty.call(obj, dontEnums[i])) { - result.push(dontEnums[i]); - } - } + if (range) { + hasVersion = true; + } else { + range = '*'; } - return result; - }; - }()); - -function equalObjects(object, other, equalFunc, isLoose, stackA, stackB) { - var objProps = keys(object), - objLength = objProps.length, - othProps = keys(other), - othLength = othProps.length; + } - if (objLength !== othLength && !isLoose) { - return false; - } - var index = objLength, key; - while (index--) { - key = objProps[index]; - if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { - return false; + // add back @ scope suffix + if (isScoped) { + name = `@${name}`; } + + return { name, range, hasVersion }; } - var skipCtor = isLoose; - while (++index < objLength) { - key = objProps[index]; - var objValue = object[key], - othValue = other[key], - result; - if (!(result === undefined ? equalFunc(objValue, othValue, isLoose, stackA, stackB) : result)) { - return false; - } - skipCtor || (skipCtor = key === 'constructor'); + /** + * Construct an exotic resolver instance with the input `ExoticResolver` and `range`. + */ + + findExoticVersionInfo(ExoticResolver, range) { + const resolver = new ExoticResolver(this, range); + return resolver.resolve(); } - if (!skipCtor) { - var objCtor = object.constructor, - othCtor = other.constructor; - if (objCtor !== othCtor && - ('constructor' in object && 'constructor' in other) && - !(typeof objCtor === 'function' && objCtor instanceof objCtor && - typeof othCtor === 'function' && othCtor instanceof othCtor)) { - return false; + /** + * If the current pattern matches an exotic resolver then delegate to it or else try + * the registry. + */ + + findVersionInfo() { + const exoticResolver = PackageRequest.getExoticResolver(this.pattern); + if (exoticResolver) { + return this.findExoticVersionInfo(exoticResolver, this.pattern); + } else if ((_workspaceResolver || _load_workspaceResolver()).default.isWorkspace(this.pattern, this.resolver.workspaceLayout)) { + invariant(this.resolver.workspaceLayout, 'expected workspaceLayout'); + const resolver = new (_workspaceResolver || _load_workspaceResolver()).default(this, this.pattern, this.resolver.workspaceLayout); + return resolver.resolve(); + } else { + return this.findVersionOnRegistry(this.pattern); } } - return true; -} -function equalByTag(object, other, tag) { - switch (tag) { - case boolTag: - case dateTag: - return +object === +other; + reportResolvedRangeMatch(info, resolved) {} - case errorTag: - return object.name === other.name && object.message === other.message; + /** + * Do the final resolve of a package that had a match with an existing version. + * After all unique versions have been discovered, so the best available version + * is found. + */ + resolveToExistingVersion(info) { + // get final resolved version + var _PackageRequest$norma2 = PackageRequest.normalizePattern(this.pattern); - case numberTag: - return (object !== +object) ? - other !== +other : - object === +other; + const range = _PackageRequest$norma2.range, + name = _PackageRequest$norma2.name; - case regexpTag: - case stringTag: - return object === (other + ''); + const resolved = this.resolver.getHighestRangeVersionMatch(name, range); + invariant(resolved, 'should have a resolved reference'); + + this.reportResolvedRangeMatch(info, resolved); + const ref = resolved._reference; + invariant(ref, 'Resolved package info has no package reference'); + ref.addRequest(this); + ref.addPattern(this.pattern, resolved); } - return false; -} -var isObject = Rx.internals.isObject = function(value) { - var type = typeof value; - return !!value && (type === 'object' || type === 'function'); -}; + /** + * TODO description + */ + find(fresh) { + var _this4 = this; -function isObjectLike(value) { - return !!value && typeof value === 'object'; -} + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // find version info for this package pattern + const info = yield _this4.findVersionInfo(); -function isLength(value) { - return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= MAX_SAFE_INTEGER; -} + if (!info) { + throw new (_errors || _load_errors()).MessageError(_this4.reporter.lang('unknownPackage', _this4.pattern)); + } -var isHostObject = (function() { - try { - Object({ 'toString': 0 } + ''); - } catch(e) { - return function() { return false; }; - } - return function(value) { - return typeof value.toString !== 'function' && typeof (value + '') === 'string'; - }; -}()); + info.fresh = fresh; + (0, (_validate || _load_validate()).cleanDependencies)(info, false, _this4.reporter, function () { + // swallow warnings + }); -function isTypedArray(value) { - return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; -} + // check if while we were resolving this dep we've already resolved one that satisfies + // the same range -var isArray = Array.isArray || function(value) { - return isObjectLike(value) && isLength(value.length) && objToString.call(value) === arrayTag; -}; + var _PackageRequest$norma3 = PackageRequest.normalizePattern(_this4.pattern); -function arraySome (array, predicate) { - var index = -1, - length = array.length; + const range = _PackageRequest$norma3.range, + name = _PackageRequest$norma3.name; - while (++index < length) { - if (predicate(array[index], index, array)) { - return true; - } - } - return false; -} + const resolved = _this4.resolver.getHighestRangeVersionMatch(name, range); + if (resolved) { + _this4.resolver.reportPackageWithExistingVersion(_this4, info); + return; + } -function equalArrays(array, other, equalFunc, isLoose, stackA, stackB) { - var index = -1, - arrLength = array.length, - othLength = other.length; + if (info.flat && !_this4.resolver.flat) { + throw new (_errors || _load_errors()).MessageError(_this4.reporter.lang('flatGlobalError')); + } - if (arrLength !== othLength && !(isLoose && othLength > arrLength)) { - return false; - } - // Ignore non-index properties. - while (++index < arrLength) { - var arrValue = array[index], - othValue = other[index], - result; + // validate version info + PackageRequest.validateVersionInfo(info, _this4.reporter); - if (result !== undefined) { - if (result) { - continue; + // + const remote = info._remote; + invariant(remote, 'Missing remote'); + + // set package reference + const ref = new (_packageReference || _load_packageReference()).default(_this4, info, remote); + ref.addPattern(_this4.pattern, info); + ref.addOptional(_this4.optional); + info._reference = ref; + info._remote = remote; + + // start installation of dependencies + const promises = []; + const deps = []; + + // normal deps + for (const depName in info.dependencies) { + const depPattern = depName + '@' + info.dependencies[depName]; + deps.push(depPattern); + promises.push(_this4.resolver.find({ + pattern: depPattern, + registry: remote.registry, + // dependencies of optional dependencies should themselves be optional + optional: _this4.optional, + parentRequest: _this4 + })); } - return false; - } - // Recursively compare arrays (susceptible to call stack limits). - if (isLoose) { - if (!arraySome(other, function(othValue) { - return arrValue === othValue || equalFunc(arrValue, othValue, isLoose, stackA, stackB); - })) { - return false; + + // optional deps + for (const depName in info.optionalDependencies) { + const depPattern = depName + '@' + info.optionalDependencies[depName]; + deps.push(depPattern); + promises.push(_this4.resolver.find({ + pattern: depPattern, + registry: remote.registry, + optional: true, + parentRequest: _this4 + })); + } + if (remote.type === 'workspace' && !_this4.config.production) { + // workspaces support dev dependencies + for (const depName in info.devDependencies) { + const depPattern = depName + '@' + info.devDependencies[depName]; + deps.push(depPattern); + promises.push(_this4.resolver.find({ + pattern: depPattern, + registry: remote.registry, + optional: false, + parentRequest: _this4 + })); + } } - } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, isLoose, stackA, stackB))) { - return false; - } - } - return true; -} -function baseIsEqualDeep(object, other, equalFunc, isLoose, stackA, stackB) { - var objIsArr = isArray(object), - othIsArr = isArray(other), - objTag = arrayTag, - othTag = arrayTag; + yield Promise.all(promises); + ref.addDependencies(deps); - if (!objIsArr) { - objTag = objToString.call(object); - if (objTag === argsTag) { - objTag = objectTag; - } else if (objTag !== objectTag) { - objIsArr = isTypedArray(object); - } - } - if (!othIsArr) { - othTag = objToString.call(other); - if (othTag === argsTag) { - othTag = objectTag; - } + // Now that we have all dependencies, it's safe to propagate optional + for (const otherRequest of ref.requests.slice(1)) { + ref.addOptional(otherRequest.optional); + } + })(); } - var objIsObj = objTag === objectTag && !isHostObject(object), - othIsObj = othTag === objectTag && !isHostObject(other), - isSameTag = objTag === othTag; - if (isSameTag && !(objIsArr || objIsObj)) { - return equalByTag(object, other, objTag); - } - if (!isLoose) { - var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), - othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); + /** + * TODO description + */ - if (objIsWrapped || othIsWrapped) { - return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, isLoose, stackA, stackB); + static validateVersionInfo(info, reporter) { + // human readable name to use in errors + const human = `${info.name}@${info.version}`; + + info.version = PackageRequest.getPackageVersion(info); + + for (const key of (_constants || _load_constants()).REQUIRED_PACKAGE_KEYS) { + if (!info[key]) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('missingRequiredPackageKey', human, key)); + } } } - if (!isSameTag) { - return false; - } - // Assume cyclic values are equal. - // For more information on detecting circular references see https://es5.github.io/#JO. - stackA || (stackA = []); - stackB || (stackB = []); - var length = stackA.length; - while (length--) { - if (stackA[length] === object) { - return stackB[length] === other; - } + /** + * Returns the package version if present, else defaults to the uid + */ + + static getPackageVersion(info) { + // TODO possibly reconsider this behaviour + return info.version === undefined ? info._uid : info.version; } - // Add `object` and `other` to the stack of traversed objects. - stackA.push(object); - stackB.push(other); - var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, isLoose, stackA, stackB); + /** + * Gets all of the outdated packages and sorts them appropriately + */ - stackA.pop(); - stackB.pop(); + static getOutdatedPackages(lockfile, install, config, reporter) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + var _ref4 = yield install.fetchRequestFromCwd(); - return result; -} + const depReqPatterns = _ref4.requests; -function baseIsEqual(value, other, isLoose, stackA, stackB) { - if (value === other) { - return true; - } - if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { - return value !== value && other !== other; + + const deps = yield Promise.all(depReqPatterns.map((() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (_ref6) { + let pattern = _ref6.pattern, + hint = _ref6.hint; + + const locked = lockfile.getLocked(pattern); + if (!locked) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('lockfileOutdated')); + } + + const name = locked.name, + current = locked.version; + + let latest = ''; + let wanted = ''; + let url = ''; + + const normalized = PackageRequest.normalizePattern(pattern); + + if (PackageRequest.getExoticResolver(pattern) || PackageRequest.getExoticResolver(normalized.range)) { + latest = wanted = 'exotic'; + url = normalized.range; + } else { + const registry = config.registries[locked.registry]; + + var _ref7 = yield registry.checkOutdated(config, name, normalized.range); + + latest = _ref7.latest; + wanted = _ref7.wanted; + url = _ref7.url; + } + + return { name, current, wanted, latest, url, hint }; + }); + + return function (_x) { + return _ref5.apply(this, arguments); + }; + })())); + + // Make sure to always output `exotic` versions to be compatible with npm + const isDepOld = function (_ref8) { + let current = _ref8.current, + latest = _ref8.latest, + wanted = _ref8.wanted; + return latest === 'exotic' || latest !== 'exotic' && (semver.lt(current, wanted) || semver.lt(current, latest)); + }; + const orderByName = function (depA, depB) { + return depA.name.localeCompare(depB.name); + }; + + return deps.filter(isDepOld).sort(orderByName); + })(); } - return baseIsEqualDeep(value, other, baseIsEqual, isLoose, stackA, stackB); } +exports.default = PackageRequest; -var isEqual = Rx.internals.isEqual = function (value, other) { - return baseIsEqual(value, other); -}; +/***/ }), +/* 29 */ +/***/ (function(module, exports) { - var hasProp = {}.hasOwnProperty, - slice = Array.prototype.slice; +// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028 +var global = module.exports = typeof window != 'undefined' && window.Math == Math + ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')(); +if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef - var inherits = Rx.internals.inherits = function (child, parent) { - function __() { this.constructor = child; } - __.prototype = parent.prototype; - child.prototype = new __(); - }; +/***/ }), +/* 30 */ +/***/ (function(module, exports, __webpack_require__) { - var addProperties = Rx.internals.addProperties = function (obj) { - for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); } - for (var idx = 0, ln = sources.length; idx < ln; idx++) { - var source = sources[idx]; - for (var prop in source) { - obj[prop] = source[prop]; - } - } - }; +/* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. - // Rx Utils - var addRef = Rx.internals.addRef = function (xs, r) { - return new AnonymousObservable(function (observer) { - return new BinaryDisposable(r.getDisposable(), xs.subscribe(observer)); - }); +;(function (undefined) { + + var objectTypes = { + 'function': true, + 'object': true }; - function arrayInitialize(count, factory) { - var a = new Array(count); - for (var i = 0; i < count; i++) { - a[i] = factory(); - } - return a; + function checkGlobal(value) { + return (value && value.Object === Object) ? value : null; } - /** - * Represents a group of disposable resources that are disposed together. - * @constructor - */ - var CompositeDisposable = Rx.CompositeDisposable = function () { - var args = [], i, len; - if (Array.isArray(arguments[0])) { - args = arguments[0]; - } else { - len = arguments.length; - args = new Array(len); - for(i = 0; i < len; i++) { args[i] = arguments[i]; } - } - this.disposables = args; - this.isDisposed = false; - this.length = args.length; + var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType) ? exports : null; + var freeModule = (objectTypes[typeof module] && module && !module.nodeType) ? module : null; + var freeGlobal = checkGlobal(freeExports && freeModule && typeof global === 'object' && global); + var freeSelf = checkGlobal(objectTypes[typeof self] && self); + var freeWindow = checkGlobal(objectTypes[typeof window] && window); + var moduleExports = (freeModule && freeModule.exports === freeExports) ? freeExports : null; + var thisGlobal = checkGlobal(objectTypes[typeof this] && this); + var root = freeGlobal || ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) || freeSelf || thisGlobal || Function('return this')(); + + var Rx = { + internals: {}, + config: { + Promise: root.Promise + }, + helpers: { } }; - var CompositeDisposablePrototype = CompositeDisposable.prototype; + // Defaults + var noop = Rx.helpers.noop = function () { }, + identity = Rx.helpers.identity = function (x) { return x; }, + defaultNow = Rx.helpers.defaultNow = Date.now, + defaultComparer = Rx.helpers.defaultComparer = function (x, y) { return isEqual(x, y); }, + defaultSubComparer = Rx.helpers.defaultSubComparer = function (x, y) { return x > y ? 1 : (x < y ? -1 : 0); }, + defaultKeySerializer = Rx.helpers.defaultKeySerializer = function (x) { return x.toString(); }, + defaultError = Rx.helpers.defaultError = function (err) { throw err; }, + isPromise = Rx.helpers.isPromise = function (p) { return !!p && typeof p.subscribe !== 'function' && typeof p.then === 'function'; }, + isFunction = Rx.helpers.isFunction = (function () { - /** - * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. - * @param {Mixed} item Disposable to add. - */ - CompositeDisposablePrototype.add = function (item) { - if (this.isDisposed) { - item.dispose(); - } else { - this.disposables.push(item); - this.length++; - } + var isFn = function (value) { + return typeof value == 'function' || false; + }; + + // fallback for older versions of Chrome and Safari + if (isFn(/x/)) { + isFn = function(value) { + return typeof value == 'function' && toString.call(value) == '[object Function]'; + }; + } + + return isFn; + }()); + + function cloneArray(arr) { for(var a = [], i = 0, len = arr.length; i < len; i++) { a.push(arr[i]); } return a;} + + var errorObj = {e: {}}; + + function tryCatcherGen(tryCatchTarget) { + return function tryCatcher() { + try { + return tryCatchTarget.apply(this, arguments); + } catch (e) { + errorObj.e = e; + return errorObj; + } + }; + } + + var tryCatch = Rx.internals.tryCatch = function tryCatch(fn) { + if (!isFunction(fn)) { throw new TypeError('fn must be a function'); } + return tryCatcherGen(fn); }; - /** - * Removes and disposes the first occurrence of a disposable from the CompositeDisposable. - * @param {Mixed} item Disposable to remove. - * @returns {Boolean} true if found; false otherwise. - */ - CompositeDisposablePrototype.remove = function (item) { - var shouldDispose = false; - if (!this.isDisposed) { - var idx = this.disposables.indexOf(item); - if (idx !== -1) { - shouldDispose = true; - this.disposables.splice(idx, 1); - this.length--; - item.dispose(); + function thrower(e) { + throw e; + } + + Rx.config.longStackSupport = false; + var hasStacks = false, stacks = tryCatch(function () { throw new Error(); })(); + hasStacks = !!stacks.e && !!stacks.e.stack; + + // All code after this point will be filtered from stack traces reported by RxJS + var rStartingLine = captureLine(), rFileName; + + var STACK_JUMP_SEPARATOR = 'From previous event:'; + + function makeStackTraceLong(error, observable) { + // If possible, transform the error stack trace by removing Node and RxJS + // cruft, then concatenating with the stack trace of `observable`. + if (hasStacks && + observable.stack && + typeof error === 'object' && + error !== null && + error.stack && + error.stack.indexOf(STACK_JUMP_SEPARATOR) === -1 + ) { + var stacks = []; + for (var o = observable; !!o; o = o.source) { + if (o.stack) { + stacks.unshift(o.stack); + } } + stacks.unshift(error.stack); + + var concatedStacks = stacks.join('\n' + STACK_JUMP_SEPARATOR + '\n'); + error.stack = filterStackString(concatedStacks); } - return shouldDispose; - }; + } - /** - * Disposes all disposables in the group and removes them from the group. - */ - CompositeDisposablePrototype.dispose = function () { - if (!this.isDisposed) { - this.isDisposed = true; - var len = this.disposables.length, currentDisposables = new Array(len); - for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; } - this.disposables = []; - this.length = 0; + function filterStackString(stackString) { + var lines = stackString.split('\n'), desiredLines = []; + for (var i = 0, len = lines.length; i < len; i++) { + var line = lines[i]; - for (i = 0; i < len; i++) { - currentDisposables[i].dispose(); + if (!isInternalFrame(line) && !isNodeFrame(line) && line) { + desiredLines.push(line); } } - }; + return desiredLines.join('\n'); + } - /** - * Provides a set of static methods for creating Disposables. - * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. - */ - var Disposable = Rx.Disposable = function (action) { - this.isDisposed = false; - this.action = action || noop; - }; + function isInternalFrame(stackLine) { + var fileNameAndLineNumber = getFileNameAndLineNumber(stackLine); + if (!fileNameAndLineNumber) { + return false; + } + var fileName = fileNameAndLineNumber[0], lineNumber = fileNameAndLineNumber[1]; - /** Performs the task of cleaning up resources. */ - Disposable.prototype.dispose = function () { - if (!this.isDisposed) { - this.action(); - this.isDisposed = true; + return fileName === rFileName && + lineNumber >= rStartingLine && + lineNumber <= rEndingLine; + } + + function isNodeFrame(stackLine) { + return stackLine.indexOf('(module.js:') !== -1 || + stackLine.indexOf('(node.js:') !== -1; + } + + function captureLine() { + if (!hasStacks) { return; } + + try { + throw new Error(); + } catch (e) { + var lines = e.stack.split('\n'); + var firstLine = lines[0].indexOf('@') > 0 ? lines[1] : lines[2]; + var fileNameAndLineNumber = getFileNameAndLineNumber(firstLine); + if (!fileNameAndLineNumber) { return; } + + rFileName = fileNameAndLineNumber[0]; + return fileNameAndLineNumber[1]; } - }; + } - /** - * Creates a disposable object that invokes the specified action when disposed. - * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. - * @return {Disposable} The disposable object that runs the given action upon disposal. - */ - var disposableCreate = Disposable.create = function (action) { return new Disposable(action); }; + function getFileNameAndLineNumber(stackLine) { + // Named functions: 'at functionName (filename:lineNumber:columnNumber)' + var attempt1 = /at .+ \((.+):(\d+):(?:\d+)\)$/.exec(stackLine); + if (attempt1) { return [attempt1[1], Number(attempt1[2])]; } - /** - * Gets the disposable that does nothing when disposed. - */ - var disposableEmpty = Disposable.empty = { dispose: noop }; + // Anonymous functions: 'at filename:lineNumber:columnNumber' + var attempt2 = /at ([^ ]+):(\d+):(?:\d+)$/.exec(stackLine); + if (attempt2) { return [attempt2[1], Number(attempt2[2])]; } - /** - * Validates whether the given object is a disposable - * @param {Object} Object to test whether it has a dispose method - * @returns {Boolean} true if a disposable object, else false. - */ - var isDisposable = Disposable.isDisposable = function (d) { - return d && isFunction(d.dispose); + // Firefox style: 'function@filename:lineNumber or @filename:lineNumber' + var attempt3 = /.*@(.+):(\d+)$/.exec(stackLine); + if (attempt3) { return [attempt3[1], Number(attempt3[2])]; } + } + + var EmptyError = Rx.EmptyError = function() { + this.message = 'Sequence contains no elements.'; + Error.call(this); }; + EmptyError.prototype = Object.create(Error.prototype); + EmptyError.prototype.name = 'EmptyError'; - var checkDisposed = Disposable.checkDisposed = function (disposable) { - if (disposable.isDisposed) { throw new ObjectDisposedError(); } + var ObjectDisposedError = Rx.ObjectDisposedError = function() { + this.message = 'Object has been disposed'; + Error.call(this); }; + ObjectDisposedError.prototype = Object.create(Error.prototype); + ObjectDisposedError.prototype.name = 'ObjectDisposedError'; - var disposableFixup = Disposable._fixup = function (result) { - return isDisposable(result) ? result : disposableEmpty; + var ArgumentOutOfRangeError = Rx.ArgumentOutOfRangeError = function () { + this.message = 'Argument out of range'; + Error.call(this); }; + ArgumentOutOfRangeError.prototype = Object.create(Error.prototype); + ArgumentOutOfRangeError.prototype.name = 'ArgumentOutOfRangeError'; - // Single assignment - var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () { - this.isDisposed = false; - this.current = null; + var NotSupportedError = Rx.NotSupportedError = function (message) { + this.message = message || 'This operation is not supported'; + Error.call(this); }; - SingleAssignmentDisposable.prototype.getDisposable = function () { - return this.current; - }; - SingleAssignmentDisposable.prototype.setDisposable = function (value) { - if (this.current) { throw new Error('Disposable has already been assigned'); } - var shouldDispose = this.isDisposed; - !shouldDispose && (this.current = value); - shouldDispose && value && value.dispose(); - }; - SingleAssignmentDisposable.prototype.dispose = function () { - if (!this.isDisposed) { - this.isDisposed = true; - var old = this.current; - this.current = null; - old && old.dispose(); - } + NotSupportedError.prototype = Object.create(Error.prototype); + NotSupportedError.prototype.name = 'NotSupportedError'; + + var NotImplementedError = Rx.NotImplementedError = function (message) { + this.message = message || 'This operation is not implemented'; + Error.call(this); }; + NotImplementedError.prototype = Object.create(Error.prototype); + NotImplementedError.prototype.name = 'NotImplementedError'; - // Multiple assignment disposable - var SerialDisposable = Rx.SerialDisposable = function () { - this.isDisposed = false; - this.current = null; - }; - SerialDisposable.prototype.getDisposable = function () { - return this.current; - }; - SerialDisposable.prototype.setDisposable = function (value) { - var shouldDispose = this.isDisposed; - if (!shouldDispose) { - var old = this.current; - this.current = value; - } - old && old.dispose(); - shouldDispose && value && value.dispose(); - }; - SerialDisposable.prototype.dispose = function () { - if (!this.isDisposed) { - this.isDisposed = true; - var old = this.current; - this.current = null; - } - old && old.dispose(); + var notImplemented = Rx.helpers.notImplemented = function () { + throw new NotImplementedError(); }; - var BinaryDisposable = Rx.BinaryDisposable = function (first, second) { - this._first = first; - this._second = second; - this.isDisposed = false; + var notSupported = Rx.helpers.notSupported = function () { + throw new NotSupportedError(); }; - BinaryDisposable.prototype.dispose = function () { - if (!this.isDisposed) { - this.isDisposed = true; - var old1 = this._first; - this._first = null; - old1 && old1.dispose(); - var old2 = this._second; - this._second = null; - old2 && old2.dispose(); - } + // Shim in iterator support + var $iterator$ = (typeof Symbol === 'function' && Symbol.iterator) || + '_es6shim_iterator_'; + // Bug for mozilla version + if (root.Set && typeof new root.Set()['@@iterator'] === 'function') { + $iterator$ = '@@iterator'; + } + + var doneEnumerator = Rx.doneEnumerator = { done: true, value: undefined }; + + var isIterable = Rx.helpers.isIterable = function (o) { + return o && o[$iterator$] !== undefined; }; - var NAryDisposable = Rx.NAryDisposable = function (disposables) { - this._disposables = disposables; - this.isDisposed = false; + var isArrayLike = Rx.helpers.isArrayLike = function (o) { + return o && o.length !== undefined; }; - NAryDisposable.prototype.dispose = function () { - if (!this.isDisposed) { - this.isDisposed = true; - for (var i = 0, len = this._disposables.length; i < len; i++) { - this._disposables[i].dispose(); - } - this._disposables.length = 0; + Rx.helpers.iterator = $iterator$; + + var bindCallback = Rx.internals.bindCallback = function (func, thisArg, argCount) { + if (typeof thisArg === 'undefined') { return func; } + switch(argCount) { + case 0: + return function() { + return func.call(thisArg) + }; + case 1: + return function(arg) { + return func.call(thisArg, arg); + }; + case 2: + return function(value, index) { + return func.call(thisArg, value, index); + }; + case 3: + return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; } + + return function() { + return func.apply(thisArg, arguments); + }; }; - /** - * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. - */ - var RefCountDisposable = Rx.RefCountDisposable = (function () { + /** Used to determine if values are of the language type Object */ + var dontEnums = ['toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor'], + dontEnumsLength = dontEnums.length; - function InnerDisposable(disposable) { - this.disposable = disposable; - this.disposable.count++; - this.isInnerDisposed = false; - } +var argsTag = '[object Arguments]', + arrayTag = '[object Array]', + boolTag = '[object Boolean]', + dateTag = '[object Date]', + errorTag = '[object Error]', + funcTag = '[object Function]', + mapTag = '[object Map]', + numberTag = '[object Number]', + objectTag = '[object Object]', + regexpTag = '[object RegExp]', + setTag = '[object Set]', + stringTag = '[object String]', + weakMapTag = '[object WeakMap]'; - InnerDisposable.prototype.dispose = function () { - if (!this.disposable.isDisposed && !this.isInnerDisposed) { - this.isInnerDisposed = true; - this.disposable.count--; - if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { - this.disposable.isDisposed = true; - this.disposable.underlyingDisposable.dispose(); - } +var arrayBufferTag = '[object ArrayBuffer]', + float32Tag = '[object Float32Array]', + float64Tag = '[object Float64Array]', + int8Tag = '[object Int8Array]', + int16Tag = '[object Int16Array]', + int32Tag = '[object Int32Array]', + uint8Tag = '[object Uint8Array]', + uint8ClampedTag = '[object Uint8ClampedArray]', + uint16Tag = '[object Uint16Array]', + uint32Tag = '[object Uint32Array]'; + +var typedArrayTags = {}; +typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = +typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = +typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = +typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = +typedArrayTags[uint32Tag] = true; +typedArrayTags[argsTag] = typedArrayTags[arrayTag] = +typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = +typedArrayTags[dateTag] = typedArrayTags[errorTag] = +typedArrayTags[funcTag] = typedArrayTags[mapTag] = +typedArrayTags[numberTag] = typedArrayTags[objectTag] = +typedArrayTags[regexpTag] = typedArrayTags[setTag] = +typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; + +var objectProto = Object.prototype, + hasOwnProperty = objectProto.hasOwnProperty, + objToString = objectProto.toString, + MAX_SAFE_INTEGER = Math.pow(2, 53) - 1; + +var keys = Object.keys || (function() { + var hasOwnProperty = Object.prototype.hasOwnProperty, + hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString'), + dontEnums = [ + 'toString', + 'toLocaleString', + 'valueOf', + 'hasOwnProperty', + 'isPrototypeOf', + 'propertyIsEnumerable', + 'constructor' + ], + dontEnumsLength = dontEnums.length; + + return function(obj) { + if (typeof obj !== 'object' && (typeof obj !== 'function' || obj === null)) { + throw new TypeError('Object.keys called on non-object'); } - }; - /** - * Initializes a new instance of the RefCountDisposable with the specified disposable. - * @constructor - * @param {Disposable} disposable Underlying disposable. - */ - function RefCountDisposable(disposable) { - this.underlyingDisposable = disposable; - this.isDisposed = false; - this.isPrimaryDisposed = false; - this.count = 0; - } + var result = [], prop, i; - /** - * Disposes the underlying disposable only when all dependent disposables have been disposed - */ - RefCountDisposable.prototype.dispose = function () { - if (!this.isDisposed && !this.isPrimaryDisposed) { - this.isPrimaryDisposed = true; - if (this.count === 0) { - this.isDisposed = true; - this.underlyingDisposable.dispose(); + for (prop in obj) { + if (hasOwnProperty.call(obj, prop)) { + result.push(prop); } } - }; - /** - * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable. - * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime. - */ - RefCountDisposable.prototype.getDisposable = function () { - return this.isDisposed ? disposableEmpty : new InnerDisposable(this); + if (hasDontEnumBug) { + for (i = 0; i < dontEnumsLength; i++) { + if (hasOwnProperty.call(obj, dontEnums[i])) { + result.push(dontEnums[i]); + } + } + } + return result; }; + }()); - return RefCountDisposable; - })(); +function equalObjects(object, other, equalFunc, isLoose, stackA, stackB) { + var objProps = keys(object), + objLength = objProps.length, + othProps = keys(other), + othLength = othProps.length; - function ScheduledDisposable(scheduler, disposable) { - this.scheduler = scheduler; - this.disposable = disposable; - this.isDisposed = false; + if (objLength !== othLength && !isLoose) { + return false; + } + var index = objLength, key; + while (index--) { + key = objProps[index]; + if (!(isLoose ? key in other : hasOwnProperty.call(other, key))) { + return false; + } } + var skipCtor = isLoose; + while (++index < objLength) { + key = objProps[index]; + var objValue = object[key], + othValue = other[key], + result; - function scheduleItem(s, self) { - if (!self.isDisposed) { - self.isDisposed = true; - self.disposable.dispose(); + if (!(result === undefined ? equalFunc(objValue, othValue, isLoose, stackA, stackB) : result)) { + return false; } + skipCtor || (skipCtor = key === 'constructor'); } + if (!skipCtor) { + var objCtor = object.constructor, + othCtor = other.constructor; - ScheduledDisposable.prototype.dispose = function () { - this.scheduler.schedule(this, scheduleItem); - }; + if (objCtor !== othCtor && + ('constructor' in object && 'constructor' in other) && + !(typeof objCtor === 'function' && objCtor instanceof objCtor && + typeof othCtor === 'function' && othCtor instanceof othCtor)) { + return false; + } + } + return true; +} - var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { - this.scheduler = scheduler; - this.state = state; - this.action = action; - this.dueTime = dueTime; - this.comparer = comparer || defaultSubComparer; - this.disposable = new SingleAssignmentDisposable(); - }; +function equalByTag(object, other, tag) { + switch (tag) { + case boolTag: + case dateTag: + return +object === +other; - ScheduledItem.prototype.invoke = function () { - this.disposable.setDisposable(this.invokeCore()); - }; + case errorTag: + return object.name === other.name && object.message === other.message; - ScheduledItem.prototype.compareTo = function (other) { - return this.comparer(this.dueTime, other.dueTime); - }; + case numberTag: + return (object !== +object) ? + other !== +other : + object === +other; - ScheduledItem.prototype.isCancelled = function () { - return this.disposable.isDisposed; - }; + case regexpTag: + case stringTag: + return object === (other + ''); + } + return false; +} - ScheduledItem.prototype.invokeCore = function () { - return disposableFixup(this.action(this.scheduler, this.state)); - }; +var isObject = Rx.internals.isObject = function(value) { + var type = typeof value; + return !!value && (type === 'object' || type === 'function'); +}; - /** Provides a set of static properties to access commonly used schedulers. */ - var Scheduler = Rx.Scheduler = (function () { +function isObjectLike(value) { + return !!value && typeof value === 'object'; +} - function Scheduler() { } +function isLength(value) { + return typeof value === 'number' && value > -1 && value % 1 === 0 && value <= MAX_SAFE_INTEGER; +} - /** Determines whether the given object is a scheduler */ - Scheduler.isScheduler = function (s) { - return s instanceof Scheduler; - }; +var isHostObject = (function() { + try { + Object({ 'toString': 0 } + ''); + } catch(e) { + return function() { return false; }; + } + return function(value) { + return typeof value.toString !== 'function' && typeof (value + '') === 'string'; + }; +}()); - var schedulerProto = Scheduler.prototype; +function isTypedArray(value) { + return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[objToString.call(value)]; +} - /** - * Schedules an action to be executed. - * @param state State passed to the action to be executed. - * @param {Function} action Action to be executed. - * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). - */ - schedulerProto.schedule = function (state, action) { - throw new NotImplementedError(); - }; +var isArray = Array.isArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) === arrayTag; +}; - /** - * Schedules an action to be executed after dueTime. - * @param state State passed to the action to be executed. - * @param {Function} action Action to be executed. - * @param {Number} dueTime Relative time after which to execute the action. - * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). - */ - schedulerProto.scheduleFuture = function (state, dueTime, action) { - var dt = dueTime; - dt instanceof Date && (dt = dt - this.now()); - dt = Scheduler.normalize(dt); +function arraySome (array, predicate) { + var index = -1, + length = array.length; - if (dt === 0) { return this.schedule(state, action); } + while (++index < length) { + if (predicate(array[index], index, array)) { + return true; + } + } + return false; +} - return this._scheduleFuture(state, dt, action); - }; +function equalArrays(array, other, equalFunc, isLoose, stackA, stackB) { + var index = -1, + arrLength = array.length, + othLength = other.length; - schedulerProto._scheduleFuture = function (state, dueTime, action) { - throw new NotImplementedError(); - }; + if (arrLength !== othLength && !(isLoose && othLength > arrLength)) { + return false; + } + // Ignore non-index properties. + while (++index < arrLength) { + var arrValue = array[index], + othValue = other[index], + result; - /** Gets the current time according to the local machine's system clock. */ - Scheduler.now = defaultNow; + if (result !== undefined) { + if (result) { + continue; + } + return false; + } + // Recursively compare arrays (susceptible to call stack limits). + if (isLoose) { + if (!arraySome(other, function(othValue) { + return arrValue === othValue || equalFunc(arrValue, othValue, isLoose, stackA, stackB); + })) { + return false; + } + } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, isLoose, stackA, stackB))) { + return false; + } + } + return true; +} - /** Gets the current time according to the local machine's system clock. */ - Scheduler.prototype.now = defaultNow; +function baseIsEqualDeep(object, other, equalFunc, isLoose, stackA, stackB) { + var objIsArr = isArray(object), + othIsArr = isArray(other), + objTag = arrayTag, + othTag = arrayTag; - /** - * Normalizes the specified TimeSpan value to a positive value. - * @param {Number} timeSpan The time span value to normalize. - * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0 - */ - Scheduler.normalize = function (timeSpan) { - timeSpan < 0 && (timeSpan = 0); - return timeSpan; - }; + if (!objIsArr) { + objTag = objToString.call(object); + if (objTag === argsTag) { + objTag = objectTag; + } else if (objTag !== objectTag) { + objIsArr = isTypedArray(object); + } + } + if (!othIsArr) { + othTag = objToString.call(other); + if (othTag === argsTag) { + othTag = objectTag; + } + } + var objIsObj = objTag === objectTag && !isHostObject(object), + othIsObj = othTag === objectTag && !isHostObject(other), + isSameTag = objTag === othTag; - return Scheduler; - }()); + if (isSameTag && !(objIsArr || objIsObj)) { + return equalByTag(object, other, objTag); + } + if (!isLoose) { + var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), + othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); - var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler; + if (objIsWrapped || othIsWrapped) { + return equalFunc(objIsWrapped ? object.value() : object, othIsWrapped ? other.value() : other, isLoose, stackA, stackB); + } + } + if (!isSameTag) { + return false; + } + // Assume cyclic values are equal. + // For more information on detecting circular references see https://es5.github.io/#JO. + stackA || (stackA = []); + stackB || (stackB = []); - (function (schedulerProto) { + var length = stackA.length; + while (length--) { + if (stackA[length] === object) { + return stackB[length] === other; + } + } + // Add `object` and `other` to the stack of traversed objects. + stackA.push(object); + stackB.push(other); - function invokeRecImmediate(scheduler, pair) { - var state = pair[0], action = pair[1], group = new CompositeDisposable(); - action(state, innerAction); - return group; + var result = (objIsArr ? equalArrays : equalObjects)(object, other, equalFunc, isLoose, stackA, stackB); - function innerAction(state2) { - var isAdded = false, isDone = false; + stackA.pop(); + stackB.pop(); - var d = scheduler.schedule(state2, scheduleWork); - if (!isDone) { - group.add(d); - isAdded = true; - } + return result; +} - function scheduleWork(_, state3) { - if (isAdded) { - group.remove(d); - } else { - isDone = true; - } - action(state3, innerAction); - return disposableEmpty; - } - } - } +function baseIsEqual(value, other, isLoose, stackA, stackB) { + if (value === other) { + return true; + } + if (value == null || other == null || (!isObject(value) && !isObjectLike(other))) { + return value !== value && other !== other; + } + return baseIsEqualDeep(value, other, baseIsEqual, isLoose, stackA, stackB); +} + +var isEqual = Rx.internals.isEqual = function (value, other) { + return baseIsEqual(value, other); +}; + + var hasProp = {}.hasOwnProperty, + slice = Array.prototype.slice; + + var inherits = Rx.internals.inherits = function (child, parent) { + function __() { this.constructor = child; } + __.prototype = parent.prototype; + child.prototype = new __(); + }; + + var addProperties = Rx.internals.addProperties = function (obj) { + for(var sources = [], i = 1, len = arguments.length; i < len; i++) { sources.push(arguments[i]); } + for (var idx = 0, ln = sources.length; idx < ln; idx++) { + var source = sources[idx]; + for (var prop in source) { + obj[prop] = source[prop]; + } + } + }; + + // Rx Utils + var addRef = Rx.internals.addRef = function (xs, r) { + return new AnonymousObservable(function (observer) { + return new BinaryDisposable(r.getDisposable(), xs.subscribe(observer)); + }); + }; + + function arrayInitialize(count, factory) { + var a = new Array(count); + for (var i = 0; i < count; i++) { + a[i] = factory(); + } + return a; + } + + /** + * Represents a group of disposable resources that are disposed together. + * @constructor + */ + var CompositeDisposable = Rx.CompositeDisposable = function () { + var args = [], i, len; + if (Array.isArray(arguments[0])) { + args = arguments[0]; + } else { + len = arguments.length; + args = new Array(len); + for(i = 0; i < len; i++) { args[i] = arguments[i]; } + } + this.disposables = args; + this.isDisposed = false; + this.length = args.length; + }; + + var CompositeDisposablePrototype = CompositeDisposable.prototype; + + /** + * Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed. + * @param {Mixed} item Disposable to add. + */ + CompositeDisposablePrototype.add = function (item) { + if (this.isDisposed) { + item.dispose(); + } else { + this.disposables.push(item); + this.length++; + } + }; + + /** + * Removes and disposes the first occurrence of a disposable from the CompositeDisposable. + * @param {Mixed} item Disposable to remove. + * @returns {Boolean} true if found; false otherwise. + */ + CompositeDisposablePrototype.remove = function (item) { + var shouldDispose = false; + if (!this.isDisposed) { + var idx = this.disposables.indexOf(item); + if (idx !== -1) { + shouldDispose = true; + this.disposables.splice(idx, 1); + this.length--; + item.dispose(); + } + } + return shouldDispose; + }; + + /** + * Disposes all disposables in the group and removes them from the group. + */ + CompositeDisposablePrototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + var len = this.disposables.length, currentDisposables = new Array(len); + for(var i = 0; i < len; i++) { currentDisposables[i] = this.disposables[i]; } + this.disposables = []; + this.length = 0; + + for (i = 0; i < len; i++) { + currentDisposables[i].dispose(); + } + } + }; + + /** + * Provides a set of static methods for creating Disposables. + * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. + */ + var Disposable = Rx.Disposable = function (action) { + this.isDisposed = false; + this.action = action || noop; + }; + + /** Performs the task of cleaning up resources. */ + Disposable.prototype.dispose = function () { + if (!this.isDisposed) { + this.action(); + this.isDisposed = true; + } + }; + + /** + * Creates a disposable object that invokes the specified action when disposed. + * @param {Function} dispose Action to run during the first call to dispose. The action is guaranteed to be run at most once. + * @return {Disposable} The disposable object that runs the given action upon disposal. + */ + var disposableCreate = Disposable.create = function (action) { return new Disposable(action); }; + + /** + * Gets the disposable that does nothing when disposed. + */ + var disposableEmpty = Disposable.empty = { dispose: noop }; + + /** + * Validates whether the given object is a disposable + * @param {Object} Object to test whether it has a dispose method + * @returns {Boolean} true if a disposable object, else false. + */ + var isDisposable = Disposable.isDisposable = function (d) { + return d && isFunction(d.dispose); + }; + + var checkDisposed = Disposable.checkDisposed = function (disposable) { + if (disposable.isDisposed) { throw new ObjectDisposedError(); } + }; + + var disposableFixup = Disposable._fixup = function (result) { + return isDisposable(result) ? result : disposableEmpty; + }; + + // Single assignment + var SingleAssignmentDisposable = Rx.SingleAssignmentDisposable = function () { + this.isDisposed = false; + this.current = null; + }; + SingleAssignmentDisposable.prototype.getDisposable = function () { + return this.current; + }; + SingleAssignmentDisposable.prototype.setDisposable = function (value) { + if (this.current) { throw new Error('Disposable has already been assigned'); } + var shouldDispose = this.isDisposed; + !shouldDispose && (this.current = value); + shouldDispose && value && value.dispose(); + }; + SingleAssignmentDisposable.prototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + var old = this.current; + this.current = null; + old && old.dispose(); + } + }; + + // Multiple assignment disposable + var SerialDisposable = Rx.SerialDisposable = function () { + this.isDisposed = false; + this.current = null; + }; + SerialDisposable.prototype.getDisposable = function () { + return this.current; + }; + SerialDisposable.prototype.setDisposable = function (value) { + var shouldDispose = this.isDisposed; + if (!shouldDispose) { + var old = this.current; + this.current = value; + } + old && old.dispose(); + shouldDispose && value && value.dispose(); + }; + SerialDisposable.prototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + var old = this.current; + this.current = null; + } + old && old.dispose(); + }; + + var BinaryDisposable = Rx.BinaryDisposable = function (first, second) { + this._first = first; + this._second = second; + this.isDisposed = false; + }; + + BinaryDisposable.prototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + var old1 = this._first; + this._first = null; + old1 && old1.dispose(); + var old2 = this._second; + this._second = null; + old2 && old2.dispose(); + } + }; + + var NAryDisposable = Rx.NAryDisposable = function (disposables) { + this._disposables = disposables; + this.isDisposed = false; + }; + + NAryDisposable.prototype.dispose = function () { + if (!this.isDisposed) { + this.isDisposed = true; + for (var i = 0, len = this._disposables.length; i < len; i++) { + this._disposables[i].dispose(); + } + this._disposables.length = 0; + } + }; + + /** + * Represents a disposable resource that only disposes its underlying disposable resource when all dependent disposable objects have been disposed. + */ + var RefCountDisposable = Rx.RefCountDisposable = (function () { + + function InnerDisposable(disposable) { + this.disposable = disposable; + this.disposable.count++; + this.isInnerDisposed = false; + } + + InnerDisposable.prototype.dispose = function () { + if (!this.disposable.isDisposed && !this.isInnerDisposed) { + this.isInnerDisposed = true; + this.disposable.count--; + if (this.disposable.count === 0 && this.disposable.isPrimaryDisposed) { + this.disposable.isDisposed = true; + this.disposable.underlyingDisposable.dispose(); + } + } + }; + + /** + * Initializes a new instance of the RefCountDisposable with the specified disposable. + * @constructor + * @param {Disposable} disposable Underlying disposable. + */ + function RefCountDisposable(disposable) { + this.underlyingDisposable = disposable; + this.isDisposed = false; + this.isPrimaryDisposed = false; + this.count = 0; + } + + /** + * Disposes the underlying disposable only when all dependent disposables have been disposed + */ + RefCountDisposable.prototype.dispose = function () { + if (!this.isDisposed && !this.isPrimaryDisposed) { + this.isPrimaryDisposed = true; + if (this.count === 0) { + this.isDisposed = true; + this.underlyingDisposable.dispose(); + } + } + }; + + /** + * Returns a dependent disposable that when disposed decreases the refcount on the underlying disposable. + * @returns {Disposable} A dependent disposable contributing to the reference count that manages the underlying disposable's lifetime. + */ + RefCountDisposable.prototype.getDisposable = function () { + return this.isDisposed ? disposableEmpty : new InnerDisposable(this); + }; + + return RefCountDisposable; + })(); + + function ScheduledDisposable(scheduler, disposable) { + this.scheduler = scheduler; + this.disposable = disposable; + this.isDisposed = false; + } + + function scheduleItem(s, self) { + if (!self.isDisposed) { + self.isDisposed = true; + self.disposable.dispose(); + } + } + + ScheduledDisposable.prototype.dispose = function () { + this.scheduler.schedule(this, scheduleItem); + }; + + var ScheduledItem = Rx.internals.ScheduledItem = function (scheduler, state, action, dueTime, comparer) { + this.scheduler = scheduler; + this.state = state; + this.action = action; + this.dueTime = dueTime; + this.comparer = comparer || defaultSubComparer; + this.disposable = new SingleAssignmentDisposable(); + }; + + ScheduledItem.prototype.invoke = function () { + this.disposable.setDisposable(this.invokeCore()); + }; + + ScheduledItem.prototype.compareTo = function (other) { + return this.comparer(this.dueTime, other.dueTime); + }; + + ScheduledItem.prototype.isCancelled = function () { + return this.disposable.isDisposed; + }; + + ScheduledItem.prototype.invokeCore = function () { + return disposableFixup(this.action(this.scheduler, this.state)); + }; + + /** Provides a set of static properties to access commonly used schedulers. */ + var Scheduler = Rx.Scheduler = (function () { + + function Scheduler() { } + + /** Determines whether the given object is a scheduler */ + Scheduler.isScheduler = function (s) { + return s instanceof Scheduler; + }; + + var schedulerProto = Scheduler.prototype; + + /** + * Schedules an action to be executed. + * @param state State passed to the action to be executed. + * @param {Function} action Action to be executed. + * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). + */ + schedulerProto.schedule = function (state, action) { + throw new NotImplementedError(); + }; + + /** + * Schedules an action to be executed after dueTime. + * @param state State passed to the action to be executed. + * @param {Function} action Action to be executed. + * @param {Number} dueTime Relative time after which to execute the action. + * @returns {Disposable} The disposable object used to cancel the scheduled action (best effort). + */ + schedulerProto.scheduleFuture = function (state, dueTime, action) { + var dt = dueTime; + dt instanceof Date && (dt = dt - this.now()); + dt = Scheduler.normalize(dt); + + if (dt === 0) { return this.schedule(state, action); } + + return this._scheduleFuture(state, dt, action); + }; + + schedulerProto._scheduleFuture = function (state, dueTime, action) { + throw new NotImplementedError(); + }; + + /** Gets the current time according to the local machine's system clock. */ + Scheduler.now = defaultNow; + + /** Gets the current time according to the local machine's system clock. */ + Scheduler.prototype.now = defaultNow; + + /** + * Normalizes the specified TimeSpan value to a positive value. + * @param {Number} timeSpan The time span value to normalize. + * @returns {Number} The specified TimeSpan value if it is zero or positive; otherwise, 0 + */ + Scheduler.normalize = function (timeSpan) { + timeSpan < 0 && (timeSpan = 0); + return timeSpan; + }; + + return Scheduler; + }()); + + var normalizeTime = Scheduler.normalize, isScheduler = Scheduler.isScheduler; + + (function (schedulerProto) { + + function invokeRecImmediate(scheduler, pair) { + var state = pair[0], action = pair[1], group = new CompositeDisposable(); + action(state, innerAction); + return group; + + function innerAction(state2) { + var isAdded = false, isDone = false; + + var d = scheduler.schedule(state2, scheduleWork); + if (!isDone) { + group.add(d); + isAdded = true; + } + + function scheduleWork(_, state3) { + if (isAdded) { + group.remove(d); + } else { + isDone = true; + } + action(state3, innerAction); + return disposableEmpty; + } + } + } function invokeRecDate(scheduler, pair) { var state = pair[0], action = pair[1], group = new CompositeDisposable(); @@ -28514,501 +29110,6 @@ observableProto.flatMapLatest = observableProto.switchMap = function(selector, r /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) -/***/ }), -/* 30 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _asyncToGenerator2; - -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); -} - -var _slicedToArray2; - -function _load_slicedToArray() { - return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); -} - -var _validate; - -function _load_validate() { - return _validate = __webpack_require__(60); -} - -var _wrapper; - -function _load_wrapper() { - return _wrapper = _interopRequireDefault(__webpack_require__(15)); -} - -var _packageReference; - -function _load_packageReference() { - return _packageReference = _interopRequireDefault(__webpack_require__(353)); -} - -var _index; - -function _load_index() { - return _index = _interopRequireWildcard(__webpack_require__(52)); -} - -var _index2; - -function _load_index2() { - return _index2 = __webpack_require__(52); -} - -var _errors; - -function _load_errors() { - return _errors = __webpack_require__(3); -} - -var _misc; - -function _load_misc() { - return _misc = __webpack_require__(10); -} - -var _constants; - -function _load_constants() { - return _constants = _interopRequireWildcard(__webpack_require__(8)); -} - -var _version; - -function _load_version() { - return _version = _interopRequireWildcard(__webpack_require__(123)); -} - -var _fs; - -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(4)); -} - -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__(1); - -const invariant = __webpack_require__(7); -const semver = __webpack_require__(27); - -class PackageRequest { - constructor(req, resolver) { - this.parentRequest = req.parentRequest; - this.lockfile = resolver.lockfile; - this.registry = req.registry; - this.reporter = resolver.reporter; - this.resolver = resolver; - this.optional = req.optional; - this.pattern = req.pattern; - this.config = resolver.config; - - resolver.usedRegistries.add(req.registry); - } - - static getExoticResolver(pattern) { - // TODO make this type more refined - for (const _ref of (0, (_misc || _load_misc()).entries)((_index || _load_index()).exotics)) { - var _ref2 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref, 2); - - const Resolver = _ref2[1]; - - if (Resolver.isVersion(pattern)) { - return Resolver; - } - } - return null; - } - - getParentNames() { - const chain = []; - - let request = this.parentRequest; - while (request) { - const info = this.resolver.getStrictResolvedPattern(request.pattern); - chain.unshift(info.name); - - request = request.parentRequest; - } - - return chain; - } - - getLocked(remoteType) { - // always prioritise root lockfile - const shrunk = this.lockfile.getLocked(this.pattern); - - if (shrunk && shrunk.resolved) { - const resolvedParts = (_version || _load_version()).explodeHashedUrl(shrunk.resolved); - - return { - name: shrunk.name, - version: shrunk.version, - _uid: shrunk.uid, - _remote: { - resolved: shrunk.resolved, - type: remoteType, - reference: resolvedParts.url, - hash: resolvedParts.hash, - registry: shrunk.registry - }, - optionalDependencies: shrunk.optionalDependencies, - dependencies: shrunk.dependencies - }; - } else { - return null; - } - } - - /** - * If the input pattern matches a registry one then attempt to find it on the registry. - * Otherwise fork off to an exotic resolver if one matches. - */ - - findVersionOnRegistry(pattern) { - var _this = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - var _ref3 = yield _this.normalize(pattern); - - const range = _ref3.range, - name = _ref3.name; - - - const exoticResolver = PackageRequest.getExoticResolver(range); - if (exoticResolver) { - let data = yield _this.findExoticVersionInfo(exoticResolver, range); - - // clone data as we're manipulating it in place and this could be resolved multiple - // times - data = Object.assign({}, data); - - // this is so the returned package response uses the overridden name. ie. if the - // package's actual name is `bar`, but it's been specified in the manifest like: - // "foo": "http://foo.com/bar.tar.gz" - // then we use the foo name - data.name = name; - - return data; - } - - const Resolver = _this.getRegistryResolver(); - const resolver = new Resolver(_this, name, range); - return resolver.resolve(); - })(); - } - - /** - * Get the registry resolver associated with this package request. - */ - - getRegistryResolver() { - const Resolver = (_index2 || _load_index2()).registries[this.registry]; - if (Resolver) { - return Resolver; - } else { - throw new (_errors || _load_errors()).MessageError(this.reporter.lang('unknownRegistryResolver', this.registry)); - } - } - - normalizeRange(pattern) { - var _this2 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (pattern.includes(':') || pattern.includes('@') || PackageRequest.getExoticResolver(pattern)) { - return Promise.resolve(pattern); - } - - if (yield (_fs || _load_fs()).exists(path.join(_this2.config.cwd, pattern))) { - return Promise.resolve(`file:${pattern}`); - } - - return Promise.resolve(pattern); - })(); - } - - normalize(pattern) { - var _this3 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - var _PackageRequest$norma = PackageRequest.normalizePattern(pattern); - - const name = _PackageRequest$norma.name, - range = _PackageRequest$norma.range, - hasVersion = _PackageRequest$norma.hasVersion; - - const newRange = yield _this3.normalizeRange(range); - return { name, range: newRange, hasVersion }; - })(); - } - - /** - * Explode and normalize a pattern into it's name and range. - */ - - static normalizePattern(pattern) { - let hasVersion = false; - let range = 'latest'; - let name = pattern; - - // if we're a scope then remove the @ and add it back later - let isScoped = false; - if (name[0] === '@') { - isScoped = true; - name = name.slice(1); - } - - // take first part as the name - const parts = name.split('@'); - if (parts.length > 1) { - name = parts.shift(); - range = parts.join('@'); - - if (range) { - hasVersion = true; - } else { - range = '*'; - } - } - - // add back @ scope suffix - if (isScoped) { - name = `@${name}`; - } - - return { name, range, hasVersion }; - } - - /** - * Construct an exotic resolver instance with the input `ExoticResolver` and `range`. - */ - - findExoticVersionInfo(ExoticResolver, range) { - const resolver = new ExoticResolver(this, range); - return resolver.resolve(); - } - - /** - * If the current pattern matches an exotic resolver then delegate to it or else try - * the registry. - */ - - findVersionInfo() { - var _this4 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const exoticResolver = PackageRequest.getExoticResolver(_this4.pattern); - if (exoticResolver) { - return yield _this4.findExoticVersionInfo(exoticResolver, _this4.pattern); - } else { - return yield _this4.findVersionOnRegistry(_this4.pattern); - } - })(); - } - - reportResolvedRangeMatch(info, resolved) {} - - /** - * TODO description - */ - - find() { - var _this5 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // find version info for this package pattern - const info = yield _this5.findVersionInfo(); - if (!info) { - throw new (_errors || _load_errors()).MessageError(_this5.reporter.lang('unknownPackage', _this5.pattern)); - } - - (0, (_validate || _load_validate()).cleanDependencies)(info, false, _this5.reporter, function () { - // swallow warnings - }); - - // check if while we were resolving this dep we've already resolved one that satisfies - // the same range - - var _PackageRequest$norma2 = PackageRequest.normalizePattern(_this5.pattern); - - const range = _PackageRequest$norma2.range, - name = _PackageRequest$norma2.name; - - const resolved = _this5.resolver.getHighestRangeVersionMatch(name, range); - if (resolved) { - _this5.reportResolvedRangeMatch(info, resolved); - const ref = resolved._reference; - invariant(ref, 'Resolved package info has no package reference'); - ref.addRequest(_this5); - ref.addPattern(_this5.pattern, resolved); - return; - } - - if (info.flat && !_this5.resolver.flat) { - throw new (_errors || _load_errors()).MessageError(_this5.reporter.lang('flatGlobalError')); - } - - // validate version info - PackageRequest.validateVersionInfo(info, _this5.reporter); - - // - const remote = info._remote; - invariant(remote, 'Missing remote'); - - // set package reference - const ref = new (_packageReference || _load_packageReference()).default(_this5, info, remote); - ref.addPattern(_this5.pattern, info); - ref.addOptional(_this5.optional); - info._reference = ref; - info._remote = remote; - - // start installation of dependencies - const promises = []; - const deps = []; - - // normal deps - for (const depName in info.dependencies) { - const depPattern = depName + '@' + info.dependencies[depName]; - deps.push(depPattern); - promises.push(_this5.resolver.find({ - pattern: depPattern, - registry: remote.registry, - // dependencies of optional dependencies should themselves be optional - optional: _this5.optional, - parentRequest: _this5 - })); - } - - // optional deps - for (const depName in info.optionalDependencies) { - const depPattern = depName + '@' + info.optionalDependencies[depName]; - deps.push(depPattern); - promises.push(_this5.resolver.find({ - pattern: depPattern, - registry: remote.registry, - optional: true, - parentRequest: _this5 - })); - } - - yield Promise.all(promises); - ref.addDependencies(deps); - - // Now that we have all dependencies, it's safe to propagate optional - for (const otherRequest of ref.requests.slice(1)) { - ref.addOptional(otherRequest.optional); - } - })(); - } - - /** - * TODO description - */ - - static validateVersionInfo(info, reporter) { - // human readable name to use in errors - const human = `${info.name}@${info.version}`; - - info.version = PackageRequest.getPackageVersion(info); - - for (const key of (_constants || _load_constants()).REQUIRED_PACKAGE_KEYS) { - if (!info[key]) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('missingRequiredPackageKey', human, key)); - } - } - } - - /** - * Returns the package version if present, else defaults to the uid - */ - - static getPackageVersion(info) { - // TODO possibly reconsider this behaviour - return info.version === undefined ? info._uid : info.version; - } - - /** - * Gets all of the outdated packages and sorts them appropriately - */ - - static getOutdatedPackages(lockfile, install, config, reporter) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - var _ref4 = yield install.fetchRequestFromCwd(); - - const depReqPatterns = _ref4.requests; - - - const deps = yield Promise.all(depReqPatterns.map((() => { - var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (_ref6) { - let pattern = _ref6.pattern, - hint = _ref6.hint; - - const locked = lockfile.getLocked(pattern); - if (!locked) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('lockfileOutdated')); - } - - const name = locked.name, - current = locked.version; - - let latest = ''; - let wanted = ''; - let url = ''; - - const normalized = PackageRequest.normalizePattern(pattern); - - if (PackageRequest.getExoticResolver(pattern) || PackageRequest.getExoticResolver(normalized.range)) { - latest = wanted = 'exotic'; - url = normalized.range; - } else { - const registry = config.registries[locked.registry]; - - var _ref7 = yield registry.checkOutdated(config, name, normalized.range); - - latest = _ref7.latest; - wanted = _ref7.wanted; - url = _ref7.url; - } - - return { name, current, wanted, latest, url, hint }; - }); - - return function (_x) { - return _ref5.apply(this, arguments); - }; - })())); - - // Make sure to always output `exotic` versions to be compatible with npm - const isDepOld = function (_ref8) { - let current = _ref8.current, - latest = _ref8.latest, - wanted = _ref8.wanted; - return latest === 'exotic' || latest !== 'exotic' && (semver.lt(current, wanted) || semver.lt(current, latest)); - }; - const orderByName = function (depA, depB) { - return depA.name.localeCompare(depB.name); - }; - - return deps.filter(isDepOld).sort(orderByName); - })(); - } -} -exports.default = PackageRequest; - /***/ }), /* 31 */ /***/ (function(module, exports) { @@ -29116,11 +29217,11 @@ module.exports = Signature; var assert = __webpack_require__(9); var algs = __webpack_require__(17); -var crypto = __webpack_require__(6); +var crypto = __webpack_require__(7); var errs = __webpack_require__(32); var utils = __webpack_require__(13); -var asn1 = __webpack_require__(35); -var SSHBuffer = __webpack_require__(102); +var asn1 = __webpack_require__(34); +var SSHBuffer = __webpack_require__(108); var InvalidAlgorithmError = errs.InvalidAlgorithmError; var SignatureParseError = errs.SignatureParseError; @@ -29138,6 +29239,7 @@ function Signature(opts) { this.type = opts.type; this.hashAlgorithm = opts.hashAlgo; + this.curve = opts.curve; this.parts = opts.parts; this.part = partLookup; } @@ -29148,18 +29250,45 @@ Signature.prototype.toBuffer = function (format) { assert.string(format, 'format'); var buf; + var stype = 'ssh-' + this.type; switch (this.type) { case 'rsa': + switch (this.hashAlgorithm) { + case 'sha256': + stype = 'rsa-sha2-256'; + break; + case 'sha512': + stype = 'rsa-sha2-512'; + break; + case 'sha1': + case undefined: + break; + default: + throw (new Error('SSH signature ' + + 'format does not support hash ' + + 'algorithm ' + this.hashAlgorithm)); + } + if (format === 'ssh') { + buf = new SSHBuffer({}); + buf.writeString(stype); + buf.writePart(this.part.sig); + return (buf.toBuffer()); + } else { + return (this.part.sig.data); + } + break; + case 'ed25519': if (format === 'ssh') { buf = new SSHBuffer({}); - buf.writeString('ssh-' + this.type); + buf.writeString(stype); buf.writePart(this.part.sig); return (buf.toBuffer()); } else { return (this.part.sig.data); } + break; case 'dsa': case 'ecdsa': @@ -29238,11 +29367,9 @@ Signature.parse = function (data, type, format) { assert.ok(data.length > 0, 'signature must not be empty'); switch (opts.type) { case 'rsa': - return (parseOneNum(data, type, format, opts, - 'ssh-rsa')); + return (parseOneNum(data, type, format, opts)); case 'ed25519': - return (parseOneNum(data, type, format, opts, - 'ssh-ed25519')); + return (parseOneNum(data, type, format, opts)); case 'dsa': case 'ecdsa': @@ -29264,7 +29391,7 @@ Signature.parse = function (data, type, format) { } }; -function parseOneNum(data, type, format, opts, headType) { +function parseOneNum(data, type, format, opts) { if (format === 'ssh') { try { var buf = new SSHBuffer({buffer: data}); @@ -29272,7 +29399,30 @@ function parseOneNum(data, type, format, opts, headType) { } catch (e) { /* fall through */ } - if (head === headType) { + if (buf !== undefined) { + var msg = 'SSH signature does not match expected ' + + 'type (expected ' + type + ', got ' + head + ')'; + switch (head) { + case 'ssh-rsa': + assert.strictEqual(type, 'rsa', msg); + opts.hashAlgo = 'sha1'; + break; + case 'rsa-sha2-256': + assert.strictEqual(type, 'rsa', msg); + opts.hashAlgo = 'sha256'; + break; + case 'rsa-sha2-512': + assert.strictEqual(type, 'rsa', msg); + opts.hashAlgo = 'sha512'; + break; + case 'ssh-ed25519': + assert.strictEqual(type, 'ed25519', msg); + opts.hashAlgo = 'sha512'; + break; + default: + throw (new Error('Unknown SSH signature ' + + 'type: ' + head)); + } var sig = buf.readPart(); assert.ok(buf.atEnd(), 'extra trailing bytes'); sig.name = 'sig'; @@ -29316,7 +29466,26 @@ function parseECDSA(data, type, format, opts) { var r, s; var inner = buf.readBuffer(); - if (inner.toString('ascii').match(/^ecdsa-/)) { + var stype = inner.toString('ascii'); + if (stype.slice(0, 6) === 'ecdsa-') { + var parts = stype.split('-'); + assert.strictEqual(parts[0], 'ecdsa'); + assert.strictEqual(parts[1], 'sha2'); + opts.curve = parts[2]; + switch (opts.curve) { + case 'nistp256': + opts.hashAlgo = 'sha256'; + break; + case 'nistp384': + opts.hashAlgo = 'sha384'; + break; + case 'nistp521': + opts.hashAlgo = 'sha512'; + break; + default: + throw (new Error('Unsupported ECDSA curve: ' + + opts.curve)); + } inner = buf.readBuffer(); assert.ok(buf.atEnd(), 'extra trailing bytes on outer'); buf = new SSHBuffer({buffer: inner}); @@ -29359,12 +29528,6 @@ Signature._oldVersionDetect = function (obj) { /***/ }), /* 34 */ -/***/ (function(module, exports) { - -module.exports = require("events"); - -/***/ }), -/* 35 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2011 Mark Cavage All rights reserved. @@ -29372,7 +29535,7 @@ module.exports = require("events"); // 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__(314); +var Ber = __webpack_require__(319); @@ -29390,7 +29553,7 @@ module.exports = { /***/ }), -/* 36 */ +/* 35 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -29466,7 +29629,7 @@ function _load_misc() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/* 37 */ +/* 36 */ /***/ (function(module, exports, __webpack_require__) { try { @@ -29474,12 +29637,12 @@ try { if (typeof util.inherits !== 'function') throw ''; module.exports = util.inherits; } catch (e) { - module.exports = __webpack_require__(507); + module.exports = __webpack_require__(514); } /***/ }), -/* 38 */ +/* 37 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -29489,9 +29652,9 @@ try { var _ = __webpack_require__(21); var chalk = __webpack_require__(16); -var runAsync = __webpack_require__(99); -var Choices = __webpack_require__(510); -var ScreenManager = __webpack_require__(521); +var runAsync = __webpack_require__(105); +var Choices = __webpack_require__(517); +var ScreenManager = __webpack_require__(528); var Prompt = module.exports = function (question, rl, answers) { // Setup instance defaults property @@ -29622,12 +29785,12 @@ Prompt.prototype.getQuestion = function () { /***/ }), -/* 39 */ +/* 38 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var rx = __webpack_require__(100); +var rx = __webpack_require__(106); function normalizeKeypressEvents(value, key) { return {value: value, key: key || {}}; @@ -29674,2224 +29837,2350 @@ module.exports = function (rl) { /***/ }), -/* 40 */ +/* 39 */ /***/ (function(module, exports, __webpack_require__) { -// Copyright 2015 Joyent, Inc. +(function(){ -module.exports = { - read: read, - write: write -}; + // Copyright (c) 2005 Tom Wu + // All Rights Reserved. + // See "LICENSE" for details. -var assert = __webpack_require__(9); -var asn1 = __webpack_require__(35); -var crypto = __webpack_require__(6); -var algs = __webpack_require__(17); -var utils = __webpack_require__(13); -var Key = __webpack_require__(18); -var PrivateKey = __webpack_require__(19); - -var pkcs1 = __webpack_require__(160); -var pkcs8 = __webpack_require__(71); -var sshpriv = __webpack_require__(101); -var rfc4253 = __webpack_require__(47); - -var errors = __webpack_require__(32); - -/* - * For reading we support both PKCS#1 and PKCS#8. If we find a private key, - * we just take the public component of it and use that. - */ -function read(buf, options, forceType) { - var input = buf; - if (typeof (buf) !== 'string') { - assert.buffer(buf, 'buf'); - buf = buf.toString('ascii'); - } - - var lines = buf.trim().split('\n'); - - var m = lines[0].match(/*JSSTYLED*/ - /[-]+[ ]*BEGIN ([A-Z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/); - assert.ok(m, 'invalid PEM header'); + // Basic JavaScript BN library - subset useful for RSA encryption. - var m2 = lines[lines.length - 1].match(/*JSSTYLED*/ - /[-]+[ ]*END ([A-Z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/); - assert.ok(m2, 'invalid PEM footer'); + // Bits per digit + var dbits; - /* Begin and end banners must match key type */ - assert.equal(m[2], m2[2]); - var type = m[2].toLowerCase(); + // JavaScript engine analysis + var canary = 0xdeadbeefcafe; + var j_lm = ((canary&0xffffff)==0xefcafe); - var alg; - if (m[1]) { - /* They also must match algorithms, if given */ - assert.equal(m[1], m2[1], 'PEM header and footer mismatch'); - alg = m[1].trim(); - } + // (public) Constructor + function BigInteger(a,b,c) { + if(a != null) + if("number" == typeof a) this.fromNumber(a,b,c); + else if(b == null && "string" != typeof a) this.fromString(a,256); + else this.fromString(a,b); + } - var headers = {}; - while (true) { - lines = lines.slice(1); - m = lines[0].match(/*JSSTYLED*/ - /^([A-Za-z0-9-]+): (.+)$/); - if (!m) - break; - headers[m[1].toLowerCase()] = m[2]; - } + // return new, unset BigInteger + function nbi() { return new BigInteger(null); } - var cipher, key, iv; - if (headers['proc-type']) { - var parts = headers['proc-type'].split(','); - if (parts[0] === '4' && parts[1] === 'ENCRYPTED') { - if (typeof (options.passphrase) === 'string') { - options.passphrase = new Buffer( - options.passphrase, 'utf-8'); - } - if (!Buffer.isBuffer(options.passphrase)) { - throw (new errors.KeyEncryptedError( - options.filename, 'PEM')); - } else { - parts = headers['dek-info'].split(','); - assert.ok(parts.length === 2); - cipher = parts[0].toLowerCase(); - iv = new Buffer(parts[1], 'hex'); - key = utils.opensslKeyDeriv(cipher, iv, - options.passphrase, 1).key; - } - } - } + // am: Compute w_j += (x*this_i), propagate carries, + // c is initial carry, returns final carry. + // c < 3*dvalue, x < 2*dvalue, this_i < dvalue + // We need to select the fastest one that works in this environment. - /* Chop off the first and last lines */ - lines = lines.slice(0, -1).join(''); - buf = new Buffer(lines, 'base64'); + // am1: use a single mult and divide to get the high bits, + // max digit bits should be 26 because + // max internal value = 2*dvalue^2-2*dvalue (< 2^53) + function am1(i,x,w,j,c,n) { + while(--n >= 0) { + var v = x*this[i++]+w[j]+c; + c = Math.floor(v/0x4000000); + w[j++] = v&0x3ffffff; + } + return c; + } + // am2 avoids a big mult-and-extract completely. + // Max digit bits should be <= 30 because we do bitwise ops + // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) + function am2(i,x,w,j,c,n) { + var xl = x&0x7fff, xh = x>>15; + while(--n >= 0) { + var l = this[i]&0x7fff; + var h = this[i++]>>15; + var m = xh*l+h*xl; + l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); + c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); + w[j++] = l&0x3fffffff; + } + return c; + } + // Alternately, set max digit bits to 28 since some + // browsers slow down when dealing with 32-bit numbers. + function am3(i,x,w,j,c,n) { + var xl = x&0x3fff, xh = x>>14; + while(--n >= 0) { + var l = this[i]&0x3fff; + var h = this[i++]>>14; + var m = xh*l+h*xl; + l = xl*l+((m&0x3fff)<<14)+w[j]+c; + c = (l>>28)+(m>>14)+xh*h; + w[j++] = l&0xfffffff; + } + return c; + } + var inBrowser = typeof navigator !== "undefined"; + if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) { + BigInteger.prototype.am = am2; + dbits = 30; + } + else if(inBrowser && j_lm && (navigator.appName != "Netscape")) { + BigInteger.prototype.am = am1; + dbits = 26; + } + else { // Mozilla/Netscape seems to prefer am3 + BigInteger.prototype.am = am3; + dbits = 28; + } - if (cipher && key && iv) { - var cipherStream = crypto.createDecipheriv(cipher, key, iv); - var chunk, chunks = []; - cipherStream.once('error', function (e) { - if (e.toString().indexOf('bad decrypt') !== -1) { - throw (new Error('Incorrect passphrase ' + - 'supplied, could not decrypt key')); - } - throw (e); - }); - cipherStream.write(buf); - cipherStream.end(); - while ((chunk = cipherStream.read()) !== null) - chunks.push(chunk); - buf = Buffer.concat(chunks); - } + BigInteger.prototype.DB = dbits; + BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i]; + r.t = this.t; + r.s = this.s; + } -function write(key, options, type) { - assert.object(key); + // (protected) set from integer value x, -DV <= x < DV + function bnpFromInt(x) { + this.t = 1; + this.s = (x<0)?-1:0; + if(x > 0) this[0] = x; + else if(x < -1) this[0] = x+this.DV; + else this.t = 0; + } - var alg = {'ecdsa': 'EC', 'rsa': 'RSA', 'dsa': 'DSA'}[key.type]; - var header; + // return bigint initialized to value + function nbv(i) { var r = nbi(); r.fromInt(i); return r; } - var der = new asn1.BerWriter(); + // (protected) set from string and radix + function bnpFromString(s,b) { + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 256) k = 8; // byte array + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else { this.fromRadix(s,b); return; } + this.t = 0; + this.s = 0; + var i = s.length, mi = false, sh = 0; + while(--i >= 0) { + var x = (k==8)?s[i]&0xff:intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-") mi = true; + continue; + } + mi = false; + if(sh == 0) + this[this.t++] = x; + else if(sh+k > this.DB) { + this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); + } + else + this[this.t-1] |= x<= this.DB) sh -= this.DB; + } + if(k == 8 && (s[0]&0x80) != 0) { + this.s = -1; + if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t; + } - } else if (Key.isKey(key)) { - if (type && type === 'pkcs1') { - header = alg + ' PUBLIC KEY'; - pkcs1.writePkcs1(der, key); - } else { - if (type) - assert.strictEqual(type, 'pkcs8'); - header = 'PUBLIC KEY'; - pkcs8.writePkcs8(der, key); - } + // (public) return string representation in given radix + function bnToString(b) { + if(this.s < 0) return "-"+this.negate().toString(b); + var k; + if(b == 16) k = 4; + else if(b == 8) k = 3; + else if(b == 2) k = 1; + else if(b == 32) k = 5; + else if(b == 4) k = 2; + else return this.toRadix(b); + var km = (1< 0) { + if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } + while(i >= 0) { + if(p < k) { + d = (this[i]&((1<>(p+=this.DB-k); + } + else { + d = (this[i]>>(p-=k))&km; + if(p <= 0) { p += this.DB; --i; } + } + if(d > 0) m = true; + if(m) r += int2char(d); + } + } + return m?r:"0"; + } - } else { - throw (new Error('key is not a Key or PrivateKey')); - } + // (public) -this + function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } - var tmp = der.buffer.toString('base64'); - var len = tmp.length + (tmp.length / 64) + - 18 + 16 + header.length*2 + 10; - var buf = new Buffer(len); - var o = 0; - o += buf.write('-----BEGIN ' + header + '-----\n', o); - for (var i = 0; i < tmp.length; ) { - var limit = i + 64; - if (limit > tmp.length) - limit = tmp.length; - o += buf.write(tmp.slice(i, limit), o); - buf[o++] = 10; - i = limit; - } - o += buf.write('-----END ' + header + '-----\n', o); + // (public) |this| + function bnAbs() { return (this.s<0)?this.negate():this; } - return (buf.slice(0, o)); -} + // (public) return + if this > a, - if this < a, 0 if equal + function bnCompareTo(a) { + var r = this.s-a.s; + if(r != 0) return r; + var i = this.t; + r = i-a.t; + if(r != 0) return (this.s<0)?-r:r; + while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; + return 0; + } + // returns bit length of the integer x + function nbits(x) { + var r = 1, t; + if((t=x>>>16) != 0) { x = t; r += 16; } + if((t=x>>8) != 0) { x = t; r += 8; } + if((t=x>>4) != 0) { x = t; r += 4; } + if((t=x>>2) != 0) { x = t; r += 2; } + if((t=x>>1) != 0) { x = t; r += 1; } + return r; + } -/***/ }), -/* 41 */ -/***/ (function(module, exports, __webpack_require__) { + // (public) return the number of bits in "this" + function bnBitLength() { + if(this.t <= 0) return 0; + return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); + } -"use strict"; + // (protected) r = this << n*DB + function bnpDLShiftTo(n,r) { + var i; + for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; + for(i = n-1; i >= 0; --i) r[i] = 0; + r.t = this.t+n; + r.s = this.s; + } + // (protected) r = this >> n*DB + function bnpDRShiftTo(n,r) { + for(var i = n; i < this.t; ++i) r[i-n] = this[i]; + r.t = Math.max(this.t-n,0); + r.s = this.s; + } + // (protected) r = this << n + function bnpLShiftTo(n,r) { + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<= 0; --i) { + r[i+ds+1] = (this[i]>>cbs)|c; + c = (this[i]&bm)<= 0; --i) r[i] = 0; + r[ds] = c; + r.t = this.t+ds+1; + r.s = this.s; + r.clamp(); + } -module.exports = { - copy: copy, - checkDataType: checkDataType, - checkDataTypes: checkDataTypes, - coerceToTypes: coerceToTypes, - toHash: toHash, - getProperty: getProperty, - escapeQuotes: escapeQuotes, - ucs2length: __webpack_require__(284), - varOccurences: varOccurences, - varReplace: varReplace, - cleanUpCode: cleanUpCode, - cleanUpVarErrors: cleanUpVarErrors, - schemaHasRules: schemaHasRules, - schemaHasRulesExcept: schemaHasRulesExcept, - stableStringify: __webpack_require__(150), - toQuotedString: toQuotedString, - getPathExpr: getPathExpr, - getPath: getPath, - getData: getData, - unescapeFragment: unescapeFragment, - escapeFragment: escapeFragment, - escapeJsonPointer: escapeJsonPointer -}; + // (protected) r = this >> n + function bnpRShiftTo(n,r) { + r.s = this.s; + var ds = Math.floor(n/this.DB); + if(ds >= this.t) { r.t = 0; return; } + var bs = n%this.DB; + var cbs = this.DB-bs; + var bm = (1<>bs; + for(var i = ds+1; i < this.t; ++i) { + r[i-ds-1] |= (this[i]&bm)<>bs; + } + if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB; + } + if(a.t < this.t) { + c -= a.s; + while(i < this.t) { + c += this[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while(i < a.t) { + c -= a[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c -= a.s; + } + r.s = (c<0)?-1:0; + if(c < -1) r[i++] = this.DV+c; + else if(c > 0) r[i++] = c; + r.t = i; + r.clamp(); + } -function copy(o, to) { - to = to || {}; - for (var key in o) to[key] = o[key]; - return to; -} + // (protected) r = this * a, r != this,a (HAC 14.12) + // "this" should be the larger one if appropriate. + function bnpMultiplyTo(a,r) { + var x = this.abs(), y = a.abs(); + var i = x.t; + r.t = i+y.t; + while(--i >= 0) r[i] = 0; + for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); + r.s = 0; + r.clamp(); + if(this.s != a.s) BigInteger.ZERO.subTo(r,r); + } + // (protected) r = this^2, r != this (HAC 14.16) + function bnpSquareTo(r) { + var x = this.abs(); + var i = r.t = 2*x.t; + while(--i >= 0) r[i] = 0; + for(i = 0; i < x.t-1; ++i) { + var c = x.am(i,x[i],r,2*i,0,1); + if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { + r[i+x.t] -= x.DV; + r[i+x.t+1] = 1; + } + } + if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); + r.s = 0; + r.clamp(); + } -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; + // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) + // r != q, this != m. q or r may be null. + function bnpDivRemTo(m,q,r) { + var pm = m.abs(); + if(pm.t <= 0) return; + var pt = this.abs(); + if(pt.t < pm.t) { + if(q != null) q.fromInt(0); + if(r != null) this.copyTo(r); + return; } - if (types.number) delete types.integer; - for (var t in types) - code += (code ? ' && ' : '' ) + checkDataType(t, data, true); - - return code; - } -} - + if(r == null) r = nbi(); + var y = nbi(), ts = this.s, ms = m.s; + var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus + if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } + else { pm.copyTo(y); pt.copyTo(r); } + var ys = y.t; + var y0 = y[ys-1]; + if(y0 == 0) return; + var yt = y0*(1<1)?y[ys-2]>>this.F2:0); + var d1 = this.FV/yt, d2 = (1<= 0) { + r[r.t++] = 1; + r.subTo(t,r); + } + BigInteger.ONE.dlShiftTo(ys,t); + t.subTo(y,y); // "negative" y so we can replace sub with am later + while(y.t < ys) y[y.t++] = 0; + while(--j >= 0) { + // Estimate quotient digit + var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); + if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out + y.dlShiftTo(j,t); + r.subTo(t,r); + while(r[i] < --qd) r.subTo(t,r); + } + } + if(q != null) { + r.drShiftTo(ys,q); + if(ts != ms) BigInteger.ZERO.subTo(q,q); + } + r.t = ys; + r.clamp(); + if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder + if(ts < 0) BigInteger.ZERO.subTo(r,r); + } -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 0) a.subTo(r,r); + return r; } - if (types.length) return types; - } else if (COERCE_TO_TYPES[dataTypes]) { - return [dataTypes]; - } else if (optionCoerceTypes === 'array' && dataTypes === 'array') { - return ['array']; - } -} + // Modular reduction using "classic" algorithm + function Classic(m) { this.m = m; } + function cConvert(x) { + if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); + else return x; + } + function cRevert(x) { return x; } + function cReduce(x) { x.divRemTo(this.m,null,x); } + function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } -function toHash(arr) { - var hash = {}; - for (var i=0; i0)?this.DV-y:-y; + } -var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i; -var SINGLE_QUOTE = /'|\\/g; -function getProperty(key) { - return typeof key == 'number' - ? '[' + key + ']' - : IDENTIFIER.test(key) - ? '.' + key - : "['" + escapeQuotes(key) + "']"; -} + // Montgomery reduction + function Montgomery(m) { + this.m = m; + this.mp = m.invDigit(); + this.mpl = this.mp&0x7fff; + this.mph = this.mp>>15; + this.um = (1<<(m.DB-15))-1; + this.mt2 = 2*m.t; + } + // xR mod m + function montConvert(x) { + var r = nbi(); + x.abs().dlShiftTo(this.m.t,r); + r.divRemTo(this.m,null,r); + if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); + return r; + } -function escapeQuotes(str) { - return str.replace(SINGLE_QUOTE, '\\$&') - .replace(/\n/g, '\\n') - .replace(/\r/g, '\\r') - .replace(/\f/g, '\\f') - .replace(/\t/g, '\\t'); -} + // x/R mod m + function montRevert(x) { + var r = nbi(); + x.copyTo(r); + this.reduce(r); + return r; + } + // x = x/R mod m (HAC 14.32) + function montReduce(x) { + while(x.t <= this.mt2) // pad x so am has enough room later + x[x.t++] = 0; + for(var i = 0; i < this.m.t; ++i) { + // faster way of calculating u0 = x[i]*mp mod DV + var j = x[i]&0x7fff; + var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; + // use am to combine the multiply-shift-add into one call + j = i+this.m.t; + x[j] += this.m.am(0,u0,x,i,0,this.m.t); + // propagate carry + while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } + } + x.clamp(); + x.drShiftTo(this.m.t,x); + if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + } -function varOccurences(str, dataVar) { - dataVar += '[^0-9]'; - var matches = str.match(new RegExp(dataVar, 'g')); - return matches ? matches.length : 0; -} + // r = "x^2/R mod m"; x != r + function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + // r = "xy/R mod m"; x,y != r + function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } -function varReplace(str, dataVar, expr) { - dataVar += '([^0-9])'; - expr = expr.replace(/\$/g, '$$$$'); - return str.replace(new RegExp(dataVar, 'g'), expr + '$1'); -} + Montgomery.prototype.convert = montConvert; + Montgomery.prototype.revert = montRevert; + Montgomery.prototype.reduce = montReduce; + Montgomery.prototype.mulTo = montMulTo; + Montgomery.prototype.sqrTo = montSqrTo; + // (protected) true iff this is even + function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } -var EMPTY_ELSE = /else\s*{\s*}/g - , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g - , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g; -function cleanUpCode(out) { - return out.replace(EMPTY_ELSE, '') - .replace(EMPTY_IF_NO_ELSE, '') - .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))'); -} + // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) + function bnpExp(e,z) { + if(e > 0xffffffff || e < 1) return BigInteger.ONE; + var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; + g.copyTo(r); + while(--i >= 0) { + z.sqrTo(r,r2); + if((e&(1< 0) z.mulTo(r2,g,r); + else { var t = r; r = r2; r2 = t; } + } + return z.revert(r); + } + // (public) this^e % m, 0 <= e < 2^32 + function bnModPowInt(e,m) { + var z; + if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); + return this.exp(e,z); + } -var ERRORS_REGEXP = /[^v\.]errors/g - , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g - , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g - , RETURN_VALID = 'return errors === 0;' - , RETURN_TRUE = 'validate.errors = null; return true;' - , RETURN_ASYNC = /if \(errors === 0\) return true;\s*else throw new ValidationError\(vErrors\);/ - , RETURN_TRUE_ASYNC = 'return true;'; + // protected + BigInteger.prototype.copyTo = bnpCopyTo; + BigInteger.prototype.fromInt = bnpFromInt; + BigInteger.prototype.fromString = bnpFromString; + BigInteger.prototype.clamp = bnpClamp; + BigInteger.prototype.dlShiftTo = bnpDLShiftTo; + BigInteger.prototype.drShiftTo = bnpDRShiftTo; + BigInteger.prototype.lShiftTo = bnpLShiftTo; + BigInteger.prototype.rShiftTo = bnpRShiftTo; + BigInteger.prototype.subTo = bnpSubTo; + BigInteger.prototype.multiplyTo = bnpMultiplyTo; + BigInteger.prototype.squareTo = bnpSquareTo; + BigInteger.prototype.divRemTo = bnpDivRemTo; + BigInteger.prototype.invDigit = bnpInvDigit; + BigInteger.prototype.isEven = bnpIsEven; + BigInteger.prototype.exp = bnpExp; -function cleanUpVarErrors(out, async) { - var matches = out.match(ERRORS_REGEXP); - if (!matches || matches.length !== 2) return out; - return async - ? out.replace(REMOVE_ERRORS_ASYNC, '') - .replace(RETURN_ASYNC, RETURN_TRUE_ASYNC) - : out.replace(REMOVE_ERRORS, '') - .replace(RETURN_VALID, RETURN_TRUE); -} + // public + BigInteger.prototype.toString = bnToString; + BigInteger.prototype.negate = bnNegate; + BigInteger.prototype.abs = bnAbs; + BigInteger.prototype.compareTo = bnCompareTo; + BigInteger.prototype.bitLength = bnBitLength; + BigInteger.prototype.mod = bnMod; + BigInteger.prototype.modPowInt = bnModPowInt; + // "constants" + BigInteger.ZERO = nbv(0); + BigInteger.ONE = nbv(1); -function schemaHasRules(schema, rules) { - for (var key in schema) if (rules[key]) return true; -} + // Copyright (c) 2005-2009 Tom Wu + // All Rights Reserved. + // See "LICENSE" for details. + // Extended JavaScript BN functions, required for RSA private ops. -function schemaHasRulesExcept(schema, rules, exceptKeyword) { - for (var key in schema) if (key != exceptKeyword && rules[key]) return true; -} + // Version 1.1: new BigInteger("0", 10) returns "proper" zero + // Version 1.2: square() API, isProbablePrime fix + // (public) + function bnClone() { var r = nbi(); this.copyTo(r); return r; } -function toQuotedString(str) { - return '\'' + escapeQuotes(str) + '\''; -} + // (public) return value as integer + function bnIntValue() { + if(this.s < 0) { + if(this.t == 1) return this[0]-this.DV; + else if(this.t == 0) return -1; + } + else if(this.t == 1) return this[0]; + else if(this.t == 0) return 0; + // assumes 16 < DB < 32 + return ((this[1]&((1<<(32-this.DB))-1))<>24; } -function getPathExpr(currentPath, expr, jsonPointers, isNumber) { - var path = jsonPointers // false by default - ? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')') - : (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\''); - return joinPaths(currentPath, path); -} + // (public) return value as short (assumes DB>=16) + function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } + // (protected) return x s.t. r^x < DV + function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } -function getPath(currentPath, prop, jsonPointers) { - var path = jsonPointers // false by default - ? toQuotedString('/' + escapeJsonPointer(prop)) - : toQuotedString(getProperty(prop)); - return joinPaths(currentPath, path); -} + // (public) 0 if this == 0, 1 if this > 0 + function bnSigNum() { + if(this.s < 0) return -1; + else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; + else return 1; + } + // (protected) convert to radix string + function bnpToRadix(b) { + if(b == null) b = 10; + if(this.signum() == 0 || b < 2 || b > 36) return "0"; + var cs = this.chunkSize(b); + var a = Math.pow(b,cs); + var d = nbv(a), y = nbi(), z = nbi(), r = ""; + this.divRemTo(d,y,z); + while(y.signum() > 0) { + r = (a+z.intValue()).toString(b).substr(1) + r; + y.divRemTo(d,y,z); + } + return z.intValue().toString(b) + r; + } -var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; -var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; -function getData($data, lvl, paths) { - var up, jsonPointer, data, matches; - if ($data === '') return 'rootData'; - if ($data[0] == '/') { - if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data); - jsonPointer = $data; - data = 'rootData'; - } else { - matches = $data.match(RELATIVE_JSON_POINTER); - if (!matches) throw new Error('Invalid JSON-pointer: ' + $data); - up = +matches[1]; - jsonPointer = matches[2]; - if (jsonPointer == '#') { - if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); - return paths[lvl - up]; + // (protected) convert from radix string + function bnpFromRadix(s,b) { + this.fromInt(0); + if(b == null) b = 10; + var cs = this.chunkSize(b); + var d = Math.pow(b,cs), mi = false, j = 0, w = 0; + for(var i = 0; i < s.length; ++i) { + var x = intAt(s,i); + if(x < 0) { + if(s.charAt(i) == "-" && this.signum() == 0) mi = true; + continue; + } + w = b*w+x; + if(++j >= cs) { + this.dMultiply(d); + this.dAddOffset(w,0); + j = 0; + w = 0; + } + } + if(j > 0) { + this.dMultiply(Math.pow(b,j)); + this.dAddOffset(w,0); + } + if(mi) BigInteger.ZERO.subTo(this,this); } - if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); - data = 'data' + ((lvl - up) || ''); - if (!jsonPointer) return data; - } + // (protected) alternate constructor + function bnpFromNumber(a,b,c) { + if("number" == typeof b) { + // new BigInteger(int,int,RNG) + if(a < 2) this.fromInt(1); + else { + this.fromNumber(a,c); + if(!this.testBit(a-1)) // force MSB set + this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); + if(this.isEven()) this.dAddOffset(1,0); // force odd + while(!this.isProbablePrime(b)) { + this.dAddOffset(2,0); + if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); + } + } + } + else { + // new BigInteger(int,RNG) + var x = new Array(), t = a&7; + x.length = (a>>3)+1; + b.nextBytes(x); + if(t > 0) x[0] &= ((1< 0) { + if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p) + r[k++] = d|(this.s<<(this.DB-p)); + while(i >= 0) { + if(p < 8) { + d = (this[i]&((1<>(p+=this.DB-8); + } + else { + d = (this[i]>>(p-=8))&0xff; + if(p <= 0) { p += this.DB; --i; } + } + if((d&0x80) != 0) d |= -256; + if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; + if(k > 0 || d != this.s) r[k++] = d; + } + } + return r; } - } - return expr; -} + function bnEquals(a) { return(this.compareTo(a)==0); } + function bnMin(a) { return(this.compareTo(a)<0)?this:a; } + function bnMax(a) { return(this.compareTo(a)>0)?this:a; } -function joinPaths (a, b) { - if (a == '""') return b; - return (a + ' + ' + b).replace(/' \+ '/g, ''); -} + // (protected) r = this op a (bitwise) + function bnpBitwiseTo(a,op,r) { + var i, f, m = Math.min(a.t,this.t); + for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]); + if(a.t < this.t) { + f = a.s&this.DM; + for(i = m; i < this.t; ++i) r[i] = op(this[i],f); + r.t = this.t; + } + else { + f = this.s&this.DM; + for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); + r.t = a.t; + } + r.s = op(this.s,a.s); + r.clamp(); + } + // (public) this & a + function op_and(x,y) { return x&y; } + function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } -function unescapeFragment(str) { - return unescapeJsonPointer(decodeURIComponent(str)); -} + // (public) this | a + function op_or(x,y) { return x|y; } + function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } + // (public) this ^ a + function op_xor(x,y) { return x^y; } + function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } -function escapeFragment(str) { - return encodeURIComponent(escapeJsonPointer(str)); -} + // (public) this & ~a + function op_andnot(x,y) { return x&~y; } + function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } + // (public) ~this + function bnNot() { + var r = nbi(); + for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; + r.t = this.t; + r.s = ~this.s; + return r; + } -function escapeJsonPointer(str) { - return str.replace(/~/g, '~0').replace(/\//g, '~1'); -} - - -function unescapeJsonPointer(str) { - return str.replace(/~1/g, '/').replace(/~0/g, '~'); -} - - -/***/ }), -/* 42 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _slicedToArray2; - -function _load_slicedToArray() { - return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); -} - -var _asyncToGenerator2; - -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); -} - -var _fs; + // (public) this << n + function bnShiftLeft(n) { + var r = nbi(); + if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); + return r; + } -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(4)); -} + // (public) this >> n + function bnShiftRight(n) { + var r = nbi(); + if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); + return r; + } -var _npmResolver; + // return index of lowest 1-bit in x, x < 2^31 + function lbit(x) { + if(x == 0) return -1; + var r = 0; + if((x&0xffff) == 0) { x >>= 16; r += 16; } + if((x&0xff) == 0) { x >>= 8; r += 8; } + if((x&0xf) == 0) { x >>= 4; r += 4; } + if((x&3) == 0) { x >>= 2; r += 2; } + if((x&1) == 0) ++r; + return r; + } -function _load_npmResolver() { - return _npmResolver = _interopRequireDefault(__webpack_require__(119)); -} + // (public) returns index of lowest 1-bit (or -1 if none) + function bnGetLowestSetBit() { + for(var i = 0; i < this.t; ++i) + if(this[i] != 0) return i*this.DB+lbit(this[i]); + if(this.s < 0) return this.t*this.DB; + return -1; + } -var _envReplace; + // return number of 1 bits in x + function cbit(x) { + var r = 0; + while(x != 0) { x &= x-1; ++r; } + return r; + } -function _load_envReplace() { - return _envReplace = _interopRequireDefault(__webpack_require__(372)); -} + // (public) return number of set bits + function bnBitCount() { + var r = 0, x = this.s&this.DM; + for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); + return r; + } -var _baseRegistry; + // (public) true iff nth bit is set + function bnTestBit(n) { + var j = Math.floor(n/this.DB); + if(j >= this.t) return(this.s!=0); + return((this[j]&(1<<(n%this.DB)))!=0); + } -function _load_baseRegistry() { - return _baseRegistry = _interopRequireDefault(__webpack_require__(355)); -} + // (protected) this op (1<>= this.DB; + } + if(a.t < this.t) { + c += a.s; + while(i < this.t) { + c += this[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += this.s; + } + else { + c += this.s; + while(i < a.t) { + c += a[i]; + r[i++] = c&this.DM; + c >>= this.DB; + } + c += a.s; + } + r.s = (c<0)?-1:0; + if(c > 0) r[i++] = c; + else if(c < -1) r[i++] = this.DV+c; + r.t = i; + r.clamp(); + } -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; } } + // (public) this + a + function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + // (public) this - a + function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } -const userHome = __webpack_require__(122).default; + // (public) this * a + function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } -const path = __webpack_require__(1); -const url = __webpack_require__(11); -const ini = __webpack_require__(508); + // (public) this^2 + function bnSquare() { var r = nbi(); this.squareTo(r); return r; } -const DEFAULT_REGISTRY = 'https://registry.npmjs.org/'; + // (public) this / a + function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } -function getGlobalPrefix() { - if (process.env.PREFIX) { - return process.env.PREFIX; - } else if (process.platform === 'win32') { - // c:\node\node.exe --> prefix=c:\node\ - return path.dirname(process.execPath); - } else { - // /usr/local/bin/node --> prefix=/usr/local - let prefix = path.dirname(path.dirname(process.execPath)); + // (public) this % a + function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } - // destdir only is respected on Unix - if (process.env.DESTDIR) { - prefix = path.join(process.env.DESTDIR, prefix); + // (public) [this/a,this%a] + function bnDivideAndRemainder(a) { + var q = nbi(), r = nbi(); + this.divRemTo(a,q,r); + return new Array(q,r); } - return prefix; - } -} + // (protected) this *= n, this >= 0, 1 < n < DV + function bnpDMultiply(n) { + this[this.t] = this.am(0,n-1,this,0,0,this.t); + ++this.t; + this.clamp(); + } -class NpmRegistry extends (_baseRegistry || _load_baseRegistry()).default { - constructor(cwd, registries, requestManager, reporter) { - super(cwd, registries, requestManager, reporter); - this.folder = 'node_modules'; - } + // (protected) this += n << w words, this >= 0 + function bnpDAddOffset(n,w) { + if(n == 0) return; + while(this.t <= w) this[this.t++] = 0; + this[w] += n; + while(this[w] >= this.DV) { + this[w] -= this.DV; + if(++w >= this.t) this[this.t++] = 0; + ++this[w]; + } + } - static escapeName(name) { - // scoped packages contain slashes and the npm registry expects them to be escaped - return name.replace('/', '%2f'); - } + // A "null" reducer + function NullExp() {} + function nNop(x) { return x; } + function nMulTo(x,y,r) { x.multiplyTo(y,r); } + function nSqrTo(x,r) { x.squareTo(r); } - request(pathname) { - let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + NullExp.prototype.convert = nNop; + NullExp.prototype.revert = nNop; + NullExp.prototype.mulTo = nMulTo; + NullExp.prototype.sqrTo = nSqrTo; - const registry = (0, (_misc || _load_misc()).addSuffix)(this.getRegistry(pathname), '/'); - const requestUrl = url.resolve(registry, pathname); - const alwaysAuth = this.getScopedOption(registry.replace(/^https?:/, ''), 'always-auth') || this.getOption('always-auth') || (0, (_misc || _load_misc()).removePrefix)(requestUrl, registry)[0] === '@'; + // (public) this^e + function bnPow(e) { return this.exp(e,new NullExp()); } - const headers = Object.assign({ - 'Accept': 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' - }, opts.headers); - if (this.token || alwaysAuth && (0, (_isRequestToRegistry || _load_isRequestToRegistry()).default)(requestUrl, registry)) { - const authorization = this.getAuth(pathname); - if (authorization) { - headers.authorization = authorization; - } + // (protected) r = lower n words of "this * a", a.t <= n + // "this" should be the larger one if appropriate. + function bnpMultiplyLowerTo(a,n,r) { + var i = Math.min(this.t+a.t,n); + r.s = 0; // assumes a,this >= 0 + r.t = i; + while(i > 0) r[--i] = 0; + var j; + for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); + for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); + r.clamp(); } - return this.requestManager.request({ - url: requestUrl, - method: opts.method, - body: opts.body, - auth: opts.auth, - headers, - json: !opts.buffer, - buffer: opts.buffer, - process: opts.process, - gzip: true - }); - } - - checkOutdated(config, name, range) { - var _this = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const req = yield _this.request(NpmRegistry.escapeName(name)); - if (!req) { - throw new Error('couldnt find ' + name); - } + // (protected) r = "this * a" without lower n words, n > 0 + // "this" should be the larger one if appropriate. + function bnpMultiplyUpperTo(a,n,r) { + --n; + var i = r.t = this.t+a.t-n; + r.s = 0; // assumes a,this >= 0 + while(--i >= 0) r[i] = 0; + for(i = Math.max(n-this.t,0); i < a.t; ++i) + r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); + r.clamp(); + r.drShiftTo(1,r); + } - const repository = req.repository, - homepage = req.homepage; + // Barrett modular reduction + function Barrett(m) { + // setup Barrett + this.r2 = nbi(); + this.q3 = nbi(); + BigInteger.ONE.dlShiftTo(2*m.t,this.r2); + this.mu = this.r2.divide(m); + this.m = m; + } - const url = homepage || repository && repository.url || ''; + function barrettConvert(x) { + if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); + else if(x.compareTo(this.m) < 0) return x; + else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } + } - return { - latest: req['dist-tags'].latest, - wanted: (yield (_npmResolver || _load_npmResolver()).default.findVersionInRegistryResponse(config, range, req)).version, - url - }; - })(); - } + function barrettRevert(x) { return x; } - getPossibleConfigLocations(filename, reporter) { - var _this2 = this; + // x = x mod m (HAC 14.42) + function barrettReduce(x) { + x.drShiftTo(this.m.t-1,this.r2); + if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } + this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); + this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); + while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); + x.subTo(this.r2,x); + while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); + } - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const possibles = [[false, path.join(_this2.cwd, filename)], [true, _this2.config.userconfig || path.join(userHome, filename)], [false, path.join(getGlobalPrefix(), filename)]]; + // r = x^2 mod m; x != r + function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - const foldersFromRootToCwd = _this2.cwd.split(path.sep); - while (foldersFromRootToCwd.length > 1) { - possibles.push([false, path.join(foldersFromRootToCwd.join(path.sep), filename)]); - foldersFromRootToCwd.pop(); - } + // r = x*y mod m; x,y != r + function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - const actuals = []; - for (const _ref of possibles) { - var _ref2 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref, 2); + Barrett.prototype.convert = barrettConvert; + Barrett.prototype.revert = barrettRevert; + Barrett.prototype.reduce = barrettReduce; + Barrett.prototype.mulTo = barrettMulTo; + Barrett.prototype.sqrTo = barrettSqrTo; - const isHome = _ref2[0]; - const loc = _ref2[1]; + // (public) this^e % m (HAC 14.85) + function bnModPow(e,m) { + var i = e.bitLength(), k, r = nbv(1), z; + if(i <= 0) return r; + else if(i < 18) k = 1; + else if(i < 48) k = 3; + else if(i < 144) k = 4; + else if(i < 768) k = 5; + else k = 6; + if(i < 8) + z = new Classic(m); + else if(m.isEven()) + z = new Barrett(m); + else + z = new Montgomery(m); - reporter.verbose(reporter.lang('configPossibleFile', loc)); - if (yield (_fs || _load_fs()).exists(loc)) { - reporter.verbose(reporter.lang('configFileFound', loc)); - actuals.push([isHome, loc, yield (_fs || _load_fs()).readFile(loc)]); + // precomputation + var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { + var g2 = nbi(); + z.sqrTo(g[1],g2); + while(n <= km) { + g[n] = nbi(); + z.mulTo(g2,g[n-2],g[n]); + n += 2; } } - return actuals; - })(); - } - - loadConfig() { - var _this3 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // docs: https://docs.npmjs.com/misc/config - _this3.mergeEnv('npm_config_'); - - for (const _ref3 of yield _this3.getPossibleConfigLocations('.npmrc', _this3.reporter)) { - var _ref4 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref3, 3); - - const loc = _ref4[1]; - const file = _ref4[2]; - const config = (_baseRegistry || _load_baseRegistry()).default.normalizeConfig(ini.parse(file)); - for (const key in config) { - config[key] = (0, (_envReplace || _load_envReplace()).default)(config[key]); + var j = e.t-1, w, is1 = true, r2 = nbi(), t; + i = nbits(e[j])-1; + while(j >= 0) { + if(i >= k1) w = (e[j]>>(i-k1))&km; + else { + w = (e[j]&((1<<(i+1))-1))<<(k1-i); + if(j > 0) w |= e[j-1]>>(this.DB+i-k1); } - // normalize offline mirror path relative to the current npmrc - const offlineLoc = config['yarn-offline-mirror']; - // don't normalize if we already have a mirror path - if (!_this3.config['yarn-offline-mirror'] && offlineLoc) { - const mirrorLoc = config['yarn-offline-mirror'] = path.resolve(path.dirname(loc), offlineLoc); - yield (_fs || _load_fs()).mkdirp(mirrorLoc); + n = k; + while((w&1) == 0) { w >>= 1; --n; } + if((i -= n) < 0) { i += this.DB; --j; } + if(is1) { // ret == 1, don't bother squaring or multiplying it + g[w].copyTo(r); + is1 = false; + } + else { + while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } + if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } + z.mulTo(r2,g[w],r); } - _this3.config = Object.assign({}, config, _this3.config); - } - })(); - } - - getScope(packageName) { - return !packageName || packageName[0] !== '@' ? '' : packageName.split(/\/|%2f/)[0]; - } - - getRegistry(packageName) { - // Try extracting registry from the url, then scoped registry, and default registry - if (packageName.match(/^https?:/)) { - const availableRegistries = this.getAvailableRegistries(); - const registry = availableRegistries.find(registry => packageName.startsWith(registry)); - if (registry) { - return registry; + while(j >= 0 && (e[j]&(1< 0) { + x.rShiftTo(g,x); + y.rShiftTo(g,y); + } + while(x.signum() > 0) { + if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); + if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); + if(x.compareTo(y) >= 0) { + x.subTo(y,x); + x.rShiftTo(1,x); + } + else { + y.subTo(x,y); + y.rShiftTo(1,y); + } } + if(g > 0) y.lShiftTo(g,y); + return y; } - return DEFAULT_REGISTRY; - } - - getAuth(packageName) { - if (this.token) { - return this.token; + // (protected) this % n, n < 2^26 + function bnpModInt(n) { + if(n <= 0) return 0; + var d = this.DV%n, r = (this.s<0)?n-1:0; + if(this.t > 0) + if(d == 0) r = this[0]%n; + else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; + return r; } - for (let registry of [this.getRegistry(packageName), '', DEFAULT_REGISTRY]) { - registry = registry.replace(/^https?:/, ''); - - // Check for bearer token. - let auth = this.getScopedOption(registry.replace(/\/?$/, '/'), '_authToken'); - if (auth) { - return `Bearer ${String(auth)}`; - } - - // Check for basic auth token. - auth = this.getScopedOption(registry, '_auth'); - if (auth) { - return `Basic ${String(auth)}`; - } - - // Check for basic username/password auth. - const username = this.getScopedOption(registry, 'username'); - const password = this.getScopedOption(registry, '_password'); - if (username && password) { - const pw = new Buffer(String(password), 'base64').toString(); - return 'Basic ' + new Buffer(String(username) + ':' + pw).toString('base64'); + // (public) 1/this % m (HAC 14.61) + function bnModInverse(m) { + var ac = m.isEven(); + if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; + var u = m.clone(), v = this.clone(); + var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); + while(u.signum() != 0) { + while(u.isEven()) { + u.rShiftTo(1,u); + if(ac) { + if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } + a.rShiftTo(1,a); + } + else if(!b.isEven()) b.subTo(m,b); + b.rShiftTo(1,b); + } + while(v.isEven()) { + v.rShiftTo(1,v); + if(ac) { + if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } + c.rShiftTo(1,c); + } + else if(!d.isEven()) d.subTo(m,d); + d.rShiftTo(1,d); + } + if(u.compareTo(v) >= 0) { + u.subTo(v,u); + if(ac) a.subTo(c,a); + b.subTo(d,b); + } + else { + v.subTo(u,v); + if(ac) c.subTo(a,c); + d.subTo(b,d); + } } + if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; + if(d.compareTo(m) >= 0) return d.subtract(m); + if(d.signum() < 0) d.addTo(m,d); else return d; + if(d.signum() < 0) return d.add(m); else return d; } - return ''; - } + var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; + var lplim = (1<<26)/lowprimes[lowprimes.length-1]; - getScopedOption(scope, option) { - return this.getOption(scope + (scope ? ':' : '') + option); - } -} -exports.default = NpmRegistry; -NpmRegistry.filename = 'package.json'; - -/***/ }), -/* 43 */ -/***/ (function(module, exports, __webpack_require__) { + // (public) test primality with certainty >= 1-.5^t + function bnIsProbablePrime(t) { + var i, x = this.abs(); + if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) { + for(i = 0; i < lowprimes.length; ++i) + if(x[0] == lowprimes[i]) return true; + return false; + } + if(x.isEven()) return false; + i = 1; + while(i < lowprimes.length) { + var m = lowprimes[i], j = i+1; + while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; + m = x.modInt(m); + while(i < j) if(m%lowprimes[i++] == 0) return false; + } + return x.millerRabin(t); + } -"use strict"; + // (protected) true if probably prime (HAC 4.24, Miller-Rabin) + function bnpMillerRabin(t) { + var n1 = this.subtract(BigInteger.ONE); + var k = n1.getLowestSetBit(); + if(k <= 0) return false; + var r = n1.shiftRight(k); + t = (t+1)>>1; + if(t > lowprimes.length) t = lowprimes.length; + var a = nbi(); + for(var i = 0; i < t; ++i) { + //Pick bases at random, instead of starting at 2 + a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); + var y = a.modPow(r,this); + if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { + var j = 1; + while(j++ < k && y.compareTo(n1) != 0) { + y = y.modPowInt(2,this); + if(y.compareTo(BigInteger.ONE) == 0) return false; + } + if(y.compareTo(n1) != 0) return false; + } + } + return true; + } + // protected + BigInteger.prototype.chunkSize = bnpChunkSize; + BigInteger.prototype.toRadix = bnpToRadix; + BigInteger.prototype.fromRadix = bnpFromRadix; + BigInteger.prototype.fromNumber = bnpFromNumber; + BigInteger.prototype.bitwiseTo = bnpBitwiseTo; + BigInteger.prototype.changeBit = bnpChangeBit; + BigInteger.prototype.addTo = bnpAddTo; + BigInteger.prototype.dMultiply = bnpDMultiply; + BigInteger.prototype.dAddOffset = bnpDAddOffset; + BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; + BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; + BigInteger.prototype.modInt = bnpModInt; + BigInteger.prototype.millerRabin = bnpMillerRabin; -exports.__esModule = true; + // public + BigInteger.prototype.clone = bnClone; + BigInteger.prototype.intValue = bnIntValue; + BigInteger.prototype.byteValue = bnByteValue; + BigInteger.prototype.shortValue = bnShortValue; + BigInteger.prototype.signum = bnSigNum; + BigInteger.prototype.toByteArray = bnToByteArray; + BigInteger.prototype.equals = bnEquals; + BigInteger.prototype.min = bnMin; + BigInteger.prototype.max = bnMax; + BigInteger.prototype.and = bnAnd; + BigInteger.prototype.or = bnOr; + BigInteger.prototype.xor = bnXor; + BigInteger.prototype.andNot = bnAndNot; + BigInteger.prototype.not = bnNot; + BigInteger.prototype.shiftLeft = bnShiftLeft; + BigInteger.prototype.shiftRight = bnShiftRight; + BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; + BigInteger.prototype.bitCount = bnBitCount; + BigInteger.prototype.testBit = bnTestBit; + BigInteger.prototype.setBit = bnSetBit; + BigInteger.prototype.clearBit = bnClearBit; + BigInteger.prototype.flipBit = bnFlipBit; + BigInteger.prototype.add = bnAdd; + BigInteger.prototype.subtract = bnSubtract; + BigInteger.prototype.multiply = bnMultiply; + BigInteger.prototype.divide = bnDivide; + BigInteger.prototype.remainder = bnRemainder; + BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; + BigInteger.prototype.modPow = bnModPow; + BigInteger.prototype.modInverse = bnModInverse; + BigInteger.prototype.pow = bnPow; + BigInteger.prototype.gcd = bnGCD; + BigInteger.prototype.isProbablePrime = bnIsProbablePrime; -var _assign = __webpack_require__(387); + // JSBN-specific extension + BigInteger.prototype.square = bnSquare; -var _assign2 = _interopRequireDefault(_assign); + // Expose the Barrett function + BigInteger.prototype.Barrett = Barrett -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + // BigInteger interfaces not implemented in jsbn: -exports.default = _assign2.default || function (target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; + // BigInteger(int signum, byte[] magnitude) + // double doubleValue() + // float floatValue() + // int hashCode() + // long longValue() + // static BigInteger valueOf(long val) - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } + // Random number generator - requires a PRNG backend, e.g. prng4.js - return target; -}; + // For best results, put code like + // + // in your main HTML document. -/***/ }), -/* 44 */ -/***/ (function(module, exports, __webpack_require__) { + var rng_state; + var rng_pool; + var rng_pptr; -var isObject = __webpack_require__(87); -module.exports = function(it){ - if(!isObject(it))throw TypeError(it + ' is not an object!'); - return it; -}; + // Mix in a 32-bit integer into the pool + function rng_seed_int(x) { + rng_pool[rng_pptr++] ^= x & 255; + rng_pool[rng_pptr++] ^= (x >> 8) & 255; + rng_pool[rng_pptr++] ^= (x >> 16) & 255; + rng_pool[rng_pptr++] ^= (x >> 24) & 255; + if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; + } -/***/ }), -/* 45 */ -/***/ (function(module, exports, __webpack_require__) { + // Mix in the current time (w/milliseconds) into the pool + function rng_seed_time() { + rng_seed_int(new Date().getTime()); + } -(function(){ + // Initialize the pool with junk if needed. + if(rng_pool == null) { + rng_pool = new Array(); + rng_pptr = 0; + var t; + if(typeof window !== "undefined" && window.crypto) { + if (window.crypto.getRandomValues) { + // Use webcrypto if available + var ua = new Uint8Array(32); + window.crypto.getRandomValues(ua); + for(t = 0; t < 32; ++t) + rng_pool[rng_pptr++] = ua[t]; + } + else if(navigator.appName == "Netscape" && navigator.appVersion < "5") { + // Extract entropy (256 bits) from NS4 RNG if available + var z = window.crypto.random(32); + for(t = 0; t < z.length; ++t) + rng_pool[rng_pptr++] = z.charCodeAt(t) & 255; + } + } + while(rng_pptr < rng_psize) { // extract some randomness from Math.random() + t = Math.floor(65536 * Math.random()); + rng_pool[rng_pptr++] = t >>> 8; + rng_pool[rng_pptr++] = t & 255; + } + rng_pptr = 0; + rng_seed_time(); + //rng_seed_int(window.screenX); + //rng_seed_int(window.screenY); + } - // Copyright (c) 2005 Tom Wu - // All Rights Reserved. - // See "LICENSE" for details. + function rng_get_byte() { + if(rng_state == null) { + rng_seed_time(); + rng_state = prng_newstate(); + rng_state.init(rng_pool); + for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) + rng_pool[rng_pptr] = 0; + rng_pptr = 0; + //rng_pool = null; + } + // TODO: allow reseeding after first request + return rng_state.next(); + } - // Basic JavaScript BN library - subset useful for RSA encryption. + function rng_get_bytes(ba) { + var i; + for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); + } - // Bits per digit - var dbits; + function SecureRandom() {} - // JavaScript engine analysis - var canary = 0xdeadbeefcafe; - var j_lm = ((canary&0xffffff)==0xefcafe); + SecureRandom.prototype.nextBytes = rng_get_bytes; - // (public) Constructor - function BigInteger(a,b,c) { - if(a != null) - if("number" == typeof a) this.fromNumber(a,b,c); - else if(b == null && "string" != typeof a) this.fromString(a,256); - else this.fromString(a,b); - } + // prng4.js - uses Arcfour as a PRNG - // return new, unset BigInteger - function nbi() { return new BigInteger(null); } + function Arcfour() { + this.i = 0; + this.j = 0; + this.S = new Array(); + } - // am: Compute w_j += (x*this_i), propagate carries, - // c is initial carry, returns final carry. - // c < 3*dvalue, x < 2*dvalue, this_i < dvalue - // We need to select the fastest one that works in this environment. + // Initialize arcfour context from key, an array of ints, each from [0..255] + function ARC4init(key) { + var i, j, t; + for(i = 0; i < 256; ++i) + this.S[i] = i; + j = 0; + for(i = 0; i < 256; ++i) { + j = (j + this.S[i] + key[i % key.length]) & 255; + t = this.S[i]; + this.S[i] = this.S[j]; + this.S[j] = t; + } + this.i = 0; + this.j = 0; + } - // am1: use a single mult and divide to get the high bits, - // max digit bits should be 26 because - // max internal value = 2*dvalue^2-2*dvalue (< 2^53) - function am1(i,x,w,j,c,n) { - while(--n >= 0) { - var v = x*this[i++]+w[j]+c; - c = Math.floor(v/0x4000000); - w[j++] = v&0x3ffffff; - } - return c; - } - // am2 avoids a big mult-and-extract completely. - // Max digit bits should be <= 30 because we do bitwise ops - // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) - function am2(i,x,w,j,c,n) { - var xl = x&0x7fff, xh = x>>15; - while(--n >= 0) { - var l = this[i]&0x7fff; - var h = this[i++]>>15; - var m = xh*l+h*xl; - l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); - c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); - w[j++] = l&0x3fffffff; - } - return c; - } - // Alternately, set max digit bits to 28 since some - // browsers slow down when dealing with 32-bit numbers. - function am3(i,x,w,j,c,n) { - var xl = x&0x3fff, xh = x>>14; - while(--n >= 0) { - var l = this[i]&0x3fff; - var h = this[i++]>>14; - var m = xh*l+h*xl; - l = xl*l+((m&0x3fff)<<14)+w[j]+c; - c = (l>>28)+(m>>14)+xh*h; - w[j++] = l&0xfffffff; - } - return c; - } - var inBrowser = typeof navigator !== "undefined"; - if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) { - BigInteger.prototype.am = am2; - dbits = 30; - } - else if(inBrowser && j_lm && (navigator.appName != "Netscape")) { - BigInteger.prototype.am = am1; - dbits = 26; - } - else { // Mozilla/Netscape seems to prefer am3 - BigInteger.prototype.am = am3; - dbits = 28; - } + function ARC4next() { + var t; + this.i = (this.i + 1) & 255; + this.j = (this.j + this.S[this.i]) & 255; + t = this.S[this.i]; + this.S[this.i] = this.S[this.j]; + this.S[this.j] = t; + return this.S[(t + this.S[this.i]) & 255]; + } - BigInteger.prototype.DB = dbits; - BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i]; - r.t = this.t; - r.s = this.s; - } +}).call(this); - // (protected) set from integer value x, -DV <= x < DV - function bnpFromInt(x) { - this.t = 1; - this.s = (x<0)?-1:0; - if(x > 0) this[0] = x; - else if(x < -1) this[0] = x+this.DV; - else this.t = 0; - } - // return bigint initialized to value - function nbv(i) { var r = nbi(); r.fromInt(i); return r; } +/***/ }), +/* 40 */ +/***/ (function(module, exports, __webpack_require__) { - // (protected) set from string and radix - function bnpFromString(s,b) { - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 256) k = 8; // byte array - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else { this.fromRadix(s,b); return; } - this.t = 0; - this.s = 0; - var i = s.length, mi = false, sh = 0; - while(--i >= 0) { - var x = (k==8)?s[i]&0xff:intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-") mi = true; - continue; - } - mi = false; - if(sh == 0) - this[this.t++] = x; - else if(sh+k > this.DB) { - this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); - } - else - this[this.t-1] |= x<= this.DB) sh -= this.DB; - } - if(k == 8 && (s[0]&0x80) != 0) { - this.s = -1; - if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t; - } +module.exports = { + read: read, + write: write +}; - // (public) return string representation in given radix - function bnToString(b) { - if(this.s < 0) return "-"+this.negate().toString(b); - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else return this.toRadix(b); - var km = (1< 0) { - if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } - while(i >= 0) { - if(p < k) { - d = (this[i]&((1<>(p+=this.DB-k); - } - else { - d = (this[i]>>(p-=k))&km; - if(p <= 0) { p += this.DB; --i; } - } - if(d > 0) m = true; - if(m) r += int2char(d); - } - } - return m?r:"0"; - } +var assert = __webpack_require__(9); +var asn1 = __webpack_require__(34); +var crypto = __webpack_require__(7); +var algs = __webpack_require__(17); +var utils = __webpack_require__(13); +var Key = __webpack_require__(18); +var PrivateKey = __webpack_require__(19); - // (public) -this - function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } +var pkcs1 = __webpack_require__(160); +var pkcs8 = __webpack_require__(74); +var sshpriv = __webpack_require__(107); +var rfc4253 = __webpack_require__(48); - // (public) |this| - function bnAbs() { return (this.s<0)?this.negate():this; } +var errors = __webpack_require__(32); - // (public) return + if this > a, - if this < a, 0 if equal - function bnCompareTo(a) { - var r = this.s-a.s; - if(r != 0) return r; - var i = this.t; - r = i-a.t; - if(r != 0) return (this.s<0)?-r:r; - while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; - return 0; - } +/* + * For reading we support both PKCS#1 and PKCS#8. If we find a private key, + * we just take the public component of it and use that. + */ +function read(buf, options, forceType) { + var input = buf; + if (typeof (buf) !== 'string') { + assert.buffer(buf, 'buf'); + buf = buf.toString('ascii'); + } - // returns bit length of the integer x - function nbits(x) { - var r = 1, t; - if((t=x>>>16) != 0) { x = t; r += 16; } - if((t=x>>8) != 0) { x = t; r += 8; } - if((t=x>>4) != 0) { x = t; r += 4; } - if((t=x>>2) != 0) { x = t; r += 2; } - if((t=x>>1) != 0) { x = t; r += 1; } - return r; - } + var lines = buf.trim().split('\n'); - // (public) return the number of bits in "this" - function bnBitLength() { - if(this.t <= 0) return 0; - return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); - } + var m = lines[0].match(/*JSSTYLED*/ + /[-]+[ ]*BEGIN ([A-Z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/); + assert.ok(m, 'invalid PEM header'); - // (protected) r = this << n*DB - function bnpDLShiftTo(n,r) { - var i; - for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; - for(i = n-1; i >= 0; --i) r[i] = 0; - r.t = this.t+n; - r.s = this.s; - } + var m2 = lines[lines.length - 1].match(/*JSSTYLED*/ + /[-]+[ ]*END ([A-Z0-9]+ )?(PUBLIC|PRIVATE) KEY[ ]*[-]+/); + assert.ok(m2, 'invalid PEM footer'); - // (protected) r = this >> n*DB - function bnpDRShiftTo(n,r) { - for(var i = n; i < this.t; ++i) r[i-n] = this[i]; - r.t = Math.max(this.t-n,0); - r.s = this.s; - } + /* Begin and end banners must match key type */ + assert.equal(m[2], m2[2]); + var type = m[2].toLowerCase(); - // (protected) r = this << n - function bnpLShiftTo(n,r) { - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<= 0; --i) { - r[i+ds+1] = (this[i]>>cbs)|c; - c = (this[i]&bm)<= 0; --i) r[i] = 0; - r[ds] = c; - r.t = this.t+ds+1; - r.s = this.s; - r.clamp(); - } + var alg; + if (m[1]) { + /* They also must match algorithms, if given */ + assert.equal(m[1], m2[1], 'PEM header and footer mismatch'); + alg = m[1].trim(); + } - // (protected) r = this >> n - function bnpRShiftTo(n,r) { - r.s = this.s; - var ds = Math.floor(n/this.DB); - if(ds >= this.t) { r.t = 0; return; } - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<>bs; - for(var i = ds+1; i < this.t; ++i) { - r[i-ds-1] |= (this[i]&bm)<>bs; - } - if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB; - } - if(a.t < this.t) { - c -= a.s; - while(i < this.t) { - c += this[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c += this.s; - } - else { - c += this.s; - while(i < a.t) { - c -= a[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c -= a.s; - } - r.s = (c<0)?-1:0; - if(c < -1) r[i++] = this.DV+c; - else if(c > 0) r[i++] = c; - r.t = i; - r.clamp(); - } + var cipher, key, iv; + if (headers['proc-type']) { + var parts = headers['proc-type'].split(','); + if (parts[0] === '4' && parts[1] === 'ENCRYPTED') { + if (typeof (options.passphrase) === 'string') { + options.passphrase = new Buffer( + options.passphrase, 'utf-8'); + } + if (!Buffer.isBuffer(options.passphrase)) { + throw (new errors.KeyEncryptedError( + options.filename, 'PEM')); + } else { + parts = headers['dek-info'].split(','); + assert.ok(parts.length === 2); + cipher = parts[0].toLowerCase(); + iv = new Buffer(parts[1], 'hex'); + key = utils.opensslKeyDeriv(cipher, iv, + options.passphrase, 1).key; + } + } + } - // (protected) r = this * a, r != this,a (HAC 14.12) - // "this" should be the larger one if appropriate. - function bnpMultiplyTo(a,r) { - var x = this.abs(), y = a.abs(); - var i = x.t; - r.t = i+y.t; - while(--i >= 0) r[i] = 0; - for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); - r.s = 0; - r.clamp(); - if(this.s != a.s) BigInteger.ZERO.subTo(r,r); - } + /* Chop off the first and last lines */ + lines = lines.slice(0, -1).join(''); + buf = new Buffer(lines, 'base64'); - // (protected) r = this^2, r != this (HAC 14.16) - function bnpSquareTo(r) { - var x = this.abs(); - var i = r.t = 2*x.t; - while(--i >= 0) r[i] = 0; - for(i = 0; i < x.t-1; ++i) { - var c = x.am(i,x[i],r,2*i,0,1); - if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { - r[i+x.t] -= x.DV; - r[i+x.t+1] = 1; - } - } - if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); - r.s = 0; - r.clamp(); - } + if (cipher && key && iv) { + var cipherStream = crypto.createDecipheriv(cipher, key, iv); + var chunk, chunks = []; + cipherStream.once('error', function (e) { + if (e.toString().indexOf('bad decrypt') !== -1) { + throw (new Error('Incorrect passphrase ' + + 'supplied, could not decrypt key')); + } + throw (e); + }); + cipherStream.write(buf); + cipherStream.end(); + while ((chunk = cipherStream.read()) !== null) + chunks.push(chunk); + buf = Buffer.concat(chunks); + } - // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) - // r != q, this != m. q or r may be null. - function bnpDivRemTo(m,q,r) { - var pm = m.abs(); - if(pm.t <= 0) return; - var pt = this.abs(); - if(pt.t < pm.t) { - if(q != null) q.fromInt(0); - if(r != null) this.copyTo(r); - return; - } - if(r == null) r = nbi(); - var y = nbi(), ts = this.s, ms = m.s; - var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus - if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } - else { pm.copyTo(y); pt.copyTo(r); } - var ys = y.t; - var y0 = y[ys-1]; - if(y0 == 0) return; - var yt = y0*(1<1)?y[ys-2]>>this.F2:0); - var d1 = this.FV/yt, d2 = (1<= 0) { - r[r.t++] = 1; - r.subTo(t,r); - } - BigInteger.ONE.dlShiftTo(ys,t); - t.subTo(y,y); // "negative" y so we can replace sub with am later - while(y.t < ys) y[y.t++] = 0; - while(--j >= 0) { - // Estimate quotient digit - var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); - if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out - y.dlShiftTo(j,t); - r.subTo(t,r); - while(r[i] < --qd) r.subTo(t,r); - } - } - if(q != null) { - r.drShiftTo(ys,q); - if(ts != ms) BigInteger.ZERO.subTo(q,q); - } - r.t = ys; - r.clamp(); - if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder - if(ts < 0) BigInteger.ZERO.subTo(r,r); - } + /* The new OpenSSH internal format abuses PEM headers */ + if (alg && alg.toLowerCase() === 'openssh') + return (sshpriv.readSSHPrivate(type, buf, options)); + if (alg && alg.toLowerCase() === 'ssh2') + return (rfc4253.readType(type, buf, options)); - // (public) this mod a - function bnMod(a) { - var r = nbi(); - this.abs().divRemTo(a,null,r); - if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); - return r; - } + var der = new asn1.BerReader(buf); + der.originalInput = input; - // Modular reduction using "classic" algorithm - function Classic(m) { this.m = m; } - function cConvert(x) { - if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); - else return x; - } - function cRevert(x) { return x; } - function cReduce(x) { x.divRemTo(this.m,null,x); } - function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + /* + * All of the PEM file types start with a sequence tag, so chop it + * off here + */ + der.readSequence(); - Classic.prototype.convert = cConvert; - Classic.prototype.revert = cRevert; - Classic.prototype.reduce = cReduce; - Classic.prototype.mulTo = cMulTo; - Classic.prototype.sqrTo = cSqrTo; + /* PKCS#1 type keys name an algorithm in the banner explicitly */ + if (alg) { + if (forceType) + assert.strictEqual(forceType, 'pkcs1'); + return (pkcs1.readPkcs1(alg, type, der)); + } else { + if (forceType) + assert.strictEqual(forceType, 'pkcs8'); + return (pkcs8.readPkcs8(alg, type, der)); + } +} - // (protected) return "-1/this % 2^DB"; useful for Mont. reduction - // justification: - // xy == 1 (mod m) - // xy = 1+km - // xy(2-xy) = (1+km)(1-km) - // x[y(2-xy)] = 1-k^2m^2 - // x[y(2-xy)] == 1 (mod m^2) - // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 - // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. - // JS multiply "overflows" differently from C/C++, so care is needed here. - function bnpInvDigit() { - if(this.t < 1) return 0; - var x = this[0]; - if((x&1) == 0) return 0; - var y = x&3; // y == 1/x mod 2^2 - y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 - y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 - y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 - // last step - calculate inverse mod DV directly; - // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints - y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits - // we really want the negative inverse, and -DV < y < DV - return (y>0)?this.DV-y:-y; - } +function write(key, options, type) { + assert.object(key); - // Montgomery reduction - function Montgomery(m) { - this.m = m; - this.mp = m.invDigit(); - this.mpl = this.mp&0x7fff; - this.mph = this.mp>>15; - this.um = (1<<(m.DB-15))-1; - this.mt2 = 2*m.t; - } + var alg = {'ecdsa': 'EC', 'rsa': 'RSA', 'dsa': 'DSA'}[key.type]; + var header; - // xR mod m - function montConvert(x) { - var r = nbi(); - x.abs().dlShiftTo(this.m.t,r); - r.divRemTo(this.m,null,r); - if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); - return r; - } + var der = new asn1.BerWriter(); - // x/R mod m - function montRevert(x) { - var r = nbi(); - x.copyTo(r); - this.reduce(r); - return r; - } + if (PrivateKey.isPrivateKey(key)) { + if (type && type === 'pkcs8') { + header = 'PRIVATE KEY'; + pkcs8.writePkcs8(der, key); + } else { + if (type) + assert.strictEqual(type, 'pkcs1'); + header = alg + ' PRIVATE KEY'; + pkcs1.writePkcs1(der, key); + } - // x = x/R mod m (HAC 14.32) - function montReduce(x) { - while(x.t <= this.mt2) // pad x so am has enough room later - x[x.t++] = 0; - for(var i = 0; i < this.m.t; ++i) { - // faster way of calculating u0 = x[i]*mp mod DV - var j = x[i]&0x7fff; - var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; - // use am to combine the multiply-shift-add into one call - j = i+this.m.t; - x[j] += this.m.am(0,u0,x,i,0,this.m.t); - // propagate carry - while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } - } - x.clamp(); - x.drShiftTo(this.m.t,x); - if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); - } + } else if (Key.isKey(key)) { + if (type && type === 'pkcs1') { + header = alg + ' PUBLIC KEY'; + pkcs1.writePkcs1(der, key); + } else { + if (type) + assert.strictEqual(type, 'pkcs8'); + header = 'PUBLIC KEY'; + pkcs8.writePkcs8(der, key); + } - // r = "x^2/R mod m"; x != r - function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } + } else { + throw (new Error('key is not a Key or PrivateKey')); + } - // r = "xy/R mod m"; x,y != r - function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } + var tmp = der.buffer.toString('base64'); + var len = tmp.length + (tmp.length / 64) + + 18 + 16 + header.length*2 + 10; + var buf = new Buffer(len); + var o = 0; + o += buf.write('-----BEGIN ' + header + '-----\n', o); + for (var i = 0; i < tmp.length; ) { + var limit = i + 64; + if (limit > tmp.length) + limit = tmp.length; + o += buf.write(tmp.slice(i, limit), o); + buf[o++] = 10; + i = limit; + } + o += buf.write('-----END ' + header + '-----\n', o); - Montgomery.prototype.convert = montConvert; - Montgomery.prototype.revert = montRevert; - Montgomery.prototype.reduce = montReduce; - Montgomery.prototype.mulTo = montMulTo; - Montgomery.prototype.sqrTo = montSqrTo; + return (buf.slice(0, o)); +} - // (protected) true iff this is even - function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } - // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) - function bnpExp(e,z) { - if(e > 0xffffffff || e < 1) return BigInteger.ONE; - var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; - g.copyTo(r); - while(--i >= 0) { - z.sqrTo(r,r2); - if((e&(1< 0) z.mulTo(r2,g,r); - else { var t = r; r = r2; r2 = t; } - } - return z.revert(r); - } +/***/ }), +/* 41 */ +/***/ (function(module, exports, __webpack_require__) { - // (public) this^e % m, 0 <= e < 2^32 - function bnModPowInt(e,m) { - var z; - if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); - return this.exp(e,z); - } +"use strict"; - // protected - BigInteger.prototype.copyTo = bnpCopyTo; - BigInteger.prototype.fromInt = bnpFromInt; - BigInteger.prototype.fromString = bnpFromString; - BigInteger.prototype.clamp = bnpClamp; - BigInteger.prototype.dlShiftTo = bnpDLShiftTo; - BigInteger.prototype.drShiftTo = bnpDRShiftTo; - BigInteger.prototype.lShiftTo = bnpLShiftTo; - BigInteger.prototype.rShiftTo = bnpRShiftTo; - BigInteger.prototype.subTo = bnpSubTo; - BigInteger.prototype.multiplyTo = bnpMultiplyTo; - BigInteger.prototype.squareTo = bnpSquareTo; - BigInteger.prototype.divRemTo = bnpDivRemTo; - BigInteger.prototype.invDigit = bnpInvDigit; - BigInteger.prototype.isEven = bnpIsEven; - BigInteger.prototype.exp = bnpExp; - // public - BigInteger.prototype.toString = bnToString; - BigInteger.prototype.negate = bnNegate; - BigInteger.prototype.abs = bnAbs; - BigInteger.prototype.compareTo = bnCompareTo; - BigInteger.prototype.bitLength = bnBitLength; - BigInteger.prototype.mod = bnMod; - BigInteger.prototype.modPowInt = bnModPowInt; - // "constants" - BigInteger.ZERO = nbv(0); - BigInteger.ONE = nbv(1); +module.exports = { + copy: copy, + checkDataType: checkDataType, + checkDataTypes: checkDataTypes, + coerceToTypes: coerceToTypes, + toHash: toHash, + getProperty: getProperty, + escapeQuotes: escapeQuotes, + ucs2length: __webpack_require__(289), + varOccurences: varOccurences, + varReplace: varReplace, + cleanUpCode: cleanUpCode, + cleanUpVarErrors: cleanUpVarErrors, + schemaHasRules: schemaHasRules, + schemaHasRulesExcept: schemaHasRulesExcept, + stableStringify: __webpack_require__(152), + toQuotedString: toQuotedString, + getPathExpr: getPathExpr, + getPath: getPath, + getData: getData, + unescapeFragment: unescapeFragment, + escapeFragment: escapeFragment, + escapeJsonPointer: escapeJsonPointer +}; - // Copyright (c) 2005-2009 Tom Wu - // All Rights Reserved. - // See "LICENSE" for details. - // Extended JavaScript BN functions, required for RSA private ops. +function copy(o, to) { + to = to || {}; + for (var key in o) to[key] = o[key]; + return to; +} - // Version 1.1: new BigInteger("0", 10) returns "proper" zero - // Version 1.2: square() API, isProbablePrime fix - // (public) - function bnClone() { var r = nbi(); this.copyTo(r); return r; } +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 + '"'; + } +} - // (public) return value as integer - function bnIntValue() { - if(this.s < 0) { - if(this.t == 1) return this[0]-this.DV; - else if(this.t == 0) return -1; - } - else if(this.t == 1) return this[0]; - else if(this.t == 0) return 0; - // assumes 16 < DB < 32 - return ((this[1]&((1<<(32-this.DB))-1))<>24; } +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); - // (public) return value as short (assumes DB>=16) - function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } + return code; + } +} - // (protected) return x s.t. r^x < DV - function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } - // (public) 0 if this == 0, 1 if this > 0 - function bnSigNum() { - if(this.s < 0) return -1; - else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; - else return 1; - } - - // (protected) convert to radix string - function bnpToRadix(b) { - if(b == null) b = 10; - if(this.signum() == 0 || b < 2 || b > 36) return "0"; - var cs = this.chunkSize(b); - var a = Math.pow(b,cs); - var d = nbv(a), y = nbi(), z = nbi(), r = ""; - this.divRemTo(d,y,z); - while(y.signum() > 0) { - r = (a+z.intValue()).toString(b).substr(1) + r; - y.divRemTo(d,y,z); - } - return z.intValue().toString(b) + r; - } - - // (protected) convert from radix string - function bnpFromRadix(s,b) { - this.fromInt(0); - if(b == null) b = 10; - var cs = this.chunkSize(b); - var d = Math.pow(b,cs), mi = false, j = 0, w = 0; - for(var i = 0; i < s.length; ++i) { - var x = intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-" && this.signum() == 0) mi = true; - continue; - } - w = b*w+x; - if(++j >= cs) { - this.dMultiply(d); - this.dAddOffset(w,0); - j = 0; - w = 0; - } - } - if(j > 0) { - this.dMultiply(Math.pow(b,j)); - this.dAddOffset(w,0); - } - if(mi) BigInteger.ZERO.subTo(this,this); - } - - // (protected) alternate constructor - function bnpFromNumber(a,b,c) { - if("number" == typeof b) { - // new BigInteger(int,int,RNG) - if(a < 2) this.fromInt(1); - else { - this.fromNumber(a,c); - if(!this.testBit(a-1)) // force MSB set - this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); - if(this.isEven()) this.dAddOffset(1,0); // force odd - while(!this.isProbablePrime(b)) { - this.dAddOffset(2,0); - if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); - } - } - } - else { - // new BigInteger(int,RNG) - var x = new Array(), t = a&7; - x.length = (a>>3)+1; - b.nextBytes(x); - if(t > 0) x[0] &= ((1< 0) { - if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p) - r[k++] = d|(this.s<<(this.DB-p)); - while(i >= 0) { - if(p < 8) { - d = (this[i]&((1<>(p+=this.DB-8); - } - else { - d = (this[i]>>(p-=8))&0xff; - if(p <= 0) { p += this.DB; --i; } - } - if((d&0x80) != 0) d |= -256; - if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; - if(k > 0 || d != this.s) r[k++] = d; - } - } - return r; - } - function bnEquals(a) { return(this.compareTo(a)==0); } - function bnMin(a) { return(this.compareTo(a)<0)?this:a; } - function bnMax(a) { return(this.compareTo(a)>0)?this:a; } +function toHash(arr) { + var hash = {}; + for (var i=0; i> n - function bnShiftRight(n) { - var r = nbi(); - if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); - return r; - } +function varReplace(str, dataVar, expr) { + dataVar += '([^0-9])'; + expr = expr.replace(/\$/g, '$$$$'); + return str.replace(new RegExp(dataVar, 'g'), expr + '$1'); +} - // return index of lowest 1-bit in x, x < 2^31 - function lbit(x) { - if(x == 0) return -1; - var r = 0; - if((x&0xffff) == 0) { x >>= 16; r += 16; } - if((x&0xff) == 0) { x >>= 8; r += 8; } - if((x&0xf) == 0) { x >>= 4; r += 4; } - if((x&3) == 0) { x >>= 2; r += 2; } - if((x&1) == 0) ++r; - return r; - } - // (public) returns index of lowest 1-bit (or -1 if none) - function bnGetLowestSetBit() { - for(var i = 0; i < this.t; ++i) - if(this[i] != 0) return i*this.DB+lbit(this[i]); - if(this.s < 0) return this.t*this.DB; - return -1; - } +var EMPTY_ELSE = /else\s*{\s*}/g + , EMPTY_IF_NO_ELSE = /if\s*\([^)]+\)\s*\{\s*\}(?!\s*else)/g + , EMPTY_IF_WITH_ELSE = /if\s*\(([^)]+)\)\s*\{\s*\}\s*else(?!\s*if)/g; +function cleanUpCode(out) { + return out.replace(EMPTY_ELSE, '') + .replace(EMPTY_IF_NO_ELSE, '') + .replace(EMPTY_IF_WITH_ELSE, 'if (!($1))'); +} - // return number of 1 bits in x - function cbit(x) { - var r = 0; - while(x != 0) { x &= x-1; ++r; } - return r; - } - // (public) return number of set bits - function bnBitCount() { - var r = 0, x = this.s&this.DM; - for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); - return r; - } +var ERRORS_REGEXP = /[^v\.]errors/g + , REMOVE_ERRORS = /var errors = 0;|var vErrors = null;|validate.errors = vErrors;/g + , REMOVE_ERRORS_ASYNC = /var errors = 0;|var vErrors = null;/g + , RETURN_VALID = 'return errors === 0;' + , RETURN_TRUE = 'validate.errors = null; return true;' + , RETURN_ASYNC = /if \(errors === 0\) return true;\s*else throw new ValidationError\(vErrors\);/ + , RETURN_TRUE_ASYNC = 'return true;'; - // (public) true iff nth bit is set - function bnTestBit(n) { - var j = Math.floor(n/this.DB); - if(j >= this.t) return(this.s!=0); - return((this[j]&(1<<(n%this.DB)))!=0); - } +function cleanUpVarErrors(out, async) { + var matches = out.match(ERRORS_REGEXP); + if (!matches || matches.length !== 2) return out; + return async + ? out.replace(REMOVE_ERRORS_ASYNC, '') + .replace(RETURN_ASYNC, RETURN_TRUE_ASYNC) + : out.replace(REMOVE_ERRORS, '') + .replace(RETURN_VALID, RETURN_TRUE); +} - // (protected) this op (1<>= this.DB; - } - if(a.t < this.t) { - c += a.s; - while(i < this.t) { - c += this[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c += this.s; - } - else { - c += this.s; - while(i < a.t) { - c += a[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c += a.s; - } - r.s = (c<0)?-1:0; - if(c > 0) r[i++] = c; - else if(c < -1) r[i++] = this.DV+c; - r.t = i; - r.clamp(); - } - // (public) this + a - function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } +function toQuotedString(str) { + return '\'' + escapeQuotes(str) + '\''; +} - // (public) this - a - function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } - // (public) this * a - function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } +function getPathExpr(currentPath, expr, jsonPointers, isNumber) { + var path = jsonPointers // false by default + ? '\'/\' + ' + expr + (isNumber ? '' : '.replace(/~/g, \'~0\').replace(/\\//g, \'~1\')') + : (isNumber ? '\'[\' + ' + expr + ' + \']\'' : '\'[\\\'\' + ' + expr + ' + \'\\\']\''); + return joinPaths(currentPath, path); +} - // (public) this^2 - function bnSquare() { var r = nbi(); this.squareTo(r); return r; } - // (public) this / a - function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } +function getPath(currentPath, prop, jsonPointers) { + var path = jsonPointers // false by default + ? toQuotedString('/' + escapeJsonPointer(prop)) + : toQuotedString(getProperty(prop)); + return joinPaths(currentPath, path); +} - // (public) this % a - function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } - // (public) [this/a,this%a] - function bnDivideAndRemainder(a) { - var q = nbi(), r = nbi(); - this.divRemTo(a,q,r); - return new Array(q,r); +var JSON_POINTER = /^\/(?:[^~]|~0|~1)*$/; +var RELATIVE_JSON_POINTER = /^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/; +function getData($data, lvl, paths) { + var up, jsonPointer, data, matches; + if ($data === '') return 'rootData'; + if ($data[0] == '/') { + if (!JSON_POINTER.test($data)) throw new Error('Invalid JSON-pointer: ' + $data); + jsonPointer = $data; + data = 'rootData'; + } else { + matches = $data.match(RELATIVE_JSON_POINTER); + if (!matches) throw new Error('Invalid JSON-pointer: ' + $data); + up = +matches[1]; + jsonPointer = matches[2]; + if (jsonPointer == '#') { + if (up >= lvl) throw new Error('Cannot access property/index ' + up + ' levels up, current level is ' + lvl); + return paths[lvl - up]; } - // (protected) this *= n, this >= 0, 1 < n < DV - function bnpDMultiply(n) { - this[this.t] = this.am(0,n-1,this,0,0,this.t); - ++this.t; - this.clamp(); - } + if (up > lvl) throw new Error('Cannot access data ' + up + ' levels up, current level is ' + lvl); + data = 'data' + ((lvl - up) || ''); + if (!jsonPointer) return data; + } - // (protected) this += n << w words, this >= 0 - function bnpDAddOffset(n,w) { - if(n == 0) return; - while(this.t <= w) this[this.t++] = 0; - this[w] += n; - while(this[w] >= this.DV) { - this[w] -= this.DV; - if(++w >= this.t) this[this.t++] = 0; - ++this[w]; - } + var expr = data; + var segments = jsonPointer.split('/'); + for (var i=0; i= 0 - r.t = i; - while(i > 0) r[--i] = 0; - var j; - for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); - for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); - r.clamp(); - } +function unescapeFragment(str) { + return unescapeJsonPointer(decodeURIComponent(str)); +} - // (protected) r = "this * a" without lower n words, n > 0 - // "this" should be the larger one if appropriate. - function bnpMultiplyUpperTo(a,n,r) { - --n; - var i = r.t = this.t+a.t-n; - r.s = 0; // assumes a,this >= 0 - while(--i >= 0) r[i] = 0; - for(i = Math.max(n-this.t,0); i < a.t; ++i) - r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); - r.clamp(); - r.drShiftTo(1,r); - } - // Barrett modular reduction - function Barrett(m) { - // setup Barrett - this.r2 = nbi(); - this.q3 = nbi(); - BigInteger.ONE.dlShiftTo(2*m.t,this.r2); - this.mu = this.r2.divide(m); - this.m = m; - } +function escapeFragment(str) { + return encodeURIComponent(escapeJsonPointer(str)); +} - function barrettConvert(x) { - if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); - else if(x.compareTo(this.m) < 0) return x; - else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } - } - function barrettRevert(x) { return x; } +function escapeJsonPointer(str) { + return str.replace(/~/g, '~0').replace(/\//g, '~1'); +} - // x = x mod m (HAC 14.42) - function barrettReduce(x) { - x.drShiftTo(this.m.t-1,this.r2); - if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } - this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); - this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); - while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); - x.subTo(this.r2,x); - while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); - } - // r = x^2 mod m; x != r - function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } +function unescapeJsonPointer(str) { + return str.replace(/~1/g, '/').replace(/~0/g, '~'); +} - // r = x*y mod m; x,y != r - function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - Barrett.prototype.convert = barrettConvert; - Barrett.prototype.revert = barrettRevert; - Barrett.prototype.reduce = barrettReduce; - Barrett.prototype.mulTo = barrettMulTo; - Barrett.prototype.sqrTo = barrettSqrTo; +/***/ }), +/* 42 */ +/***/ (function(module, exports, __webpack_require__) { - // (public) this^e % m (HAC 14.85) - function bnModPow(e,m) { - var i = e.bitLength(), k, r = nbv(1), z; - if(i <= 0) return r; - else if(i < 18) k = 1; - else if(i < 48) k = 3; - else if(i < 144) k = 4; - else if(i < 768) k = 5; - else k = 6; - if(i < 8) - z = new Classic(m); - else if(m.isEven()) - z = new Barrett(m); - else - z = new Montgomery(m); +"use strict"; - // precomputation - var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { - var g2 = nbi(); - z.sqrTo(g[1],g2); - while(n <= km) { - g[n] = nbi(); - z.mulTo(g2,g[n-2],g[n]); - n += 2; - } - } - var j = e.t-1, w, is1 = true, r2 = nbi(), t; - i = nbits(e[j])-1; - while(j >= 0) { - if(i >= k1) w = (e[j]>>(i-k1))&km; - else { - w = (e[j]&((1<<(i+1))-1))<<(k1-i); - if(j > 0) w |= e[j-1]>>(this.DB+i-k1); - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - n = k; - while((w&1) == 0) { w >>= 1; --n; } - if((i -= n) < 0) { i += this.DB; --j; } - if(is1) { // ret == 1, don't bother squaring or multiplying it - g[w].copyTo(r); - is1 = false; - } - else { - while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } - if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } - z.mulTo(r2,g[w],r); - } +var _slicedToArray2; - while(j >= 0 && (e[j]&(1< 0) { - x.rShiftTo(g,x); - y.rShiftTo(g,y); - } - while(x.signum() > 0) { - if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); - if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); - if(x.compareTo(y) >= 0) { - x.subTo(y,x); - x.rShiftTo(1,x); - } - else { - y.subTo(x,y); - y.rShiftTo(1,y); - } - } - if(g > 0) y.lShiftTo(g,y); - return y; - } +function _load_slicedToArray() { + return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); +} - // (protected) this % n, n < 2^26 - function bnpModInt(n) { - if(n <= 0) return 0; - var d = this.DV%n, r = (this.s<0)?n-1:0; - if(this.t > 0) - if(d == 0) r = this[0]%n; - else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; - return r; - } +var _asyncToGenerator2; - // (public) 1/this % m (HAC 14.61) - function bnModInverse(m) { - var ac = m.isEven(); - if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; - var u = m.clone(), v = this.clone(); - var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); - while(u.signum() != 0) { - while(u.isEven()) { - u.rShiftTo(1,u); - if(ac) { - if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } - a.rShiftTo(1,a); - } - else if(!b.isEven()) b.subTo(m,b); - b.rShiftTo(1,b); - } - while(v.isEven()) { - v.rShiftTo(1,v); - if(ac) { - if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } - c.rShiftTo(1,c); - } - else if(!d.isEven()) d.subTo(m,d); - d.rShiftTo(1,d); - } - if(u.compareTo(v) >= 0) { - u.subTo(v,u); - if(ac) a.subTo(c,a); - b.subTo(d,b); - } - else { - v.subTo(u,v); - if(ac) c.subTo(a,c); - d.subTo(b,d); - } - } - if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; - if(d.compareTo(m) >= 0) return d.subtract(m); - if(d.signum() < 0) d.addTo(m,d); else return d; - if(d.signum() < 0) return d.add(m); else return d; - } +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} - var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; - var lplim = (1<<26)/lowprimes[lowprimes.length-1]; +var _fs; - // (public) test primality with certainty >= 1-.5^t - function bnIsProbablePrime(t) { - var i, x = this.abs(); - if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) { - for(i = 0; i < lowprimes.length; ++i) - if(x[0] == lowprimes[i]) return true; - return false; - } - if(x.isEven()) return false; - i = 1; - while(i < lowprimes.length) { - var m = lowprimes[i], j = i+1; - while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; - m = x.modInt(m); - while(i < j) if(m%lowprimes[i++] == 0) return false; - } - return x.millerRabin(t); - } +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); +} - // (protected) true if probably prime (HAC 4.24, Miller-Rabin) - function bnpMillerRabin(t) { - var n1 = this.subtract(BigInteger.ONE); - var k = n1.getLowestSetBit(); - if(k <= 0) return false; - var r = n1.shiftRight(k); - t = (t+1)>>1; - if(t > lowprimes.length) t = lowprimes.length; - var a = nbi(); - for(var i = 0; i < t; ++i) { - //Pick bases at random, instead of starting at 2 - a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); - var y = a.modPow(r,this); - if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { - var j = 1; - while(j++ < k && y.compareTo(n1) != 0) { - y = y.modPowInt(2,this); - if(y.compareTo(BigInteger.ONE) == 0) return false; - } - if(y.compareTo(n1) != 0) return false; - } - } - return true; - } +var _npmResolver; - // protected - BigInteger.prototype.chunkSize = bnpChunkSize; - BigInteger.prototype.toRadix = bnpToRadix; - BigInteger.prototype.fromRadix = bnpFromRadix; - BigInteger.prototype.fromNumber = bnpFromNumber; - BigInteger.prototype.bitwiseTo = bnpBitwiseTo; - BigInteger.prototype.changeBit = bnpChangeBit; - BigInteger.prototype.addTo = bnpAddTo; - BigInteger.prototype.dMultiply = bnpDMultiply; - BigInteger.prototype.dAddOffset = bnpDAddOffset; - BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; - BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; - BigInteger.prototype.modInt = bnpModInt; - BigInteger.prototype.millerRabin = bnpMillerRabin; +function _load_npmResolver() { + return _npmResolver = _interopRequireDefault(__webpack_require__(124)); +} - // public - BigInteger.prototype.clone = bnClone; - BigInteger.prototype.intValue = bnIntValue; - BigInteger.prototype.byteValue = bnByteValue; - BigInteger.prototype.shortValue = bnShortValue; - BigInteger.prototype.signum = bnSigNum; - BigInteger.prototype.toByteArray = bnToByteArray; - BigInteger.prototype.equals = bnEquals; - BigInteger.prototype.min = bnMin; - BigInteger.prototype.max = bnMax; - BigInteger.prototype.and = bnAnd; - BigInteger.prototype.or = bnOr; - BigInteger.prototype.xor = bnXor; - BigInteger.prototype.andNot = bnAndNot; - BigInteger.prototype.not = bnNot; - BigInteger.prototype.shiftLeft = bnShiftLeft; - BigInteger.prototype.shiftRight = bnShiftRight; - BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; - BigInteger.prototype.bitCount = bnBitCount; - BigInteger.prototype.testBit = bnTestBit; - BigInteger.prototype.setBit = bnSetBit; - BigInteger.prototype.clearBit = bnClearBit; - BigInteger.prototype.flipBit = bnFlipBit; - BigInteger.prototype.add = bnAdd; - BigInteger.prototype.subtract = bnSubtract; - BigInteger.prototype.multiply = bnMultiply; - BigInteger.prototype.divide = bnDivide; - BigInteger.prototype.remainder = bnRemainder; - BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; - BigInteger.prototype.modPow = bnModPow; - BigInteger.prototype.modInverse = bnModInverse; - BigInteger.prototype.pow = bnPow; - BigInteger.prototype.gcd = bnGCD; - BigInteger.prototype.isProbablePrime = bnIsProbablePrime; +var _envReplace; - // JSBN-specific extension - BigInteger.prototype.square = bnSquare; +function _load_envReplace() { + return _envReplace = _interopRequireDefault(__webpack_require__(381)); +} - // Expose the Barrett function - BigInteger.prototype.Barrett = Barrett +var _baseRegistry; - // BigInteger interfaces not implemented in jsbn: +function _load_baseRegistry() { + return _baseRegistry = _interopRequireDefault(__webpack_require__(362)); +} - // BigInteger(int signum, byte[] magnitude) - // double doubleValue() - // float floatValue() - // int hashCode() - // long longValue() - // static BigInteger valueOf(long val) +var _misc; - // Random number generator - requires a PRNG backend, e.g. prng4.js +function _load_misc() { + return _misc = __webpack_require__(10); +} - // For best results, put code like - // - // in your main HTML document. +var _path; - var rng_state; - var rng_pool; - var rng_pptr; +function _load_path() { + return _path = __webpack_require__(207); +} - // Mix in a 32-bit integer into the pool - function rng_seed_int(x) { - rng_pool[rng_pptr++] ^= x & 255; - rng_pool[rng_pptr++] ^= (x >> 8) & 255; - rng_pool[rng_pptr++] ^= (x >> 16) & 255; - rng_pool[rng_pptr++] ^= (x >> 24) & 255; - if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; - } +var _isRequestToRegistry; - // Mix in the current time (w/milliseconds) into the pool - function rng_seed_time() { - rng_seed_int(new Date().getTime()); - } +function _load_isRequestToRegistry() { + return _isRequestToRegistry = _interopRequireDefault(__webpack_require__(363)); +} - // Initialize the pool with junk if needed. - if(rng_pool == null) { - rng_pool = new Array(); - rng_pptr = 0; - var t; - if(typeof window !== "undefined" && window.crypto) { - if (window.crypto.getRandomValues) { - // Use webcrypto if available - var ua = new Uint8Array(32); - window.crypto.getRandomValues(ua); - for(t = 0; t < 32; ++t) - rng_pool[rng_pptr++] = ua[t]; - } - else if(navigator.appName == "Netscape" && navigator.appVersion < "5") { - // Extract entropy (256 bits) from NS4 RNG if available - var z = window.crypto.random(32); - for(t = 0; t < z.length; ++t) - rng_pool[rng_pptr++] = z.charCodeAt(t) & 255; - } - } - while(rng_pptr < rng_psize) { // extract some randomness from Math.random() - t = Math.floor(65536 * Math.random()); - rng_pool[rng_pptr++] = t >>> 8; - rng_pool[rng_pptr++] = t & 255; - } - rng_pptr = 0; - rng_seed_time(); - //rng_seed_int(window.screenX); - //rng_seed_int(window.screenY); - } +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 rng_get_byte() { - if(rng_state == null) { - rng_seed_time(); - rng_state = prng_newstate(); - rng_state.init(rng_pool); - for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) - rng_pool[rng_pptr] = 0; - rng_pptr = 0; - //rng_pool = null; - } - // TODO: allow reseeding after first request - return rng_state.next(); - } +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - function rng_get_bytes(ba) { - var i; - for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); - } +const userHome = __webpack_require__(86).default; +const path = __webpack_require__(1); +const url = __webpack_require__(11); +const ini = __webpack_require__(515); - function SecureRandom() {} +const DEFAULT_REGISTRY = 'https://registry.npmjs.org/'; +const REGEX_REGISTRY_PREFIX = /^https?:/; +const REGEX_REGISTRY_SUFFIX = /registry\/?$/; - SecureRandom.prototype.nextBytes = rng_get_bytes; +function getGlobalPrefix() { + if (process.env.PREFIX) { + return process.env.PREFIX; + } else if (process.platform === 'win32') { + // c:\node\node.exe --> prefix=c:\node\ + return path.dirname(process.execPath); + } else { + // /usr/local/bin/node --> prefix=/usr/local + let prefix = path.dirname(path.dirname(process.execPath)); - // prng4.js - uses Arcfour as a PRNG + // destdir only is respected on Unix + if (process.env.DESTDIR) { + prefix = path.join(process.env.DESTDIR, prefix); + } - function Arcfour() { - this.i = 0; - this.j = 0; - this.S = new Array(); - } + return prefix; + } +} - // Initialize arcfour context from key, an array of ints, each from [0..255] - function ARC4init(key) { - var i, j, t; - for(i = 0; i < 256; ++i) - this.S[i] = i; - j = 0; - for(i = 0; i < 256; ++i) { - j = (j + this.S[i] + key[i % key.length]) & 255; - t = this.S[i]; - this.S[i] = this.S[j]; - this.S[j] = t; - } - this.i = 0; - this.j = 0; - } +class NpmRegistry extends (_baseRegistry || _load_baseRegistry()).default { + constructor(cwd, registries, requestManager, reporter) { + super(cwd, registries, requestManager, reporter); + this.folder = 'node_modules'; + } - function ARC4next() { - var t; - this.i = (this.i + 1) & 255; - this.j = (this.j + this.S[this.i]) & 255; - t = this.S[this.i]; - this.S[this.i] = this.S[this.j]; - this.S[this.j] = t; - return this.S[(t + this.S[this.i]) & 255]; - } + static escapeName(name) { + // scoped packages contain slashes and the npm registry expects them to be escaped + return name.replace('/', '%2f'); + } - Arcfour.prototype.init = ARC4init; - Arcfour.prototype.next = ARC4next; + request(pathname) { + let opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + let packageName = arguments[2]; - // Plug in your RNG constructor here - function prng_newstate() { - return new Arcfour(); - } + const registry = this.getRegistry(packageName || pathname); + const requestUrl = url.resolve(registry, pathname); + const alwaysAuth = this.getRegistryOrGlobalOption(registry, 'always-auth'); + const customHostSuffix = this.getRegistryOrGlobalOption(registry, 'custom-host-suffix'); - // Pool size must be a multiple of 4 and greater than 32. - // An array of bytes the size of the pool will be passed to init() - var rng_psize = 256; + const headers = Object.assign({ + Accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*' + }, opts.headers); + if (this.token || alwaysAuth && (0, (_isRequestToRegistry || _load_isRequestToRegistry()).default)(requestUrl, registry, customHostSuffix)) { + const authorization = this.getAuth(packageName || pathname); + if (authorization) { + headers.authorization = authorization; + } + } - BigInteger.SecureRandom = SecureRandom; - BigInteger.BigInteger = BigInteger; - if (true) { - exports = module.exports = BigInteger; - } else { - this.BigInteger = BigInteger; - this.SecureRandom = SecureRandom; + return this.requestManager.request({ + url: requestUrl, + method: opts.method, + body: opts.body, + auth: opts.auth, + headers, + json: !opts.buffer, + buffer: opts.buffer, + process: opts.process, + gzip: true + }); } -}).call(this); + checkOutdated(config, name, range) { + var _this = this; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const req = yield _this.request(NpmRegistry.escapeName(name), { + headers: { Accept: 'application/json' } + }); + if (!req) { + throw new Error('couldnt find ' + name); + } -/***/ }), -/* 46 */ -/***/ (function(module, exports, __webpack_require__) { + const repository = req.repository, + homepage = req.homepage; -"use strict"; -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. + const url = homepage || repository && repository.url || ''; + return { + latest: req['dist-tags'].latest, + wanted: (yield (_npmResolver || _load_npmResolver()).default.findVersionInRegistryResponse(config, range, req)).version, + url + }; + })(); + } + getPossibleConfigLocations(filename, reporter) { + var _this2 = this; -/**/ + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const possibles = [[false, path.join(_this2.cwd, filename)], [true, _this2.config.userconfig || path.join(userHome, filename)], [false, path.join(getGlobalPrefix(), filename)]]; -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ + const foldersFromRootToCwd = (0, (_path || _load_path()).getPosixPath)(_this2.cwd).split('/'); + while (foldersFromRootToCwd.length > 1) { + possibles.push([false, path.join(foldersFromRootToCwd.join(path.sep), filename)]); + foldersFromRootToCwd.pop(); + } -module.exports = Duplex; + const actuals = []; + for (const _ref of possibles) { + var _ref2 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref, 2); -/**/ -var processNextTick = __webpack_require__(157); -/**/ + const isHome = _ref2[0]; + const loc = _ref2[1]; -/**/ -var util = __webpack_require__(66); -util.inherits = __webpack_require__(37); -/**/ + reporter.verbose(reporter.lang('configPossibleFile', loc)); + if (yield (_fs || _load_fs()).exists(loc)) { + reporter.verbose(reporter.lang('configFileFound', loc)); + actuals.push([isHome, loc, yield (_fs || _load_fs()).readFile(loc)]); + } + } + return actuals; + })(); + } -var Readable = __webpack_require__(248); -var Writable = __webpack_require__(249); + loadConfig() { + var _this3 = this; -util.inherits(Duplex, Readable); + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // docs: https://docs.npmjs.com/misc/config + _this3.mergeEnv('npm_config_'); -var keys = objectKeys(Writable.prototype); -for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; -} + for (const _ref3 of yield _this3.getPossibleConfigLocations('.npmrc', _this3.reporter)) { + var _ref4 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref3, 3); -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); + const loc = _ref4[1]; + const file = _ref4[2]; - Readable.call(this, options); - Writable.call(this, options); + const config = (_baseRegistry || _load_baseRegistry()).default.normalizeConfig(ini.parse(file)); + for (const key in config) { + config[key] = (0, (_envReplace || _load_envReplace()).default)(config[key]); + } - if (options && options.readable === false) this.readable = false; + // normalize offline mirror path relative to the current npmrc + const offlineLoc = config['yarn-offline-mirror']; + // don't normalize if we already have a mirror path + if (!_this3.config['yarn-offline-mirror'] && offlineLoc) { + const mirrorLoc = config['yarn-offline-mirror'] = path.resolve(path.dirname(loc), offlineLoc); + yield (_fs || _load_fs()).mkdirp(mirrorLoc); + } - if (options && options.writable === false) this.writable = false; + _this3.config = Object.assign({}, config, _this3.config); + } + })(); + } - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + getScope(packageName) { + return !packageName || packageName[0] !== '@' ? '' : packageName.split(/\/|%2f/)[0]; + } - this.once('end', onend); -} + getRegistry(packageName) { + // Try extracting registry from the url, then scoped registry, and default registry + if (packageName.match(/^https?:/)) { + const availableRegistries = this.getAvailableRegistries(); + const registry = availableRegistries.find(registry => packageName.startsWith(registry)); + if (registry) { + return (0, (_misc || _load_misc()).addSuffix)(registry, '/'); + } + } -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; + for (const scope of [this.getScope(packageName), '']) { + const registry = this.getScopedOption(scope, 'registry') || this.registries.yarn.getScopedOption(scope, 'registry'); + if (registry) { + return (0, (_misc || _load_misc()).addSuffix)(String(registry), '/'); + } + } - // no more data can be written. - // But allow more writes to happen in this tick. - processNextTick(onEndNT, this); -} + return DEFAULT_REGISTRY; + } -function onEndNT(self) { - self.end(); -} + getAuth(packageName) { + if (this.token) { + return this.token; + } -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); + const registry = this.getRegistry(packageName); + + // Check for bearer token. + const authToken = this.getRegistryOrGlobalOption(registry, '_authToken'); + if (authToken) { + return `Bearer ${String(authToken)}`; + } + + // Check for basic auth token. + const auth = this.getRegistryOrGlobalOption(registry, '_auth'); + if (auth) { + return `Basic ${String(auth)}`; + } + + // Check for basic username/password auth. + const username = this.getRegistryOrGlobalOption(registry, 'username'); + const password = this.getRegistryOrGlobalOption(registry, '_password'); + if (username && password) { + const pw = new Buffer(String(password), 'base64').toString(); + return 'Basic ' + new Buffer(String(username) + ':' + pw).toString('base64'); + } + + return ''; + } + + getScopedOption(scope, option) { + return this.getOption(scope + (scope ? ':' : '') + option); + } + + getRegistryOption(registry, option) { + const pre = REGEX_REGISTRY_PREFIX; + const suf = REGEX_REGISTRY_SUFFIX; + + // When registry is used config scope, the trailing '/' is required + const reg = (0, (_misc || _load_misc()).addSuffix)(registry, '/'); + + // 1st attempt, try to get option for the given registry URL + // 2nd attempt, remove the 'https?:' prefix of the registry URL + // 3nd attempt, remove the 'registry/?' suffix of the registry URL + return this.getScopedOption(reg, option) || reg.match(pre) && this.getRegistryOption(reg.replace(pre, ''), option) || reg.match(suf) && this.getRegistryOption(reg.replace(suf, ''), option); + } + + getRegistryOrGlobalOption(registry, option) { + return this.getRegistryOption(registry, option) || this.getOption(option); + } +} +exports.default = NpmRegistry; +NpmRegistry.filename = 'package.json'; + +/***/ }), +/* 43 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _baseResolver; + +function _load_baseResolver() { + return _baseResolver = _interopRequireDefault(__webpack_require__(83)); +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +class ExoticResolver extends (_baseResolver || _load_baseResolver()).default { + + static isVersion(pattern) { + const proto = this.protocol; + if (proto) { + return pattern.startsWith(`${proto}:`); + } else { + throw new Error('No protocol specified'); + } } } +exports.default = ExoticResolver; + +/***/ }), +/* 44 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.exec = exports.queue = undefined; +exports.spawn = spawn; + +var _constants; + +function _load_constants() { + return _constants = _interopRequireWildcard(__webpack_require__(8)); +} + +var _blockingQueue; + +function _load_blockingQueue() { + return _blockingQueue = _interopRequireDefault(__webpack_require__(84)); +} + +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(3); +} + +var _promise; + +function _load_promise() { + return _promise = __webpack_require__(64); +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +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; } } + +/* global child_process$spawnOpts */ + +const child = __webpack_require__(111); + +const queue = exports.queue = new (_blockingQueue || _load_blockingQueue()).default('child', (_constants || _load_constants()).CHILD_CONCURRENCY); + +// TODO: this uid check is kinda whack +let uid = 0; + +const exec = exports.exec = (0, (_promise || _load_promise()).promisify)(child.exec); + +function spawn(program, args) { + let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + let onData = arguments[3]; + + return queue.push(opts.cwd || String(++uid), () => new Promise((resolve, reject) => { + const proc = child.spawn(program, args, opts); + + let processingDone = false; + let processClosed = false; + let err = null; + + let stdout = ''; + + proc.on('error', err => { + if (err.code === 'ENOENT') { + reject(new (_errors || _load_errors()).MessageError(`Couldn't find the binary ${program}`)); + } else { + reject(err); + } + }); + + function updateStdout(chunk) { + stdout += chunk; + if (onData) { + onData(chunk); + } + } + + function finish() { + if (err) { + reject(err); + } else { + resolve(stdout.trim()); + } + } + + if (typeof opts.process === 'function') { + opts.process(proc, updateStdout, reject, function () { + if (processClosed) { + finish(); + } else { + processingDone = true; + } + }); + } else { + if (proc.stderr) { + proc.stderr.on('data', updateStdout); + } + + if (proc.stdout) { + proc.stdout.on('data', updateStdout); + } + + processingDone = true; + } + + proc.on('close', code => { + if (code >= 1) { + // TODO make this output nicer + err = new (_errors || _load_errors()).SpawnError(['Command failed.', `Exit code: ${code}`, `Command: ${program}`, `Arguments: ${args.join(' ')}`, `Directory: ${opts.cwd || process.cwd()}`, `Output:\n${stdout.trim()}`].join('\n')); + err.EXIT_CODE = code; + } + + if (processingDone || err) { + finish(); + } else { + processClosed = true; + } + }); + })); +} + +/***/ }), +/* 45 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; + +var _assign = __webpack_require__(396); + +var _assign2 = _interopRequireDefault(_assign); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = _assign2.default || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; +}; + +/***/ }), +/* 46 */ +/***/ (function(module, exports, __webpack_require__) { + +var isObject = __webpack_require__(91); +module.exports = function(it){ + if(!isObject(it))throw TypeError(it + ' is not an object!'); + return it; +}; /***/ }), /* 47 */ /***/ (function(module, exports, __webpack_require__) { +var Stream = __webpack_require__(14); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream; + exports = module.exports = Stream.Readable; + exports.Readable = Stream.Readable; + exports.Writable = Stream.Writable; + exports.Duplex = Stream.Duplex; + exports.Transform = Stream.Transform; + exports.PassThrough = Stream.PassThrough; + exports.Stream = Stream; +} else { + exports = module.exports = __webpack_require__(250); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = __webpack_require__(252); + exports.Duplex = __webpack_require__(56); + exports.Transform = __webpack_require__(251); + exports.PassThrough = __webpack_require__(580); +} + + +/***/ }), +/* 48 */ +/***/ (function(module, exports, __webpack_require__) { + // Copyright 2015 Joyent, Inc. module.exports = { @@ -31912,7 +32201,7 @@ var algs = __webpack_require__(17); var utils = __webpack_require__(13); var Key = __webpack_require__(18); var PrivateKey = __webpack_require__(19); -var SSHBuffer = __webpack_require__(102); +var SSHBuffer = __webpack_require__(108); function algToKeyType(alg) { assert.string(alg); @@ -32041,13 +32330,19 @@ function write(key, options) { /***/ }), -/* 48 */ +/* 49 */ +/***/ (function(module, exports) { + +module.exports = require("events"); + +/***/ }), +/* 50 */ /***/ (function(module, exports) { module.exports = require("http"); /***/ }), -/* 49 */ +/* 51 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32080,7 +32375,7 @@ function _load_index() { var _isCi; function _load_isCi() { - return _isCi = _interopRequireDefault(__webpack_require__(147)); + return _isCi = _interopRequireDefault(__webpack_require__(149)); } 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; } } @@ -32090,7 +32385,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de /* eslint no-unused-vars: 0 */ const util = __webpack_require__(2); -const EventEmitter = __webpack_require__(34).EventEmitter; +const EventEmitter = __webpack_require__(49).EventEmitter; function stringifyLangArgs(args) { return args.map(function (val) { @@ -32329,39 +32624,7 @@ class BaseReporter { exports.default = BaseReporter; /***/ }), -/* 50 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _baseResolver; - -function _load_baseResolver() { - return _baseResolver = _interopRequireDefault(__webpack_require__(117)); -} - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -class ExoticResolver extends (_baseResolver || _load_baseResolver()).default { - - static isVersion(pattern) { - const proto = this.protocol; - if (proto) { - return pattern.startsWith(`${proto}:`); - } else { - throw new Error('No protocol specified'); - } - } -} -exports.default = ExoticResolver; - -/***/ }), -/* 51 */ +/* 52 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32394,25 +32657,24 @@ function _load_index() { var _gitResolver; function _load_gitResolver() { - return _gitResolver = _interopRequireDefault(__webpack_require__(58)); + return _gitResolver = _interopRequireDefault(__webpack_require__(61)); } var _exoticResolver; function _load_exoticResolver() { - return _exoticResolver = _interopRequireDefault(__webpack_require__(50)); + return _exoticResolver = _interopRequireDefault(__webpack_require__(43)); } var _git; function _load_git() { - return _git = _interopRequireDefault(__webpack_require__(120)); + return _git = _interopRequireDefault(__webpack_require__(125)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function explodeHostedGitFragment(fragment, reporter) { - const preParts = fragment.split('@'); if (preParts.length > 2) { fragment = preParts[1] + '@' + preParts[2]; @@ -32441,7 +32703,6 @@ function explodeHostedGitFragment(fragment, reporter) { const userParts = fragment.split('/'); if (userParts.length >= 2) { - if (userParts[0].indexOf('@') >= 0) { userParts.shift(); } @@ -32536,7 +32797,7 @@ class HostedGitResolver extends (_exoticResolver || _load_exoticResolver()).defa } const refs = (_git || _load_git()).default.parseRefs(out); - return yield client.setRef(refs); + return client.setRef(refs); })(); } @@ -32631,7 +32892,7 @@ class HostedGitResolver extends (_exoticResolver || _load_exoticResolver()).defa // archive and tarball unarchiving. The HTTP API is only available for public repos // though. if (yield _this4.hasHTTPCapability(httpBaseUrl)) { - return yield _this4.resolveOverHTTP(httpUrl); + return _this4.resolveOverHTTP(httpUrl); } // If the url is accessible over git archive then we should immediately delegate to @@ -32644,18 +32905,18 @@ class HostedGitResolver extends (_exoticResolver || _load_exoticResolver()).defa if (yield (_git || _load_git()).default.hasArchiveCapability(sshGitUrl)) { const archiveClient = new (_git || _load_git()).default(_this4.config, sshGitUrl, _this4.hash); const commit = yield archiveClient.init(); - return yield _this4.fork((_gitResolver || _load_gitResolver()).default, true, `${sshUrl}#${commit}`); + return _this4.fork((_gitResolver || _load_gitResolver()).default, true, `${sshUrl}#${commit}`); } // fallback to the plain git resolver - return yield _this4.fork((_gitResolver || _load_gitResolver()).default, true, sshUrl); + return _this4.fork((_gitResolver || _load_gitResolver()).default, true, sshUrl); })(); } } exports.default = HostedGitResolver; /***/ }), -/* 52 */ +/* 53 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32670,7 +32931,7 @@ exports.hostedGitFragmentToGitUrl = hostedGitFragmentToGitUrl; var _npmResolver; function _load_npmResolver() { - return _npmResolver = _interopRequireDefault(__webpack_require__(119)); + return _npmResolver = _interopRequireDefault(__webpack_require__(124)); } var _yarnResolver; @@ -32682,19 +32943,19 @@ function _load_yarnResolver() { var _gitResolver; function _load_gitResolver() { - return _gitResolver = _interopRequireDefault(__webpack_require__(58)); + return _gitResolver = _interopRequireDefault(__webpack_require__(61)); } var _tarballResolver; function _load_tarballResolver() { - return _tarballResolver = _interopRequireDefault(__webpack_require__(370)); + return _tarballResolver = _interopRequireDefault(__webpack_require__(379)); } var _githubResolver; function _load_githubResolver() { - return _githubResolver = _interopRequireDefault(__webpack_require__(367)); + return _githubResolver = _interopRequireDefault(__webpack_require__(375)); } var _fileResolver; @@ -32703,34 +32964,40 @@ function _load_fileResolver() { return _fileResolver = _interopRequireDefault(__webpack_require__(202)); } +var _linkResolver; + +function _load_linkResolver() { + return _linkResolver = _interopRequireDefault(__webpack_require__(377)); +} + var _gitlabResolver; function _load_gitlabResolver() { - return _gitlabResolver = _interopRequireDefault(__webpack_require__(368)); + return _gitlabResolver = _interopRequireDefault(__webpack_require__(376)); } var _gistResolver; function _load_gistResolver() { - return _gistResolver = _interopRequireDefault(__webpack_require__(118)); + return _gistResolver = _interopRequireDefault(__webpack_require__(123)); } var _bitbucketResolver; function _load_bitbucketResolver() { - return _bitbucketResolver = _interopRequireDefault(__webpack_require__(366)); + return _bitbucketResolver = _interopRequireDefault(__webpack_require__(374)); } var _hostedGitResolver; function _load_hostedGitResolver() { - return _hostedGitResolver = __webpack_require__(51); + return _hostedGitResolver = __webpack_require__(52); } var _registryResolver; function _load_registryResolver() { - return _registryResolver = _interopRequireDefault(__webpack_require__(369)); + return _registryResolver = _interopRequireDefault(__webpack_require__(378)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -32747,6 +33014,7 @@ const exotics = exports.exotics = { tarball: (_tarballResolver || _load_tarballResolver()).default, github: (_githubResolver || _load_githubResolver()).default, file: (_fileResolver || _load_fileResolver()).default, + link: (_linkResolver || _load_linkResolver()).default, gitlab: (_gitlabResolver || _load_gitlabResolver()).default, gist: (_gistResolver || _load_gistResolver()).default, bitbucket: (_bitbucketResolver || _load_bitbucketResolver()).default @@ -32782,12 +33050,12 @@ for (const key in registries) { } /***/ }), -/* 53 */ +/* 54 */ /***/ (function(module, exports, __webpack_require__) { -var dP = __webpack_require__(65) - , createDesc = __webpack_require__(132); -module.exports = __webpack_require__(64) ? function(object, key, value){ +var dP = __webpack_require__(70) + , createDesc = __webpack_require__(135); +module.exports = __webpack_require__(69) ? function(object, key, value){ return dP.f(object, key, createDesc(1, value)); } : function(object, key, value){ object[key] = value; @@ -32795,19 +33063,172 @@ module.exports = __webpack_require__(64) ? function(object, key, value){ }; /***/ }), -/* 54 */ +/* 55 */ /***/ (function(module, exports) { module.exports = {}; /***/ }), -/* 55 */ -/***/ (function(module, exports) { +/* 56 */ +/***/ (function(module, exports, __webpack_require__) { -module.exports = require("buffer"); +"use strict"; +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ + +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) { + keys.push(key); + }return keys; +}; +/**/ + +module.exports = Duplex; + +/**/ +var processNextTick = __webpack_require__(158); +/**/ + +/**/ +var util = __webpack_require__(71); +util.inherits = __webpack_require__(36); +/**/ + +var Readable = __webpack_require__(250); +var Writable = __webpack_require__(252); + +util.inherits(Duplex, Readable); + +var keys = objectKeys(Writable.prototype); +for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; +} + +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) this.readable = false; + + if (options && options.writable === false) this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + processNextTick(onEndNT, this); +} + +function onEndNT(self) { + self.end(); +} + +function forEach(xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} /***/ }), -/* 56 */ +/* 57 */ +/***/ (function(module, exports, __webpack_require__) { + +var buffer = __webpack_require__(76) + +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + Object.keys(buffer).forEach(function (prop) { + exports[prop] = buffer[prop] + }) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +// Copy static methods from Buffer +Object.keys(Buffer).forEach(function (prop) { + SafeBuffer[prop] = Buffer[prop] +}) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), +/* 58 */ +/***/ (function(module, exports, __webpack_require__) { + +var v1 = __webpack_require__(632); +var v4 = __webpack_require__(633); + +var uuid = v4; +uuid.v1 = v1; +uuid.v4 = v4; + +module.exports = uuid; + + +/***/ }), +/* 59 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -32928,6 +33349,27 @@ let initUpdateBins = (() => { }; })(); +let list = (() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + yield updateCwd(config); + + // install so we get hard file paths + const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.cwd); + const install = new (_install || _load_install()).Install({ skipIntegrityCheck: true }, config, new (_baseReporter || _load_baseReporter()).default(), lockfile); + const patterns = yield install.init(); + + // dump global modules + for (const pattern of patterns) { + const manifest = install.resolver.getStrictResolvedPattern(pattern); + ls(manifest, reporter, false); + } + }); + + return function list(_x6, _x7, _x8, _x9) { + return _ref5.apply(this, arguments); + }; +})(); + exports.hasWrapper = hasWrapper; exports.getBinFolder = getBinFolder; exports.setFlags = setFlags; @@ -32947,13 +33389,13 @@ function _load_index() { var _baseReporter; function _load_baseReporter() { - return _baseReporter = _interopRequireDefault(__webpack_require__(49)); + return _baseReporter = _interopRequireDefault(__webpack_require__(51)); } var _buildSubCommands2; function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(36)); + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(35)); } var _wrapper; @@ -32965,13 +33407,13 @@ function _load_wrapper() { var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } var _add; function _load_add() { - return _add = __webpack_require__(75); + return _add = __webpack_require__(78); } var _remove; @@ -32995,7 +33437,7 @@ function _load_upgradeInteractive() { var _packageLinker; function _load_packageLinker() { - return _packageLinker = __webpack_require__(114); + return _packageLinker = __webpack_require__(120); } var _fs; @@ -33104,18 +33546,14 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def ls(config, reporter, flags, args) { return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - yield updateCwd(config); - - // install so we get hard file paths - const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.cwd); - const install = new (_install || _load_install()).Install({ skipIntegrityCheck: true }, config, new (_baseReporter || _load_baseReporter()).default(), lockfile); - const patterns = yield install.init(); + reporter.warn(`\`yarn global ls\` is deprecated. Please use \`yarn global list\`.`); + yield list(config, reporter, flags, args); + })(); + }, - // dump global modules - for (const pattern of patterns) { - const manifest = install.resolver.getStrictResolvedPattern(pattern); - ls(manifest, reporter, false); - } + list(config, reporter, flags, args) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + yield list(config, reporter, flags, args); })(); }, @@ -33171,7 +33609,7 @@ function setFlags(commander) { } /***/ }), -/* 57 */ +/* 60 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33258,7 +33696,10 @@ let getToken = exports.getToken = (() => { const username = creds.username, email = creds.email; - const password = yield reporter.question(reporter.lang('npmPassword'), { password: true, required: true }); + const password = yield reporter.question(reporter.lang('npmPassword'), { + password: true, + required: true + }); // const userobj = { @@ -33336,7 +33777,7 @@ function hasWrapper() { function setFlags() {} /***/ }), -/* 58 */ +/* 61 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33355,7 +33796,7 @@ function _load_asyncToGenerator() { var _index; function _load_index() { - return _index = __webpack_require__(52); + return _index = __webpack_require__(53); } var _errors; @@ -33373,7 +33814,7 @@ function _load_misc() { var _version; function _load_version() { - return _version = _interopRequireWildcard(__webpack_require__(123)); + return _version = _interopRequireWildcard(__webpack_require__(127)); } var _index2; @@ -33385,13 +33826,13 @@ function _load_index2() { var _exoticResolver; function _load_exoticResolver() { - return _exoticResolver = _interopRequireDefault(__webpack_require__(50)); + return _exoticResolver = _interopRequireDefault(__webpack_require__(43)); } var _git; function _load_git() { - return _git = _interopRequireDefault(__webpack_require__(120)); + return _git = _interopRequireDefault(__webpack_require__(125)); } 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; } } @@ -33544,7 +33985,7 @@ class GitResolver extends (_exoticResolver || _load_exoticResolver()).default { exports.default = GitResolver; /***/ }), -/* 59 */ +/* 62 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33553,221 +33994,438 @@ exports.default = GitResolver; Object.defineProperty(exports, "__esModule", { value: true }); -exports.exec = exports.queue = undefined; -exports.spawn = spawn; - -var _constants; - -function _load_constants() { - return _constants = _interopRequireWildcard(__webpack_require__(8)); -} +exports.execCommand = exports.execFromManifest = exports.executeLifecycleScript = exports.makeEnv = undefined; -var _blockingQueue; +var _extends2; -function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(80)); +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(45)); } -var _errors; +var _slicedToArray2; -function _load_errors() { - return _errors = __webpack_require__(3); +function _load_slicedToArray() { + return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); } -var _promise; +var _asyncToGenerator2; -function _load_promise() { - return _promise = __webpack_require__(61); +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -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; } } - -/* global child_process$spawnOpts */ - -const child = __webpack_require__(105); - -const queue = exports.queue = new (_blockingQueue || _load_blockingQueue()).default('child', (_constants || _load_constants()).CHILD_CONCURRENCY); +let makeEnv = exports.makeEnv = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (stage, cwd, config) { + const env = Object.assign({}, process.env); -// TODO: this uid check is kinda whack -let uid = 0; + // Merge in the `env` object specified in .yarnrc + const customEnv = config.getOption('env'); + if (customEnv && typeof customEnv === 'object') { + Object.assign(env, customEnv); + } -const exec = exports.exec = (0, (_promise || _load_promise()).promisify)(child.exec); + env.npm_lifecycle_event = stage; + env.npm_node_execpath = env.NODE || process.execPath; + env.npm_execpath = env.npm_execpath || process.mainModule.filename; -function spawn(program, args) { - let opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - let onData = arguments[3]; + // Set the env to production for npm compat if production mode. + // https://github.com/npm/npm/blob/30d75e738b9cb7a6a3f9b50e971adcbe63458ed3/lib/utils/lifecycle.js#L336 + if (config.production) { + env.NODE_ENV = 'production'; + } - return queue.push(opts.cwd || String(++uid), () => new Promise((resolve, reject) => { - const proc = child.spawn(program, args, opts); + // Note: npm_config_argv environment variable contains output of nopt - command-line + // parser used by npm. Since we use other parser, we just roughly emulate it's output. (See: #684) + env.npm_config_argv = JSON.stringify({ + remain: [], + cooked: [config.commandName], + original: [config.commandName] + }); - let processingDone = false; - let processClosed = false; - let err = null; + // add npm_package_* + const manifest = yield config.maybeReadManifest(cwd); + if (manifest) { + const queue = [['', manifest]]; + while (queue.length) { + var _queue$pop = queue.pop(), + _queue$pop2 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_queue$pop, 2); - let stdout = ''; + const key = _queue$pop2[0], + val = _queue$pop2[1]; - proc.on('error', err => { - if (err.code === 'ENOENT') { - reject(new (_errors || _load_errors()).MessageError(`Couldn't find the binary ${program}`)); - } else { - reject(err); - } - }); + if (key[0] === '_') { + continue; + } - function updateStdout(chunk) { - stdout += chunk; - if (onData) { - onData(chunk); + if (typeof val === 'object') { + for (const subKey in val) { + const completeKey = [key, subKey].filter(function (part) { + return !!part; + }).join('_'); + queue.push([completeKey, val[subKey]]); + } + } else if (IGNORE_MANIFEST_KEYS.indexOf(key) < 0) { + let cleanVal = String(val); + if (cleanVal.indexOf('\n') >= 0) { + cleanVal = JSON.stringify(cleanVal); + } + env[`npm_package_${key}`] = cleanVal; + } } } - function finish() { - if (err) { - reject(err); - } else { - resolve(stdout.trim()); + // add npm_config_* + const keys = new Set([...Object.keys(config.registries.yarn.config), ...Object.keys(config.registries.npm.config)]); + for (const key of keys) { + if (key.match(/:_/) || IGNORE_CONFIG_KEYS.indexOf(key) >= 0) { + continue; } - } - if (typeof opts.process === 'function') { - opts.process(proc, updateStdout, reject, function () { - if (processClosed) { - finish(); - } else { - processingDone = true; - } - }); - } else { - if (proc.stderr) { - proc.stderr.on('data', updateStdout); + let val = config.getOption(key); + + if (!val) { + val = ''; + } else if (typeof val === 'number') { + val = '' + val; + } else if (typeof val !== 'string') { + val = JSON.stringify(val); } - if (proc.stdout) { - proc.stdout.on('data', updateStdout); + if (val.indexOf('\n') >= 0) { + val = JSON.stringify(val); } - processingDone = true; + const cleanKey = key.replace(/^_+/, ''); + const envKey = `npm_config_${cleanKey}`.replace(/[^a-zA-Z0-9_]/g, '_'); + env[envKey] = val; } - proc.on('close', code => { - if (code >= 1) { - // TODO make this output nicer - err = new (_errors || _load_errors()).SpawnError(['Command failed.', `Exit code: ${code}`, `Command: ${program}`, `Arguments: ${args.join(' ')}`, `Directory: ${opts.cwd || process.cwd()}`, `Output:\n${stdout.trim()}`].join('\n')); - err.EXIT_CODE = code; - } + return env; + }); - if (processingDone || err) { - finish(); - } else { - processClosed = true; - } - }); - })); -} + return function makeEnv(_x, _x2, _x3) { + return _ref.apply(this, arguments); + }; +})(); -/***/ }), -/* 60 */ -/***/ (function(module, exports, __webpack_require__) { +let executeLifecycleScript = exports.executeLifecycleScript = (() => { + var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (stage, config, cwd, cmd, spinner) { + // if we don't have a spinner then pipe everything to the terminal + const stdio = spinner ? undefined : 'inherit'; -"use strict"; + const env = yield makeEnv(stage, cwd, config); + // split up the path + const pathParts = (env[(_constants || _load_constants()).ENV_PATH_KEY] || '').split(path.delimiter); -Object.defineProperty(exports, "__esModule", { - value: true -}); + // Include node-gyp version that was bundled with the current Node.js version, + // if available. + pathParts.unshift(path.join(path.dirname(process.execPath), 'node_modules', 'npm', 'bin', 'node-gyp-bin')); + pathParts.unshift(path.join(path.dirname(process.execPath), '..', 'lib', 'node_modules', 'npm', 'bin', 'node-gyp-bin')); -var _slicedToArray2; + // Add global bin folder, as some packages depend on a globally-installed + // version of node-gyp. + pathParts.unshift((0, (_global || _load_global()).getBinFolder)(config, {})); -function _load_slicedToArray() { - return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); -} + // add .bin folders to PATH + for (const registry of Object.keys((_index || _load_index()).registries)) { + const binFolder = path.join(config.registries[registry].folder, '.bin'); + pathParts.unshift(path.join(config.linkFolder, binFolder)); + pathParts.unshift(path.join(cwd, binFolder)); + } -exports.isValidPackageName = isValidPackageName; + yield checkForGypIfNeeded(config, cmd, pathParts); -exports.default = function (info, isRoot, reporter, warn) { - if (isRoot) { - for (const key in (_typos || _load_typos()).default) { - if (key in info) { - warn(reporter.lang('manifestPotentialTypo', key, (_typos || _load_typos()).default[key])); - } - } - } + // join path back together + env[(_constants || _load_constants()).ENV_PATH_KEY] = pathParts.join(path.delimiter); - // validate name - const name = info.name; + // get shell + const conf = { windowsVerbatimArguments: false }; + let sh = 'sh'; + let shFlag = '-c'; + if (process.platform === 'win32') { + // cmd or command.com + sh = process.env.comspec || 'cmd'; - if (typeof name === 'string') { - if (isRoot && isBuiltinModule(name)) { - warn(reporter.lang('manifestBuiltinModule', name)); - } + // d - Ignore registry AutoRun commands + // s - Strip " quote characters from command. + // c - Run Command and then terminate + shFlag = '/d /s /c'; - // cannot start with a dot - if (name[0] === '.') { - throw new (_errors || _load_errors()).MessageError(reporter.lang('manifestNameDot')); - } + // handle windows run scripts starting with a relative path + cmd = (0, (_fixCmdWinSlashes || _load_fixCmdWinSlashes()).fixCmdWinSlashes)(cmd); - // cannot contain the following characters - if (!isValidPackageName(name)) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('manifestNameIllegalChars')); + // handle quotes properly in windows environments - https://github.com/nodejs/node/issues/5060 + conf.windowsVerbatimArguments = true; } - // cannot equal node_modules or favicon.ico - const lower = name.toLowerCase(); - if (lower === 'node_modules' || lower === 'favicon.ico') { - throw new (_errors || _load_errors()).MessageError(reporter.lang('manifestNameBlacklisted')); - } - } + const stdout = yield (_child || _load_child()).spawn(sh, [shFlag, cmd], (0, (_extends2 || _load_extends()).default)({ cwd, env, stdio }, conf), function (data) { + if (spinner) { + const line = data.toString() // turn buffer into string + .trim() // trim whitespace + .split('\n') // split into lines + .pop() // use only the last line + .replace(/\t/g, ' '); // change tabs to spaces as they can interfere with the console - // validate license - if (isRoot && !info.private) { - if (typeof info.license === 'string') { - const license = info.license.replace(/\*$/g, ''); - if (!(0, (_util || _load_util()).isValidLicense)(license)) { - warn(reporter.lang('manifestLicenseInvalid')); + if (line) { + spinner.tick(line); + } } - } else { - warn(reporter.lang('manifestLicenseNone')); - } - } + }); - // validate strings - for (const key of strings) { - const val = info[key]; - if (val && typeof val !== 'string') { - throw new (_errors || _load_errors()).MessageError(reporter.lang('manifestStringExpected', key)); - } - } + return { cwd, command: cmd, stdout }; + }); - cleanDependencies(info, isRoot, reporter, warn); -}; + return function executeLifecycleScript(_x4, _x5, _x6, _x7, _x8) { + return _ref2.apply(this, arguments); + }; +})(); -exports.cleanDependencies = cleanDependencies; +let _checkForGyp = (() => { + var _ref3 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, paths) { + const reporter = config.reporter; -var _errors; + // Check every directory in the PATH -function _load_errors() { - return _errors = __webpack_require__(3); -} + const allChecks = yield Promise.all(paths.map(function (dir) { + return (0, (_fs || _load_fs()).exists)(path.join(dir, 'node-gyp')); + })); + if (allChecks.some(Boolean)) { + // node-gyp is available somewhere + return; + } -var _util; + reporter.info(reporter.lang('packageRequiresNodeGyp')); -function _load_util() { - return _util = __webpack_require__(121); -} + try { + yield (0, (_global || _load_global()).run)(config, reporter, {}, ['add', 'node-gyp']); + } catch (e) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('nodeGypAutoInstallFailed', e.message)); + } + }); -var _typos; + return function _checkForGyp(_x9, _x10) { + return _ref3.apply(this, arguments); + }; +})(); -function _load_typos() { - return _typos = _interopRequireDefault(__webpack_require__(378)); -} +let execFromManifest = exports.execFromManifest = (() => { + var _ref4 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, commandName, cwd) { + const pkg = yield config.maybeReadManifest(cwd); + if (!pkg || !pkg.scripts) { + return; + } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + const cmd = pkg.scripts[commandName]; + if (cmd) { + yield execCommand(commandName, config, cmd, cwd); + } + }); -const isBuiltinModule = __webpack_require__(526); + return function execFromManifest(_x11, _x12, _x13) { + return _ref4.apply(this, arguments); + }; +})(); -const strings = ['name', 'version']; +let execCommand = exports.execCommand = (() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (stage, config, cmd, cwd) { + const reporter = config.reporter; + + try { + reporter.command(cmd); + yield executeLifecycleScript(stage, config, cwd, cmd); + return Promise.resolve(); + } catch (err) { + if (err instanceof (_errors || _load_errors()).SpawnError) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('commandFailed', err.EXIT_CODE)); + } else { + throw err; + } + } + }); + + return function execCommand(_x14, _x15, _x16, _x17) { + return _ref5.apply(this, arguments); + }; +})(); + +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(3); +} + +var _constants; + +function _load_constants() { + return _constants = _interopRequireWildcard(__webpack_require__(8)); +} + +var _child; + +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(44)); +} + +var _fs; + +function _load_fs() { + return _fs = __webpack_require__(4); +} + +var _index; + +function _load_index() { + return _index = __webpack_require__(53); +} + +var _fixCmdWinSlashes; + +function _load_fixCmdWinSlashes() { + return _fixCmdWinSlashes = __webpack_require__(382); +} + +var _global; + +function _load_global() { + return _global = __webpack_require__(59); +} + +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__(1); + +const IGNORE_MANIFEST_KEYS = ['readme']; + +// We treat these configs as internal, thus not expose them to process.env. +// This helps us avoid some gyp issues when building native modules. +// See https://github.com/yarnpkg/yarn/issues/2286. +const IGNORE_CONFIG_KEYS = ['lastUpdateCheck']; + +exports.default = executeLifecycleScript; + + +let checkGypPromise = null; +/** + * Special case: Some packages depend on node-gyp, but don't specify this in + * their package.json dependencies. They assume that node-gyp is available + * globally. We need to detect this case and show an error message. + */ +function checkForGypIfNeeded(config, cmd, paths) { + if (cmd.substr(0, cmd.indexOf(' ')) !== 'node-gyp') { + return Promise.resolve(); + } + + // Ensure this only runs once, rather than multiple times in parallel. + if (!checkGypPromise) { + checkGypPromise = _checkForGyp(config, paths); + } + return checkGypPromise; +} + +/***/ }), +/* 63 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _slicedToArray2; + +function _load_slicedToArray() { + return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); +} + +exports.isValidPackageName = isValidPackageName; + +exports.default = function (info, isRoot, reporter, warn) { + if (isRoot) { + for (const key in (_typos || _load_typos()).default) { + if (key in info) { + warn(reporter.lang('manifestPotentialTypo', key, (_typos || _load_typos()).default[key])); + } + } + } + + // validate name + const name = info.name; + + if (typeof name === 'string') { + if (isRoot && isBuiltinModule(name)) { + warn(reporter.lang('manifestBuiltinModule', name)); + } + + // cannot start with a dot + if (name[0] === '.') { + throw new (_errors || _load_errors()).MessageError(reporter.lang('manifestNameDot')); + } + + // cannot contain the following characters + if (!isValidPackageName(name)) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('manifestNameIllegalChars')); + } + + // cannot equal node_modules or favicon.ico + const lower = name.toLowerCase(); + if (lower === 'node_modules' || lower === 'favicon.ico') { + throw new (_errors || _load_errors()).MessageError(reporter.lang('manifestNameBlacklisted')); + } + } + + // validate license + if (isRoot && !info.private) { + if (typeof info.license === 'string') { + const license = info.license.replace(/\*$/g, ''); + if (!(0, (_util || _load_util()).isValidLicense)(license)) { + warn(reporter.lang('manifestLicenseInvalid')); + } + } else { + warn(reporter.lang('manifestLicenseNone')); + } + } + + // validate strings + for (const key of strings) { + const val = info[key]; + if (val && typeof val !== 'string') { + throw new (_errors || _load_errors()).MessageError(reporter.lang('manifestStringExpected', key)); + } + } + + cleanDependencies(info, isRoot, reporter, warn); +}; + +exports.cleanDependencies = cleanDependencies; + +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(3); +} + +var _util; + +function _load_util() { + return _util = __webpack_require__(126); +} + +var _typos; + +function _load_typos() { + return _typos = _interopRequireDefault(__webpack_require__(387)); +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const isBuiltinModule = __webpack_require__(533); + +const strings = ['name', 'version']; const dependencyKeys = [ // npm registry will include optionalDependencies in dependencies and we'll want to dedupe them from the @@ -33807,41 +34465,54 @@ function cleanDependencies(info, isRoot, reporter, warn) { depTypes.push([type, deps]); } - // ensure that dependencies don't have ones that can collide + // aggregate all non-trivial deps (not '' or '*') + const nonTrivialDeps = new Map(); for (const _ref of depTypes) { var _ref2 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref, 2); const type = _ref2[0]; const deps = _ref2[1]; - for (const name in deps) { + for (const name of Object.keys(deps)) { const version = deps[name]; + if (!nonTrivialDeps.has(name) && version && version !== '*') { + nonTrivialDeps.set(name, { type, version }); + } + } + } - // check collisions - for (const _ref3 of depTypes) { - var _ref4 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref3, 2); + // overwrite first dep of package with non-trivial version, remove the rest + const setDeps = new Set(); + for (const _ref3 of depTypes) { + var _ref4 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref3, 2); - const type2 = _ref4[0]; - const deps2 = _ref4[1]; + const type = _ref4[0]; + const deps = _ref4[1]; - const version2 = deps2[name]; - if (deps === deps2 || !version2 || version2 === '*') { - continue; - } + for (const name of Object.keys(deps)) { + let version = deps[name]; - if (version !== version2 && isRoot) { + const dep = nonTrivialDeps.get(name); + if (dep) { + if (version && version !== '*' && version !== dep.version && isRoot) { // only throw a warning when at the root - warn(reporter.lang('manifestDependencyCollision', type, name, version, type2, version2)); + warn(reporter.lang('manifestDependencyCollision', dep.type, name, dep.version, type, version)); } + version = dep.version; + } - delete deps2[name]; + if (setDeps.has(name)) { + delete deps[name]; + } else { + deps[name] = version; + setDeps.add(name); } } } } /***/ }), -/* 61 */ +/* 64 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -33943,7 +34614,7 @@ function queue(arr, promiseProducer) { } /***/ }), -/* 62 */ +/* 65 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -34000,7 +34671,7 @@ function _load_fs() { var _fs2; function _load_fs2() { - return _fs2 = _interopRequireDefault(__webpack_require__(5)); + return _fs2 = _interopRequireDefault(__webpack_require__(6)); } var _path; @@ -34012,7 +34683,7 @@ function _load_path() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } // This will be bundled directly in the .js file for production builds -var _require = __webpack_require__(272); /** +var _require = __webpack_require__(277); /** * Determines the current version of Yarn itself. * */ @@ -34023,11 +34694,76 @@ exports.version = version; /* WEBPACK VAR INJECTION */}.call(exports, "/")) /***/ }), -/* 63 */ +/* 66 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _packageRequest; + +function _load_packageRequest() { + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const semver = __webpack_require__(26); + +class WorkspaceLayout { + constructor(workspaces, config) { + this.workspaces = workspaces; + this.config = config; + } + + getWorkspaceManifest(key) { + return this.workspaces[key]; + } + + getManifestByPattern(pattern) { + var _PackageRequest$norma = (_packageRequest || _load_packageRequest()).default.normalizePattern(pattern); + + const name = _PackageRequest$norma.name, + range = _PackageRequest$norma.range; + + const workspace = this.getWorkspaceManifest(name); + if (!workspace || !semver.satisfies(workspace.manifest.version, range, this.config.looseSemver)) { + return null; + } + return workspace; + } +} +exports.default = WorkspaceLayout; + +/***/ }), +/* 67 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +exports.__esModule = true; + +var _from = __webpack_require__(393); + +var _from2 = _interopRequireDefault(_from); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports.default = function (arr) { + return Array.isArray(arr) ? arr : (0, _from2.default)(arr); +}; + +/***/ }), +/* 68 */ /***/ (function(module, exports, __webpack_require__) { // optional / simple context binding -var aFunction = __webpack_require__(127); +var aFunction = __webpack_require__(130); module.exports = function(fn, that, length){ aFunction(fn); if(that === undefined)return fn; @@ -34048,24 +34784,24 @@ module.exports = function(fn, that, length){ }; /***/ }), -/* 64 */ +/* 69 */ /***/ (function(module, exports, __webpack_require__) { // Thank's IE8 for his funny defineProperty -module.exports = !__webpack_require__(131)(function(){ +module.exports = !__webpack_require__(134)(function(){ return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }), -/* 65 */ +/* 70 */ /***/ (function(module, exports, __webpack_require__) { -var anObject = __webpack_require__(44) - , IE8_DOM_DEFINE = __webpack_require__(413) - , toPrimitive = __webpack_require__(431) +var anObject = __webpack_require__(46) + , IE8_DOM_DEFINE = __webpack_require__(422) + , toPrimitive = __webpack_require__(440) , dP = Object.defineProperty; -exports.f = __webpack_require__(64) ? Object.defineProperty : function defineProperty(O, P, Attributes){ +exports.f = __webpack_require__(69) ? Object.defineProperty : function defineProperty(O, P, Attributes){ anObject(O); P = toPrimitive(P, true); anObject(Attributes); @@ -34078,7 +34814,7 @@ exports.f = __webpack_require__(64) ? Object.defineProperty : function definePro }; /***/ }), -/* 66 */ +/* 71 */ /***/ (function(module, exports) { // Copyright Joyent, Inc. and other Node contributors. @@ -34191,93 +34927,7 @@ function objectToString(o) { /***/ }), -/* 67 */ -/***/ (function(module, exports, __webpack_require__) { - -var Stream = (function (){ - try { - return __webpack_require__(14); // hack to fix a circular dependency issue when used with browserify - } catch(_){} -}()); -exports = module.exports = __webpack_require__(248); -exports.Stream = Stream || exports; -exports.Readable = exports; -exports.Writable = __webpack_require__(249); -exports.Duplex = __webpack_require__(46); -exports.Transform = __webpack_require__(158); -exports.PassThrough = __webpack_require__(573); - -if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) { - module.exports = Stream; -} - - -/***/ }), -/* 68 */ -/***/ (function(module, exports, __webpack_require__) { - -var buffer = __webpack_require__(55) - -if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { - module.exports = buffer -} else { - // Copy properties from require('buffer') - Object.keys(buffer).forEach(function (prop) { - exports[prop] = buffer[prop] - }) - exports.Buffer = SafeBuffer -} - -function SafeBuffer (arg, encodingOrOffset, length) { - return Buffer(arg, encodingOrOffset, length) -} - -// Copy static methods from Buffer -Object.keys(Buffer).forEach(function (prop) { - SafeBuffer[prop] = Buffer[prop] -}) - -SafeBuffer.from = function (arg, encodingOrOffset, length) { - if (typeof arg === 'number') { - throw new TypeError('Argument must not be a number') - } - return Buffer(arg, encodingOrOffset, length) -} - -SafeBuffer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - var buf = Buffer(size) - if (fill !== undefined) { - if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - } else { - buf.fill(0) - } - return buf -} - -SafeBuffer.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return Buffer(size) -} - -SafeBuffer.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('Argument must be a number') - } - return buffer.SlowBuffer(size) -} - - -/***/ }), -/* 69 */ +/* 72 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2016 Joyent, Inc. @@ -34286,20 +34936,20 @@ module.exports = Certificate; var assert = __webpack_require__(9); var algs = __webpack_require__(17); -var crypto = __webpack_require__(6); -var Fingerprint = __webpack_require__(70); +var crypto = __webpack_require__(7); +var Fingerprint = __webpack_require__(73); var Signature = __webpack_require__(33); var errs = __webpack_require__(32); var util = __webpack_require__(2); var utils = __webpack_require__(13); var Key = __webpack_require__(18); var PrivateKey = __webpack_require__(19); -var Identity = __webpack_require__(72); +var Identity = __webpack_require__(75); var formats = {}; -formats['openssh'] = __webpack_require__(611); -formats['x509'] = __webpack_require__(259); -formats['pem'] = __webpack_require__(612); +formats['openssh'] = __webpack_require__(618); +formats['x509'] = __webpack_require__(265); +formats['pem'] = __webpack_require__(619); var CertificateParseError = errs.CertificateParseError; var InvalidAlgorithmError = errs.InvalidAlgorithmError; @@ -34321,6 +34971,8 @@ function Certificate(opts) { assert.date(opts.validFrom, 'options.validFrom'); assert.date(opts.validUntil, 'optons.validUntil'); + assert.optionalArrayOfString(opts.purposes, 'options.purposes'); + this._hashCache = {}; this.subjects = opts.subjects; @@ -34331,6 +34983,7 @@ function Certificate(opts) { this.serial = opts.serial; this.validFrom = opts.validFrom; this.validUntil = opts.validUntil; + this.purposes = opts.purposes; } Certificate.formats = formats; @@ -34390,6 +35043,10 @@ Certificate.prototype.isSignedBy = function (issuerCert) { if (!this.issuer.equals(issuerCert.subjects[0])) return (false); + if (this.issuer.purposes && this.issuer.purposes.length > 0 && + this.issuer.purposes.indexOf('ca') === -1) { + return (false); + } return (this.isSignedByKey(issuerCert.subjectKey)); }; @@ -34462,6 +35119,47 @@ Certificate.createSelfSigned = function (subjectOrSubjects, key, options) { if (serial === undefined) serial = new Buffer('0000000000000001', 'hex'); + var purposes = options.purposes; + if (purposes === undefined) + purposes = []; + + if (purposes.indexOf('signature') === -1) + purposes.push('signature'); + + /* Self-signed certs are always CAs. */ + if (purposes.indexOf('ca') === -1) + purposes.push('ca'); + if (purposes.indexOf('crl') === -1) + purposes.push('crl'); + + /* + * If we weren't explicitly given any other purposes, do the sensible + * thing and add some basic ones depending on the subject type. + */ + if (purposes.length <= 3) { + var hostSubjects = subjects.filter(function (subject) { + return (subject.type === 'host'); + }); + var userSubjects = subjects.filter(function (subject) { + return (subject.type === 'user'); + }); + if (hostSubjects.length > 0) { + if (purposes.indexOf('serverAuth') === -1) + purposes.push('serverAuth'); + } + if (userSubjects.length > 0) { + if (purposes.indexOf('clientAuth') === -1) + purposes.push('clientAuth'); + } + if (userSubjects.length > 0 || hostSubjects.length > 0) { + if (purposes.indexOf('keyAgreement') === -1) + purposes.push('keyAgreement'); + if (key.type === 'rsa' && + purposes.indexOf('encryption') === -1) + purposes.push('encryption'); + } + } + var cert = new Certificate({ subjects: subjects, issuer: subjects[0], @@ -34470,7 +35168,8 @@ Certificate.createSelfSigned = function (subjectOrSubjects, key, options) { signatures: {}, serial: serial, validFrom: validFrom, - validUntil: validUntil + validUntil: validUntil, + purposes: purposes }); cert.signWith(key); @@ -34518,6 +35217,42 @@ Certificate.create = if (serial === undefined) serial = new Buffer('0000000000000001', 'hex'); + var purposes = options.purposes; + if (purposes === undefined) + purposes = []; + + if (purposes.indexOf('signature') === -1) + purposes.push('signature'); + + if (options.ca === true) { + if (purposes.indexOf('ca') === -1) + purposes.push('ca'); + if (purposes.indexOf('crl') === -1) + purposes.push('crl'); + } + + var hostSubjects = subjects.filter(function (subject) { + return (subject.type === 'host'); + }); + var userSubjects = subjects.filter(function (subject) { + return (subject.type === 'user'); + }); + if (hostSubjects.length > 0) { + if (purposes.indexOf('serverAuth') === -1) + purposes.push('serverAuth'); + } + if (userSubjects.length > 0) { + if (purposes.indexOf('clientAuth') === -1) + purposes.push('clientAuth'); + } + if (userSubjects.length > 0 || hostSubjects.length > 0) { + if (purposes.indexOf('keyAgreement') === -1) + purposes.push('keyAgreement'); + if (key.type === 'rsa' && + purposes.indexOf('encryption') === -1) + purposes.push('encryption'); + } + var cert = new Certificate({ subjects: subjects, issuer: issuer, @@ -34526,7 +35261,8 @@ Certificate.create = signatures: {}, serial: serial, validFrom: validFrom, - validUntil: validUntil + validUntil: validUntil, + purposes: purposes }); cert.signWith(issuerKey); @@ -34574,7 +35310,7 @@ Certificate._oldVersionDetect = function (obj) { /***/ }), -/* 70 */ +/* 73 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. @@ -34583,10 +35319,10 @@ module.exports = Fingerprint; var assert = __webpack_require__(9); var algs = __webpack_require__(17); -var crypto = __webpack_require__(6); +var crypto = __webpack_require__(7); var errs = __webpack_require__(32); var Key = __webpack_require__(18); -var Certificate = __webpack_require__(69); +var Certificate = __webpack_require__(72); var utils = __webpack_require__(13); var FingerprintFormatError = errs.FingerprintFormatError; @@ -34741,7 +35477,7 @@ Fingerprint._oldVersionDetect = function (obj) { /***/ }), -/* 71 */ +/* 74 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. @@ -34757,7 +35493,7 @@ module.exports = { }; var assert = __webpack_require__(9); -var asn1 = __webpack_require__(35); +var asn1 = __webpack_require__(34); var algs = __webpack_require__(17); var utils = __webpack_require__(13); var Key = __webpack_require__(18); @@ -35252,22 +35988,22 @@ function writePkcs8ECDSAPrivate(key, der) { /***/ }), -/* 72 */ +/* 75 */ /***/ (function(module, exports, __webpack_require__) { -// Copyright 2016 Joyent, Inc. +// Copyright 2017 Joyent, Inc. module.exports = Identity; var assert = __webpack_require__(9); var algs = __webpack_require__(17); -var crypto = __webpack_require__(6); -var Fingerprint = __webpack_require__(70); +var crypto = __webpack_require__(7); +var Fingerprint = __webpack_require__(73); var Signature = __webpack_require__(33); var errs = __webpack_require__(32); var util = __webpack_require__(2); var utils = __webpack_require__(13); -var asn1 = __webpack_require__(35); +var asn1 = __webpack_require__(34); /*JSSTYLED*/ var DNS_NAME_RE = /^([*]|[a-z0-9][a-z0-9\-]{0,62})(?:\.([*]|[a-z0-9][a-z0-9\-]{0,62}))*$/i; @@ -35535,27 +36271,19 @@ Identity._oldVersionDetect = function (obj) { /***/ }), -/* 73 */ -/***/ (function(module, exports, __webpack_require__) { - -var v1 = __webpack_require__(625); -var v4 = __webpack_require__(626); - -var uuid = v4; -uuid.v1 = v1; -uuid.v4 = v4; - -module.exports = uuid; +/* 76 */ +/***/ (function(module, exports) { +module.exports = require("buffer"); /***/ }), -/* 74 */ +/* 77 */ /***/ (function(module, exports) { module.exports = require("net"); /***/ }), -/* 75 */ +/* 78 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35578,7 +36306,7 @@ let run = exports.run = (() => { throw new (_errors || _load_errors()).MessageError(reporter.lang('missingAddDependencies')); } - const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.cwd, reporter); + const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.lockfileFolder, reporter); yield (0, (_install || _load_install()).wrapLifecycle)(config, flags, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { const install = new Add(args, flags, config, reporter, lockfile); @@ -35603,7 +36331,7 @@ function _load_wrapper() { var _packageRequest; function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); } var _list; @@ -35615,7 +36343,7 @@ function _load_list() { var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } var _errors; @@ -35626,7 +36354,7 @@ function _load_errors() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); class Add extends (_install || _load_install()).Install { constructor(args, flags, config, reporter, lockfile) { @@ -35811,7 +36539,7 @@ function setFlags(commander) { } /***/ }), -/* 76 */ +/* 79 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35850,6 +36578,7 @@ const path = __webpack_require__(1); class BaseFetcher { constructor(dest, remote, config) { this.reporter = config.reporter; + this.packageName = remote.packageName; this.reference = remote.reference; this.registry = remote.registry; this.hash = remote.hash; @@ -35905,7 +36634,7 @@ class BaseFetcher { exports.default = BaseFetcher; /***/ }), -/* 77 */ +/* 80 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -35946,10 +36675,10 @@ function _load_map() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); /* eslint quotes: 0 */ -const stripBOM = __webpack_require__(261); +const stripBOM = __webpack_require__(266); const VERSION_REGEX = /^yarn lockfile v(\d+)$/; @@ -36023,7 +36752,7 @@ function* tokenise(input) { val += currentChar; if (i > 0 && currentChar === '"') { - const isEscaped = input[i - 1] === "\\" && input[i - 2] !== "\\"; + const isEscaped = input[i - 1] === '\\' && input[i - 2] !== '\\'; if (!isEscaped) { break; } @@ -36062,7 +36791,7 @@ function* tokenise(input) { yield buildToken(TOKEN_TYPES.comma); chop++; } else if (/^[a-zA-Z\/-]/g.test(input)) { - let name = ""; + let name = ''; for (let i = 0; i < input.length; i++) { const char = input[i]; if (char === ':' || char === ' ' || char === '\n' || char === ',') { @@ -36253,7 +36982,7 @@ class Parser { exports.Parser = Parser; /***/ }), -/* 78 */ +/* 81 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36276,7 +37005,7 @@ function _load_constants() { return _constants = __webpack_require__(8); } -const YARN_VERSION = __webpack_require__(272).version; +const YARN_VERSION = __webpack_require__(277).version; const NODE_VERSION = process.version; function shouldWrapKey(str) { @@ -36360,7 +37089,7 @@ function _stringify(obj, options) { return indent + lines.join(`\n${indent}`); } -function stringify(obj, noHeader, skipVersions) { +function stringify(obj, noHeader, enableVersions) { const val = _stringify(obj, { indent: '', topLevel: true @@ -36372,7 +37101,7 @@ function stringify(obj, noHeader, skipVersions) { const lines = []; lines.push('# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.'); lines.push(`# yarn lockfile v${(_constants || _load_constants()).LOCKFILE_VERSION}`); - if (!skipVersions) { + if (enableVersions) { lines.push(`# yarn v${YARN_VERSION}`); lines.push(`# node ${NODE_VERSION}`); } @@ -36383,7 +37112,7 @@ function stringify(obj, noHeader, skipVersions) { } /***/ }), -/* 79 */ +/* 82 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36396,7 +37125,7 @@ Object.defineProperty(exports, "__esModule", { var _consoleReporter; function _load_consoleReporter() { - return _consoleReporter = __webpack_require__(359); + return _consoleReporter = __webpack_require__(366); } Object.defineProperty(exports, 'ConsoleReporter', { @@ -36409,7 +37138,7 @@ Object.defineProperty(exports, 'ConsoleReporter', { var _bufferReporter; function _load_bufferReporter() { - return _bufferReporter = __webpack_require__(358); + return _bufferReporter = __webpack_require__(365); } Object.defineProperty(exports, 'BufferReporter', { @@ -36422,7 +37151,7 @@ Object.defineProperty(exports, 'BufferReporter', { var _eventReporter; function _load_eventReporter() { - return _eventReporter = __webpack_require__(363); + return _eventReporter = __webpack_require__(370); } Object.defineProperty(exports, 'EventReporter', { @@ -36435,7 +37164,7 @@ Object.defineProperty(exports, 'EventReporter', { var _jsonReporter; function _load_jsonReporter() { - return _jsonReporter = __webpack_require__(116); + return _jsonReporter = __webpack_require__(122); } Object.defineProperty(exports, 'JSONReporter', { @@ -36448,7 +37177,7 @@ Object.defineProperty(exports, 'JSONReporter', { var _noopReporter; function _load_noopReporter() { - return _noopReporter = __webpack_require__(365); + return _noopReporter = __webpack_require__(372); } Object.defineProperty(exports, 'NoopReporter', { @@ -36461,7 +37190,7 @@ Object.defineProperty(exports, 'NoopReporter', { var _baseReporter; function _load_baseReporter() { - return _baseReporter = __webpack_require__(49); + return _baseReporter = __webpack_require__(51); } Object.defineProperty(exports, 'Reporter', { @@ -36474,7 +37203,44 @@ Object.defineProperty(exports, 'Reporter', { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /***/ }), -/* 80 */ +/* 83 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +class BaseResolver { + constructor(request, fragment) { + this.resolver = request.resolver; + this.reporter = request.reporter; + this.fragment = fragment; + this.registry = request.registry; + this.request = request; + this.pattern = request.pattern; + this.config = request.config; + } + + fork(Resolver, resolveArg) { + for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { + args[_key - 2] = arguments[_key]; + } + + const resolver = new Resolver(this.request, ...args); + resolver.registry = this.registry; + return resolver.resolve(resolveArg); + } + + resolve() { + throw new Error('Not implemented'); + } +} +exports.default = BaseResolver; + +/***/ }), +/* 84 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36492,7 +37258,7 @@ function _load_map() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const debug = __webpack_require__(443)('yarn'); +const debug = __webpack_require__(452)('yarn'); class BlockingQueue { constructor(alias) { @@ -36612,7 +37378,7 @@ class BlockingQueue { exports.default = BlockingQueue; /***/ }), -/* 81 */ +/* 85 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36622,7 +37388,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.hash = hash; -const crypto = __webpack_require__(6); +const crypto = __webpack_require__(7); const stream = __webpack_require__(14); function hash(content) { @@ -36655,7 +37421,7 @@ class HashStream extends stream.Transform { exports.HashStream = HashStream; /***/ }), -/* 82 */ +/* 86 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -36664,341 +37430,29 @@ exports.HashStream = HashStream; Object.defineProperty(exports, "__esModule", { value: true }); -exports.execCommand = exports.execFromManifest = exports.executeLifecycleScript = undefined; - -var _extends2; - -function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(43)); -} - -var _slicedToArray2; - -function _load_slicedToArray() { - return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); -} - -var _asyncToGenerator2; - -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); -} - -let makeEnv = (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (stage, cwd, config) { - const env = Object.assign({}, process.env); - - // Merge in the `env` object specified in .yarnrc - const customEnv = config.getOption('env'); - if (customEnv && typeof customEnv === 'object') { - Object.assign(env, customEnv); - } - - env.npm_lifecycle_event = stage; - env.npm_node_execpath = env.NODE || process.execPath; - env.npm_execpath = env.npm_execpath || process.mainModule.filename; - - // Set the env to production for npm compat if production mode. - // https://github.com/npm/npm/blob/30d75e738b9cb7a6a3f9b50e971adcbe63458ed3/lib/utils/lifecycle.js#L336 - if (config.production) { - env.NODE_ENV = 'production'; - } - - // Note: npm_config_argv environment variable contains output of nopt - command-line - // parser used by npm. Since we use other parser, we just roughly emulate it's output. (See: #684) - env.npm_config_argv = JSON.stringify({ remain: [], cooked: [config.commandName], original: [config.commandName] }); - - // add npm_package_* - const manifest = yield config.maybeReadManifest(cwd); - if (manifest) { - const queue = [['', manifest]]; - while (queue.length) { - var _queue$pop = queue.pop(), - _queue$pop2 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_queue$pop, 2); - - const key = _queue$pop2[0], - val = _queue$pop2[1]; - - if (key[0] === '_') { - continue; - } - - if (typeof val === 'object') { - for (const subKey in val) { - const completeKey = [key, subKey].filter(function (part) { - return !!part; - }).join('_'); - queue.push([completeKey, val[subKey]]); - } - } else if (IGNORE_MANIFEST_KEYS.indexOf(key) < 0) { - let cleanVal = String(val); - if (cleanVal.indexOf('\n') >= 0) { - cleanVal = JSON.stringify(cleanVal); - } - env[`npm_package_${key}`] = cleanVal; - } - } - } - - // add npm_config_* - const keys = new Set([...Object.keys(config.registries.yarn.config), ...Object.keys(config.registries.npm.config)]); - for (const key of keys) { - if (key.match(/:_/) || IGNORE_CONFIG_KEYS.indexOf(key) >= 0) { - continue; - } - - let val = config.getOption(key); - - if (!val) { - val = ''; - } else if (typeof val === 'number') { - val = '' + val; - } else if (typeof val !== 'string') { - val = JSON.stringify(val); - } - - if (val.indexOf('\n') >= 0) { - val = JSON.stringify(val); - } - - const cleanKey = key.replace(/^_+/, ''); - const envKey = `npm_config_${cleanKey}`.replace(/[^a-zA-Z0-9_]/g, '_'); - env[envKey] = val; - } - - return env; - }); - - return function makeEnv(_x, _x2, _x3) { - return _ref.apply(this, arguments); - }; -})(); - -let executeLifecycleScript = exports.executeLifecycleScript = (() => { - var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (stage, config, cwd, cmd, spinner) { - // if we don't have a spinner then pipe everything to the terminal - const stdio = spinner ? undefined : 'inherit'; - - const env = yield makeEnv(stage, cwd, config); - - // split up the path - const pathParts = (env[(_constants || _load_constants()).ENV_PATH_KEY] || '').split(path.delimiter); - // Include node-gyp version that was bundled with the current Node.js version, - // if available. - pathParts.unshift(path.join(path.dirname(process.execPath), 'node_modules', 'npm', 'bin', 'node-gyp-bin')); - pathParts.unshift(path.join(path.dirname(process.execPath), '..', 'lib', 'node_modules', 'npm', 'bin', 'node-gyp-bin')); - - // Add global bin folder, as some packages depend on a globally-installed - // version of node-gyp. - pathParts.unshift((0, (_global || _load_global()).getBinFolder)(config, {})); - - // add .bin folders to PATH - for (const registry of Object.keys((_index || _load_index()).registries)) { - const binFolder = path.join(config.registries[registry].folder, '.bin'); - pathParts.unshift(path.join(config.linkFolder, binFolder)); - pathParts.unshift(path.join(cwd, binFolder)); - } - - yield checkForGypIfNeeded(config, cmd, pathParts); - - // join path back together - env[(_constants || _load_constants()).ENV_PATH_KEY] = pathParts.join(path.delimiter); - - // get shell - const conf = { windowsVerbatimArguments: false }; - let sh = 'sh'; - let shFlag = '-c'; - if (process.platform === 'win32') { - // cmd or command.com - sh = process.env.comspec || 'cmd'; - - // d - Ignore registry AutoRun commands - // s - Strip " quote characters from command. - // c - Run Command and then terminate - shFlag = '/d /s /c'; - - // handle windows run scripts starting with a relative path - cmd = (0, (_fixCmdWinSlashes || _load_fixCmdWinSlashes()).fixCmdWinSlashes)(cmd); - - // handle quotes properly in windows environments - https://github.com/nodejs/node/issues/5060 - conf.windowsVerbatimArguments = true; - } - - const stdout = yield (_child || _load_child()).spawn(sh, [shFlag, cmd], (0, (_extends2 || _load_extends()).default)({ cwd, env, stdio }, conf), function (data) { - if (spinner) { - const line = data.toString() // turn buffer into string - .trim() // trim whitespace - .split('\n') // split into lines - .pop() // use only the last line - .replace(/\t/g, ' '); // change tabs to spaces as they can interfere with the console - - if (line) { - spinner.tick(line); - } - } - }); - - return { cwd, command: cmd, stdout }; - }); - - return function executeLifecycleScript(_x4, _x5, _x6, _x7, _x8) { - return _ref2.apply(this, arguments); - }; -})(); - -let _checkForGyp = (() => { - var _ref3 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, paths) { - const reporter = config.reporter; - - // Check every directory in the PATH - - const allChecks = yield Promise.all(paths.map(function (dir) { - return (0, (_fs || _load_fs()).exists)(path.join(dir, 'node-gyp')); - })); - if (allChecks.some(Boolean)) { - // node-gyp is available somewhere - return; - } - - reporter.info(reporter.lang('packageRequiresNodeGyp')); - - try { - yield (0, (_global || _load_global()).run)(config, reporter, {}, ['add', 'node-gyp']); - } catch (e) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('nodeGypAutoInstallFailed', e.message)); - } - }); - - return function _checkForGyp(_x9, _x10) { - return _ref3.apply(this, arguments); - }; -})(); - -let execFromManifest = exports.execFromManifest = (() => { - var _ref4 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, commandName, cwd) { - const pkg = yield config.maybeReadManifest(cwd); - if (!pkg || !pkg.scripts) { - return; - } - - const cmd = pkg.scripts[commandName]; - if (cmd) { - yield execCommand(commandName, config, cmd, cwd); - } - }); - - return function execFromManifest(_x11, _x12, _x13) { - return _ref4.apply(this, arguments); - }; -})(); - -let execCommand = exports.execCommand = (() => { - var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (stage, config, cmd, cwd) { - const reporter = config.reporter; - - try { - reporter.command(cmd); - yield executeLifecycleScript(stage, config, cwd, cmd); - return Promise.resolve(); - } catch (err) { - if (err instanceof (_errors || _load_errors()).SpawnError) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('commandFailed', err.EXIT_CODE)); - } else { - throw err; - } - } - }); - - return function execCommand(_x14, _x15, _x16, _x17) { - return _ref5.apply(this, arguments); - }; -})(); - -var _errors; - -function _load_errors() { - return _errors = __webpack_require__(3); -} - -var _constants; - -function _load_constants() { - return _constants = _interopRequireWildcard(__webpack_require__(8)); -} - -var _child; - -function _load_child() { - return _child = _interopRequireWildcard(__webpack_require__(59)); -} - -var _fs; - -function _load_fs() { - return _fs = __webpack_require__(4); -} - -var _index; - -function _load_index() { - return _index = __webpack_require__(52); -} - -var _fixCmdWinSlashes; - -function _load_fixCmdWinSlashes() { - return _fixCmdWinSlashes = __webpack_require__(373); -} - -var _global; +var _rootUser; -function _load_global() { - return _global = __webpack_require__(56); +function _load_rootUser() { + return _rootUser = _interopRequireDefault(__webpack_require__(390)); } -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__(1); -const IGNORE_MANIFEST_KEYS = ['readme']; +const userHomeDir = process.platform === 'linux' && (_rootUser || _load_rootUser()).default ? path.resolve('/usr/local/share') : __webpack_require__(113).homedir(); -// We treat these configs as internal, thus not expose them to process.env. -// This helps us avoid some gyp issues when building native modules. -// See https://github.com/yarnpkg/yarn/issues/2286. -const IGNORE_CONFIG_KEYS = ['lastUpdateCheck']; - -exports.default = executeLifecycleScript; - - -let checkGypPromise = null; -/** - * Special case: Some packages depend on node-gyp, but don't specify this in - * their package.json dependencies. They assume that node-gyp is available - * globally. We need to detect this case and show an error message. - */ -function checkForGypIfNeeded(config, cmd, paths) { - if (cmd.substr(0, cmd.indexOf(' ')) !== 'node-gyp') { - return Promise.resolve(); - } - - // Ensure this only runs once, rather than multiple times in parallel. - if (!checkGypPromise) { - checkGypPromise = _checkForGyp(config, paths); - } - return checkGypPromise; -} +exports.default = userHomeDir; /***/ }), -/* 83 */ +/* 87 */ /***/ (function(module, exports, __webpack_require__) { // Load modules -var Http = __webpack_require__(48); -var Hoek = __webpack_require__(90); +var Http = __webpack_require__(50); +var Hoek = __webpack_require__(95); // Declare internals @@ -37316,7 +37770,7 @@ exports.badImplementation = function (message, data) { /***/ }), -/* 84 */ +/* 88 */ /***/ (function(module, exports) { var toString = {}.toString; @@ -37326,13 +37780,13 @@ module.exports = function(it){ }; /***/ }), -/* 85 */ +/* 89 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(28) +var global = __webpack_require__(29) , core = __webpack_require__(31) - , ctx = __webpack_require__(63) - , hide = __webpack_require__(53) + , ctx = __webpack_require__(68) + , hide = __webpack_require__(54) , PROTOTYPE = 'prototype'; var $export = function(type, name, source){ @@ -37392,7 +37846,7 @@ $export.R = 128; // real proto method for `library` module.exports = $export; /***/ }), -/* 86 */ +/* 90 */ /***/ (function(module, exports) { var hasOwnProperty = {}.hasOwnProperty; @@ -37401,7 +37855,7 @@ module.exports = function(it, key){ }; /***/ }), -/* 87 */ +/* 91 */ /***/ (function(module, exports) { module.exports = function(it){ @@ -37409,15 +37863,15 @@ module.exports = function(it){ }; /***/ }), -/* 88 */ +/* 92 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var $at = __webpack_require__(429)(true); +var $at = __webpack_require__(438)(true); // 21.1.3.27 String.prototype[@@iterator]() -__webpack_require__(217)(String, 'String', function(iterated){ +__webpack_require__(218)(String, 'String', function(iterated){ this._t = String(iterated); // target this._i = 0; // next index // 21.1.5.2.1 %StringIteratorPrototype%.next() @@ -37432,259 +37886,826 @@ __webpack_require__(217)(String, 'String', function(iterated){ }); /***/ }), -/* 89 */ +/* 93 */ /***/ (function(module, exports, __webpack_require__) { -// Load modules - -var Sntp = __webpack_require__(255); -var Boom = __webpack_require__(83); +// Basic Javascript Elliptic Curve implementation +// Ported loosely from BouncyCastle's Java EC code +// Only Fp curves implemented for now +// Requires jsbn.js and jsbn2.js +var BigInteger = __webpack_require__(39).BigInteger +var Barrett = BigInteger.prototype.Barrett -// Declare internals +// ---------------- +// ECFieldElementFp -var internals = {}; +// constructor +function ECFieldElementFp(q,x) { + this.x = x; + // TODO if(x.compareTo(q) >= 0) error + this.q = q; +} +function feFpEquals(other) { + if(other == this) return true; + return (this.q.equals(other.q) && this.x.equals(other.x)); +} -exports.version = function () { +function feFpToBigInteger() { + return this.x; +} - return __webpack_require__(500).version; -}; +function feFpNegate() { + return new ECFieldElementFp(this.q, this.x.negate().mod(this.q)); +} +function feFpAdd(b) { + return new ECFieldElementFp(this.q, this.x.add(b.toBigInteger()).mod(this.q)); +} -exports.limits = { - maxMatchLength: 4096 // Limit the length of uris and headers to avoid a DoS attack on string matching -}; +function feFpSubtract(b) { + return new ECFieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q)); +} +function feFpMultiply(b) { + return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger()).mod(this.q)); +} -// Extract host and port from request +function feFpSquare() { + return new ECFieldElementFp(this.q, this.x.square().mod(this.q)); +} -// $1 $2 -internals.hostHeaderRegex = /^(?:(?:\r\n)?\s)*((?:[^:]+)|(?:\[[^\]]+\]))(?::(\d+))?(?:(?:\r\n)?\s)*$/; // (IPv4, hostname)|(IPv6) +function feFpDivide(b) { + return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q)); +} +ECFieldElementFp.prototype.equals = feFpEquals; +ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger; +ECFieldElementFp.prototype.negate = feFpNegate; +ECFieldElementFp.prototype.add = feFpAdd; +ECFieldElementFp.prototype.subtract = feFpSubtract; +ECFieldElementFp.prototype.multiply = feFpMultiply; +ECFieldElementFp.prototype.square = feFpSquare; +ECFieldElementFp.prototype.divide = feFpDivide; -exports.parseHost = function (req, hostHeaderName) { +// ---------------- +// ECPointFp - hostHeaderName = (hostHeaderName ? hostHeaderName.toLowerCase() : 'host'); - var hostHeader = req.headers[hostHeaderName]; - if (!hostHeader) { - return null; +// constructor +function ECPointFp(curve,x,y,z) { + this.curve = curve; + this.x = x; + this.y = y; + // Projective coordinates: either zinv == null or z * zinv == 1 + // z and zinv are just BigIntegers, not fieldElements + if(z == null) { + this.z = BigInteger.ONE; } - - if (hostHeader.length > exports.limits.maxMatchLength) { - return null; + else { + this.z = z; } + this.zinv = null; + //TODO: compression flag +} - var hostParts = hostHeader.match(internals.hostHeaderRegex); - if (!hostParts) { - return null; +function pointFpGetX() { + if(this.zinv == null) { + this.zinv = this.z.modInverse(this.curve.q); } + var r = this.x.toBigInteger().multiply(this.zinv); + this.curve.reduce(r); + return this.curve.fromBigInteger(r); +} - return { - name: hostParts[1], - port: (hostParts[2] ? hostParts[2] : (req.connection && req.connection.encrypted ? 443 : 80)) - }; -}; - - -// Parse Content-Type header content - -exports.parseContentType = function (header) { - - if (!header) { - return ''; +function pointFpGetY() { + if(this.zinv == null) { + this.zinv = this.z.modInverse(this.curve.q); } + var r = this.y.toBigInteger().multiply(this.zinv); + this.curve.reduce(r); + return this.curve.fromBigInteger(r); +} - return header.split(';')[0].trim().toLowerCase(); -}; - - -// Convert node's to request configuration object +function pointFpEquals(other) { + if(other == this) return true; + if(this.isInfinity()) return other.isInfinity(); + if(other.isInfinity()) return this.isInfinity(); + var u, v; + // u = Y2 * Z1 - Y1 * Z2 + u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q); + if(!u.equals(BigInteger.ZERO)) return false; + // v = X2 * Z1 - X1 * Z2 + v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q); + return v.equals(BigInteger.ZERO); +} -exports.parseRequest = function (req, options) { +function pointFpIsInfinity() { + if((this.x == null) && (this.y == null)) return true; + return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO); +} - if (!req.headers) { - return req; - } +function pointFpNegate() { + return new ECPointFp(this.curve, this.x, this.y.negate(), this.z); +} - // Obtain host and port information +function pointFpAdd(b) { + if(this.isInfinity()) return b; + if(b.isInfinity()) return this; - var host; - if (!options.host || - !options.port) { + // u = Y2 * Z1 - Y1 * Z2 + var u = b.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(b.z)).mod(this.curve.q); + // v = X2 * Z1 - X1 * Z2 + var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q); - host = exports.parseHost(req, options.hostHeaderName); - if (!host) { - return new Error('Invalid Host header'); + if(BigInteger.ZERO.equals(v)) { + if(BigInteger.ZERO.equals(u)) { + return this.twice(); // this == b, so double } + return this.curve.getInfinity(); // this = -b, so infinity } - var request = { - method: req.method, - url: req.url, - host: options.host || host.name, - port: options.port || host.port, - authorization: req.headers.authorization, - contentType: req.headers['content-type'] || '' - }; + var THREE = new BigInteger("3"); + var x1 = this.x.toBigInteger(); + var y1 = this.y.toBigInteger(); + var x2 = b.x.toBigInteger(); + var y2 = b.y.toBigInteger(); - return request; -}; + var v2 = v.square(); + var v3 = v2.multiply(v); + var x1v2 = x1.multiply(v2); + var zu2 = u.square().multiply(this.z); + // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3) + var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q); + // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3 + var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.q); + // z3 = v^3 * z1 * z2 + var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q); -exports.now = function (localtimeOffsetMsec) { + return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3); +} - return Sntp.now() + (localtimeOffsetMsec || 0); -}; +function pointFpTwice() { + if(this.isInfinity()) return this; + if(this.y.toBigInteger().signum() == 0) return this.curve.getInfinity(); + // TODO: optimized handling of constants + var THREE = new BigInteger("3"); + var x1 = this.x.toBigInteger(); + var y1 = this.y.toBigInteger(); -exports.nowSecs = function (localtimeOffsetMsec) { + var y1z1 = y1.multiply(this.z); + var y1sqz1 = y1z1.multiply(y1).mod(this.curve.q); + var a = this.curve.a.toBigInteger(); - return Math.floor(exports.now(localtimeOffsetMsec) / 1000); -}; + // w = 3 * x1^2 + a * z1^2 + var w = x1.square().multiply(THREE); + if(!BigInteger.ZERO.equals(a)) { + w = w.add(this.z.square().multiply(a)); + } + w = w.mod(this.curve.q); + //this.curve.reduce(w); + // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1) + var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.q); + // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3 + var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.square().multiply(w)).mod(this.curve.q); + // z3 = 8 * (y1 * z1)^3 + var z3 = y1z1.square().multiply(y1z1).shiftLeft(3).mod(this.curve.q); + return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3); +} -internals.authHeaderRegex = /^(\w+)(?:\s+(.*))?$/; // Header: scheme[ something] -internals.attributeRegex = /^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/; // !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9 +// Simple NAF (Non-Adjacent Form) multiplication algorithm +// TODO: modularize the multiplication algorithm +function pointFpMultiply(k) { + if(this.isInfinity()) return this; + if(k.signum() == 0) return this.curve.getInfinity(); + var e = k; + var h = e.multiply(new BigInteger("3")); -// Parse Hawk HTTP Authorization header + var neg = this.negate(); + var R = this; -exports.parseAuthorizationHeader = function (header, keys) { + var i; + for(i = h.bitLength() - 2; i > 0; --i) { + R = R.twice(); - keys = keys || ['id', 'ts', 'nonce', 'hash', 'ext', 'mac', 'app', 'dlg']; + var hBit = h.testBit(i); + var eBit = e.testBit(i); - if (!header) { - return Boom.unauthorized(null, 'Hawk'); + if (hBit != eBit) { + R = R.add(hBit ? this : neg); + } } - if (header.length > exports.limits.maxMatchLength) { - return Boom.badRequest('Header length too long'); - } + return R; +} - var headerParts = header.match(internals.authHeaderRegex); - if (!headerParts) { - return Boom.badRequest('Invalid header syntax'); - } +// Compute this*j + x*k (simultaneous multiplication) +function pointFpMultiplyTwo(j,x,k) { + var i; + if(j.bitLength() > k.bitLength()) + i = j.bitLength() - 1; + else + i = k.bitLength() - 1; - var scheme = headerParts[1]; - if (scheme.toLowerCase() !== 'hawk') { - return Boom.unauthorized(null, 'Hawk'); + var R = this.curve.getInfinity(); + var both = this.add(x); + while(i >= 0) { + R = R.twice(); + if(j.testBit(i)) { + if(k.testBit(i)) { + R = R.add(both); + } + else { + R = R.add(this); + } } - - var attributesString = headerParts[2]; - if (!attributesString) { - return Boom.badRequest('Invalid header syntax'); + else { + if(k.testBit(i)) { + R = R.add(x); + } } + --i; + } - var attributes = {}; - var errorMessage = ''; - var verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, function ($0, $1, $2) { - - // Check valid attribute names - - if (keys.indexOf($1) === -1) { - errorMessage = 'Unknown attribute: ' + $1; - return; - } - - // Allowed attribute value characters - - if ($2.match(internals.attributeRegex) === null) { - errorMessage = 'Bad attribute value: ' + $1; - return; - } - - // Check for duplicates - - if (attributes.hasOwnProperty($1)) { - errorMessage = 'Duplicate attribute: ' + $1; - return; - } - - attributes[$1] = $2; - return ''; - }); + return R; +} - if (verify !== '') { - return Boom.badRequest(errorMessage || 'Bad header format'); - } +ECPointFp.prototype.getX = pointFpGetX; +ECPointFp.prototype.getY = pointFpGetY; +ECPointFp.prototype.equals = pointFpEquals; +ECPointFp.prototype.isInfinity = pointFpIsInfinity; +ECPointFp.prototype.negate = pointFpNegate; +ECPointFp.prototype.add = pointFpAdd; +ECPointFp.prototype.twice = pointFpTwice; +ECPointFp.prototype.multiply = pointFpMultiply; +ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo; - return attributes; -}; +// ---------------- +// ECCurveFp +// constructor +function ECCurveFp(q,a,b) { + this.q = q; + this.a = this.fromBigInteger(a); + this.b = this.fromBigInteger(b); + this.infinity = new ECPointFp(this, null, null); + this.reducer = new Barrett(this.q); +} -exports.unauthorized = function (message, attributes) { +function curveFpGetQ() { + return this.q; +} - return Boom.unauthorized(message, 'Hawk', attributes); -}; +function curveFpGetA() { + return this.a; +} +function curveFpGetB() { + return this.b; +} +function curveFpEquals(other) { + if(other == this) return true; + return(this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b)); +} -/***/ }), -/* 90 */ -/***/ (function(module, exports, __webpack_require__) { +function curveFpGetInfinity() { + return this.infinity; +} -// Load modules +function curveFpFromBigInteger(x) { + return new ECFieldElementFp(this.q, x); +} -var Crypto = __webpack_require__(6); -var Path = __webpack_require__(1); -var Util = __webpack_require__(2); -var Escape = __webpack_require__(501); +function curveReduce(x) { + this.reducer.reduce(x); +} +// for now, work with hex strings because they're easier in JS +function curveFpDecodePointHex(s) { + switch(parseInt(s.substr(0,2), 16)) { // first byte + case 0: + return this.infinity; + case 2: + case 3: + // point compression not supported yet + return null; + case 4: + case 6: + case 7: + var len = (s.length - 2) / 2; + var xHex = s.substr(2, len); + var yHex = s.substr(len+2, len); -// Declare internals + return new ECPointFp(this, + this.fromBigInteger(new BigInteger(xHex, 16)), + this.fromBigInteger(new BigInteger(yHex, 16))); -var internals = {}; + default: // unsupported + return null; + } +} +function curveFpEncodePointHex(p) { + if (p.isInfinity()) return "00"; + var xHex = p.getX().toBigInteger().toString(16); + var yHex = p.getY().toBigInteger().toString(16); + var oLen = this.getQ().toString(16).length; + if ((oLen % 2) != 0) oLen++; + while (xHex.length < oLen) { + xHex = "0" + xHex; + } + while (yHex.length < oLen) { + yHex = "0" + yHex; + } + return "04" + xHex + yHex; +} -// Clone object or array +ECCurveFp.prototype.getQ = curveFpGetQ; +ECCurveFp.prototype.getA = curveFpGetA; +ECCurveFp.prototype.getB = curveFpGetB; +ECCurveFp.prototype.equals = curveFpEquals; +ECCurveFp.prototype.getInfinity = curveFpGetInfinity; +ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger; +ECCurveFp.prototype.reduce = curveReduce; +//ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex; +ECCurveFp.prototype.encodePointHex = curveFpEncodePointHex; -exports.clone = function (obj, seen) { +// from: https://github.com/kaielvin/jsbn-ec-point-compression +ECCurveFp.prototype.decodePointHex = function(s) +{ + var yIsEven; + switch(parseInt(s.substr(0,2), 16)) { // first byte + case 0: + return this.infinity; + case 2: + yIsEven = false; + case 3: + if(yIsEven == undefined) yIsEven = true; + var len = s.length - 2; + var xHex = s.substr(2, len); + var x = this.fromBigInteger(new BigInteger(xHex,16)); + var alpha = x.multiply(x.square().add(this.getA())).add(this.getB()); + var beta = alpha.sqrt(); - if (typeof obj !== 'object' || - obj === null) { + if (beta == null) throw "Invalid point compression"; - return obj; + var betaValue = beta.toBigInteger(); + if (betaValue.testBit(0) != yIsEven) + { + // Use the other root + beta = this.fromBigInteger(this.getQ().subtract(betaValue)); } + return new ECPointFp(this,x,beta); + case 4: + case 6: + case 7: + var len = (s.length - 2) / 2; + var xHex = s.substr(2, len); + var yHex = s.substr(len+2, len); - seen = seen || { orig: [], copy: [] }; + return new ECPointFp(this, + this.fromBigInteger(new BigInteger(xHex, 16)), + this.fromBigInteger(new BigInteger(yHex, 16))); - var lookup = seen.orig.indexOf(obj); - if (lookup !== -1) { - return seen.copy[lookup]; + default: // unsupported + return null; } +} +ECCurveFp.prototype.encodeCompressedPointHex = function(p) +{ + if (p.isInfinity()) return "00"; + var xHex = p.getX().toBigInteger().toString(16); + var oLen = this.getQ().toString(16).length; + if ((oLen % 2) != 0) oLen++; + while (xHex.length < oLen) + xHex = "0" + xHex; + var yPrefix; + if(p.getY().toBigInteger().isEven()) yPrefix = "02"; + else yPrefix = "03"; - var newObj; - var cloneDeep = false; + return yPrefix + xHex; +} - if (!Array.isArray(obj)) { - if (Buffer.isBuffer(obj)) { - newObj = new Buffer(obj); - } - else if (obj instanceof Date) { - newObj = new Date(obj.getTime()); - } - else if (obj instanceof RegExp) { - newObj = new RegExp(obj); - } - else { - var proto = Object.getPrototypeOf(obj); - if (proto && - proto.isImmutable) { - newObj = obj; - } - else { - newObj = Object.create(proto); - cloneDeep = true; - } - } - } - else { - newObj = []; - cloneDeep = true; - } +ECFieldElementFp.prototype.getR = function() +{ + if(this.r != undefined) return this.r; + + this.r = null; + var bitLength = this.q.bitLength(); + if (bitLength > 128) + { + var firstWord = this.q.shiftRight(bitLength - 64); + if (firstWord.intValue() == -1) + { + this.r = BigInteger.ONE.shiftLeft(bitLength).subtract(this.q); + } + } + return this.r; +} +ECFieldElementFp.prototype.modMult = function(x1,x2) +{ + return this.modReduce(x1.multiply(x2)); +} +ECFieldElementFp.prototype.modReduce = function(x) +{ + if (this.getR() != null) + { + var qLen = q.bitLength(); + while (x.bitLength() > (qLen + 1)) + { + var u = x.shiftRight(qLen); + var v = x.subtract(u.shiftLeft(qLen)); + if (!this.getR().equals(BigInteger.ONE)) + { + u = u.multiply(this.getR()); + } + x = u.add(v); + } + while (x.compareTo(q) >= 0) + { + x = x.subtract(q); + } + } + else + { + x = x.mod(q); + } + return x; +} +ECFieldElementFp.prototype.sqrt = function() +{ + if (!this.q.testBit(0)) throw "unsupported"; + + // p mod 4 == 3 + if (this.q.testBit(1)) + { + var z = new ECFieldElementFp(this.q,this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE),this.q)); + return z.square().equals(this) ? z : null; + } + + // p mod 4 == 1 + var qMinusOne = this.q.subtract(BigInteger.ONE); + + var legendreExponent = qMinusOne.shiftRight(1); + if (!(this.x.modPow(legendreExponent, this.q).equals(BigInteger.ONE))) + { + return null; + } + + var u = qMinusOne.shiftRight(2); + var k = u.shiftLeft(1).add(BigInteger.ONE); + + var Q = this.x; + var fourQ = modDouble(modDouble(Q)); + + var U, V; + do + { + var P; + do + { + P = new BigInteger(this.q.bitLength(), new SecureRandom()); + } + while (P.compareTo(this.q) >= 0 + || !(P.multiply(P).subtract(fourQ).modPow(legendreExponent, this.q).equals(qMinusOne))); + + var result = this.lucasSequence(P, Q, k); + U = result[0]; + V = result[1]; + + if (this.modMult(V, V).equals(fourQ)) + { + // Integer division by 2, mod q + if (V.testBit(0)) + { + V = V.add(q); + } + + V = V.shiftRight(1); + + return new ECFieldElementFp(q,V); + } + } + while (U.equals(BigInteger.ONE) || U.equals(qMinusOne)); + + return null; +} +ECFieldElementFp.prototype.lucasSequence = function(P,Q,k) +{ + var n = k.bitLength(); + var s = k.getLowestSetBit(); + + var Uh = BigInteger.ONE; + var Vl = BigInteger.TWO; + var Vh = P; + var Ql = BigInteger.ONE; + var Qh = BigInteger.ONE; + + for (var j = n - 1; j >= s + 1; --j) + { + Ql = this.modMult(Ql, Qh); + + if (k.testBit(j)) + { + Qh = this.modMult(Ql, Q); + Uh = this.modMult(Uh, Vh); + Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); + Vh = this.modReduce(Vh.multiply(Vh).subtract(Qh.shiftLeft(1))); + } + else + { + Qh = Ql; + Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql)); + Vh = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); + Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1))); + } + } + + Ql = this.modMult(Ql, Qh); + Qh = this.modMult(Ql, Q); + Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql)); + Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); + Ql = this.modMult(Ql, Qh); + + for (var j = 1; j <= s; ++j) + { + Uh = this.modMult(Uh, Vl); + Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1))); + Ql = this.modMult(Ql, Ql); + } + + return [ Uh, Vl ]; +} + +var exports = { + ECCurveFp: ECCurveFp, + ECPointFp: ECPointFp, + ECFieldElementFp: ECFieldElementFp +} + +module.exports = exports + + +/***/ }), +/* 94 */ +/***/ (function(module, exports, __webpack_require__) { + +// Load modules + +var Sntp = __webpack_require__(260); +var Boom = __webpack_require__(87); + + +// Declare internals + +var internals = {}; + + +exports.version = function () { + + return __webpack_require__(507).version; +}; + + +exports.limits = { + maxMatchLength: 4096 // Limit the length of uris and headers to avoid a DoS attack on string matching +}; + + +// Extract host and port from request + +// $1 $2 +internals.hostHeaderRegex = /^(?:(?:\r\n)?\s)*((?:[^:]+)|(?:\[[^\]]+\]))(?::(\d+))?(?:(?:\r\n)?\s)*$/; // (IPv4, hostname)|(IPv6) + + +exports.parseHost = function (req, hostHeaderName) { + + hostHeaderName = (hostHeaderName ? hostHeaderName.toLowerCase() : 'host'); + var hostHeader = req.headers[hostHeaderName]; + if (!hostHeader) { + return null; + } + + if (hostHeader.length > exports.limits.maxMatchLength) { + return null; + } + + var hostParts = hostHeader.match(internals.hostHeaderRegex); + if (!hostParts) { + return null; + } + + return { + name: hostParts[1], + port: (hostParts[2] ? hostParts[2] : (req.connection && req.connection.encrypted ? 443 : 80)) + }; +}; + + +// Parse Content-Type header content + +exports.parseContentType = function (header) { + + if (!header) { + return ''; + } + + return header.split(';')[0].trim().toLowerCase(); +}; + + +// Convert node's to request configuration object + +exports.parseRequest = function (req, options) { + + if (!req.headers) { + return req; + } + + // Obtain host and port information + + var host; + if (!options.host || + !options.port) { + + host = exports.parseHost(req, options.hostHeaderName); + if (!host) { + return new Error('Invalid Host header'); + } + } + + var request = { + method: req.method, + url: req.url, + host: options.host || host.name, + port: options.port || host.port, + authorization: req.headers.authorization, + contentType: req.headers['content-type'] || '' + }; + + return request; +}; + + +exports.now = function (localtimeOffsetMsec) { + + return Sntp.now() + (localtimeOffsetMsec || 0); +}; + + +exports.nowSecs = function (localtimeOffsetMsec) { + + return Math.floor(exports.now(localtimeOffsetMsec) / 1000); +}; + + +internals.authHeaderRegex = /^(\w+)(?:\s+(.*))?$/; // Header: scheme[ something] +internals.attributeRegex = /^[ \w\!#\$%&'\(\)\*\+,\-\.\/\:;<\=>\?@\[\]\^`\{\|\}~]+$/; // !#$%&'()*+,-./:;<=>?@[]^_`{|}~ and space, a-z, A-Z, 0-9 + + +// Parse Hawk HTTP Authorization header + +exports.parseAuthorizationHeader = function (header, keys) { + + keys = keys || ['id', 'ts', 'nonce', 'hash', 'ext', 'mac', 'app', 'dlg']; + + if (!header) { + return Boom.unauthorized(null, 'Hawk'); + } + + if (header.length > exports.limits.maxMatchLength) { + return Boom.badRequest('Header length too long'); + } + + var headerParts = header.match(internals.authHeaderRegex); + if (!headerParts) { + return Boom.badRequest('Invalid header syntax'); + } + + var scheme = headerParts[1]; + if (scheme.toLowerCase() !== 'hawk') { + return Boom.unauthorized(null, 'Hawk'); + } + + var attributesString = headerParts[2]; + if (!attributesString) { + return Boom.badRequest('Invalid header syntax'); + } + + var attributes = {}; + var errorMessage = ''; + var verify = attributesString.replace(/(\w+)="([^"\\]*)"\s*(?:,\s*|$)/g, function ($0, $1, $2) { + + // Check valid attribute names + + if (keys.indexOf($1) === -1) { + errorMessage = 'Unknown attribute: ' + $1; + return; + } + + // Allowed attribute value characters + + if ($2.match(internals.attributeRegex) === null) { + errorMessage = 'Bad attribute value: ' + $1; + return; + } + + // Check for duplicates + + if (attributes.hasOwnProperty($1)) { + errorMessage = 'Duplicate attribute: ' + $1; + return; + } + + attributes[$1] = $2; + return ''; + }); + + if (verify !== '') { + return Boom.badRequest(errorMessage || 'Bad header format'); + } + + return attributes; +}; + + +exports.unauthorized = function (message, attributes) { + + return Boom.unauthorized(message, 'Hawk', attributes); +}; + + + +/***/ }), +/* 95 */ +/***/ (function(module, exports, __webpack_require__) { + +// Load modules + +var Crypto = __webpack_require__(7); +var Path = __webpack_require__(1); +var Util = __webpack_require__(2); +var Escape = __webpack_require__(508); + + +// Declare internals + +var internals = {}; + + +// Clone object or array + +exports.clone = function (obj, seen) { + + if (typeof obj !== 'object' || + obj === null) { + + return obj; + } + + seen = seen || { orig: [], copy: [] }; + + var lookup = seen.orig.indexOf(obj); + if (lookup !== -1) { + return seen.copy[lookup]; + } + + var newObj; + var cloneDeep = false; + + if (!Array.isArray(obj)) { + if (Buffer.isBuffer(obj)) { + newObj = new Buffer(obj); + } + else if (obj instanceof Date) { + newObj = new Date(obj.getTime()); + } + else if (obj instanceof RegExp) { + newObj = new RegExp(obj); + } + else { + var proto = Object.getPrototypeOf(obj); + if (proto && + proto.isImmutable) { + + newObj = obj; + } + else { + newObj = Object.create(proto); + cloneDeep = true; + } + } + } + else { + newObj = []; + cloneDeep = true; + } seen.orig.push(obj); seen.copy.push(newObj); @@ -38621,12 +39642,12 @@ exports.shallow = function (source) { /***/ }), -/* 91 */ +/* 96 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2012 Joyent, Inc. All rights reserved. -var assert = __webpack_require__(92); +var assert = __webpack_require__(97); var sshpk = __webpack_require__(161); var util = __webpack_require__(2); @@ -38739,7 +39760,7 @@ module.exports = { /***/ }), -/* 92 */ +/* 97 */ /***/ (function(module, exports, __webpack_require__) { // Copyright (c) 2012, Mark Cavage. All rights reserved. @@ -38951,13 +39972,13 @@ module.exports = _setExports(process.env.NODE_NDEBUG); /***/ }), -/* 93 */ +/* 98 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var chalk = __webpack_require__(16); -var figures = __webpack_require__(143); +var figures = __webpack_require__(145); /** * Separator object @@ -38992,7 +40013,7 @@ Separator.prototype.toString = function () { /***/ }), -/* 94 */ +/* 99 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -39037,7 +40058,7 @@ Paginator.prototype.paginate = function (output, active, pageSize) { /***/ }), -/* 95 */ +/* 100 */ /***/ (function(module, exports) { /*! @@ -39054,7 +40075,7 @@ module.exports = function isExtglob(str) { /***/ }), -/* 96 */ +/* 101 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -39064,7 +40085,7 @@ module.exports = function isExtglob(str) { * Licensed under the MIT License. */ -var isExtglob = __webpack_require__(95); +var isExtglob = __webpack_require__(100); module.exports = function isGlob(str) { return typeof str === 'string' @@ -39073,7 +40094,7 @@ module.exports = function isGlob(str) { }; /***/ }), -/* 97 */ +/* 102 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -39093,7 +40114,7 @@ module.exports = function isGlob(str) { * You should have received a copy of the license along with this program. */ -var crypto = __webpack_require__(6); +var crypto = __webpack_require__(7); /** * @exports jodid25519/core @@ -39561,7 +40582,7 @@ module.exports = ns; /***/ }), -/* 98 */ +/* 103 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -39582,7 +40603,7 @@ module.exports = ns; * You should have received a copy of the license along with this program. */ -var core = __webpack_require__(97); +var core = __webpack_require__(102); /** * @exports jodid25519/utils @@ -39766,13 +40787,61 @@ module.exports = ns; /***/ }), -/* 99 */ +/* 104 */ +/***/ (function(module, exports, __webpack_require__) { + +var wrappy = __webpack_require__(163) +module.exports = wrappy(once) +module.exports.strict = wrappy(onceStrict) + +once.proto = once(function () { + Object.defineProperty(Function.prototype, 'once', { + value: function () { + return once(this) + }, + configurable: true + }) + + Object.defineProperty(Function.prototype, 'onceStrict', { + value: function () { + return onceStrict(this) + }, + configurable: true + }) +}) + +function once (fn) { + var f = function () { + if (f.called) return f.value + f.called = true + return f.value = fn.apply(this, arguments) + } + f.called = false + return f +} + +function onceStrict (fn) { + var f = function () { + if (f.called) + throw new Error(f.onceError) + f.called = true + return f.value = fn.apply(this, arguments) + } + var name = fn.name || 'Function wrapped with `once`' + f.onceError = name + " shouldn't be called more than once" + f.called = false + return f +} + + +/***/ }), +/* 105 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var isPromise = __webpack_require__(533); +var isPromise = __webpack_require__(540); /** * Return a function that will run a function asynchronously or synchronously @@ -39834,27 +40903,27 @@ runAsync.cb = function (func, cb) { /***/ }), -/* 100 */ +/* 106 */ /***/ (function(module, exports, __webpack_require__) { -var Rx = __webpack_require__(29); -__webpack_require__(595); -__webpack_require__(596); -__webpack_require__(597); -__webpack_require__(252); -__webpack_require__(598); -__webpack_require__(599); -__webpack_require__(600); -__webpack_require__(601); -__webpack_require__(253); -__webpack_require__(602); +var Rx = __webpack_require__(30); __webpack_require__(603); +__webpack_require__(604); +__webpack_require__(605); +__webpack_require__(257); +__webpack_require__(606); +__webpack_require__(607); +__webpack_require__(608); +__webpack_require__(609); +__webpack_require__(258); +__webpack_require__(610); +__webpack_require__(611); module.exports = Rx; /***/ }), -/* 101 */ +/* 107 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. @@ -39866,16 +40935,16 @@ module.exports = { }; var assert = __webpack_require__(9); -var asn1 = __webpack_require__(35); +var asn1 = __webpack_require__(34); var algs = __webpack_require__(17); var utils = __webpack_require__(13); -var crypto = __webpack_require__(6); +var crypto = __webpack_require__(7); var Key = __webpack_require__(18); var PrivateKey = __webpack_require__(19); var pem = __webpack_require__(40); -var rfc4253 = __webpack_require__(47); -var SSHBuffer = __webpack_require__(102); +var rfc4253 = __webpack_require__(48); +var SSHBuffer = __webpack_require__(108); var errors = __webpack_require__(32); var bcrypt; @@ -39925,7 +40994,7 @@ function readSSHPrivate(type, buf, options) { var rounds = kdfOptsBuf.readInt(); var cinf = utils.opensshCipherInfo(cipher); if (bcrypt === undefined) { - bcrypt = __webpack_require__(208); + bcrypt = __webpack_require__(209); } if (typeof (options.passphrase) === 'string') { @@ -40046,7 +41115,7 @@ function write(key, options) { kdfopts = kdfssh.toBuffer(); if (bcrypt === undefined) { - bcrypt = __webpack_require__(208); + bcrypt = __webpack_require__(209); } var pass = new Uint8Array(passphrase); var salti = new Uint8Array(salt); @@ -40121,7 +41190,7 @@ function write(key, options) { /***/ }), -/* 102 */ +/* 108 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. @@ -40275,16 +41344,16 @@ SSHBuffer.prototype.write = function (buf) { /***/ }), -/* 103 */ +/* 109 */ /***/ (function(module, exports, __webpack_require__) { -var chownr = __webpack_require__(397) -var tar = __webpack_require__(263) -var pump = __webpack_require__(244) -var mkdirp = __webpack_require__(154) -var fs = __webpack_require__(5) +var chownr = __webpack_require__(406) +var tar = __webpack_require__(268) +var pump = __webpack_require__(246) +var mkdirp = __webpack_require__(156) +var fs = __webpack_require__(6) var path = __webpack_require__(1) -var os = __webpack_require__(107) +var os = __webpack_require__(113) var win32 = os.platform() === 'win32' @@ -40604,9364 +41673,8510 @@ function mkdirfix (name, opts, cb) { /***/ }), -/* 104 */ -/***/ (function(module, exports) { +/* 110 */ +/***/ (function(module, exports, __webpack_require__) { -// Returns a wrapper function that returns a wrapped callback -// The wrapper function should do some stuff, and return a -// presumably different callback function. -// This makes sure that own properties are retained, so that -// decorations and such are not lost along the way. -module.exports = wrappy -function wrappy (fn, cb) { - if (fn && cb) return wrappy(fn)(cb) +(function(nacl) { +'use strict'; - if (typeof fn !== 'function') - throw new TypeError('need wrapper function') +// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. +// Public domain. +// +// Implementation derived from TweetNaCl version 20140427. +// See for details: http://tweetnacl.cr.yp.to/ - Object.keys(fn).forEach(function (k) { - wrapper[k] = fn[k] - }) +var gf = function(init) { + var i, r = new Float64Array(16); + if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; + return r; +}; - return wrapper +// Pluggable, initialized in high-level API below. +var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; - function wrapper() { - var args = new Array(arguments.length) - for (var i = 0; i < args.length; i++) { - args[i] = arguments[i] - } - var ret = fn.apply(this, args) - var cb = args[args.length-1] - if (typeof ret === 'function' && ret !== cb) { - Object.keys(cb).forEach(function (k) { - ret[k] = cb[k] - }) - } - return ret - } -} +var _0 = new Uint8Array(16); +var _9 = new Uint8Array(32); _9[0] = 9; +var gf0 = gf(), + gf1 = gf([1]), + _121665 = gf([0xdb41, 1]), + D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), + D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), + X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), + Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), + I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); -/***/ }), -/* 105 */ -/***/ (function(module, exports) { +function ts64(x, i, h, l) { + x[i] = (h >> 24) & 0xff; + x[i+1] = (h >> 16) & 0xff; + x[i+2] = (h >> 8) & 0xff; + x[i+3] = h & 0xff; + x[i+4] = (l >> 24) & 0xff; + x[i+5] = (l >> 16) & 0xff; + x[i+6] = (l >> 8) & 0xff; + x[i+7] = l & 0xff; +} -module.exports = require("child_process"); +function vn(x, xi, y, yi, n) { + var i,d = 0; + for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; + return (1 & ((d - 1) >>> 8)) - 1; +} -/***/ }), -/* 106 */ -/***/ (function(module, exports) { +function crypto_verify_16(x, xi, y, yi) { + return vn(x,xi,y,yi,16); +} -module.exports = require("https"); +function crypto_verify_32(x, xi, y, yi) { + return vn(x,xi,y,yi,32); +} -/***/ }), -/* 107 */ -/***/ (function(module, exports) { +function core_salsa20(o, p, k, c) { + var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, + j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, + j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, + j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, + j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, + j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, + j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, + j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, + j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, + j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, + j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, + j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, + j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, + j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, + j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, + j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; -module.exports = require("os"); + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, + x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, + x15 = j15, u; -/***/ }), -/* 108 */ -/***/ (function(module, exports) { + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u<<7 | u>>>(32-7); + u = x4 + x0 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x4 | 0; + x12 ^= u<<13 | u>>>(32-13); + u = x12 + x8 | 0; + x0 ^= u<<18 | u>>>(32-18); -module.exports = require("querystring"); + u = x5 + x1 | 0; + x9 ^= u<<7 | u>>>(32-7); + u = x9 + x5 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x9 | 0; + x1 ^= u<<13 | u>>>(32-13); + u = x1 + x13 | 0; + x5 ^= u<<18 | u>>>(32-18); -/***/ }), -/* 109 */ -/***/ (function(module, exports) { + u = x10 + x6 | 0; + x14 ^= u<<7 | u>>>(32-7); + u = x14 + x10 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x14 | 0; + x6 ^= u<<13 | u>>>(32-13); + u = x6 + x2 | 0; + x10 ^= u<<18 | u>>>(32-18); -module.exports = require("readline"); + u = x15 + x11 | 0; + x3 ^= u<<7 | u>>>(32-7); + u = x3 + x15 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x3 | 0; + x11 ^= u<<13 | u>>>(32-13); + u = x11 + x7 | 0; + x15 ^= u<<18 | u>>>(32-18); -/***/ }), -/* 110 */ -/***/ (function(module, exports) { + u = x0 + x3 | 0; + x1 ^= u<<7 | u>>>(32-7); + u = x1 + x0 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x1 | 0; + x3 ^= u<<13 | u>>>(32-13); + u = x3 + x2 | 0; + x0 ^= u<<18 | u>>>(32-18); -module.exports = require("tty"); + u = x5 + x4 | 0; + x6 ^= u<<7 | u>>>(32-7); + u = x6 + x5 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x6 | 0; + x4 ^= u<<13 | u>>>(32-13); + u = x4 + x7 | 0; + x5 ^= u<<18 | u>>>(32-18); -/***/ }), -/* 111 */ -/***/ (function(module, exports) { + u = x10 + x9 | 0; + x11 ^= u<<7 | u>>>(32-7); + u = x11 + x10 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x11 | 0; + x9 ^= u<<13 | u>>>(32-13); + u = x9 + x8 | 0; + x10 ^= u<<18 | u>>>(32-18); -// Copyright 2011 Mark Cavage All rights reserved. + u = x15 + x14 | 0; + x12 ^= u<<7 | u>>>(32-7); + u = x12 + x15 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x12 | 0; + x14 ^= u<<13 | u>>>(32-13); + u = x14 + x13 | 0; + x15 ^= u<<18 | u>>>(32-18); + } + x0 = x0 + j0 | 0; + x1 = x1 + j1 | 0; + x2 = x2 + j2 | 0; + x3 = x3 + j3 | 0; + x4 = x4 + j4 | 0; + x5 = x5 + j5 | 0; + x6 = x6 + j6 | 0; + x7 = x7 + j7 | 0; + x8 = x8 + j8 | 0; + x9 = x9 + j9 | 0; + x10 = x10 + j10 | 0; + x11 = x11 + j11 | 0; + x12 = x12 + j12 | 0; + x13 = x13 + j13 | 0; + x14 = x14 + j14 | 0; + x15 = x15 + j15 | 0; + o[ 0] = x0 >>> 0 & 0xff; + o[ 1] = x0 >>> 8 & 0xff; + o[ 2] = x0 >>> 16 & 0xff; + o[ 3] = x0 >>> 24 & 0xff; -module.exports = { + o[ 4] = x1 >>> 0 & 0xff; + o[ 5] = x1 >>> 8 & 0xff; + o[ 6] = x1 >>> 16 & 0xff; + o[ 7] = x1 >>> 24 & 0xff; - newInvalidAsn1Error: function(msg) { - var e = new Error(); - e.name = 'InvalidAsn1Error'; - e.message = msg || ''; - return e; - } + o[ 8] = x2 >>> 0 & 0xff; + o[ 9] = x2 >>> 8 & 0xff; + o[10] = x2 >>> 16 & 0xff; + o[11] = x2 >>> 24 & 0xff; -}; + o[12] = x3 >>> 0 & 0xff; + o[13] = x3 >>> 8 & 0xff; + o[14] = x3 >>> 16 & 0xff; + o[15] = x3 >>> 24 & 0xff; + o[16] = x4 >>> 0 & 0xff; + o[17] = x4 >>> 8 & 0xff; + o[18] = x4 >>> 16 & 0xff; + o[19] = x4 >>> 24 & 0xff; -/***/ }), -/* 112 */ -/***/ (function(module, exports) { + o[20] = x5 >>> 0 & 0xff; + o[21] = x5 >>> 8 & 0xff; + o[22] = x5 >>> 16 & 0xff; + o[23] = x5 >>> 24 & 0xff; -// Copyright 2011 Mark Cavage All rights reserved. + o[24] = x6 >>> 0 & 0xff; + o[25] = x6 >>> 8 & 0xff; + o[26] = x6 >>> 16 & 0xff; + o[27] = x6 >>> 24 & 0xff; + o[28] = x7 >>> 0 & 0xff; + o[29] = x7 >>> 8 & 0xff; + o[30] = x7 >>> 16 & 0xff; + o[31] = x7 >>> 24 & 0xff; -module.exports = { - EOC: 0, - Boolean: 1, - Integer: 2, - BitString: 3, - OctetString: 4, - Null: 5, - OID: 6, - ObjectDescriptor: 7, - External: 8, - Real: 9, // float - Enumeration: 10, - PDV: 11, - Utf8String: 12, - RelativeOID: 13, - Sequence: 16, - Set: 17, - NumericString: 18, - PrintableString: 19, - T61String: 20, - VideotexString: 21, - IA5String: 22, - UTCTime: 23, - GeneralizedTime: 24, - GraphicString: 25, - VisibleString: 26, - GeneralString: 28, - UniversalString: 29, - CharacterString: 30, - BMPString: 31, - Constructor: 32, - Context: 128 -}; + o[32] = x8 >>> 0 & 0xff; + o[33] = x8 >>> 8 & 0xff; + o[34] = x8 >>> 16 & 0xff; + o[35] = x8 >>> 24 & 0xff; + o[36] = x9 >>> 0 & 0xff; + o[37] = x9 >>> 8 & 0xff; + o[38] = x9 >>> 16 & 0xff; + o[39] = x9 >>> 24 & 0xff; -/***/ }), -/* 113 */ -/***/ (function(module, exports, __webpack_require__) { + o[40] = x10 >>> 0 & 0xff; + o[41] = x10 >>> 8 & 0xff; + o[42] = x10 >>> 16 & 0xff; + o[43] = x10 >>> 24 & 0xff; -"use strict"; + o[44] = x11 >>> 0 & 0xff; + o[45] = x11 >>> 8 & 0xff; + o[46] = x11 >>> 16 & 0xff; + o[47] = x11 >>> 24 & 0xff; + o[48] = x12 >>> 0 & 0xff; + o[49] = x12 >>> 8 & 0xff; + o[50] = x12 >>> 16 & 0xff; + o[51] = x12 >>> 24 & 0xff; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.integrityErrors = undefined; + o[52] = x13 >>> 0 & 0xff; + o[53] = x13 >>> 8 & 0xff; + o[54] = x13 >>> 16 & 0xff; + o[55] = x13 >>> 24 & 0xff; -var _asyncToGenerator2; + o[56] = x14 >>> 0 & 0xff; + o[57] = x14 >>> 8 & 0xff; + o[58] = x14 >>> 16 & 0xff; + o[59] = x14 >>> 24 & 0xff; -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); + o[60] = x15 >>> 0 & 0xff; + o[61] = x15 >>> 8 & 0xff; + o[62] = x15 >>> 16 & 0xff; + o[63] = x15 >>> 24 & 0xff; } -var _constants; - -function _load_constants() { - return _constants = _interopRequireWildcard(__webpack_require__(8)); -} +function core_hsalsa20(o,p,k,c) { + var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, + j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, + j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, + j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, + j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, + j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, + j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, + j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, + j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, + j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, + j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, + j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, + j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, + j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, + j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, + j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; -var _index; + var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, + x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, + x15 = j15, u; -function _load_index() { - return _index = __webpack_require__(23); -} + for (var i = 0; i < 20; i += 2) { + u = x0 + x12 | 0; + x4 ^= u<<7 | u>>>(32-7); + u = x4 + x0 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x4 | 0; + x12 ^= u<<13 | u>>>(32-13); + u = x12 + x8 | 0; + x0 ^= u<<18 | u>>>(32-18); -var _fs; + u = x5 + x1 | 0; + x9 ^= u<<7 | u>>>(32-7); + u = x9 + x5 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x9 | 0; + x1 ^= u<<13 | u>>>(32-13); + u = x1 + x13 | 0; + x5 ^= u<<18 | u>>>(32-18); -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(4)); -} + u = x10 + x6 | 0; + x14 ^= u<<7 | u>>>(32-7); + u = x14 + x10 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x14 | 0; + x6 ^= u<<13 | u>>>(32-13); + u = x6 + x2 | 0; + x10 ^= u<<18 | u>>>(32-18); -var _misc; + u = x15 + x11 | 0; + x3 ^= u<<7 | u>>>(32-7); + u = x3 + x15 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x3 | 0; + x11 ^= u<<13 | u>>>(32-13); + u = x11 + x7 | 0; + x15 ^= u<<18 | u>>>(32-18); -function _load_misc() { - return _misc = __webpack_require__(10); -} + u = x0 + x3 | 0; + x1 ^= u<<7 | u>>>(32-7); + u = x1 + x0 | 0; + x2 ^= u<<9 | u>>>(32-9); + u = x2 + x1 | 0; + x3 ^= u<<13 | u>>>(32-13); + u = x3 + x2 | 0; + x0 ^= u<<18 | u>>>(32-18); -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; } } + u = x5 + x4 | 0; + x6 ^= u<<7 | u>>>(32-7); + u = x6 + x5 | 0; + x7 ^= u<<9 | u>>>(32-9); + u = x7 + x6 | 0; + x4 ^= u<<13 | u>>>(32-13); + u = x4 + x7 | 0; + x5 ^= u<<18 | u>>>(32-18); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + u = x10 + x9 | 0; + x11 ^= u<<7 | u>>>(32-7); + u = x11 + x10 | 0; + x8 ^= u<<9 | u>>>(32-9); + u = x8 + x11 | 0; + x9 ^= u<<13 | u>>>(32-13); + u = x9 + x8 | 0; + x10 ^= u<<18 | u>>>(32-18); -const invariant = __webpack_require__(7); + u = x15 + x14 | 0; + x12 ^= u<<7 | u>>>(32-7); + u = x12 + x15 | 0; + x13 ^= u<<9 | u>>>(32-9); + u = x13 + x12 | 0; + x14 ^= u<<13 | u>>>(32-13); + u = x14 + x13 | 0; + x15 ^= u<<18 | u>>>(32-18); + } -const path = __webpack_require__(1); + o[ 0] = x0 >>> 0 & 0xff; + o[ 1] = x0 >>> 8 & 0xff; + o[ 2] = x0 >>> 16 & 0xff; + o[ 3] = x0 >>> 24 & 0xff; -const integrityErrors = exports.integrityErrors = { - EXPECTED_IS_NOT_A_JSON: 'integrityFailedExpectedIsNotAJSON', - FILES_MISSING: 'integrityFailedFilesMissing', - LOCKFILE_DONT_MATCH: 'integrityLockfilesDontMatch', - FLAGS_DONT_MATCH: 'integrityFlagsDontMatch', - LINKED_MODULES_DONT_MATCH: 'integrityCheckLinkedModulesDontMatch' -}; - -/** - * - */ -class InstallationIntegrityChecker { - constructor(config) { - this.config = config; - } - - _getModuleLocation(usedRegistries) { - var _this = this; + o[ 4] = x5 >>> 0 & 0xff; + o[ 5] = x5 >>> 8 & 0xff; + o[ 6] = x5 >>> 16 & 0xff; + o[ 7] = x5 >>> 24 & 0xff; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // build up possible folders - let registries = (_index || _load_index()).registryNames; - if (usedRegistries && usedRegistries.size > 0) { - registries = usedRegistries; - } - const possibleFolders = []; - if (_this.config.modulesFolder) { - possibleFolders.push(_this.config.modulesFolder); - } + o[ 8] = x10 >>> 0 & 0xff; + o[ 9] = x10 >>> 8 & 0xff; + o[10] = x10 >>> 16 & 0xff; + o[11] = x10 >>> 24 & 0xff; - // ensure we only write to a registry folder that was used - for (const name of registries) { - const loc = path.join(_this.config.cwd, _this.config.registries[name].folder); - possibleFolders.push(loc); - } + o[12] = x15 >>> 0 & 0xff; + o[13] = x15 >>> 8 & 0xff; + o[14] = x15 >>> 16 & 0xff; + o[15] = x15 >>> 24 & 0xff; - // if we already have an integrity hash in one of these folders then use it's location otherwise use the - // first folder - let loc; - for (const possibleLoc of possibleFolders) { - if (yield (_fs || _load_fs()).exists(path.join(possibleLoc, (_constants || _load_constants()).INTEGRITY_FILENAME))) { - loc = possibleLoc; - break; - } - } + o[16] = x6 >>> 0 & 0xff; + o[17] = x6 >>> 8 & 0xff; + o[18] = x6 >>> 16 & 0xff; + o[19] = x6 >>> 24 & 0xff; - return loc || possibleFolders[0]; - })(); - } + o[20] = x7 >>> 0 & 0xff; + o[21] = x7 >>> 8 & 0xff; + o[22] = x7 >>> 16 & 0xff; + o[23] = x7 >>> 24 & 0xff; - /** - * Get the location of an existing integrity hash. If none exists then return the location where we should - * write a new one. - */ + o[24] = x8 >>> 0 & 0xff; + o[25] = x8 >>> 8 & 0xff; + o[26] = x8 >>> 16 & 0xff; + o[27] = x8 >>> 24 & 0xff; - _getIntegrityHashLocation(usedRegistries) { - var _this2 = this; + o[28] = x9 >>> 0 & 0xff; + o[29] = x9 >>> 8 & 0xff; + o[30] = x9 >>> 16 & 0xff; + o[31] = x9 >>> 24 & 0xff; +} - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - let locationFolder; +function crypto_core_salsa20(out,inp,k,c) { + core_salsa20(out,inp,k,c); +} - if (_this2.config.enableMetaFolder) { - locationFolder = path.join(_this2.config.cwd, (_constants || _load_constants()).META_FOLDER); - } else { - locationFolder = yield _this2._getModuleLocation(usedRegistries); - } +function crypto_core_hsalsa20(out,inp,k,c) { + core_hsalsa20(out,inp,k,c); +} - const locationPath = path.join(locationFolder, (_constants || _load_constants()).INTEGRITY_FILENAME); - const exists = yield (_fs || _load_fs()).exists(locationPath); +var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); + // "expand 32-byte k" - return { - locationFolder, - locationPath, - exists - }; - })(); +function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + mpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i]; } + return 0; +} - /** - * returns a list of files recursively in a directory sorted - */ - _getFilesDeep(rootDir) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - let getFilePaths = (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (rootDir, files) { - let currentDir = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rootDir; +function crypto_stream_salsa20(c,cpos,b,n,k) { + var z = new Uint8Array(16), x = new Uint8Array(64); + var u, i; + for (i = 0; i < 16; i++) z[i] = 0; + for (i = 0; i < 8; i++) z[i] = n[i]; + while (b >= 64) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < 64; i++) c[cpos+i] = x[i]; + u = 1; + for (i = 8; i < 16; i++) { + u = u + (z[i] & 0xff) | 0; + z[i] = u & 0xff; + u >>>= 8; + } + b -= 64; + cpos += 64; + } + if (b > 0) { + crypto_core_salsa20(x,z,k,sigma); + for (i = 0; i < b; i++) c[cpos+i] = x[i]; + } + return 0; +} - for (const file of yield (_fs || _load_fs()).readdir(currentDir)) { - const entry = path.join(currentDir, file); - const stat = yield (_fs || _load_fs()).stat(entry); - if (stat.isDirectory()) { - yield getFilePaths(rootDir, files, entry); - } else { - files.push(path.relative(rootDir, entry)); - } - } - }); +function crypto_stream(c,cpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) sn[i] = n[i+16]; + return crypto_stream_salsa20(c,cpos,d,sn,s); +} - return function getFilePaths(_x, _x2) { - return _ref.apply(this, arguments); - }; - })(); +function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { + var s = new Uint8Array(32); + crypto_core_hsalsa20(s,n,k,sigma); + var sn = new Uint8Array(8); + for (var i = 0; i < 8; i++) sn[i] = n[i+16]; + return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s); +} - const result = []; - yield getFilePaths(rootDir, result); - return result; - })(); - } +/* +* Port of Andrew Moon's Poly1305-donna-16. Public domain. +* https://github.com/floodyberry/poly1305-donna +*/ - /** - * Generate integrity hash of input lockfile. - */ +var poly1305 = function(key) { + this.buffer = new Uint8Array(16); + this.r = new Uint16Array(10); + this.h = new Uint16Array(10); + this.pad = new Uint16Array(8); + this.leftover = 0; + this.fin = 0; - _generateIntegrityFile(lockfile, patterns, flags, modulesFolder, artifacts) { - var _this3 = this; + var t0, t1, t2, t3, t4, t5, t6, t7; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; + t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; + t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; + this.r[5] = ((t4 >>> 1)) & 0x1ffe; + t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; + t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + this.r[9] = ((t7 >>> 5)) & 0x007f; - const result = { - flags: [], - linkedModules: [], - topLevelPatters: [], - lockfileEntries: {}, - files: [], - artifacts - }; + this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; + this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; + this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; + this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; + this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; + this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; + this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; + this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; +}; - result.topLevelPatters = patterns.sort((_misc || _load_misc()).sortAlpha); +poly1305.prototype.blocks = function(m, mpos, bytes) { + var hibit = this.fin ? 0 : (1 << 11); + var t0, t1, t2, t3, t4, t5, t6, t7, c; + var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; - if (flags.flat) { - result.flags.push('flat'); - } - if (flags.ignoreScripts) { - result.flags.push('ignoreScripts'); - } + var h0 = this.h[0], + h1 = this.h[1], + h2 = this.h[2], + h3 = this.h[3], + h4 = this.h[4], + h5 = this.h[5], + h6 = this.h[6], + h7 = this.h[7], + h8 = this.h[8], + h9 = this.h[9]; - if (_this3.config.production) { - result.flags.push('production'); - } + var r0 = this.r[0], + r1 = this.r[1], + r2 = this.r[2], + r3 = this.r[3], + r4 = this.r[4], + r5 = this.r[5], + r6 = this.r[6], + r7 = this.r[7], + r8 = this.r[8], + r9 = this.r[9]; - const linkedModules = _this3.config.linkedModules; - if (linkedModules.length) { - result.linkedModules = linkedModules.sort((_misc || _load_misc()).sortAlpha); - } + while (bytes >= 16) { + t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; + t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; + t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; + t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; + t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; + h5 += ((t4 >>> 1)) & 0x1fff; + t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; + t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; + t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; + h9 += ((t7 >>> 5)) | hibit; - Object.keys(lockfile).forEach(function (key) { - result.lockfileEntries[key] = lockfile[key].resolved; - }); + c = 0; - if (flags.checkFiles) { - result.files = yield _this3._getFilesDeep(modulesFolder); - } + d0 = c; + d0 += h0 * r0; + d0 += h1 * (5 * r9); + d0 += h2 * (5 * r8); + d0 += h3 * (5 * r7); + d0 += h4 * (5 * r6); + c = (d0 >>> 13); d0 &= 0x1fff; + d0 += h5 * (5 * r5); + d0 += h6 * (5 * r4); + d0 += h7 * (5 * r3); + d0 += h8 * (5 * r2); + d0 += h9 * (5 * r1); + c += (d0 >>> 13); d0 &= 0x1fff; - return result; - })(); - } + d1 = c; + d1 += h0 * r1; + d1 += h1 * r0; + d1 += h2 * (5 * r9); + d1 += h3 * (5 * r8); + d1 += h4 * (5 * r7); + c = (d1 >>> 13); d1 &= 0x1fff; + d1 += h5 * (5 * r6); + d1 += h6 * (5 * r5); + d1 += h7 * (5 * r4); + d1 += h8 * (5 * r3); + d1 += h9 * (5 * r2); + c += (d1 >>> 13); d1 &= 0x1fff; - _getIntegrityFile(locationPath) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const expectedRaw = yield (_fs || _load_fs()).readFile(locationPath); - try { - return JSON.parse(expectedRaw); - } catch (e) { - // ignore JSON parsing for legacy text integrity files compatibility - } - return null; - })(); - } + d2 = c; + d2 += h0 * r2; + d2 += h1 * r1; + d2 += h2 * r0; + d2 += h3 * (5 * r9); + d2 += h4 * (5 * r8); + c = (d2 >>> 13); d2 &= 0x1fff; + d2 += h5 * (5 * r7); + d2 += h6 * (5 * r6); + d2 += h7 * (5 * r5); + d2 += h8 * (5 * r4); + d2 += h9 * (5 * r3); + c += (d2 >>> 13); d2 &= 0x1fff; - _compareIntegrityFiles(actual, expected, checkFiles, locationFolder) { - var _this4 = this; + d3 = c; + d3 += h0 * r3; + d3 += h1 * r2; + d3 += h2 * r1; + d3 += h3 * r0; + d3 += h4 * (5 * r9); + c = (d3 >>> 13); d3 &= 0x1fff; + d3 += h5 * (5 * r8); + d3 += h6 * (5 * r7); + d3 += h7 * (5 * r6); + d3 += h8 * (5 * r5); + d3 += h9 * (5 * r4); + c += (d3 >>> 13); d3 &= 0x1fff; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (!expected) { - return 'EXPECTED_IS_NOT_A_JSON'; - } - if (!(0, (_misc || _load_misc()).compareSortedArrays)(actual.linkedModules, expected.linkedModules)) { - return 'LINKED_MODULES_DONT_MATCH'; - } - if (!(0, (_misc || _load_misc()).compareSortedArrays)(actual.flags, expected.flags)) { - return 'FLAGS_DONT_MATCH'; - } - for (const key of Object.keys(actual.lockfileEntries)) { - if (actual.lockfileEntries[key] !== expected.lockfileEntries[key]) { - return 'LOCKFILE_DONT_MATCH'; - } - } - for (const key of Object.keys(expected.lockfileEntries)) { - if (actual.lockfileEntries[key] !== expected.lockfileEntries[key]) { - return 'LOCKFILE_DONT_MATCH'; - } - } - if (checkFiles) { - if (expected.files.length === 0) { - // edge case handling - --check-fies is passed but .yarn-integrity does not contain any files - // check and fail if there are file in node_modules after all. - const actualFiles = yield _this4._getFilesDeep(locationFolder); - if (actualFiles.length > 0) { - return 'FILES_MISSING'; - } - } else { - // TODO we may want to optimise this check by checking only for package.json files on very large trees - for (const file of expected.files) { - if (!(yield (_fs || _load_fs()).exists(path.join(locationFolder, file)))) { - return 'FILES_MISSING'; - } - } - } - } - return 'OK'; - })(); - } + d4 = c; + d4 += h0 * r4; + d4 += h1 * r3; + d4 += h2 * r2; + d4 += h3 * r1; + d4 += h4 * r0; + c = (d4 >>> 13); d4 &= 0x1fff; + d4 += h5 * (5 * r9); + d4 += h6 * (5 * r8); + d4 += h7 * (5 * r7); + d4 += h8 * (5 * r6); + d4 += h9 * (5 * r5); + c += (d4 >>> 13); d4 &= 0x1fff; - check(patterns, lockfile, flags) { - var _this5 = this; + d5 = c; + d5 += h0 * r5; + d5 += h1 * r4; + d5 += h2 * r3; + d5 += h3 * r2; + d5 += h4 * r1; + c = (d5 >>> 13); d5 &= 0x1fff; + d5 += h5 * r0; + d5 += h6 * (5 * r9); + d5 += h7 * (5 * r8); + d5 += h8 * (5 * r7); + d5 += h9 * (5 * r6); + c += (d5 >>> 13); d5 &= 0x1fff; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // check if patterns exist in lockfile - const missingPatterns = patterns.filter(function (p) { - return !lockfile[p]; - }); + d6 = c; + d6 += h0 * r6; + d6 += h1 * r5; + d6 += h2 * r4; + d6 += h3 * r3; + d6 += h4 * r2; + c = (d6 >>> 13); d6 &= 0x1fff; + d6 += h5 * r1; + d6 += h6 * r0; + d6 += h7 * (5 * r9); + d6 += h8 * (5 * r8); + d6 += h9 * (5 * r7); + c += (d6 >>> 13); d6 &= 0x1fff; - const loc = yield _this5._getIntegrityHashLocation(); - if (missingPatterns.length || !loc.exists) { - return { - integrityFileMissing: !loc.exists, - missingPatterns - }; - } + d7 = c; + d7 += h0 * r7; + d7 += h1 * r6; + d7 += h2 * r5; + d7 += h3 * r4; + d7 += h4 * r3; + c = (d7 >>> 13); d7 &= 0x1fff; + d7 += h5 * r2; + d7 += h6 * r1; + d7 += h7 * r0; + d7 += h8 * (5 * r9); + d7 += h9 * (5 * r8); + c += (d7 >>> 13); d7 &= 0x1fff; - const actual = yield _this5._generateIntegrityFile(lockfile, patterns, Object.assign({}, flags, { checkFiles: false }), ( // don't generate files when checking, we check the files below - yield _this5._getModuleLocation())); - const expected = yield _this5._getIntegrityFile(loc.locationPath); - const integrityMatches = yield _this5._compareIntegrityFiles(actual, expected, flags.checkFiles, loc.locationFolder); + d8 = c; + d8 += h0 * r8; + d8 += h1 * r7; + d8 += h2 * r6; + d8 += h3 * r5; + d8 += h4 * r4; + c = (d8 >>> 13); d8 &= 0x1fff; + d8 += h5 * r3; + d8 += h6 * r2; + d8 += h7 * r1; + d8 += h8 * r0; + d8 += h9 * (5 * r9); + c += (d8 >>> 13); d8 &= 0x1fff; - return { - integrityFileMissing: false, - integrityMatches: integrityMatches === 'OK', - integrityError: integrityMatches === 'OK' ? undefined : integrityMatches, - missingPatterns - }; - })(); - } + d9 = c; + d9 += h0 * r9; + d9 += h1 * r8; + d9 += h2 * r7; + d9 += h3 * r6; + d9 += h4 * r5; + c = (d9 >>> 13); d9 &= 0x1fff; + d9 += h5 * r4; + d9 += h6 * r3; + d9 += h7 * r2; + d9 += h8 * r1; + d9 += h9 * r0; + c += (d9 >>> 13); d9 &= 0x1fff; - /** - * Get artifacts from integrity file if it exists. - */ - getArtifacts() { - var _this6 = this; + c = (((c << 2) + c)) | 0; + c = (c + d0) | 0; + d0 = c & 0x1fff; + c = (c >>> 13); + d1 += c; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const loc = yield _this6._getIntegrityHashLocation(); - if (!loc.exists) { - return null; - } - - const expectedRaw = yield (_fs || _load_fs()).readFile(loc.locationPath); - let expected; - try { - expected = JSON.parse(expectedRaw); - } catch (e) { - // ignore JSON parsing for legacy text integrity files compatibility - } + h0 = d0; + h1 = d1; + h2 = d2; + h3 = d3; + h4 = d4; + h5 = d5; + h6 = d6; + h7 = d7; + h8 = d8; + h9 = d9; - return expected ? expected.artifacts : null; - })(); + mpos += 16; + bytes -= 16; } + this.h[0] = h0; + this.h[1] = h1; + this.h[2] = h2; + this.h[3] = h3; + this.h[4] = h4; + this.h[5] = h5; + this.h[6] = h6; + this.h[7] = h7; + this.h[8] = h8; + this.h[9] = h9; +}; - /** - * Write the integrity hash of the current install to disk. - */ - save(patterns, lockfile, flags, usedRegistries, artifacts) { - var _this7 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const moduleFolder = yield _this7._getModuleLocation(usedRegistries); - const integrityFile = yield _this7._generateIntegrityFile(lockfile, patterns, flags, moduleFolder, artifacts); - - const loc = yield _this7._getIntegrityHashLocation(usedRegistries); - invariant(loc.locationPath, 'expected integrity hash location'); +poly1305.prototype.finish = function(mac, macpos) { + var g = new Uint16Array(10); + var c, mask, f, i; - yield (_fs || _load_fs()).mkdirp(path.dirname(loc.locationPath)); - yield (_fs || _load_fs()).writeFile(loc.locationPath, JSON.stringify(integrityFile, null, 2)); - })(); + if (this.leftover) { + i = this.leftover; + this.buffer[i++] = 1; + for (; i < 16; i++) this.buffer[i] = 0; + this.fin = 1; + this.blocks(this.buffer, 0, 16); } - removeIntegrityFile() { - var _this8 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const loc = yield _this8._getIntegrityHashLocation(); - if (loc.exists) { - yield (_fs || _load_fs()).unlink(loc.locationPath); - } - })(); + c = this.h[1] >>> 13; + this.h[1] &= 0x1fff; + for (i = 2; i < 10; i++) { + this.h[i] += c; + c = this.h[i] >>> 13; + this.h[i] &= 0x1fff; } -} -exports.default = InstallationIntegrityChecker; - -/***/ }), -/* 114 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.linkBin = undefined; - -var _slicedToArray2; - -function _load_slicedToArray() { - return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); -} + this.h[0] += (c * 5); + c = this.h[0] >>> 13; + this.h[0] &= 0x1fff; + this.h[1] += c; + c = this.h[1] >>> 13; + this.h[1] &= 0x1fff; + this.h[2] += c; -var _asyncToGenerator2; + g[0] = this.h[0] + 5; + c = g[0] >>> 13; + g[0] &= 0x1fff; + for (i = 1; i < 10; i++) { + g[i] = this.h[i] + c; + c = g[i] >>> 13; + g[i] &= 0x1fff; + } + g[9] -= (1 << 13); -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); -} + mask = (c ^ 1) - 1; + for (i = 0; i < 10; i++) g[i] &= mask; + mask = ~mask; + for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i]; -let linkBin = exports.linkBin = (() => { - var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (src, dest) { - if (process.platform === 'win32') { - const unlockMutex = yield (0, (_mutex || _load_mutex()).default)(src); - try { - yield cmdShim(src, dest); - } finally { - unlockMutex(); - } - } else { - yield (_fs || _load_fs()).mkdirp(path.dirname(dest)); - yield (_fs || _load_fs()).symlink(src, dest); - yield (_fs || _load_fs()).chmod(dest, '755'); - } - }); + this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff; + this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff; + this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff; + this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff; + this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff; + this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff; + this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff; + this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff; - return function linkBin(_x, _x2) { - return _ref.apply(this, arguments); - }; -})(); + f = this.h[0] + this.pad[0]; + this.h[0] = f & 0xffff; + for (i = 1; i < 8; i++) { + f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0; + this.h[i] = f & 0xffff; + } -var _packageHoister; + mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; + mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; + mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; + mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; + mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; + mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; + mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; + mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; + mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; + mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; + mac[macpos+10] = (this.h[5] >>> 0) & 0xff; + mac[macpos+11] = (this.h[5] >>> 8) & 0xff; + mac[macpos+12] = (this.h[6] >>> 0) & 0xff; + mac[macpos+13] = (this.h[6] >>> 8) & 0xff; + mac[macpos+14] = (this.h[7] >>> 0) & 0xff; + mac[macpos+15] = (this.h[7] >>> 8) & 0xff; +}; -function _load_packageHoister() { - return _packageHoister = _interopRequireDefault(__webpack_require__(351)); -} +poly1305.prototype.update = function(m, mpos, bytes) { + var i, want; -var _constants; + if (this.leftover) { + want = (16 - this.leftover); + if (want > bytes) + want = bytes; + for (i = 0; i < want; i++) + this.buffer[this.leftover + i] = m[mpos+i]; + bytes -= want; + mpos += want; + this.leftover += want; + if (this.leftover < 16) + return; + this.blocks(this.buffer, 0, 16); + this.leftover = 0; + } -function _load_constants() { - return _constants = _interopRequireWildcard(__webpack_require__(8)); -} + if (bytes >= 16) { + want = bytes - (bytes % 16); + this.blocks(m, mpos, want); + mpos += want; + bytes -= want; + } -var _promise; + if (bytes) { + for (i = 0; i < bytes; i++) + this.buffer[this.leftover + i] = m[mpos+i]; + this.leftover += bytes; + } +}; -function _load_promise() { - return _promise = _interopRequireWildcard(__webpack_require__(61)); +function crypto_onetimeauth(out, outpos, m, mpos, n, k) { + var s = new poly1305(k); + s.update(m, mpos, n); + s.finish(out, outpos); + return 0; } -var _misc; - -function _load_misc() { - return _misc = __webpack_require__(10); +function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { + var x = new Uint8Array(16); + crypto_onetimeauth(x,0,m,mpos,n,k); + return crypto_verify_16(h,hpos,x,0); } -var _fs; - -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(4)); +function crypto_secretbox(c,m,d,n,k) { + var i; + if (d < 32) return -1; + crypto_stream_xor(c,0,m,0,d,n,k); + crypto_onetimeauth(c, 16, c, 32, d - 32, c); + for (i = 0; i < 16; i++) c[i] = 0; + return 0; } -var _mutex; - -function _load_mutex() { - return _mutex = _interopRequireDefault(__webpack_require__(374)); +function crypto_secretbox_open(m,c,d,n,k) { + var i; + var x = new Uint8Array(32); + if (d < 32) return -1; + crypto_stream(x,0,32,n,k); + if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; + crypto_stream_xor(m,0,c,0,d,n,k); + for (i = 0; i < 32; i++) m[i] = 0; + return 0; } -var _semver; - -function _load_semver() { - return _semver = __webpack_require__(382); +function set25519(r, a) { + var i; + for (i = 0; i < 16; i++) r[i] = a[i]|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 invariant = __webpack_require__(7); -const cmdShim = (_promise || _load_promise()).promisify(__webpack_require__(400)); -const path = __webpack_require__(1); - -class PackageLinker { - constructor(config, resolver) { - this.resolver = resolver; - this.reporter = config.reporter; - this.config = config; - this.artifacts = {}; - } - - setArtifacts(artifacts) { - this.artifacts = artifacts; +function car25519(o) { + var i, v, c = 1; + for (i = 0; i < 16; i++) { + v = o[i] + c + 65535; + c = Math.floor(v / 65536); + o[i] = v - c * 65536; } + o[0] += c-1 + 37 * (c-1); +} - linkSelfDependencies(pkg, pkgLoc, targetBinLoc) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - targetBinLoc = path.join(targetBinLoc, '.bin'); - yield (_fs || _load_fs()).mkdirp(targetBinLoc); - targetBinLoc = yield (_fs || _load_fs()).realpath(targetBinLoc); - pkgLoc = yield (_fs || _load_fs()).realpath(pkgLoc); - for (const _ref2 of (0, (_misc || _load_misc()).entries)(pkg.bin)) { - var _ref3 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref2, 2); - - const scriptName = _ref3[0]; - const scriptCmd = _ref3[1]; - - const dest = path.join(targetBinLoc, scriptName); - const src = path.join(pkgLoc, scriptCmd); - if (!(yield (_fs || _load_fs()).exists(src))) { - // TODO maybe throw an error - continue; - } - yield linkBin(src, dest); - } - })(); +function sel25519(p, q, b) { + var t, c = ~(b-1); + for (var i = 0; i < 16; i++) { + t = c & (p[i] ^ q[i]); + p[i] ^= t; + q[i] ^= t; } +} - linkBinDependencies(pkg, dir) { - var _this = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const deps = []; - - const ref = pkg._reference; - invariant(ref, 'Package reference is missing'); - - const remote = pkg._remote; - invariant(remote, 'Package remote is missing'); - - // link up `bin scripts` in `dependencies` - for (const pattern of ref.dependencies) { - const dep = _this.resolver.getStrictResolvedPattern(pattern); - if (dep.bin && Object.keys(dep.bin).length) { - deps.push({ dep, loc: _this.config.generateHardModulePath(dep._reference) }); - } - } - - // link up the `bin` scripts in bundled dependencies - if (pkg.bundleDependencies) { - for (const depName of pkg.bundleDependencies) { - const loc = path.join(_this.config.generateHardModulePath(ref), _this.config.getFolder(pkg), depName); - - const dep = yield _this.config.readManifest(loc, remote.registry); - - if (dep.bin && Object.keys(dep.bin).length) { - deps.push({ dep, loc }); - } - } - } - - // no deps to link - if (!deps.length) { - return; - } - - // write the executables - for (const _ref4 of deps) { - const dep = _ref4.dep, - loc = _ref4.loc; - - yield _this.linkSelfDependencies(dep, loc, dir); - } - })(); +function pack25519(o, n) { + var i, j, b; + var m = gf(), t = gf(); + for (i = 0; i < 16; i++) t[i] = n[i]; + car25519(t); + car25519(t); + car25519(t); + for (j = 0; j < 2; j++) { + m[0] = t[0] - 0xffed; + for (i = 1; i < 15; i++) { + m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); + m[i-1] &= 0xffff; + } + m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); + b = (m[15]>>16) & 1; + m[14] &= 0xffff; + sel25519(t, m, 1-b); } - - getFlatHoistedTree(patterns) { - const hoister = new (_packageHoister || _load_packageHoister()).default(this.config, this.resolver); - hoister.seed(patterns); - return Promise.resolve(hoister.init()); + for (i = 0; i < 16; i++) { + o[2*i] = t[i] & 0xff; + o[2*i+1] = t[i]>>8; } +} - copyModules(patterns, linkDuplicates) { - var _this2 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - - let flatTree = yield _this2.getFlatHoistedTree(patterns); - - // sorted tree makes file creation and copying not to interfere with each other - flatTree = flatTree.sort(function (dep1, dep2) { - return dep1[0].localeCompare(dep2[0]); - }); - - // list of artifacts in modules to remove from extraneous removal - const artifactFiles = []; - - const copyQueue = new Map(); - const hardlinkQueue = new Map(); - const hardlinksEnabled = linkDuplicates && (yield (_fs || _load_fs()).hardlinksWork(_this2.config.cwd)); - - const copiedSrcs = new Map(); - for (const _ref5 of flatTree) { - var _ref6 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref5, 2); - - const dest = _ref6[0]; - var _ref6$ = _ref6[1]; - const pkg = _ref6$.pkg; - const src = _ref6$.loc; - - const ref = pkg._reference; - invariant(ref, 'expected package reference'); - ref.setLocation(dest); - - // backwards compatibility: get build artifacts from metadata - const metadata = yield _this2.config.readPackageMetadata(src); - for (const file of metadata.artifacts) { - artifactFiles.push(path.join(dest, file)); - } - - const integrityArtifacts = _this2.artifacts[`${pkg.name}@${pkg.version}`]; - if (integrityArtifacts) { - for (const file of integrityArtifacts) { - artifactFiles.push(path.join(dest, file)); - } - } +function neq25519(a, b) { + var c = new Uint8Array(32), d = new Uint8Array(32); + pack25519(c, a); + pack25519(d, b); + return crypto_verify_32(c, 0, d, 0); +} - const copiedDest = copiedSrcs.get(src); - if (!copiedDest) { - if (hardlinksEnabled) { - copiedSrcs.set(src, dest); - } - copyQueue.set(dest, { - src, - dest, - onFresh() { - if (ref) { - ref.setFresh(true); - } - } - }); - } else { - hardlinkQueue.set(dest, { - src: copiedDest, - dest, - onFresh() { - if (ref) { - ref.setFresh(true); - } - } - }); - } - } +function par25519(a) { + var d = new Uint8Array(32); + pack25519(d, a); + return d[0] & 1; +} - // keep track of all scoped paths to remove empty scopes after copy - const scopedPaths = new Set(); +function unpack25519(o, n) { + var i; + for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); + o[15] &= 0x7fff; +} - // register root & scoped packages as being possibly extraneous - const possibleExtraneous = new Set(); - for (const folder of _this2.config.registryFolders) { - const loc = path.join(_this2.config.cwd, folder); +function A(o, a, b) { + for (var i = 0; i < 16; i++) o[i] = a[i] + b[i]; +} - if (yield (_fs || _load_fs()).exists(loc)) { - const files = yield (_fs || _load_fs()).readdir(loc); - let filepath; - for (const file of files) { - filepath = path.join(loc, file); - if (file[0] === '@') { - // it's a scope, not a package - scopedPaths.add(filepath); - const subfiles = yield (_fs || _load_fs()).readdir(filepath); - for (const subfile of subfiles) { - possibleExtraneous.add(path.join(filepath, subfile)); - } - } else { - possibleExtraneous.add(filepath); - } - } - } - } +function Z(o, a, b) { + for (var i = 0; i < 16; i++) o[i] = a[i] - b[i]; +} - // linked modules - for (const loc of possibleExtraneous) { - const stat = yield (_fs || _load_fs()).lstat(loc); - if (stat.isSymbolicLink()) { - possibleExtraneous.delete(loc); - copyQueue.delete(loc); - } - } +function M(o, a, b) { + var v, c, + t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, + t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, + t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, + t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, + b0 = b[0], + b1 = b[1], + b2 = b[2], + b3 = b[3], + b4 = b[4], + b5 = b[5], + b6 = b[6], + b7 = b[7], + b8 = b[8], + b9 = b[9], + b10 = b[10], + b11 = b[11], + b12 = b[12], + b13 = b[13], + b14 = b[14], + b15 = b[15]; - // - let tick; - yield (_fs || _load_fs()).copyBulk(Array.from(copyQueue.values()), _this2.reporter, { - possibleExtraneous, - artifactFiles, - - ignoreBasenames: [(_constants || _load_constants()).METADATA_FILENAME, (_constants || _load_constants()).TARBALL_FILENAME], - - onStart: function (num) { - tick = _this2.reporter.progress(num); - }, - - onProgress(src) { - if (tick) { - tick(src); - } - } - }); - yield (_fs || _load_fs()).hardlinkBulk(Array.from(hardlinkQueue.values()), _this2.reporter, { - possibleExtraneous, - artifactFiles, - - onStart: function (num) { - tick = _this2.reporter.progress(num); - }, - - onProgress(src) { - if (tick) { - tick(src); - } - } - }); - - // remove all extraneous files that weren't in the tree - for (const loc of possibleExtraneous) { - _this2.reporter.verbose(_this2.reporter.lang('verboseFileRemoveExtraneous', loc)); - yield (_fs || _load_fs()).unlink(loc); - } - - // remove any empty scoped directories - for (const scopedPath of scopedPaths) { - const files = yield (_fs || _load_fs()).readdir(scopedPath); - if (files.length === 0) { - yield (_fs || _load_fs()).unlink(scopedPath); - } - } - - // create binary links - if (_this2.config.binLinks) { - const linksToCreate = _this2.determineTopLevelBinLinks(flatTree); - const tickBin = _this2.reporter.progress(flatTree.length + linksToCreate.length); - - // create links in transient dependencies - yield (_promise || _load_promise()).queue(flatTree, (() => { - var _ref7 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (_ref8) { - var _ref9 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref8, 2); - - let dest = _ref9[0], - pkg = _ref9[1].pkg; - - const binLoc = path.join(dest, _this2.config.getFolder(pkg)); - yield _this2.linkBinDependencies(pkg, binLoc); - tickBin(dest); - }); - - return function (_x3) { - return _ref7.apply(this, arguments); - }; - })(), 4); - - // create links at top level for all dependencies. - // non-transient dependencies will overwrite these during this.save() to ensure they take priority. - yield (_promise || _load_promise()).queue(linksToCreate, (() => { - var _ref10 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (_ref11) { - var _ref12 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref11, 2); - - let dest = _ref12[0], - pkg = _ref12[1].pkg; - - if (pkg.bin && Object.keys(pkg.bin).length) { - const binLoc = path.join(_this2.config.cwd, _this2.config.getFolder(pkg)); - yield _this2.linkSelfDependencies(pkg, dest, binLoc); - tickBin(_this2.config.cwd); - } - }); - - return function (_x4) { - return _ref10.apply(this, arguments); - }; - })(), 4); - } - })(); - } - - determineTopLevelBinLinks(flatTree) { - const linksToCreate = new Map(); - - flatTree.forEach((_ref13) => { - var _ref14 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref13, 2); - - let dest = _ref14[0], - hoistManifest = _ref14[1]; - - if (!linksToCreate.has(hoistManifest.pkg.name)) { - linksToCreate.set(hoistManifest.pkg.name, [dest, hoistManifest]); - } - }); - - return Array.from(linksToCreate.values()); - } - - resolvePeerModules() { - for (const pkg of this.resolver.getManifests()) { - this._resolvePeerModules(pkg); - } - } - - _resolvePeerModules(pkg) { - const peerDeps = pkg.peerDependencies; - if (!peerDeps) { - return; - } - - const ref = pkg._reference; - invariant(ref, 'Package reference is missing'); - - for (const name in peerDeps) { - const range = peerDeps[name]; - const patterns = this.resolver.patternsByPackage[name] || []; - const foundPattern = patterns.find(pattern => { - const resolvedPattern = this.resolver.getResolvedPattern(pattern); - return resolvedPattern ? this._satisfiesPeerDependency(range, resolvedPattern.version) : false; - }); - - if (foundPattern) { - ref.addDependencies([foundPattern]); - } else { - const depError = patterns.length > 0 ? 'incorrectPeer' : 'unmetPeer'; - const pkgHuman = `${pkg.name}@${pkg.version}`, - depHuman = `${name}@${range}`; - - this.reporter.warn(this.reporter.lang(depError, pkgHuman, depHuman)); - } - } - } - - _satisfiesPeerDependency(range, version) { - return range === '*' || (0, (_semver || _load_semver()).satisfiesWithPreleases)(version, range, this.config.looseSemver); - } - - init(patterns, linkDuplicates) { - var _this3 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this3.resolvePeerModules(); - yield _this3.copyModules(patterns, linkDuplicates); - yield _this3.saveAll(patterns); - })(); - } - - save(pattern) { - var _this4 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const resolved = _this4.resolver.getResolvedPattern(pattern); - invariant(resolved, `Couldn't find resolved name/version for ${pattern}`); - - const ref = resolved._reference; - invariant(ref, 'Missing reference'); - - // - const src = _this4.config.generateHardModulePath(ref); - - // link bins - if (_this4.config.binLinks && resolved.bin && Object.keys(resolved.bin).length && !ref.ignore) { - const binLoc = _this4.config.modulesFolder || path.join(_this4.config.cwd, _this4.config.getFolder(resolved)); - yield _this4.linkSelfDependencies(resolved, src, binLoc); - } - })(); - } - - saveAll(deps) { - var _this5 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - deps = _this5.resolver.dedupePatterns(deps); - yield (_promise || _load_promise()).queue(deps, function (dep) { - return _this5.save(dep); - }); - })(); - } -} -exports.default = PackageLinker; - -/***/ }), -/* 115 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.clearLine = clearLine; -exports.toStartOfLine = toStartOfLine; -exports.writeOnNthLine = writeOnNthLine; -exports.clearNthLine = clearNthLine; - - -const readline = __webpack_require__(109); - -var _require = __webpack_require__(16); - -const supportsColor = _require.supportsColor; - - -const CLEAR_WHOLE_LINE = 0; -const CLEAR_RIGHT_OF_CURSOR = 1; - -function clearLine(stdout) { - if (!supportsColor) { - return; - } - - readline.clearLine(stdout, CLEAR_WHOLE_LINE); - readline.cursorTo(stdout, 0); -} - -function toStartOfLine(stdout) { - if (!supportsColor) { - return; - } - - readline.cursorTo(stdout, 0); -} - -function writeOnNthLine(stdout, n, msg) { - if (!supportsColor) { - return; - } - - if (n == 0) { - readline.cursorTo(stdout, 0); - stdout.write(msg); - readline.clearLine(stdout, CLEAR_RIGHT_OF_CURSOR); - return; - } - readline.cursorTo(stdout, 0); - readline.moveCursor(stdout, 0, -n); - stdout.write(msg); - readline.clearLine(stdout, CLEAR_RIGHT_OF_CURSOR); - readline.cursorTo(stdout, 0); - readline.moveCursor(stdout, 0, n); -} - -function clearNthLine(stdout, n) { - if (!supportsColor) { - return; - } - - if (n == 0) { - clearLine(stdout); - return; - } - readline.cursorTo(stdout, 0); - readline.moveCursor(stdout, 0, -n); - readline.clearLine(stdout, CLEAR_WHOLE_LINE); - readline.moveCursor(stdout, 0, n); -} - -/***/ }), -/* 116 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _extends2; - -function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(43)); -} - -var _baseReporter; - -function _load_baseReporter() { - return _baseReporter = _interopRequireDefault(__webpack_require__(49)); -} - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -class JSONReporter extends (_baseReporter || _load_baseReporter()).default { - constructor(opts) { - super(opts); - - this._activityId = 0; - this._progressId = 0; - } - - _dump(type, data, error) { - let stdout = this.stdout; - if (error) { - stdout = this.stderr; - } - stdout.write(`${JSON.stringify({ type, data })}\n`); - } - - _verbose(msg) { - this._dump('verbose', msg); - } - - list(type, items, hints) { - this._dump('list', { type, items, hints }); - } - - tree(type, trees) { - this._dump('tree', { type, trees }); - } - - step(current, total, message) { - this._dump('step', { message, current, total }); - } - - inspect(value) { - this._dump('inspect', value); - } - - footer() { - this._dump('finished', this.getTotalTime()); - } - - log(msg) { - this._dump('log', msg); - } - - command(msg) { - this._dump('command', msg); - } - - table(head, body) { - this._dump('table', { head, body }); - } - - success(msg) { - this._dump('success', msg); - } - - error(msg) { - this._dump('error', msg, true); - } - - warn(msg) { - this._dump('warning', msg, true); - } - - info(msg) { - this._dump('info', msg); - } - - activitySet(total, workers) { - if (!this.isTTY || this.noProgress) { - return super.activitySet(total, workers); - } - - const id = this._activityId++; - this._dump('activitySetStart', { id, total, workers }); - - const spinners = []; - for (let i = 0; i < workers; i++) { - let current = 0; - let header = ''; - - spinners.push({ - clear() {}, - setPrefix(_current, _header) { - current = _current; - header = _header; - }, - tick: msg => { - this._dump('activitySetTick', { id, header, current, worker: i, message: msg }); - }, - end() {} - }); - } - - return { - spinners, - end: () => { - this._dump('activitySetEnd', { id }); - } - }; - } - - activity() { - return this._activity({}); - } - - _activity(data) { - if (!this.isTTY || this.noProgress) { - return { - tick() {}, - end() {} - }; - } - - const id = this._activityId++; - this._dump('activityStart', (0, (_extends2 || _load_extends()).default)({ id }, data)); - - return { - tick: name => { - this._dump('activityTick', { id, name }); - }, - - end: () => { - this._dump('activityEnd', { id }); - } - }; - } - - progress(total) { - if (this.noProgress) { - return function () { - // noop - }; - } - - const id = this._progressId++; - let current = 0; - this._dump('progressStart', { id, total }); - - return () => { - current++; - this._dump('progressTick', { id, current }); - - if (current === total) { - this._dump('progressFinish', { id }); - } - }; - } -} -exports.default = JSONReporter; - -/***/ }), -/* 117 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -class BaseResolver { - constructor(request, fragment) { - this.resolver = request.resolver; - this.reporter = request.reporter; - this.fragment = fragment; - this.registry = request.registry; - this.request = request; - this.pattern = request.pattern; - this.config = request.config; - } - - fork(Resolver, resolveArg) { - for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) { - args[_key - 2] = arguments[_key]; - } - - const resolver = new Resolver(this.request, ...args); - resolver.registry = this.registry; - return resolver.resolve(resolveArg); - } - - resolve() { - throw new Error('Not implemented'); - } -} -exports.default = BaseResolver; - -/***/ }), -/* 118 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.explodeGistFragment = explodeGistFragment; - -var _errors; - -function _load_errors() { - return _errors = __webpack_require__(3); -} - -var _gitResolver; - -function _load_gitResolver() { - return _gitResolver = _interopRequireDefault(__webpack_require__(58)); -} - -var _exoticResolver; - -function _load_exoticResolver() { - return _exoticResolver = _interopRequireDefault(__webpack_require__(50)); -} - -var _misc; - -function _load_misc() { - return _misc = _interopRequireWildcard(__webpack_require__(10)); -} - -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 explodeGistFragment(fragment, reporter) { - fragment = (_misc || _load_misc()).removePrefix(fragment, 'gist:'); - - const parts = fragment.split('#'); - - if (parts.length <= 2) { - return { - id: parts[0], - hash: parts[1] || '' - }; - } else { - throw new (_errors || _load_errors()).MessageError(reporter.lang('invalidGistFragment', fragment)); - } -} - -class GistResolver extends (_exoticResolver || _load_exoticResolver()).default { - - constructor(request, fragment) { - super(request, fragment); - - var _explodeGistFragment = explodeGistFragment(fragment, this.reporter); - - const id = _explodeGistFragment.id, - hash = _explodeGistFragment.hash; - - this.id = id; - this.hash = hash; - } - - resolve() { - return this.fork((_gitResolver || _load_gitResolver()).default, false, `https://gist.github.com/${this.id}.git#${this.hash}`); - } -} -exports.default = GistResolver; -GistResolver.protocol = 'gist'; - -/***/ }), -/* 119 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -Object.defineProperty(exports, "__esModule", { - value: true -}); - -var _asyncToGenerator2; - -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); -} - -var _errors; - -function _load_errors() { - return _errors = __webpack_require__(3); -} - -var _registryResolver; - -function _load_registryResolver() { - return _registryResolver = _interopRequireDefault(__webpack_require__(371)); -} - -var _npmRegistry; - -function _load_npmRegistry() { - return _npmRegistry = _interopRequireDefault(__webpack_require__(42)); -} - -var _map; - -function _load_map() { - return _map = _interopRequireDefault(__webpack_require__(24)); -} - -var _fs; - -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(4)); -} - -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 inquirer = __webpack_require__(146); - -const tty = __webpack_require__(110); -const invariant = __webpack_require__(7); -const path = __webpack_require__(1); - -const NPM_REGISTRY = /http[s]:\/\/registry.npmjs.org/g; - -class NpmResolver extends (_registryResolver || _load_registryResolver()).default { - - static findVersionInRegistryResponse(config, range, body, request) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (!body['dist-tags']) { - throw new (_errors || _load_errors()).MessageError(config.reporter.lang('malformedRegistryResponse', body.name)); - } - - if (range in body['dist-tags']) { - range = body['dist-tags'][range]; - } - - const satisfied = yield config.resolveConstraints(Object.keys(body.versions), range); - if (satisfied) { - return body.versions[satisfied]; - } else if (request && !config.nonInteractive) { - if (request.resolver && request.resolver.activity) { - request.resolver.activity.end(); - } - config.reporter.log(config.reporter.lang('couldntFindVersionThatMatchesRange', body.name, range)); - let pageSize; - if (process.stdout instanceof tty.WriteStream) { - pageSize = process.stdout.rows - 2; - } - const response = yield inquirer.prompt([{ - name: 'package', - type: 'list', - message: config.reporter.lang('chooseVersionFromList', body.name), - choices: Object.keys(body.versions).reverse(), - pageSize - }]); - if (response && response.package) { - return body.versions[response.package]; - } - } - throw new (_errors || _load_errors()).MessageError(config.reporter.lang('couldntFindVersionThatMatchesRange', body.name, range)); - })(); - } - - resolveRequest() { - var _this = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (_this.config.offline) { - const res = _this.resolveRequestOffline(); - if (res != null) { - return res; - } - } - - const body = yield _this.config.registries.npm.request((_npmRegistry || _load_npmRegistry()).default.escapeName(_this.name)); - - if (body) { - return yield NpmResolver.findVersionInRegistryResponse(_this.config, _this.range, body, _this.request); - } else { - return null; - } - })(); - } - - resolveRequestOffline() { - var _this2 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - - const scope = _this2.config.registries.npm.getScope(_this2.name); - // find modules of this name - const prefix = scope ? _this2.name.split(/\/|%2f/)[1] : `npm-${_this2.name}-`; - - invariant(_this2.config.cacheFolder, 'expected packages root'); - const cacheFolder = path.join(_this2.config.cacheFolder, scope ? 'npm-' + scope : ''); - - const files = yield _this2.config.getCache('cachedPackages', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const files = yield (_fs || _load_fs()).readdir(cacheFolder); - const validFiles = []; - - for (const name of files) { - // no hidden files - if (name[0] === '.') { - continue; - } - - // ensure valid module cache - const dir = path.join(cacheFolder, name); - if (yield _this2.config.isValidModuleDest(dir)) { - validFiles.push(name); - } - } - - return validFiles; - })); - - const versions = (0, (_map || _load_map()).default)(); - - for (const name of files) { - // check if folder starts with our prefix - if (name.indexOf(prefix) !== 0) { - continue; - } - - const dir = path.join(cacheFolder, name); - - // read manifest and validate correct name - const pkg = yield _this2.config.readManifest(dir, 'npm'); - if (pkg.name !== _this2.name) { - continue; - } - - // read package metadata - const metadata = yield _this2.config.readPackageMetadata(dir); - if (!metadata.remote) { - continue; // old yarn metadata - } - - versions[pkg.version] = Object.assign({}, pkg, { _remote: metadata.remote }); - } - - const satisfied = yield _this2.config.resolveConstraints(Object.keys(versions), _this2.range); - if (satisfied) { - return versions[satisfied]; - } else if (!_this2.config.preferOffline) { - throw new (_errors || _load_errors()).MessageError(_this2.reporter.lang('couldntFindPackageInCache', _this2.name, _this2.range, Object.keys(versions).join(', '))); - } else { - return null; - } - })(); - } - - cleanRegistry(url) { - if (this.config.getOption('registry') === (_constants || _load_constants()).YARN_REGISTRY) { - return url.replace(NPM_REGISTRY, (_constants || _load_constants()).YARN_REGISTRY); - } else { - return url; - } - } - - resolve() { - var _this3 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // lockfile - const shrunk = _this3.request.getLocked('tarball'); - if (shrunk) { - return shrunk; - } - - const info = yield _this3.resolveRequest(); - if (info == null) { - throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('packageNotFoundRegistry', _this3.name, 'npm')); - } - - const deprecated = info.deprecated, - dist = info.dist; - - if (typeof deprecated === 'string') { - let human = `${info.name}@${info.version}`; - const parentNames = _this3.request.getParentNames(); - if (parentNames.length) { - human = parentNames.concat(human).join(' > '); - } - _this3.reporter.warn(`${human}: ${deprecated}`); - } - - if (dist != null && dist.tarball) { - info._remote = { - resolved: `${_this3.cleanRegistry(dist.tarball)}#${dist.shasum}`, - type: 'tarball', - reference: _this3.cleanRegistry(dist.tarball), - hash: dist.shasum, - registry: 'npm' - }; - } - - info._uid = info.version; - - return info; - })(); - } -} -exports.default = NpmResolver; -NpmResolver.registry = 'npm'; - -/***/ }), -/* 120 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; + v = a[0]; + t0 += v * b0; + t1 += v * b1; + t2 += v * b2; + t3 += v * b3; + t4 += v * b4; + t5 += v * b5; + t6 += v * b6; + t7 += v * b7; + t8 += v * b8; + t9 += v * b9; + t10 += v * b10; + t11 += v * b11; + t12 += v * b12; + t13 += v * b13; + t14 += v * b14; + t15 += v * b15; + v = a[1]; + t1 += v * b0; + t2 += v * b1; + t3 += v * b2; + t4 += v * b3; + t5 += v * b4; + t6 += v * b5; + t7 += v * b6; + t8 += v * b7; + t9 += v * b8; + t10 += v * b9; + t11 += v * b10; + t12 += v * b11; + t13 += v * b12; + t14 += v * b13; + t15 += v * b14; + t16 += v * b15; + v = a[2]; + t2 += v * b0; + t3 += v * b1; + t4 += v * b2; + t5 += v * b3; + t6 += v * b4; + t7 += v * b5; + t8 += v * b6; + t9 += v * b7; + t10 += v * b8; + t11 += v * b9; + t12 += v * b10; + t13 += v * b11; + t14 += v * b12; + t15 += v * b13; + t16 += v * b14; + t17 += v * b15; + v = a[3]; + t3 += v * b0; + t4 += v * b1; + t5 += v * b2; + t6 += v * b3; + t7 += v * b4; + t8 += v * b5; + t9 += v * b6; + t10 += v * b7; + t11 += v * b8; + t12 += v * b9; + t13 += v * b10; + t14 += v * b11; + t15 += v * b12; + t16 += v * b13; + t17 += v * b14; + t18 += v * b15; + v = a[4]; + t4 += v * b0; + t5 += v * b1; + t6 += v * b2; + t7 += v * b3; + t8 += v * b4; + t9 += v * b5; + t10 += v * b6; + t11 += v * b7; + t12 += v * b8; + t13 += v * b9; + t14 += v * b10; + t15 += v * b11; + t16 += v * b12; + t17 += v * b13; + t18 += v * b14; + t19 += v * b15; + v = a[5]; + t5 += v * b0; + t6 += v * b1; + t7 += v * b2; + t8 += v * b3; + t9 += v * b4; + t10 += v * b5; + t11 += v * b6; + t12 += v * b7; + t13 += v * b8; + t14 += v * b9; + t15 += v * b10; + t16 += v * b11; + t17 += v * b12; + t18 += v * b13; + t19 += v * b14; + t20 += v * b15; + v = a[6]; + t6 += v * b0; + t7 += v * b1; + t8 += v * b2; + t9 += v * b3; + t10 += v * b4; + t11 += v * b5; + t12 += v * b6; + t13 += v * b7; + t14 += v * b8; + t15 += v * b9; + t16 += v * b10; + t17 += v * b11; + t18 += v * b12; + t19 += v * b13; + t20 += v * b14; + t21 += v * b15; + v = a[7]; + t7 += v * b0; + t8 += v * b1; + t9 += v * b2; + t10 += v * b3; + t11 += v * b4; + t12 += v * b5; + t13 += v * b6; + t14 += v * b7; + t15 += v * b8; + t16 += v * b9; + t17 += v * b10; + t18 += v * b11; + t19 += v * b12; + t20 += v * b13; + t21 += v * b14; + t22 += v * b15; + v = a[8]; + t8 += v * b0; + t9 += v * b1; + t10 += v * b2; + t11 += v * b3; + t12 += v * b4; + t13 += v * b5; + t14 += v * b6; + t15 += v * b7; + t16 += v * b8; + t17 += v * b9; + t18 += v * b10; + t19 += v * b11; + t20 += v * b12; + t21 += v * b13; + t22 += v * b14; + t23 += v * b15; + v = a[9]; + t9 += v * b0; + t10 += v * b1; + t11 += v * b2; + t12 += v * b3; + t13 += v * b4; + t14 += v * b5; + t15 += v * b6; + t16 += v * b7; + t17 += v * b8; + t18 += v * b9; + t19 += v * b10; + t20 += v * b11; + t21 += v * b12; + t22 += v * b13; + t23 += v * b14; + t24 += v * b15; + v = a[10]; + t10 += v * b0; + t11 += v * b1; + t12 += v * b2; + t13 += v * b3; + t14 += v * b4; + t15 += v * b5; + t16 += v * b6; + t17 += v * b7; + t18 += v * b8; + t19 += v * b9; + t20 += v * b10; + t21 += v * b11; + t22 += v * b12; + t23 += v * b13; + t24 += v * b14; + t25 += v * b15; + v = a[11]; + t11 += v * b0; + t12 += v * b1; + t13 += v * b2; + t14 += v * b3; + t15 += v * b4; + t16 += v * b5; + t17 += v * b6; + t18 += v * b7; + t19 += v * b8; + t20 += v * b9; + t21 += v * b10; + t22 += v * b11; + t23 += v * b12; + t24 += v * b13; + t25 += v * b14; + t26 += v * b15; + v = a[12]; + t12 += v * b0; + t13 += v * b1; + t14 += v * b2; + t15 += v * b3; + t16 += v * b4; + t17 += v * b5; + t18 += v * b6; + t19 += v * b7; + t20 += v * b8; + t21 += v * b9; + t22 += v * b10; + t23 += v * b11; + t24 += v * b12; + t25 += v * b13; + t26 += v * b14; + t27 += v * b15; + v = a[13]; + t13 += v * b0; + t14 += v * b1; + t15 += v * b2; + t16 += v * b3; + t17 += v * b4; + t18 += v * b5; + t19 += v * b6; + t20 += v * b7; + t21 += v * b8; + t22 += v * b9; + t23 += v * b10; + t24 += v * b11; + t25 += v * b12; + t26 += v * b13; + t27 += v * b14; + t28 += v * b15; + v = a[14]; + t14 += v * b0; + t15 += v * b1; + t16 += v * b2; + t17 += v * b3; + t18 += v * b4; + t19 += v * b5; + t20 += v * b6; + t21 += v * b7; + t22 += v * b8; + t23 += v * b9; + t24 += v * b10; + t25 += v * b11; + t26 += v * b12; + t27 += v * b13; + t28 += v * b14; + t29 += v * b15; + v = a[15]; + t15 += v * b0; + t16 += v * b1; + t17 += v * b2; + t18 += v * b3; + t19 += v * b4; + t20 += v * b5; + t21 += v * b6; + t22 += v * b7; + t23 += v * b8; + t24 += v * b9; + t25 += v * b10; + t26 += v * b11; + t27 += v * b12; + t28 += v * b13; + t29 += v * b14; + t30 += v * b15; + t0 += 38 * t16; + t1 += 38 * t17; + t2 += 38 * t18; + t3 += 38 * t19; + t4 += 38 * t20; + t5 += 38 * t21; + t6 += 38 * t22; + t7 += 38 * t23; + t8 += 38 * t24; + t9 += 38 * t25; + t10 += 38 * t26; + t11 += 38 * t27; + t12 += 38 * t28; + t13 += 38 * t29; + t14 += 38 * t30; + // t15 left as is -Object.defineProperty(exports, "__esModule", { - value: true -}); + // first car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); -var _slicedToArray2; + // second car + c = 1; + v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; + v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; + v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; + v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; + v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; + v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; + v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; + v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; + v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; + v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; + v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; + v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; + v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; + v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; + v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; + v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; + t0 += c-1 + 37 * (c-1); -function _load_slicedToArray() { - return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); + o[ 0] = t0; + o[ 1] = t1; + o[ 2] = t2; + o[ 3] = t3; + o[ 4] = t4; + o[ 5] = t5; + o[ 6] = t6; + o[ 7] = t7; + o[ 8] = t8; + o[ 9] = t9; + o[10] = t10; + o[11] = t11; + o[12] = t12; + o[13] = t13; + o[14] = t14; + o[15] = t15; } -var _asyncToGenerator2; - -function _load_asyncToGenerator() { - return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +function S(o, a) { + M(o, a, a); } -var _errors; - -function _load_errors() { - return _errors = __webpack_require__(3); +function inv25519(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 253; a >= 0; a--) { + S(c, c); + if(a !== 2 && a !== 4) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; } -var _misc; - -function _load_misc() { - return _misc = __webpack_require__(10); +function pow2523(o, i) { + var c = gf(); + var a; + for (a = 0; a < 16; a++) c[a] = i[a]; + for (a = 250; a >= 0; a--) { + S(c, c); + if(a !== 1) M(c, c, i); + } + for (a = 0; a < 16; a++) o[a] = c[a]; } -var _crypto; +function crypto_scalarmult(q, n, p) { + var z = new Uint8Array(32); + var x = new Float64Array(80), r, i; + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(); + for (i = 0; i < 31; i++) z[i] = n[i]; + z[31]=(n[31]&127)|64; + z[0]&=248; + unpack25519(x,p); + for (i = 0; i < 16; i++) { + b[i]=x[i]; + d[i]=a[i]=c[i]=0; + } + a[0]=d[0]=1; + for (i=254; i>=0; --i) { + r=(z[i>>>3]>>>(i&7))&1; + sel25519(a,b,r); + sel25519(c,d,r); + A(e,a,c); + Z(a,a,c); + A(c,b,d); + Z(b,b,d); + S(d,e); + S(f,a); + M(a,c,a); + M(c,b,e); + A(e,a,c); + Z(a,a,c); + S(b,a); + Z(c,d,f); + M(a,c,_121665); + A(a,a,d); + M(c,c,a); + M(a,d,f); + M(d,b,x); + S(b,e); + sel25519(a,b,r); + sel25519(c,d,r); + } + for (i = 0; i < 16; i++) { + x[i+16]=a[i]; + x[i+32]=c[i]; + x[i+48]=b[i]; + x[i+64]=d[i]; + } + var x32 = x.subarray(32); + var x16 = x.subarray(16); + inv25519(x32,x32); + M(x16,x16,x32); + pack25519(q,x16); + return 0; +} -function _load_crypto() { - return _crypto = _interopRequireWildcard(__webpack_require__(81)); +function crypto_scalarmult_base(q, n) { + return crypto_scalarmult(q, n, _9); } -var _child; +function crypto_box_keypair(y, x) { + randombytes(x, 32); + return crypto_scalarmult_base(y, x); +} -function _load_child() { - return _child = _interopRequireWildcard(__webpack_require__(59)); +function crypto_box_beforenm(k, y, x) { + var s = new Uint8Array(32); + crypto_scalarmult(s, x, y); + return crypto_core_hsalsa20(k, _0, s, sigma); } -var _fs; +var crypto_box_afternm = crypto_secretbox; +var crypto_box_open_afternm = crypto_secretbox_open; -function _load_fs() { - return _fs = _interopRequireWildcard(__webpack_require__(4)); +function crypto_box(c, m, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_afternm(c, m, d, n, k); } -var _map; - -function _load_map() { - return _map = _interopRequireDefault(__webpack_require__(24)); +function crypto_box_open(m, c, d, n, y, x) { + var k = new Uint8Array(32); + crypto_box_beforenm(k, y, x); + return crypto_box_open_afternm(m, c, d, n, k); } -var _fs2; +var K = [ + 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, + 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, + 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, + 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, + 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, + 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, + 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, + 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, + 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, + 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, + 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, + 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, + 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, + 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, + 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, + 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, + 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, + 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, + 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, + 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, + 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, + 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, + 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, + 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, + 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, + 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, + 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, + 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, + 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, + 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, + 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, + 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, + 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, + 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, + 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, + 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, + 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, + 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, + 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, + 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 +]; -function _load_fs2() { - return _fs2 = __webpack_require__(5); -} +function crypto_hashblocks_hl(hh, hl, m, n) { + var wh = new Int32Array(16), wl = new Int32Array(16), + bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, + bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, + th, tl, i, j, h, l, a, b, c, d; -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; } } + var ah0 = hh[0], + ah1 = hh[1], + ah2 = hh[2], + ah3 = hh[3], + ah4 = hh[4], + ah5 = hh[5], + ah6 = hh[6], + ah7 = hh[7], -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + al0 = hl[0], + al1 = hl[1], + al2 = hl[2], + al3 = hl[3], + al4 = hl[4], + al5 = hl[5], + al6 = hl[6], + al7 = hl[7]; -const invariant = __webpack_require__(7); -const semver = __webpack_require__(27); -const StringDecoder = __webpack_require__(164).StringDecoder; -const tarFs = __webpack_require__(103); -const tarStream = __webpack_require__(263); -const url = __webpack_require__(11); + var pos = 0; + while (n >= 128) { + for (i = 0; i < 16; i++) { + j = 8 * i + pos; + wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3]; + wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7]; + } + for (i = 0; i < 80; i++) { + bh0 = ah0; + bh1 = ah1; + bh2 = ah2; + bh3 = ah3; + bh4 = ah4; + bh5 = ah5; + bh6 = ah6; + bh7 = ah7; + bl0 = al0; + bl1 = al1; + bl2 = al2; + bl3 = al3; + bl4 = al4; + bl5 = al5; + bl6 = al6; + bl7 = al7; -const supportsArchiveCache = (0, (_map || _load_map()).default)({ - 'github.com': false }); + // add + h = ah7; + l = al7; -// This regex is designed to match output from git of the style: -// ebeb6eafceb61dd08441ffe086c77eb472842494 refs/tags/v0.21.0 -// and extract the hash and tag name as capture groups -const gitRefLineRegex = /^([a-fA-F0-9]+)\s+(?:[^/]+\/){2}(.*)$/; + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; -class Git { - constructor(config, gitUrl, hash) { - this.supportsArchive = false; - this.fetched = false; - this.config = config; - this.reporter = config.reporter; - this.hash = hash; - this.ref = hash; - this.gitUrl = gitUrl; - this.cwd = this.config.getTemp((_crypto || _load_crypto()).hash(this.gitUrl.repository)); - } + // Sigma1 + h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32)))); + l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32)))); - /** - * npm URLs contain a 'git+' scheme prefix, which is not understood by git. - * git "URLs" also allow an alternative scp-like syntax, so they're not standard URLs. - */ - static npmUrlToGitUrl(npmUrl) { - // Special case in npm, where ssh:// prefix is stripped to pass scp-like syntax - // which in git works as remote path only if there are no slashes before ':'. - const match = npmUrl.match(/^git\+ssh:\/\/((?:[^@:\/]+@)?([^@:\/]+):([^/]*).*)/); - // Additionally, if the host part is digits-only, npm falls back to - // interpreting it as an SSH URL with a port number. - if (match && /[^0-9]/.test(match[3])) { - return { - protocol: 'ssh:', - hostname: match[2], - repository: match[1] - }; - } + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - const repository = npmUrl.replace(/^git\+/, ''); - const parsed = url.parse(repository); - return { - protocol: parsed.protocol || 'file:', - hostname: parsed.hostname || null, - repository - }; - } + // Ch + h = (ah4 & ah5) ^ (~ah4 & ah6); + l = (al4 & al5) ^ (~al4 & al6); - /** - * Check if the host specified in the input `gitUrl` has archive capability. - */ + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - static hasArchiveCapability(ref) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const hostname = ref.hostname; - if (ref.protocol !== 'ssh:' || hostname == null) { - return false; - } + // K + h = K[i*2]; + l = K[i*2+1]; - if (hostname in supportsArchiveCache) { - return supportsArchiveCache[hostname]; - } + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - try { - yield (_child || _load_child()).spawn('git', ['archive', `--remote=${ref.repository}`, 'HEAD', Date.now() + '']); - throw new Error(); - } catch (err) { - const supports = err.message.indexOf('did not match any files') >= 0; - return supportsArchiveCache[hostname] = supports; - } - })(); - } + // w + h = wh[i%16]; + l = wl[i%16]; - /** - * Check if the input `target` is a 5-40 character hex commit hash. - */ + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - static isCommitHash(target) { - return !!target && /^[a-f0-9]{5,40}$/.test(target); - } + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - static repoExists(ref) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - try { - yield (_child || _load_child()).spawn('git', ['ls-remote', '-t', ref.repository]); - return true; - } catch (err) { - return false; - } - })(); - } + th = c & 0xffff | d << 16; + tl = a & 0xffff | b << 16; - static replaceProtocol(ref, protocol) { - return { - protocol, - hostname: ref.hostname, - repository: ref.repository.replace(/^(?:git|http):/, protocol) - }; - } + // add + h = th; + l = tl; - /** - * Attempt to upgrade insecure protocols to secure protocol - */ - static secureGitUrl(ref, hash, reporter) { - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (Git.isCommitHash(hash)) { - // this is cryptographically secure - return ref; - } + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - if (ref.protocol === 'git:') { - const secureUrl = Git.replaceProtocol(ref, 'https:'); - if (yield Git.repoExists(secureUrl)) { - return secureUrl; - } else { - throw new (_errors || _load_errors()).SecurityError(reporter.lang('refusingDownloadGitWithoutCommit', ref)); - } - } + // Sigma0 + h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32)))); + l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32)))); - if (ref.protocol === 'http:') { - const secureRef = Git.replaceProtocol(ref, 'https:'); - if (yield Git.repoExists(secureRef)) { - return secureRef; - } else { - if (yield Git.repoExists(ref)) { - return ref; - } else { - throw new (_errors || _load_errors()).SecurityError(reporter.lang('refusingDownloadHTTPWithoutCommit', ref)); - } - } - } + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - if (ref.protocol === 'https:') { - if (yield Git.repoExists(ref)) { - return ref; - } else { - throw new (_errors || _load_errors()).SecurityError(reporter.lang('refusingDownloadHTTPSWithoutCommit', ref)); - } - } + // Maj + h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2); + l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2); - return ref; - })(); - } + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - /** - * Archive a repo to destination - */ + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - archive(dest) { - if (this.supportsArchive) { - return this._archiveViaRemoteArchive(dest); - } else { - return this._archiveViaLocalFetched(dest); - } - } + bh7 = (c & 0xffff) | (d << 16); + bl7 = (a & 0xffff) | (b << 16); - _archiveViaRemoteArchive(dest) { - var _this = this; + // add + h = bh3; + l = bl3; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const hashStream = new (_crypto || _load_crypto()).HashStream(); - yield (_child || _load_child()).spawn('git', ['archive', `--remote=${_this.gitUrl.repository}`, _this.ref], { - process(proc, resolve, reject, done) { - const writeStream = (0, (_fs2 || _load_fs2()).createWriteStream)(dest); - proc.on('error', reject); - writeStream.on('error', reject); - writeStream.on('end', done); - writeStream.on('open', function () { - proc.stdout.pipe(hashStream).pipe(writeStream); - }); - writeStream.once('finish', done); - } - }); - return hashStream.getHash(); - })(); - } + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - _archiveViaLocalFetched(dest) { - var _this2 = this; + h = th; + l = tl; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const hashStream = new (_crypto || _load_crypto()).HashStream(); - yield (_child || _load_child()).spawn('git', ['archive', _this2.hash], { - cwd: _this2.cwd, - process(proc, resolve, reject, done) { - const writeStream = (0, (_fs2 || _load_fs2()).createWriteStream)(dest); - proc.on('error', reject); - writeStream.on('error', reject); - writeStream.on('open', function () { - proc.stdout.pipe(hashStream).pipe(writeStream); - }); - writeStream.once('finish', done); - } - }); - return hashStream.getHash(); - })(); - } + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - /** - * Clone a repo to the input `dest`. Use `git archive` if it's available, otherwise fall - * back to `git clone`. - */ + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - clone(dest) { - if (this.supportsArchive) { - return this._cloneViaRemoteArchive(dest); - } else { - return this._cloneViaLocalFetched(dest); - } - } + bh3 = (c & 0xffff) | (d << 16); + bl3 = (a & 0xffff) | (b << 16); - _cloneViaRemoteArchive(dest) { - var _this3 = this; + ah1 = bh0; + ah2 = bh1; + ah3 = bh2; + ah4 = bh3; + ah5 = bh4; + ah6 = bh5; + ah7 = bh6; + ah0 = bh7; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - yield (_child || _load_child()).spawn('git', ['archive', `--remote=${_this3.gitUrl.repository}`, _this3.ref], { - process(proc, update, reject, done) { - const extractor = tarFs.extract(dest, { - dmode: 0o555, // all dirs should be readable - fmode: 0o444 }); - extractor.on('error', reject); - extractor.on('finish', done); + al1 = bl0; + al2 = bl1; + al3 = bl2; + al4 = bl3; + al5 = bl4; + al6 = bl5; + al7 = bl6; + al0 = bl7; - proc.stdout.pipe(extractor); - proc.on('error', reject); - } - }); - })(); - } + if (i%16 === 15) { + for (j = 0; j < 16; j++) { + // add + h = wh[j]; + l = wl[j]; - _cloneViaLocalFetched(dest) { - var _this4 = this; + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - yield (_child || _load_child()).spawn('git', ['archive', _this4.hash], { - cwd: _this4.cwd, - process(proc, resolve, reject, done) { - const extractor = tarFs.extract(dest, { - dmode: 0o555, // all dirs should be readable - fmode: 0o444 }); + h = wh[(j+9)%16]; + l = wl[(j+9)%16]; - extractor.on('error', reject); - extractor.on('finish', done); + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - proc.stdout.pipe(extractor); - } - }); - })(); - } + // sigma0 + th = wh[(j+1)%16]; + tl = wl[(j+1)%16]; + h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7); + l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7))); - /** - * Clone this repo. - */ + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - fetch() { - var _this5 = this; + // sigma1 + th = wh[(j+14)%16]; + tl = wl[(j+14)%16]; + h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6); + l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6))); - const gitUrl = this.gitUrl, - cwd = this.cwd; + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - return (_fs || _load_fs()).lockQueue.push(gitUrl.repository, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (yield (_fs || _load_fs()).exists(cwd)) { - yield (_child || _load_child()).spawn('git', ['pull'], { cwd }); - } else { - yield (_child || _load_child()).spawn('git', ['clone', gitUrl.repository, cwd]); + wh[j] = (c & 0xffff) | (d << 16); + wl[j] = (a & 0xffff) | (b << 16); + } } + } - _this5.fetched = true; - })); - } + // add + h = ah0; + l = al0; - /** - * Given a list of tags/branches from git, check if they match an input range. - */ + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - findResolution(range, tags) { - var _this6 = this; + h = hh[0]; + l = hl[0]; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // If there are no tags and target is *, fallback to the latest commit on master - // or if we have no target. - if (!range || !tags.length && range === '*') { - return 'master'; - } + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - return (yield _this6.config.resolveConstraints(tags.filter(function (tag) { - return !!semver.valid(tag, _this6.config.looseSemver); - }), range)) || range; - })(); - } + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - /** - * Fetch the file by cloning the repo and reading it. - */ + hh[0] = ah0 = (c & 0xffff) | (d << 16); + hl[0] = al0 = (a & 0xffff) | (b << 16); - getFile(filename) { - if (this.supportsArchive) { - return this._getFileFromArchive(filename); - } else { - return this._getFileFromClone(filename); - } - } + h = ah1; + l = al1; - _getFileFromArchive(filename) { - var _this7 = this; + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - try { - return yield (_child || _load_child()).spawn('git', ['archive', `--remote=${_this7.gitUrl.repository}`, _this7.ref, filename], { - process(proc, update, reject, done) { - const parser = tarStream.extract(); + h = hh[1]; + l = hl[1]; - parser.on('error', reject); - parser.on('finish', done); + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - parser.on('entry', (header, stream, next) => { - const decoder = new StringDecoder('utf8'); - let fileContent = ''; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - stream.on('data', buffer => { - fileContent += decoder.write(buffer); - }); - stream.on('end', () => { - // $FlowFixMe: suppressing this error due to bug https://github.com/facebook/flow/pull/3483 - const remaining = decoder.end(); - update(fileContent + remaining); - next(); - }); - stream.resume(); - }); + hh[1] = ah1 = (c & 0xffff) | (d << 16); + hl[1] = al1 = (a & 0xffff) | (b << 16); - proc.stdout.pipe(parser); - } - }); - } catch (err) { - if (err.message.indexOf('did not match any files') >= 0) { - return false; - } else { - throw err; - } - } - })(); - } + h = ah2; + l = al2; - _getFileFromClone(filename) { - var _this8 = this; + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - invariant(_this8.fetched, 'Repo not fetched'); + h = hh[2]; + l = hl[2]; - try { - return yield (_child || _load_child()).spawn('git', ['show', `${_this8.hash}:${filename}`], { cwd: _this8.cwd }); - } catch (err) { - // file doesn't exist - return false; - } - })(); - } + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - /** - * Initialize the repo, find a secure url to use and - * set the ref to match an input `target`. - */ - init() { - var _this9 = this; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - _this9.gitUrl = yield Git.secureGitUrl(_this9.gitUrl, _this9.hash, _this9.reporter); - // check capabilities - if (yield Git.hasArchiveCapability(_this9.gitUrl)) { - _this9.supportsArchive = true; - } else { - yield _this9.fetch(); - } + hh[2] = ah2 = (c & 0xffff) | (d << 16); + hl[2] = al2 = (a & 0xffff) | (b << 16); - return yield _this9.setRefRemote(); - })(); - } + h = ah3; + l = al3; - setRefRemote() { - var _this10 = this; + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const stdout = yield (_child || _load_child()).spawn('git', ['ls-remote', '--tags', '--heads', _this10.gitUrl.repository]); - const refs = Git.parseRefs(stdout); - return yield _this10.setRef(refs); - })(); - } + h = hh[3]; + l = hl[3]; - /** - * TODO description - */ + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - setRef(refs) { - var _this11 = this; + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // get commit ref - const hash = _this11.hash; + hh[3] = ah3 = (c & 0xffff) | (d << 16); + hl[3] = al3 = (a & 0xffff) | (b << 16); + h = ah4; + l = al4; - const names = Object.keys(refs); + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - if (Git.isCommitHash(hash)) { - for (const name in refs) { - if (refs[name] === hash) { - _this11.ref = name; - return hash; - } - } + h = hh[4]; + l = hl[4]; - // `git archive` only accepts a treeish and we have no ref to this commit - _this11.supportsArchive = false; + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - if (!_this11.fetched) { - // in fact, `git archive` can't be used, and we haven't fetched the project yet. Do it now. - yield _this11.fetch(); - } - return _this11.ref = _this11.hash = hash; - } + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - const ref = yield _this11.findResolution(hash, names); - const commit = refs[ref]; - if (commit) { - _this11.ref = ref; - return _this11.hash = commit; - } else { - throw new (_errors || _load_errors()).MessageError(_this11.reporter.lang('couldntFindMatch', ref, names.join(','), _this11.gitUrl.repository)); - } - })(); - } + hh[4] = ah4 = (c & 0xffff) | (d << 16); + hl[4] = al4 = (a & 0xffff) | (b << 16); - /** - * Parse Git ref lines into hash of tag names to SHA hashes - */ + h = ah5; + l = al5; - static parseRefs(stdout) { - // store references - const refs = {}; + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - // line delimited - const refLines = stdout.split('\n'); + h = hh[5]; + l = hl[5]; - for (const line of refLines) { - const match = gitRefLineRegex.exec(line); + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; - if (match) { - var _match = (0, (_slicedToArray2 || _load_slicedToArray()).default)(match, 3); + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; - const sha = _match[1], - tagName = _match[2]; + hh[5] = ah5 = (c & 0xffff) | (d << 16); + hl[5] = al5 = (a & 0xffff) | (b << 16); - // As documented in gitrevisions: - // https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions - // "A suffix ^ followed by an empty brace pair means the object could be a tag, - // and dereference the tag recursively until a non-tag object is found." - // In other words, the hash without ^{} is the hash of the tag, - // and the hash with ^{} is the hash of the commit at which the tag was made. + h = ah6; + l = al6; - const name = (0, (_misc || _load_misc()).removeSuffix)(tagName, '^{}'); + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; - refs[name] = sha; - } - } + h = hh[6]; + l = hl[6]; - return refs; - } -} -exports.default = Git; + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; -/***/ }), -/* 121 */ -/***/ (function(module, exports, __webpack_require__) { + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; -"use strict"; + hh[6] = ah6 = (c & 0xffff) | (d << 16); + hl[6] = al6 = (a & 0xffff) | (b << 16); + h = ah7; + l = al7; -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.isValidLicense = isValidLicense; -exports.stringifyPerson = stringifyPerson; -exports.parsePerson = parsePerson; -exports.normalizePerson = normalizePerson; -exports.extractDescription = extractDescription; -exports.extractRepositoryUrl = extractRepositoryUrl; + a = l & 0xffff; b = l >>> 16; + c = h & 0xffff; d = h >>> 16; + h = hh[7]; + l = hl[7]; -const validateLicense = __webpack_require__(627); + a += l & 0xffff; b += l >>> 16; + c += h & 0xffff; d += h >>> 16; -function isValidLicense(license) { - return !!license && validateLicense(license).validForNewPackages; -} + b += a >>> 16; + c += b >>> 16; + d += c >>> 16; -function stringifyPerson(person) { - if (!person || typeof person !== 'object') { - return person; - } + hh[7] = ah7 = (c & 0xffff) | (d << 16); + hl[7] = al7 = (a & 0xffff) | (b << 16); - const parts = []; - if (person.name) { - parts.push(person.name); + pos += 128; + n -= 128; } - const email = person.email || person.mail; - if (typeof email === 'string') { - parts.push(`<${email}>`); - } + return n; +} - const url = person.url || person.web; - if (typeof url === 'string') { - parts.push(`(${url})`); - } +function crypto_hash(out, m, n) { + var hh = new Int32Array(8), + hl = new Int32Array(8), + x = new Uint8Array(256), + i, b = n; - return parts.join(' '); -} + hh[0] = 0x6a09e667; + hh[1] = 0xbb67ae85; + hh[2] = 0x3c6ef372; + hh[3] = 0xa54ff53a; + hh[4] = 0x510e527f; + hh[5] = 0x9b05688c; + hh[6] = 0x1f83d9ab; + hh[7] = 0x5be0cd19; -function parsePerson(person) { - if (typeof person !== 'string') { - return person; - } + hl[0] = 0xf3bcc908; + hl[1] = 0x84caa73b; + hl[2] = 0xfe94f82b; + hl[3] = 0x5f1d36f1; + hl[4] = 0xade682d1; + hl[5] = 0x2b3e6c1f; + hl[6] = 0xfb41bd6b; + hl[7] = 0x137e2179; - // format: name (url) - const obj = {}; + crypto_hashblocks_hl(hh, hl, m, n); + n %= 128; - let name = person.match(/^([^\(<]+)/); - if (name) { - name = name[0].trim(); - if (name) { - obj.name = name; - } - } + for (i = 0; i < n; i++) x[i] = m[b-n+i]; + x[n] = 128; - const email = person.match(/<([^>]+)>/); - if (email) { - obj.email = email[1]; - } + n = 256-128*(n<112?1:0); + x[n-9] = 0; + ts64(x, n-8, (b / 0x20000000) | 0, b << 3); + crypto_hashblocks_hl(hh, hl, x, n); - const url = person.match(/\(([^\)]+)\)/); - if (url) { - obj.url = url[1]; - } + for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]); - return obj; + return 0; } -function normalizePerson(person) { - return parsePerson(stringifyPerson(person)); -} +function add(p, q) { + var a = gf(), b = gf(), c = gf(), + d = gf(), e = gf(), f = gf(), + g = gf(), h = gf(), t = gf(); -function extractDescription(readme) { - if (typeof readme !== 'string' || readme === '') { - return undefined; - } + Z(a, p[1], p[0]); + Z(t, q[1], q[0]); + M(a, a, t); + A(b, p[0], p[1]); + A(t, q[0], q[1]); + M(b, b, t); + M(c, p[3], q[3]); + M(c, c, D2); + M(d, p[2], q[2]); + A(d, d, d); + Z(e, b, a); + Z(f, d, c); + A(g, d, c); + A(h, b, a); - // split into lines - const lines = readme.trim().split('\n').map(line => line.trim()); + M(p[0], e, f); + M(p[1], h, g); + M(p[2], g, f); + M(p[3], e, h); +} - // find the start of the first paragraph, ignore headings - let start = 0; - for (; start < lines.length; start++) { - const line = lines[start]; - if (line && line.match(/^(#|$)/)) { - // line isn't empty and isn't a heading so this is the start of a paragraph - start++; - break; - } +function cswap(p, q, b) { + var i; + for (i = 0; i < 4; i++) { + sel25519(p[i], q[i], b); } +} - // skip newlines from the header to the first line - while (start < lines.length && !lines[start]) { - start++; - } +function pack(r, p) { + var tx = gf(), ty = gf(), zi = gf(); + inv25519(zi, p[2]); + M(tx, p[0], zi); + M(ty, p[1], zi); + pack25519(r, ty); + r[31] ^= par25519(tx) << 7; +} - // continue to the first non empty line - let end = start; - while (end < lines.length && lines[end]) { - end++; +function scalarmult(p, q, s) { + var b, i; + set25519(p[0], gf0); + set25519(p[1], gf1); + set25519(p[2], gf1); + set25519(p[3], gf0); + for (i = 255; i >= 0; --i) { + b = (s[(i/8)|0] >> (i&7)) & 1; + cswap(p, q, b); + add(q, p); + add(p, p); + cswap(p, q, b); } - - return lines.slice(start, end).join(' '); } -function extractRepositoryUrl(repository) { - if (!repository || typeof repository !== 'object') { - return repository; - } - return repository.url; +function scalarbase(p, s) { + var q = [gf(), gf(), gf(), gf()]; + set25519(q[0], X); + set25519(q[1], Y); + set25519(q[2], gf1); + M(q[3], X, Y); + scalarmult(p, q, s); } -/***/ }), -/* 122 */ -/***/ (function(module, exports, __webpack_require__) { +function crypto_sign_keypair(pk, sk, seeded) { + var d = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()]; + var i; -"use strict"; + if (!seeded) randombytes(sk, 32); + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; + scalarbase(p, d); + pack(pk, p); -Object.defineProperty(exports, "__esModule", { - value: true -}); + for (i = 0; i < 32; i++) sk[i+32] = pk[i]; + return 0; +} -var _rootUser; +var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); -function _load_rootUser() { - return _rootUser = _interopRequireDefault(__webpack_require__(381)); +function modL(r, x) { + var carry, i, j, k; + for (i = 63; i >= 32; --i) { + carry = 0; + for (j = i - 32, k = i - 12; j < k; ++j) { + x[j] += carry - 16 * x[i] * L[j - (i - 32)]; + carry = (x[j] + 128) >> 8; + x[j] -= carry * 256; + } + x[j] += carry; + x[i] = 0; + } + carry = 0; + for (j = 0; j < 32; j++) { + x[j] += carry - (x[31] >> 4) * L[j]; + carry = x[j] >> 8; + x[j] &= 255; + } + for (j = 0; j < 32; j++) x[j] -= carry * L[j]; + for (i = 0; i < 32; i++) { + x[i+1] += x[i] >> 8; + r[i] = x[i] & 255; + } } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -const path = __webpack_require__(1); +function reduce(r) { + var x = new Float64Array(64), i; + for (i = 0; i < 64; i++) x[i] = r[i]; + for (i = 0; i < 64; i++) r[i] = 0; + modL(r, x); +} -const userHomeDir = process.platform === 'linux' && (_rootUser || _load_rootUser()).default ? path.resolve('/usr/local/share') : __webpack_require__(107).homedir(); +// Note: difference from C - smlen returned, not passed as argument. +function crypto_sign(sm, m, n, sk) { + var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); + var i, j, x = new Float64Array(64); + var p = [gf(), gf(), gf(), gf()]; -exports.default = userHomeDir; + crypto_hash(d, sk, 32); + d[0] &= 248; + d[31] &= 127; + d[31] |= 64; -/***/ }), -/* 123 */ -/***/ (function(module, exports, __webpack_require__) { + var smlen = n + 64; + for (i = 0; i < n; i++) sm[64 + i] = m[i]; + for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; -"use strict"; + crypto_hash(r, sm.subarray(32), n+32); + reduce(r); + scalarbase(p, r); + pack(sm, p); + for (i = 32; i < 64; i++) sm[i] = sk[i]; + crypto_hash(h, sm, n + 64); + reduce(h); -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.explodeHashedUrl = explodeHashedUrl; -function explodeHashedUrl(url) { - const parts = url.split('#'); + for (i = 0; i < 64; i++) x[i] = 0; + for (i = 0; i < 32; i++) x[i] = r[i]; + for (i = 0; i < 32; i++) { + for (j = 0; j < 32; j++) { + x[i+j] += h[i] * d[j]; + } + } - return { - url: parts[0], - hash: parts[1] || '' - }; + modL(sm.subarray(32), x); + return smlen; } -/***/ }), -/* 124 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -exports.__esModule = true; - -var _from = __webpack_require__(384); +function unpackneg(r, p) { + var t = gf(), chk = gf(), num = gf(), + den = gf(), den2 = gf(), den4 = gf(), + den6 = gf(); -var _from2 = _interopRequireDefault(_from); + set25519(r[2], gf1); + unpack25519(r[1], p); + S(num, r[1]); + M(den, num, D); + Z(num, num, r[2]); + A(den, r[2], den); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + S(den2, den); + S(den4, den2); + M(den6, den4, den2); + M(t, den6, num); + M(t, t, den); -exports.default = function (arr) { - return Array.isArray(arr) ? arr : (0, _from2.default)(arr); -}; + pow2523(t, t); + M(t, t, num); + M(t, t, den); + M(t, t, den); + M(r[0], t, den); -/***/ }), -/* 125 */ -/***/ (function(module, exports, __webpack_require__) { + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) M(r[0], r[0], I); -"use strict"; + S(chk, r[0]); + M(chk, chk, den); + if (neq25519(chk, num)) return -1; + if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); -var buffer = __webpack_require__(55); -var Buffer = buffer.Buffer; -var SlowBuffer = buffer.SlowBuffer; -var MAX_LEN = buffer.kMaxLength || 2147483647; -exports.alloc = function alloc(size, fill, encoding) { - if (typeof Buffer.alloc === 'function') { - return Buffer.alloc(size, fill, encoding); - } - if (typeof encoding === 'number') { - throw new TypeError('encoding must not be number'); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size > MAX_LEN) { - throw new RangeError('size is too large'); - } - var enc = encoding; - var _fill = fill; - if (_fill === undefined) { - enc = undefined; - _fill = 0; - } - var buf = new Buffer(size); - if (typeof _fill === 'string') { - var fillBuf = new Buffer(_fill, enc); - var flen = fillBuf.length; - var i = -1; - while (++i < size) { - buf[i] = fillBuf[i % flen]; - } - } else { - buf.fill(_fill); - } - return buf; -} -exports.allocUnsafe = function allocUnsafe(size) { - if (typeof Buffer.allocUnsafe === 'function') { - return Buffer.allocUnsafe(size); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size > MAX_LEN) { - throw new RangeError('size is too large'); - } - return new Buffer(size); + M(r[3], r[0], r[1]); + return 0; } -exports.from = function from(value, encodingOrOffset, length) { - if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { - return Buffer.from(value, encodingOrOffset, length); - } - if (typeof value === 'number') { - throw new TypeError('"value" argument must not be a number'); - } - if (typeof value === 'string') { - return new Buffer(value, encodingOrOffset); - } - if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { - var offset = encodingOrOffset; - if (arguments.length === 1) { - return new Buffer(value); - } - if (typeof offset === 'undefined') { - offset = 0; - } - var len = length; - if (typeof len === 'undefined') { - len = value.byteLength - offset; - } - if (offset >= value.byteLength) { - throw new RangeError('\'offset\' is out of bounds'); - } - if (len > value.byteLength - offset) { - throw new RangeError('\'length\' is out of bounds'); - } - return new Buffer(value.slice(offset, offset + len)); - } - if (Buffer.isBuffer(value)) { - var out = new Buffer(value.length); - value.copy(out, 0, 0, value.length); - return out; - } - if (value) { - if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { - return new Buffer(value); - } - if (value.type === 'Buffer' && Array.isArray(value.data)) { - return new Buffer(value.data); - } - } - throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); -} -exports.allocUnsafeSlow = function allocUnsafeSlow(size) { - if (typeof Buffer.allocUnsafeSlow === 'function') { - return Buffer.allocUnsafeSlow(size); - } - if (typeof size !== 'number') { - throw new TypeError('size must be a number'); - } - if (size >= MAX_LEN) { - throw new RangeError('size is too large'); - } - return new SlowBuffer(size); -} +function crypto_sign_open(m, sm, n, pk) { + var i, mlen; + var t = new Uint8Array(32), h = new Uint8Array(64); + var p = [gf(), gf(), gf(), gf()], + q = [gf(), gf(), gf(), gf()]; + mlen = -1; + if (n < 64) return -1; -/***/ }), -/* 126 */ -/***/ (function(module, exports) { + if (unpackneg(q, pk)) return -1; -function Caseless (dict) { - this.dict = dict || {} -} -Caseless.prototype.set = function (name, value, clobber) { - if (typeof name === 'object') { - for (var i in name) { - this.set(i, name[i], value) - } - } else { - if (typeof clobber === 'undefined') clobber = true - var has = this.has(name) + for (i = 0; i < n; i++) m[i] = sm[i]; + for (i = 0; i < 32; i++) m[i+32] = pk[i]; + crypto_hash(h, m, n); + reduce(h); + scalarmult(p, q, h); - if (!clobber && has) this.dict[has] = this.dict[has] + ',' + value - else this.dict[has || name] = value - return has - } -} -Caseless.prototype.has = function (name) { - var keys = Object.keys(this.dict) - , name = name.toLowerCase() - ; - for (var i=0;i 0 ? floor : ceil)(it); +nacl.secretbox.open = function(box, nonce, key) { + checkArrayTypes(box, nonce, key); + checkLengths(key, nonce); + var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); + var m = new Uint8Array(c.length); + for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; + if (c.length < 32) return false; + if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; + return m.subarray(crypto_secretbox_ZEROBYTES); }; -/***/ }), -/* 136 */ -/***/ (function(module, exports, __webpack_require__) { +nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; +nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; +nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; -// to indexed object, toObject with fallback for non-array-like ES3 strings -var IObject = __webpack_require__(214) - , defined = __webpack_require__(129); -module.exports = function(it){ - return IObject(defined(it)); +nacl.scalarMult = function(n, p) { + checkArrayTypes(n, p); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult(q, n, p); + return q; }; -/***/ }), -/* 137 */ -/***/ (function(module, exports, __webpack_require__) { - -// 7.1.15 ToLength -var toInteger = __webpack_require__(135) - , min = Math.min; -module.exports = function(it){ - return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +nacl.scalarMult.base = function(n) { + checkArrayTypes(n); + if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); + var q = new Uint8Array(crypto_scalarmult_BYTES); + crypto_scalarmult_base(q, n); + return q; }; -/***/ }), -/* 138 */ -/***/ (function(module, exports, __webpack_require__) { +nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; +nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; -// 7.1.13 ToObject(argument) -var defined = __webpack_require__(129); -module.exports = function(it){ - return Object(defined(it)); +nacl.box = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox(msg, nonce, k); }; -/***/ }), -/* 139 */ -/***/ (function(module, exports, __webpack_require__) { - -var classof = __webpack_require__(128) - , ITERATOR = __webpack_require__(25)('iterator') - , Iterators = __webpack_require__(54); -module.exports = __webpack_require__(31).getIteratorMethod = function(it){ - if(it != undefined)return it[ITERATOR] - || it['@@iterator'] - || Iterators[classof(it)]; +nacl.box.before = function(publicKey, secretKey) { + checkArrayTypes(publicKey, secretKey); + checkBoxLengths(publicKey, secretKey); + var k = new Uint8Array(crypto_box_BEFORENMBYTES); + crypto_box_beforenm(k, publicKey, secretKey); + return k; }; -/***/ }), -/* 140 */ -/***/ (function(module, exports, __webpack_require__) { - -__webpack_require__(435); -var global = __webpack_require__(28) - , hide = __webpack_require__(53) - , Iterators = __webpack_require__(54) - , TO_STRING_TAG = __webpack_require__(25)('toStringTag'); +nacl.box.after = nacl.secretbox; -for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ - var NAME = collections[i] - , Collection = global[NAME] - , proto = Collection && Collection.prototype; - if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); - Iterators[NAME] = Iterators.Array; -} +nacl.box.open = function(msg, nonce, publicKey, secretKey) { + var k = nacl.box.before(publicKey, secretKey); + return nacl.secretbox.open(msg, nonce, k); +}; -/***/ }), -/* 141 */ -/***/ (function(module, exports, __webpack_require__) { +nacl.box.open.after = nacl.secretbox.open; -// Basic Javascript Elliptic Curve implementation -// Ported loosely from BouncyCastle's Java EC code -// Only Fp curves implemented for now +nacl.box.keyPair = function() { + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); + crypto_box_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; -// Requires jsbn.js and jsbn2.js -var BigInteger = __webpack_require__(45).BigInteger -var Barrett = BigInteger.prototype.Barrett +nacl.box.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_box_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); + crypto_scalarmult_base(pk, secretKey); + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; -// ---------------- -// ECFieldElementFp +nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; +nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; +nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; +nacl.box.nonceLength = crypto_box_NONCEBYTES; +nacl.box.overheadLength = nacl.secretbox.overheadLength; -// constructor -function ECFieldElementFp(q,x) { - this.x = x; - // TODO if(x.compareTo(q) >= 0) error - this.q = q; -} +nacl.sign = function(msg, secretKey) { + checkArrayTypes(msg, secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); + crypto_sign(signedMsg, msg, msg.length, secretKey); + return signedMsg; +}; -function feFpEquals(other) { - if(other == this) return true; - return (this.q.equals(other.q) && this.x.equals(other.x)); -} +nacl.sign.open = function(signedMsg, publicKey) { + if (arguments.length !== 2) + throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); + checkArrayTypes(signedMsg, publicKey); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var tmp = new Uint8Array(signedMsg.length); + var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); + if (mlen < 0) return null; + var m = new Uint8Array(mlen); + for (var i = 0; i < m.length; i++) m[i] = tmp[i]; + return m; +}; -function feFpToBigInteger() { - return this.x; -} +nacl.sign.detached = function(msg, secretKey) { + var signedMsg = nacl.sign(msg, secretKey); + var sig = new Uint8Array(crypto_sign_BYTES); + for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; + return sig; +}; -function feFpNegate() { - return new ECFieldElementFp(this.q, this.x.negate().mod(this.q)); -} +nacl.sign.detached.verify = function(msg, sig, publicKey) { + checkArrayTypes(msg, sig, publicKey); + if (sig.length !== crypto_sign_BYTES) + throw new Error('bad signature size'); + if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) + throw new Error('bad public key size'); + var sm = new Uint8Array(crypto_sign_BYTES + msg.length); + var m = new Uint8Array(crypto_sign_BYTES + msg.length); + var i; + for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; + for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; + return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); +}; -function feFpAdd(b) { - return new ECFieldElementFp(this.q, this.x.add(b.toBigInteger()).mod(this.q)); -} +nacl.sign.keyPair = function() { + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + crypto_sign_keypair(pk, sk); + return {publicKey: pk, secretKey: sk}; +}; -function feFpSubtract(b) { - return new ECFieldElementFp(this.q, this.x.subtract(b.toBigInteger()).mod(this.q)); -} +nacl.sign.keyPair.fromSecretKey = function(secretKey) { + checkArrayTypes(secretKey); + if (secretKey.length !== crypto_sign_SECRETKEYBYTES) + throw new Error('bad secret key size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; + return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +}; -function feFpMultiply(b) { - return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger()).mod(this.q)); -} +nacl.sign.keyPair.fromSeed = function(seed) { + checkArrayTypes(seed); + if (seed.length !== crypto_sign_SEEDBYTES) + throw new Error('bad seed size'); + var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); + var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); + for (var i = 0; i < 32; i++) sk[i] = seed[i]; + crypto_sign_keypair(pk, sk, true); + return {publicKey: pk, secretKey: sk}; +}; -function feFpSquare() { - return new ECFieldElementFp(this.q, this.x.square().mod(this.q)); -} +nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; +nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; +nacl.sign.seedLength = crypto_sign_SEEDBYTES; +nacl.sign.signatureLength = crypto_sign_BYTES; -function feFpDivide(b) { - return new ECFieldElementFp(this.q, this.x.multiply(b.toBigInteger().modInverse(this.q)).mod(this.q)); -} +nacl.hash = function(msg) { + checkArrayTypes(msg); + var h = new Uint8Array(crypto_hash_BYTES); + crypto_hash(h, msg, msg.length); + return h; +}; -ECFieldElementFp.prototype.equals = feFpEquals; -ECFieldElementFp.prototype.toBigInteger = feFpToBigInteger; -ECFieldElementFp.prototype.negate = feFpNegate; -ECFieldElementFp.prototype.add = feFpAdd; -ECFieldElementFp.prototype.subtract = feFpSubtract; -ECFieldElementFp.prototype.multiply = feFpMultiply; -ECFieldElementFp.prototype.square = feFpSquare; -ECFieldElementFp.prototype.divide = feFpDivide; +nacl.hash.hashLength = crypto_hash_BYTES; -// ---------------- -// ECPointFp +nacl.verify = function(x, y) { + checkArrayTypes(x, y); + // Zero length arguments are considered not equal. + if (x.length === 0 || y.length === 0) return false; + if (x.length !== y.length) return false; + return (vn(x, 0, y, 0, x.length) === 0) ? true : false; +}; -// constructor -function ECPointFp(curve,x,y,z) { - this.curve = curve; - this.x = x; - this.y = y; - // Projective coordinates: either zinv == null or z * zinv == 1 - // z and zinv are just BigIntegers, not fieldElements - if(z == null) { - this.z = BigInteger.ONE; - } - else { - this.z = z; - } - this.zinv = null; - //TODO: compression flag -} +nacl.setPRNG = function(fn) { + randombytes = fn; +}; -function pointFpGetX() { - if(this.zinv == null) { - this.zinv = this.z.modInverse(this.curve.q); +(function() { + // Initialize PRNG if environment provides CSPRNG. + // If not, methods calling randombytes will throw. + var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; + if (crypto && crypto.getRandomValues) { + // Browsers. + var QUOTA = 65536; + nacl.setPRNG(function(x, n) { + var i, v = new Uint8Array(n); + for (i = 0; i < n; i += QUOTA) { + crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); + } + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); + } else if (true) { + // Node.js. + crypto = __webpack_require__(7); + if (crypto && crypto.randomBytes) { + nacl.setPRNG(function(x, n) { + var i, v = crypto.randomBytes(n); + for (i = 0; i < n; i++) x[i] = v[i]; + cleanup(v); + }); } - var r = this.x.toBigInteger().multiply(this.zinv); - this.curve.reduce(r); - return this.curve.fromBigInteger(r); -} + } +})(); -function pointFpGetY() { - if(this.zinv == null) { - this.zinv = this.z.modInverse(this.curve.q); - } - var r = this.y.toBigInteger().multiply(this.zinv); - this.curve.reduce(r); - return this.curve.fromBigInteger(r); -} +})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); -function pointFpEquals(other) { - if(other == this) return true; - if(this.isInfinity()) return other.isInfinity(); - if(other.isInfinity()) return this.isInfinity(); - var u, v; - // u = Y2 * Z1 - Y1 * Z2 - u = other.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(other.z)).mod(this.curve.q); - if(!u.equals(BigInteger.ZERO)) return false; - // v = X2 * Z1 - X1 * Z2 - v = other.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(other.z)).mod(this.curve.q); - return v.equals(BigInteger.ZERO); -} -function pointFpIsInfinity() { - if((this.x == null) && (this.y == null)) return true; - return this.z.equals(BigInteger.ZERO) && !this.y.toBigInteger().equals(BigInteger.ZERO); -} +/***/ }), +/* 111 */ +/***/ (function(module, exports) { -function pointFpNegate() { - return new ECPointFp(this.curve, this.x, this.y.negate(), this.z); -} +module.exports = require("child_process"); -function pointFpAdd(b) { - if(this.isInfinity()) return b; - if(b.isInfinity()) return this; +/***/ }), +/* 112 */ +/***/ (function(module, exports) { - // u = Y2 * Z1 - Y1 * Z2 - var u = b.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(b.z)).mod(this.curve.q); - // v = X2 * Z1 - X1 * Z2 - var v = b.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(b.z)).mod(this.curve.q); +module.exports = require("https"); - if(BigInteger.ZERO.equals(v)) { - if(BigInteger.ZERO.equals(u)) { - return this.twice(); // this == b, so double - } - return this.curve.getInfinity(); // this = -b, so infinity - } +/***/ }), +/* 113 */ +/***/ (function(module, exports) { - var THREE = new BigInteger("3"); - var x1 = this.x.toBigInteger(); - var y1 = this.y.toBigInteger(); - var x2 = b.x.toBigInteger(); - var y2 = b.y.toBigInteger(); +module.exports = require("os"); - var v2 = v.square(); - var v3 = v2.multiply(v); - var x1v2 = x1.multiply(v2); - var zu2 = u.square().multiply(this.z); +/***/ }), +/* 114 */ +/***/ (function(module, exports) { - // x3 = v * (z2 * (z1 * u^2 - 2 * x1 * v^2) - v^3) - var x3 = zu2.subtract(x1v2.shiftLeft(1)).multiply(b.z).subtract(v3).multiply(v).mod(this.curve.q); - // y3 = z2 * (3 * x1 * u * v^2 - y1 * v^3 - z1 * u^3) + u * v^3 - var y3 = x1v2.multiply(THREE).multiply(u).subtract(y1.multiply(v3)).subtract(zu2.multiply(u)).multiply(b.z).add(u.multiply(v3)).mod(this.curve.q); - // z3 = v^3 * z1 * z2 - var z3 = v3.multiply(this.z).multiply(b.z).mod(this.curve.q); +module.exports = require("querystring"); - return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3); -} +/***/ }), +/* 115 */ +/***/ (function(module, exports) { -function pointFpTwice() { - if(this.isInfinity()) return this; - if(this.y.toBigInteger().signum() == 0) return this.curve.getInfinity(); +module.exports = require("readline"); - // TODO: optimized handling of constants - var THREE = new BigInteger("3"); - var x1 = this.x.toBigInteger(); - var y1 = this.y.toBigInteger(); +/***/ }), +/* 116 */ +/***/ (function(module, exports) { - var y1z1 = y1.multiply(this.z); - var y1sqz1 = y1z1.multiply(y1).mod(this.curve.q); - var a = this.curve.a.toBigInteger(); +module.exports = require("tty"); - // w = 3 * x1^2 + a * z1^2 - var w = x1.square().multiply(THREE); - if(!BigInteger.ZERO.equals(a)) { - w = w.add(this.z.square().multiply(a)); - } - w = w.mod(this.curve.q); - //this.curve.reduce(w); - // x3 = 2 * y1 * z1 * (w^2 - 8 * x1 * y1^2 * z1) - var x3 = w.square().subtract(x1.shiftLeft(3).multiply(y1sqz1)).shiftLeft(1).multiply(y1z1).mod(this.curve.q); - // y3 = 4 * y1^2 * z1 * (3 * w * x1 - 2 * y1^2 * z1) - w^3 - var y3 = w.multiply(THREE).multiply(x1).subtract(y1sqz1.shiftLeft(1)).shiftLeft(2).multiply(y1sqz1).subtract(w.square().multiply(w)).mod(this.curve.q); - // z3 = 8 * (y1 * z1)^3 - var z3 = y1z1.square().multiply(y1z1).shiftLeft(3).mod(this.curve.q); +/***/ }), +/* 117 */ +/***/ (function(module, exports) { - return new ECPointFp(this.curve, this.curve.fromBigInteger(x3), this.curve.fromBigInteger(y3), z3); -} +// Copyright 2011 Mark Cavage All rights reserved. -// Simple NAF (Non-Adjacent Form) multiplication algorithm -// TODO: modularize the multiplication algorithm -function pointFpMultiply(k) { - if(this.isInfinity()) return this; - if(k.signum() == 0) return this.curve.getInfinity(); - var e = k; - var h = e.multiply(new BigInteger("3")); +module.exports = { - var neg = this.negate(); - var R = this; + newInvalidAsn1Error: function(msg) { + var e = new Error(); + e.name = 'InvalidAsn1Error'; + e.message = msg || ''; + return e; + } - var i; - for(i = h.bitLength() - 2; i > 0; --i) { - R = R.twice(); +}; - var hBit = h.testBit(i); - var eBit = e.testBit(i); - if (hBit != eBit) { - R = R.add(hBit ? this : neg); - } - } +/***/ }), +/* 118 */ +/***/ (function(module, exports) { - return R; -} +// Copyright 2011 Mark Cavage All rights reserved. -// Compute this*j + x*k (simultaneous multiplication) -function pointFpMultiplyTwo(j,x,k) { - var i; - if(j.bitLength() > k.bitLength()) - i = j.bitLength() - 1; - else - i = k.bitLength() - 1; - var R = this.curve.getInfinity(); - var both = this.add(x); - while(i >= 0) { - R = R.twice(); - if(j.testBit(i)) { - if(k.testBit(i)) { - R = R.add(both); - } - else { - R = R.add(this); - } - } - else { - if(k.testBit(i)) { - R = R.add(x); - } - } - --i; - } +module.exports = { + EOC: 0, + Boolean: 1, + Integer: 2, + BitString: 3, + OctetString: 4, + Null: 5, + OID: 6, + ObjectDescriptor: 7, + External: 8, + Real: 9, // float + Enumeration: 10, + PDV: 11, + Utf8String: 12, + RelativeOID: 13, + Sequence: 16, + Set: 17, + NumericString: 18, + PrintableString: 19, + T61String: 20, + VideotexString: 21, + IA5String: 22, + UTCTime: 23, + GeneralizedTime: 24, + GraphicString: 25, + VisibleString: 26, + GeneralString: 28, + UniversalString: 29, + CharacterString: 30, + BMPString: 31, + Constructor: 32, + Context: 128 +}; - return R; -} -ECPointFp.prototype.getX = pointFpGetX; -ECPointFp.prototype.getY = pointFpGetY; -ECPointFp.prototype.equals = pointFpEquals; -ECPointFp.prototype.isInfinity = pointFpIsInfinity; -ECPointFp.prototype.negate = pointFpNegate; -ECPointFp.prototype.add = pointFpAdd; -ECPointFp.prototype.twice = pointFpTwice; -ECPointFp.prototype.multiply = pointFpMultiply; -ECPointFp.prototype.multiplyTwo = pointFpMultiplyTwo; +/***/ }), +/* 119 */ +/***/ (function(module, exports, __webpack_require__) { -// ---------------- -// ECCurveFp +"use strict"; -// constructor -function ECCurveFp(q,a,b) { - this.q = q; - this.a = this.fromBigInteger(a); - this.b = this.fromBigInteger(b); - this.infinity = new ECPointFp(this, null, null); - this.reducer = new Barrett(this.q); -} -function curveFpGetQ() { - return this.q; -} +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.integrityErrors = undefined; -function curveFpGetA() { - return this.a; -} +var _asyncToGenerator2; -function curveFpGetB() { - return this.b; +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); } -function curveFpEquals(other) { - if(other == this) return true; - return(this.q.equals(other.q) && this.a.equals(other.a) && this.b.equals(other.b)); -} +var _constants; -function curveFpGetInfinity() { - return this.infinity; +function _load_constants() { + return _constants = _interopRequireWildcard(__webpack_require__(8)); } -function curveFpFromBigInteger(x) { - return new ECFieldElementFp(this.q, x); -} +var _index; -function curveReduce(x) { - this.reducer.reduce(x); +function _load_index() { + return _index = __webpack_require__(23); } -// for now, work with hex strings because they're easier in JS -function curveFpDecodePointHex(s) { - switch(parseInt(s.substr(0,2), 16)) { // first byte - case 0: - return this.infinity; - case 2: - case 3: - // point compression not supported yet - return null; - case 4: - case 6: - case 7: - var len = (s.length - 2) / 2; - var xHex = s.substr(2, len); - var yHex = s.substr(len+2, len); - - return new ECPointFp(this, - this.fromBigInteger(new BigInteger(xHex, 16)), - this.fromBigInteger(new BigInteger(yHex, 16))); +var _fs; - default: // unsupported - return null; - } +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); } -function curveFpEncodePointHex(p) { - if (p.isInfinity()) return "00"; - var xHex = p.getX().toBigInteger().toString(16); - var yHex = p.getY().toBigInteger().toString(16); - var oLen = this.getQ().toString(16).length; - if ((oLen % 2) != 0) oLen++; - while (xHex.length < oLen) { - xHex = "0" + xHex; - } - while (yHex.length < oLen) { - yHex = "0" + yHex; - } - return "04" + xHex + yHex; +var _misc; + +function _load_misc() { + return _misc = __webpack_require__(10); } -ECCurveFp.prototype.getQ = curveFpGetQ; -ECCurveFp.prototype.getA = curveFpGetA; -ECCurveFp.prototype.getB = curveFpGetB; -ECCurveFp.prototype.equals = curveFpEquals; -ECCurveFp.prototype.getInfinity = curveFpGetInfinity; -ECCurveFp.prototype.fromBigInteger = curveFpFromBigInteger; -ECCurveFp.prototype.reduce = curveReduce; -//ECCurveFp.prototype.decodePointHex = curveFpDecodePointHex; -ECCurveFp.prototype.encodePointHex = curveFpEncodePointHex; +var _workspaceLayout; -// from: https://github.com/kaielvin/jsbn-ec-point-compression -ECCurveFp.prototype.decodePointHex = function(s) -{ - var yIsEven; - switch(parseInt(s.substr(0,2), 16)) { // first byte - case 0: - return this.infinity; - case 2: - yIsEven = false; - case 3: - if(yIsEven == undefined) yIsEven = true; - var len = s.length - 2; - var xHex = s.substr(2, len); - var x = this.fromBigInteger(new BigInteger(xHex,16)); - var alpha = x.multiply(x.square().add(this.getA())).add(this.getB()); - var beta = alpha.sqrt(); +function _load_workspaceLayout() { + return _workspaceLayout = _interopRequireDefault(__webpack_require__(66)); +} - if (beta == null) throw "Invalid point compression"; +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; } } - var betaValue = beta.toBigInteger(); - if (betaValue.testBit(0) != yIsEven) - { - // Use the other root - beta = this.fromBigInteger(this.getQ().subtract(betaValue)); - } - return new ECPointFp(this,x,beta); - case 4: - case 6: - case 7: - var len = (s.length - 2) / 2; - var xHex = s.substr(2, len); - var yHex = s.substr(len+2, len); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - return new ECPointFp(this, - this.fromBigInteger(new BigInteger(xHex, 16)), - this.fromBigInteger(new BigInteger(yHex, 16))); +const invariant = __webpack_require__(5); +const path = __webpack_require__(1); - default: // unsupported - return null; - } -} -ECCurveFp.prototype.encodeCompressedPointHex = function(p) -{ - if (p.isInfinity()) return "00"; - var xHex = p.getX().toBigInteger().toString(16); - var oLen = this.getQ().toString(16).length; - if ((oLen % 2) != 0) oLen++; - while (xHex.length < oLen) - xHex = "0" + xHex; - var yPrefix; - if(p.getY().toBigInteger().isEven()) yPrefix = "02"; - else yPrefix = "03"; +const integrityErrors = exports.integrityErrors = { + EXPECTED_IS_NOT_A_JSON: 'integrityFailedExpectedIsNotAJSON', + FILES_MISSING: 'integrityFailedFilesMissing', + LOCKFILE_DONT_MATCH: 'integrityLockfilesDontMatch', + FLAGS_DONT_MATCH: 'integrityFlagsDontMatch', + LINKED_MODULES_DONT_MATCH: 'integrityCheckLinkedModulesDontMatch' +}; - return yPrefix + xHex; -} +/** + * + */ +class InstallationIntegrityChecker { + constructor(config) { + this.config = config; + } + _getModuleLocation(usedRegistries) { + var _this = this; -ECFieldElementFp.prototype.getR = function() -{ - if(this.r != undefined) return this.r; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // build up possible folders + let registries = (_index || _load_index()).registryNames; + if (usedRegistries && usedRegistries.size > 0) { + registries = usedRegistries; + } + const possibleFolders = []; + if (_this.config.modulesFolder) { + possibleFolders.push(_this.config.modulesFolder); + } - this.r = null; - var bitLength = this.q.bitLength(); - if (bitLength > 128) - { - var firstWord = this.q.shiftRight(bitLength - 64); - if (firstWord.intValue() == -1) - { - this.r = BigInteger.ONE.shiftLeft(bitLength).subtract(this.q); - } - } - return this.r; -} -ECFieldElementFp.prototype.modMult = function(x1,x2) -{ - return this.modReduce(x1.multiply(x2)); -} -ECFieldElementFp.prototype.modReduce = function(x) -{ - if (this.getR() != null) - { - var qLen = q.bitLength(); - while (x.bitLength() > (qLen + 1)) - { - var u = x.shiftRight(qLen); - var v = x.subtract(u.shiftLeft(qLen)); - if (!this.getR().equals(BigInteger.ONE)) - { - u = u.multiply(this.getR()); - } - x = u.add(v); - } - while (x.compareTo(q) >= 0) - { - x = x.subtract(q); + // ensure we only write to a registry folder that was used + for (const name of registries) { + const loc = path.join(_this.config.cwd, _this.config.registries[name].folder); + possibleFolders.push(loc); + } + + // if we already have an integrity hash in one of these folders then use it's location otherwise use the + // first folder + let loc; + for (const possibleLoc of possibleFolders) { + if (yield (_fs || _load_fs()).exists(path.join(possibleLoc, (_constants || _load_constants()).INTEGRITY_FILENAME))) { + loc = possibleLoc; + break; } - } - else - { - x = x.mod(q); - } - return x; -} -ECFieldElementFp.prototype.sqrt = function() -{ - if (!this.q.testBit(0)) throw "unsupported"; + } - // p mod 4 == 3 - if (this.q.testBit(1)) - { - var z = new ECFieldElementFp(this.q,this.x.modPow(this.q.shiftRight(2).add(BigInteger.ONE),this.q)); - return z.square().equals(this) ? z : null; - } + return loc || possibleFolders[0]; + })(); + } - // p mod 4 == 1 - var qMinusOne = this.q.subtract(BigInteger.ONE); + /** + * Get the location of an existing integrity hash. If none exists then return the location where we should + * write a new one. + */ - var legendreExponent = qMinusOne.shiftRight(1); - if (!(this.x.modPow(legendreExponent, this.q).equals(BigInteger.ONE))) - { - return null; - } + _getIntegrityHashLocation(usedRegistries) { + var _this2 = this; - var u = qMinusOne.shiftRight(2); - var k = u.shiftLeft(1).add(BigInteger.ONE); + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + let locationFolder; - var Q = this.x; - var fourQ = modDouble(modDouble(Q)); + if (_this2.config.enableMetaFolder) { + locationFolder = path.join(_this2.config.lockfileFolder, (_constants || _load_constants()).META_FOLDER); + } else { + locationFolder = yield _this2._getModuleLocation(usedRegistries); + } - var U, V; - do - { - var P; - do - { - P = new BigInteger(this.q.bitLength(), new SecureRandom()); - } - while (P.compareTo(this.q) >= 0 - || !(P.multiply(P).subtract(fourQ).modPow(legendreExponent, this.q).equals(qMinusOne))); + const locationPath = path.join(locationFolder, (_constants || _load_constants()).INTEGRITY_FILENAME); + const exists = yield (_fs || _load_fs()).exists(locationPath); - var result = this.lucasSequence(P, Q, k); - U = result[0]; - V = result[1]; + return { + locationFolder, + locationPath, + exists + }; + })(); + } - if (this.modMult(V, V).equals(fourQ)) - { - // Integer division by 2, mod q - if (V.testBit(0)) - { - V = V.add(q); - } + /** + * returns a list of files recursively in a directory sorted + */ + _getFilesDeep(rootDir) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + let getFilePaths = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (rootDir, files) { + let currentDir = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : rootDir; - V = V.shiftRight(1); + for (const file of yield (_fs || _load_fs()).readdir(currentDir)) { + const entry = path.join(currentDir, file); + const stat = yield (_fs || _load_fs()).stat(entry); + if (stat.isDirectory()) { + yield getFilePaths(rootDir, files, entry); + } else { + files.push(path.relative(rootDir, entry)); + } + } + }); - return new ECFieldElementFp(q,V); - } - } - while (U.equals(BigInteger.ONE) || U.equals(qMinusOne)); + return function getFilePaths(_x, _x2) { + return _ref.apply(this, arguments); + }; + })(); - return null; -} -ECFieldElementFp.prototype.lucasSequence = function(P,Q,k) -{ - var n = k.bitLength(); - var s = k.getLowestSetBit(); + const result = []; + yield getFilePaths(rootDir, result); + return result; + })(); + } - var Uh = BigInteger.ONE; - var Vl = BigInteger.TWO; - var Vh = P; - var Ql = BigInteger.ONE; - var Qh = BigInteger.ONE; + /** + * Generate integrity hash of input lockfile. + */ - for (var j = n - 1; j >= s + 1; --j) - { - Ql = this.modMult(Ql, Qh); + _generateIntegrityFile(lockfile, patterns, flags, modulesFolder, artifacts) { + var _this3 = this; - if (k.testBit(j)) - { - Qh = this.modMult(Ql, Q); - Uh = this.modMult(Uh, Vh); - Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); - Vh = this.modReduce(Vh.multiply(Vh).subtract(Qh.shiftLeft(1))); - } - else - { - Qh = Ql; - Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql)); - Vh = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); - Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1))); - } - } + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const result = { + flags: [], + linkedModules: [], + topLevelPatters: [], + lockfileEntries: {}, + files: [], + artifacts + }; - Ql = this.modMult(Ql, Qh); - Qh = this.modMult(Ql, Q); - Uh = this.modReduce(Uh.multiply(Vl).subtract(Ql)); - Vl = this.modReduce(Vh.multiply(Vl).subtract(P.multiply(Ql))); - Ql = this.modMult(Ql, Qh); + result.topLevelPatters = patterns.sort((_misc || _load_misc()).sortAlpha); - for (var j = 1; j <= s; ++j) - { - Uh = this.modMult(Uh, Vl); - Vl = this.modReduce(Vl.multiply(Vl).subtract(Ql.shiftLeft(1))); - Ql = this.modMult(Ql, Ql); - } + if (flags.flat) { + result.flags.push('flat'); + } + if (flags.ignoreScripts) { + result.flags.push('ignoreScripts'); + } - return [ Uh, Vl ]; -} + if (_this3.config.production) { + result.flags.push('production'); + } -var exports = { - ECCurveFp: ECCurveFp, - ECPointFp: ECPointFp, - ECFieldElementFp: ECFieldElementFp -} + const linkedModules = _this3.config.linkedModules; + if (linkedModules.length) { + result.linkedModules = linkedModules.sort((_misc || _load_misc()).sortAlpha); + } -module.exports = exports + Object.keys(lockfile).forEach(function (key) { + result.lockfileEntries[key] = lockfile[key].resolved; + }); + if (flags.checkFiles) { + result.files = yield _this3._getFilesDeep(modulesFolder); + } -/***/ }), -/* 142 */ -/***/ (function(module, exports, __webpack_require__) { + return result; + })(); + } -"use strict"; + _getIntegrityFile(locationPath) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const expectedRaw = yield (_fs || _load_fs()).readFile(locationPath); + try { + return JSON.parse(expectedRaw); + } catch (e) { + // ignore JSON parsing for legacy text integrity files compatibility + } + return null; + })(); + } + _compareIntegrityFiles(actual, expected, checkFiles, locationFolder) { + var _this4 = this; -var hasOwn = Object.prototype.hasOwnProperty; -var toStr = Object.prototype.toString; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (!expected) { + return 'EXPECTED_IS_NOT_A_JSON'; + } + if (!(0, (_misc || _load_misc()).compareSortedArrays)(actual.linkedModules, expected.linkedModules)) { + return 'LINKED_MODULES_DONT_MATCH'; + } + if (!(0, (_misc || _load_misc()).compareSortedArrays)(actual.flags, expected.flags)) { + return 'FLAGS_DONT_MATCH'; + } + for (const key of Object.keys(actual.lockfileEntries)) { + if (actual.lockfileEntries[key] !== expected.lockfileEntries[key]) { + return 'LOCKFILE_DONT_MATCH'; + } + } + for (const key of Object.keys(expected.lockfileEntries)) { + if (actual.lockfileEntries[key] !== expected.lockfileEntries[key]) { + return 'LOCKFILE_DONT_MATCH'; + } + } + if (checkFiles) { + if (expected.files.length === 0) { + // edge case handling - --check-fies is passed but .yarn-integrity does not contain any files + // check and fail if there are file in node_modules after all. + const actualFiles = yield _this4._getFilesDeep(locationFolder); + if (actualFiles.length > 0) { + return 'FILES_MISSING'; + } + } else { + // TODO we may want to optimise this check by checking only for package.json files on very large trees + for (const file of expected.files) { + if (!(yield (_fs || _load_fs()).exists(path.join(locationFolder, file)))) { + return 'FILES_MISSING'; + } + } + } + } + return 'OK'; + })(); + } -var isArray = function isArray(arr) { - if (typeof Array.isArray === 'function') { - return Array.isArray(arr); - } + check(patterns, lockfile, flags, workspaceLayout) { + var _this5 = this; - return toStr.call(arr) === '[object Array]'; -}; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // check if patterns exist in lockfile + const missingPatterns = patterns.filter(function (p) { + return !lockfile[p] && (!workspaceLayout || !workspaceLayout.getManifestByPattern(p)); + }); -var isPlainObject = function isPlainObject(obj) { - if (!obj || toStr.call(obj) !== '[object Object]') { - return false; - } + const loc = yield _this5._getIntegrityHashLocation(); + if (missingPatterns.length || !loc.exists) { + return { + integrityFileMissing: !loc.exists, + missingPatterns + }; + } - var hasOwnConstructor = hasOwn.call(obj, 'constructor'); - var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); - // Not own constructor property must be Object - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } + const actual = yield _this5._generateIntegrityFile(lockfile, patterns, Object.assign({}, flags, { checkFiles: false }), ( // don't generate files when checking, we check the files below + yield _this5._getModuleLocation())); + const expected = yield _this5._getIntegrityFile(loc.locationPath); + const integrityMatches = yield _this5._compareIntegrityFiles(actual, expected, flags.checkFiles, loc.locationFolder); - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - var key; - for (key in obj) {/**/} + return { + integrityFileMissing: false, + integrityMatches: integrityMatches === 'OK', + integrityError: integrityMatches === 'OK' ? undefined : integrityMatches, + missingPatterns + }; + })(); + } - return typeof key === 'undefined' || hasOwn.call(obj, key); -}; + /** + * Get artifacts from integrity file if it exists. + */ + getArtifacts() { + var _this6 = this; -module.exports = function extend() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0], - i = 1, - length = arguments.length, - deep = false; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const loc = yield _this6._getIntegrityHashLocation(); + if (!loc.exists) { + return null; + } - // Handle a deep copy situation - if (typeof target === 'boolean') { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } else if ((typeof target !== 'object' && typeof target !== 'function') || target == null) { - target = {}; - } + const expectedRaw = yield (_fs || _load_fs()).readFile(loc.locationPath); + let expected; + try { + expected = JSON.parse(expectedRaw); + } catch (e) { + // ignore JSON parsing for legacy text integrity files compatibility + } - for (; i < length; ++i) { - options = arguments[i]; - // Only deal with non-null/undefined values - if (options != null) { - // Extend the base object - for (name in options) { - src = target[name]; - copy = options[name]; + return expected ? expected.artifacts : null; + })(); + } - // Prevent never-ending loop - if (target !== copy) { - // Recurse if we're merging plain objects or arrays - if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } + /** + * Write the integrity hash of the current install to disk. + */ + save(patterns, lockfile, flags, usedRegistries, artifacts) { + var _this7 = this; - // Never move original objects, clone them - target[name] = extend(deep, clone, copy); + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const moduleFolder = yield _this7._getModuleLocation(usedRegistries); + const integrityFile = yield _this7._generateIntegrityFile(lockfile, patterns, flags, moduleFolder, artifacts); - // Don't bring in undefined values - } else if (typeof copy !== 'undefined') { - target[name] = copy; - } - } - } - } - } + const loc = yield _this7._getIntegrityHashLocation(usedRegistries); + invariant(loc.locationPath, 'expected integrity hash location'); - // Return the modified object - return target; -}; + yield (_fs || _load_fs()).mkdirp(path.dirname(loc.locationPath)); + yield (_fs || _load_fs()).writeFile(loc.locationPath, JSON.stringify(integrityFile, null, 2)); + })(); + } + removeIntegrityFile() { + var _this8 = this; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const loc = yield _this8._getIntegrityHashLocation(); + if (loc.exists) { + yield (_fs || _load_fs()).unlink(loc.locationPath); + } + })(); + } +} +exports.default = InstallationIntegrityChecker; /***/ }), -/* 143 */ +/* 120 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const escapeStringRegexp = __webpack_require__(228); - -const platform = process.platform; -const main = { - tick: '✔', - cross: '✖', - star: '★', - square: '▇', - squareSmall: '◻', - squareSmallFilled: '◼', - play: '▶', - circle: '◯', - circleFilled: '◉', - circleDotted: '◌', - circleDouble: '◎', - circleCircle: 'ⓞ', - circleCross: 'ⓧ', - circlePipe: 'Ⓘ', - circleQuestionMark: '?⃝', - bullet: '●', - dot: '․', - line: '─', - ellipsis: '…', - pointer: '❯', - pointerSmall: '›', - info: 'ℹ', - warning: '⚠', - hamburger: '☰', - smiley: '㋡', - mustache: '෴', - heart: '♥', - arrowUp: '↑', - arrowDown: '↓', - arrowLeft: '←', - arrowRight: '→', - radioOn: '◉', - radioOff: '◯', - checkboxOn: '☒', - checkboxOff: '☐', - checkboxCircleOn: 'ⓧ', - checkboxCircleOff: 'Ⓘ', - questionMarkPrefix: '?⃝', - oneHalf: '½', - oneThird: '⅓', - oneQuarter: '¼', - oneFifth: '⅕', - oneSixth: '⅙', - oneSeventh: '⅐', - oneEighth: '⅛', - oneNinth: '⅑', - oneTenth: '⅒', - twoThirds: '⅔', - twoFifths: '⅖', - threeQuarters: '¾', - threeFifths: '⅗', - threeEighths: '⅜', - fourFifths: '⅘', - fiveSixths: '⅚', - fiveEighths: '⅝', - sevenEighths: '⅞' -}; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.linkBin = undefined; -const win = { - tick: '√', - cross: '×', - star: '*', - square: '█', - squareSmall: '[ ]', - squareSmallFilled: '[█]', - play: '►', - circle: '( )', - circleFilled: '(*)', - circleDotted: '( )', - circleDouble: '( )', - circleCircle: '(○)', - circleCross: '(×)', - circlePipe: '(│)', - circleQuestionMark: '(?)', - bullet: '*', - dot: '.', - line: '─', - ellipsis: '...', - pointer: '>', - pointerSmall: '»', - info: 'i', - warning: '‼', - hamburger: '≡', - smiley: '☺', - mustache: '┌─┐', - heart: main.heart, - arrowUp: main.arrowUp, - arrowDown: main.arrowDown, - arrowLeft: main.arrowLeft, - arrowRight: main.arrowRight, - radioOn: '(*)', - radioOff: '( )', - checkboxOn: '[×]', - checkboxOff: '[ ]', - checkboxCircleOn: '(×)', - checkboxCircleOff: '( )', - questionMarkPrefix: '?', - oneHalf: '1/2', - oneThird: '1/3', - oneQuarter: '1/4', - oneFifth: '1/5', - oneSixth: '1/6', - oneSeventh: '1/7', - oneEighth: '1/8', - oneNinth: '1/9', - oneTenth: '1/10', - twoThirds: '2/3', - twoFifths: '2/5', - threeQuarters: '3/4', - threeFifths: '3/5', - threeEighths: '3/8', - fourFifths: '4/5', - fiveSixths: '5/6', - fiveEighths: '5/8', - sevenEighths: '7/8' -}; +var _slicedToArray2; -if (platform === 'linux') { - // the main one doesn't look that good on Ubuntu - main.questionMarkPrefix = '?'; +function _load_slicedToArray() { + return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); } -const figures = platform === 'win32' ? win : main; - -const fn = str => { - if (figures === main) { - return str; - } +var _asyncToGenerator2; - Object.keys(main).forEach(key => { - if (main[key] === figures[key]) { - return; - } +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} - str = str.replace(new RegExp(escapeStringRegexp(main[key]), 'g'), figures[key]); - }); +let linkBin = exports.linkBin = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (src, dest) { + if (process.platform === 'win32') { + const unlockMutex = yield (0, (_mutex || _load_mutex()).default)(src); + try { + yield cmdShim(src, dest); + } finally { + unlockMutex(); + } + } else { + yield (_fs || _load_fs()).mkdirp(path.dirname(dest)); + yield (_fs || _load_fs()).symlink(src, dest); + yield (_fs || _load_fs()).chmod(dest, '755'); + } + }); - return str; -}; + return function linkBin(_x, _x2) { + return _ref.apply(this, arguments); + }; +})(); -module.exports = Object.assign(fn, figures); +var _packageHoister; +function _load_packageHoister() { + return _packageHoister = _interopRequireDefault(__webpack_require__(358)); +} -/***/ }), -/* 144 */ -/***/ (function(module, exports, __webpack_require__) { +var _constants; -// Approach: -// -// 1. Get the minimatch set -// 2. For each pattern in the set, PROCESS(pattern, false) -// 3. Store matches per-set, then uniq them -// -// PROCESS(pattern, inGlobStar) -// Get the first [n] items from pattern that are all strings -// Join these together. This is PREFIX. -// If there is no more remaining, then stat(PREFIX) and -// add to matches if it succeeds. END. -// -// If inGlobStar and PREFIX is symlink and points to dir -// set ENTRIES = [] -// else readdir(PREFIX) as ENTRIES -// If fail, END -// -// with ENTRIES -// If pattern[n] is GLOBSTAR -// // handle the case where the globstar match is empty -// // by pruning it out, and testing the resulting pattern -// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) -// // handle other cases. -// for ENTRY in ENTRIES (not dotfiles) -// // attach globstar + tail onto the entry -// // Mark that this entry is a globstar match -// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) -// -// else // not globstar -// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) -// Test ENTRY against pattern[n] -// If fails, continue -// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) -// -// Caveat: -// Cache all stats and readdirs results to minimize syscall. Since all -// we ever care about is existence and directory-ness, we can just keep -// `true` for files, and [children,...] for directories, or `false` for -// things that don't exist. +function _load_constants() { + return _constants = _interopRequireWildcard(__webpack_require__(8)); +} -module.exports = glob +var _promise; -var fs = __webpack_require__(5) -var rp = __webpack_require__(230) -var minimatch = __webpack_require__(153) -var Minimatch = minimatch.Minimatch -var inherits = __webpack_require__(37) -var EE = __webpack_require__(34).EventEmitter -var path = __webpack_require__(1) -var assert = __webpack_require__(22) -var isAbsolute = __webpack_require__(156) -var globSync = __webpack_require__(470) -var common = __webpack_require__(231) -var alphasort = common.alphasort -var alphasorti = common.alphasorti -var setopts = common.setopts -var ownProp = common.ownProp -var inflight = __webpack_require__(506) -var util = __webpack_require__(2) -var childrenIgnored = common.childrenIgnored -var isIgnored = common.isIgnored +function _load_promise() { + return _promise = _interopRequireWildcard(__webpack_require__(64)); +} -var once = __webpack_require__(155) +var _misc; -function glob (pattern, options, cb) { - if (typeof options === 'function') cb = options, options = {} - if (!options) options = {} +function _load_misc() { + return _misc = __webpack_require__(10); +} - if (options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return globSync(pattern, options) - } +var _fs; - return new Glob(pattern, options, cb) +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); } -glob.sync = globSync -var GlobSync = glob.GlobSync = globSync.GlobSync +var _mutex; -// old api surface -glob.glob = glob +function _load_mutex() { + return _mutex = _interopRequireDefault(__webpack_require__(383)); +} -function extend (origin, add) { - if (add === null || typeof add !== 'object') { - return origin - } +var _semver; - var keys = Object.keys(add) - var i = keys.length - while (i--) { - origin[keys[i]] = add[keys[i]] - } - return origin +function _load_semver() { + return _semver = __webpack_require__(391); } -glob.hasMagic = function (pattern, options_) { - var options = extend({}, options_) - options.noprocess = true +var _workspaceLayout; - var g = new Glob(pattern, options) - var set = g.minimatch.set +function _load_workspaceLayout() { + return _workspaceLayout = _interopRequireDefault(__webpack_require__(66)); +} - if (!pattern) - return false +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 (set.length > 1) - return true +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - for (var j = 0; j < set[0].length; j++) { - if (typeof set[0][j] !== 'string') - return true - } +const invariant = __webpack_require__(5); - return false -} +const cmdShim = (_promise || _load_promise()).promisify(__webpack_require__(409)); +const path = __webpack_require__(1); +// Concurrency for creating bin links disabled because of the issue #1961 +const linkBinConcurrency = 1; -glob.Glob = Glob -inherits(Glob, EE) -function Glob (pattern, options, cb) { - if (typeof options === 'function') { - cb = options - options = null +class PackageLinker { + constructor(config, resolver) { + this.resolver = resolver; + this.reporter = config.reporter; + this.config = config; + this.artifacts = {}; } - if (options && options.sync) { - if (cb) - throw new TypeError('callback provided to sync glob') - return new GlobSync(pattern, options) + setArtifacts(artifacts) { + this.artifacts = artifacts; } - if (!(this instanceof Glob)) - return new Glob(pattern, options, cb) + linkSelfDependencies(pkg, pkgLoc, targetBinLoc) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + targetBinLoc = path.join(targetBinLoc, '.bin'); + yield (_fs || _load_fs()).mkdirp(targetBinLoc); + targetBinLoc = yield (_fs || _load_fs()).realpath(targetBinLoc); + pkgLoc = yield (_fs || _load_fs()).realpath(pkgLoc); + for (const _ref2 of (0, (_misc || _load_misc()).entries)(pkg.bin)) { + var _ref3 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref2, 2); - setopts(this, pattern, options) - this._didRealPath = false + const scriptName = _ref3[0]; + const scriptCmd = _ref3[1]; - // process each pattern in the minimatch set - var n = this.minimatch.set.length + const dest = path.join(targetBinLoc, scriptName); + const src = path.join(pkgLoc, scriptCmd); + if (!(yield (_fs || _load_fs()).exists(src))) { + // TODO maybe throw an error + continue; + } + yield linkBin(src, dest); + } + })(); + } - // The matches are stored as {: true,...} so that - // duplicates are automagically pruned. - // Later, we do an Object.keys() on these. - // Keep them as a list so we can fill in when nonull is set. - this.matches = new Array(n) + linkBinDependencies(pkg, dir) { + var _this = this; - if (typeof cb === 'function') { - cb = once(cb) - this.on('error', cb) - this.on('end', function (matches) { - cb(null, matches) - }) - } + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const deps = []; - var self = this - var n = this.minimatch.set.length - this._processing = 0 - this.matches = new Array(n) + const ref = pkg._reference; + invariant(ref, 'Package reference is missing'); - this._emitQueue = [] - this._processQueue = [] - this.paused = false + const remote = pkg._remote; + invariant(remote, 'Package remote is missing'); - if (this.noprocess) - return this + // link up `bin scripts` in `dependencies` + for (const pattern of ref.dependencies) { + const dep = _this.resolver.getStrictResolvedPattern(pattern); + if (dep.bin && Object.keys(dep.bin).length) { + deps.push({ + dep, + loc: _this.config.generateHardModulePath(dep._reference) + }); + } + } - if (n === 0) - return done() + // link up the `bin` scripts in bundled dependencies + if (pkg.bundleDependencies) { + for (const depName of pkg.bundleDependencies) { + const loc = path.join(_this.config.generateHardModulePath(ref), _this.config.getFolder(pkg), depName); - var sync = true - for (var i = 0; i < n; i ++) { - this._process(this.minimatch.set[i], i, false, done) - } - sync = false + const dep = yield _this.config.readManifest(loc, remote.registry); - function done () { - --self._processing - if (self._processing <= 0) { - if (sync) { - process.nextTick(function () { - self._finish() - }) - } else { - self._finish() + if (dep.bin && Object.keys(dep.bin).length) { + deps.push({ dep, loc }); + } + } + } + + // no deps to link + if (!deps.length) { + return; + } + + // write the executables + for (const _ref4 of deps) { + const dep = _ref4.dep, + loc = _ref4.loc; + + yield _this.linkSelfDependencies(dep, loc, dir); } - } + })(); } -} -Glob.prototype._finish = function () { - assert(this instanceof Glob) - if (this.aborted) - return + getFlatHoistedTree(patterns) { + const hoister = new (_packageHoister || _load_packageHoister()).default(this.config, this.resolver); + hoister.seed(patterns); + return Promise.resolve(hoister.init()); + } - if (this.realpath && !this._didRealpath) - return this._realpath() + copyModules(patterns, linkDuplicates, workspaceLayout) { + var _this2 = this; - common.finish(this) - this.emit('end', this.found) -} + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + let flatTree = yield _this2.getFlatHoistedTree(patterns); -Glob.prototype._realpath = function () { - if (this._didRealpath) - return + // sorted tree makes file creation and copying not to interfere with each other + flatTree = flatTree.sort(function (dep1, dep2) { + return dep1[0].localeCompare(dep2[0]); + }); - this._didRealpath = true + // list of artifacts in modules to remove from extraneous removal + const artifactFiles = []; - var n = this.matches.length - if (n === 0) - return this._finish() + const copyQueue = new Map(); + const hardlinkQueue = new Map(); + const hardlinksEnabled = linkDuplicates && (yield (_fs || _load_fs()).hardlinksWork(_this2.config.cwd)); - var self = this - for (var i = 0; i < this.matches.length; i++) - this._realpathSet(i, next) + const copiedSrcs = new Map(); + const symlinkPaths = new Map(); + for (const _ref5 of flatTree) { + var _ref6 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref5, 2); - function next () { - if (--n === 0) - self._finish() - } -} + const folder = _ref6[0]; + var _ref6$ = _ref6[1]; + const pkg = _ref6$.pkg; + const loc = _ref6$.loc; -Glob.prototype._realpathSet = function (index, cb) { - var matchset = this.matches[index] - if (!matchset) - return cb() + const remote = pkg._remote || { type: '' }; + const ref = pkg._reference; + let dest = folder; + invariant(ref, 'expected package reference'); - var found = Object.keys(matchset) - var self = this - var n = found.length + let src = loc; + let type = ''; + if (remote.type === 'link') { + // replace package source from incorrect cache location (workspaces and link: are not cached) + // with a symlink source + src = remote.reference; + type = 'symlink'; + } else if (workspaceLayout && remote.type === 'workspace') { + src = remote.reference; + type = 'symlink'; + if (dest.indexOf(workspaceLayout.virtualManifestName) !== -1) { + // we don't need to install virtual manifest + continue; + } + // to get real path for non hoisted dependencies + symlinkPaths.set(dest, src); + } else { + // backwards compatibility: get build artifacts from metadata + // does not apply to symlinked dependencies + const metadata = yield _this2.config.readPackageMetadata(src); + for (const file of metadata.artifacts) { + artifactFiles.push(path.join(dest, file)); + } + } - if (n === 0) - return cb() + // fs copy can't copy through a symlink, so we replace those with real paths to workpsaces + for (const _ref7 of symlinkPaths.entries()) { + var _ref8 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref7, 2); - var set = this.matches[index] = Object.create(null) - found.forEach(function (p, i) { - // If there's a problem with the stat, then it means that - // one or more of the links in the realpath couldn't be - // resolved. just return the abs value in that case. - p = self._makeAbs(p) - rp.realpath(p, self.realpathCache, function (er, real) { - if (!er) - set[real] = true - else if (er.syscall === 'stat') - set[p] = true - else - self.emit('error', er) // srsly wtf right here + const symlink = _ref8[0]; + const realpath = _ref8[1]; - if (--n === 0) { - self.matches[index] = set - cb() - } - }) - }) -} + if (dest !== symlink && dest.indexOf(symlink) === 0) { + dest = dest.replace(symlink, realpath); + } + } -Glob.prototype._mark = function (p) { - return common.mark(this, p) -} + ref.setLocation(dest); -Glob.prototype._makeAbs = function (f) { - return common.makeAbs(this, f) -} + const integrityArtifacts = _this2.artifacts[`${pkg.name}@${pkg.version}`]; + if (integrityArtifacts) { + for (const file of integrityArtifacts) { + artifactFiles.push(path.join(dest, file)); + } + } -Glob.prototype.abort = function () { - this.aborted = true - this.emit('abort') -} + const copiedDest = copiedSrcs.get(src); + if (!copiedDest) { + if (hardlinksEnabled) { + copiedSrcs.set(src, dest); + } + copyQueue.set(dest, { + src, + dest, + type, + onFresh() { + if (ref) { + ref.setFresh(true); + } + } + }); + } else { + hardlinkQueue.set(dest, { + src: copiedDest, + dest, + onFresh() { + if (ref) { + ref.setFresh(true); + } + } + }); + } + } -Glob.prototype.pause = function () { - if (!this.paused) { - this.paused = true - this.emit('pause') - } -} + // keep track of all scoped paths to remove empty scopes after copy + const scopedPaths = new Set(); -Glob.prototype.resume = function () { - if (this.paused) { - this.emit('resume') - this.paused = false - if (this._emitQueue.length) { - var eq = this._emitQueue.slice(0) - this._emitQueue.length = 0 - for (var i = 0; i < eq.length; i ++) { - var e = eq[i] - this._emitMatch(e[0], e[1]) - } - } - if (this._processQueue.length) { - var pq = this._processQueue.slice(0) - this._processQueue.length = 0 - for (var i = 0; i < pq.length; i ++) { - var p = pq[i] - this._processing-- - this._process(p[0], p[1], p[2], p[3]) + // register root & scoped packages as being possibly extraneous + const possibleExtraneous = new Set(); + for (const folder of _this2.config.registryFolders) { + const loc = path.join(_this2.config.cwd, folder); + + if (yield (_fs || _load_fs()).exists(loc)) { + const files = yield (_fs || _load_fs()).readdir(loc); + let filepath; + for (const file of files) { + filepath = path.join(loc, file); + if (file[0] === '@') { + // it's a scope, not a package + scopedPaths.add(filepath); + const subfiles = yield (_fs || _load_fs()).readdir(filepath); + for (const subfile of subfiles) { + possibleExtraneous.add(path.join(filepath, subfile)); + } + } else { + possibleExtraneous.add(filepath); + } + } + } } - } - } -} -Glob.prototype._process = function (pattern, index, inGlobStar, cb) { - assert(this instanceof Glob) - assert(typeof cb === 'function') + // linked modules + for (const loc of possibleExtraneous) { + const stat = yield (_fs || _load_fs()).lstat(loc); + if (stat.isSymbolicLink()) { + possibleExtraneous.delete(loc); + copyQueue.delete(loc); + } + } - if (this.aborted) - return + // + let tick; + yield (_fs || _load_fs()).copyBulk(Array.from(copyQueue.values()), _this2.reporter, { + possibleExtraneous, + artifactFiles, - this._processing++ - if (this.paused) { - this._processQueue.push([pattern, index, inGlobStar, cb]) - return - } + ignoreBasenames: [(_constants || _load_constants()).METADATA_FILENAME, (_constants || _load_constants()).TARBALL_FILENAME], - //console.error('PROCESS %d', this._processing, pattern) + onStart: function (num) { + tick = _this2.reporter.progress(num); + }, - // Get the first [n] parts of pattern that are all strings. - var n = 0 - while (typeof pattern[n] === 'string') { - n ++ - } - // now n is the index of the first one that is *not* a string. + onProgress(src) { + if (tick) { + tick(src); + } + } + }); + yield (_fs || _load_fs()).hardlinkBulk(Array.from(hardlinkQueue.values()), _this2.reporter, { + possibleExtraneous, + artifactFiles, - // see if there's anything else - var prefix - switch (n) { - // if not, then this is rather simple - case pattern.length: - this._processSimple(pattern.join('/'), index, cb) - return + onStart: function (num) { + tick = _this2.reporter.progress(num); + }, - case 0: - // pattern *starts* with some non-trivial item. - // going to readdir(cwd), but not include the prefix in matches. - prefix = null - break + onProgress(src) { + if (tick) { + tick(src); + } + } + }); - default: - // pattern has some string bits in the front. - // whatever it starts with, whether that's 'absolute' like /foo/bar, - // or 'relative' like '../baz' - prefix = pattern.slice(0, n).join('/') - break - } + // remove all extraneous files that weren't in the tree + for (const loc of possibleExtraneous) { + _this2.reporter.verbose(_this2.reporter.lang('verboseFileRemoveExtraneous', loc)); + yield (_fs || _load_fs()).unlink(loc); + } - var remain = pattern.slice(n) + // remove any empty scoped directories + for (const scopedPath of scopedPaths) { + const files = yield (_fs || _load_fs()).readdir(scopedPath); + if (files.length === 0) { + yield (_fs || _load_fs()).unlink(scopedPath); + } + } - // get the list of entries. - var read - if (prefix === null) - read = '.' - else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { - if (!prefix || !isAbsolute(prefix)) - prefix = '/' + prefix - read = prefix - } else - read = prefix + // create binary links + if (_this2.config.binLinks) { + const topLevelDependencies = _this2.determineTopLevelBinLinks(flatTree); + const tickBin = _this2.reporter.progress(flatTree.length + topLevelDependencies.length); - var abs = this._makeAbs(read) + // create links in transient dependencies + yield (_promise || _load_promise()).queue(flatTree, (() => { + var _ref9 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (_ref10) { + var _ref11 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref10, 2); - //if ignored, skip _processing - if (childrenIgnored(this, read)) - return cb() + let dest = _ref11[0], + pkg = _ref11[1].pkg; - var isGlobStar = remain[0] === minimatch.GLOBSTAR - if (isGlobStar) - this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) - else - this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) -} + const binLoc = path.join(dest, _this2.config.getFolder(pkg)); + yield _this2.linkBinDependencies(pkg, binLoc); + tickBin(dest); + }); -Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) -} + return function (_x3) { + return _ref9.apply(this, arguments); + }; + })(), linkBinConcurrency); -Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + // create links at top level for all dependencies. + // non-transient dependencies will overwrite these during this.save() to ensure they take priority. + yield (_promise || _load_promise()).queue(topLevelDependencies, (() => { + var _ref12 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (_ref13) { + var _ref14 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref13, 2); - // if the abs isn't a dir, then nothing can match! - if (!entries) - return cb() + let dest = _ref14[0], + pkg = _ref14[1].pkg; - // It will only match dot entries if it starts with a dot, or if - // dot is set. Stuff like @(.foo|.bar) isn't allowed. - var pn = remain[0] - var negate = !!this.minimatch.negate - var rawGlob = pn._glob - var dotOk = this.dot || rawGlob.charAt(0) === '.' + if (pkg.bin && Object.keys(pkg.bin).length) { + const binLoc = path.join(_this2.config.cwd, _this2.config.getFolder(pkg)); + yield _this2.linkSelfDependencies(pkg, dest, binLoc); + tickBin(_this2.config.cwd); + } + }); - var matchedEntries = [] - for (var i = 0; i < entries.length; i++) { - var e = entries[i] - if (e.charAt(0) !== '.' || dotOk) { - var m - if (negate && !prefix) { - m = !e.match(pn) - } else { - m = e.match(pn) + return function (_x4) { + return _ref12.apply(this, arguments); + }; + })(), linkBinConcurrency); } - if (m) - matchedEntries.push(e) - } + })(); } - //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - - var len = matchedEntries.length - // If there are no matched entries, then nothing matches. - if (len === 0) - return cb() + determineTopLevelBinLinks(flatTree) { + const linksToCreate = new Map(); - // if this is the last remaining pattern bit, then no need for - // an additional stat *unless* the user has specified mark or - // stat explicitly. We know they exist, since readdir returned - // them. + flatTree.forEach((_ref15) => { + var _ref16 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref15, 2); - if (remain.length === 1 && !this.mark && !this.stat) { - if (!this.matches[index]) - this.matches[index] = Object.create(null) + let dest = _ref16[0], + hoistManifest = _ref16[1]; - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e + if (!linksToCreate.has(hoistManifest.pkg.name)) { + linksToCreate.set(hoistManifest.pkg.name, [dest, hoistManifest]); } + }); - if (e.charAt(0) === '/' && !this.nomount) { - e = path.join(this.root, e) - } - this._emitMatch(index, e) - } - // This was the last one, and no stats were needed - return cb() + return Array.from(linksToCreate.values()); } - // now test all matched entries as stand-ins for that part - // of the pattern. - remain.shift() - for (var i = 0; i < len; i ++) { - var e = matchedEntries[i] - var newPattern - if (prefix) { - if (prefix !== '/') - e = prefix + '/' + e - else - e = prefix + e + resolvePeerModules() { + for (const pkg of this.resolver.getManifests()) { + this._resolvePeerModules(pkg); } - this._process([e].concat(remain), index, inGlobStar, cb) - } - cb() -} - -Glob.prototype._emitMatch = function (index, e) { - if (this.aborted) - return - - if (isIgnored(this, e)) - return - - if (this.paused) { - this._emitQueue.push([index, e]) - return } - var abs = isAbsolute(e) ? e : this._makeAbs(e) + _resolvePeerModules(pkg) { + const peerDeps = pkg.peerDependencies; + if (!peerDeps) { + return; + } - if (this.mark) - e = this._mark(e) + const ref = pkg._reference; + invariant(ref, 'Package reference is missing'); - if (this.absolute) - e = abs + for (const name in peerDeps) { + const range = peerDeps[name]; + const patterns = this.resolver.patternsByPackage[name] || []; + const foundPattern = patterns.find(pattern => { + const resolvedPattern = this.resolver.getResolvedPattern(pattern); + return resolvedPattern ? this._satisfiesPeerDependency(range, resolvedPattern.version) : false; + }); - if (this.matches[index][e]) - return + if (foundPattern) { + ref.addDependencies([foundPattern]); + } else { + const depError = patterns.length > 0 ? 'incorrectPeer' : 'unmetPeer'; + const pkgHuman = `${pkg.name}@${pkg.version}`, + depHuman = `${name}@${range}`; - if (this.nodir) { - var c = this.cache[abs] - if (c === 'DIR' || Array.isArray(c)) - return + this.reporter.warn(this.reporter.lang(depError, pkgHuman, depHuman)); + } + } } - this.matches[index][e] = true + _satisfiesPeerDependency(range, version) { + return range === '*' || (0, (_semver || _load_semver()).satisfiesWithPreleases)(version, range, this.config.looseSemver); + } - var st = this.statCache[abs] - if (st) - this.emit('stat', e, st) + init(patterns, linkDuplicates, workspaceLayout) { + var _this3 = this; - this.emit('match', e) + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this3.resolvePeerModules(); + yield _this3.copyModules(patterns, linkDuplicates, workspaceLayout); + })(); + } } +exports.default = PackageLinker; -Glob.prototype._readdirInGlobStar = function (abs, cb) { - if (this.aborted) - return +/***/ }), +/* 121 */ +/***/ (function(module, exports, __webpack_require__) { - // follow all symlinked directories forever - // just proceed as if this is a non-globstar situation - if (this.follow) - return this._readdir(abs, false, cb) +"use strict"; - var lstatkey = 'lstat\0' + abs - var self = this - var lstatcb = inflight(lstatkey, lstatcb_) - if (lstatcb) - fs.lstat(abs, lstatcb) +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.clearLine = clearLine; +exports.toStartOfLine = toStartOfLine; +exports.writeOnNthLine = writeOnNthLine; +exports.clearNthLine = clearNthLine; - function lstatcb_ (er, lstat) { - if (er && er.code === 'ENOENT') - return cb() - var isSym = lstat && lstat.isSymbolicLink() - self.symlinks[abs] = isSym +const readline = __webpack_require__(115); - // If it's not a symlink or a dir, then it's definitely a regular file. - // don't bother doing a readdir in that case. - if (!isSym && lstat && !lstat.isDirectory()) { - self.cache[abs] = 'FILE' - cb() - } else - self._readdir(abs, false, cb) - } -} +var _require = __webpack_require__(16); -Glob.prototype._readdir = function (abs, inGlobStar, cb) { - if (this.aborted) - return +const supportsColor = _require.supportsColor; - cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) - if (!cb) - return - //console.error('RD %j %j', +inGlobStar, abs) - if (inGlobStar && !ownProp(this.symlinks, abs)) - return this._readdirInGlobStar(abs, cb) +const CLEAR_WHOLE_LINE = 0; +const CLEAR_RIGHT_OF_CURSOR = 1; - if (ownProp(this.cache, abs)) { - var c = this.cache[abs] - if (!c || c === 'FILE') - return cb() +function clearLine(stdout) { + if (!supportsColor) { + return; + } - if (Array.isArray(c)) - return cb(null, c) + readline.clearLine(stdout, CLEAR_WHOLE_LINE); + readline.cursorTo(stdout, 0); +} + +function toStartOfLine(stdout) { + if (!supportsColor) { + return; } - var self = this - fs.readdir(abs, readdirCb(this, abs, cb)) + readline.cursorTo(stdout, 0); } -function readdirCb (self, abs, cb) { - return function (er, entries) { - if (er) - self._readdirError(abs, er, cb) - else - self._readdirEntries(abs, entries, cb) +function writeOnNthLine(stdout, n, msg) { + if (!supportsColor) { + return; } -} -Glob.prototype._readdirEntries = function (abs, entries, cb) { - if (this.aborted) - return + if (n == 0) { + readline.cursorTo(stdout, 0); + stdout.write(msg); + readline.clearLine(stdout, CLEAR_RIGHT_OF_CURSOR); + return; + } + readline.cursorTo(stdout, 0); + readline.moveCursor(stdout, 0, -n); + stdout.write(msg); + readline.clearLine(stdout, CLEAR_RIGHT_OF_CURSOR); + readline.cursorTo(stdout, 0); + readline.moveCursor(stdout, 0, n); +} - // if we haven't asked to stat everything, then just - // assume that everything in there exists, so we can avoid - // having to stat it a second time. - if (!this.mark && !this.stat) { - for (var i = 0; i < entries.length; i ++) { - var e = entries[i] - if (abs === '/') - e = abs + e - else - e = abs + '/' + e - this.cache[e] = true - } +function clearNthLine(stdout, n) { + if (!supportsColor) { + return; } - this.cache[abs] = entries - return cb(null, entries) + if (n == 0) { + clearLine(stdout); + return; + } + readline.cursorTo(stdout, 0); + readline.moveCursor(stdout, 0, -n); + readline.clearLine(stdout, CLEAR_WHOLE_LINE); + readline.moveCursor(stdout, 0, n); } -Glob.prototype._readdirError = function (f, er, cb) { - if (this.aborted) - return +/***/ }), +/* 122 */ +/***/ (function(module, exports, __webpack_require__) { - // handle errors, and cache the information - switch (er.code) { - case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 - case 'ENOTDIR': // totally normal. means it *does* exist. - var abs = this._makeAbs(f) - this.cache[abs] = 'FILE' - if (abs === this.cwdAbs) { - var error = new Error(er.code + ' invalid cwd ' + this.cwd) - error.path = this.cwd - error.code = er.code - this.emit('error', error) - this.abort() - } - break +"use strict"; - case 'ENOENT': // not terribly unusual - case 'ELOOP': - case 'ENAMETOOLONG': - case 'UNKNOWN': - this.cache[this._makeAbs(f)] = false - break - default: // some unusual error. Treat as failure. - this.cache[this._makeAbs(f)] = false - if (this.strict) { - this.emit('error', er) - // If the error is handled, then we abort - // if not, we threw out of here - this.abort() - } - if (!this.silent) - console.error('glob error', er) - break - } +Object.defineProperty(exports, "__esModule", { + value: true +}); - return cb() -} +var _extends2; -Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { - var self = this - this._readdir(abs, inGlobStar, function (er, entries) { - self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) - }) +function _load_extends() { + return _extends2 = _interopRequireDefault(__webpack_require__(45)); } +var _baseReporter; -Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { - //console.error('pgs2', prefix, remain[0], entries) +function _load_baseReporter() { + return _baseReporter = _interopRequireDefault(__webpack_require__(51)); +} - // no entries means not a dir, so it can never have matches - // foo.txt/** doesn't match foo.txt - if (!entries) - return cb() +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - // test without the globstar, and with every child both below - // and replacing the globstar. - var remainWithoutGlobStar = remain.slice(1) - var gspref = prefix ? [ prefix ] : [] - var noGlobStar = gspref.concat(remainWithoutGlobStar) +class JSONReporter extends (_baseReporter || _load_baseReporter()).default { + constructor(opts) { + super(opts); - // the noGlobStar pattern exits the inGlobStar state - this._process(noGlobStar, index, false, cb) + this._activityId = 0; + this._progressId = 0; + } - var isSym = this.symlinks[abs] - var len = entries.length + _dump(type, data, error) { + let stdout = this.stdout; + if (error) { + stdout = this.stderr; + } + stdout.write(`${JSON.stringify({ type, data })}\n`); + } - // If it's a symlink, and we're in a globstar, then stop - if (isSym && inGlobStar) - return cb() + _verbose(msg) { + this._dump('verbose', msg); + } - for (var i = 0; i < len; i++) { - var e = entries[i] - if (e.charAt(0) === '.' && !this.dot) - continue + list(type, items, hints) { + this._dump('list', { type, items, hints }); + } - // these two cases enter the inGlobStar state - var instead = gspref.concat(entries[i], remainWithoutGlobStar) - this._process(instead, index, true, cb) + tree(type, trees) { + this._dump('tree', { type, trees }); + } - var below = gspref.concat(entries[i], remain) - this._process(below, index, true, cb) + step(current, total, message) { + this._dump('step', { message, current, total }); } - cb() -} + inspect(value) { + this._dump('inspect', value); + } -Glob.prototype._processSimple = function (prefix, index, cb) { - // XXX review this. Shouldn't it be doing the mounting etc - // before doing stat? kinda weird? - var self = this - this._stat(prefix, function (er, exists) { - self._processSimple2(prefix, index, er, exists, cb) - }) -} -Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { + footer() { + this._dump('finished', this.getTotalTime()); + } - //console.error('ps2', prefix, exists) + log(msg) { + this._dump('log', msg); + } - if (!this.matches[index]) - this.matches[index] = Object.create(null) + command(msg) { + this._dump('command', msg); + } - // If it doesn't exist, then just mark the lack of results - if (!exists) - return cb() + table(head, body) { + this._dump('table', { head, body }); + } - if (prefix && isAbsolute(prefix) && !this.nomount) { - var trail = /[\/\\]$/.test(prefix) - if (prefix.charAt(0) === '/') { - prefix = path.join(this.root, prefix) - } else { - prefix = path.resolve(this.root, prefix) - if (trail) - prefix += '/' - } + success(msg) { + this._dump('success', msg); } - if (process.platform === 'win32') - prefix = prefix.replace(/\\/g, '/') + error(msg) { + this._dump('error', msg, true); + } - // Mark this as a match - this._emitMatch(index, prefix) - cb() -} + warn(msg) { + this._dump('warning', msg, true); + } -// Returns either 'DIR', 'FILE', or false -Glob.prototype._stat = function (f, cb) { - var abs = this._makeAbs(f) - var needDir = f.slice(-1) === '/' + info(msg) { + this._dump('info', msg); + } - if (f.length > this.maxLength) - return cb() + activitySet(total, workers) { + if (!this.isTTY || this.noProgress) { + return super.activitySet(total, workers); + } - if (!this.stat && ownProp(this.cache, abs)) { - var c = this.cache[abs] + const id = this._activityId++; + this._dump('activitySetStart', { id, total, workers }); - if (Array.isArray(c)) - c = 'DIR' + const spinners = []; + for (let i = 0; i < workers; i++) { + let current = 0; + let header = ''; - // It exists, but maybe not how we need it - if (!needDir || c === 'DIR') - return cb(null, c) + spinners.push({ + clear() {}, + setPrefix(_current, _header) { + current = _current; + header = _header; + }, + tick: msg => { + this._dump('activitySetTick', { + id, + header, + current, + worker: i, + message: msg + }); + }, + end() {} + }); + } - if (needDir && c === 'FILE') - return cb() + return { + spinners, + end: () => { + this._dump('activitySetEnd', { id }); + } + }; + } - // otherwise we have to stat, because maybe c=true - // if we know it exists, but not what it is. + activity() { + return this._activity({}); } - var exists - var stat = this.statCache[abs] - if (stat !== undefined) { - if (stat === false) - return cb(null, stat) - else { - var type = stat.isDirectory() ? 'DIR' : 'FILE' - if (needDir && type === 'FILE') - return cb() - else - return cb(null, type, stat) + _activity(data) { + if (!this.isTTY || this.noProgress) { + return { + tick() {}, + end() {} + }; } - } - var self = this - var statcb = inflight('stat\0' + abs, lstatcb_) - if (statcb) - fs.lstat(abs, statcb) + const id = this._activityId++; + this._dump('activityStart', (0, (_extends2 || _load_extends()).default)({ id }, data)); - function lstatcb_ (er, lstat) { - if (lstat && lstat.isSymbolicLink()) { - // If it's a symlink, then treat it as the target, unless - // the target does not exist, then treat it as a file. - return fs.stat(abs, function (er, stat) { - if (er) - self._stat2(f, abs, null, lstat, cb) - else - self._stat2(f, abs, er, stat, cb) - }) - } else { - self._stat2(f, abs, er, lstat, cb) + return { + tick: name => { + this._dump('activityTick', { id, name }); + }, + + end: () => { + this._dump('activityEnd', { id }); + } + }; + } + + progress(total) { + if (this.noProgress) { + return function () { + // noop + }; } + + const id = this._progressId++; + let current = 0; + this._dump('progressStart', { id, total }); + + return () => { + current++; + this._dump('progressTick', { id, current }); + + if (current === total) { + this._dump('progressFinish', { id }); + } + }; } } +exports.default = JSONReporter; -Glob.prototype._stat2 = function (f, abs, er, stat, cb) { - if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { - this.statCache[abs] = false - return cb() - } +/***/ }), +/* 123 */ +/***/ (function(module, exports, __webpack_require__) { - var needDir = f.slice(-1) === '/' - this.statCache[abs] = stat +"use strict"; - if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) - return cb(null, false, stat) - var c = true - if (stat) - c = stat.isDirectory() ? 'DIR' : 'FILE' - this.cache[abs] = this.cache[abs] || c +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.explodeGistFragment = explodeGistFragment; - if (needDir && c === 'FILE') - return cb() +var _errors; - return cb(null, c, stat) +function _load_errors() { + return _errors = __webpack_require__(3); } +var _gitResolver; -/***/ }), -/* 145 */ -/***/ (function(module, exports, __webpack_require__) { +function _load_gitResolver() { + return _gitResolver = _interopRequireDefault(__webpack_require__(61)); +} -// Load modules +var _exoticResolver; -var Crypto = __webpack_require__(6); -var Url = __webpack_require__(11); -var Utils = __webpack_require__(89); +function _load_exoticResolver() { + return _exoticResolver = _interopRequireDefault(__webpack_require__(43)); +} +var _misc; -// Declare internals +function _load_misc() { + return _misc = _interopRequireWildcard(__webpack_require__(10)); +} -var internals = {}; +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 }; } -// MAC normalization format version +function explodeGistFragment(fragment, reporter) { + fragment = (_misc || _load_misc()).removePrefix(fragment, 'gist:'); -exports.headerVersion = '1'; // Prevent comparison of mac values generated with different normalized string formats + const parts = fragment.split('#'); + if (parts.length <= 2) { + return { + id: parts[0], + hash: parts[1] || '' + }; + } else { + throw new (_errors || _load_errors()).MessageError(reporter.lang('invalidGistFragment', fragment)); + } +} -// Supported HMAC algorithms +class GistResolver extends (_exoticResolver || _load_exoticResolver()).default { -exports.algorithms = ['sha1', 'sha256']; + constructor(request, fragment) { + super(request, fragment); + var _explodeGistFragment = explodeGistFragment(fragment, this.reporter); -// Calculate the request MAC + const id = _explodeGistFragment.id, + hash = _explodeGistFragment.hash; -/* - type: 'header', // 'header', 'bewit', 'response' - credentials: { - key: 'aoijedoaijsdlaksjdl', - algorithm: 'sha256' // 'sha1', 'sha256' - }, - options: { - method: 'GET', - resource: '/resource?a=1&b=2', - host: 'example.com', - port: 8080, - ts: 1357718381034, - nonce: 'd3d345f', - hash: 'U4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=', - ext: 'app-specific-data', - app: 'hf48hd83qwkj', // Application id (Oz) - dlg: 'd8djwekds9cj' // Delegated by application id (Oz), requires options.app - } -*/ + this.id = id; + this.hash = hash; + } -exports.calculateMac = function (type, credentials, options) { + resolve() { + return this.fork((_gitResolver || _load_gitResolver()).default, false, `https://gist.github.com/${this.id}.git#${this.hash}`); + } +} +exports.default = GistResolver; +GistResolver.protocol = 'gist'; - var normalized = exports.generateNormalizedString(type, options); +/***/ }), +/* 124 */ +/***/ (function(module, exports, __webpack_require__) { - var hmac = Crypto.createHmac(credentials.algorithm, credentials.key).update(normalized); - var digest = hmac.digest('base64'); - return digest; -}; +"use strict"; -exports.generateNormalizedString = function (type, options) { +Object.defineProperty(exports, "__esModule", { + value: true +}); - var resource = options.resource || ''; - if (resource && - resource[0] !== '/') { +var _asyncToGenerator2; - var url = Url.parse(resource, false); - resource = url.path; // Includes query - } +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} - var normalized = 'hawk.' + exports.headerVersion + '.' + type + '\n' + - options.ts + '\n' + - options.nonce + '\n' + - (options.method || '').toUpperCase() + '\n' + - resource + '\n' + - options.host.toLowerCase() + '\n' + - options.port + '\n' + - (options.hash || '') + '\n'; +var _errors; - if (options.ext) { - normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n'); - } +function _load_errors() { + return _errors = __webpack_require__(3); +} - normalized += '\n'; +var _registryResolver; - if (options.app) { - normalized += options.app + '\n' + - (options.dlg || '') + '\n'; - } +function _load_registryResolver() { + return _registryResolver = _interopRequireDefault(__webpack_require__(380)); +} - return normalized; -}; +var _npmRegistry; +function _load_npmRegistry() { + return _npmRegistry = _interopRequireDefault(__webpack_require__(42)); +} -exports.calculatePayloadHash = function (payload, algorithm, contentType) { +var _map; - var hash = exports.initializePayloadHash(algorithm, contentType); - hash.update(payload || ''); - return exports.finalizePayloadHash(hash); -}; +function _load_map() { + return _map = _interopRequireDefault(__webpack_require__(24)); +} + +var _fs; +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); +} -exports.initializePayloadHash = function (algorithm, contentType) { +var _constants; - var hash = Crypto.createHash(algorithm); - hash.update('hawk.' + exports.headerVersion + '.payload\n'); - hash.update(Utils.parseContentType(contentType) + '\n'); - return hash; -}; +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 }; } -exports.finalizePayloadHash = function (hash) { +const inquirer = __webpack_require__(148); - hash.update('\n'); - return hash.digest('base64'); -}; +const tty = __webpack_require__(116); +const invariant = __webpack_require__(5); +const path = __webpack_require__(1); +const NPM_REGISTRY = /http[s]:\/\/registry.npmjs.org/g; -exports.calculateTsMac = function (ts, credentials) { +class NpmResolver extends (_registryResolver || _load_registryResolver()).default { - var hmac = Crypto.createHmac(credentials.algorithm, credentials.key); - hmac.update('hawk.' + exports.headerVersion + '.ts\n' + ts + '\n'); - return hmac.digest('base64'); -}; + static findVersionInRegistryResponse(config, range, body, request) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (!body['dist-tags']) { + throw new (_errors || _load_errors()).MessageError(config.reporter.lang('malformedRegistryResponse', body.name)); + } + if (range in body['dist-tags']) { + range = body['dist-tags'][range]; + } -exports.timestampMessage = function (credentials, localtimeOffsetMsec) { + const satisfied = yield config.resolveConstraints(Object.keys(body.versions), range); + if (satisfied) { + return body.versions[satisfied]; + } else if (request && !config.nonInteractive) { + if (request.resolver && request.resolver.activity) { + request.resolver.activity.end(); + } + config.reporter.log(config.reporter.lang('couldntFindVersionThatMatchesRange', body.name, range)); + let pageSize; + if (process.stdout instanceof tty.WriteStream) { + pageSize = process.stdout.rows - 2; + } + const response = yield inquirer.prompt([{ + name: 'package', + type: 'list', + message: config.reporter.lang('chooseVersionFromList', body.name), + choices: Object.keys(body.versions).reverse(), + pageSize + }]); + if (response && response.package) { + return body.versions[response.package]; + } + } + throw new (_errors || _load_errors()).MessageError(config.reporter.lang('couldntFindVersionThatMatchesRange', body.name, range)); + })(); + } - var now = Utils.nowSecs(localtimeOffsetMsec); - var tsm = exports.calculateTsMac(now, credentials); - return { ts: now, tsm: tsm }; -}; + resolveRequest() { + var _this = this; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (_this.config.offline) { + const res = _this.resolveRequestOffline(); + if (res != null) { + return res; + } + } -/***/ }), -/* 146 */ -/***/ (function(module, exports, __webpack_require__) { + const body = yield _this.config.registries.npm.request((_npmRegistry || _load_npmRegistry()).default.escapeName(_this.name)); -/** - * Inquirer.js - * A collection of common interactive command line user interfaces. - */ + if (body) { + return NpmResolver.findVersionInRegistryResponse(_this.config, _this.range, body, _this.request); + } else { + return null; + } + })(); + } -var inquirer = module.exports; + resolveRequestOffline() { + var _this2 = this; -/** - * Client interfaces - */ + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const scope = _this2.config.registries.npm.getScope(_this2.name); + // find modules of this name + const prefix = scope ? _this2.name.split(/\/|%2f/)[1] : `npm-${_this2.name}-`; -inquirer.prompts = {}; + invariant(_this2.config.cacheFolder, 'expected packages root'); + const cacheFolder = path.join(_this2.config.cacheFolder, scope ? 'npm-' + scope : ''); -inquirer.Separator = __webpack_require__(93); + const files = yield _this2.config.getCache('cachedPackages', (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const files = yield (_fs || _load_fs()).readdir(cacheFolder); + const validFiles = []; -inquirer.ui = { - BottomBar: __webpack_require__(519), - Prompt: __webpack_require__(520) -}; + for (const name of files) { + // no hidden files + if (name[0] === '.') { + continue; + } -/** - * Create a new self-contained prompt module. - */ -inquirer.createPromptModule = function (opt) { - var promptModule = function (questions) { - var ui = new inquirer.ui.Prompt(promptModule.prompts, opt); - var promise = ui.run(questions); + // ensure valid module cache + const dir = path.join(cacheFolder, name); + if (yield _this2.config.isValidModuleDest(dir)) { + validFiles.push(name); + } + } - // Monkey patch the UI on the promise object so - // that it remains publicly accessible. - promise.ui = ui; + return validFiles; + })); - return promise; - }; - promptModule.prompts = {}; + const versions = (0, (_map || _load_map()).default)(); - /** - * Register a prompt type - * @param {String} name Prompt type name - * @param {Function} prompt Prompt constructor - * @return {inquirer} - */ + for (const name of files) { + // check if folder starts with our prefix + if (name.indexOf(prefix) !== 0) { + continue; + } - promptModule.registerPrompt = function (name, prompt) { - promptModule.prompts[name] = prompt; - return this; - }; + const dir = path.join(cacheFolder, name); - /** - * Register the defaults provider prompts - */ + // read manifest and validate correct name + const pkg = yield _this2.config.readManifest(dir, 'npm'); + if (pkg.name !== _this2.name) { + continue; + } - promptModule.restoreDefaultPrompts = function () { - this.registerPrompt('list', __webpack_require__(516)); - this.registerPrompt('input', __webpack_require__(515)); - this.registerPrompt('confirm', __webpack_require__(512)); - this.registerPrompt('rawlist', __webpack_require__(518)); - this.registerPrompt('expand', __webpack_require__(514)); - this.registerPrompt('checkbox', __webpack_require__(511)); - this.registerPrompt('password', __webpack_require__(517)); - this.registerPrompt('editor', __webpack_require__(513)); - }; + // read package metadata + const metadata = yield _this2.config.readPackageMetadata(dir); + if (!metadata.remote) { + continue; // old yarn metadata + } - promptModule.restoreDefaultPrompts(); + versions[pkg.version] = Object.assign({}, pkg, { + _remote: metadata.remote + }); + } - return promptModule; -}; + const satisfied = yield _this2.config.resolveConstraints(Object.keys(versions), _this2.range); + if (satisfied) { + return versions[satisfied]; + } else if (!_this2.config.preferOffline) { + throw new (_errors || _load_errors()).MessageError(_this2.reporter.lang('couldntFindPackageInCache', _this2.name, _this2.range, Object.keys(versions).join(', '))); + } else { + return null; + } + })(); + } -/** - * Public CLI helper interface - * @param {Array|Object|rx.Observable} questions - Questions settings array - * @param {Function} cb - Callback being passed the user answers - * @return {inquirer.ui.Prompt} - */ + cleanRegistry(url) { + if (this.config.getOption('registry') === (_constants || _load_constants()).YARN_REGISTRY) { + return url.replace(NPM_REGISTRY, (_constants || _load_constants()).YARN_REGISTRY); + } else { + return url; + } + } -inquirer.prompt = inquirer.createPromptModule(); + resolve() { + var _this3 = this; -// Expose helper functions on the top level for easiest usage by common users -inquirer.registerPrompt = function (name, prompt) { - inquirer.prompt.registerPrompt(name, prompt); -}; -inquirer.restoreDefaultPrompts = function () { - inquirer.prompt.restoreDefaultPrompts(); -}; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // lockfile + const shrunk = _this3.request.getLocked('tarball'); + if (shrunk) { + return shrunk; + } + const info = yield _this3.resolveRequest(); + if (info == null) { + throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('packageNotFoundRegistry', _this3.name, 'npm')); + } -/***/ }), -/* 147 */ -/***/ (function(module, exports, __webpack_require__) { + const deprecated = info.deprecated, + dist = info.dist; -"use strict"; + if (typeof deprecated === 'string') { + let human = `${info.name}@${info.version}`; + const parentNames = _this3.request.getParentNames(); + if (parentNames.length) { + human = parentNames.concat(human).join(' > '); + } + _this3.reporter.warn(`${human}: ${deprecated}`); + } + if (dist != null && dist.tarball) { + info._remote = { + resolved: `${_this3.cleanRegistry(dist.tarball)}#${dist.shasum}`, + type: 'tarball', + reference: _this3.cleanRegistry(dist.tarball), + hash: dist.shasum, + registry: 'npm', + packageName: info.name + }; + } -module.exports = __webpack_require__(398).isCI + info._uid = info.version; + return info; + })(); + } +} +exports.default = NpmResolver; +NpmResolver.registry = 'npm'; /***/ }), -/* 148 */ +/* 125 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -/* - * Copyright (c) 2014 Mega Limited - * under the MIT License. - * - * Authors: Guy K. Kloss - * - * You should have received a copy of the license along with this program. - */ - -var dh = __webpack_require__(536); -var eddsa = __webpack_require__(537); -var curve255 = __webpack_require__(149); -var utils = __webpack_require__(98); - - /** - * @exports jodid25519 - * Curve 25519-based cryptography collection. - * - * @description - * EC Diffie-Hellman (ECDH) based on Curve25519 and digital signatures - * (EdDSA) based on Ed25519. - */ - var ns = {}; - - /** Module version indicator as string (format: [major.minor.patch]). */ - ns.VERSION = '0.7.1'; - - ns.dh = dh; - ns.eddsa = eddsa; - ns.curve255 = curve255; - ns.utils = utils; - -module.exports = ns; +Object.defineProperty(exports, "__esModule", { + value: true +}); +var _slicedToArray2; -/***/ }), -/* 149 */ -/***/ (function(module, exports, __webpack_require__) { +function _load_slicedToArray() { + return _slicedToArray2 = _interopRequireDefault(__webpack_require__(12)); +} -"use strict"; +var _asyncToGenerator2; -/** - * @fileOverview - * Core operations on curve 25519 required for the higher level modules. - */ +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} -/* - * Copyright (c) 2007, 2013, 2014 Michele Bini - * Copyright (c) 2014 Mega Limited - * under the MIT License. - * - * Authors: Guy K. Kloss, Michele Bini - * - * You should have received a copy of the license along with this program. - */ +var _errors; -var core = __webpack_require__(97); -var utils = __webpack_require__(98); +function _load_errors() { + return _errors = __webpack_require__(3); +} - /** - * @exports jodid25519/curve255 - * Legacy compatibility module for Michele Bini's previous curve255.js. - * - * @description - * Legacy compatibility module for Michele Bini's previous curve255.js. - * - *

- * This code presents an API with all key formats as previously available - * from Michele Bini's curve255.js implementation. - *

- */ - var ns = {}; +var _misc; - function curve25519_raw(f, c) { - var a, x_1, q; +function _load_misc() { + return _misc = __webpack_require__(10); +} - x_1 = c; - a = core.dbl(x_1, core.ONE()); - q = [x_1, core.ONE()]; +var _crypto; - var n = 255; +function _load_crypto() { + return _crypto = _interopRequireWildcard(__webpack_require__(85)); +} - while (core.getbit(f, n) == 0) { - n--; - // For correct constant-time operation, bit 255 should always be - // set to 1 so the following 'while' loop is never entered. - if (n < 0) { - return core.ZERO(); - } - } - n--; +var _child; - var aq = [a, q]; +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(44)); +} - while (n >= 0) { - var r, s; - var b = core.getbit(f, n); - r = core.sum(aq[0][0], aq[0][1], aq[1][0], aq[1][1], x_1); - s = core.dbl(aq[1 - b][0], aq[1 - b][1]); - aq[1 - b] = s; - aq[b] = r; - n--; - } - q = aq[1]; +var _fs; - q[1] = core.invmodp(q[1]); - q[0] = core.mulmodp(q[0], q[1]); - core.reduce(q[0]); - return q[0]; - } +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); +} - function curve25519b32(a, b) { - return _base32encode(curve25519(_base32decode(a), - _base32decode(b))); - } +var _map; - function curve25519(f, c) { - if (!c) { - c = core.BASE(); - } - f[0] &= 0xFFF8; - f[15] = (f[15] & 0x7FFF) | 0x4000; - return curve25519_raw(f, c); - } +function _load_map() { + return _map = _interopRequireDefault(__webpack_require__(24)); +} - function _hexEncodeVector(k) { - var hexKey = utils.hexEncode(k); - // Pad with '0' at the front. - hexKey = new Array(64 + 1 - hexKey.length).join('0') + hexKey; - // Invert bytes. - return hexKey.split(/(..)/).reverse().join(''); - } +var _fs2; - function _hexDecodeVector(v) { - // assert(length(x) == 64); - // Invert bytes. - var hexKey = v.split(/(..)/).reverse().join(''); - return utils.hexDecode(hexKey); - } +function _load_fs2() { + return _fs2 = __webpack_require__(6); +} +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; } } - // Expose some functions to the outside through this name space. +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - /** - * Computes the scalar product of a point on the curve 25519. - * - * This function is used for the DH key-exchange protocol. - * - * Before multiplication, some bit operations are applied to the - * private key to ensure it is a valid Curve25519 secret key. - * It is the user's responsibility to make sure that the private - * key is a uniformly random, secret value. - * - * @function - * @param f {array} - * Private key. - * @param c {array} - * Public point on the curve. If not given, the curve's base point is used. - * @returns {array} - * Key point resulting from scalar product. - */ - ns.curve25519 = curve25519; +const invariant = __webpack_require__(5); +const semver = __webpack_require__(26); +const StringDecoder = __webpack_require__(164).StringDecoder; +const tarFs = __webpack_require__(109); +const tarStream = __webpack_require__(268); +const url = __webpack_require__(11); - /** - * Computes the scalar product of a point on the curve 25519. - * - * This variant does not make sure that the private key is valid. - * The user has the responsibility to ensure the private key is - * valid or that this results in a safe protocol. Unless you know - * exactly what you are doing, you should not use this variant, - * please use 'curve25519' instead. - * - * @function - * @param f {array} - * Private key. - * @param c {array} - * Public point on the curve. If not given, the curve's base point is used. - * @returns {array} - * Key point resulting from scalar product. - */ - ns.curve25519_raw = curve25519_raw; - /** - * Encodes the internal representation of a key to a canonical hex - * representation. - * - * This is the format commonly used in other libraries and for - * test vectors, and is equivalent to the hex dump of the key in - * little-endian binary format. - * - * @function - * @param n {array} - * Array representation of key. - * @returns {string} - * Hexadecimal string representation of key. - */ - ns.hexEncodeVector = _hexEncodeVector; +const supportsArchiveCache = (0, (_map || _load_map()).default)({ + 'github.com': false }); - /** - * Decodes a canonical hex representation of a key - * to an internally compatible array representation. - * - * @function - * @param n {string} - * Hexadecimal string representation of key. - * @returns {array} - * Array representation of key. - */ - ns.hexDecodeVector = _hexDecodeVector; +// This regex is designed to match output from git of the style: +// ebeb6eafceb61dd08441ffe086c77eb472842494 refs/tags/v0.21.0 +// and extract the hash and tag name as capture groups +const gitRefLineRegex = /^([a-fA-F0-9]+)\s+(?:[^/]+\/){2}(.*)$/; - /** - * Encodes the internal representation of a key into a - * hexadecimal representation. - * - * This is a strict positional notation, most significant digit first. - * - * @function - * @param n {array} - * Array representation of key. - * @returns {string} - * Hexadecimal string representation of key. - */ - ns.hexencode = utils.hexEncode; +class Git { + constructor(config, gitUrl, hash) { + this.supportsArchive = false; + this.fetched = false; + this.config = config; + this.reporter = config.reporter; + this.hash = hash; + this.ref = hash; + this.gitUrl = gitUrl; + this.cwd = this.config.getTemp((_crypto || _load_crypto()).hash(this.gitUrl.repository)); + } - /** - * Decodes a hex representation of a key to an internally - * compatible array representation. - * - * @function - * @param n {string} - * Hexadecimal string representation of key. - * @returns {array} - * Array representation of key. - */ - ns.hexdecode = utils.hexDecode; + /** + * npm URLs contain a 'git+' scheme prefix, which is not understood by git. + * git "URLs" also allow an alternative scp-like syntax, so they're not standard URLs. + */ + static npmUrlToGitUrl(npmUrl) { + // Expand shortened format first if needed + npmUrl = npmUrl.replace(/^github:/, 'git+ssh://git@github.com/'); - /** - * Encodes the internal representation of a key to a base32 - * representation. - * - * @function - * @param n {array} - * Array representation of key. - * @returns {string} - * Base32 string representation of key. - */ - ns.base32encode = utils.base32encode; + // Special case in npm, where ssh:// prefix is stripped to pass scp-like syntax + // which in git works as remote path only if there are no slashes before ':'. + const match = npmUrl.match(/^git\+ssh:\/\/((?:[^@:\/]+@)?([^@:\/]+):([^/]*).*)/); + // Additionally, if the host part is digits-only, npm falls back to + // interpreting it as an SSH URL with a port number. + if (match && /[^0-9]/.test(match[3])) { + return { + hostname: match[2], + protocol: 'ssh:', + repository: match[1] + }; + } - /** - * Decodes a base32 representation of a key to an internally - * compatible array representation. - * - * @function - * @param n {string} - * Base32 string representation of key. - * @returns {array} - * Array representation of key. - */ - ns.base32decode = utils.base32decode; + const repository = npmUrl.replace(/^git\+/, ''); + const parsed = url.parse(repository); + return { + hostname: parsed.hostname || null, + protocol: parsed.protocol || 'file:', + repository + }; + } -module.exports = ns; + /** + * Check if the host specified in the input `gitUrl` has archive capability. + */ + static hasArchiveCapability(ref) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const hostname = ref.hostname; + if (ref.protocol !== 'ssh:' || hostname == null) { + return false; + } -/***/ }), -/* 150 */ -/***/ (function(module, exports, __webpack_require__) { + if (hostname in supportsArchiveCache) { + return supportsArchiveCache[hostname]; + } -var json = typeof JSON !== 'undefined' ? JSON : __webpack_require__(540); + try { + yield (_child || _load_child()).spawn('git', ['archive', `--remote=${ref.repository}`, 'HEAD', Date.now() + '']); + throw new Error(); + } catch (err) { + const supports = err.message.indexOf('did not match any files') >= 0; + return supportsArchiveCache[hostname] = supports; + } + })(); + } -module.exports = function (obj, opts) { - if (!opts) opts = {}; - if (typeof opts === 'function') opts = { cmp: opts }; - var space = opts.space || ''; - if (typeof space === 'number') space = Array(space+1).join(' '); - var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; - var replacer = opts.replacer || function(key, value) { return value; }; + /** + * Check if the input `target` is a 5-40 character hex commit hash. + */ - var cmp = opts.cmp && (function (f) { - return function (node) { - return function (a, b) { - var aobj = { key: a, value: node[a] }; - var bobj = { key: b, value: node[b] }; - return f(aobj, bobj); - }; - }; - })(opts.cmp); + static isCommitHash(target) { + return !!target && /^[a-f0-9]{5,40}$/.test(target); + } - var seen = []; - return (function stringify (parent, key, node, level) { - var indent = space ? ('\n' + new Array(level + 1).join(space)) : ''; - var colonSeparator = space ? ': ' : ':'; + static repoExists(ref) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + try { + yield (_child || _load_child()).spawn('git', ['ls-remote', '-t', ref.repository]); + return true; + } catch (err) { + return false; + } + })(); + } - if (node && node.toJSON && typeof node.toJSON === 'function') { - node = node.toJSON(); - } + static replaceProtocol(ref, protocol) { + return { + hostname: ref.hostname, + protocol, + repository: ref.repository.replace(/^(?:git|http):/, protocol) + }; + } - node = replacer.call(parent, key, node); + /** + * Attempt to upgrade insecure protocols to secure protocol + */ + static secureGitUrl(ref, hash, reporter) { + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (Git.isCommitHash(hash)) { + // this is cryptographically secure + return ref; + } - if (node === undefined) { - return; - } - if (typeof node !== 'object' || node === null) { - return json.stringify(node); - } - if (isArray(node)) { - var out = []; - for (var i = 0; i < node.length; i++) { - var item = stringify(node, i, node[i], level+1) || json.stringify(null); - out.push(indent + space + item); - } - return '[' + out.join(',') + indent + ']'; + if (ref.protocol === 'git:') { + const secureUrl = Git.replaceProtocol(ref, 'https:'); + if (yield Git.repoExists(secureUrl)) { + return secureUrl; + } else { + throw new (_errors || _load_errors()).SecurityError(reporter.lang('refusingDownloadGitWithoutCommit', ref)); } - else { - if (seen.indexOf(node) !== -1) { - if (cycles) return json.stringify('__cycle__'); - throw new TypeError('Converting circular structure to JSON'); - } - else seen.push(node); - - var keys = objectKeys(node).sort(cmp && cmp(node)); - var out = []; - for (var i = 0; i < keys.length; i++) { - var key = keys[i]; - var value = stringify(node, key, node[key], level+1); + } - if(!value) continue; + if (ref.protocol === 'http:') { + const secureRef = Git.replaceProtocol(ref, 'https:'); + if (yield Git.repoExists(secureRef)) { + return secureRef; + } else { + if (yield Git.repoExists(ref)) { + return ref; + } else { + throw new (_errors || _load_errors()).SecurityError(reporter.lang('refusingDownloadHTTPWithoutCommit', ref)); + } + } + } - var keyValue = json.stringify(key) - + colonSeparator - + value; - ; - out.push(indent + space + keyValue); - } - seen.splice(seen.indexOf(node), 1); - return '{' + out.join(',') + indent + '}'; + if (ref.protocol === 'https:') { + if (yield Git.repoExists(ref)) { + return ref; + } else { + throw new (_errors || _load_errors()).SecurityError(reporter.lang('refusingDownloadHTTPSWithoutCommit', ref)); } - })({ '': obj }, '', obj, 0); -}; + } -var isArray = Array.isArray || function (x) { - return {}.toString.call(x) === '[object Array]'; -}; + return ref; + })(); + } -var objectKeys = Object.keys || function (obj) { - var has = Object.prototype.hasOwnProperty || function () { return true }; - var keys = []; - for (var key in obj) { - if (has.call(obj, key)) keys.push(key); - } - return keys; -}; + /** + * Archive a repo to destination + */ + archive(dest) { + if (this.supportsArchive) { + return this._archiveViaRemoteArchive(dest); + } else { + return this._archiveViaLocalFetched(dest); + } + } -/***/ }), -/* 151 */ -/***/ (function(module, exports, __webpack_require__) { + _archiveViaRemoteArchive(dest) { + var _this = this; -var isBuffer = __webpack_require__(525); -var toString = Object.prototype.toString; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const hashStream = new (_crypto || _load_crypto()).HashStream(); + yield (_child || _load_child()).spawn('git', ['archive', `--remote=${_this.gitUrl.repository}`, _this.ref], { + process(proc, resolve, reject, done) { + const writeStream = (0, (_fs2 || _load_fs2()).createWriteStream)(dest); + proc.on('error', reject); + writeStream.on('error', reject); + writeStream.on('end', done); + writeStream.on('open', function () { + proc.stdout.pipe(hashStream).pipe(writeStream); + }); + writeStream.once('finish', done); + } + }); + return hashStream.getHash(); + })(); + } -/** - * Get the native `typeof` a value. - * - * @param {*} `val` - * @return {*} Native javascript type - */ + _archiveViaLocalFetched(dest) { + var _this2 = this; -module.exports = function kindOf(val) { - // primitivies - if (typeof val === 'undefined') { - return 'undefined'; - } - if (val === null) { - return 'null'; - } - if (val === true || val === false || val instanceof Boolean) { - return 'boolean'; - } - if (typeof val === 'string' || val instanceof String) { - return 'string'; - } - if (typeof val === 'number' || val instanceof Number) { - return 'number'; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const hashStream = new (_crypto || _load_crypto()).HashStream(); + yield (_child || _load_child()).spawn('git', ['archive', _this2.hash], { + cwd: _this2.cwd, + process(proc, resolve, reject, done) { + const writeStream = (0, (_fs2 || _load_fs2()).createWriteStream)(dest); + proc.on('error', reject); + writeStream.on('error', reject); + writeStream.on('open', function () { + proc.stdout.pipe(hashStream).pipe(writeStream); + }); + writeStream.once('finish', done); + } + }); + return hashStream.getHash(); + })(); } - // functions - if (typeof val === 'function' || val instanceof Function) { - return 'function'; - } + /** + * Clone a repo to the input `dest`. Use `git archive` if it's available, otherwise fall + * back to `git clone`. + */ - // array - if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { - return 'array'; + clone(dest) { + if (this.supportsArchive) { + return this._cloneViaRemoteArchive(dest); + } else { + return this._cloneViaLocalFetched(dest); + } } - // check for instances of RegExp and Date before calling `toString` - if (val instanceof RegExp) { - return 'regexp'; - } - if (val instanceof Date) { - return 'date'; - } + _cloneViaRemoteArchive(dest) { + var _this3 = this; - // other objects - var type = toString.call(val); + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + yield (_child || _load_child()).spawn('git', ['archive', `--remote=${_this3.gitUrl.repository}`, _this3.ref], { + process(proc, update, reject, done) { + const extractor = tarFs.extract(dest, { + dmode: 0o555, // all dirs should be readable + fmode: 0o444 }); + extractor.on('error', reject); + extractor.on('finish', done); - if (type === '[object RegExp]') { - return 'regexp'; - } - if (type === '[object Date]') { - return 'date'; - } - if (type === '[object Arguments]') { - return 'arguments'; - } - if (type === '[object Error]') { - return 'error'; + proc.stdout.pipe(extractor); + proc.on('error', reject); + } + }); + })(); } - // buffer - if (typeof Buffer !== 'undefined' && isBuffer(val)) { - return 'buffer'; - } + _cloneViaLocalFetched(dest) { + var _this4 = this; - // es6: Map, WeakMap, Set, WeakSet - if (type === '[object Set]') { - return 'set'; - } - if (type === '[object WeakSet]') { - return 'weakset'; - } - if (type === '[object Map]') { - return 'map'; - } - if (type === '[object WeakMap]') { - return 'weakmap'; - } - if (type === '[object Symbol]') { - return 'symbol'; - } + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + yield (_child || _load_child()).spawn('git', ['archive', _this4.hash], { + cwd: _this4.cwd, + process(proc, resolve, reject, done) { + const extractor = tarFs.extract(dest, { + dmode: 0o555, // all dirs should be readable + fmode: 0o444 }); - // typed arrays - if (type === '[object Int8Array]') { - return 'int8array'; - } - if (type === '[object Uint8Array]') { - return 'uint8array'; - } - if (type === '[object Uint8ClampedArray]') { - return 'uint8clampedarray'; - } - if (type === '[object Int16Array]') { - return 'int16array'; - } - if (type === '[object Uint16Array]') { - return 'uint16array'; - } - if (type === '[object Int32Array]') { - return 'int32array'; - } - if (type === '[object Uint32Array]') { - return 'uint32array'; - } - if (type === '[object Float32Array]') { - return 'float32array'; - } - if (type === '[object Float64Array]') { - return 'float64array'; + extractor.on('error', reject); + extractor.on('finish', done); + + proc.stdout.pipe(extractor); + } + }); + })(); } - // must be a plain object - return 'object'; -}; + /** + * Clone this repo. + */ + fetch() { + var _this5 = this; -/***/ }), -/* 152 */ -/***/ (function(module, exports, __webpack_require__) { + const gitUrl = this.gitUrl, + cwd = this.cwd; -"use strict"; + return (_fs || _load_fs()).lockQueue.push(gitUrl.repository, (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + if (yield (_fs || _load_fs()).exists(cwd)) { + yield (_child || _load_child()).spawn('git', ['pull'], { cwd }); + } else { + yield (_child || _load_child()).spawn('git', ['clone', gitUrl.repository, cwd]); + } -var win32 = process && process.platform === 'win32'; -var path = __webpack_require__(1); -var fileRe = __webpack_require__(460); -var utils = module.exports; + _this5.fetched = true; + })); + } -/** - * Module dependencies - */ + /** + * Given a list of tags/branches from git, check if they match an input range. + */ -utils.diff = __webpack_require__(310); -utils.unique = __webpack_require__(313); -utils.braces = __webpack_require__(392); -utils.brackets = __webpack_require__(452); -utils.extglob = __webpack_require__(459); -utils.isExtglob = __webpack_require__(95); -utils.isGlob = __webpack_require__(96); -utils.typeOf = __webpack_require__(151); -utils.normalize = __webpack_require__(556); -utils.omit = __webpack_require__(558); -utils.parseGlob = __webpack_require__(561); -utils.cache = __webpack_require__(576); + findResolution(range, tags) { + var _this6 = this; -/** - * Get the filename of a filepath - * - * @param {String} `string` - * @return {String} - */ + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // If there are no tags and target is *, fallback to the latest commit on master + // or if we have no target. + if (!range || !tags.length && range === '*') { + return 'master'; + } -utils.filename = function filename(fp) { - var seg = fp.match(fileRe()); - return seg && seg[0]; -}; + return (yield _this6.config.resolveConstraints(tags.filter(function (tag) { + return !!semver.valid(tag, _this6.config.looseSemver); + }), range)) || range; + })(); + } -/** - * Returns a function that returns true if the given - * pattern is the same as a given `filepath` - * - * @param {String} `pattern` - * @return {Function} - */ + /** + * Fetch the file by cloning the repo and reading it. + */ -utils.isPath = function isPath(pattern, opts) { - opts = opts || {}; - return function(fp) { - var unixified = utils.unixify(fp, opts); - if(opts.nocase){ - return pattern.toLowerCase() === unixified.toLowerCase(); + getFile(filename) { + if (this.supportsArchive) { + return this._getFileFromArchive(filename); + } else { + return this._getFileFromClone(filename); } - return pattern === unixified; - }; -}; + } -/** - * Returns a function that returns true if the given - * pattern contains a `filepath` - * - * @param {String} `pattern` - * @return {Function} - */ + _getFileFromArchive(filename) { + var _this7 = this; -utils.hasPath = function hasPath(pattern, opts) { - return function(fp) { - return utils.unixify(pattern, opts).indexOf(fp) !== -1; - }; -}; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + try { + return yield (_child || _load_child()).spawn('git', ['archive', `--remote=${_this7.gitUrl.repository}`, _this7.ref, filename], { + process(proc, update, reject, done) { + const parser = tarStream.extract(); -/** - * Returns a function that returns true if the given - * pattern matches or contains a `filepath` - * - * @param {String} `pattern` - * @return {Function} - */ + parser.on('error', reject); + parser.on('finish', done); -utils.matchPath = function matchPath(pattern, opts) { - var fn = (opts && opts.contains) - ? utils.hasPath(pattern, opts) - : utils.isPath(pattern, opts); - return fn; -}; + parser.on('entry', (header, stream, next) => { + const decoder = new StringDecoder('utf8'); + let fileContent = ''; -/** - * Returns a function that returns true if the given - * regex matches the `filename` of a file path. - * - * @param {RegExp} `re` - * @return {Boolean} - */ + stream.on('data', buffer => { + fileContent += decoder.write(buffer); + }); + stream.on('end', () => { + // $FlowFixMe: suppressing this error due to bug https://github.com/facebook/flow/pull/3483 + const remaining = decoder.end(); + update(fileContent + remaining); + next(); + }); + stream.resume(); + }); + + proc.stdout.pipe(parser); + } + }); + } catch (err) { + if (err.message.indexOf('did not match any files') >= 0) { + return false; + } else { + throw err; + } + } + })(); + } -utils.hasFilename = function hasFilename(re) { - return function(fp) { - var name = utils.filename(fp); - return name && re.test(name); - }; -}; + _getFileFromClone(filename) { + var _this8 = this; -/** - * Coerce `val` to an array - * - * @param {*} val - * @return {Array} - */ + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + invariant(_this8.fetched, 'Repo not fetched'); -utils.arrayify = function arrayify(val) { - return !Array.isArray(val) - ? [val] - : val; -}; + try { + return yield (_child || _load_child()).spawn('git', ['show', `${_this8.hash}:${filename}`], { + cwd: _this8.cwd + }); + } catch (err) { + // file doesn't exist + return false; + } + })(); + } -/** - * Normalize all slashes in a file path or glob pattern to - * forward slashes. - */ + /** + * Initialize the repo, find a secure url to use and + * set the ref to match an input `target`. + */ + init() { + var _this9 = this; -utils.unixify = function unixify(fp, opts) { - if (opts && opts.unixify === false) return fp; - if (opts && opts.unixify === true || win32 || path.sep === '\\') { - return utils.normalize(fp, false); - } - if (opts && opts.unescape === true) { - return fp ? fp.toString().replace(/\\(\w)/g, '$1') : ''; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + _this9.gitUrl = yield Git.secureGitUrl(_this9.gitUrl, _this9.hash, _this9.reporter); + // check capabilities + if (yield Git.hasArchiveCapability(_this9.gitUrl)) { + _this9.supportsArchive = true; + } else { + yield _this9.fetch(); + } + + return _this9.setRefRemote(); + })(); } - return fp; -}; -/** - * Escape/unescape utils - */ + setRefRemote() { + var _this10 = this; -utils.escapePath = function escapePath(fp) { - return fp.replace(/[\\.]/g, '\\$&'); -}; + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const stdout = yield (_child || _load_child()).spawn('git', ['ls-remote', '--tags', '--heads', _this10.gitUrl.repository]); + const refs = Git.parseRefs(stdout); + return _this10.setRef(refs); + })(); + } -utils.unescapeGlob = function unescapeGlob(fp) { - return fp.replace(/[\\"']/g, ''); -}; + /** + * TODO description + */ -utils.escapeRe = function escapeRe(str) { - return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&'); -}; + setRef(refs) { + var _this11 = this; -/** - * Expose `utils` - */ + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // get commit ref + const hash = _this11.hash; -module.exports = utils; + const names = Object.keys(refs); -/***/ }), -/* 153 */ -/***/ (function(module, exports, __webpack_require__) { + if (Git.isCommitHash(hash)) { + for (const name in refs) { + if (refs[name] === hash) { + _this11.ref = name; + return hash; + } + } -module.exports = minimatch -minimatch.Minimatch = Minimatch + // `git archive` only accepts a treeish and we have no ref to this commit + _this11.supportsArchive = false; -var path = { sep: '/' } -try { - path = __webpack_require__(1) -} catch (er) {} + if (!_this11.fetched) { + // in fact, `git archive` can't be used, and we haven't fetched the project yet. Do it now. + yield _this11.fetch(); + } + return _this11.ref = _this11.hash = hash; + } -var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} -var expand = __webpack_require__(391) + const ref = yield _this11.findResolution(hash, names); + const commit = refs[ref]; + if (commit) { + _this11.ref = ref; + return _this11.hash = commit; + } else { + throw new (_errors || _load_errors()).MessageError(_this11.reporter.lang('couldntFindMatch', ref, names.join(','), _this11.gitUrl.repository)); + } + })(); + } -var plTypes = { - '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, - '?': { open: '(?:', close: ')?' }, - '+': { open: '(?:', close: ')+' }, - '*': { open: '(?:', close: ')*' }, - '@': { open: '(?:', close: ')' } -} + /** + * Parse Git ref lines into hash of tag names to SHA hashes + */ -// any single thing other than / -// don't need to escape / when using new RegExp() -var qmark = '[^/]' + static parseRefs(stdout) { + // store references + const refs = {}; -// * => any number of characters -var star = qmark + '*?' + // line delimited + const refLines = stdout.split('\n'); -// ** when dots are allowed. Anything goes, except .. and . -// not (^ or / followed by one or two dots followed by $ or /), -// followed by anything, any number of times. -var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + for (const line of refLines) { + const match = gitRefLineRegex.exec(line); -// not a ^ or / followed by a dot, -// followed by anything, any number of times. -var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + if (match) { + var _match = (0, (_slicedToArray2 || _load_slicedToArray()).default)(match, 3); -// characters that need to be escaped in RegExp. -var reSpecials = charSet('().*{}+?[]^$\\!') + const sha = _match[1], + tagName = _match[2]; -// "abc" -> { a:true, b:true, c:true } -function charSet (s) { - return s.split('').reduce(function (set, c) { - set[c] = true - return set - }, {}) -} + // As documented in gitrevisions: + // https://www.kernel.org/pub/software/scm/git/docs/gitrevisions.html#_specifying_revisions + // "A suffix ^ followed by an empty brace pair means the object could be a tag, + // and dereference the tag recursively until a non-tag object is found." + // In other words, the hash without ^{} is the hash of the tag, + // and the hash with ^{} is the hash of the commit at which the tag was made. -// normalizes slashes. -var slashSplit = /\/+/ + const name = (0, (_misc || _load_misc()).removeSuffix)(tagName, '^{}'); -minimatch.filter = filter -function filter (pattern, options) { - options = options || {} - return function (p, i, list) { - return minimatch(p, pattern, options) + refs[name] = sha; + } + } + + return refs; } } +exports.default = Git; -function ext (a, b) { - a = a || {} - b = b || {} - var t = {} - Object.keys(b).forEach(function (k) { - t[k] = b[k] - }) - Object.keys(a).forEach(function (k) { - t[k] = a[k] - }) - return t -} +/***/ }), +/* 126 */ +/***/ (function(module, exports, __webpack_require__) { -minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return minimatch +"use strict"; - var orig = minimatch - var m = function minimatch (p, pattern, options) { - return orig.minimatch(p, pattern, ext(def, options)) - } +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.isValidLicense = isValidLicense; +exports.stringifyPerson = stringifyPerson; +exports.parsePerson = parsePerson; +exports.normalizePerson = normalizePerson; +exports.extractDescription = extractDescription; +exports.extractRepositoryUrl = extractRepositoryUrl; - m.Minimatch = function Minimatch (pattern, options) { - return new orig.Minimatch(pattern, ext(def, options)) - } - return m -} +const validateLicense = __webpack_require__(634); -Minimatch.defaults = function (def) { - if (!def || !Object.keys(def).length) return Minimatch - return minimatch.defaults(def).Minimatch +function isValidLicense(license) { + return !!license && validateLicense(license).validForNewPackages; } -function minimatch (p, pattern, options) { - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') +function stringifyPerson(person) { + if (!person || typeof person !== 'object') { + return person; } - if (!options) options = {} + const parts = []; + if (person.name) { + parts.push(person.name); + } - // shortcut: comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - return false + const email = person.email || person.mail; + if (typeof email === 'string') { + parts.push(`<${email}>`); } - // "" only matches "" - if (pattern.trim() === '') return p === '' + const url = person.url || person.web; + if (typeof url === 'string') { + parts.push(`(${url})`); + } - return new Minimatch(pattern, options).match(p) + return parts.join(' '); } -function Minimatch (pattern, options) { - if (!(this instanceof Minimatch)) { - return new Minimatch(pattern, options) +function parsePerson(person) { + if (typeof person !== 'string') { + return person; } - if (typeof pattern !== 'string') { - throw new TypeError('glob pattern string required') - } + // format: name (url) + const obj = {}; - if (!options) options = {} - pattern = pattern.trim() + let name = person.match(/^([^\(<]+)/); + if (name) { + name = name[0].trim(); + if (name) { + obj.name = name; + } + } - // windows support: need to use /, not \ - if (path.sep !== '/') { - pattern = pattern.split(path.sep).join('/') + const email = person.match(/<([^>]+)>/); + if (email) { + obj.email = email[1]; } - this.options = options - this.set = [] - this.pattern = pattern - this.regexp = null - this.negate = false - this.comment = false - this.empty = false + const url = person.match(/\(([^\)]+)\)/); + if (url) { + obj.url = url[1]; + } - // make the set of regexps etc. - this.make() + return obj; } -Minimatch.prototype.debug = function () {} - -Minimatch.prototype.make = make -function make () { - // don't do it more than once. - if (this._made) return - - var pattern = this.pattern - var options = this.options +function normalizePerson(person) { + return parsePerson(stringifyPerson(person)); +} - // empty patterns and comments match nothing. - if (!options.nocomment && pattern.charAt(0) === '#') { - this.comment = true - return - } - if (!pattern) { - this.empty = true - return +function extractDescription(readme) { + if (typeof readme !== 'string' || readme === '') { + return undefined; } - // step 1: figure out negation, etc. - this.parseNegate() + // split into lines + const lines = readme.trim().split('\n').map(line => line.trim()); - // step 2: expand braces - var set = this.globSet = this.braceExpand() + // find the start of the first paragraph, ignore headings + let start = 0; + for (; start < lines.length; start++) { + const line = lines[start]; + if (line && line.match(/^(#|$)/)) { + // line isn't empty and isn't a heading so this is the start of a paragraph + start++; + break; + } + } - if (options.debug) this.debug = console.error + // skip newlines from the header to the first line + while (start < lines.length && !lines[start]) { + start++; + } - this.debug(this.pattern, set) + // continue to the first non empty line + let end = start; + while (end < lines.length && lines[end]) { + end++; + } - // step 3: now we have a set, so turn each one into a series of path-portion - // matching patterns. - // These will be regexps, except in the case of "**", which is - // set to the GLOBSTAR object for globstar behavior, - // and will not contain any / characters - set = this.globParts = set.map(function (s) { - return s.split(slashSplit) - }) + return lines.slice(start, end).join(' '); +} - this.debug(this.pattern, set) +function extractRepositoryUrl(repository) { + if (!repository || typeof repository !== 'object') { + return repository; + } + return repository.url; +} - // glob --> regexps - set = set.map(function (s, si, set) { - return s.map(this.parse, this) - }, this) +/***/ }), +/* 127 */ +/***/ (function(module, exports, __webpack_require__) { - this.debug(this.pattern, set) +"use strict"; - // filter out everything that didn't compile properly. - set = set.filter(function (s) { - return s.indexOf(false) === -1 - }) - this.debug(this.pattern, set) +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.explodeHashedUrl = explodeHashedUrl; +function explodeHashedUrl(url) { + const parts = url.split('#'); - this.set = set + return { + hash: parts[1] || '', + url: parts[0] + }; } -Minimatch.prototype.parseNegate = parseNegate -function parseNegate () { - var pattern = this.pattern - var negate = false - var options = this.options - var negateOffset = 0 +/***/ }), +/* 128 */ +/***/ (function(module, exports, __webpack_require__) { - if (options.nonegate) return +"use strict"; - for (var i = 0, l = pattern.length - ; i < l && pattern.charAt(i) === '!' - ; i++) { - negate = !negate - negateOffset++ - } - if (negateOffset) this.pattern = pattern.substr(negateOffset) - this.negate = negate +var buffer = __webpack_require__(76); +var Buffer = buffer.Buffer; +var SlowBuffer = buffer.SlowBuffer; +var MAX_LEN = buffer.kMaxLength || 2147483647; +exports.alloc = function alloc(size, fill, encoding) { + if (typeof Buffer.alloc === 'function') { + return Buffer.alloc(size, fill, encoding); + } + if (typeof encoding === 'number') { + throw new TypeError('encoding must not be number'); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + var enc = encoding; + var _fill = fill; + if (_fill === undefined) { + enc = undefined; + _fill = 0; + } + var buf = new Buffer(size); + if (typeof _fill === 'string') { + var fillBuf = new Buffer(_fill, enc); + var flen = fillBuf.length; + var i = -1; + while (++i < size) { + buf[i] = fillBuf[i % flen]; + } + } else { + buf.fill(_fill); + } + return buf; } - -// Brace expansion: -// a{b,c}d -> abd acd -// a{b,}c -> abc ac -// a{0..3}d -> a0d a1d a2d a3d -// a{b,c{d,e}f}g -> abg acdfg acefg -// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg -// -// Invalid sets are not expanded. -// a{2..}b -> a{2..}b -// a{b}c -> a{b}c -minimatch.braceExpand = function (pattern, options) { - return braceExpand(pattern, options) +exports.allocUnsafe = function allocUnsafe(size) { + if (typeof Buffer.allocUnsafe === 'function') { + return Buffer.allocUnsafe(size); + } + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); + } + if (size > MAX_LEN) { + throw new RangeError('size is too large'); + } + return new Buffer(size); } - -Minimatch.prototype.braceExpand = braceExpand - -function braceExpand (pattern, options) { - if (!options) { - if (this instanceof Minimatch) { - options = this.options - } else { - options = {} +exports.from = function from(value, encodingOrOffset, length) { + if (typeof Buffer.from === 'function' && (!global.Uint8Array || Uint8Array.from !== Buffer.from)) { + return Buffer.from(value, encodingOrOffset, length); + } + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number'); + } + if (typeof value === 'string') { + return new Buffer(value, encodingOrOffset); + } + if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) { + var offset = encodingOrOffset; + if (arguments.length === 1) { + return new Buffer(value); + } + if (typeof offset === 'undefined') { + offset = 0; + } + var len = length; + if (typeof len === 'undefined') { + len = value.byteLength - offset; + } + if (offset >= value.byteLength) { + throw new RangeError('\'offset\' is out of bounds'); + } + if (len > value.byteLength - offset) { + throw new RangeError('\'length\' is out of bounds'); + } + return new Buffer(value.slice(offset, offset + len)); + } + if (Buffer.isBuffer(value)) { + var out = new Buffer(value.length); + value.copy(out, 0, 0, value.length); + return out; + } + if (value) { + if (Array.isArray(value) || (typeof ArrayBuffer !== 'undefined' && value.buffer instanceof ArrayBuffer) || 'length' in value) { + return new Buffer(value); + } + if (value.type === 'Buffer' && Array.isArray(value.data)) { + return new Buffer(value.data); } } - pattern = typeof pattern === 'undefined' - ? this.pattern : pattern - - if (typeof pattern === 'undefined') { - throw new TypeError('undefined pattern') + throw new TypeError('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); +} +exports.allocUnsafeSlow = function allocUnsafeSlow(size) { + if (typeof Buffer.allocUnsafeSlow === 'function') { + return Buffer.allocUnsafeSlow(size); } - - if (options.nobrace || - !pattern.match(/\{.*\}/)) { - // shortcut. no need to expand. - return [pattern] + if (typeof size !== 'number') { + throw new TypeError('size must be a number'); } - - return expand(pattern) -} - -// parse a component of the expanded set. -// At this point, no pattern may contain "/" in it -// so we're going to return a 2d array, where each entry is the full -// pattern, split on '/', and then turned into a regular expression. -// A regexp is made at the end which joins each array with an -// escaped /, and another full one which joins each regexp with |. -// -// Following the lead of Bash 4.1, note that "**" only has special meaning -// when it is the *only* thing in a path portion. Otherwise, any series -// of * is equivalent to a single *. Globstar behavior is enabled by -// default, and can be disabled by setting options.noglobstar. -Minimatch.prototype.parse = parse -var SUBPARSE = {} -function parse (pattern, isSub) { - if (pattern.length > 1024 * 64) { - throw new TypeError('pattern is too long') + if (size >= MAX_LEN) { + throw new RangeError('size is too large'); } + return new SlowBuffer(size); +} - var options = this.options - - // shortcuts - if (!options.noglobstar && pattern === '**') return GLOBSTAR - if (pattern === '') return '' - - var re = '' - var hasMagic = !!options.nocase - var escaping = false - // ? => one single character - var patternListStack = [] - var negativeLists = [] - var stateChar - var inClass = false - var reClassStart = -1 - var classStart = -1 - // . and .. never match anything that doesn't start with ., - // even when options.dot is set. - var patternStart = pattern.charAt(0) === '.' ? '' // anything - // not (start or / followed by . or .. followed by / or end) - : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' - : '(?!\\.)' - var self = this - - function clearStateChar () { - if (stateChar) { - // we had some state-tracking character - // that wasn't consumed by this pass. - switch (stateChar) { - case '*': - re += star - hasMagic = true - break - case '?': - re += qmark - hasMagic = true - break - default: - re += '\\' + stateChar - break - } - self.debug('clearStateChar %j %j', stateChar, re) - stateChar = false - } - } - for (var i = 0, len = pattern.length, c - ; (i < len) && (c = pattern.charAt(i)) - ; i++) { - this.debug('%s\t%s %s %j', pattern, i, re, c) +/***/ }), +/* 129 */ +/***/ (function(module, exports) { - // skip over any that are escaped. - if (escaping && reSpecials[c]) { - re += '\\' + c - escaping = false - continue +function Caseless (dict) { + this.dict = dict || {} +} +Caseless.prototype.set = function (name, value, clobber) { + if (typeof name === 'object') { + for (var i in name) { + this.set(i, name[i], value) } + } else { + if (typeof clobber === 'undefined') clobber = true + var has = this.has(name) - switch (c) { - case '/': - // completely not allowed, even escaped. - // Should already be path-split by now. - return false - - case '\\': - clearStateChar() - escaping = true - continue - - // the various stateChar values - // for the "extglob" stuff. - case '?': - case '*': - case '+': - case '@': - case '!': - this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) - - // all of those are literals inside a class, except that - // the glob [!a] means [^a] in regexp - if (inClass) { - this.debug(' in class') - if (c === '!' && i === classStart + 1) c = '^' - re += c - continue - } - - // if we already have a stateChar, then it means - // that there was something like ** or +? in there. - // Handle the stateChar, then proceed with this one. - self.debug('call clearStateChar %j', stateChar) - clearStateChar() - stateChar = c - // if extglob is disabled, then +(asdf|foo) isn't a thing. - // just clear the statechar *now*, rather than even diving into - // the patternList stuff. - if (options.noext) clearStateChar() - continue - - case '(': - if (inClass) { - re += '(' - continue - } - - if (!stateChar) { - re += '\\(' - continue - } + if (!clobber && has) this.dict[has] = this.dict[has] + ',' + value + else this.dict[has || name] = value + return has + } +} +Caseless.prototype.has = function (name) { + var keys = Object.keys(this.dict) + , name = name.toLowerCase() + ; + for (var i=0;i) - re += pl.close - if (pl.type === '!') { - negativeLists.push(pl) - } - pl.reEnd = re.length - continue +/***/ }), +/* 130 */ +/***/ (function(module, exports) { - case '|': - if (inClass || !patternListStack.length || escaping) { - re += '\\|' - escaping = false - continue - } +module.exports = function(it){ + if(typeof it != 'function')throw TypeError(it + ' is not a function!'); + return it; +}; - clearStateChar() - re += '|' - continue +/***/ }), +/* 131 */ +/***/ (function(module, exports, __webpack_require__) { - // these are mostly the same in regexp and glob - case '[': - // swallow any state-tracking char before the [ - clearStateChar() +// getting tag from 19.1.3.6 Object.prototype.toString() +var cof = __webpack_require__(88) + , TAG = __webpack_require__(25)('toStringTag') + // ES3 wrong here + , ARG = cof(function(){ return arguments; }()) == 'Arguments'; - if (inClass) { - re += '\\' + c - continue - } +// fallback for IE11 Script Access Denied error +var tryGet = function(it, key){ + try { + return it[key]; + } catch(e){ /* empty */ } +}; - inClass = true - classStart = i - reClassStart = re.length - re += c - continue +module.exports = function(it){ + var O, T, B; + return it === undefined ? 'Undefined' : it === null ? 'Null' + // @@toStringTag case + : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T + // builtinTag case + : ARG ? cof(O) + // ES3 arguments fallback + : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B; +}; - case ']': - // a right bracket shall lose its special - // meaning and represent itself in - // a bracket expression if it occurs - // first in the list. -- POSIX.2 2.8.3.2 - if (i === classStart + 1 || !inClass) { - re += '\\' + c - escaping = false - continue - } +/***/ }), +/* 132 */ +/***/ (function(module, exports) { - // handle the case where we left a class open. - // "[z-a]" is valid, equivalent to "\[z-a\]" - if (inClass) { - // split where the last [ was, make sure we don't have - // an invalid re. if so, re-walk the contents of the - // would-be class to re-translate any characters that - // were passed through as-is - // TODO: It would probably be faster to determine this - // without a try/catch and a new RegExp, but it's tricky - // to do safely. For now, this is safe and works. - var cs = pattern.substring(classStart + 1, i) - try { - RegExp('[' + cs + ']') - } catch (er) { - // not a valid class! - var sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' - hasMagic = hasMagic || sp[1] - inClass = false - continue - } - } +// 7.2.1 RequireObjectCoercible(argument) +module.exports = function(it){ + if(it == undefined)throw TypeError("Can't call method on " + it); + return it; +}; - // finish up the class. - hasMagic = true - inClass = false - re += c - continue +/***/ }), +/* 133 */ +/***/ (function(module, exports, __webpack_require__) { - default: - // swallow any state char that wasn't consumed - clearStateChar() +var isObject = __webpack_require__(91) + , document = __webpack_require__(29).document + // in old IE typeof document.createElement is 'object' + , is = isObject(document) && isObject(document.createElement); +module.exports = function(it){ + return is ? document.createElement(it) : {}; +}; - if (escaping) { - // no need - escaping = false - } else if (reSpecials[c] - && !(c === '^' && inClass)) { - re += '\\' - } +/***/ }), +/* 134 */ +/***/ (function(module, exports) { - re += c +module.exports = function(exec){ + try { + return !!exec(); + } catch(e){ + return true; + } +}; - } // switch - } // for +/***/ }), +/* 135 */ +/***/ (function(module, exports) { - // handle the case where we left a class open. - // "[abc" is valid, equivalent to "\[abc" - if (inClass) { - // split where the last [ was, and escape it - // this is a huge pita. We now have to re-walk - // the contents of the would-be class to re-translate - // any characters that were passed through as-is - cs = pattern.substr(classStart + 1) - sp = this.parse(cs, SUBPARSE) - re = re.substr(0, reClassStart) + '\\[' + sp[0] - hasMagic = hasMagic || sp[1] - } +module.exports = function(bitmap, value){ + return { + enumerable : !(bitmap & 1), + configurable: !(bitmap & 2), + writable : !(bitmap & 4), + value : value + }; +}; - // handle the case where we had a +( thing at the *end* - // of the pattern. - // each pattern list stack adds 3 chars, and we need to go through - // and escape any | chars that were passed through as-is for the regexp. - // Go through and escape them, taking care not to double-escape any - // | chars that were already escaped. - for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { - var tail = re.slice(pl.reStart + pl.open.length) - this.debug('setting tail', re, pl) - // maybe some even number of \, then maybe 1 \, followed by a | - tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { - if (!$2) { - // the | isn't already escaped, so escape it. - $2 = '\\' - } +/***/ }), +/* 136 */ +/***/ (function(module, exports, __webpack_require__) { - // need to escape all those slashes *again*, without escaping the - // one that we need for escaping the | character. As it works out, - // escaping an even number of slashes can be done by simply repeating - // it exactly after itself. That's why this trick works. - // - // I am sorry that you have to see this. - return $1 + $1 + $2 + '|' - }) +var def = __webpack_require__(70).f + , has = __webpack_require__(90) + , TAG = __webpack_require__(25)('toStringTag'); - this.debug('tail=%j\n %s', tail, tail, pl, re) - var t = pl.type === '*' ? star - : pl.type === '?' ? qmark - : '\\' + pl.type +module.exports = function(it, tag, stat){ + if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag}); +}; - hasMagic = true - re = re.slice(0, pl.reStart) + t + '\\(' + tail - } +/***/ }), +/* 137 */ +/***/ (function(module, exports, __webpack_require__) { - // handle trailing things that only matter at the very end. - clearStateChar() - if (escaping) { - // trailing \\ - re += '\\\\' - } +var shared = __webpack_require__(222)('keys') + , uid = __webpack_require__(224); +module.exports = function(key){ + return shared[key] || (shared[key] = uid(key)); +}; - // only need to apply the nodot start if the re starts with - // something that could conceivably capture a dot - var addPatternStart = false - switch (re.charAt(0)) { - case '.': - case '[': - case '(': addPatternStart = true - } +/***/ }), +/* 138 */ +/***/ (function(module, exports) { - // Hack to work around lack of negative lookbehind in JS - // A pattern like: *.!(x).!(y|z) needs to ensure that a name - // like 'a.xyz.yz' doesn't match. So, the first negative - // lookahead, has to look ALL the way ahead, to the end of - // the pattern. - for (var n = negativeLists.length - 1; n > -1; n--) { - var nl = negativeLists[n] +// 7.1.4 ToInteger +var ceil = Math.ceil + , floor = Math.floor; +module.exports = function(it){ + return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it); +}; - var nlBefore = re.slice(0, nl.reStart) - var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) - var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) - var nlAfter = re.slice(nl.reEnd) +/***/ }), +/* 139 */ +/***/ (function(module, exports, __webpack_require__) { - nlLast += nlAfter +// to indexed object, toObject with fallback for non-array-like ES3 strings +var IObject = __webpack_require__(215) + , defined = __webpack_require__(132); +module.exports = function(it){ + return IObject(defined(it)); +}; - // Handle nested stuff like *(*.js|!(*.json)), where open parens - // mean that we should *not* include the ) in the bit that is considered - // "after" the negated section. - var openParensBefore = nlBefore.split('(').length - 1 - var cleanAfter = nlAfter - for (i = 0; i < openParensBefore; i++) { - cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') - } - nlAfter = cleanAfter +/***/ }), +/* 140 */ +/***/ (function(module, exports, __webpack_require__) { - var dollar = '' - if (nlAfter === '' && isSub !== SUBPARSE) { - dollar = '$' - } - var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast - re = newRe - } +// 7.1.15 ToLength +var toInteger = __webpack_require__(138) + , min = Math.min; +module.exports = function(it){ + return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991 +}; - // if the re is not "" at this point, then we need to make sure - // it doesn't match against an empty path part. - // Otherwise a/* will match a/, which it should not. - if (re !== '' && hasMagic) { - re = '(?=.)' + re - } +/***/ }), +/* 141 */ +/***/ (function(module, exports, __webpack_require__) { - if (addPatternStart) { - re = patternStart + re - } +// 7.1.13 ToObject(argument) +var defined = __webpack_require__(132); +module.exports = function(it){ + return Object(defined(it)); +}; - // parsing just a piece of a larger pattern. - if (isSub === SUBPARSE) { - return [re, hasMagic] - } +/***/ }), +/* 142 */ +/***/ (function(module, exports, __webpack_require__) { - // skip the regexp for non-magical patterns - // unescape anything in it, though, so that it'll be - // an exact match against a file etc. - if (!hasMagic) { - return globUnescape(pattern) - } +var classof = __webpack_require__(131) + , ITERATOR = __webpack_require__(25)('iterator') + , Iterators = __webpack_require__(55); +module.exports = __webpack_require__(31).getIteratorMethod = function(it){ + if(it != undefined)return it[ITERATOR] + || it['@@iterator'] + || Iterators[classof(it)]; +}; - var flags = options.nocase ? 'i' : '' - try { - var regExp = new RegExp('^' + re + '$', flags) - } catch (er) { - // If it was an invalid regular expression, then it can't match - // anything. This trick looks for a character after the end of - // the string, which is of course impossible, except in multi-line - // mode, but it's not a /m regex. - return new RegExp('$.') - } +/***/ }), +/* 143 */ +/***/ (function(module, exports, __webpack_require__) { - regExp._glob = pattern - regExp._src = re +__webpack_require__(444); +var global = __webpack_require__(29) + , hide = __webpack_require__(54) + , Iterators = __webpack_require__(55) + , TO_STRING_TAG = __webpack_require__(25)('toStringTag'); - return regExp +for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){ + var NAME = collections[i] + , Collection = global[NAME] + , proto = Collection && Collection.prototype; + if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME); + Iterators[NAME] = Iterators.Array; } -minimatch.makeRe = function (pattern, options) { - return new Minimatch(pattern, options || {}).makeRe() -} +/***/ }), +/* 144 */ +/***/ (function(module, exports, __webpack_require__) { -Minimatch.prototype.makeRe = makeRe -function makeRe () { - if (this.regexp || this.regexp === false) return this.regexp +"use strict"; - // at this point, this.set is a 2d array of partial - // pattern strings, or "**". - // - // It's better to use .match(). This function shouldn't - // be used, really, but it's pretty convenient sometimes, - // when you just want to work with a regex. - var set = this.set - if (!set.length) { - this.regexp = false - return this.regexp - } - var options = this.options +var hasOwn = Object.prototype.hasOwnProperty; +var toStr = Object.prototype.toString; - var twoStar = options.noglobstar ? star - : options.dot ? twoStarDot - : twoStarNoDot - var flags = options.nocase ? 'i' : '' +var isArray = function isArray(arr) { + if (typeof Array.isArray === 'function') { + return Array.isArray(arr); + } - var re = set.map(function (pattern) { - return pattern.map(function (p) { - return (p === GLOBSTAR) ? twoStar - : (typeof p === 'string') ? regExpEscape(p) - : p._src - }).join('\\\/') - }).join('|') + return toStr.call(arr) === '[object Array]'; +}; - // must match entire pattern - // ending in a * or ** will make it less strict. - re = '^(?:' + re + ')$' +var isPlainObject = function isPlainObject(obj) { + if (!obj || toStr.call(obj) !== '[object Object]') { + return false; + } - // can match anything, as long as it's not this. - if (this.negate) re = '^(?!' + re + ').*$' + var hasOwnConstructor = hasOwn.call(obj, 'constructor'); + var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); + // Not own constructor property must be Object + if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { + return false; + } - try { - this.regexp = new RegExp(re, flags) - } catch (ex) { - this.regexp = false - } - return this.regexp -} + // Own properties are enumerated firstly, so to speed up, + // if last one is own, then all properties are own. + var key; + for (key in obj) { /**/ } -minimatch.match = function (list, pattern, options) { - options = options || {} - var mm = new Minimatch(pattern, options) - list = list.filter(function (f) { - return mm.match(f) - }) - if (mm.options.nonull && !list.length) { - list.push(pattern) - } - return list -} + return typeof key === 'undefined' || hasOwn.call(obj, key); +}; -Minimatch.prototype.match = match -function match (f, partial) { - this.debug('match', f, this.pattern) - // short-circuit in the case of busted things. - // comments, etc. - if (this.comment) return false - if (this.empty) return f === '' +module.exports = function extend() { + var options, name, src, copy, copyIsArray, clone; + var target = arguments[0]; + var i = 1; + var length = arguments.length; + var deep = false; - if (f === '/' && partial) return true + // Handle a deep copy situation + if (typeof target === 'boolean') { + deep = target; + target = arguments[1] || {}; + // skip the boolean and the target + i = 2; + } + if (target == null || (typeof target !== 'object' && typeof target !== 'function')) { + target = {}; + } - var options = this.options + for (; i < length; ++i) { + options = arguments[i]; + // Only deal with non-null/undefined values + if (options != null) { + // Extend the base object + for (name in options) { + src = target[name]; + copy = options[name]; - // windows: need to use /, not \ - if (path.sep !== '/') { - f = f.split(path.sep).join('/') - } + // Prevent never-ending loop + if (target !== copy) { + // Recurse if we're merging plain objects or arrays + if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { + if (copyIsArray) { + copyIsArray = false; + clone = src && isArray(src) ? src : []; + } else { + clone = src && isPlainObject(src) ? src : {}; + } - // treat the test path as a set of pathparts. - f = f.split(slashSplit) - this.debug(this.pattern, 'split', f) + // Never move original objects, clone them + target[name] = extend(deep, clone, copy); - // just ONE of the pattern sets in this.set needs to match - // in order for it to be valid. If negating, then just one - // match means that we have failed. - // Either way, return on the first hit. + // Don't bring in undefined values + } else if (typeof copy !== 'undefined') { + target[name] = copy; + } + } + } + } + } - var set = this.set - this.debug(this.pattern, 'set', set) + // Return the modified object + return target; +}; - // Find the basename of the path by looking for the last non-empty segment - var filename - var i - for (i = f.length - 1; i >= 0; i--) { - filename = f[i] - if (filename) break - } - for (i = 0; i < set.length; i++) { - var pattern = set[i] - var file = f - if (options.matchBase && pattern.length === 1) { - file = [filename] - } - var hit = this.matchOne(file, pattern, partial) - if (hit) { - if (options.flipNegate) return true - return !this.negate - } - } +/***/ }), +/* 145 */ +/***/ (function(module, exports, __webpack_require__) { - // didn't get any hits. this is success if it's a negative - // pattern, failure otherwise. - if (options.flipNegate) return false - return this.negate -} +"use strict"; -// set partial to true to test if, for example, -// "/a/b" matches the start of "/*/b/*/d" -// Partial means, if you run out of file before you run -// out of pattern, then that's fine, as long as all -// the parts match. -Minimatch.prototype.matchOne = function (file, pattern, partial) { - var options = this.options +const escapeStringRegexp = __webpack_require__(230); - this.debug('matchOne', - { 'this': this, file: file, pattern: pattern }) +const platform = process.platform; - this.debug('matchOne', file.length, pattern.length) +const main = { + tick: '✔', + cross: '✖', + star: '★', + square: '▇', + squareSmall: '◻', + squareSmallFilled: '◼', + play: '▶', + circle: '◯', + circleFilled: '◉', + circleDotted: '◌', + circleDouble: '◎', + circleCircle: 'ⓞ', + circleCross: 'ⓧ', + circlePipe: 'Ⓘ', + circleQuestionMark: '?⃝', + bullet: '●', + dot: '․', + line: '─', + ellipsis: '…', + pointer: '❯', + pointerSmall: '›', + info: 'ℹ', + warning: '⚠', + hamburger: '☰', + smiley: '㋡', + mustache: '෴', + heart: '♥', + arrowUp: '↑', + arrowDown: '↓', + arrowLeft: '←', + arrowRight: '→', + radioOn: '◉', + radioOff: '◯', + checkboxOn: '☒', + checkboxOff: '☐', + checkboxCircleOn: 'ⓧ', + checkboxCircleOff: 'Ⓘ', + questionMarkPrefix: '?⃝', + oneHalf: '½', + oneThird: '⅓', + oneQuarter: '¼', + oneFifth: '⅕', + oneSixth: '⅙', + oneSeventh: '⅐', + oneEighth: '⅛', + oneNinth: '⅑', + oneTenth: '⅒', + twoThirds: '⅔', + twoFifths: '⅖', + threeQuarters: '¾', + threeFifths: '⅗', + threeEighths: '⅜', + fourFifths: '⅘', + fiveSixths: '⅚', + fiveEighths: '⅝', + sevenEighths: '⅞' +}; - for (var fi = 0, - pi = 0, - fl = file.length, - pl = pattern.length - ; (fi < fl) && (pi < pl) - ; fi++, pi++) { - this.debug('matchOne loop') - var p = pattern[pi] - var f = file[fi] +const win = { + tick: '√', + cross: '×', + star: '*', + square: '█', + squareSmall: '[ ]', + squareSmallFilled: '[█]', + play: '►', + circle: '( )', + circleFilled: '(*)', + circleDotted: '( )', + circleDouble: '( )', + circleCircle: '(○)', + circleCross: '(×)', + circlePipe: '(│)', + circleQuestionMark: '(?)', + bullet: '*', + dot: '.', + line: '─', + ellipsis: '...', + pointer: '>', + pointerSmall: '»', + info: 'i', + warning: '‼', + hamburger: '≡', + smiley: '☺', + mustache: '┌─┐', + heart: main.heart, + arrowUp: main.arrowUp, + arrowDown: main.arrowDown, + arrowLeft: main.arrowLeft, + arrowRight: main.arrowRight, + radioOn: '(*)', + radioOff: '( )', + checkboxOn: '[×]', + checkboxOff: '[ ]', + checkboxCircleOn: '(×)', + checkboxCircleOff: '( )', + questionMarkPrefix: '?', + oneHalf: '1/2', + oneThird: '1/3', + oneQuarter: '1/4', + oneFifth: '1/5', + oneSixth: '1/6', + oneSeventh: '1/7', + oneEighth: '1/8', + oneNinth: '1/9', + oneTenth: '1/10', + twoThirds: '2/3', + twoFifths: '2/5', + threeQuarters: '3/4', + threeFifths: '3/5', + threeEighths: '3/8', + fourFifths: '4/5', + fiveSixths: '5/6', + fiveEighths: '5/8', + sevenEighths: '7/8' +}; - this.debug(pattern, p, f) +if (platform === 'linux') { + // the main one doesn't look that good on Ubuntu + main.questionMarkPrefix = '?'; +} - // should be impossible. - // some invalid regexp stuff in the set. - if (p === false) return false +const figures = platform === 'win32' ? win : main; - if (p === GLOBSTAR) { - this.debug('GLOBSTAR', [pattern, p, f]) +const fn = str => { + if (figures === main) { + return str; + } - // "**" - // a/**/b/**/c would match the following: - // a/b/x/y/z/c - // a/x/y/z/b/c - // a/b/x/b/x/c - // a/b/c - // To do this, take the rest of the pattern after - // the **, and see if it would match the file remainder. - // If so, return success. - // If not, the ** "swallows" a segment, and try again. - // This is recursively awful. - // - // a/**/b/**/c matching a/b/x/y/z/c - // - a matches a - // - doublestar - // - matchOne(b/x/y/z/c, b/**/c) - // - b matches b - // - doublestar - // - matchOne(x/y/z/c, c) -> no - // - matchOne(y/z/c, c) -> no - // - matchOne(z/c, c) -> no - // - matchOne(c, c) yes, hit - var fr = fi - var pr = pi + 1 - if (pr === pl) { - this.debug('** at the end') - // a ** at the end will just swallow the rest. - // We have found a match. - // however, it will not swallow /.x, unless - // options.dot is set. - // . and .. are *never* matched by **, for explosively - // exponential reasons. - for (; fi < fl; fi++) { - if (file[fi] === '.' || file[fi] === '..' || - (!options.dot && file[fi].charAt(0) === '.')) return false - } - return true - } + Object.keys(main).forEach(key => { + if (main[key] === figures[key]) { + return; + } - // ok, let's see if we can swallow whatever we can. - while (fr < fl) { - var swallowee = file[fr] + str = str.replace(new RegExp(escapeStringRegexp(main[key]), 'g'), figures[key]); + }); - this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) + return str; +}; - // XXX remove this slice. Just pass the start index. - if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { - this.debug('globstar found match!', fr, fl, swallowee) - // found a match. - return true - } else { - // can't swallow "." or ".." ever. - // can only swallow ".foo" when explicitly asked. - if (swallowee === '.' || swallowee === '..' || - (!options.dot && swallowee.charAt(0) === '.')) { - this.debug('dot detected!', file, fr, pattern, pr) - break - } +module.exports = Object.assign(fn, figures); - // ** swallows a segment, and continue. - this.debug('globstar swallow a segment, and continue') - fr++ - } - } - // no match was found. - // However, in partial mode, we can't say this is necessarily over. - // If there's more *pattern* left, then - if (partial) { - // ran out of file - this.debug('\n>>> no match, partial?', file, fr, pattern, pr) - if (fr === fl) return true - } - return false - } +/***/ }), +/* 146 */ +/***/ (function(module, exports, __webpack_require__) { - // something other than ** - // non-magic patterns just have to match exactly - // patterns with magic have been turned into regexps. - var hit - if (typeof p === 'string') { - if (options.nocase) { - hit = f.toLowerCase() === p.toLowerCase() - } else { - hit = f === p - } - this.debug('string match', p, f, hit) - } else { - hit = f.match(p) - this.debug('pattern match', p, f, hit) - } +// Approach: +// +// 1. Get the minimatch set +// 2. For each pattern in the set, PROCESS(pattern, false) +// 3. Store matches per-set, then uniq them +// +// PROCESS(pattern, inGlobStar) +// Get the first [n] items from pattern that are all strings +// Join these together. This is PREFIX. +// If there is no more remaining, then stat(PREFIX) and +// add to matches if it succeeds. END. +// +// If inGlobStar and PREFIX is symlink and points to dir +// set ENTRIES = [] +// else readdir(PREFIX) as ENTRIES +// If fail, END +// +// with ENTRIES +// If pattern[n] is GLOBSTAR +// // handle the case where the globstar match is empty +// // by pruning it out, and testing the resulting pattern +// PROCESS(pattern[0..n] + pattern[n+1 .. $], false) +// // handle other cases. +// for ENTRY in ENTRIES (not dotfiles) +// // attach globstar + tail onto the entry +// // Mark that this entry is a globstar match +// PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true) +// +// else // not globstar +// for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot) +// Test ENTRY against pattern[n] +// If fails, continue +// If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $]) +// +// Caveat: +// Cache all stats and readdirs results to minimize syscall. Since all +// we ever care about is existence and directory-ness, we can just keep +// `true` for files, and [children,...] for directories, or `false` for +// things that don't exist. + +module.exports = glob + +var fs = __webpack_require__(6) +var rp = __webpack_require__(232) +var minimatch = __webpack_require__(155) +var Minimatch = minimatch.Minimatch +var inherits = __webpack_require__(36) +var EE = __webpack_require__(49).EventEmitter +var path = __webpack_require__(1) +var assert = __webpack_require__(22) +var isAbsolute = __webpack_require__(157) +var globSync = __webpack_require__(477) +var common = __webpack_require__(233) +var alphasort = common.alphasort +var alphasorti = common.alphasorti +var setopts = common.setopts +var ownProp = common.ownProp +var inflight = __webpack_require__(513) +var util = __webpack_require__(2) +var childrenIgnored = common.childrenIgnored +var isIgnored = common.isIgnored - if (!hit) return false - } +var once = __webpack_require__(104) - // Note: ending in / means that we'll get a final "" - // at the end of the pattern. This can only match a - // corresponding "" at the end of the file. - // If the file ends in /, then it can only match a - // a pattern that ends in /, unless the pattern just - // doesn't have any more for it. But, a/b/ should *not* - // match "a/b/*", even though "" matches against the - // [^/]*? pattern, except in partial mode, where it might - // simply not be reached yet. - // However, a/b/ should still satisfy a/* +function glob (pattern, options, cb) { + if (typeof options === 'function') cb = options, options = {} + if (!options) options = {} - // now either we fell off the end of the pattern, or we're done. - if (fi === fl && pi === pl) { - // ran out of pattern and filename at the same time. - // an exact hit! - return true - } else if (fi === fl) { - // ran out of file, but still had pattern left. - // this is ok if we're doing the match as part of - // a glob fs traversal. - return partial - } else if (pi === pl) { - // ran out of pattern, still have file left. - // this is only acceptable if we're on the very last - // empty segment of a file with a trailing slash. - // a/* should match a/b/ - var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') - return emptyFileEnd + if (options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return globSync(pattern, options) } - // should be unreachable. - throw new Error('wtf?') + return new Glob(pattern, options, cb) } -// replace stuff like \* with * -function globUnescape (s) { - return s.replace(/\\(.)/g, '$1') -} +glob.sync = globSync +var GlobSync = glob.GlobSync = globSync.GlobSync -function regExpEscape (s) { - return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +// old api surface +glob.glob = glob + +function extend (origin, add) { + if (add === null || typeof add !== 'object') { + return origin + } + + var keys = Object.keys(add) + var i = keys.length + while (i--) { + origin[keys[i]] = add[keys[i]] + } + return origin } +glob.hasMagic = function (pattern, options_) { + var options = extend({}, options_) + options.noprocess = true -/***/ }), -/* 154 */ -/***/ (function(module, exports, __webpack_require__) { + var g = new Glob(pattern, options) + var set = g.minimatch.set -var path = __webpack_require__(1); -var fs = __webpack_require__(5); -var _0777 = parseInt('0777', 8); + if (!pattern) + return false -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; + if (set.length > 1) + return true -function mkdirP (p, opts, f, made) { - if (typeof opts === 'function') { - f = opts; - opts = {}; - } - else if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - p = path.resolve(p); - - xfs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), opts, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, opts, cb, made); - }); - break; + for (var j = 0; j < set[0].length; j++) { + if (typeof set[0][j] !== 'string') + return true + } - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - xfs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original error be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - } - }); + return false } -mkdirP.sync = function sync (p, opts, made) { - if (!opts || typeof opts !== 'object') { - opts = { mode: opts }; - } - - var mode = opts.mode; - var xfs = opts.fs || fs; - - if (mode === undefined) { - mode = _0777 & (~process.umask()); - } - if (!made) made = null; +glob.Glob = Glob +inherits(Glob, EE) +function Glob (pattern, options, cb) { + if (typeof options === 'function') { + cb = options + options = null + } - p = path.resolve(p); + if (options && options.sync) { + if (cb) + throw new TypeError('callback provided to sync glob') + return new GlobSync(pattern, options) + } - try { - xfs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), opts, made); - sync(p, opts, made); - break; + if (!(this instanceof Glob)) + return new Glob(pattern, options, cb) - // In the case of any other error, just see if there's a dir - // there already. If so, then hooray! If not, then something - // is borked. - default: - var stat; - try { - stat = xfs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - } - } + setopts(this, pattern, options) + this._didRealPath = false - return made; -}; + // process each pattern in the minimatch set + var n = this.minimatch.set.length + + // The matches are stored as {: true,...} so that + // duplicates are automagically pruned. + // Later, we do an Object.keys() on these. + // Keep them as a list so we can fill in when nonull is set. + this.matches = new Array(n) + if (typeof cb === 'function') { + cb = once(cb) + this.on('error', cb) + this.on('end', function (matches) { + cb(null, matches) + }) + } -/***/ }), -/* 155 */ -/***/ (function(module, exports, __webpack_require__) { + var self = this + this._processing = 0 -var wrappy = __webpack_require__(104) -module.exports = wrappy(once) -module.exports.strict = wrappy(onceStrict) + this._emitQueue = [] + this._processQueue = [] + this.paused = false -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) + if (this.noprocess) + return this - Object.defineProperty(Function.prototype, 'onceStrict', { - value: function () { - return onceStrict(this) - }, - configurable: true - }) -}) + if (n === 0) + return done() -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) + var sync = true + for (var i = 0; i < n; i ++) { + this._process(this.minimatch.set[i], i, false, done) } - f.called = false - return f -} + sync = false -function onceStrict (fn) { - var f = function () { - if (f.called) - throw new Error(f.onceError) - f.called = true - return f.value = fn.apply(this, arguments) + function done () { + --self._processing + if (self._processing <= 0) { + if (sync) { + process.nextTick(function () { + self._finish() + }) + } else { + self._finish() + } + } } - var name = fn.name || 'Function wrapped with `once`' - f.onceError = name + " shouldn't be called more than once" - f.called = false - return f } +Glob.prototype._finish = function () { + assert(this instanceof Glob) + if (this.aborted) + return -/***/ }), -/* 156 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.realpath && !this._didRealpath) + return this._realpath() -"use strict"; + common.finish(this) + this.emit('end', this.found) +} +Glob.prototype._realpath = function () { + if (this._didRealpath) + return -function posix(path) { - return path.charAt(0) === '/'; -} + this._didRealpath = true -function win32(path) { - // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 - var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; - var result = splitDeviceRe.exec(path); - var device = result[1] || ''; - var isUnc = Boolean(device && device.charAt(1) !== ':'); + var n = this.matches.length + if (n === 0) + return this._finish() - // UNC paths are always absolute - return Boolean(result[2] || isUnc); + var self = this + for (var i = 0; i < this.matches.length; i++) + this._realpathSet(i, next) + + function next () { + if (--n === 0) + self._finish() + } } -module.exports = process.platform === 'win32' ? win32 : posix; -module.exports.posix = posix; -module.exports.win32 = win32; +Glob.prototype._realpathSet = function (index, cb) { + var matchset = this.matches[index] + if (!matchset) + return cb() + var found = Object.keys(matchset) + var self = this + var n = found.length -/***/ }), -/* 157 */ -/***/ (function(module, exports, __webpack_require__) { + if (n === 0) + return cb() -"use strict"; + var set = this.matches[index] = Object.create(null) + found.forEach(function (p, i) { + // If there's a problem with the stat, then it means that + // one or more of the links in the realpath couldn't be + // resolved. just return the abs value in that case. + p = self._makeAbs(p) + rp.realpath(p, self.realpathCache, function (er, real) { + if (!er) + set[real] = true + else if (er.syscall === 'stat') + set[p] = true + else + self.emit('error', er) // srsly wtf right here + if (--n === 0) { + self.matches[index] = set + cb() + } + }) + }) +} -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = nextTick; -} else { - module.exports = process.nextTick; +Glob.prototype._mark = function (p) { + return common.mark(this, p) } -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); +Glob.prototype._makeAbs = function (f) { + return common.makeAbs(this, f) +} + +Glob.prototype.abort = function () { + this.aborted = true + this.emit('abort') +} + +Glob.prototype.pause = function () { + if (!this.paused) { + this.paused = true + this.emit('pause') } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; +} + +Glob.prototype.resume = function () { + if (this.paused) { + this.emit('resume') + this.paused = false + if (this._emitQueue.length) { + var eq = this._emitQueue.slice(0) + this._emitQueue.length = 0 + for (var i = 0; i < eq.length; i ++) { + var e = eq[i] + this._emitMatch(e[0], e[1]) + } + } + if (this._processQueue.length) { + var pq = this._processQueue.slice(0) + this._processQueue.length = 0 + for (var i = 0; i < pq.length; i ++) { + var p = pq[i] + this._processing-- + this._process(p[0], p[1], p[2], p[3]) + } } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); } } +Glob.prototype._process = function (pattern, index, inGlobStar, cb) { + assert(this instanceof Glob) + assert(typeof cb === 'function') -/***/ }), -/* 158 */ -/***/ (function(module, exports, __webpack_require__) { + if (this.aborted) + return -"use strict"; -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. + this._processing++ + if (this.paused) { + this._processQueue.push([pattern, index, inGlobStar, cb]) + return + } + + //console.error('PROCESS %d', this._processing, pattern) + + // Get the first [n] parts of pattern that are all strings. + var n = 0 + while (typeof pattern[n] === 'string') { + n ++ + } + // now n is the index of the first one that is *not* a string. + + // see if there's anything else + var prefix + switch (n) { + // if not, then this is rather simple + case pattern.length: + this._processSimple(pattern.join('/'), index, cb) + return + + case 0: + // pattern *starts* with some non-trivial item. + // going to readdir(cwd), but not include the prefix in matches. + prefix = null + break + + default: + // pattern has some string bits in the front. + // whatever it starts with, whether that's 'absolute' like /foo/bar, + // or 'relative' like '../baz' + prefix = pattern.slice(0, n).join('/') + break + } + + var remain = pattern.slice(n) + + // get the list of entries. + var read + if (prefix === null) + read = '.' + else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) { + if (!prefix || !isAbsolute(prefix)) + prefix = '/' + prefix + read = prefix + } else + read = prefix + var abs = this._makeAbs(read) + //if ignored, skip _processing + if (childrenIgnored(this, read)) + return cb() -module.exports = Transform; + var isGlobStar = remain[0] === minimatch.GLOBSTAR + if (isGlobStar) + this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb) + else + this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb) +} -var Duplex = __webpack_require__(46); +Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} -/**/ -var util = __webpack_require__(66); -util.inherits = __webpack_require__(37); -/**/ +Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { -util.inherits(Transform, Duplex); + // if the abs isn't a dir, then nothing can match! + if (!entries) + return cb() -function TransformState(stream) { - this.afterTransform = function (er, data) { - return afterTransform(stream, er, data); - }; + // It will only match dot entries if it starts with a dot, or if + // dot is set. Stuff like @(.foo|.bar) isn't allowed. + var pn = remain[0] + var negate = !!this.minimatch.negate + var rawGlob = pn._glob + var dotOk = this.dot || rawGlob.charAt(0) === '.' - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - this.writeencoding = null; -} + var matchedEntries = [] + for (var i = 0; i < entries.length; i++) { + var e = entries[i] + if (e.charAt(0) !== '.' || dotOk) { + var m + if (negate && !prefix) { + m = !e.match(pn) + } else { + m = e.match(pn) + } + if (m) + matchedEntries.push(e) + } + } -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; + //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries) - var cb = ts.writecb; + var len = matchedEntries.length + // If there are no matched entries, then nothing matches. + if (len === 0) + return cb() - if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); + // if this is the last remaining pattern bit, then no need for + // an additional stat *unless* the user has specified mark or + // stat explicitly. We know they exist, since readdir returned + // them. - ts.writechunk = null; - ts.writecb = null; + if (remain.length === 1 && !this.mark && !this.stat) { + if (!this.matches[index]) + this.matches[index] = Object.create(null) - if (data !== null && data !== undefined) stream.push(data); + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } - cb(er); + if (e.charAt(0) === '/' && !this.nomount) { + e = path.join(this.root, e) + } + this._emitMatch(index, e) + } + // This was the last one, and no stats were needed + return cb() + } - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); + // now test all matched entries as stand-ins for that part + // of the pattern. + remain.shift() + for (var i = 0; i < len; i ++) { + var e = matchedEntries[i] + var newPattern + if (prefix) { + if (prefix !== '/') + e = prefix + '/' + e + else + e = prefix + e + } + this._process([e].concat(remain), index, inGlobStar, cb) } + cb() } -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); +Glob.prototype._emitMatch = function (index, e) { + if (this.aborted) + return - Duplex.call(this, options); + if (isIgnored(this, e)) + return - this._transformState = new TransformState(this); + if (this.paused) { + this._emitQueue.push([index, e]) + return + } - var stream = this; + var abs = isAbsolute(e) ? e : this._makeAbs(e) - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; + if (this.mark) + e = this._mark(e) - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; + if (this.absolute) + e = abs - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; + if (this.matches[index][e]) + return - if (typeof options.flush === 'function') this._flush = options.flush; + if (this.nodir) { + var c = this.cache[abs] + if (c === 'DIR' || Array.isArray(c)) + return } - // When the writable side finishes, then flush out anything remaining. - this.once('prefinish', function () { - if (typeof this._flush === 'function') this._flush(function (er, data) { - done(stream, er, data); - });else done(stream); - }); -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('_transform() is not implemented'); -}; + this.matches[index][e] = true -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; + var st = this.statCache[abs] + if (st) + this.emit('stat', e, st) -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; + this.emit('match', e) +} - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; +Glob.prototype._readdirInGlobStar = function (abs, cb) { + if (this.aborted) + return -function done(stream, er, data) { - if (er) return stream.emit('error', er); + // follow all symlinked directories forever + // just proceed as if this is a non-globstar situation + if (this.follow) + return this._readdir(abs, false, cb) - if (data !== null && data !== undefined) stream.push(data); + var lstatkey = 'lstat\0' + abs + var self = this + var lstatcb = inflight(lstatkey, lstatcb_) - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; + if (lstatcb) + fs.lstat(abs, lstatcb) - if (ws.length) throw new Error('Calling transform done when ws.length != 0'); + function lstatcb_ (er, lstat) { + if (er && er.code === 'ENOENT') + return cb() - if (ts.transforming) throw new Error('Calling transform done when still transforming'); + var isSym = lstat && lstat.isSymbolicLink() + self.symlinks[abs] = isSym - return stream.push(null); + // If it's not a symlink or a dir, then it's definitely a regular file. + // don't bother doing a readdir in that case. + if (!isSym && lstat && !lstat.isDirectory()) { + self.cache[abs] = 'FILE' + cb() + } else + self._readdir(abs, false, cb) + } } -/***/ }), -/* 159 */ -/***/ (function(module, exports, __webpack_require__) { +Glob.prototype._readdir = function (abs, inGlobStar, cb) { + if (this.aborted) + return -"use strict"; + cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb) + if (!cb) + return + //console.error('RD %j %j', +inGlobStar, abs) + if (inGlobStar && !ownProp(this.symlinks, abs)) + return this._readdirInGlobStar(abs, cb) -var jsonSafeStringify = __webpack_require__(539) - , crypto = __webpack_require__(6) - , Buffer = __webpack_require__(68).Buffer + if (ownProp(this.cache, abs)) { + var c = this.cache[abs] + if (!c || c === 'FILE') + return cb() -var defer = typeof setImmediate === 'undefined' - ? process.nextTick - : setImmediate + if (Array.isArray(c)) + return cb(null, c) + } -function paramsHaveRequestBody(params) { - return ( - params.body || - params.requestBodyStream || - (params.json && typeof params.json !== 'boolean') || - params.multipart - ) + var self = this + fs.readdir(abs, readdirCb(this, abs, cb)) } -function safeStringify (obj, replacer) { - var ret - try { - ret = JSON.stringify(obj, replacer) - } catch (e) { - ret = jsonSafeStringify(obj, replacer) +function readdirCb (self, abs, cb) { + return function (er, entries) { + if (er) + self._readdirError(abs, er, cb) + else + self._readdirEntries(abs, entries, cb) } - return ret } -function md5 (str) { - return crypto.createHash('md5').update(str).digest('hex') -} +Glob.prototype._readdirEntries = function (abs, entries, cb) { + if (this.aborted) + return -function isReadStream (rs) { - return rs.readable && rs.path && rs.mode -} + // if we haven't asked to stat everything, then just + // assume that everything in there exists, so we can avoid + // having to stat it a second time. + if (!this.mark && !this.stat) { + for (var i = 0; i < entries.length; i ++) { + var e = entries[i] + if (abs === '/') + e = abs + e + else + e = abs + '/' + e + this.cache[e] = true + } + } -function toBase64 (str) { - return Buffer.from(str || '', 'utf8').toString('base64') + this.cache[abs] = entries + return cb(null, entries) } -function copy (obj) { - var o = {} - Object.keys(obj).forEach(function (i) { - o[i] = obj[i] - }) - return o -} +Glob.prototype._readdirError = function (f, er, cb) { + if (this.aborted) + return -function version () { - var numbers = process.version.replace('v', '').split('.') - return { - major: parseInt(numbers[0], 10), - minor: parseInt(numbers[1], 10), - patch: parseInt(numbers[2], 10) - } -} + // handle errors, and cache the information + switch (er.code) { + case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205 + case 'ENOTDIR': // totally normal. means it *does* exist. + var abs = this._makeAbs(f) + this.cache[abs] = 'FILE' + if (abs === this.cwdAbs) { + var error = new Error(er.code + ' invalid cwd ' + this.cwd) + error.path = this.cwd + error.code = er.code + this.emit('error', error) + this.abort() + } + break -exports.paramsHaveRequestBody = paramsHaveRequestBody -exports.safeStringify = safeStringify -exports.md5 = md5 -exports.isReadStream = isReadStream -exports.toBase64 = toBase64 -exports.copy = copy -exports.version = version -exports.defer = defer + case 'ENOENT': // not terribly unusual + case 'ELOOP': + case 'ENAMETOOLONG': + case 'UNKNOWN': + this.cache[this._makeAbs(f)] = false + break + default: // some unusual error. Treat as failure. + this.cache[this._makeAbs(f)] = false + if (this.strict) { + this.emit('error', er) + // If the error is handled, then we abort + // if not, we threw out of here + this.abort() + } + if (!this.silent) + console.error('glob error', er) + break + } -/***/ }), -/* 160 */ -/***/ (function(module, exports, __webpack_require__) { + return cb() +} -// Copyright 2015 Joyent, Inc. +Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) { + var self = this + this._readdir(abs, inGlobStar, function (er, entries) { + self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb) + }) +} -module.exports = { - read: read, - readPkcs1: readPkcs1, - write: write, - writePkcs1: writePkcs1 -}; -var assert = __webpack_require__(9); -var asn1 = __webpack_require__(35); -var algs = __webpack_require__(17); -var utils = __webpack_require__(13); +Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) { + //console.error('pgs2', prefix, remain[0], entries) -var Key = __webpack_require__(18); -var PrivateKey = __webpack_require__(19); -var pem = __webpack_require__(40); + // no entries means not a dir, so it can never have matches + // foo.txt/** doesn't match foo.txt + if (!entries) + return cb() -var pkcs8 = __webpack_require__(71); -var readECDSACurve = pkcs8.readECDSACurve; + // test without the globstar, and with every child both below + // and replacing the globstar. + var remainWithoutGlobStar = remain.slice(1) + var gspref = prefix ? [ prefix ] : [] + var noGlobStar = gspref.concat(remainWithoutGlobStar) -function read(buf, options) { - return (pem.read(buf, options, 'pkcs1')); -} + // the noGlobStar pattern exits the inGlobStar state + this._process(noGlobStar, index, false, cb) -function write(key, options) { - return (pem.write(key, options, 'pkcs1')); -} + var isSym = this.symlinks[abs] + var len = entries.length -/* Helper to read in a single mpint */ -function readMPInt(der, nm) { - assert.strictEqual(der.peek(), asn1.Ber.Integer, - nm + ' is not an Integer'); - return (utils.mpNormalize(der.readString(asn1.Ber.Integer, true))); -} + // If it's a symlink, and we're in a globstar, then stop + if (isSym && inGlobStar) + return cb() -function readPkcs1(alg, type, der) { - switch (alg) { - case 'RSA': - if (type === 'public') - return (readPkcs1RSAPublic(der)); - else if (type === 'private') - return (readPkcs1RSAPrivate(der)); - throw (new Error('Unknown key type: ' + type)); - case 'DSA': - if (type === 'public') - return (readPkcs1DSAPublic(der)); - else if (type === 'private') - return (readPkcs1DSAPrivate(der)); - throw (new Error('Unknown key type: ' + type)); - case 'EC': - case 'ECDSA': - if (type === 'private') - return (readPkcs1ECDSAPrivate(der)); - else if (type === 'public') - return (readPkcs1ECDSAPublic(der)); - throw (new Error('Unknown key type: ' + type)); - default: - throw (new Error('Unknown key algo: ' + alg)); - } -} + for (var i = 0; i < len; i++) { + var e = entries[i] + if (e.charAt(0) === '.' && !this.dot) + continue -function readPkcs1RSAPublic(der) { - // modulus and exponent - var n = readMPInt(der, 'modulus'); - var e = readMPInt(der, 'exponent'); + // these two cases enter the inGlobStar state + var instead = gspref.concat(entries[i], remainWithoutGlobStar) + this._process(instead, index, true, cb) - // now, make the key - var key = { - type: 'rsa', - parts: [ - { name: 'e', data: e }, - { name: 'n', data: n } - ] - }; + var below = gspref.concat(entries[i], remain) + this._process(below, index, true, cb) + } - return (new Key(key)); + cb() } -function readPkcs1RSAPrivate(der) { - var version = readMPInt(der, 'version'); - assert.strictEqual(version[0], 0); - - // modulus then public exponent - var n = readMPInt(der, 'modulus'); - var e = readMPInt(der, 'public exponent'); - var d = readMPInt(der, 'private exponent'); - var p = readMPInt(der, 'prime1'); - var q = readMPInt(der, 'prime2'); - var dmodp = readMPInt(der, 'exponent1'); - var dmodq = readMPInt(der, 'exponent2'); - var iqmp = readMPInt(der, 'iqmp'); +Glob.prototype._processSimple = function (prefix, index, cb) { + // XXX review this. Shouldn't it be doing the mounting etc + // before doing stat? kinda weird? + var self = this + this._stat(prefix, function (er, exists) { + self._processSimple2(prefix, index, er, exists, cb) + }) +} +Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) { - // now, make the key - var key = { - type: 'rsa', - parts: [ - { name: 'n', data: n }, - { name: 'e', data: e }, - { name: 'd', data: d }, - { name: 'iqmp', data: iqmp }, - { name: 'p', data: p }, - { name: 'q', data: q }, - { name: 'dmodp', data: dmodp }, - { name: 'dmodq', data: dmodq } - ] - }; + //console.error('ps2', prefix, exists) - return (new PrivateKey(key)); -} + if (!this.matches[index]) + this.matches[index] = Object.create(null) -function readPkcs1DSAPrivate(der) { - var version = readMPInt(der, 'version'); - assert.strictEqual(version.readUInt8(0), 0); + // If it doesn't exist, then just mark the lack of results + if (!exists) + return cb() - var p = readMPInt(der, 'p'); - var q = readMPInt(der, 'q'); - var g = readMPInt(der, 'g'); - var y = readMPInt(der, 'y'); - var x = readMPInt(der, 'x'); + if (prefix && isAbsolute(prefix) && !this.nomount) { + var trail = /[\/\\]$/.test(prefix) + if (prefix.charAt(0) === '/') { + prefix = path.join(this.root, prefix) + } else { + prefix = path.resolve(this.root, prefix) + if (trail) + prefix += '/' + } + } - // now, make the key - var key = { - type: 'dsa', - parts: [ - { name: 'p', data: p }, - { name: 'q', data: q }, - { name: 'g', data: g }, - { name: 'y', data: y }, - { name: 'x', data: x } - ] - }; + if (process.platform === 'win32') + prefix = prefix.replace(/\\/g, '/') - return (new PrivateKey(key)); + // Mark this as a match + this._emitMatch(index, prefix) + cb() } -function readPkcs1DSAPublic(der) { - var y = readMPInt(der, 'y'); - var p = readMPInt(der, 'p'); - var q = readMPInt(der, 'q'); - var g = readMPInt(der, 'g'); +// Returns either 'DIR', 'FILE', or false +Glob.prototype._stat = function (f, cb) { + var abs = this._makeAbs(f) + var needDir = f.slice(-1) === '/' - var key = { - type: 'dsa', - parts: [ - { name: 'y', data: y }, - { name: 'p', data: p }, - { name: 'q', data: q }, - { name: 'g', data: g } - ] - }; + if (f.length > this.maxLength) + return cb() - return (new Key(key)); -} + if (!this.stat && ownProp(this.cache, abs)) { + var c = this.cache[abs] -function readPkcs1ECDSAPublic(der) { - der.readSequence(); + if (Array.isArray(c)) + c = 'DIR' - var oid = der.readOID(); - assert.strictEqual(oid, '1.2.840.10045.2.1', 'must be ecPublicKey'); + // It exists, but maybe not how we need it + if (!needDir || c === 'DIR') + return cb(null, c) - var curveOid = der.readOID(); + if (needDir && c === 'FILE') + return cb() - var curve; - var curves = Object.keys(algs.curves); - for (var j = 0; j < curves.length; ++j) { - var c = curves[j]; - var cd = algs.curves[c]; - if (cd.pkcs8oid === curveOid) { - curve = c; - break; - } - } - assert.string(curve, 'a known ECDSA named curve'); + // otherwise we have to stat, because maybe c=true + // if we know it exists, but not what it is. + } - var Q = der.readString(asn1.Ber.BitString, true); - Q = utils.ecNormalize(Q); + var exists + var stat = this.statCache[abs] + if (stat !== undefined) { + if (stat === false) + return cb(null, stat) + else { + var type = stat.isDirectory() ? 'DIR' : 'FILE' + if (needDir && type === 'FILE') + return cb() + else + return cb(null, type, stat) + } + } - var key = { - type: 'ecdsa', - parts: [ - { name: 'curve', data: new Buffer(curve) }, - { name: 'Q', data: Q } - ] - }; + var self = this + var statcb = inflight('stat\0' + abs, lstatcb_) + if (statcb) + fs.lstat(abs, statcb) - return (new Key(key)); + function lstatcb_ (er, lstat) { + if (lstat && lstat.isSymbolicLink()) { + // If it's a symlink, then treat it as the target, unless + // the target does not exist, then treat it as a file. + return fs.stat(abs, function (er, stat) { + if (er) + self._stat2(f, abs, null, lstat, cb) + else + self._stat2(f, abs, er, stat, cb) + }) + } else { + self._stat2(f, abs, er, lstat, cb) + } + } } -function readPkcs1ECDSAPrivate(der) { - var version = readMPInt(der, 'version'); - assert.strictEqual(version.readUInt8(0), 1); +Glob.prototype._stat2 = function (f, abs, er, stat, cb) { + if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) { + this.statCache[abs] = false + return cb() + } - // private key - var d = der.readString(asn1.Ber.OctetString, true); + var needDir = f.slice(-1) === '/' + this.statCache[abs] = stat - der.readSequence(0xa0); - var curve = readECDSACurve(der); - assert.string(curve, 'a known elliptic curve'); + if (abs.slice(-1) === '/' && stat && !stat.isDirectory()) + return cb(null, false, stat) - der.readSequence(0xa1); - var Q = der.readString(asn1.Ber.BitString, true); - Q = utils.ecNormalize(Q); + var c = true + if (stat) + c = stat.isDirectory() ? 'DIR' : 'FILE' + this.cache[abs] = this.cache[abs] || c - var key = { - type: 'ecdsa', - parts: [ - { name: 'curve', data: new Buffer(curve) }, - { name: 'Q', data: Q }, - { name: 'd', data: d } - ] - }; + if (needDir && c === 'FILE') + return cb() - return (new PrivateKey(key)); + return cb(null, c, stat) } -function writePkcs1(der, key) { - der.startSequence(); - switch (key.type) { - case 'rsa': - if (PrivateKey.isPrivateKey(key)) - writePkcs1RSAPrivate(der, key); - else - writePkcs1RSAPublic(der, key); - break; - case 'dsa': - if (PrivateKey.isPrivateKey(key)) - writePkcs1DSAPrivate(der, key); - else - writePkcs1DSAPublic(der, key); - break; - case 'ecdsa': - if (PrivateKey.isPrivateKey(key)) - writePkcs1ECDSAPrivate(der, key); - else - writePkcs1ECDSAPublic(der, key); - break; - default: - throw (new Error('Unknown key algo: ' + key.type)); - } +/***/ }), +/* 147 */ +/***/ (function(module, exports, __webpack_require__) { - der.endSequence(); -} +// Load modules -function writePkcs1RSAPublic(der, key) { - der.writeBuffer(key.part.n.data, asn1.Ber.Integer); - der.writeBuffer(key.part.e.data, asn1.Ber.Integer); -} +var Crypto = __webpack_require__(7); +var Url = __webpack_require__(11); +var Utils = __webpack_require__(94); -function writePkcs1RSAPrivate(der, key) { - var ver = new Buffer(1); - ver[0] = 0; - der.writeBuffer(ver, asn1.Ber.Integer); - der.writeBuffer(key.part.n.data, asn1.Ber.Integer); - der.writeBuffer(key.part.e.data, asn1.Ber.Integer); - der.writeBuffer(key.part.d.data, asn1.Ber.Integer); - der.writeBuffer(key.part.p.data, asn1.Ber.Integer); - der.writeBuffer(key.part.q.data, asn1.Ber.Integer); - if (!key.part.dmodp || !key.part.dmodq) - utils.addRSAMissing(key); - der.writeBuffer(key.part.dmodp.data, asn1.Ber.Integer); - der.writeBuffer(key.part.dmodq.data, asn1.Ber.Integer); - der.writeBuffer(key.part.iqmp.data, asn1.Ber.Integer); -} +// Declare internals -function writePkcs1DSAPrivate(der, key) { - var ver = new Buffer(1); - ver[0] = 0; - der.writeBuffer(ver, asn1.Ber.Integer); +var internals = {}; - der.writeBuffer(key.part.p.data, asn1.Ber.Integer); - der.writeBuffer(key.part.q.data, asn1.Ber.Integer); - der.writeBuffer(key.part.g.data, asn1.Ber.Integer); - der.writeBuffer(key.part.y.data, asn1.Ber.Integer); - der.writeBuffer(key.part.x.data, asn1.Ber.Integer); -} -function writePkcs1DSAPublic(der, key) { - der.writeBuffer(key.part.y.data, asn1.Ber.Integer); - der.writeBuffer(key.part.p.data, asn1.Ber.Integer); - der.writeBuffer(key.part.q.data, asn1.Ber.Integer); - der.writeBuffer(key.part.g.data, asn1.Ber.Integer); -} +// MAC normalization format version -function writePkcs1ECDSAPublic(der, key) { - der.startSequence(); +exports.headerVersion = '1'; // Prevent comparison of mac values generated with different normalized string formats - der.writeOID('1.2.840.10045.2.1'); /* ecPublicKey */ - var curve = key.part.curve.data.toString(); - var curveOid = algs.curves[curve].pkcs8oid; - assert.string(curveOid, 'a known ECDSA named curve'); - der.writeOID(curveOid); - der.endSequence(); +// Supported HMAC algorithms - var Q = utils.ecNormalize(key.part.Q.data, true); - der.writeBuffer(Q, asn1.Ber.BitString); -} +exports.algorithms = ['sha1', 'sha256']; -function writePkcs1ECDSAPrivate(der, key) { - var ver = new Buffer(1); - ver[0] = 1; - der.writeBuffer(ver, asn1.Ber.Integer); - der.writeBuffer(key.part.d.data, asn1.Ber.OctetString); +// Calculate the request MAC - der.startSequence(0xa0); - var curve = key.part.curve.data.toString(); - var curveOid = algs.curves[curve].pkcs8oid; - assert.string(curveOid, 'a known ECDSA named curve'); - der.writeOID(curveOid); - der.endSequence(); +/* + type: 'header', // 'header', 'bewit', 'response' + credentials: { + key: 'aoijedoaijsdlaksjdl', + algorithm: 'sha256' // 'sha1', 'sha256' + }, + options: { + method: 'GET', + resource: '/resource?a=1&b=2', + host: 'example.com', + port: 8080, + ts: 1357718381034, + nonce: 'd3d345f', + hash: 'U4MKKSmiVxk37JCCrAVIjV/OhB3y+NdwoCr6RShbVkE=', + ext: 'app-specific-data', + app: 'hf48hd83qwkj', // Application id (Oz) + dlg: 'd8djwekds9cj' // Delegated by application id (Oz), requires options.app + } +*/ - der.startSequence(0xa1); - var Q = utils.ecNormalize(key.part.Q.data, true); - der.writeBuffer(Q, asn1.Ber.BitString); - der.endSequence(); -} +exports.calculateMac = function (type, credentials, options) { + var normalized = exports.generateNormalizedString(type, options); -/***/ }), -/* 161 */ -/***/ (function(module, exports, __webpack_require__) { + var hmac = Crypto.createHmac(credentials.algorithm, credentials.key).update(normalized); + var digest = hmac.digest('base64'); + return digest; +}; -// Copyright 2015 Joyent, Inc. -var Key = __webpack_require__(18); -var Fingerprint = __webpack_require__(70); -var Signature = __webpack_require__(33); -var PrivateKey = __webpack_require__(19); -var Certificate = __webpack_require__(69); -var Identity = __webpack_require__(72); -var errs = __webpack_require__(32); +exports.generateNormalizedString = function (type, options) { -module.exports = { - /* top-level classes */ - Key: Key, - parseKey: Key.parse, - Fingerprint: Fingerprint, - parseFingerprint: Fingerprint.parse, - Signature: Signature, - parseSignature: Signature.parse, - PrivateKey: PrivateKey, - parsePrivateKey: PrivateKey.parse, - Certificate: Certificate, - parseCertificate: Certificate.parse, - createSelfSignedCertificate: Certificate.createSelfSigned, - createCertificate: Certificate.create, - Identity: Identity, - identityFromDN: Identity.parseDN, - identityForHost: Identity.forHost, - identityForUser: Identity.forUser, - identityForEmail: Identity.forEmail, + var resource = options.resource || ''; + if (resource && + resource[0] !== '/') { - /* errors */ - FingerprintFormatError: errs.FingerprintFormatError, - InvalidAlgorithmError: errs.InvalidAlgorithmError, - KeyParseError: errs.KeyParseError, - SignatureParseError: errs.SignatureParseError, - KeyEncryptedError: errs.KeyEncryptedError, - CertificateParseError: errs.CertificateParseError -}; + var url = Url.parse(resource, false); + resource = url.path; // Includes query + } + var normalized = 'hawk.' + exports.headerVersion + '.' + type + '\n' + + options.ts + '\n' + + options.nonce + '\n' + + (options.method || '').toUpperCase() + '\n' + + resource + '\n' + + options.host.toLowerCase() + '\n' + + options.port + '\n' + + (options.hash || '') + '\n'; -/***/ }), -/* 162 */ -/***/ (function(module, exports, __webpack_require__) { + if (options.ext) { + normalized += options.ext.replace('\\', '\\\\').replace('\n', '\\n'); + } -"use strict"; + normalized += '\n'; -var ansiRegex = __webpack_require__(177)(); + if (options.app) { + normalized += options.app + '\n' + + (options.dlg || '') + '\n'; + } -module.exports = function (str) { - return typeof str === 'string' ? str.replace(ansiRegex, '') : str; + return normalized; }; -/***/ }), -/* 163 */ -/***/ (function(module, exports, __webpack_require__) { +exports.calculatePayloadHash = function (payload, algorithm, contentType) { -(function(nacl) { -'use strict'; + var hash = exports.initializePayloadHash(algorithm, contentType); + hash.update(payload || ''); + return exports.finalizePayloadHash(hash); +}; -// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. -// Public domain. -// -// Implementation derived from TweetNaCl version 20140427. -// See for details: http://tweetnacl.cr.yp.to/ -var gf = function(init) { - var i, r = new Float64Array(16); - if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; - return r; +exports.initializePayloadHash = function (algorithm, contentType) { + + var hash = Crypto.createHash(algorithm); + hash.update('hawk.' + exports.headerVersion + '.payload\n'); + hash.update(Utils.parseContentType(contentType) + '\n'); + return hash; }; -// Pluggable, initialized in high-level API below. -var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; -var _0 = new Uint8Array(16); -var _9 = new Uint8Array(32); _9[0] = 9; +exports.finalizePayloadHash = function (hash) { -var gf0 = gf(), - gf1 = gf([1]), - _121665 = gf([0xdb41, 1]), - D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), - D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), - X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), - Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), - I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); + hash.update('\n'); + return hash.digest('base64'); +}; -function ts64(x, i, h, l) { - x[i] = (h >> 24) & 0xff; - x[i+1] = (h >> 16) & 0xff; - x[i+2] = (h >> 8) & 0xff; - x[i+3] = h & 0xff; - x[i+4] = (l >> 24) & 0xff; - x[i+5] = (l >> 16) & 0xff; - x[i+6] = (l >> 8) & 0xff; - x[i+7] = l & 0xff; -} -function vn(x, xi, y, yi, n) { - var i,d = 0; - for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; - return (1 & ((d - 1) >>> 8)) - 1; -} +exports.calculateTsMac = function (ts, credentials) { -function crypto_verify_16(x, xi, y, yi) { - return vn(x,xi,y,yi,16); -} + var hmac = Crypto.createHmac(credentials.algorithm, credentials.key); + hmac.update('hawk.' + exports.headerVersion + '.ts\n' + ts + '\n'); + return hmac.digest('base64'); +}; -function crypto_verify_32(x, xi, y, yi) { - return vn(x,xi,y,yi,32); -} -function core_salsa20(o, p, k, c) { - var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, - j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, - j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, - j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, - j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, - j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, - j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, - j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, - j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, - j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, - j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, - j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, - j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, - j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, - j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, - j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; +exports.timestampMessage = function (credentials, localtimeOffsetMsec) { - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, - x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, - x15 = j15, u; + var now = Utils.nowSecs(localtimeOffsetMsec); + var tsm = exports.calculateTsMac(now, credentials); + return { ts: now, tsm: tsm }; +}; - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u<<7 | u>>>(32-7); - u = x4 + x0 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x4 | 0; - x12 ^= u<<13 | u>>>(32-13); - u = x12 + x8 | 0; - x0 ^= u<<18 | u>>>(32-18); - u = x5 + x1 | 0; - x9 ^= u<<7 | u>>>(32-7); - u = x9 + x5 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x9 | 0; - x1 ^= u<<13 | u>>>(32-13); - u = x1 + x13 | 0; - x5 ^= u<<18 | u>>>(32-18); +/***/ }), +/* 148 */ +/***/ (function(module, exports, __webpack_require__) { - u = x10 + x6 | 0; - x14 ^= u<<7 | u>>>(32-7); - u = x14 + x10 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x14 | 0; - x6 ^= u<<13 | u>>>(32-13); - u = x6 + x2 | 0; - x10 ^= u<<18 | u>>>(32-18); +/** + * Inquirer.js + * A collection of common interactive command line user interfaces. + */ - u = x15 + x11 | 0; - x3 ^= u<<7 | u>>>(32-7); - u = x3 + x15 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x3 | 0; - x11 ^= u<<13 | u>>>(32-13); - u = x11 + x7 | 0; - x15 ^= u<<18 | u>>>(32-18); +var inquirer = module.exports; - u = x0 + x3 | 0; - x1 ^= u<<7 | u>>>(32-7); - u = x1 + x0 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x1 | 0; - x3 ^= u<<13 | u>>>(32-13); - u = x3 + x2 | 0; - x0 ^= u<<18 | u>>>(32-18); +/** + * Client interfaces + */ - u = x5 + x4 | 0; - x6 ^= u<<7 | u>>>(32-7); - u = x6 + x5 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x6 | 0; - x4 ^= u<<13 | u>>>(32-13); - u = x4 + x7 | 0; - x5 ^= u<<18 | u>>>(32-18); +inquirer.prompts = {}; + +inquirer.Separator = __webpack_require__(98); + +inquirer.ui = { + BottomBar: __webpack_require__(526), + Prompt: __webpack_require__(527) +}; + +/** + * Create a new self-contained prompt module. + */ +inquirer.createPromptModule = function (opt) { + var promptModule = function (questions) { + var ui = new inquirer.ui.Prompt(promptModule.prompts, opt); + var promise = ui.run(questions); - u = x10 + x9 | 0; - x11 ^= u<<7 | u>>>(32-7); - u = x11 + x10 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x11 | 0; - x9 ^= u<<13 | u>>>(32-13); - u = x9 + x8 | 0; - x10 ^= u<<18 | u>>>(32-18); + // Monkey patch the UI on the promise object so + // that it remains publicly accessible. + promise.ui = ui; - u = x15 + x14 | 0; - x12 ^= u<<7 | u>>>(32-7); - u = x12 + x15 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x12 | 0; - x14 ^= u<<13 | u>>>(32-13); - u = x14 + x13 | 0; - x15 ^= u<<18 | u>>>(32-18); - } - x0 = x0 + j0 | 0; - x1 = x1 + j1 | 0; - x2 = x2 + j2 | 0; - x3 = x3 + j3 | 0; - x4 = x4 + j4 | 0; - x5 = x5 + j5 | 0; - x6 = x6 + j6 | 0; - x7 = x7 + j7 | 0; - x8 = x8 + j8 | 0; - x9 = x9 + j9 | 0; - x10 = x10 + j10 | 0; - x11 = x11 + j11 | 0; - x12 = x12 + j12 | 0; - x13 = x13 + j13 | 0; - x14 = x14 + j14 | 0; - x15 = x15 + j15 | 0; + return promise; + }; + promptModule.prompts = {}; - o[ 0] = x0 >>> 0 & 0xff; - o[ 1] = x0 >>> 8 & 0xff; - o[ 2] = x0 >>> 16 & 0xff; - o[ 3] = x0 >>> 24 & 0xff; + /** + * Register a prompt type + * @param {String} name Prompt type name + * @param {Function} prompt Prompt constructor + * @return {inquirer} + */ - o[ 4] = x1 >>> 0 & 0xff; - o[ 5] = x1 >>> 8 & 0xff; - o[ 6] = x1 >>> 16 & 0xff; - o[ 7] = x1 >>> 24 & 0xff; + promptModule.registerPrompt = function (name, prompt) { + promptModule.prompts[name] = prompt; + return this; + }; - o[ 8] = x2 >>> 0 & 0xff; - o[ 9] = x2 >>> 8 & 0xff; - o[10] = x2 >>> 16 & 0xff; - o[11] = x2 >>> 24 & 0xff; + /** + * Register the defaults provider prompts + */ - o[12] = x3 >>> 0 & 0xff; - o[13] = x3 >>> 8 & 0xff; - o[14] = x3 >>> 16 & 0xff; - o[15] = x3 >>> 24 & 0xff; + promptModule.restoreDefaultPrompts = function () { + this.registerPrompt('list', __webpack_require__(523)); + this.registerPrompt('input', __webpack_require__(522)); + this.registerPrompt('confirm', __webpack_require__(519)); + this.registerPrompt('rawlist', __webpack_require__(525)); + this.registerPrompt('expand', __webpack_require__(521)); + this.registerPrompt('checkbox', __webpack_require__(518)); + this.registerPrompt('password', __webpack_require__(524)); + this.registerPrompt('editor', __webpack_require__(520)); + }; - o[16] = x4 >>> 0 & 0xff; - o[17] = x4 >>> 8 & 0xff; - o[18] = x4 >>> 16 & 0xff; - o[19] = x4 >>> 24 & 0xff; + promptModule.restoreDefaultPrompts(); - o[20] = x5 >>> 0 & 0xff; - o[21] = x5 >>> 8 & 0xff; - o[22] = x5 >>> 16 & 0xff; - o[23] = x5 >>> 24 & 0xff; + return promptModule; +}; - o[24] = x6 >>> 0 & 0xff; - o[25] = x6 >>> 8 & 0xff; - o[26] = x6 >>> 16 & 0xff; - o[27] = x6 >>> 24 & 0xff; +/** + * Public CLI helper interface + * @param {Array|Object|rx.Observable} questions - Questions settings array + * @param {Function} cb - Callback being passed the user answers + * @return {inquirer.ui.Prompt} + */ - o[28] = x7 >>> 0 & 0xff; - o[29] = x7 >>> 8 & 0xff; - o[30] = x7 >>> 16 & 0xff; - o[31] = x7 >>> 24 & 0xff; +inquirer.prompt = inquirer.createPromptModule(); - o[32] = x8 >>> 0 & 0xff; - o[33] = x8 >>> 8 & 0xff; - o[34] = x8 >>> 16 & 0xff; - o[35] = x8 >>> 24 & 0xff; +// Expose helper functions on the top level for easiest usage by common users +inquirer.registerPrompt = function (name, prompt) { + inquirer.prompt.registerPrompt(name, prompt); +}; +inquirer.restoreDefaultPrompts = function () { + inquirer.prompt.restoreDefaultPrompts(); +}; - o[36] = x9 >>> 0 & 0xff; - o[37] = x9 >>> 8 & 0xff; - o[38] = x9 >>> 16 & 0xff; - o[39] = x9 >>> 24 & 0xff; - o[40] = x10 >>> 0 & 0xff; - o[41] = x10 >>> 8 & 0xff; - o[42] = x10 >>> 16 & 0xff; - o[43] = x10 >>> 24 & 0xff; +/***/ }), +/* 149 */ +/***/ (function(module, exports, __webpack_require__) { - o[44] = x11 >>> 0 & 0xff; - o[45] = x11 >>> 8 & 0xff; - o[46] = x11 >>> 16 & 0xff; - o[47] = x11 >>> 24 & 0xff; +"use strict"; - o[48] = x12 >>> 0 & 0xff; - o[49] = x12 >>> 8 & 0xff; - o[50] = x12 >>> 16 & 0xff; - o[51] = x12 >>> 24 & 0xff; - o[52] = x13 >>> 0 & 0xff; - o[53] = x13 >>> 8 & 0xff; - o[54] = x13 >>> 16 & 0xff; - o[55] = x13 >>> 24 & 0xff; +module.exports = __webpack_require__(407).isCI - o[56] = x14 >>> 0 & 0xff; - o[57] = x14 >>> 8 & 0xff; - o[58] = x14 >>> 16 & 0xff; - o[59] = x14 >>> 24 & 0xff; - o[60] = x15 >>> 0 & 0xff; - o[61] = x15 >>> 8 & 0xff; - o[62] = x15 >>> 16 & 0xff; - o[63] = x15 >>> 24 & 0xff; -} +/***/ }), +/* 150 */ +/***/ (function(module, exports, __webpack_require__) { -function core_hsalsa20(o,p,k,c) { - var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, - j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, - j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, - j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, - j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, - j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, - j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, - j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, - j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, - j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, - j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, - j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, - j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, - j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, - j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, - j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; +"use strict"; - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, - x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, - x15 = j15, u; - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u<<7 | u>>>(32-7); - u = x4 + x0 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x4 | 0; - x12 ^= u<<13 | u>>>(32-13); - u = x12 + x8 | 0; - x0 ^= u<<18 | u>>>(32-18); +/* + * Copyright (c) 2014 Mega Limited + * under the MIT License. + * + * Authors: Guy K. Kloss + * + * You should have received a copy of the license along with this program. + */ - u = x5 + x1 | 0; - x9 ^= u<<7 | u>>>(32-7); - u = x9 + x5 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x9 | 0; - x1 ^= u<<13 | u>>>(32-13); - u = x1 + x13 | 0; - x5 ^= u<<18 | u>>>(32-18); +var dh = __webpack_require__(543); +var eddsa = __webpack_require__(544); +var curve255 = __webpack_require__(151); +var utils = __webpack_require__(103); + + /** + * @exports jodid25519 + * Curve 25519-based cryptography collection. + * + * @description + * EC Diffie-Hellman (ECDH) based on Curve25519 and digital signatures + * (EdDSA) based on Ed25519. + */ + var ns = {}; + + /** Module version indicator as string (format: [major.minor.patch]). */ + ns.VERSION = '0.7.1'; - u = x10 + x6 | 0; - x14 ^= u<<7 | u>>>(32-7); - u = x14 + x10 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x14 | 0; - x6 ^= u<<13 | u>>>(32-13); - u = x6 + x2 | 0; - x10 ^= u<<18 | u>>>(32-18); + ns.dh = dh; + ns.eddsa = eddsa; + ns.curve255 = curve255; + ns.utils = utils; - u = x15 + x11 | 0; - x3 ^= u<<7 | u>>>(32-7); - u = x3 + x15 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x3 | 0; - x11 ^= u<<13 | u>>>(32-13); - u = x11 + x7 | 0; - x15 ^= u<<18 | u>>>(32-18); +module.exports = ns; - u = x0 + x3 | 0; - x1 ^= u<<7 | u>>>(32-7); - u = x1 + x0 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x1 | 0; - x3 ^= u<<13 | u>>>(32-13); - u = x3 + x2 | 0; - x0 ^= u<<18 | u>>>(32-18); - u = x5 + x4 | 0; - x6 ^= u<<7 | u>>>(32-7); - u = x6 + x5 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x6 | 0; - x4 ^= u<<13 | u>>>(32-13); - u = x4 + x7 | 0; - x5 ^= u<<18 | u>>>(32-18); +/***/ }), +/* 151 */ +/***/ (function(module, exports, __webpack_require__) { - u = x10 + x9 | 0; - x11 ^= u<<7 | u>>>(32-7); - u = x11 + x10 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x11 | 0; - x9 ^= u<<13 | u>>>(32-13); - u = x9 + x8 | 0; - x10 ^= u<<18 | u>>>(32-18); +"use strict"; - u = x15 + x14 | 0; - x12 ^= u<<7 | u>>>(32-7); - u = x12 + x15 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x12 | 0; - x14 ^= u<<13 | u>>>(32-13); - u = x14 + x13 | 0; - x15 ^= u<<18 | u>>>(32-18); - } +/** + * @fileOverview + * Core operations on curve 25519 required for the higher level modules. + */ - o[ 0] = x0 >>> 0 & 0xff; - o[ 1] = x0 >>> 8 & 0xff; - o[ 2] = x0 >>> 16 & 0xff; - o[ 3] = x0 >>> 24 & 0xff; +/* + * Copyright (c) 2007, 2013, 2014 Michele Bini + * Copyright (c) 2014 Mega Limited + * under the MIT License. + * + * Authors: Guy K. Kloss, Michele Bini + * + * You should have received a copy of the license along with this program. + */ - o[ 4] = x5 >>> 0 & 0xff; - o[ 5] = x5 >>> 8 & 0xff; - o[ 6] = x5 >>> 16 & 0xff; - o[ 7] = x5 >>> 24 & 0xff; +var core = __webpack_require__(102); +var utils = __webpack_require__(103); - o[ 8] = x10 >>> 0 & 0xff; - o[ 9] = x10 >>> 8 & 0xff; - o[10] = x10 >>> 16 & 0xff; - o[11] = x10 >>> 24 & 0xff; + /** + * @exports jodid25519/curve255 + * Legacy compatibility module for Michele Bini's previous curve255.js. + * + * @description + * Legacy compatibility module for Michele Bini's previous curve255.js. + * + *

+ * This code presents an API with all key formats as previously available + * from Michele Bini's curve255.js implementation. + *

+ */ + var ns = {}; - o[12] = x15 >>> 0 & 0xff; - o[13] = x15 >>> 8 & 0xff; - o[14] = x15 >>> 16 & 0xff; - o[15] = x15 >>> 24 & 0xff; + function curve25519_raw(f, c) { + var a, x_1, q; - o[16] = x6 >>> 0 & 0xff; - o[17] = x6 >>> 8 & 0xff; - o[18] = x6 >>> 16 & 0xff; - o[19] = x6 >>> 24 & 0xff; + x_1 = c; + a = core.dbl(x_1, core.ONE()); + q = [x_1, core.ONE()]; - o[20] = x7 >>> 0 & 0xff; - o[21] = x7 >>> 8 & 0xff; - o[22] = x7 >>> 16 & 0xff; - o[23] = x7 >>> 24 & 0xff; + var n = 255; - o[24] = x8 >>> 0 & 0xff; - o[25] = x8 >>> 8 & 0xff; - o[26] = x8 >>> 16 & 0xff; - o[27] = x8 >>> 24 & 0xff; + while (core.getbit(f, n) == 0) { + n--; + // For correct constant-time operation, bit 255 should always be + // set to 1 so the following 'while' loop is never entered. + if (n < 0) { + return core.ZERO(); + } + } + n--; - o[28] = x9 >>> 0 & 0xff; - o[29] = x9 >>> 8 & 0xff; - o[30] = x9 >>> 16 & 0xff; - o[31] = x9 >>> 24 & 0xff; -} + var aq = [a, q]; -function crypto_core_salsa20(out,inp,k,c) { - core_salsa20(out,inp,k,c); -} + while (n >= 0) { + var r, s; + var b = core.getbit(f, n); + r = core.sum(aq[0][0], aq[0][1], aq[1][0], aq[1][1], x_1); + s = core.dbl(aq[1 - b][0], aq[1 - b][1]); + aq[1 - b] = s; + aq[b] = r; + n--; + } + q = aq[1]; -function crypto_core_hsalsa20(out,inp,k,c) { - core_hsalsa20(out,inp,k,c); -} + q[1] = core.invmodp(q[1]); + q[0] = core.mulmodp(q[0], q[1]); + core.reduce(q[0]); + return q[0]; + } -var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - // "expand 32-byte k" + function curve25519b32(a, b) { + return _base32encode(curve25519(_base32decode(a), + _base32decode(b))); + } -function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; + function curve25519(f, c) { + if (!c) { + c = core.BASE(); + } + f[0] &= 0xFFF8; + f[15] = (f[15] & 0x7FFF) | 0x4000; + return curve25519_raw(f, c); } - b -= 64; - cpos += 64; - mpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i]; - } - return 0; -} -function crypto_stream_salsa20(c,cpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; + function _hexEncodeVector(k) { + var hexKey = utils.hexEncode(k); + // Pad with '0' at the front. + hexKey = new Array(64 + 1 - hexKey.length).join('0') + hexKey; + // Invert bytes. + return hexKey.split(/(..)/).reverse().join(''); } - b -= 64; - cpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = x[i]; - } - return 0; -} -function crypto_stream(c,cpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) sn[i] = n[i+16]; - return crypto_stream_salsa20(c,cpos,d,sn,s); -} + function _hexDecodeVector(v) { + // assert(length(x) == 64); + // Invert bytes. + var hexKey = v.split(/(..)/).reverse().join(''); + return utils.hexDecode(hexKey); + } -function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) sn[i] = n[i+16]; - return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s); -} -/* -* Port of Andrew Moon's Poly1305-donna-16. Public domain. -* https://github.com/floodyberry/poly1305-donna -*/ + // Expose some functions to the outside through this name space. + + /** + * Computes the scalar product of a point on the curve 25519. + * + * This function is used for the DH key-exchange protocol. + * + * Before multiplication, some bit operations are applied to the + * private key to ensure it is a valid Curve25519 secret key. + * It is the user's responsibility to make sure that the private + * key is a uniformly random, secret value. + * + * @function + * @param f {array} + * Private key. + * @param c {array} + * Public point on the curve. If not given, the curve's base point is used. + * @returns {array} + * Key point resulting from scalar product. + */ + ns.curve25519 = curve25519; + + /** + * Computes the scalar product of a point on the curve 25519. + * + * This variant does not make sure that the private key is valid. + * The user has the responsibility to ensure the private key is + * valid or that this results in a safe protocol. Unless you know + * exactly what you are doing, you should not use this variant, + * please use 'curve25519' instead. + * + * @function + * @param f {array} + * Private key. + * @param c {array} + * Public point on the curve. If not given, the curve's base point is used. + * @returns {array} + * Key point resulting from scalar product. + */ + ns.curve25519_raw = curve25519_raw; + + /** + * Encodes the internal representation of a key to a canonical hex + * representation. + * + * This is the format commonly used in other libraries and for + * test vectors, and is equivalent to the hex dump of the key in + * little-endian binary format. + * + * @function + * @param n {array} + * Array representation of key. + * @returns {string} + * Hexadecimal string representation of key. + */ + ns.hexEncodeVector = _hexEncodeVector; + + /** + * Decodes a canonical hex representation of a key + * to an internally compatible array representation. + * + * @function + * @param n {string} + * Hexadecimal string representation of key. + * @returns {array} + * Array representation of key. + */ + ns.hexDecodeVector = _hexDecodeVector; -var poly1305 = function(key) { - this.buffer = new Uint8Array(16); - this.r = new Uint16Array(10); - this.h = new Uint16Array(10); - this.pad = new Uint16Array(8); - this.leftover = 0; - this.fin = 0; + /** + * Encodes the internal representation of a key into a + * hexadecimal representation. + * + * This is a strict positional notation, most significant digit first. + * + * @function + * @param n {array} + * Array representation of key. + * @returns {string} + * Hexadecimal string representation of key. + */ + ns.hexencode = utils.hexEncode; - var t0, t1, t2, t3, t4, t5, t6, t7; + /** + * Decodes a hex representation of a key to an internally + * compatible array representation. + * + * @function + * @param n {string} + * Hexadecimal string representation of key. + * @returns {array} + * Array representation of key. + */ + ns.hexdecode = utils.hexDecode; - t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; - t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; - t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; - this.r[5] = ((t4 >>> 1)) & 0x1ffe; - t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; - t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - this.r[9] = ((t7 >>> 5)) & 0x007f; + /** + * Encodes the internal representation of a key to a base32 + * representation. + * + * @function + * @param n {array} + * Array representation of key. + * @returns {string} + * Base32 string representation of key. + */ + ns.base32encode = utils.base32encode; - this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; - this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; - this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; - this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; - this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; - this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; - this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; - this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; -}; + /** + * Decodes a base32 representation of a key to an internally + * compatible array representation. + * + * @function + * @param n {string} + * Base32 string representation of key. + * @returns {array} + * Array representation of key. + */ + ns.base32decode = utils.base32decode; -poly1305.prototype.blocks = function(m, mpos, bytes) { - var hibit = this.fin ? 0 : (1 << 11); - var t0, t1, t2, t3, t4, t5, t6, t7, c; - var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; +module.exports = ns; - var h0 = this.h[0], - h1 = this.h[1], - h2 = this.h[2], - h3 = this.h[3], - h4 = this.h[4], - h5 = this.h[5], - h6 = this.h[6], - h7 = this.h[7], - h8 = this.h[8], - h9 = this.h[9]; - var r0 = this.r[0], - r1 = this.r[1], - r2 = this.r[2], - r3 = this.r[3], - r4 = this.r[4], - r5 = this.r[5], - r6 = this.r[6], - r7 = this.r[7], - r8 = this.r[8], - r9 = this.r[9]; +/***/ }), +/* 152 */ +/***/ (function(module, exports, __webpack_require__) { - while (bytes >= 16) { - t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; - t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; - t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; - h5 += ((t4 >>> 1)) & 0x1fff; - t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; - t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - h9 += ((t7 >>> 5)) | hibit; +var json = typeof JSON !== 'undefined' ? JSON : __webpack_require__(547); - c = 0; +module.exports = function (obj, opts) { + if (!opts) opts = {}; + if (typeof opts === 'function') opts = { cmp: opts }; + var space = opts.space || ''; + if (typeof space === 'number') space = Array(space+1).join(' '); + var cycles = (typeof opts.cycles === 'boolean') ? opts.cycles : false; + var replacer = opts.replacer || function(key, value) { return value; }; - d0 = c; - d0 += h0 * r0; - d0 += h1 * (5 * r9); - d0 += h2 * (5 * r8); - d0 += h3 * (5 * r7); - d0 += h4 * (5 * r6); - c = (d0 >>> 13); d0 &= 0x1fff; - d0 += h5 * (5 * r5); - d0 += h6 * (5 * r4); - d0 += h7 * (5 * r3); - d0 += h8 * (5 * r2); - d0 += h9 * (5 * r1); - c += (d0 >>> 13); d0 &= 0x1fff; + var cmp = opts.cmp && (function (f) { + return function (node) { + return function (a, b) { + var aobj = { key: a, value: node[a] }; + var bobj = { key: b, value: node[b] }; + return f(aobj, bobj); + }; + }; + })(opts.cmp); - d1 = c; - d1 += h0 * r1; - d1 += h1 * r0; - d1 += h2 * (5 * r9); - d1 += h3 * (5 * r8); - d1 += h4 * (5 * r7); - c = (d1 >>> 13); d1 &= 0x1fff; - d1 += h5 * (5 * r6); - d1 += h6 * (5 * r5); - d1 += h7 * (5 * r4); - d1 += h8 * (5 * r3); - d1 += h9 * (5 * r2); - c += (d1 >>> 13); d1 &= 0x1fff; + var seen = []; + return (function stringify (parent, key, node, level) { + var indent = space ? ('\n' + new Array(level + 1).join(space)) : ''; + var colonSeparator = space ? ': ' : ':'; - d2 = c; - d2 += h0 * r2; - d2 += h1 * r1; - d2 += h2 * r0; - d2 += h3 * (5 * r9); - d2 += h4 * (5 * r8); - c = (d2 >>> 13); d2 &= 0x1fff; - d2 += h5 * (5 * r7); - d2 += h6 * (5 * r6); - d2 += h7 * (5 * r5); - d2 += h8 * (5 * r4); - d2 += h9 * (5 * r3); - c += (d2 >>> 13); d2 &= 0x1fff; + if (node && node.toJSON && typeof node.toJSON === 'function') { + node = node.toJSON(); + } - d3 = c; - d3 += h0 * r3; - d3 += h1 * r2; - d3 += h2 * r1; - d3 += h3 * r0; - d3 += h4 * (5 * r9); - c = (d3 >>> 13); d3 &= 0x1fff; - d3 += h5 * (5 * r8); - d3 += h6 * (5 * r7); - d3 += h7 * (5 * r6); - d3 += h8 * (5 * r5); - d3 += h9 * (5 * r4); - c += (d3 >>> 13); d3 &= 0x1fff; + node = replacer.call(parent, key, node); - d4 = c; - d4 += h0 * r4; - d4 += h1 * r3; - d4 += h2 * r2; - d4 += h3 * r1; - d4 += h4 * r0; - c = (d4 >>> 13); d4 &= 0x1fff; - d4 += h5 * (5 * r9); - d4 += h6 * (5 * r8); - d4 += h7 * (5 * r7); - d4 += h8 * (5 * r6); - d4 += h9 * (5 * r5); - c += (d4 >>> 13); d4 &= 0x1fff; + if (node === undefined) { + return; + } + if (typeof node !== 'object' || node === null) { + return json.stringify(node); + } + if (isArray(node)) { + var out = []; + for (var i = 0; i < node.length; i++) { + var item = stringify(node, i, node[i], level+1) || json.stringify(null); + out.push(indent + space + item); + } + return '[' + out.join(',') + indent + ']'; + } + else { + if (seen.indexOf(node) !== -1) { + if (cycles) return json.stringify('__cycle__'); + throw new TypeError('Converting circular structure to JSON'); + } + else seen.push(node); - d5 = c; - d5 += h0 * r5; - d5 += h1 * r4; - d5 += h2 * r3; - d5 += h3 * r2; - d5 += h4 * r1; - c = (d5 >>> 13); d5 &= 0x1fff; - d5 += h5 * r0; - d5 += h6 * (5 * r9); - d5 += h7 * (5 * r8); - d5 += h8 * (5 * r7); - d5 += h9 * (5 * r6); - c += (d5 >>> 13); d5 &= 0x1fff; + var keys = objectKeys(node).sort(cmp && cmp(node)); + var out = []; + for (var i = 0; i < keys.length; i++) { + var key = keys[i]; + var value = stringify(node, key, node[key], level+1); - d6 = c; - d6 += h0 * r6; - d6 += h1 * r5; - d6 += h2 * r4; - d6 += h3 * r3; - d6 += h4 * r2; - c = (d6 >>> 13); d6 &= 0x1fff; - d6 += h5 * r1; - d6 += h6 * r0; - d6 += h7 * (5 * r9); - d6 += h8 * (5 * r8); - d6 += h9 * (5 * r7); - c += (d6 >>> 13); d6 &= 0x1fff; + if(!value) continue; - d7 = c; - d7 += h0 * r7; - d7 += h1 * r6; - d7 += h2 * r5; - d7 += h3 * r4; - d7 += h4 * r3; - c = (d7 >>> 13); d7 &= 0x1fff; - d7 += h5 * r2; - d7 += h6 * r1; - d7 += h7 * r0; - d7 += h8 * (5 * r9); - d7 += h9 * (5 * r8); - c += (d7 >>> 13); d7 &= 0x1fff; + var keyValue = json.stringify(key) + + colonSeparator + + value; + ; + out.push(indent + space + keyValue); + } + seen.splice(seen.indexOf(node), 1); + return '{' + out.join(',') + indent + '}'; + } + })({ '': obj }, '', obj, 0); +}; - d8 = c; - d8 += h0 * r8; - d8 += h1 * r7; - d8 += h2 * r6; - d8 += h3 * r5; - d8 += h4 * r4; - c = (d8 >>> 13); d8 &= 0x1fff; - d8 += h5 * r3; - d8 += h6 * r2; - d8 += h7 * r1; - d8 += h8 * r0; - d8 += h9 * (5 * r9); - c += (d8 >>> 13); d8 &= 0x1fff; +var isArray = Array.isArray || function (x) { + return {}.toString.call(x) === '[object Array]'; +}; - d9 = c; - d9 += h0 * r9; - d9 += h1 * r8; - d9 += h2 * r7; - d9 += h3 * r6; - d9 += h4 * r5; - c = (d9 >>> 13); d9 &= 0x1fff; - d9 += h5 * r4; - d9 += h6 * r3; - d9 += h7 * r2; - d9 += h8 * r1; - d9 += h9 * r0; - c += (d9 >>> 13); d9 &= 0x1fff; +var objectKeys = Object.keys || function (obj) { + var has = Object.prototype.hasOwnProperty || function () { return true }; + var keys = []; + for (var key in obj) { + if (has.call(obj, key)) keys.push(key); + } + return keys; +}; - c = (((c << 2) + c)) | 0; - c = (c + d0) | 0; - d0 = c & 0x1fff; - c = (c >>> 13); - d1 += c; - h0 = d0; - h1 = d1; - h2 = d2; - h3 = d3; - h4 = d4; - h5 = d5; - h6 = d6; - h7 = d7; - h8 = d8; - h9 = d9; +/***/ }), +/* 153 */ +/***/ (function(module, exports, __webpack_require__) { - mpos += 16; - bytes -= 16; - } - this.h[0] = h0; - this.h[1] = h1; - this.h[2] = h2; - this.h[3] = h3; - this.h[4] = h4; - this.h[5] = h5; - this.h[6] = h6; - this.h[7] = h7; - this.h[8] = h8; - this.h[9] = h9; -}; +var isBuffer = __webpack_require__(532); +var toString = Object.prototype.toString; -poly1305.prototype.finish = function(mac, macpos) { - var g = new Uint16Array(10); - var c, mask, f, i; +/** + * Get the native `typeof` a value. + * + * @param {*} `val` + * @return {*} Native javascript type + */ - if (this.leftover) { - i = this.leftover; - this.buffer[i++] = 1; - for (; i < 16; i++) this.buffer[i] = 0; - this.fin = 1; - this.blocks(this.buffer, 0, 16); +module.exports = function kindOf(val) { + // primitivies + if (typeof val === 'undefined') { + return 'undefined'; + } + if (val === null) { + return 'null'; + } + if (val === true || val === false || val instanceof Boolean) { + return 'boolean'; + } + if (typeof val === 'string' || val instanceof String) { + return 'string'; + } + if (typeof val === 'number' || val instanceof Number) { + return 'number'; } - c = this.h[1] >>> 13; - this.h[1] &= 0x1fff; - for (i = 2; i < 10; i++) { - this.h[i] += c; - c = this.h[i] >>> 13; - this.h[i] &= 0x1fff; + // functions + if (typeof val === 'function' || val instanceof Function) { + return 'function'; } - this.h[0] += (c * 5); - c = this.h[0] >>> 13; - this.h[0] &= 0x1fff; - this.h[1] += c; - c = this.h[1] >>> 13; - this.h[1] &= 0x1fff; - this.h[2] += c; - g[0] = this.h[0] + 5; - c = g[0] >>> 13; - g[0] &= 0x1fff; - for (i = 1; i < 10; i++) { - g[i] = this.h[i] + c; - c = g[i] >>> 13; - g[i] &= 0x1fff; + // array + if (typeof Array.isArray !== 'undefined' && Array.isArray(val)) { + return 'array'; } - g[9] -= (1 << 13); - mask = (c ^ 1) - 1; - for (i = 0; i < 10; i++) g[i] &= mask; - mask = ~mask; - for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i]; + // check for instances of RegExp and Date before calling `toString` + if (val instanceof RegExp) { + return 'regexp'; + } + if (val instanceof Date) { + return 'date'; + } - this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff; - this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff; - this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff; - this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff; - this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff; - this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff; - this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff; - this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff; + // other objects + var type = toString.call(val); - f = this.h[0] + this.pad[0]; - this.h[0] = f & 0xffff; - for (i = 1; i < 8; i++) { - f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0; - this.h[i] = f & 0xffff; + if (type === '[object RegExp]') { + return 'regexp'; + } + if (type === '[object Date]') { + return 'date'; + } + if (type === '[object Arguments]') { + return 'arguments'; + } + if (type === '[object Error]') { + return 'error'; } - mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; - mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; - mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; - mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; - mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; - mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; - mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; - mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; - mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; - mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; - mac[macpos+10] = (this.h[5] >>> 0) & 0xff; - mac[macpos+11] = (this.h[5] >>> 8) & 0xff; - mac[macpos+12] = (this.h[6] >>> 0) & 0xff; - mac[macpos+13] = (this.h[6] >>> 8) & 0xff; - mac[macpos+14] = (this.h[7] >>> 0) & 0xff; - mac[macpos+15] = (this.h[7] >>> 8) & 0xff; -}; + // buffer + if (isBuffer(val)) { + return 'buffer'; + } -poly1305.prototype.update = function(m, mpos, bytes) { - var i, want; + // es6: Map, WeakMap, Set, WeakSet + if (type === '[object Set]') { + return 'set'; + } + if (type === '[object WeakSet]') { + return 'weakset'; + } + if (type === '[object Map]') { + return 'map'; + } + if (type === '[object WeakMap]') { + return 'weakmap'; + } + if (type === '[object Symbol]') { + return 'symbol'; + } - if (this.leftover) { - want = (16 - this.leftover); - if (want > bytes) - want = bytes; - for (i = 0; i < want; i++) - this.buffer[this.leftover + i] = m[mpos+i]; - bytes -= want; - mpos += want; - this.leftover += want; - if (this.leftover < 16) - return; - this.blocks(this.buffer, 0, 16); - this.leftover = 0; + // typed arrays + if (type === '[object Int8Array]') { + return 'int8array'; + } + if (type === '[object Uint8Array]') { + return 'uint8array'; + } + if (type === '[object Uint8ClampedArray]') { + return 'uint8clampedarray'; + } + if (type === '[object Int16Array]') { + return 'int16array'; + } + if (type === '[object Uint16Array]') { + return 'uint16array'; } - - if (bytes >= 16) { - want = bytes - (bytes % 16); - this.blocks(m, mpos, want); - mpos += want; - bytes -= want; + if (type === '[object Int32Array]') { + return 'int32array'; } - - if (bytes) { - for (i = 0; i < bytes; i++) - this.buffer[this.leftover + i] = m[mpos+i]; - this.leftover += bytes; + if (type === '[object Uint32Array]') { + return 'uint32array'; } + if (type === '[object Float32Array]') { + return 'float32array'; + } + if (type === '[object Float64Array]') { + return 'float64array'; + } + + // must be a plain object + return 'object'; }; -function crypto_onetimeauth(out, outpos, m, mpos, n, k) { - var s = new poly1305(k); - s.update(m, mpos, n); - s.finish(out, outpos); - return 0; -} -function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { - var x = new Uint8Array(16); - crypto_onetimeauth(x,0,m,mpos,n,k); - return crypto_verify_16(h,hpos,x,0); -} +/***/ }), +/* 154 */ +/***/ (function(module, exports, __webpack_require__) { -function crypto_secretbox(c,m,d,n,k) { - var i; - if (d < 32) return -1; - crypto_stream_xor(c,0,m,0,d,n,k); - crypto_onetimeauth(c, 16, c, 32, d - 32, c); - for (i = 0; i < 16; i++) c[i] = 0; - return 0; -} +"use strict"; -function crypto_secretbox_open(m,c,d,n,k) { - var i; - var x = new Uint8Array(32); - if (d < 32) return -1; - crypto_stream(x,0,32,n,k); - if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; - crypto_stream_xor(m,0,c,0,d,n,k); - for (i = 0; i < 32; i++) m[i] = 0; - return 0; -} -function set25519(r, a) { - var i; - for (i = 0; i < 16; i++) r[i] = a[i]|0; -} +var win32 = process && process.platform === 'win32'; +var path = __webpack_require__(1); +var fileRe = __webpack_require__(467); +var utils = module.exports; -function car25519(o) { - var i, v, c = 1; - for (i = 0; i < 16; i++) { - v = o[i] + c + 65535; - c = Math.floor(v / 65536); - o[i] = v - c * 65536; - } - o[0] += c-1 + 37 * (c-1); -} +/** + * Module dependencies + */ -function sel25519(p, q, b) { - var t, c = ~(b-1); - for (var i = 0; i < 16; i++) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } -} +utils.diff = __webpack_require__(315); +utils.unique = __webpack_require__(318); +utils.braces = __webpack_require__(401); +utils.brackets = __webpack_require__(459); +utils.extglob = __webpack_require__(466); +utils.isExtglob = __webpack_require__(100); +utils.isGlob = __webpack_require__(101); +utils.typeOf = __webpack_require__(153); +utils.normalize = __webpack_require__(563); +utils.omit = __webpack_require__(565); +utils.parseGlob = __webpack_require__(568); +utils.cache = __webpack_require__(583); -function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for (i = 0; i < 16; i++) t[i] = n[i]; - car25519(t); - car25519(t); - car25519(t); - for (j = 0; j < 2; j++) { - m[0] = t[0] - 0xffed; - for (i = 1; i < 15; i++) { - m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); - m[i-1] &= 0xffff; +/** + * Get the filename of a filepath + * + * @param {String} `string` + * @return {String} + */ + +utils.filename = function filename(fp) { + var seg = fp.match(fileRe()); + return seg && seg[0]; +}; + +/** + * Returns a function that returns true if the given + * pattern is the same as a given `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ + +utils.isPath = function isPath(pattern, opts) { + opts = opts || {}; + return function(fp) { + var unixified = utils.unixify(fp, opts); + if(opts.nocase){ + return pattern.toLowerCase() === unixified.toLowerCase(); } - m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); - b = (m[15]>>16) & 1; - m[14] &= 0xffff; - sel25519(t, m, 1-b); - } - for (i = 0; i < 16; i++) { - o[2*i] = t[i] & 0xff; - o[2*i+1] = t[i]>>8; - } -} + return pattern === unixified; + }; +}; -function neq25519(a, b) { - var c = new Uint8Array(32), d = new Uint8Array(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); -} +/** + * Returns a function that returns true if the given + * pattern contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ -function par25519(a) { - var d = new Uint8Array(32); - pack25519(d, a); - return d[0] & 1; -} +utils.hasPath = function hasPath(pattern, opts) { + return function(fp) { + return utils.unixify(pattern, opts).indexOf(fp) !== -1; + }; +}; -function unpack25519(o, n) { - var i; - for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); - o[15] &= 0x7fff; -} +/** + * Returns a function that returns true if the given + * pattern matches or contains a `filepath` + * + * @param {String} `pattern` + * @return {Function} + */ -function A(o, a, b) { - for (var i = 0; i < 16; i++) o[i] = a[i] + b[i]; -} +utils.matchPath = function matchPath(pattern, opts) { + var fn = (opts && opts.contains) + ? utils.hasPath(pattern, opts) + : utils.isPath(pattern, opts); + return fn; +}; -function Z(o, a, b) { - for (var i = 0; i < 16; i++) o[i] = a[i] - b[i]; -} +/** + * Returns a function that returns true if the given + * regex matches the `filename` of a file path. + * + * @param {RegExp} `re` + * @return {Boolean} + */ -function M(o, a, b) { - var v, c, - t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, - t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, - t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, - t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, - b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3], - b4 = b[4], - b5 = b[5], - b6 = b[6], - b7 = b[7], - b8 = b[8], - b9 = b[9], - b10 = b[10], - b11 = b[11], - b12 = b[12], - b13 = b[13], - b14 = b[14], - b15 = b[15]; +utils.hasFilename = function hasFilename(re) { + return function(fp) { + var name = utils.filename(fp); + return name && re.test(name); + }; +}; - v = a[0]; - t0 += v * b0; - t1 += v * b1; - t2 += v * b2; - t3 += v * b3; - t4 += v * b4; - t5 += v * b5; - t6 += v * b6; - t7 += v * b7; - t8 += v * b8; - t9 += v * b9; - t10 += v * b10; - t11 += v * b11; - t12 += v * b12; - t13 += v * b13; - t14 += v * b14; - t15 += v * b15; - v = a[1]; - t1 += v * b0; - t2 += v * b1; - t3 += v * b2; - t4 += v * b3; - t5 += v * b4; - t6 += v * b5; - t7 += v * b6; - t8 += v * b7; - t9 += v * b8; - t10 += v * b9; - t11 += v * b10; - t12 += v * b11; - t13 += v * b12; - t14 += v * b13; - t15 += v * b14; - t16 += v * b15; - v = a[2]; - t2 += v * b0; - t3 += v * b1; - t4 += v * b2; - t5 += v * b3; - t6 += v * b4; - t7 += v * b5; - t8 += v * b6; - t9 += v * b7; - t10 += v * b8; - t11 += v * b9; - t12 += v * b10; - t13 += v * b11; - t14 += v * b12; - t15 += v * b13; - t16 += v * b14; - t17 += v * b15; - v = a[3]; - t3 += v * b0; - t4 += v * b1; - t5 += v * b2; - t6 += v * b3; - t7 += v * b4; - t8 += v * b5; - t9 += v * b6; - t10 += v * b7; - t11 += v * b8; - t12 += v * b9; - t13 += v * b10; - t14 += v * b11; - t15 += v * b12; - t16 += v * b13; - t17 += v * b14; - t18 += v * b15; - v = a[4]; - t4 += v * b0; - t5 += v * b1; - t6 += v * b2; - t7 += v * b3; - t8 += v * b4; - t9 += v * b5; - t10 += v * b6; - t11 += v * b7; - t12 += v * b8; - t13 += v * b9; - t14 += v * b10; - t15 += v * b11; - t16 += v * b12; - t17 += v * b13; - t18 += v * b14; - t19 += v * b15; - v = a[5]; - t5 += v * b0; - t6 += v * b1; - t7 += v * b2; - t8 += v * b3; - t9 += v * b4; - t10 += v * b5; - t11 += v * b6; - t12 += v * b7; - t13 += v * b8; - t14 += v * b9; - t15 += v * b10; - t16 += v * b11; - t17 += v * b12; - t18 += v * b13; - t19 += v * b14; - t20 += v * b15; - v = a[6]; - t6 += v * b0; - t7 += v * b1; - t8 += v * b2; - t9 += v * b3; - t10 += v * b4; - t11 += v * b5; - t12 += v * b6; - t13 += v * b7; - t14 += v * b8; - t15 += v * b9; - t16 += v * b10; - t17 += v * b11; - t18 += v * b12; - t19 += v * b13; - t20 += v * b14; - t21 += v * b15; - v = a[7]; - t7 += v * b0; - t8 += v * b1; - t9 += v * b2; - t10 += v * b3; - t11 += v * b4; - t12 += v * b5; - t13 += v * b6; - t14 += v * b7; - t15 += v * b8; - t16 += v * b9; - t17 += v * b10; - t18 += v * b11; - t19 += v * b12; - t20 += v * b13; - t21 += v * b14; - t22 += v * b15; - v = a[8]; - t8 += v * b0; - t9 += v * b1; - t10 += v * b2; - t11 += v * b3; - t12 += v * b4; - t13 += v * b5; - t14 += v * b6; - t15 += v * b7; - t16 += v * b8; - t17 += v * b9; - t18 += v * b10; - t19 += v * b11; - t20 += v * b12; - t21 += v * b13; - t22 += v * b14; - t23 += v * b15; - v = a[9]; - t9 += v * b0; - t10 += v * b1; - t11 += v * b2; - t12 += v * b3; - t13 += v * b4; - t14 += v * b5; - t15 += v * b6; - t16 += v * b7; - t17 += v * b8; - t18 += v * b9; - t19 += v * b10; - t20 += v * b11; - t21 += v * b12; - t22 += v * b13; - t23 += v * b14; - t24 += v * b15; - v = a[10]; - t10 += v * b0; - t11 += v * b1; - t12 += v * b2; - t13 += v * b3; - t14 += v * b4; - t15 += v * b5; - t16 += v * b6; - t17 += v * b7; - t18 += v * b8; - t19 += v * b9; - t20 += v * b10; - t21 += v * b11; - t22 += v * b12; - t23 += v * b13; - t24 += v * b14; - t25 += v * b15; - v = a[11]; - t11 += v * b0; - t12 += v * b1; - t13 += v * b2; - t14 += v * b3; - t15 += v * b4; - t16 += v * b5; - t17 += v * b6; - t18 += v * b7; - t19 += v * b8; - t20 += v * b9; - t21 += v * b10; - t22 += v * b11; - t23 += v * b12; - t24 += v * b13; - t25 += v * b14; - t26 += v * b15; - v = a[12]; - t12 += v * b0; - t13 += v * b1; - t14 += v * b2; - t15 += v * b3; - t16 += v * b4; - t17 += v * b5; - t18 += v * b6; - t19 += v * b7; - t20 += v * b8; - t21 += v * b9; - t22 += v * b10; - t23 += v * b11; - t24 += v * b12; - t25 += v * b13; - t26 += v * b14; - t27 += v * b15; - v = a[13]; - t13 += v * b0; - t14 += v * b1; - t15 += v * b2; - t16 += v * b3; - t17 += v * b4; - t18 += v * b5; - t19 += v * b6; - t20 += v * b7; - t21 += v * b8; - t22 += v * b9; - t23 += v * b10; - t24 += v * b11; - t25 += v * b12; - t26 += v * b13; - t27 += v * b14; - t28 += v * b15; - v = a[14]; - t14 += v * b0; - t15 += v * b1; - t16 += v * b2; - t17 += v * b3; - t18 += v * b4; - t19 += v * b5; - t20 += v * b6; - t21 += v * b7; - t22 += v * b8; - t23 += v * b9; - t24 += v * b10; - t25 += v * b11; - t26 += v * b12; - t27 += v * b13; - t28 += v * b14; - t29 += v * b15; - v = a[15]; - t15 += v * b0; - t16 += v * b1; - t17 += v * b2; - t18 += v * b3; - t19 += v * b4; - t20 += v * b5; - t21 += v * b6; - t22 += v * b7; - t23 += v * b8; - t24 += v * b9; - t25 += v * b10; - t26 += v * b11; - t27 += v * b12; - t28 += v * b13; - t29 += v * b14; - t30 += v * b15; +/** + * Coerce `val` to an array + * + * @param {*} val + * @return {Array} + */ + +utils.arrayify = function arrayify(val) { + return !Array.isArray(val) + ? [val] + : val; +}; + +/** + * Normalize all slashes in a file path or glob pattern to + * forward slashes. + */ + +utils.unixify = function unixify(fp, opts) { + if (opts && opts.unixify === false) return fp; + if (opts && opts.unixify === true || win32 || path.sep === '\\') { + return utils.normalize(fp, false); + } + if (opts && opts.unescape === true) { + return fp ? fp.toString().replace(/\\(\w)/g, '$1') : ''; + } + return fp; +}; - t0 += 38 * t16; - t1 += 38 * t17; - t2 += 38 * t18; - t3 += 38 * t19; - t4 += 38 * t20; - t5 += 38 * t21; - t6 += 38 * t22; - t7 += 38 * t23; - t8 += 38 * t24; - t9 += 38 * t25; - t10 += 38 * t26; - t11 += 38 * t27; - t12 += 38 * t28; - t13 += 38 * t29; - t14 += 38 * t30; - // t15 left as is +/** + * Escape/unescape utils + */ - // first car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); +utils.escapePath = function escapePath(fp) { + return fp.replace(/[\\.]/g, '\\$&'); +}; - // second car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); +utils.unescapeGlob = function unescapeGlob(fp) { + return fp.replace(/[\\"']/g, ''); +}; - o[ 0] = t0; - o[ 1] = t1; - o[ 2] = t2; - o[ 3] = t3; - o[ 4] = t4; - o[ 5] = t5; - o[ 6] = t6; - o[ 7] = t7; - o[ 8] = t8; - o[ 9] = t9; - o[10] = t10; - o[11] = t11; - o[12] = t12; - o[13] = t13; - o[14] = t14; - o[15] = t15; +utils.escapeRe = function escapeRe(str) { + return str.replace(/[-[\\$*+?.#^\s{}(|)\]]/g, '\\$&'); +}; + +/** + * Expose `utils` + */ + +module.exports = utils; + + +/***/ }), +/* 155 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = minimatch +minimatch.Minimatch = Minimatch + +var path = { sep: '/' } +try { + path = __webpack_require__(1) +} catch (er) {} + +var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {} +var expand = __webpack_require__(400) + +var plTypes = { + '!': { open: '(?:(?!(?:', close: '))[^/]*?)'}, + '?': { open: '(?:', close: ')?' }, + '+': { open: '(?:', close: ')+' }, + '*': { open: '(?:', close: ')*' }, + '@': { open: '(?:', close: ')' } } -function S(o, a) { - M(o, a, a); +// any single thing other than / +// don't need to escape / when using new RegExp() +var qmark = '[^/]' + +// * => any number of characters +var star = qmark + '*?' + +// ** when dots are allowed. Anything goes, except .. and . +// not (^ or / followed by one or two dots followed by $ or /), +// followed by anything, any number of times. +var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?' + +// not a ^ or / followed by a dot, +// followed by anything, any number of times. +var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?' + +// characters that need to be escaped in RegExp. +var reSpecials = charSet('().*{}+?[]^$\\!') + +// "abc" -> { a:true, b:true, c:true } +function charSet (s) { + return s.split('').reduce(function (set, c) { + set[c] = true + return set + }, {}) } -function inv25519(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 253; a >= 0; a--) { - S(c, c); - if(a !== 2 && a !== 4) M(c, c, i); +// normalizes slashes. +var slashSplit = /\/+/ + +minimatch.filter = filter +function filter (pattern, options) { + options = options || {} + return function (p, i, list) { + return minimatch(p, pattern, options) } - for (a = 0; a < 16; a++) o[a] = c[a]; } -function pow2523(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 250; a >= 0; a--) { - S(c, c); - if(a !== 1) M(c, c, i); +function ext (a, b) { + a = a || {} + b = b || {} + var t = {} + Object.keys(b).forEach(function (k) { + t[k] = b[k] + }) + Object.keys(a).forEach(function (k) { + t[k] = a[k] + }) + return t +} + +minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return minimatch + + var orig = minimatch + + var m = function minimatch (p, pattern, options) { + return orig.minimatch(p, pattern, ext(def, options)) } - for (a = 0; a < 16; a++) o[a] = c[a]; + + m.Minimatch = function Minimatch (pattern, options) { + return new orig.Minimatch(pattern, ext(def, options)) + } + + return m } -function crypto_scalarmult(q, n, p) { - var z = new Uint8Array(32); - var x = new Float64Array(80), r, i; - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(); - for (i = 0; i < 31; i++) z[i] = n[i]; - z[31]=(n[31]&127)|64; - z[0]&=248; - unpack25519(x,p); - for (i = 0; i < 16; i++) { - b[i]=x[i]; - d[i]=a[i]=c[i]=0; +Minimatch.defaults = function (def) { + if (!def || !Object.keys(def).length) return Minimatch + return minimatch.defaults(def).Minimatch +} + +function minimatch (p, pattern, options) { + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') } - a[0]=d[0]=1; - for (i=254; i>=0; --i) { - r=(z[i>>>3]>>>(i&7))&1; - sel25519(a,b,r); - sel25519(c,d,r); - A(e,a,c); - Z(a,a,c); - A(c,b,d); - Z(b,b,d); - S(d,e); - S(f,a); - M(a,c,a); - M(c,b,e); - A(e,a,c); - Z(a,a,c); - S(b,a); - Z(c,d,f); - M(a,c,_121665); - A(a,a,d); - M(c,c,a); - M(a,d,f); - M(d,b,x); - S(b,e); - sel25519(a,b,r); - sel25519(c,d,r); + + if (!options) options = {} + + // shortcut: comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + return false } - for (i = 0; i < 16; i++) { - x[i+16]=a[i]; - x[i+32]=c[i]; - x[i+48]=b[i]; - x[i+64]=d[i]; + + // "" only matches "" + if (pattern.trim() === '') return p === '' + + return new Minimatch(pattern, options).match(p) +} + +function Minimatch (pattern, options) { + if (!(this instanceof Minimatch)) { + return new Minimatch(pattern, options) } - var x32 = x.subarray(32); - var x16 = x.subarray(16); - inv25519(x32,x32); - M(x16,x16,x32); - pack25519(q,x16); - return 0; + + if (typeof pattern !== 'string') { + throw new TypeError('glob pattern string required') + } + + if (!options) options = {} + pattern = pattern.trim() + + // windows support: need to use /, not \ + if (path.sep !== '/') { + pattern = pattern.split(path.sep).join('/') + } + + this.options = options + this.set = [] + this.pattern = pattern + this.regexp = null + this.negate = false + this.comment = false + this.empty = false + + // make the set of regexps etc. + this.make() +} + +Minimatch.prototype.debug = function () {} + +Minimatch.prototype.make = make +function make () { + // don't do it more than once. + if (this._made) return + + var pattern = this.pattern + var options = this.options + + // empty patterns and comments match nothing. + if (!options.nocomment && pattern.charAt(0) === '#') { + this.comment = true + return + } + if (!pattern) { + this.empty = true + return + } + + // step 1: figure out negation, etc. + this.parseNegate() + + // step 2: expand braces + var set = this.globSet = this.braceExpand() + + if (options.debug) this.debug = console.error + + this.debug(this.pattern, set) + + // step 3: now we have a set, so turn each one into a series of path-portion + // matching patterns. + // These will be regexps, except in the case of "**", which is + // set to the GLOBSTAR object for globstar behavior, + // and will not contain any / characters + set = this.globParts = set.map(function (s) { + return s.split(slashSplit) + }) + + this.debug(this.pattern, set) + + // glob --> regexps + set = set.map(function (s, si, set) { + return s.map(this.parse, this) + }, this) + + this.debug(this.pattern, set) + + // filter out everything that didn't compile properly. + set = set.filter(function (s) { + return s.indexOf(false) === -1 + }) + + this.debug(this.pattern, set) + + this.set = set +} + +Minimatch.prototype.parseNegate = parseNegate +function parseNegate () { + var pattern = this.pattern + var negate = false + var options = this.options + var negateOffset = 0 + + if (options.nonegate) return + + for (var i = 0, l = pattern.length + ; i < l && pattern.charAt(i) === '!' + ; i++) { + negate = !negate + negateOffset++ + } + + if (negateOffset) this.pattern = pattern.substr(negateOffset) + this.negate = negate +} + +// Brace expansion: +// a{b,c}d -> abd acd +// a{b,}c -> abc ac +// a{0..3}d -> a0d a1d a2d a3d +// a{b,c{d,e}f}g -> abg acdfg acefg +// a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg +// +// Invalid sets are not expanded. +// a{2..}b -> a{2..}b +// a{b}c -> a{b}c +minimatch.braceExpand = function (pattern, options) { + return braceExpand(pattern, options) +} + +Minimatch.prototype.braceExpand = braceExpand + +function braceExpand (pattern, options) { + if (!options) { + if (this instanceof Minimatch) { + options = this.options + } else { + options = {} + } + } + + pattern = typeof pattern === 'undefined' + ? this.pattern : pattern + + if (typeof pattern === 'undefined') { + throw new TypeError('undefined pattern') + } + + if (options.nobrace || + !pattern.match(/\{.*\}/)) { + // shortcut. no need to expand. + return [pattern] + } + + return expand(pattern) } -function crypto_scalarmult_base(q, n) { - return crypto_scalarmult(q, n, _9); -} +// parse a component of the expanded set. +// At this point, no pattern may contain "/" in it +// so we're going to return a 2d array, where each entry is the full +// pattern, split on '/', and then turned into a regular expression. +// A regexp is made at the end which joins each array with an +// escaped /, and another full one which joins each regexp with |. +// +// Following the lead of Bash 4.1, note that "**" only has special meaning +// when it is the *only* thing in a path portion. Otherwise, any series +// of * is equivalent to a single *. Globstar behavior is enabled by +// default, and can be disabled by setting options.noglobstar. +Minimatch.prototype.parse = parse +var SUBPARSE = {} +function parse (pattern, isSub) { + if (pattern.length > 1024 * 64) { + throw new TypeError('pattern is too long') + } + + var options = this.options + + // shortcuts + if (!options.noglobstar && pattern === '**') return GLOBSTAR + if (pattern === '') return '' + + var re = '' + var hasMagic = !!options.nocase + var escaping = false + // ? => one single character + var patternListStack = [] + var negativeLists = [] + var stateChar + var inClass = false + var reClassStart = -1 + var classStart = -1 + // . and .. never match anything that doesn't start with ., + // even when options.dot is set. + var patternStart = pattern.charAt(0) === '.' ? '' // anything + // not (start or / followed by . or .. followed by / or end) + : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))' + : '(?!\\.)' + var self = this + + function clearStateChar () { + if (stateChar) { + // we had some state-tracking character + // that wasn't consumed by this pass. + switch (stateChar) { + case '*': + re += star + hasMagic = true + break + case '?': + re += qmark + hasMagic = true + break + default: + re += '\\' + stateChar + break + } + self.debug('clearStateChar %j %j', stateChar, re) + stateChar = false + } + } + + for (var i = 0, len = pattern.length, c + ; (i < len) && (c = pattern.charAt(i)) + ; i++) { + this.debug('%s\t%s %s %j', pattern, i, re, c) + + // skip over any that are escaped. + if (escaping && reSpecials[c]) { + re += '\\' + c + escaping = false + continue + } + + switch (c) { + case '/': + // completely not allowed, even escaped. + // Should already be path-split by now. + return false + + case '\\': + clearStateChar() + escaping = true + continue + + // the various stateChar values + // for the "extglob" stuff. + case '?': + case '*': + case '+': + case '@': + case '!': + this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c) + + // all of those are literals inside a class, except that + // the glob [!a] means [^a] in regexp + if (inClass) { + this.debug(' in class') + if (c === '!' && i === classStart + 1) c = '^' + re += c + continue + } + + // if we already have a stateChar, then it means + // that there was something like ** or +? in there. + // Handle the stateChar, then proceed with this one. + self.debug('call clearStateChar %j', stateChar) + clearStateChar() + stateChar = c + // if extglob is disabled, then +(asdf|foo) isn't a thing. + // just clear the statechar *now*, rather than even diving into + // the patternList stuff. + if (options.noext) clearStateChar() + continue -function crypto_box_keypair(y, x) { - randombytes(x, 32); - return crypto_scalarmult_base(y, x); -} + case '(': + if (inClass) { + re += '(' + continue + } -function crypto_box_beforenm(k, y, x) { - var s = new Uint8Array(32); - crypto_scalarmult(s, x, y); - return crypto_core_hsalsa20(k, _0, s, sigma); -} + if (!stateChar) { + re += '\\(' + continue + } -var crypto_box_afternm = crypto_secretbox; -var crypto_box_open_afternm = crypto_secretbox_open; + patternListStack.push({ + type: stateChar, + start: i - 1, + reStart: re.length, + open: plTypes[stateChar].open, + close: plTypes[stateChar].close + }) + // negation is (?:(?!js)[^/]*) + re += stateChar === '!' ? '(?:(?!(?:' : '(?:' + this.debug('plType %j %j', stateChar, re) + stateChar = false + continue -function crypto_box(c, m, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_afternm(c, m, d, n, k); -} + case ')': + if (inClass || !patternListStack.length) { + re += '\\)' + continue + } -function crypto_box_open(m, c, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_open_afternm(m, c, d, n, k); -} + clearStateChar() + hasMagic = true + var pl = patternListStack.pop() + // negation is (?:(?!js)[^/]*) + // The others are (?:) + re += pl.close + if (pl.type === '!') { + negativeLists.push(pl) + } + pl.reEnd = re.length + continue -var K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 -]; + case '|': + if (inClass || !patternListStack.length || escaping) { + re += '\\|' + escaping = false + continue + } -function crypto_hashblocks_hl(hh, hl, m, n) { - var wh = new Int32Array(16), wl = new Int32Array(16), - bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, - bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, - th, tl, i, j, h, l, a, b, c, d; + clearStateChar() + re += '|' + continue - var ah0 = hh[0], - ah1 = hh[1], - ah2 = hh[2], - ah3 = hh[3], - ah4 = hh[4], - ah5 = hh[5], - ah6 = hh[6], - ah7 = hh[7], + // these are mostly the same in regexp and glob + case '[': + // swallow any state-tracking char before the [ + clearStateChar() - al0 = hl[0], - al1 = hl[1], - al2 = hl[2], - al3 = hl[3], - al4 = hl[4], - al5 = hl[5], - al6 = hl[6], - al7 = hl[7]; + if (inClass) { + re += '\\' + c + continue + } - var pos = 0; - while (n >= 128) { - for (i = 0; i < 16; i++) { - j = 8 * i + pos; - wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3]; - wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7]; - } - for (i = 0; i < 80; i++) { - bh0 = ah0; - bh1 = ah1; - bh2 = ah2; - bh3 = ah3; - bh4 = ah4; - bh5 = ah5; - bh6 = ah6; - bh7 = ah7; + inClass = true + classStart = i + reClassStart = re.length + re += c + continue - bl0 = al0; - bl1 = al1; - bl2 = al2; - bl3 = al3; - bl4 = al4; - bl5 = al5; - bl6 = al6; - bl7 = al7; + case ']': + // a right bracket shall lose its special + // meaning and represent itself in + // a bracket expression if it occurs + // first in the list. -- POSIX.2 2.8.3.2 + if (i === classStart + 1 || !inClass) { + re += '\\' + c + escaping = false + continue + } - // add - h = ah7; - l = al7; + // handle the case where we left a class open. + // "[z-a]" is valid, equivalent to "\[z-a\]" + if (inClass) { + // split where the last [ was, make sure we don't have + // an invalid re. if so, re-walk the contents of the + // would-be class to re-translate any characters that + // were passed through as-is + // TODO: It would probably be faster to determine this + // without a try/catch and a new RegExp, but it's tricky + // to do safely. For now, this is safe and works. + var cs = pattern.substring(classStart + 1, i) + try { + RegExp('[' + cs + ']') + } catch (er) { + // not a valid class! + var sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]' + hasMagic = hasMagic || sp[1] + inClass = false + continue + } + } - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; + // finish up the class. + hasMagic = true + inClass = false + re += c + continue - // Sigma1 - h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32)))); - l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32)))); + default: + // swallow any state char that wasn't consumed + clearStateChar() - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + if (escaping) { + // no need + escaping = false + } else if (reSpecials[c] + && !(c === '^' && inClass)) { + re += '\\' + } - // Ch - h = (ah4 & ah5) ^ (~ah4 & ah6); - l = (al4 & al5) ^ (~al4 & al6); + re += c - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + } // switch + } // for - // K - h = K[i*2]; - l = K[i*2+1]; + // handle the case where we left a class open. + // "[abc" is valid, equivalent to "\[abc" + if (inClass) { + // split where the last [ was, and escape it + // this is a huge pita. We now have to re-walk + // the contents of the would-be class to re-translate + // any characters that were passed through as-is + cs = pattern.substr(classStart + 1) + sp = this.parse(cs, SUBPARSE) + re = re.substr(0, reClassStart) + '\\[' + sp[0] + hasMagic = hasMagic || sp[1] + } - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + // handle the case where we had a +( thing at the *end* + // of the pattern. + // each pattern list stack adds 3 chars, and we need to go through + // and escape any | chars that were passed through as-is for the regexp. + // Go through and escape them, taking care not to double-escape any + // | chars that were already escaped. + for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) { + var tail = re.slice(pl.reStart + pl.open.length) + this.debug('setting tail', re, pl) + // maybe some even number of \, then maybe 1 \, followed by a | + tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) { + if (!$2) { + // the | isn't already escaped, so escape it. + $2 = '\\' + } - // w - h = wh[i%16]; - l = wl[i%16]; + // need to escape all those slashes *again*, without escaping the + // one that we need for escaping the | character. As it works out, + // escaping an even number of slashes can be done by simply repeating + // it exactly after itself. That's why this trick works. + // + // I am sorry that you have to see this. + return $1 + $1 + $2 + '|' + }) - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + this.debug('tail=%j\n %s', tail, tail, pl, re) + var t = pl.type === '*' ? star + : pl.type === '?' ? qmark + : '\\' + pl.type - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + hasMagic = true + re = re.slice(0, pl.reStart) + t + '\\(' + tail + } - th = c & 0xffff | d << 16; - tl = a & 0xffff | b << 16; + // handle trailing things that only matter at the very end. + clearStateChar() + if (escaping) { + // trailing \\ + re += '\\\\' + } - // add - h = th; - l = tl; + // only need to apply the nodot start if the re starts with + // something that could conceivably capture a dot + var addPatternStart = false + switch (re.charAt(0)) { + case '.': + case '[': + case '(': addPatternStart = true + } - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; + // Hack to work around lack of negative lookbehind in JS + // A pattern like: *.!(x).!(y|z) needs to ensure that a name + // like 'a.xyz.yz' doesn't match. So, the first negative + // lookahead, has to look ALL the way ahead, to the end of + // the pattern. + for (var n = negativeLists.length - 1; n > -1; n--) { + var nl = negativeLists[n] - // Sigma0 - h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32)))); - l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32)))); + var nlBefore = re.slice(0, nl.reStart) + var nlFirst = re.slice(nl.reStart, nl.reEnd - 8) + var nlLast = re.slice(nl.reEnd - 8, nl.reEnd) + var nlAfter = re.slice(nl.reEnd) - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + nlLast += nlAfter - // Maj - h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2); - l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2); + // Handle nested stuff like *(*.js|!(*.json)), where open parens + // mean that we should *not* include the ) in the bit that is considered + // "after" the negated section. + var openParensBefore = nlBefore.split('(').length - 1 + var cleanAfter = nlAfter + for (i = 0; i < openParensBefore; i++) { + cleanAfter = cleanAfter.replace(/\)[+*?]?/, '') + } + nlAfter = cleanAfter - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + var dollar = '' + if (nlAfter === '' && isSub !== SUBPARSE) { + dollar = '$' + } + var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast + re = newRe + } - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + // if the re is not "" at this point, then we need to make sure + // it doesn't match against an empty path part. + // Otherwise a/* will match a/, which it should not. + if (re !== '' && hasMagic) { + re = '(?=.)' + re + } - bh7 = (c & 0xffff) | (d << 16); - bl7 = (a & 0xffff) | (b << 16); + if (addPatternStart) { + re = patternStart + re + } - // add - h = bh3; - l = bl3; + // parsing just a piece of a larger pattern. + if (isSub === SUBPARSE) { + return [re, hasMagic] + } - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; + // skip the regexp for non-magical patterns + // unescape anything in it, though, so that it'll be + // an exact match against a file etc. + if (!hasMagic) { + return globUnescape(pattern) + } - h = th; - l = tl; + var flags = options.nocase ? 'i' : '' + try { + var regExp = new RegExp('^' + re + '$', flags) + } catch (er) { + // If it was an invalid regular expression, then it can't match + // anything. This trick looks for a character after the end of + // the string, which is of course impossible, except in multi-line + // mode, but it's not a /m regex. + return new RegExp('$.') + } - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + regExp._glob = pattern + regExp._src = re - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + return regExp +} - bh3 = (c & 0xffff) | (d << 16); - bl3 = (a & 0xffff) | (b << 16); +minimatch.makeRe = function (pattern, options) { + return new Minimatch(pattern, options || {}).makeRe() +} - ah1 = bh0; - ah2 = bh1; - ah3 = bh2; - ah4 = bh3; - ah5 = bh4; - ah6 = bh5; - ah7 = bh6; - ah0 = bh7; +Minimatch.prototype.makeRe = makeRe +function makeRe () { + if (this.regexp || this.regexp === false) return this.regexp - al1 = bl0; - al2 = bl1; - al3 = bl2; - al4 = bl3; - al5 = bl4; - al6 = bl5; - al7 = bl6; - al0 = bl7; + // at this point, this.set is a 2d array of partial + // pattern strings, or "**". + // + // It's better to use .match(). This function shouldn't + // be used, really, but it's pretty convenient sometimes, + // when you just want to work with a regex. + var set = this.set - if (i%16 === 15) { - for (j = 0; j < 16; j++) { - // add - h = wh[j]; - l = wl[j]; + if (!set.length) { + this.regexp = false + return this.regexp + } + var options = this.options - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; + var twoStar = options.noglobstar ? star + : options.dot ? twoStarDot + : twoStarNoDot + var flags = options.nocase ? 'i' : '' - h = wh[(j+9)%16]; - l = wl[(j+9)%16]; + var re = set.map(function (pattern) { + return pattern.map(function (p) { + return (p === GLOBSTAR) ? twoStar + : (typeof p === 'string') ? regExpEscape(p) + : p._src + }).join('\\\/') + }).join('|') - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + // must match entire pattern + // ending in a * or ** will make it less strict. + re = '^(?:' + re + ')$' - // sigma0 - th = wh[(j+1)%16]; - tl = wl[(j+1)%16]; - h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7); - l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7))); + // can match anything, as long as it's not this. + if (this.negate) re = '^(?!' + re + ').*$' - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + try { + this.regexp = new RegExp(re, flags) + } catch (ex) { + this.regexp = false + } + return this.regexp +} - // sigma1 - th = wh[(j+14)%16]; - tl = wl[(j+14)%16]; - h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6); - l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6))); +minimatch.match = function (list, pattern, options) { + options = options || {} + var mm = new Minimatch(pattern, options) + list = list.filter(function (f) { + return mm.match(f) + }) + if (mm.options.nonull && !list.length) { + list.push(pattern) + } + return list +} + +Minimatch.prototype.match = match +function match (f, partial) { + this.debug('match', f, this.pattern) + // short-circuit in the case of busted things. + // comments, etc. + if (this.comment) return false + if (this.empty) return f === '' + + if (f === '/' && partial) return true - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + var options = this.options - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + // windows: need to use /, not \ + if (path.sep !== '/') { + f = f.split(path.sep).join('/') + } - wh[j] = (c & 0xffff) | (d << 16); - wl[j] = (a & 0xffff) | (b << 16); - } - } - } + // treat the test path as a set of pathparts. + f = f.split(slashSplit) + this.debug(this.pattern, 'split', f) - // add - h = ah0; - l = al0; + // just ONE of the pattern sets in this.set needs to match + // in order for it to be valid. If negating, then just one + // match means that we have failed. + // Either way, return on the first hit. - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; + var set = this.set + this.debug(this.pattern, 'set', set) - h = hh[0]; - l = hl[0]; + // Find the basename of the path by looking for the last non-empty segment + var filename + var i + for (i = f.length - 1; i >= 0; i--) { + filename = f[i] + if (filename) break + } - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + for (i = 0; i < set.length; i++) { + var pattern = set[i] + var file = f + if (options.matchBase && pattern.length === 1) { + file = [filename] + } + var hit = this.matchOne(file, pattern, partial) + if (hit) { + if (options.flipNegate) return true + return !this.negate + } + } - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + // didn't get any hits. this is success if it's a negative + // pattern, failure otherwise. + if (options.flipNegate) return false + return this.negate +} - hh[0] = ah0 = (c & 0xffff) | (d << 16); - hl[0] = al0 = (a & 0xffff) | (b << 16); +// set partial to true to test if, for example, +// "/a/b" matches the start of "/*/b/*/d" +// Partial means, if you run out of file before you run +// out of pattern, then that's fine, as long as all +// the parts match. +Minimatch.prototype.matchOne = function (file, pattern, partial) { + var options = this.options - h = ah1; - l = al1; + this.debug('matchOne', + { 'this': this, file: file, pattern: pattern }) - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; + this.debug('matchOne', file.length, pattern.length) - h = hh[1]; - l = hl[1]; + for (var fi = 0, + pi = 0, + fl = file.length, + pl = pattern.length + ; (fi < fl) && (pi < pl) + ; fi++, pi++) { + this.debug('matchOne loop') + var p = pattern[pi] + var f = file[fi] - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + this.debug(pattern, p, f) - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + // should be impossible. + // some invalid regexp stuff in the set. + if (p === false) return false - hh[1] = ah1 = (c & 0xffff) | (d << 16); - hl[1] = al1 = (a & 0xffff) | (b << 16); + if (p === GLOBSTAR) { + this.debug('GLOBSTAR', [pattern, p, f]) - h = ah2; - l = al2; + // "**" + // a/**/b/**/c would match the following: + // a/b/x/y/z/c + // a/x/y/z/b/c + // a/b/x/b/x/c + // a/b/c + // To do this, take the rest of the pattern after + // the **, and see if it would match the file remainder. + // If so, return success. + // If not, the ** "swallows" a segment, and try again. + // This is recursively awful. + // + // a/**/b/**/c matching a/b/x/y/z/c + // - a matches a + // - doublestar + // - matchOne(b/x/y/z/c, b/**/c) + // - b matches b + // - doublestar + // - matchOne(x/y/z/c, c) -> no + // - matchOne(y/z/c, c) -> no + // - matchOne(z/c, c) -> no + // - matchOne(c, c) yes, hit + var fr = fi + var pr = pi + 1 + if (pr === pl) { + this.debug('** at the end') + // a ** at the end will just swallow the rest. + // We have found a match. + // however, it will not swallow /.x, unless + // options.dot is set. + // . and .. are *never* matched by **, for explosively + // exponential reasons. + for (; fi < fl; fi++) { + if (file[fi] === '.' || file[fi] === '..' || + (!options.dot && file[fi].charAt(0) === '.')) return false + } + return true + } - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; + // ok, let's see if we can swallow whatever we can. + while (fr < fl) { + var swallowee = file[fr] - h = hh[2]; - l = hl[2]; + this.debug('\nglobstar while', file, fr, pattern, pr, swallowee) - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + // XXX remove this slice. Just pass the start index. + if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) { + this.debug('globstar found match!', fr, fl, swallowee) + // found a match. + return true + } else { + // can't swallow "." or ".." ever. + // can only swallow ".foo" when explicitly asked. + if (swallowee === '.' || swallowee === '..' || + (!options.dot && swallowee.charAt(0) === '.')) { + this.debug('dot detected!', file, fr, pattern, pr) + break + } - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + // ** swallows a segment, and continue. + this.debug('globstar swallow a segment, and continue') + fr++ + } + } - hh[2] = ah2 = (c & 0xffff) | (d << 16); - hl[2] = al2 = (a & 0xffff) | (b << 16); + // no match was found. + // However, in partial mode, we can't say this is necessarily over. + // If there's more *pattern* left, then + if (partial) { + // ran out of file + this.debug('\n>>> no match, partial?', file, fr, pattern, pr) + if (fr === fl) return true + } + return false + } - h = ah3; - l = al3; + // something other than ** + // non-magic patterns just have to match exactly + // patterns with magic have been turned into regexps. + var hit + if (typeof p === 'string') { + if (options.nocase) { + hit = f.toLowerCase() === p.toLowerCase() + } else { + hit = f === p + } + this.debug('string match', p, f, hit) + } else { + hit = f.match(p) + this.debug('pattern match', p, f, hit) + } - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; + if (!hit) return false + } - h = hh[3]; - l = hl[3]; + // Note: ending in / means that we'll get a final "" + // at the end of the pattern. This can only match a + // corresponding "" at the end of the file. + // If the file ends in /, then it can only match a + // a pattern that ends in /, unless the pattern just + // doesn't have any more for it. But, a/b/ should *not* + // match "a/b/*", even though "" matches against the + // [^/]*? pattern, except in partial mode, where it might + // simply not be reached yet. + // However, a/b/ should still satisfy a/* - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + // now either we fell off the end of the pattern, or we're done. + if (fi === fl && pi === pl) { + // ran out of pattern and filename at the same time. + // an exact hit! + return true + } else if (fi === fl) { + // ran out of file, but still had pattern left. + // this is ok if we're doing the match as part of + // a glob fs traversal. + return partial + } else if (pi === pl) { + // ran out of pattern, still have file left. + // this is only acceptable if we're on the very last + // empty segment of a file with a trailing slash. + // a/* should match a/b/ + var emptyFileEnd = (fi === fl - 1) && (file[fi] === '') + return emptyFileEnd + } - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + // should be unreachable. + throw new Error('wtf?') +} - hh[3] = ah3 = (c & 0xffff) | (d << 16); - hl[3] = al3 = (a & 0xffff) | (b << 16); +// replace stuff like \* with * +function globUnescape (s) { + return s.replace(/\\(.)/g, '$1') +} - h = ah4; - l = al4; +function regExpEscape (s) { + return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&') +} - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - h = hh[4]; - l = hl[4]; +/***/ }), +/* 156 */ +/***/ (function(module, exports, __webpack_require__) { - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; +var path = __webpack_require__(1); +var fs = __webpack_require__(6); +var _0777 = parseInt('0777', 8); - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; +module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - hh[4] = ah4 = (c & 0xffff) | (d << 16); - hl[4] = al4 = (a & 0xffff) | (b << 16); +function mkdirP (p, opts, f, made) { + if (typeof opts === 'function') { + f = opts; + opts = {}; + } + else if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 & (~process.umask()); + } + if (!made) made = null; + + var cb = f || function () {}; + p = path.resolve(p); + + xfs.mkdir(p, mode, function (er) { + if (!er) { + made = made || p; + return cb(null, made); + } + switch (er.code) { + case 'ENOENT': + mkdirP(path.dirname(p), opts, function (er, made) { + if (er) cb(er, made); + else mkdirP(p, opts, cb, made); + }); + break; - h = ah5; - l = al5; + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + xfs.stat(p, function (er2, stat) { + // if the stat fails, then that's super weird. + // let the original error be the failure reason. + if (er2 || !stat.isDirectory()) cb(er, made) + else cb(null, made); + }); + break; + } + }); +} - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; +mkdirP.sync = function sync (p, opts, made) { + if (!opts || typeof opts !== 'object') { + opts = { mode: opts }; + } + + var mode = opts.mode; + var xfs = opts.fs || fs; + + if (mode === undefined) { + mode = _0777 & (~process.umask()); + } + if (!made) made = null; - h = hh[5]; - l = hl[5]; + p = path.resolve(p); - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; + try { + xfs.mkdirSync(p, mode); + made = made || p; + } + catch (err0) { + switch (err0.code) { + case 'ENOENT' : + made = sync(path.dirname(p), opts, made); + sync(p, opts, made); + break; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; + // In the case of any other error, just see if there's a dir + // there already. If so, then hooray! If not, then something + // is borked. + default: + var stat; + try { + stat = xfs.statSync(p); + } + catch (err1) { + throw err0; + } + if (!stat.isDirectory()) throw err0; + break; + } + } - hh[5] = ah5 = (c & 0xffff) | (d << 16); - hl[5] = al5 = (a & 0xffff) | (b << 16); + return made; +}; - h = ah6; - l = al6; - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; +/***/ }), +/* 157 */ +/***/ (function(module, exports, __webpack_require__) { - h = hh[6]; - l = hl[6]; +"use strict"; - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; +function posix(path) { + return path.charAt(0) === '/'; +} - hh[6] = ah6 = (c & 0xffff) | (d << 16); - hl[6] = al6 = (a & 0xffff) | (b << 16); +function win32(path) { + // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56 + var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/; + var result = splitDeviceRe.exec(path); + var device = result[1] || ''; + var isUnc = Boolean(device && device.charAt(1) !== ':'); - h = ah7; - l = al7; + // UNC paths are always absolute + return Boolean(result[2] || isUnc); +} - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; +module.exports = process.platform === 'win32' ? win32 : posix; +module.exports.posix = posix; +module.exports.win32 = win32; - h = hh[7]; - l = hl[7]; - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; +/***/ }), +/* 158 */ +/***/ (function(module, exports, __webpack_require__) { - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; +"use strict"; - hh[7] = ah7 = (c & 0xffff) | (d << 16); - hl[7] = al7 = (a & 0xffff) | (b << 16); - pos += 128; - n -= 128; - } +if (!process.version || + process.version.indexOf('v0.') === 0 || + process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { + module.exports = nextTick; +} else { + module.exports = process.nextTick; +} - return n; +function nextTick(fn, arg1, arg2, arg3) { + if (typeof fn !== 'function') { + throw new TypeError('"callback" argument must be a function'); + } + var len = arguments.length; + var args, i; + switch (len) { + case 0: + case 1: + return process.nextTick(fn); + case 2: + return process.nextTick(function afterTickOne() { + fn.call(null, arg1); + }); + case 3: + return process.nextTick(function afterTickTwo() { + fn.call(null, arg1, arg2); + }); + case 4: + return process.nextTick(function afterTickThree() { + fn.call(null, arg1, arg2, arg3); + }); + default: + args = new Array(len - 1); + i = 0; + while (i < args.length) { + args[i++] = arguments[i]; + } + return process.nextTick(function afterTick() { + fn.apply(null, args); + }); + } } -function crypto_hash(out, m, n) { - var hh = new Int32Array(8), - hl = new Int32Array(8), - x = new Uint8Array(256), - i, b = n; - hh[0] = 0x6a09e667; - hh[1] = 0xbb67ae85; - hh[2] = 0x3c6ef372; - hh[3] = 0xa54ff53a; - hh[4] = 0x510e527f; - hh[5] = 0x9b05688c; - hh[6] = 0x1f83d9ab; - hh[7] = 0x5be0cd19; +/***/ }), +/* 159 */ +/***/ (function(module, exports, __webpack_require__) { - hl[0] = 0xf3bcc908; - hl[1] = 0x84caa73b; - hl[2] = 0xfe94f82b; - hl[3] = 0x5f1d36f1; - hl[4] = 0xade682d1; - hl[5] = 0x2b3e6c1f; - hl[6] = 0xfb41bd6b; - hl[7] = 0x137e2179; +"use strict"; - crypto_hashblocks_hl(hh, hl, m, n); - n %= 128; - for (i = 0; i < n; i++) x[i] = m[b-n+i]; - x[n] = 128; +var jsonSafeStringify = __webpack_require__(546) + , crypto = __webpack_require__(7) + , Buffer = __webpack_require__(57).Buffer - n = 256-128*(n<112?1:0); - x[n-9] = 0; - ts64(x, n-8, (b / 0x20000000) | 0, b << 3); - crypto_hashblocks_hl(hh, hl, x, n); +var defer = typeof setImmediate === 'undefined' + ? process.nextTick + : setImmediate - for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]); +function paramsHaveRequestBody(params) { + return ( + params.body || + params.requestBodyStream || + (params.json && typeof params.json !== 'boolean') || + params.multipart + ) +} - return 0; +function safeStringify (obj, replacer) { + var ret + try { + ret = JSON.stringify(obj, replacer) + } catch (e) { + ret = jsonSafeStringify(obj, replacer) + } + return ret } -function add(p, q) { - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(), - g = gf(), h = gf(), t = gf(); - - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); +function md5 (str) { + return crypto.createHash('md5').update(str).digest('hex') +} - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); +function isReadStream (rs) { + return rs.readable && rs.path && rs.mode } -function cswap(p, q, b) { - var i; - for (i = 0; i < 4; i++) { - sel25519(p[i], q[i], b); - } +function toBase64 (str) { + return Buffer.from(str || '', 'utf8').toString('base64') } -function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; +function copy (obj) { + var o = {} + Object.keys(obj).forEach(function (i) { + o[i] = obj[i] + }) + return o } -function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for (i = 255; i >= 0; --i) { - b = (s[(i/8)|0] >> (i&7)) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); +function version () { + var numbers = process.version.replace('v', '').split('.') + return { + major: parseInt(numbers[0], 10), + minor: parseInt(numbers[1], 10), + patch: parseInt(numbers[2], 10) } } -function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); -} +exports.paramsHaveRequestBody = paramsHaveRequestBody +exports.safeStringify = safeStringify +exports.md5 = md5 +exports.isReadStream = isReadStream +exports.toBase64 = toBase64 +exports.copy = copy +exports.version = version +exports.defer = defer -function crypto_sign_keypair(pk, sk, seeded) { - var d = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()]; - var i; - if (!seeded) randombytes(sk, 32); - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; +/***/ }), +/* 160 */ +/***/ (function(module, exports, __webpack_require__) { - scalarbase(p, d); - pack(pk, p); +// Copyright 2015 Joyent, Inc. - for (i = 0; i < 32; i++) sk[i+32] = pk[i]; - return 0; +module.exports = { + read: read, + readPkcs1: readPkcs1, + write: write, + writePkcs1: writePkcs1 +}; + +var assert = __webpack_require__(9); +var asn1 = __webpack_require__(34); +var algs = __webpack_require__(17); +var utils = __webpack_require__(13); + +var Key = __webpack_require__(18); +var PrivateKey = __webpack_require__(19); +var pem = __webpack_require__(40); + +var pkcs8 = __webpack_require__(74); +var readECDSACurve = pkcs8.readECDSACurve; + +function read(buf, options) { + return (pem.read(buf, options, 'pkcs1')); } -var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); +function write(key, options) { + return (pem.write(key, options, 'pkcs1')); +} -function modL(r, x) { - var carry, i, j, k; - for (i = 63; i >= 32; --i) { - carry = 0; - for (j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = (x[j] + 128) >> 8; - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for (j = 0; j < 32; j++) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for (j = 0; j < 32; j++) x[j] -= carry * L[j]; - for (i = 0; i < 32; i++) { - x[i+1] += x[i] >> 8; - r[i] = x[i] & 255; - } +/* Helper to read in a single mpint */ +function readMPInt(der, nm) { + assert.strictEqual(der.peek(), asn1.Ber.Integer, + nm + ' is not an Integer'); + return (utils.mpNormalize(der.readString(asn1.Ber.Integer, true))); } -function reduce(r) { - var x = new Float64Array(64), i; - for (i = 0; i < 64; i++) x[i] = r[i]; - for (i = 0; i < 64; i++) r[i] = 0; - modL(r, x); +function readPkcs1(alg, type, der) { + switch (alg) { + case 'RSA': + if (type === 'public') + return (readPkcs1RSAPublic(der)); + else if (type === 'private') + return (readPkcs1RSAPrivate(der)); + throw (new Error('Unknown key type: ' + type)); + case 'DSA': + if (type === 'public') + return (readPkcs1DSAPublic(der)); + else if (type === 'private') + return (readPkcs1DSAPrivate(der)); + throw (new Error('Unknown key type: ' + type)); + case 'EC': + case 'ECDSA': + if (type === 'private') + return (readPkcs1ECDSAPrivate(der)); + else if (type === 'public') + return (readPkcs1ECDSAPublic(der)); + throw (new Error('Unknown key type: ' + type)); + default: + throw (new Error('Unknown key algo: ' + alg)); + } } -// Note: difference from C - smlen returned, not passed as argument. -function crypto_sign(sm, m, n, sk) { - var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; +function readPkcs1RSAPublic(der) { + // modulus and exponent + var n = readMPInt(der, 'modulus'); + var e = readMPInt(der, 'exponent'); - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; + // now, make the key + var key = { + type: 'rsa', + parts: [ + { name: 'e', data: e }, + { name: 'n', data: n } + ] + }; - var smlen = n + 64; - for (i = 0; i < n; i++) sm[64 + i] = m[i]; - for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; + return (new Key(key)); +} - crypto_hash(r, sm.subarray(32), n+32); - reduce(r); - scalarbase(p, r); - pack(sm, p); +function readPkcs1RSAPrivate(der) { + var version = readMPInt(der, 'version'); + assert.strictEqual(version[0], 0); - for (i = 32; i < 64; i++) sm[i] = sk[i]; - crypto_hash(h, sm, n + 64); - reduce(h); + // modulus then public exponent + var n = readMPInt(der, 'modulus'); + var e = readMPInt(der, 'public exponent'); + var d = readMPInt(der, 'private exponent'); + var p = readMPInt(der, 'prime1'); + var q = readMPInt(der, 'prime2'); + var dmodp = readMPInt(der, 'exponent1'); + var dmodq = readMPInt(der, 'exponent2'); + var iqmp = readMPInt(der, 'iqmp'); - for (i = 0; i < 64; i++) x[i] = 0; - for (i = 0; i < 32; i++) x[i] = r[i]; - for (i = 0; i < 32; i++) { - for (j = 0; j < 32; j++) { - x[i+j] += h[i] * d[j]; - } - } + // now, make the key + var key = { + type: 'rsa', + parts: [ + { name: 'n', data: n }, + { name: 'e', data: e }, + { name: 'd', data: d }, + { name: 'iqmp', data: iqmp }, + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'dmodp', data: dmodp }, + { name: 'dmodq', data: dmodq } + ] + }; - modL(sm.subarray(32), x); - return smlen; + return (new PrivateKey(key)); } -function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), - den = gf(), den2 = gf(), den4 = gf(), - den6 = gf(); - - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); +function readPkcs1DSAPrivate(der) { + var version = readMPInt(der, 'version'); + assert.strictEqual(version.readUInt8(0), 0); - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); + var p = readMPInt(der, 'p'); + var q = readMPInt(der, 'q'); + var g = readMPInt(der, 'g'); + var y = readMPInt(der, 'y'); + var x = readMPInt(der, 'x'); - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); + // now, make the key + var key = { + type: 'dsa', + parts: [ + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'g', data: g }, + { name: 'y', data: y }, + { name: 'x', data: x } + ] + }; - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) M(r[0], r[0], I); + return (new PrivateKey(key)); +} - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) return -1; +function readPkcs1DSAPublic(der) { + var y = readMPInt(der, 'y'); + var p = readMPInt(der, 'p'); + var q = readMPInt(der, 'q'); + var g = readMPInt(der, 'g'); - if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); + var key = { + type: 'dsa', + parts: [ + { name: 'y', data: y }, + { name: 'p', data: p }, + { name: 'q', data: q }, + { name: 'g', data: g } + ] + }; - M(r[3], r[0], r[1]); - return 0; + return (new Key(key)); } -function crypto_sign_open(m, sm, n, pk) { - var i, mlen; - var t = new Uint8Array(32), h = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()], - q = [gf(), gf(), gf(), gf()]; +function readPkcs1ECDSAPublic(der) { + der.readSequence(); - mlen = -1; - if (n < 64) return -1; + var oid = der.readOID(); + assert.strictEqual(oid, '1.2.840.10045.2.1', 'must be ecPublicKey'); - if (unpackneg(q, pk)) return -1; + var curveOid = der.readOID(); - for (i = 0; i < n; i++) m[i] = sm[i]; - for (i = 0; i < 32; i++) m[i+32] = pk[i]; - crypto_hash(h, m, n); - reduce(h); - scalarmult(p, q, h); + var curve; + var curves = Object.keys(algs.curves); + for (var j = 0; j < curves.length; ++j) { + var c = curves[j]; + var cd = algs.curves[c]; + if (cd.pkcs8oid === curveOid) { + curve = c; + break; + } + } + assert.string(curve, 'a known ECDSA named curve'); - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); + var Q = der.readString(asn1.Ber.BitString, true); + Q = utils.ecNormalize(Q); - n -= 64; - if (crypto_verify_32(sm, 0, t, 0)) { - for (i = 0; i < n; i++) m[i] = 0; - return -1; - } + var key = { + type: 'ecdsa', + parts: [ + { name: 'curve', data: new Buffer(curve) }, + { name: 'Q', data: Q } + ] + }; - for (i = 0; i < n; i++) m[i] = sm[i + 64]; - mlen = n; - return mlen; + return (new Key(key)); } -var crypto_secretbox_KEYBYTES = 32, - crypto_secretbox_NONCEBYTES = 24, - crypto_secretbox_ZEROBYTES = 32, - crypto_secretbox_BOXZEROBYTES = 16, - crypto_scalarmult_BYTES = 32, - crypto_scalarmult_SCALARBYTES = 32, - crypto_box_PUBLICKEYBYTES = 32, - crypto_box_SECRETKEYBYTES = 32, - crypto_box_BEFORENMBYTES = 32, - crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, - crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, - crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, - crypto_sign_BYTES = 64, - crypto_sign_PUBLICKEYBYTES = 32, - crypto_sign_SECRETKEYBYTES = 64, - crypto_sign_SEEDBYTES = 32, - crypto_hash_BYTES = 64; +function readPkcs1ECDSAPrivate(der) { + var version = readMPInt(der, 'version'); + assert.strictEqual(version.readUInt8(0), 1); -nacl.lowlevel = { - crypto_core_hsalsa20: crypto_core_hsalsa20, - crypto_stream_xor: crypto_stream_xor, - crypto_stream: crypto_stream, - crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, - crypto_stream_salsa20: crypto_stream_salsa20, - crypto_onetimeauth: crypto_onetimeauth, - crypto_onetimeauth_verify: crypto_onetimeauth_verify, - crypto_verify_16: crypto_verify_16, - crypto_verify_32: crypto_verify_32, - crypto_secretbox: crypto_secretbox, - crypto_secretbox_open: crypto_secretbox_open, - crypto_scalarmult: crypto_scalarmult, - crypto_scalarmult_base: crypto_scalarmult_base, - crypto_box_beforenm: crypto_box_beforenm, - crypto_box_afternm: crypto_box_afternm, - crypto_box: crypto_box, - crypto_box_open: crypto_box_open, - crypto_box_keypair: crypto_box_keypair, - crypto_hash: crypto_hash, - crypto_sign: crypto_sign, - crypto_sign_keypair: crypto_sign_keypair, - crypto_sign_open: crypto_sign_open, + // private key + var d = der.readString(asn1.Ber.OctetString, true); - crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, - crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, - crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, - crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, - crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, - crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, - crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, - crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, - crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, - crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, - crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, - crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, - crypto_sign_BYTES: crypto_sign_BYTES, - crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, - crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, - crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, - crypto_hash_BYTES: crypto_hash_BYTES -}; + der.readSequence(0xa0); + var curve = readECDSACurve(der); + assert.string(curve, 'a known elliptic curve'); -/* High-level API */ + der.readSequence(0xa1); + var Q = der.readString(asn1.Ber.BitString, true); + Q = utils.ecNormalize(Q); -function checkLengths(k, n) { - if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); - if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); + var key = { + type: 'ecdsa', + parts: [ + { name: 'curve', data: new Buffer(curve) }, + { name: 'Q', data: Q }, + { name: 'd', data: d } + ] + }; + + return (new PrivateKey(key)); } -function checkBoxLengths(pk, sk) { - if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); - if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); +function writePkcs1(der, key) { + der.startSequence(); + + switch (key.type) { + case 'rsa': + if (PrivateKey.isPrivateKey(key)) + writePkcs1RSAPrivate(der, key); + else + writePkcs1RSAPublic(der, key); + break; + case 'dsa': + if (PrivateKey.isPrivateKey(key)) + writePkcs1DSAPrivate(der, key); + else + writePkcs1DSAPublic(der, key); + break; + case 'ecdsa': + if (PrivateKey.isPrivateKey(key)) + writePkcs1ECDSAPrivate(der, key); + else + writePkcs1ECDSAPublic(der, key); + break; + default: + throw (new Error('Unknown key algo: ' + key.type)); + } + + der.endSequence(); } -function checkArrayTypes() { - var t, i; - for (i = 0; i < arguments.length; i++) { - if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') - throw new TypeError('unexpected type ' + t + ', use Uint8Array'); - } +function writePkcs1RSAPublic(der, key) { + der.writeBuffer(key.part.n.data, asn1.Ber.Integer); + der.writeBuffer(key.part.e.data, asn1.Ber.Integer); +} + +function writePkcs1RSAPrivate(der, key) { + var ver = new Buffer(1); + ver[0] = 0; + der.writeBuffer(ver, asn1.Ber.Integer); + + der.writeBuffer(key.part.n.data, asn1.Ber.Integer); + der.writeBuffer(key.part.e.data, asn1.Ber.Integer); + der.writeBuffer(key.part.d.data, asn1.Ber.Integer); + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + if (!key.part.dmodp || !key.part.dmodq) + utils.addRSAMissing(key); + der.writeBuffer(key.part.dmodp.data, asn1.Ber.Integer); + der.writeBuffer(key.part.dmodq.data, asn1.Ber.Integer); + der.writeBuffer(key.part.iqmp.data, asn1.Ber.Integer); } -function cleanup(arr) { - for (var i = 0; i < arr.length; i++) arr[i] = 0; +function writePkcs1DSAPrivate(der, key) { + var ver = new Buffer(1); + ver[0] = 0; + der.writeBuffer(ver, asn1.Ber.Integer); + + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + der.writeBuffer(key.part.g.data, asn1.Ber.Integer); + der.writeBuffer(key.part.y.data, asn1.Ber.Integer); + der.writeBuffer(key.part.x.data, asn1.Ber.Integer); } -// TODO: Completely remove this in v0.15. -if (!nacl.util) { - nacl.util = {}; - nacl.util.decodeUTF8 = nacl.util.encodeUTF8 = nacl.util.encodeBase64 = nacl.util.decodeBase64 = function() { - throw new Error('nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js'); - }; +function writePkcs1DSAPublic(der, key) { + der.writeBuffer(key.part.y.data, asn1.Ber.Integer); + der.writeBuffer(key.part.p.data, asn1.Ber.Integer); + der.writeBuffer(key.part.q.data, asn1.Ber.Integer); + der.writeBuffer(key.part.g.data, asn1.Ber.Integer); } -nacl.randomBytes = function(n) { - var b = new Uint8Array(n); - randombytes(b, n); - return b; -}; - -nacl.secretbox = function(msg, nonce, key) { - checkArrayTypes(msg, nonce, key); - checkLengths(key, nonce); - var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); - var c = new Uint8Array(m.length); - for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; - crypto_secretbox(c, m, m.length, nonce, key); - return c.subarray(crypto_secretbox_BOXZEROBYTES); -}; - -nacl.secretbox.open = function(box, nonce, key) { - checkArrayTypes(box, nonce, key); - checkLengths(key, nonce); - var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); - var m = new Uint8Array(c.length); - for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; - if (c.length < 32) return false; - if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; - return m.subarray(crypto_secretbox_ZEROBYTES); -}; +function writePkcs1ECDSAPublic(der, key) { + der.startSequence(); -nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; -nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; -nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; + der.writeOID('1.2.840.10045.2.1'); /* ecPublicKey */ + var curve = key.part.curve.data.toString(); + var curveOid = algs.curves[curve].pkcs8oid; + assert.string(curveOid, 'a known ECDSA named curve'); + der.writeOID(curveOid); -nacl.scalarMult = function(n, p) { - checkArrayTypes(n, p); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult(q, n, p); - return q; -}; + der.endSequence(); -nacl.scalarMult.base = function(n) { - checkArrayTypes(n); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult_base(q, n); - return q; -}; + var Q = utils.ecNormalize(key.part.Q.data, true); + der.writeBuffer(Q, asn1.Ber.BitString); +} -nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; -nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; +function writePkcs1ECDSAPrivate(der, key) { + var ver = new Buffer(1); + ver[0] = 1; + der.writeBuffer(ver, asn1.Ber.Integer); -nacl.box = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox(msg, nonce, k); -}; + der.writeBuffer(key.part.d.data, asn1.Ber.OctetString); -nacl.box.before = function(publicKey, secretKey) { - checkArrayTypes(publicKey, secretKey); - checkBoxLengths(publicKey, secretKey); - var k = new Uint8Array(crypto_box_BEFORENMBYTES); - crypto_box_beforenm(k, publicKey, secretKey); - return k; -}; + der.startSequence(0xa0); + var curve = key.part.curve.data.toString(); + var curveOid = algs.curves[curve].pkcs8oid; + assert.string(curveOid, 'a known ECDSA named curve'); + der.writeOID(curveOid); + der.endSequence(); -nacl.box.after = nacl.secretbox; + der.startSequence(0xa1); + var Q = utils.ecNormalize(key.part.Q.data, true); + der.writeBuffer(Q, asn1.Ber.BitString); + der.endSequence(); +} -nacl.box.open = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox.open(msg, nonce, k); -}; -nacl.box.open.after = nacl.secretbox.open; +/***/ }), +/* 161 */ +/***/ (function(module, exports, __webpack_require__) { -nacl.box.keyPair = function() { - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); - crypto_box_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; +// Copyright 2015 Joyent, Inc. -nacl.box.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_box_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - crypto_scalarmult_base(pk, secretKey); - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; +var Key = __webpack_require__(18); +var Fingerprint = __webpack_require__(73); +var Signature = __webpack_require__(33); +var PrivateKey = __webpack_require__(19); +var Certificate = __webpack_require__(72); +var Identity = __webpack_require__(75); +var errs = __webpack_require__(32); -nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; -nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; -nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; -nacl.box.nonceLength = crypto_box_NONCEBYTES; -nacl.box.overheadLength = nacl.secretbox.overheadLength; +module.exports = { + /* top-level classes */ + Key: Key, + parseKey: Key.parse, + Fingerprint: Fingerprint, + parseFingerprint: Fingerprint.parse, + Signature: Signature, + parseSignature: Signature.parse, + PrivateKey: PrivateKey, + parsePrivateKey: PrivateKey.parse, + generatePrivateKey: PrivateKey.generate, + Certificate: Certificate, + parseCertificate: Certificate.parse, + createSelfSignedCertificate: Certificate.createSelfSigned, + createCertificate: Certificate.create, + Identity: Identity, + identityFromDN: Identity.parseDN, + identityForHost: Identity.forHost, + identityForUser: Identity.forUser, + identityForEmail: Identity.forEmail, -nacl.sign = function(msg, secretKey) { - checkArrayTypes(msg, secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); - crypto_sign(signedMsg, msg, msg.length, secretKey); - return signedMsg; + /* errors */ + FingerprintFormatError: errs.FingerprintFormatError, + InvalidAlgorithmError: errs.InvalidAlgorithmError, + KeyParseError: errs.KeyParseError, + SignatureParseError: errs.SignatureParseError, + KeyEncryptedError: errs.KeyEncryptedError, + CertificateParseError: errs.CertificateParseError }; -nacl.sign.open = function(signedMsg, publicKey) { - if (arguments.length !== 2) - throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); - checkArrayTypes(signedMsg, publicKey); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var tmp = new Uint8Array(signedMsg.length); - var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); - if (mlen < 0) return null; - var m = new Uint8Array(mlen); - for (var i = 0; i < m.length; i++) m[i] = tmp[i]; - return m; -}; -nacl.sign.detached = function(msg, secretKey) { - var signedMsg = nacl.sign(msg, secretKey); - var sig = new Uint8Array(crypto_sign_BYTES); - for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; - return sig; -}; +/***/ }), +/* 162 */ +/***/ (function(module, exports, __webpack_require__) { -nacl.sign.detached.verify = function(msg, sig, publicKey) { - checkArrayTypes(msg, sig, publicKey); - if (sig.length !== crypto_sign_BYTES) - throw new Error('bad signature size'); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var sm = new Uint8Array(crypto_sign_BYTES + msg.length); - var m = new Uint8Array(crypto_sign_BYTES + msg.length); - var i; - for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; - for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; - return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); -}; +"use strict"; -nacl.sign.keyPair = function() { - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - crypto_sign_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; +var ansiRegex = __webpack_require__(177)(); -nacl.sign.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; +module.exports = function (str) { + return typeof str === 'string' ? str.replace(ansiRegex, '') : str; }; -nacl.sign.keyPair.fromSeed = function(seed) { - checkArrayTypes(seed); - if (seed.length !== crypto_sign_SEEDBYTES) - throw new Error('bad seed size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - for (var i = 0; i < 32; i++) sk[i] = seed[i]; - crypto_sign_keypair(pk, sk, true); - return {publicKey: pk, secretKey: sk}; -}; -nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; -nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; -nacl.sign.seedLength = crypto_sign_SEEDBYTES; -nacl.sign.signatureLength = crypto_sign_BYTES; +/***/ }), +/* 163 */ +/***/ (function(module, exports) { -nacl.hash = function(msg) { - checkArrayTypes(msg); - var h = new Uint8Array(crypto_hash_BYTES); - crypto_hash(h, msg, msg.length); - return h; -}; +// Returns a wrapper function that returns a wrapped callback +// The wrapper function should do some stuff, and return a +// presumably different callback function. +// This makes sure that own properties are retained, so that +// decorations and such are not lost along the way. +module.exports = wrappy +function wrappy (fn, cb) { + if (fn && cb) return wrappy(fn)(cb) -nacl.hash.hashLength = crypto_hash_BYTES; + if (typeof fn !== 'function') + throw new TypeError('need wrapper function') -nacl.verify = function(x, y) { - checkArrayTypes(x, y); - // Zero length arguments are considered not equal. - if (x.length === 0 || y.length === 0) return false; - if (x.length !== y.length) return false; - return (vn(x, 0, y, 0, x.length) === 0) ? true : false; -}; + Object.keys(fn).forEach(function (k) { + wrapper[k] = fn[k] + }) -nacl.setPRNG = function(fn) { - randombytes = fn; -}; + return wrapper -(function() { - // Initialize PRNG if environment provides CSPRNG. - // If not, methods calling randombytes will throw. - var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; - if (crypto && crypto.getRandomValues) { - // Browsers. - var QUOTA = 65536; - nacl.setPRNG(function(x, n) { - var i, v = new Uint8Array(n); - for (i = 0; i < n; i += QUOTA) { - crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); - } - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } else if (true) { - // Node.js. - crypto = __webpack_require__(6); - if (crypto && crypto.randomBytes) { - nacl.setPRNG(function(x, n) { - var i, v = crypto.randomBytes(n); - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); + function wrapper() { + var args = new Array(arguments.length) + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + var ret = fn.apply(this, args) + var cb = args[args.length-1] + if (typeof ret === 'function' && ret !== cb) { + Object.keys(cb).forEach(function (k) { + ret[k] = cb[k] + }) } + return ret } -})(); - -})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); +} /***/ }), @@ -49988,7 +50203,6 @@ webpackEmptyContext.resolve = webpackEmptyContext; module.exports = webpackEmptyContext; webpackEmptyContext.id = 166; - /***/ }), /* 167 */ /***/ (function(module, exports, __webpack_require__) { @@ -50089,7 +50303,7 @@ function getRegenerator(opts, required) { try { if (!regenerator) { var name = 'regenerator'; - regenerator = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND';; throw e; }()); + regenerator = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()); regenerator.runtime(); } if (!opts.async || opts.async === true) @@ -50112,7 +50326,7 @@ function getNodent(opts, required) { try { if (!nodent) { var name = 'nodent'; - nodent = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND';; throw e; }())({ log: false, dontInstallRequireHook: true }); + nodent = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }())({ log: false, dontInstallRequireHook: true }); } if (opts.async != 'es7') { if (opts.async && opts.async !== true) console.warn('nodent transpiles only es7 async functions'); @@ -51012,8 +51226,7 @@ module.exports = function generate_validate(it, $keyword) { var $valid = 'valid' + $lvl, $breakOnError = !it.opts.allErrors, $closingBraces1 = '', - $closingBraces2 = '', - $errorKeyword; + $closingBraces2 = ''; var $typeSchema = it.schema.type, $typeIsArray = Array.isArray($typeSchema); if ($typeSchema && it.opts.coerceTypes) { @@ -51066,7 +51279,7 @@ module.exports = function generate_validate(it, $keyword) { $$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: \''; + out += ' { keyword: \'' + ('type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; if ($typeIsArray) { out += '' + ($typeSchema.join(",")); } else { @@ -51208,7 +51421,7 @@ module.exports = function generate_validate(it, $keyword) { } if ($rulesGroup.type) { out += ' } '; - if ($typeSchema && $typeSchema === $rulesGroup.type) { + if ($typeSchema && $typeSchema === $rulesGroup.type && !$coerceToTypes) { var $typeChecked = true; out += ' else { '; var $schemaPath = it.schemaPath + '.type', @@ -51217,7 +51430,7 @@ module.exports = function generate_validate(it, $keyword) { $$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: \''; + out += ' { keyword: \'' + ('type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; if ($typeIsArray) { out += '' + ($typeSchema.join(",")); } else { @@ -51268,7 +51481,7 @@ module.exports = function generate_validate(it, $keyword) { } } } - if ($typeSchema && !$typeChecked && !(it.opts.coerceTypes && $coerceToTypes)) { + if ($typeSchema && !$typeChecked && !$coerceToTypes) { var $schemaPath = it.schemaPath + '.type', $errSchemaPath = it.errSchemaPath + '/type', $method = $typeIsArray ? 'checkDataTypes' : 'checkDataType'; @@ -51277,7 +51490,7 @@ module.exports = function generate_validate(it, $keyword) { $$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: \''; + out += ' { keyword: \'' + ('type') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { type: \''; if ($typeIsArray) { out += '' + ($typeSchema.join(",")); } else { @@ -51395,7 +51608,7 @@ function clean(key) /* 179 */ /***/ (function(module, exports, __webpack_require__) { -var defer = __webpack_require__(318); +var defer = __webpack_require__(323); // API module.exports = async; @@ -51714,21 +51927,33 @@ let verifyTreeCheck = exports.verifyTreeCheck = (() => { const dependenciesToCheckVersion = []; if (rootManifest.dependencies) { for (const name in rootManifest.dependencies) { + const version = rootManifest.dependencies[name]; + // skip linked dependencies + const isLinkedDepencency = /^link:/i.test(version) || /^file:/i.test(version) && config.linkFileDependencies; + if (isLinkedDepencency) { + continue; + } dependenciesToCheckVersion.push({ name, originalKey: name, parentCwd: registry.cwd, - version: rootManifest.dependencies[name] + version }); } } if (rootManifest.devDependencies && !config.production) { for (const name in rootManifest.devDependencies) { + const version = rootManifest.devDependencies[name]; + // skip linked dependencies + const isLinkedDepencency = /^link:/i.test(version) || /^file:/i.test(version) && config.linkFileDependencies; + if (isLinkedDepencency) { + continue; + } dependenciesToCheckVersion.push({ name, originalKey: name, parentCwd: registry.cwd, - version: rootManifest.devDependencies[name] + version }); } } @@ -51821,10 +52046,11 @@ let integrityHashCheck = (() => { var _ref3 = yield install.fetchRequestFromCwd(); - const patterns = _ref3.patterns; + const patterns = _ref3.patterns, + workspaceLayout = _ref3.workspaceLayout; - const match = yield integrityChecker.check(patterns, lockfile.cache, flags); + const match = yield integrityChecker.check(patterns, lockfile.cache, flags, workspaceLayout); for (const pattern of match.missingPatterns) { reportError('lockfileNotContainPattern', pattern); } @@ -51888,19 +52114,21 @@ let run = exports.run = (() => { // get patterns that are installed when running `yarn install` - var _ref5 = yield install.hydrate(true); + var _ref5 = yield install.hydrate(); - const rawPatterns = _ref5.patterns; + const rawPatterns = _ref5.patterns, + workspaceLayout = _ref5.workspaceLayout; const patterns = yield install.flatten(rawPatterns); // check if patterns exist in lockfile for (const pattern of patterns) { - if (!lockfile.getLocked(pattern)) { + if (!lockfile.getLocked(pattern) && (!workspaceLayout || !workspaceLayout.getManifestByPattern(pattern))) { reportError('lockfileNotContainPattern', pattern); } } + const bundledDeps = {}; // check if any of the node_modules are out of sync const res = yield install.linker.getFlatHoistedTree(patterns); for (const _ref6 of res) { @@ -51942,6 +52170,13 @@ let run = exports.run = (() => { human = humanParts.join(''); } + // skip unnecessary checks for linked dependencies + const remoteType = pkg._reference.remote.type; + const isLinkedDepencency = remoteType === 'link' || remoteType === 'workspace' || remoteType === 'file' && config.linkFileDependencies; + if (isLinkedDepencency) { + continue; + } + const pkgLoc = path.join(loc, 'package.json'); if (!(yield (_fs || _load_fs()).exists(loc)) || !(yield (_fs || _load_fs()).exists(pkgLoc))) { if (pkg._reference.optional) { @@ -51959,6 +52194,7 @@ let run = exports.run = (() => { } const deps = Object.assign({}, packageJson.dependencies, packageJson.peerDependencies); + bundledDeps[packageJson.name] = packageJson.bundledDependencies || []; for (const name in deps) { const range = deps[name]; @@ -52007,7 +52243,12 @@ let run = exports.run = (() => { } const packageJson = yield config.readJson(loc); - if (packageJson.version === depPkg.version || semver.satisfies(packageJson.version, range, config.looseSemver) && semver.gt(packageJson.version, depPkg.version, config.looseSemver)) { + const packagePath = originalKey.split('#'); + const rootDep = packagePath[0]; + const packageName = packagePath[1] || packageJson.name; + + const bundledDep = bundledDeps[rootDep] && bundledDeps[rootDep].indexOf(packageName) !== -1; + if (!bundledDep && (packageJson.version === depPkg.version || semver.satisfies(packageJson.version, range, config.looseSemver) && semver.gt(packageJson.version, depPkg.version, config.looseSemver))) { reporter.warn(reporter.lang('couldBeDeduped', subHuman, packageJson.version, `${humaniseLocation(path.dirname(loc)).join('#')}@${packageJson.version}`)); warningCount++; } @@ -52044,13 +52285,13 @@ function _load_errors() { var _integrityChecker; function _load_integrityChecker() { - return _integrityChecker = _interopRequireDefault(__webpack_require__(113)); + return _integrityChecker = _interopRequireDefault(__webpack_require__(119)); } var _integrityChecker2; function _load_integrityChecker2() { - return _integrityChecker2 = __webpack_require__(113); + return _integrityChecker2 = __webpack_require__(119); } var _wrapper; @@ -52068,14 +52309,14 @@ function _load_fs() { var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } 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 semver = __webpack_require__(27); +const semver = __webpack_require__(26); const path = __webpack_require__(1); @@ -52294,7 +52535,7 @@ Object.defineProperty(exports, "__esModule", { var _index; function _load_index() { - return _index = __webpack_require__(79); + return _index = __webpack_require__(82); } var _constants; @@ -52318,25 +52559,25 @@ function _load_config() { var _access; function _load_access() { - return _access = _interopRequireWildcard(__webpack_require__(326)); + return _access = _interopRequireWildcard(__webpack_require__(331)); } var _add; function _load_add() { - return _add = _interopRequireWildcard(__webpack_require__(75)); + return _add = _interopRequireWildcard(__webpack_require__(78)); } var _bin; function _load_bin() { - return _bin = _interopRequireWildcard(__webpack_require__(327)); + return _bin = _interopRequireWildcard(__webpack_require__(332)); } var _cache; function _load_cache() { - return _cache = _interopRequireWildcard(__webpack_require__(328)); + return _cache = _interopRequireWildcard(__webpack_require__(333)); } var _check; @@ -52354,61 +52595,67 @@ function _load_clean() { var _config2; function _load_config2() { - return _config2 = _interopRequireWildcard(__webpack_require__(329)); + return _config2 = _interopRequireWildcard(__webpack_require__(334)); } var _create; function _load_create() { - return _create = _interopRequireWildcard(__webpack_require__(330)); + return _create = _interopRequireWildcard(__webpack_require__(335)); +} + +var _exec; + +function _load_exec() { + return _exec = _interopRequireWildcard(__webpack_require__(336)); } var _generateLockEntry; function _load_generateLockEntry() { - return _generateLockEntry = _interopRequireWildcard(__webpack_require__(331)); + return _generateLockEntry = _interopRequireWildcard(__webpack_require__(337)); } var _global; function _load_global() { - return _global = _interopRequireWildcard(__webpack_require__(56)); + return _global = _interopRequireWildcard(__webpack_require__(59)); } var _help; function _load_help() { - return _help = _interopRequireWildcard(__webpack_require__(332)); + return _help = _interopRequireWildcard(__webpack_require__(338)); } var _import; function _load_import() { - return _import = _interopRequireWildcard(__webpack_require__(333)); + return _import = _interopRequireWildcard(__webpack_require__(339)); } var _info; function _load_info() { - return _info = _interopRequireWildcard(__webpack_require__(334)); + return _info = _interopRequireWildcard(__webpack_require__(340)); } var _init; function _load_init() { - return _init = _interopRequireWildcard(__webpack_require__(335)); + return _init = _interopRequireWildcard(__webpack_require__(341)); } var _install; function _load_install() { - return _install = _interopRequireWildcard(__webpack_require__(26)); + return _install = _interopRequireWildcard(__webpack_require__(27)); } var _licenses; function _load_licenses() { - return _licenses = _interopRequireWildcard(__webpack_require__(336)); + return _licenses = _interopRequireWildcard(__webpack_require__(342)); } var _link; @@ -52420,13 +52667,13 @@ function _load_link() { var _login; function _load_login() { - return _login = _interopRequireWildcard(__webpack_require__(57)); + return _login = _interopRequireWildcard(__webpack_require__(60)); } var _logout; function _load_logout() { - return _logout = _interopRequireWildcard(__webpack_require__(337)); + return _logout = _interopRequireWildcard(__webpack_require__(343)); } var _list; @@ -52438,13 +52685,13 @@ function _load_list() { var _outdated; function _load_outdated() { - return _outdated = _interopRequireWildcard(__webpack_require__(338)); + return _outdated = _interopRequireWildcard(__webpack_require__(344)); } var _owner; function _load_owner() { - return _owner = _interopRequireWildcard(__webpack_require__(339)); + return _owner = _interopRequireWildcard(__webpack_require__(345)); } var _pack; @@ -52456,7 +52703,7 @@ function _load_pack() { var _publish; function _load_publish() { - return _publish = _interopRequireWildcard(__webpack_require__(340)); + return _publish = _interopRequireWildcard(__webpack_require__(346)); } var _remove; @@ -52468,7 +52715,7 @@ function _load_remove() { var _run; function _load_run() { - return _run = _interopRequireWildcard(__webpack_require__(341)); + return _run = _interopRequireWildcard(__webpack_require__(347)); } var _tag; @@ -52480,13 +52727,13 @@ function _load_tag() { var _team; function _load_team() { - return _team = _interopRequireWildcard(__webpack_require__(342)); + return _team = _interopRequireWildcard(__webpack_require__(348)); } var _unlink; function _load_unlink() { - return _unlink = _interopRequireWildcard(__webpack_require__(343)); + return _unlink = _interopRequireWildcard(__webpack_require__(349)); } var _upgrade; @@ -52504,13 +52751,19 @@ function _load_version() { var _versions; function _load_versions() { - return _versions = _interopRequireWildcard(__webpack_require__(344)); + return _versions = _interopRequireWildcard(__webpack_require__(350)); } var _why; function _load_why() { - return _why = _interopRequireWildcard(__webpack_require__(345)); + return _why = _interopRequireWildcard(__webpack_require__(351)); +} + +var _workspace; + +function _load_workspace() { + return _workspace = _interopRequireWildcard(__webpack_require__(352)); } var _upgradeInteractive; @@ -52522,19 +52775,19 @@ function _load_upgradeInteractive() { var _useless; function _load_useless() { - return _useless = _interopRequireDefault(__webpack_require__(325)); + return _useless = _interopRequireDefault(__webpack_require__(330)); } var _aliases; function _load_aliases() { - return _aliases = _interopRequireDefault(__webpack_require__(324)); + return _aliases = _interopRequireDefault(__webpack_require__(329)); } var _unsupportedAliases; function _load_unsupportedAliases() { - return _unsupportedAliases = _interopRequireDefault(__webpack_require__(346)); + return _unsupportedAliases = _interopRequireDefault(__webpack_require__(353)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -52556,6 +52809,7 @@ const commands = { config: _config2 || _load_config2(), create: _create || _load_create(), dedupe: (0, (_useless || _load_useless()).default)("The dedupe command isn't necessary. `yarn install` will already dedupe."), + exec: _exec || _load_exec(), generateLockEntry: _generateLockEntry || _load_generateLockEntry(), global: _global || _load_global(), help: _help || _load_help(), @@ -52583,6 +52837,7 @@ const commands = { version: _version || _load_version(), versions: _versions || _load_versions(), why: _why || _load_why(), + workspace: _workspace || _load_workspace(), upgradeInteractive: _upgradeInteractive || _load_upgradeInteractive() }; @@ -52662,7 +52917,7 @@ let run = exports.run = (() => { yield (_fs || _load_fs()).unlink(dest); yield (_fs || _load_fs()).mkdirp(path.dirname(dest)); yield (_fs || _load_fs()).symlink(src, dest); - reporter.success(reporter.lang('linkRegistered', name)); + reporter.success(reporter.lang('linkUsing', name)); } else { throw new (_errors || _load_errors()).MessageError(reporter.lang('linkMissing', name)); } @@ -52699,7 +52954,7 @@ let run = exports.run = (() => { } reporter.success(reporter.lang('linkRegistered', name)); - reporter.info(reporter.lang('linkInstallMessage', name)); + reporter.info(reporter.lang('linkRegisteredMessage', name)); } } }); @@ -52727,14 +52982,14 @@ function _load_fs() { var _global; function _load_global() { - return _global = __webpack_require__(56); + return _global = __webpack_require__(59); } 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 invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); const path = __webpack_require__(1); @@ -52886,8 +53141,7 @@ let buildTree = exports.buildTree = (() => { let run = exports.run = (() => { var _ref8 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - - const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.cwd, reporter); + const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.lockfileFolder, reporter); const install = new (_install || _load_install()).Install(flags, config, reporter, lockfile); var _ref9 = yield install.fetchRequestFromCwd(); @@ -52929,7 +53183,7 @@ exports.filterTree = filterTree; var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } var _wrapper; @@ -52940,7 +53194,7 @@ function _load_wrapper() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); const requireLockfile = exports.requireLockfile = true; @@ -53166,8 +53420,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de const zlib = __webpack_require__(165); const path = __webpack_require__(1); -const tar = __webpack_require__(103); -const fs2 = __webpack_require__(5); +const tar = __webpack_require__(109); +const fs2 = __webpack_require__(6); const IGNORE_FILENAMES = ['.yarnignore', '.npmignore', '.gitignore']; @@ -53207,7 +53461,7 @@ exports.run = exports.requireLockfile = undefined; var _extends2; function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(43)); + return _extends2 = _interopRequireDefault(__webpack_require__(45)); } var _slicedToArray2; @@ -53310,7 +53564,7 @@ function _load_index() { var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } var _errors; @@ -53322,7 +53576,7 @@ function _load_errors() { var _index2; function _load_index2() { - return _index2 = __webpack_require__(79); + return _index2 = __webpack_require__(82); } var _fs; @@ -53397,19 +53651,19 @@ let getName = exports.getName = (() => { var _packageRequest; function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); } var _buildSubCommands2; function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(36)); + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(35)); } var _login; function _load_login() { - return _login = __webpack_require__(57); + return _login = __webpack_require__(60); } var _npmRegistry; @@ -53427,7 +53681,7 @@ function _load_errors() { var _validate; function _load_validate() { - return _validate = __webpack_require__(60); + return _validate = __webpack_require__(63); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -53570,7 +53824,7 @@ function _load_asyncToGenerator() { let run = exports.run = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.cwd); + const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.lockfileFolder); const install = new (_install || _load_install()).Install(flags, config, reporter, lockfile); const deps = yield (_packageRequest || _load_packageRequest()).default.getOutdatedPackages(lockfile, install, config, reporter); @@ -53683,7 +53937,7 @@ let run = exports.run = (() => { if (deps.length) { reporter.info(reporter.lang('updateInstalling', getNameFromHint(hint))); const add = new (_add || _load_add()).Add(deps, flags, config, reporter, lockfile); - return yield add.init(); + return add.init(); } return Promise.resolve(); }); @@ -53708,25 +53962,25 @@ exports.hasWrapper = hasWrapper; var _inquirer; function _load_inquirer() { - return _inquirer = _interopRequireDefault(__webpack_require__(146)); + return _inquirer = _interopRequireDefault(__webpack_require__(148)); } var _packageRequest; function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); } var _add; function _load_add() { - return _add = __webpack_require__(75); + return _add = __webpack_require__(78); } var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } var _wrapper; @@ -53769,7 +54023,7 @@ function _load_asyncToGenerator() { let run = exports.run = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { - const lockfile = args.length ? yield (_wrapper || _load_wrapper()).default.fromDirectory(config.cwd, reporter) : new (_wrapper || _load_wrapper()).default(); + const lockfile = args.length ? yield (_wrapper || _load_wrapper()).default.fromDirectory(config.lockfileFolder, reporter) : new (_wrapper || _load_wrapper()).default(); var _ref2 = (yield config.readRootManifest()) || {}; @@ -53822,7 +54076,7 @@ exports.hasWrapper = hasWrapper; var _add; function _load_add() { - return _add = __webpack_require__(75); + return _add = __webpack_require__(78); } var _wrapper; @@ -53834,7 +54088,7 @@ function _load_wrapper() { var _packageRequest; function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); } var _errors; @@ -53887,20 +54141,6 @@ function _load_asyncToGenerator() { let setVersion = exports.setVersion = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args, required) { - let runLifecycle = (() => { - var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (lifecycle) { - if (scripts[lifecycle]) { - return yield (0, (_executeLifecycleScript || _load_executeLifecycleScript()).execCommand)(lifecycle, config, scripts[lifecycle], config.cwd); - } - - return Promise.resolve(); - }); - - return function runLifecycle(_x6) { - return _ref2.apply(this, arguments); - }; - })(); - const pkg = yield config.readRootManifest(); const pkgLoc = pkg._loc; const scripts = (0, (_map || _load_map()).default)(); @@ -53911,6 +54151,14 @@ let setVersion = exports.setVersion = (() => { throw new (_errors || _load_errors()).MessageError(reporter.lang('invalidVersionArgument', NEW_VERSION_FLAG)); } + function runLifecycle(lifecycle) { + if (scripts[lifecycle]) { + return (0, (_executeLifecycleScript || _load_executeLifecycleScript()).execCommand)(lifecycle, config, scripts[lifecycle], config.cwd); + } + + return Promise.resolve(); + } + if (pkg.scripts) { // inherit `scripts` from manifest Object.assign(scripts, pkg.scripts); @@ -54024,13 +54272,13 @@ let setVersion = exports.setVersion = (() => { })(); let run = exports.run = (() => { - var _ref4 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + var _ref3 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { const commit = yield setVersion(config, reporter, flags, args, true); yield commit(); }); - return function run(_x7, _x8, _x9, _x10) { - return _ref4.apply(this, arguments); + return function run(_x6, _x7, _x8, _x9) { + return _ref3.apply(this, arguments); }; })(); @@ -54046,7 +54294,7 @@ function _load_index() { var _executeLifecycleScript; function _load_executeLifecycleScript() { - return _executeLifecycleScript = __webpack_require__(82); + return _executeLifecycleScript = __webpack_require__(62); } var _errors; @@ -54058,7 +54306,7 @@ function _load_errors() { var _child; function _load_child() { - return _child = __webpack_require__(59); + return _child = __webpack_require__(44); } var _fs; @@ -54077,8 +54325,8 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); -const semver = __webpack_require__(27); +const invariant = __webpack_require__(5); +const semver = __webpack_require__(26); const path = __webpack_require__(1); const NEW_VERSION_FLAG = '--new-version [version]'; @@ -54116,7 +54364,13 @@ function _load_asyncToGenerator() { var _executeLifecycleScript; function _load_executeLifecycleScript() { - return _executeLifecycleScript = __webpack_require__(82); + return _executeLifecycleScript = __webpack_require__(62); +} + +var _path; + +function _load_path() { + return _path = __webpack_require__(207); } var _index; @@ -54146,13 +54400,13 @@ function _load_constants() { var _packageConstraintResolver; function _load_packageConstraintResolver() { - return _packageConstraintResolver = _interopRequireDefault(__webpack_require__(350)); + return _packageConstraintResolver = _interopRequireDefault(__webpack_require__(357)); } var _requestManager; function _load_requestManager() { - return _requestManager = _interopRequireDefault(__webpack_require__(207)); + return _requestManager = _interopRequireDefault(__webpack_require__(208)); } var _index2; @@ -54164,7 +54418,7 @@ function _load_index2() { var _index3; function _load_index3() { - return _index3 = __webpack_require__(79); + return _index3 = __webpack_require__(82); } var _map; @@ -54177,8 +54431,9 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const detectIndent = __webpack_require__(446); -const invariant = __webpack_require__(7); +const detectIndent = __webpack_require__(455); + +const invariant = __webpack_require__(5); const path = __webpack_require__(1); function sortObject(object) { @@ -54273,7 +54528,15 @@ class Config { */ getOption(key) { - return this.registries.yarn.getOption(key); + let expand = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + + const value = this.registries.yarn.getOption(key); + + if (expand && typeof value === 'string') { + return (0, (_path || _load_path()).expandPath)(value); + } + + return value; } /** @@ -54295,6 +54558,9 @@ class Config { return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { _this._init(opts); + _this.workspaceRootFolder = yield _this.findWorkspaceRoot(_this.cwd); + _this.lockfileFolder = _this.workspaceRootFolder || _this.cwd; + yield (_fs || _load_fs()).mkdirp(_this.globalFolder); yield (_fs || _load_fs()).mkdirp(_this.linkFolder); @@ -54350,11 +54616,12 @@ class Config { networkTimeout: _this.networkTimeout }); _this._cacheRootFolder = String(opts.cacheFolder || _this.getOption('cache-folder') || (_constants || _load_constants()).MODULE_CACHE_DIRECTORY); - _this.workspacesExperimental = Boolean(_this.getOption('workspaces-experimental')); + _this.workspacesEnabled = Boolean(_this.getOption('workspaces-experimental')); _this.pruneOfflineMirror = Boolean(_this.getOption('yarn-offline-mirror-pruning')); _this.enableMetaFolder = Boolean(_this.getOption('enable-meta-folder')); - _this.disableLockfileVersions = Boolean(_this.getOption('yarn-disable-lockfile-versions')); + _this.enableLockfileVersions = Boolean(_this.getOption('yarn-enable-lockfile-versions')); + _this.linkFileDependencies = Boolean(_this.getOption('yarn-link-file-dependencies')); //init & create cacheFolder, tempFolder _this.cacheFolder = path.join(_this._cacheRootFolder, 'v' + String((_constants || _load_constants()).CACHE_VERSION)); @@ -54369,6 +54636,10 @@ class Config { } else { _this.production = !!opts.production; } + + if (_this.workspaceRootFolder && !_this.workspacesEnabled) { + throw new (_errors || _load_errors()).MessageError(_this.reporter.lang('workspaceExperimentalDisabled')); + } })(); } @@ -54629,6 +54900,94 @@ class Config { })(); } + findManifest(dir, isRoot) { + var _this6 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + for (const registry of (_index2 || _load_index2()).registryNames) { + const manifest = yield _this6.tryManifest(dir, registry, isRoot); + + if (manifest) { + return manifest; + } + } + + return null; + })(); + } + + findWorkspaceRoot(initial) { + var _this7 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + let previous = null; + let current = path.normalize(initial); + + do { + const manifest = yield _this7.findManifest(current, true); + + if (manifest && manifest.workspaces) { + return current; + } + + previous = current; + current = path.dirname(current); + } while (current !== previous); + + return null; + })(); + } + + resolveWorkspaces(root, rootManifest) { + var _this8 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + const workspaces = {}; + const patterns = rootManifest.workspaces || []; + if (!_this8.workspacesEnabled) { + return workspaces; + } + if (!rootManifest.private && patterns.length > 0) { + throw new (_errors || _load_errors()).MessageError(_this8.reporter.lang('workspacesRequirePrivateProjects')); + } + + const registryFilenames = (_index2 || _load_index2()).registryNames.map(function (registryName) { + return _this8.registries[registryName].constructor.filename; + }); + const trailingPattern = `/+(${registryFilenames.join(`|`)})`; + + const files = yield Promise.all(patterns.map(function (pattern) { + return (_fs || _load_fs()).glob(pattern.replace(/\/?$/, trailingPattern), { cwd: root, ignore: _this8.registryFolders }); + })); + + for (const file of new Set([].concat(...files))) { + const loc = path.join(root, path.dirname(file)); + const manifest = yield _this8.findManifest(loc, false); + + if (!manifest) { + continue; + } + + if (!manifest.name) { + _this8.reporter.warn(_this8.reporter.lang('workspaceNameMandatory', loc)); + continue; + } + if (!manifest.version) { + _this8.reporter.warn(_this8.reporter.lang('workspaceVersionMandatory', loc)); + continue; + } + + if (Object.prototype.hasOwnProperty.call(workspaces, manifest.name)) { + throw new (_errors || _load_errors()).MessageError(_this8.reporter.lang('workspaceNameDuplicate', manifest.name)); + } + + workspaces[manifest.name] = { loc, manifest }; + } + + return workspaces; + })(); + } + /** * Description */ @@ -54648,13 +55007,13 @@ class Config { */ getRootManifests() { - var _this6 = this; + var _this9 = this; return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { const manifests = {}; for (const registryName of (_index2 || _load_index2()).registryNames) { const registry = (_index2 || _load_index2()).registries[registryName]; - const jsonLoc = path.join(_this6.cwd, registry.filename); + const jsonLoc = path.join(_this9.cwd, registry.filename); let object = {}; let exists = false; @@ -54662,7 +55021,7 @@ class Config { if (yield (_fs || _load_fs()).exists(jsonLoc)) { exists = true; - const info = yield _this6.readJson(jsonLoc, (_fs || _load_fs()).readJsonAndFile); + const info = yield _this9.readJson(jsonLoc, (_fs || _load_fs()).readJsonAndFile); object = info.object; indent = detectIndent(info.content).indent || undefined; } @@ -54706,20 +55065,17 @@ class Config { */ readJson(loc) { - var _this7 = this; - let factory = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : (_fs || _load_fs()).readJson; - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - try { - return yield factory(loc); - } catch (err) { - if (err instanceof SyntaxError) { - throw new (_errors || _load_errors()).MessageError(_this7.reporter.lang('jsonError', loc, err.message)); - } else { - throw err; - } + + try { + return factory(loc); + } catch (err) { + if (err instanceof SyntaxError) { + throw new (_errors || _load_errors()).MessageError(this.reporter.lang('jsonError', loc, err.message)); + } else { + throw err; } - })(); + } } static create() { @@ -54755,7 +55111,7 @@ function _load_asyncToGenerator() { var _http; function _load_http() { - return _http = _interopRequireDefault(__webpack_require__(48)); + return _http = _interopRequireDefault(__webpack_require__(50)); } var _errors; @@ -54773,13 +55129,13 @@ function _load_constants() { var _crypto; function _load_crypto() { - return _crypto = _interopRequireWildcard(__webpack_require__(81)); + return _crypto = _interopRequireWildcard(__webpack_require__(85)); } var _baseFetcher; function _load_baseFetcher() { - return _baseFetcher = _interopRequireDefault(__webpack_require__(76)); + return _baseFetcher = _interopRequireDefault(__webpack_require__(79)); } var _fs; @@ -54793,11 +55149,11 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const path = __webpack_require__(1); -const tarFs = __webpack_require__(103); +const tarFs = __webpack_require__(109); const url = __webpack_require__(11); -const fs = __webpack_require__(5); +const fs = __webpack_require__(6); const stream = __webpack_require__(14); -const gunzip = __webpack_require__(474); +const gunzip = __webpack_require__(481); class TarballFetcher extends (_baseFetcher || _load_baseFetcher()).default { setupMirrorFromCache() { @@ -54813,6 +55169,7 @@ class TarballFetcher extends (_baseFetcher || _load_baseFetcher()).default { if (!(yield (_fs || _load_fs()).exists(tarballMirrorPath)) && (yield (_fs || _load_fs()).exists(tarballCachePath))) { // The tarball doesn't exists in the offline cache but does in the cache; we import it to the mirror + yield (_fs || _load_fs()).mkdirp(path.dirname(tarballMirrorPath)); yield (_fs || _load_fs()).copy(tarballCachePath, tarballMirrorPath, _this.reporter); } })(); @@ -54921,7 +55278,7 @@ class TarballFetcher extends (_baseFetcher || _load_baseFetcher()).default { return registry.request(this.reference, { headers: { 'Accept-Encoding': 'gzip', - 'Accept': 'application/octet-stream' + Accept: 'application/octet-stream' }, buffer: true, process: (req, resolve, reject) => { @@ -54958,7 +55315,7 @@ class TarballFetcher extends (_baseFetcher || _load_baseFetcher()).default { validateStream.pipe(extractorStream).on('error', reject); } - }); + }, this.packageName); } _fetch() { @@ -54970,13 +55327,13 @@ class TarballFetcher extends (_baseFetcher || _load_baseFetcher()).default { const isFilePath = urlParse.protocol ? urlParse.protocol.match(/^[a-z]:$/i) : urlParse.pathname ? urlParse.pathname.match(/^(?:\.{1,2})?[\\\/]/) : false; if (isFilePath) { - return yield _this4.fetchFromLocal(_this4.reference); + return _this4.fetchFromLocal(_this4.reference); } if (yield _this4.getLocalAvailabilityStatus()) { - return yield _this4.fetchFromLocal(); + return _this4.fetchFromLocal(); } else { - return yield _this4.fetchFromExternal(); + return _this4.fetchFromExternal(); } })(); } @@ -55001,6 +55358,8 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.testEngine = testEngine; +exports.checkOne = checkOne; +exports.check = check; var _errors; @@ -55023,13 +55382,13 @@ function _load_misc() { var _yarnVersion; function _load_yarnVersion() { - return _yarnVersion = __webpack_require__(62); + return _yarnVersion = __webpack_require__(65); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); -const semver = __webpack_require__(27); +const invariant = __webpack_require__(5); +const semver = __webpack_require__(26); const VERSIONS = Object.assign({}, process.versions, { yarn: (_yarnVersion || _load_yarnVersion()).version @@ -55101,90 +55460,80 @@ function testEngine(name, range, versions, looseSemver) { return false; } -class PackageCompatibility { - constructor(config, resolver, ignoreEngines) { - this.reporter = config.reporter; - this.resolver = resolver; - this.config = config; - this.ignoreEngines = ignoreEngines; - } - - static isValidArch(archs) { - return isValid(archs, process.arch); - } +function isValidArch(archs) { + return isValid(archs, process.arch); +} - static isValidPlatform(platforms) { - return isValid(platforms, process.platform); - } +function isValidPlatform(platforms) { + return isValid(platforms, process.platform); +} - check(info) { - let didIgnore = false; - let didError = false; - const reporter = this.reporter; - const human = `${info.name}@${info.version}`; +function checkOne(info, config, ignoreEngines) { + let didIgnore = false; + let didError = false; + const reporter = config.reporter; + const human = `${info.name}@${info.version}`; - const pushError = msg => { - const ref = info._reference; - invariant(ref, 'expected package reference'); + const pushError = msg => { + const ref = info._reference; + invariant(ref, 'expected package reference'); - if (ref.optional) { - ref.ignore = true; - ref.incompatible = true; + if (ref.optional) { + ref.ignore = true; + ref.incompatible = true; - reporter.warn(`${human}: ${msg}`); - if (!didIgnore) { - reporter.info(reporter.lang('optionalCompatibilityExcluded', human)); - didIgnore = true; - } - } else { - reporter.error(`${human}: ${msg}`); - didError = true; + reporter.warn(`${human}: ${msg}`); + if (!didIgnore) { + reporter.info(reporter.lang('optionalCompatibilityExcluded', human)); + didIgnore = true; } - }; - - const invalidPlatform = !this.config.ignorePlatform && Array.isArray(info.os) && info.os.length > 0 && !PackageCompatibility.isValidPlatform(info.os); - if (invalidPlatform) { - pushError(this.reporter.lang('incompatibleOS', process.platform)); + } else { + reporter.error(`${human}: ${msg}`); + didError = true; } + }; - const invalidCpu = !this.config.ignorePlatform && Array.isArray(info.cpu) && info.cpu.length > 0 && !PackageCompatibility.isValidArch(info.cpu); - if (invalidCpu) { - pushError(this.reporter.lang('incompatibleCPU', process.arch)); - } + const invalidPlatform = !config.ignorePlatform && Array.isArray(info.os) && info.os.length > 0 && !isValidPlatform(info.os); + + if (invalidPlatform) { + pushError(reporter.lang('incompatibleOS', process.platform)); + } - if (!this.ignoreEngines && typeof info.engines === 'object') { - for (const entry of (0, (_misc || _load_misc()).entries)(info.engines)) { - let name = entry[0]; - const range = entry[1]; + const invalidCpu = !config.ignorePlatform && Array.isArray(info.cpu) && info.cpu.length > 0 && !isValidArch(info.cpu); - if (aliases[name]) { - name = aliases[name]; - } + if (invalidCpu) { + pushError(reporter.lang('incompatibleCPU', process.arch)); + } - if (VERSIONS[name]) { - if (!testEngine(name, range, VERSIONS, this.config.looseSemver)) { - pushError(this.reporter.lang('incompatibleEngine', name, range)); - } - } else if (ignore.indexOf(name) < 0) { - this.reporter.warn(`${human}: ${this.reporter.lang('invalidEngine', name)}`); + if (!ignoreEngines && typeof info.engines === 'object') { + for (const entry of (0, (_misc || _load_misc()).entries)(info.engines)) { + let name = entry[0]; + const range = entry[1]; + + if (aliases[name]) { + name = aliases[name]; + } + + if (VERSIONS[name]) { + if (!testEngine(name, range, VERSIONS, config.looseSemver)) { + pushError(reporter.lang('incompatibleEngine', name, range)); } + } else if (ignore.indexOf(name) < 0) { + reporter.warn(`${human}: ${reporter.lang('invalidEngine', name)}`); } } + } - if (didError) { - throw new (_errors || _load_errors()).MessageError(reporter.lang('foundIncompatible')); - } + if (didError) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('foundIncompatible')); } +} - init() { - const infos = this.resolver.getManifests(); - for (const info of infos) { - this.check(info); - } - return Promise.resolve(); +function check(infos, config, ignoreEngines) { + for (const info of infos) { + checkOne(info, config, ignoreEngines); } } -exports.default = PackageCompatibility; /***/ }), /* 198 */ @@ -55203,6 +55552,90 @@ function _load_asyncToGenerator() { return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); } +let fetchCache = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (dest, fetcher, config) { + var _ref2 = yield config.readPackageMetadata(dest); + + const hash = _ref2.hash, + pkg = _ref2.package; + + yield fetcher.setupMirrorFromCache(); + return { + package: pkg, + hash, + dest, + cached: true + }; + }); + + return function fetchCache(_x, _x2, _x3) { + return _ref.apply(this, arguments); + }; +})(); + +let fetchOne = (() => { + var _ref3 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (ref, config) { + const dest = config.generateHardModulePath(ref); + + const remote = ref.remote; + + // Mock metedata for symlinked dependencies + if (remote.type === 'link' || remote.type === 'workspace') { + const mockPkg = { _uid: '', name: '', version: '0.0.0' }; + return Promise.resolve({ resolved: null, hash: '', dest, package: mockPkg, cached: false }); + } + + const Fetcher = (_index || _load_index())[remote.type]; + if (!Fetcher) { + throw new (_errors || _load_errors()).MessageError(config.reporter.lang('unknownFetcherFor', remote.type)); + } + + const fetcher = new Fetcher(dest, remote, config); + if (yield config.isValidModuleDest(dest)) { + return fetchCache(dest, fetcher, config); + } + + // remove as the module may be invalid + yield (_fs || _load_fs()).unlink(dest); + + try { + return fetcher.fetch(); + } catch (err) { + try { + yield (_fs || _load_fs()).unlink(dest); + } catch (err2) { + // what do? + } + throw err; + } + }); + + return function fetchOne(_x4, _x5) { + return _ref3.apply(this, arguments); + }; +})(); + +let maybeFetchOne = (() => { + var _ref4 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (ref, config) { + try { + return yield fetchOne(ref, config); + } catch (err) { + if (ref.optional) { + config.reporter.error(err.message); + return null; + } else { + throw err; + } + } + }); + + return function maybeFetchOne(_x6, _x7) { + return _ref4.apply(this, arguments); + }; +})(); + +exports.fetch = fetch; + var _errors; function _load_errors() { @@ -55212,7 +55645,7 @@ function _load_errors() { var _index; function _load_index() { - return _index = _interopRequireWildcard(__webpack_require__(349)); + return _index = _interopRequireWildcard(__webpack_require__(356)); } var _fs; @@ -55224,140 +55657,71 @@ function _load_fs() { var _promise; function _load_promise() { - return _promise = _interopRequireWildcard(__webpack_require__(61)); + return _promise = _interopRequireWildcard(__webpack_require__(64)); } 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 }; } -class PackageFetcher { - constructor(config, resolver) { - this.reporter = config.reporter; - this.resolver = resolver; - this.config = config; - } - - fetchCache(dest, fetcher) { - var _this = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - var _ref = yield _this.config.readPackageMetadata(dest); - - const hash = _ref.hash, - pkg = _ref.package; - - yield fetcher.setupMirrorFromCache(); - return { - package: pkg, - hash, - dest, - cached: true - }; - })(); - } - - fetch(ref) { - var _this2 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const dest = _this2.config.generateHardModulePath(ref); +function fetch(pkgs, config) { + const pkgsPerDest = new Map(); + pkgs = pkgs.filter(pkg => { + const ref = pkg._reference; + if (!ref) { + return false; + } + const dest = config.generateHardModulePath(ref); + const otherPkg = pkgsPerDest.get(dest); + if (otherPkg) { + config.reporter.warn(config.reporter.lang('multiplePackagesCantUnpackInSameDestination', ref.patterns, dest, otherPkg.patterns)); + return false; + } + pkgsPerDest.set(dest, ref); + return true; + }); + const tick = config.reporter.progress(pkgs.length); - const remote = ref.remote; - const Fetcher = (_index || _load_index())[remote.type]; - if (!Fetcher) { - throw new (_errors || _load_errors()).MessageError(_this2.reporter.lang('unknownFetcherFor', remote.type)); + return (_promise || _load_promise()).queue(pkgs, (() => { + var _ref5 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (pkg) { + const ref = pkg._reference; + if (!ref) { + return pkg; } - const fetcher = new Fetcher(dest, remote, _this2.config); - if (yield _this2.config.isValidModuleDest(dest)) { - return _this2.fetchCache(dest, fetcher); - } + const res = yield maybeFetchOne(ref, config); + let newPkg; - // remove as the module may be invalid - yield (_fs || _load_fs()).unlink(dest); + if (res) { + newPkg = res.package; - try { - return yield fetcher.fetch(); - } catch (err) { - try { - yield (_fs || _load_fs()).unlink(dest); - } catch (err2) { - // what do? + // update with new remote + // but only if there was a hash previously as the tarball fetcher does not provide a hash. + if (ref.remote.hash) { + ref.remote.hash = res.hash; } - throw err; } - })(); - } - maybeFetch(ref) { - var _this3 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - try { - return yield _this3.fetch(ref); - } catch (err) { - if (ref.optional) { - _this3.reporter.error(err.message); - return null; - } else { - throw err; - } + if (tick) { + tick(ref.name); } - })(); - } - - init() { - var _this4 = this; - - return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - let pkgs = _this4.resolver.getPackageReferences(); - const pkgsPerDest = new Map(); - pkgs = pkgs.filter(function (ref) { - const dest = _this4.config.generateHardModulePath(ref); - const otherPkg = pkgsPerDest.get(dest); - if (otherPkg) { - _this4.reporter.warn(_this4.reporter.lang('multiplePackagesCantUnpackInSameDestination', ref.patterns, dest, otherPkg.patterns)); - return false; - } - pkgsPerDest.set(dest, ref); - return true; - }); - const tick = _this4.reporter.progress(pkgs.length); - yield (_promise || _load_promise()).queue(pkgs, (() => { - var _ref2 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (ref) { - const res = yield _this4.maybeFetch(ref); - let newPkg; - - if (res) { - newPkg = res.package; - - // update with new remote - // but only if there was a hash previously as the tarball fetcher does not provide a hash. - if (ref.remote.hash) { - ref.remote.hash = res.hash; - } - } - - if (newPkg) { - // update with fresh manifest - yield _this4.resolver.updateManifest(ref, newPkg); - } + if (newPkg) { + newPkg._reference = ref; + newPkg._remote = ref.remote; + newPkg.name = pkg.name; + newPkg.fresh = pkg.fresh; + return newPkg; + } - if (tick) { - tick(ref.name); - } - }); + return pkg; + }); - return function (_x) { - return _ref2.apply(this, arguments); - }; - })(), _this4.config.networkConcurrency); - })(); - } + return function (_x8) { + return _ref5.apply(this, arguments); + }; + })(), config.networkConcurrency); } -exports.default = PackageFetcher; /***/ }), /* 199 */ @@ -55379,19 +55743,19 @@ function _load_asyncToGenerator() { var _packageRequest; function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); } var _requestManager; function _load_requestManager() { - return _requestManager = _interopRequireDefault(__webpack_require__(207)); + return _requestManager = _interopRequireDefault(__webpack_require__(208)); } var _blockingQueue; function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(80)); + return _blockingQueue = _interopRequireDefault(__webpack_require__(84)); } var _wrapper; @@ -55406,17 +55770,23 @@ function _load_map() { return _map = _interopRequireDefault(__webpack_require__(24)); } +var _workspaceLayout; + +function _load_workspaceLayout() { + return _workspaceLayout = _interopRequireDefault(__webpack_require__(66)); +} + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); -const semver = __webpack_require__(27); +const invariant = __webpack_require__(5); + +const semver = __webpack_require__(26); class PackageResolver { constructor(config, lockfile) { this.patternsByPackage = (0, (_map || _load_map()).default)(); this.fetchingPatterns = (0, (_map || _load_map()).default)(); this.fetchingQueue = new (_blockingQueue || _load_blockingQueue()).default('resolver fetching'); - this.newPatterns = []; this.patterns = (0, (_map || _load_map()).default)(); this.usedRegistries = new Set(); this.flat = false; @@ -55424,6 +55794,7 @@ class PackageResolver { this.reporter = config.reporter; this.lockfile = lockfile; this.config = config; + this.delayedResolveQueue = []; } // whether the dependency graph will be flattened @@ -55438,16 +55809,9 @@ class PackageResolver { // patterns we've already resolved or are in the process of resolving - // new patterns that didn't exist in the lockfile - - // TODO - // these are patterns that the package resolver was seeded with. these are required in - // order to resolve top level peerDependencies - - // manages and throttles json api http requests @@ -55466,24 +55830,25 @@ class PackageResolver { // environment specific config methods and options + // list of packages need to be resolved later (they found a matching version in the + // resolver, but better matches can still arrive later in the resolve process) + + /** * TODO description */ isNewPattern(pattern) { - return this.newPatterns.indexOf(pattern) >= 0; + return !!this.patterns[pattern].fresh; } - /** - * TODO description - */ - updateManifest(ref, newPkg) { // inherit fields const oldPkg = this.patterns[ref.patterns[0]]; newPkg._reference = ref; newPkg._remote = ref.remote; newPkg.name = oldPkg.name; + newPkg.fresh = oldPkg.fresh; // update patterns for (const pattern of ref.patterns) { @@ -55493,6 +55858,18 @@ class PackageResolver { return Promise.resolve(); } + updateManifests(newPkgs) { + for (const newPkg of newPkgs) { + if (newPkg._reference) { + for (const pattern of newPkg._reference.patterns) { + this.patterns[pattern] = newPkg; + } + } + } + + return Promise.resolve(); + } + /** * Given a list of patterns, dedupe them to a list of unique patterns. */ @@ -55612,23 +55989,6 @@ class PackageResolver { return infos; } - /** - * Get a flat list of all package references. - */ - - getPackageReferences() { - const refs = []; - - for (const manifest of this.getManifests()) { - const ref = manifest._reference; - if (ref) { - refs.push(ref); - } - } - - return refs; - } - /** * Get a flat list of all package info. */ @@ -55659,7 +56019,6 @@ class PackageResolver { const ref = pkg._reference; invariant(ref, 'expected package reference'); ref.patterns = [newPattern]; - this.newPatterns.splice(this.newPatterns.indexOf(pattern), 1, newPattern); this.addPattern(newPattern, pkg); this.removePattern(pattern); } @@ -55685,6 +56044,7 @@ class PackageResolver { break; } } + invariant(collapseToReference && collapseToManifest && collapseToPattern, `Couldn't find package manifest for ${human}`); for (const pattern of patterns) { @@ -55825,9 +56185,8 @@ class PackageResolver { } const lockfileEntry = _this.lockfile.getLocked(req.pattern); - if (!lockfileEntry) { - _this.newPatterns.push(req.pattern); - } else { + let fresh = false; + if (lockfileEntry) { var _PackageRequest$norma = (_packageRequest || _load_packageRequest()).default.normalizePattern(req.pattern); const range = _PackageRequest$norma.range, @@ -55837,13 +56196,15 @@ class PackageResolver { if (semver.validRange(range) && semver.valid(lockfileEntry.version) && !semver.satisfies(lockfileEntry.version, range) && !(_packageRequest || _load_packageRequest()).default.getExoticResolver(range) && hasVersion) { _this.reporter.warn(_this.reporter.lang('incorrectLockfileEntry', req.pattern)); _this.removePattern(req.pattern); - _this.newPatterns.push(req.pattern); _this.lockfile.removePattern(req.pattern); + fresh = true; } + } else { + fresh = true; } const request = new (_packageRequest || _load_packageRequest()).default(req, _this); - yield request.find(); + yield request.find(fresh); })(); } @@ -55851,29 +56212,49 @@ class PackageResolver { * TODO description */ - init(deps, isFlat) { + init(deps, isFlat, workspaceLayout) { var _this2 = this; return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { _this2.flat = isFlat; - - // + _this2.workspaceLayout = workspaceLayout; const activity = _this2.activity = _this2.reporter.activity(); - - // - _this2.seedPatterns = deps.map(function (dep) { - return dep.pattern; - }); - - // yield Promise.all(deps.map(function (req) { return _this2.find(req); })); + // all required package versions have been discovered, so now packages that + // resolved to existing versions can be resolved to their best available version + _this2.resolvePackagesWithExistingVersions(); + activity.end(); _this2.activity = null; })(); } + + /** + * Called by the package requester for packages that this resolver already had + * a matching version for. Delay the resolve, because better matches can still be + * discovered. + */ + + reportPackageWithExistingVersion(req, info) { + this.delayedResolveQueue.push({ req, info }); + } + + /** + * Executes the resolve to existing versions for packages after the find process, + * when all versions that are going to be used have been discovered. + */ + + resolvePackagesWithExistingVersions() { + for (const _ref2 of this.delayedResolveQueue) { + const req = _ref2.req, + info = _ref2.info; + + req.resolveToExistingVersion(info); + } + } } exports.default = PackageResolver; @@ -55930,7 +56311,7 @@ exports.en = undefined; var _en; function _load_en() { - return _en = _interopRequireDefault(__webpack_require__(364)); + return _en = _interopRequireDefault(__webpack_require__(371)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -55969,7 +56350,7 @@ function _load_errors() { var _exoticResolver; function _load_exoticResolver() { - return _exoticResolver = _interopRequireDefault(__webpack_require__(50)); + return _exoticResolver = _interopRequireDefault(__webpack_require__(43)); } var _misc; @@ -55988,9 +56369,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); + const path = __webpack_require__(1); -const uuid = __webpack_require__(73); +const uuid = __webpack_require__(58); class FileResolver extends (_exoticResolver || _load_exoticResolver()).default { constructor(request, fragment) { @@ -56006,6 +56388,19 @@ class FileResolver extends (_exoticResolver || _load_exoticResolver()).default { if (!path.isAbsolute(loc)) { loc = path.join(_this.config.cwd, loc); } + + if (_this.config.linkFileDependencies) { + const registry = 'npm'; + const manifest = { _uid: '', name: '', version: '0.0.0', _registry: registry }; + manifest._remote = { + type: 'link', + registry, + hash: null, + reference: loc + }; + manifest._uid = manifest.version; + return manifest; + } if (!(yield (_fs || _load_fs()).exists(loc))) { throw new (_errors || _load_errors()).MessageError(_this.reporter.lang('doesntExist', loc)); } @@ -56083,7 +56478,7 @@ Object.defineProperty(exports, "__esModule", { var _npmResolver; function _load_npmResolver() { - return _npmResolver = _interopRequireDefault(__webpack_require__(119)); + return _npmResolver = _interopRequireDefault(__webpack_require__(124)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -56111,7 +56506,7 @@ function _load_misc() { return _misc = __webpack_require__(10); } -const mm = __webpack_require__(546); +const mm = __webpack_require__(553); const path = __webpack_require__(1); const WHITESPACE_RE = /^\s+$/; @@ -56187,7 +56582,7 @@ function sortFilter(files, filters) { } } - return { keepFiles, ignoreFiles }; + return { ignoreFiles, keepFiles }; } function matchesFilter(filter, basename, loc) { @@ -56227,8 +56622,8 @@ function ignoreLinesToRegex(lines) { return { base, isNegation, - regex, - pattern + pattern, + regex }; } else { return null; @@ -56247,7 +56642,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.isOffline = isOffline; -const os = __webpack_require__(107); +const os = __webpack_require__(113); const IGNORE_INTERFACES = ['lo0', 'awdl0', 'bridge0']; const LOCAL_IPS = ['127.0.0.1', '::1']; @@ -56305,13 +56700,13 @@ function _load_asyncToGenerator() { var _validate; function _load_validate() { - return _validate = _interopRequireDefault(__webpack_require__(60)); + return _validate = _interopRequireDefault(__webpack_require__(63)); } var _fix; function _load_fix() { - return _fix = _interopRequireDefault(__webpack_require__(375)); + return _fix = _interopRequireDefault(__webpack_require__(384)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -56367,6 +56762,32 @@ exports.default = (() => { "use strict"; +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getPosixPath = getPosixPath; +exports.expandPath = expandPath; +const userHome = __webpack_require__(86).default; + +function getPosixPath(path) { + return path.replace(/\\/g, '/'); +} + +function expandPath(path) { + if (process.platform !== 'win32') { + path = path.replace(/^\s*~(?=$|\/|\\)/, userHome); + } + + return path; +} + +/***/ }), +/* 208 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + Object.defineProperty(exports, "__esModule", { value: true }); @@ -56380,7 +56801,7 @@ function _load_errors() { var _blockingQueue; function _load_blockingQueue() { - return _blockingQueue = _interopRequireDefault(__webpack_require__(80)); + return _blockingQueue = _interopRequireDefault(__webpack_require__(84)); } var _constants; @@ -56405,10 +56826,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const RequestCaptureHar = __webpack_require__(579); -const invariant = __webpack_require__(7); +const RequestCaptureHar = __webpack_require__(587); +const invariant = __webpack_require__(5); const url = __webpack_require__(11); -const fs = __webpack_require__(5); +const fs = __webpack_require__(6); const successHosts = (0, (_map || _load_map()).default)(); const controlOffline = (_network || _load_network()).isOffline(); @@ -56504,7 +56925,7 @@ class RequestManager { _getRequestModule() { if (!this._requestModule) { - const request = __webpack_require__(580); + const request = __webpack_require__(588); if (this.captureHar) { this._requestCaptureHar = new RequestCaptureHar(request); this._requestModule = this._requestCaptureHar.request.bind(this._requestCaptureHar); @@ -56538,7 +56959,7 @@ class RequestManager { }, params.headers); const promise = new Promise((resolve, reject) => { - this.queue.push({ params, resolve, reject }); + this.queue.push({ params, reject, resolve }); this.shiftQueue(); }); @@ -56778,13 +57199,13 @@ class RequestManager { exports.default = RequestManager; /***/ }), -/* 208 */ +/* 209 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var crypto_hash_sha512 = __webpack_require__(163).lowlevel.crypto_hash; +var crypto_hash_sha512 = __webpack_require__(110).lowlevel.crypto_hash; /* * This file is a 1:1 port from the OpenBSD blowfish.c and bcrypt_pbkdf.c. As a @@ -57341,12 +57762,12 @@ module.exports = { /***/ }), -/* 209 */ +/* 210 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const restoreCursor = __webpack_require__(590); +const restoreCursor = __webpack_require__(598); let hidden = false; @@ -57387,7 +57808,7 @@ exports.toggle = (force, stream) => { /***/ }), -/* 210 */ +/* 211 */ /***/ (function(module, exports) { @@ -57630,12 +58051,12 @@ function isObject(val) { /***/ }), -/* 211 */ +/* 212 */ /***/ (function(module, exports, __webpack_require__) { var util = __webpack_require__(2); var Stream = __webpack_require__(14).Stream; -var DelayedStream = __webpack_require__(445); +var DelayedStream = __webpack_require__(454); module.exports = CombinedStream; function CombinedStream() { @@ -57824,7 +58245,7 @@ CombinedStream.prototype._emitError = function(err) { /***/ }), -/* 212 */ +/* 213 */ /***/ (function(module, exports) { // IE 8- don't enum bug keys @@ -57833,27 +58254,27 @@ module.exports = ( ).split(','); /***/ }), -/* 213 */ +/* 214 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(28).document && document.documentElement; +module.exports = __webpack_require__(29).document && document.documentElement; /***/ }), -/* 214 */ +/* 215 */ /***/ (function(module, exports, __webpack_require__) { // fallback for non-array-like ES3 and non-enumerable old V8 strings -var cof = __webpack_require__(84); +var cof = __webpack_require__(88); module.exports = Object('z').propertyIsEnumerable(0) ? Object : function(it){ return cof(it) == 'String' ? it.split('') : Object(it); }; /***/ }), -/* 215 */ +/* 216 */ /***/ (function(module, exports, __webpack_require__) { // check on default Array iterator -var Iterators = __webpack_require__(54) +var Iterators = __webpack_require__(55) , ITERATOR = __webpack_require__(25)('iterator') , ArrayProto = Array.prototype; @@ -57862,11 +58283,11 @@ module.exports = function(it){ }; /***/ }), -/* 216 */ +/* 217 */ /***/ (function(module, exports, __webpack_require__) { // call something on iterator step with safe closing on error -var anObject = __webpack_require__(44); +var anObject = __webpack_require__(46); module.exports = function(iterator, fn, value, entries){ try { return entries ? fn(anObject(value)[0], value[1]) : fn(value); @@ -57879,20 +58300,20 @@ module.exports = function(iterator, fn, value, entries){ }; /***/ }), -/* 217 */ +/* 218 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var LIBRARY = __webpack_require__(219) - , $export = __webpack_require__(85) - , redefine = __webpack_require__(426) - , hide = __webpack_require__(53) - , has = __webpack_require__(86) - , Iterators = __webpack_require__(54) - , $iterCreate = __webpack_require__(415) - , setToStringTag = __webpack_require__(133) - , getPrototypeOf = __webpack_require__(422) +var LIBRARY = __webpack_require__(220) + , $export = __webpack_require__(89) + , redefine = __webpack_require__(435) + , hide = __webpack_require__(54) + , has = __webpack_require__(90) + , Iterators = __webpack_require__(55) + , $iterCreate = __webpack_require__(424) + , setToStringTag = __webpack_require__(136) + , getPrototypeOf = __webpack_require__(431) , ITERATOR = __webpack_require__(25)('iterator') , BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next` , FF_ITERATOR = '@@iterator' @@ -57955,7 +58376,7 @@ module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED }; /***/ }), -/* 218 */ +/* 219 */ /***/ (function(module, exports, __webpack_require__) { var ITERATOR = __webpack_require__(25)('iterator') @@ -57981,28 +58402,28 @@ module.exports = function(exec, skipClosing){ }; /***/ }), -/* 219 */ +/* 220 */ /***/ (function(module, exports) { module.exports = true; /***/ }), -/* 220 */ +/* 221 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.14 / 15.2.3.14 Object.keys(O) -var $keys = __webpack_require__(423) - , enumBugKeys = __webpack_require__(212); +var $keys = __webpack_require__(432) + , enumBugKeys = __webpack_require__(213); module.exports = Object.keys || function keys(O){ return $keys(O, enumBugKeys); }; /***/ }), -/* 221 */ +/* 222 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(28) +var global = __webpack_require__(29) , SHARED = '__core-js_shared__' , store = global[SHARED] || (global[SHARED] = {}); module.exports = function(key){ @@ -58010,14 +58431,14 @@ module.exports = function(key){ }; /***/ }), -/* 222 */ +/* 223 */ /***/ (function(module, exports, __webpack_require__) { -var ctx = __webpack_require__(63) - , invoke = __webpack_require__(414) - , html = __webpack_require__(213) - , cel = __webpack_require__(130) - , global = __webpack_require__(28) +var ctx = __webpack_require__(68) + , invoke = __webpack_require__(423) + , html = __webpack_require__(214) + , cel = __webpack_require__(133) + , global = __webpack_require__(29) , process = global.process , setTask = global.setImmediate , clearTask = global.clearImmediate @@ -58052,7 +58473,7 @@ if(!setTask || !clearTask){ delete queue[id]; }; // Node.js 0.8- - if(__webpack_require__(84)(process) == 'process'){ + if(__webpack_require__(88)(process) == 'process'){ defer = function(id){ process.nextTick(ctx(run, id, 1)); }; @@ -58090,7 +58511,7 @@ module.exports = { }; /***/ }), -/* 223 */ +/* 224 */ /***/ (function(module, exports) { var id = 0 @@ -58100,13 +58521,13 @@ module.exports = function(key){ }; /***/ }), -/* 224 */ +/* 225 */ /***/ (function(module, exports, __webpack_require__) { // Load modules -var Crypto = __webpack_require__(6); -var Boom = __webpack_require__(83); +var Crypto = __webpack_require__(7); +var Boom = __webpack_require__(87); // Declare internals @@ -58174,7 +58595,7 @@ exports.fixedTimeComparison = function (a, b) { /***/ }), -/* 225 */ +/* 226 */ /***/ (function(module, exports, __webpack_require__) { @@ -58190,7 +58611,7 @@ exports.coerce = coerce; exports.disable = disable; exports.enable = enable; exports.enabled = enabled; -exports.humanize = __webpack_require__(553); +exports.humanize = __webpack_require__(560); /** * The currently active debug mode names, and names to skip. @@ -58320,7 +58741,7 @@ function enable(namespaces) { exports.names = []; exports.skips = []; - var split = (namespaces || '').split(/[\s,]+/); + var split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); var len = split.length; for (var i = 0; i < len; i++) { @@ -58382,13 +58803,13 @@ function coerce(val) { /***/ }), -/* 226 */ +/* 227 */ /***/ (function(module, exports, __webpack_require__) { -var stream = __webpack_require__(67) -var eos = __webpack_require__(447) -var inherits = __webpack_require__(37) -var shift = __webpack_require__(613) +var stream = __webpack_require__(47) +var eos = __webpack_require__(456) +var inherits = __webpack_require__(36) +var shift = __webpack_require__(620) var SIGNAL_FLUSH = new Buffer([0]) @@ -58616,10 +59037,73 @@ module.exports = Duplexify /***/ }), -/* 227 */ +/* 228 */ +/***/ (function(module, exports, __webpack_require__) { + +var crypto = __webpack_require__(7); +var BigInteger = __webpack_require__(39).BigInteger; +var ECPointFp = __webpack_require__(93).ECPointFp; +exports.ECCurves = __webpack_require__(458); + +// zero prepad +function unstupid(hex,len) +{ + return (hex.length >= len) ? hex : unstupid("0"+hex,len); +} + +exports.ECKey = function(curve, key, isPublic) +{ + var priv; + var c = curve(); + var n = c.getN(); + var bytes = Math.floor(n.bitLength()/8); + + if(key) + { + if(isPublic) + { + var curve = c.getCurve(); +// var x = key.slice(1,bytes+1); // skip the 04 for uncompressed format +// var y = key.slice(bytes+1); +// this.P = new ECPointFp(curve, +// curve.fromBigInteger(new BigInteger(x.toString("hex"), 16)), +// curve.fromBigInteger(new BigInteger(y.toString("hex"), 16))); + this.P = curve.decodePointHex(key.toString("hex")); + }else{ + if(key.length != bytes) return false; + priv = new BigInteger(key.toString("hex"), 16); + } + }else{ + var n1 = n.subtract(BigInteger.ONE); + var r = new BigInteger(crypto.randomBytes(n.bitLength())); + priv = r.mod(n1).add(BigInteger.ONE); + this.P = c.getG().multiply(priv); + } + if(this.P) + { +// var pubhex = unstupid(this.P.getX().toBigInteger().toString(16),bytes*2)+unstupid(this.P.getY().toBigInteger().toString(16),bytes*2); +// this.PublicKey = new Buffer("04"+pubhex,"hex"); + this.PublicKey = new Buffer(c.getCurve().encodeCompressedPointHex(this.P),"hex"); + } + if(priv) + { + this.PrivateKey = new Buffer(unstupid(priv.toString(16),bytes*2),"hex"); + this.deriveSharedSecret = function(key) + { + if(!key || !key.P) return false; + var S = key.P.multiply(priv); + return new Buffer(unstupid(S.getX().toBigInteger().toString(16),bytes*2),"hex"); + } + } +} + + + +/***/ }), +/* 229 */ /***/ (function(module, exports, __webpack_require__) { -var once = __webpack_require__(451); +var once = __webpack_require__(104); var noop = function() {}; @@ -58648,21 +59132,21 @@ var eos = function(stream, opts, callback) { var onfinish = function() { writable = false; - if (!readable) callback(); + if (!readable) callback.call(stream); }; var onend = function() { readable = false; - if (!writable) callback(); + if (!writable) callback.call(stream); }; var onexit = function(exitCode) { - callback(exitCode ? new Error('exited with error code: ' + exitCode) : null); + callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null); }; var onclose = function() { - if (readable && !(rs && rs.ended)) return callback(new Error('premature close')); - if (writable && !(ws && ws.ended)) return callback(new Error('premature close')); + if (readable && !(rs && rs.ended)) return callback.call(stream, new Error('premature close')); + if (writable && !(ws && ws.ended)) return callback.call(stream, new Error('premature close')); }; var onrequest = function() { @@ -58703,8 +59187,9 @@ var eos = function(stream, opts, callback) { module.exports = eos; + /***/ }), -/* 228 */ +/* 230 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -58722,7 +59207,7 @@ module.exports = function (str) { /***/ }), -/* 229 */ +/* 231 */ /***/ (function(module, exports, __webpack_require__) { /* @@ -58894,7 +59379,7 @@ function dumpException(ex) /***/ }), -/* 230 */ +/* 232 */ /***/ (function(module, exports, __webpack_require__) { module.exports = realpath @@ -58904,13 +59389,13 @@ realpath.realpathSync = realpathSync realpath.monkeypatch = monkeypatch realpath.unmonkeypatch = unmonkeypatch -var fs = __webpack_require__(5) +var fs = __webpack_require__(6) var origRealpath = fs.realpath var origRealpathSync = fs.realpathSync var version = process.version var ok = /^v[0-5]\./.test(version) -var old = __webpack_require__(467) +var old = __webpack_require__(474) function newError (er) { return er && er.syscall === 'realpath' && ( @@ -58966,7 +59451,7 @@ function unmonkeypatch () { /***/ }), -/* 231 */ +/* 233 */ /***/ (function(module, exports, __webpack_require__) { exports.alphasort = alphasort @@ -58984,8 +59469,8 @@ function ownProp (obj, field) { } var path = __webpack_require__(1) -var minimatch = __webpack_require__(153) -var isAbsolute = __webpack_require__(156) +var minimatch = __webpack_require__(155) +var isAbsolute = __webpack_require__(157) var Minimatch = minimatch.Minimatch function alphasorti (a, b) { @@ -59212,13 +59697,13 @@ function childrenIgnored (self, path) { /***/ }), -/* 232 */ +/* 234 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var fs = __webpack_require__(5) +var fs = __webpack_require__(6) module.exports = clone(fs) @@ -59240,12 +59725,12 @@ function clone (obj) { /***/ }), -/* 233 */ +/* 235 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(5) -var polyfills = __webpack_require__(472) -var legacy = __webpack_require__(471) +var fs = __webpack_require__(6) +var polyfills = __webpack_require__(479) +var legacy = __webpack_require__(478) var queue = [] var util = __webpack_require__(2) @@ -59269,7 +59754,7 @@ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || '')) { }) } -module.exports = patch(__webpack_require__(232)) +module.exports = patch(__webpack_require__(234)) if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH) { module.exports = patch(fs) } @@ -59508,14 +59993,14 @@ function retry () { /***/ }), -/* 234 */ +/* 236 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(21); -var MuteStream = __webpack_require__(241); -var readline = __webpack_require__(109); +var MuteStream = __webpack_require__(243); +var readline = __webpack_require__(115); /** * Base interface class other can inherits from @@ -59543,6 +60028,7 @@ var UI = module.exports = function (opt) { UI.prototype.onForceClose = function () { this.close(); + console.log(''); }; /** @@ -59586,12 +60072,12 @@ function setupReadlineOptions(opt) { /***/ }), -/* 235 */ +/* 237 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var ansiEscapes = __webpack_require__(308); +var ansiEscapes = __webpack_require__(313); /** * Move cursor left by `x` @@ -59644,7 +60130,7 @@ exports.clearLine = function (rl, len) { /***/ }), -/* 236 */ +/* 238 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -59657,7 +60143,7 @@ exports.clearLine = function (rl, len) { -var typeOf = __webpack_require__(151); +var typeOf = __webpack_require__(153); module.exports = function isNumber(num) { var type = typeOf(num); @@ -59670,7 +60156,7 @@ module.exports = function isNumber(num) { /***/ }), -/* 237 */ +/* 239 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -59690,7 +60176,7 @@ module.exports = function isPrimitive(value) { /***/ }), -/* 238 */ +/* 240 */ /***/ (function(module, exports) { var toString = {}.toString; @@ -59701,7 +60187,7 @@ module.exports = Array.isArray || function (arr) { /***/ }), -/* 239 */ +/* 241 */ /***/ (function(module, exports, __webpack_require__) { var stream = __webpack_require__(14) @@ -59734,7 +60220,7 @@ module.exports.isDuplex = isDuplex /***/ }), -/* 240 */ +/* 242 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -59752,7 +60238,7 @@ module.exports.isDuplex = isDuplex * @private */ -var db = __webpack_require__(551) +var db = __webpack_require__(558) var extname = __webpack_require__(1).extname /** @@ -59915,7 +60401,7 @@ function populateMaps (extensions, types) { var to = preference.indexOf(mime.source) if (types[extension] !== 'application/octet-stream' && - from > to || (from === to && types[extension].substr(0, 12) === 'application/')) { + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { // skip the remapping continue } @@ -59929,7 +60415,7 @@ function populateMaps (extensions, types) { /***/ }), -/* 241 */ +/* 243 */ /***/ (function(module, exports, __webpack_require__) { var Stream = __webpack_require__(14) @@ -60080,13 +60566,13 @@ MuteStream.prototype.close = proxy('close') /***/ }), -/* 242 */ +/* 244 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(554); +module.exports = __webpack_require__(561); /***/ }), -/* 243 */ +/* 245 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;(function (root, factory){ @@ -60387,12 +60873,12 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_ /***/ }), -/* 244 */ +/* 246 */ /***/ (function(module, exports, __webpack_require__) { -var once = __webpack_require__(155) -var eos = __webpack_require__(227) -var fs = __webpack_require__(5) // we only need fs to get the ReadStream and WriteStream prototypes +var once = __webpack_require__(104) +var eos = __webpack_require__(229) +var fs = __webpack_require__(6) // we only need fs to get the ReadStream and WriteStream prototypes var noop = function () {} @@ -60473,7 +60959,7 @@ module.exports = pump /***/ }), -/* 245 */ +/* 247 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -60498,15 +60984,15 @@ module.exports = { /***/ }), -/* 246 */ +/* 248 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var stringify = __webpack_require__(569); -var parse = __webpack_require__(568); -var formats = __webpack_require__(245); +var stringify = __webpack_require__(576); +var parse = __webpack_require__(575); +var formats = __webpack_require__(247); module.exports = { formats: formats, @@ -60516,7 +61002,7 @@ module.exports = { /***/ }), -/* 247 */ +/* 249 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -60705,7 +61191,7 @@ exports.isBuffer = function (obj) { /***/ }), -/* 248 */ +/* 250 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -60714,11 +61200,11 @@ exports.isBuffer = function (obj) { module.exports = Readable; /**/ -var processNextTick = __webpack_require__(157); +var processNextTick = __webpack_require__(158); /**/ /**/ -var isArray = __webpack_require__(238); +var isArray = __webpack_require__(240); /**/ /**/ @@ -60728,7 +61214,7 @@ var Duplex; Readable.ReadableState = ReadableState; /**/ -var EE = __webpack_require__(34).EventEmitter; +var EE = __webpack_require__(49).EventEmitter; var EElistenerCount = function (emitter, type) { return emitter.listeners(type).length; @@ -60736,24 +61222,17 @@ var EElistenerCount = function (emitter, type) { /**/ /**/ -var Stream; -(function () { - try { - Stream = __webpack_require__(14); - } catch (_) {} finally { - if (!Stream) Stream = __webpack_require__(34).EventEmitter; - } -})(); +var Stream = __webpack_require__(253); /**/ -var Buffer = __webpack_require__(55).Buffer; +var Buffer = __webpack_require__(76).Buffer; /**/ -var bufferShim = __webpack_require__(125); +var bufferShim = __webpack_require__(128); /**/ /**/ -var util = __webpack_require__(66); -util.inherits = __webpack_require__(37); +var util = __webpack_require__(71); +util.inherits = __webpack_require__(36); /**/ /**/ @@ -60766,11 +61245,13 @@ if (debugUtil && debugUtil.debuglog) { } /**/ -var BufferList = __webpack_require__(574); +var BufferList = __webpack_require__(581); var StringDecoder; util.inherits(Readable, Stream); +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; + function prependListener(emitter, event, fn) { // Sadly this is not cacheable as some libraries bundle their own // event emitter implementation with them. @@ -60786,7 +61267,7 @@ function prependListener(emitter, event, fn) { } function ReadableState(options, stream) { - Duplex = Duplex || __webpack_require__(46); + Duplex = Duplex || __webpack_require__(56); options = options || {}; @@ -60803,7 +61284,7 @@ function ReadableState(options, stream) { this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; + this.highWaterMark = ~~this.highWaterMark; // A linked list is used to store data chunks instead of an array because the // linked list can remove elements from the beginning faster than @@ -60848,14 +61329,14 @@ function ReadableState(options, stream) { this.decoder = null; this.encoding = null; if (options.encoding) { - if (!StringDecoder) StringDecoder = __webpack_require__(260).StringDecoder; + if (!StringDecoder) StringDecoder = __webpack_require__(254).StringDecoder; this.decoder = new StringDecoder(options.encoding); this.encoding = options.encoding; } } function Readable(options) { - Duplex = Duplex || __webpack_require__(46); + Duplex = Duplex || __webpack_require__(56); if (!(this instanceof Readable)) return new Readable(options); @@ -60958,7 +61439,7 @@ function needMoreData(state) { // backwards compatibility. Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = __webpack_require__(260).StringDecoder; + if (!StringDecoder) StringDecoder = __webpack_require__(254).StringDecoder; this._readableState.decoder = new StringDecoder(enc); this._readableState.encoding = enc; return this; @@ -61495,10 +61976,9 @@ Readable.prototype.wrap = function (stream) { } // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function (ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], self.emit.bind(self, kProxyEvents[n])); + } // when we try to consume some more bytes, simply unpause the // underlying stream. @@ -61652,7 +62132,195 @@ function indexOf(xs, x) { } /***/ }), -/* 249 */ +/* 251 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; + +var Duplex = __webpack_require__(56); + +/**/ +var util = __webpack_require__(71); +util.inherits = __webpack_require__(36); +/**/ + +util.inherits(Transform, Duplex); + +function TransformState(stream) { + this.afterTransform = function (er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; + this.writeencoding = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) stream.push(data); + + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + + Duplex.call(this, options); + + this._transformState = new TransformState(this); + + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.once('prefinish', function () { + if (typeof this._flush === 'function') this._flush(function (er, data) { + done(stream, er, data); + });else done(stream); + }); +} + +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + throw new Error('_transform() is not implemented'); +}; + +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + +function done(stream, er, data) { + if (er) return stream.emit('error', er); + + if (data !== null && data !== undefined) stream.push(data); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) throw new Error('Calling transform done when ws.length != 0'); + + if (ts.transforming) throw new Error('Calling transform done when still transforming'); + + return stream.push(null); +} + +/***/ }), +/* 252 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -61665,7 +62333,7 @@ function indexOf(xs, x) { module.exports = Writable; /**/ -var processNextTick = __webpack_require__(157); +var processNextTick = __webpack_require__(158); /**/ /**/ @@ -61679,30 +62347,23 @@ var Duplex; Writable.WritableState = WritableState; /**/ -var util = __webpack_require__(66); -util.inherits = __webpack_require__(37); +var util = __webpack_require__(71); +util.inherits = __webpack_require__(36); /**/ /**/ var internalUtil = { - deprecate: __webpack_require__(624) + deprecate: __webpack_require__(631) }; /**/ /**/ -var Stream; -(function () { - try { - Stream = __webpack_require__(14); - } catch (_) {} finally { - if (!Stream) Stream = __webpack_require__(34).EventEmitter; - } -})(); +var Stream = __webpack_require__(253); /**/ -var Buffer = __webpack_require__(55).Buffer; +var Buffer = __webpack_require__(76).Buffer; /**/ -var bufferShim = __webpack_require__(125); +var bufferShim = __webpack_require__(128); /**/ util.inherits(Writable, Stream); @@ -61717,7 +62378,7 @@ function WriteReq(chunk, encoding, cb) { } function WritableState(options, stream) { - Duplex = Duplex || __webpack_require__(46); + Duplex = Duplex || __webpack_require__(56); options = options || {}; @@ -61735,7 +62396,7 @@ function WritableState(options, stream) { this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; + this.highWaterMark = ~~this.highWaterMark; // drain event flag. this.needDrain = false; @@ -61851,7 +62512,7 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot } function Writable(options) { - Duplex = Duplex || __webpack_require__(46); + Duplex = Duplex || __webpack_require__(56); // Writable ctor is applied to Duplexes, too. // `realHasInstance` is necessary because using plain `instanceof` @@ -61890,20 +62551,16 @@ function writeAfterEnd(stream, cb) { processNextTick(cb, er); } -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. function validChunk(stream, state, chunk, cb) { var valid = true; var er = false; - // Always throw error if a null is written - // if we are not in object mode then throw - // if it is not a buffer, string, or undefined. + if (chunk === null) { er = new TypeError('May not write null values to stream'); - } else if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { er = new TypeError('Invalid non-string/buffer chunk'); } if (er) { @@ -61917,19 +62574,20 @@ function validChunk(stream, state, chunk, cb) { Writable.prototype.write = function (chunk, encoding, cb) { var state = this._writableState; var ret = false; + var isBuf = Buffer.isBuffer(chunk); if (typeof encoding === 'function') { cb = encoding; encoding = null; } - if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; if (typeof cb !== 'function') cb = nop; - if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { + if (state.ended) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); } return ret; @@ -61969,10 +62627,11 @@ function decodeChunk(state, chunk, encoding) { // if we're already writing something, then just put this // in the queue, and wait our turn. Otherwise, call _write // If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - - if (Buffer.isBuffer(chunk)) encoding = 'buffer'; +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + chunk = decodeChunk(state, chunk, encoding); + if (Buffer.isBuffer(chunk)) encoding = 'buffer'; + } var len = state.objectMode ? 1 : chunk.length; state.length += len; @@ -62041,8 +62700,8 @@ function onwrite(stream, er) { asyncWrite(afterWrite, stream, state, finished, cb); /**/ } else { - afterWrite(stream, state, finished, cb); - } + afterWrite(stream, state, finished, cb); + } } } @@ -62193,7 +62852,6 @@ function CorkedRequest(state) { this.next = null; this.entry = null; - this.finish = function (err) { var entry = _this.entry; _this.entry = null; @@ -62212,7 +62870,292 @@ function CorkedRequest(state) { } /***/ }), -/* 250 */ +/* 253 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(14); + + +/***/ }), +/* 254 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +var Buffer = __webpack_require__(57).Buffer; + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return -1; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// UTF-8 replacement characters ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'.repeat(p); + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'.repeat(p + 1); + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'.repeat(p + 2); + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character for each buffered byte of a (partial) +// character needs to be added to the output. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'.repeat(this.lastTotal - this.lastNeed); + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} + +/***/ }), +/* 255 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -62237,13 +63180,13 @@ module.exports = function repeat(ele, num) { /***/ }), -/* 251 */ +/* 256 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var tough = __webpack_require__(620) +var tough = __webpack_require__(627) var Cookie = tough.Cookie , CookieJar = tough.CookieJar @@ -62283,7 +63226,7 @@ exports.jar = function(store) { /***/ }), -/* 252 */ +/* 257 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -62309,7 +63252,7 @@ exports.jar = function(store) { // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -62852,7 +63795,7 @@ exports.jar = function(store) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 253 */ +/* 258 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -62878,7 +63821,7 @@ exports.jar = function(store) { // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -63090,230 +64033,646 @@ exports.jar = function(store) { return si.disposable; }; - return VirtualTimeScheduler; - }(Scheduler)); + return VirtualTimeScheduler; + }(Scheduler)); + + /** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */ + Rx.HistoricalScheduler = (function (__super__) { + inherits(HistoricalScheduler, __super__); + + /** + * Creates a new historical scheduler with the specified initial clock value. + * @constructor + * @param {Number} initialClock Initial value for the clock. + * @param {Function} comparer Comparer to determine causality of events based on absolute time. + */ + function HistoricalScheduler(initialClock, comparer) { + var clock = initialClock == null ? 0 : initialClock; + var cmp = comparer || defaultSubComparer; + __super__.call(this, clock, cmp); + } + + var HistoricalSchedulerProto = HistoricalScheduler.prototype; + + /** + * Adds a relative time value to an absolute time value. + * @param {Number} absolute Absolute virtual time value. + * @param {Number} relative Relative virtual time value to add. + * @return {Number} Resulting absolute virtual time sum value. + */ + HistoricalSchedulerProto.add = function (absolute, relative) { + return absolute + relative; + }; + + HistoricalSchedulerProto.toAbsoluteTime = function (absolute) { + return new Date(absolute).getTime(); + }; + + /** + * Converts the TimeSpan value to a relative virtual time value. + * @memberOf HistoricalScheduler + * @param {Number} timeSpan TimeSpan value to convert. + * @return {Number} Corresponding relative virtual time value. + */ + HistoricalSchedulerProto.toRelativeTime = function (timeSpan) { + return timeSpan; + }; + + return HistoricalScheduler; + }(Rx.VirtualTimeScheduler)); + + return Rx; +})); + +/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) + +/***/ }), +/* 259 */ +/***/ (function(module, exports, __webpack_require__) { + +// Note: since nyc uses this module to output coverage, any lines +// that are in the direct sync flow of nyc's outputCoverage are +// ignored, since we can never get coverage for them. +var assert = __webpack_require__(22) +var signals = __webpack_require__(612) + +var EE = __webpack_require__(49) +/* istanbul ignore if */ +if (typeof EE !== 'function') { + EE = EE.EventEmitter +} + +var emitter +if (process.__signal_exit_emitter__) { + emitter = process.__signal_exit_emitter__ +} else { + emitter = process.__signal_exit_emitter__ = new EE() + emitter.count = 0 + emitter.emitted = {} +} + +// Because this emitter is a global, we have to check to see if a +// previous version of this library failed to enable infinite listeners. +// I know what you're about to say. But literally everything about +// signal-exit is a compromise with evil. Get used to it. +if (!emitter.infinite) { + emitter.setMaxListeners(Infinity) + emitter.infinite = true +} + +module.exports = function (cb, opts) { + assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler') + + if (loaded === false) { + load() + } + + var ev = 'exit' + if (opts && opts.alwaysLast) { + ev = 'afterexit' + } + + var remove = function () { + emitter.removeListener(ev, cb) + if (emitter.listeners('exit').length === 0 && + emitter.listeners('afterexit').length === 0) { + unload() + } + } + emitter.on(ev, cb) + + return remove +} + +module.exports.unload = unload +function unload () { + if (!loaded) { + return + } + loaded = false + + signals.forEach(function (sig) { + try { + process.removeListener(sig, sigListeners[sig]) + } catch (er) {} + }) + process.emit = originalProcessEmit + process.reallyExit = originalProcessReallyExit + emitter.count -= 1 +} + +function emit (event, code, signal) { + if (emitter.emitted[event]) { + return + } + emitter.emitted[event] = true + emitter.emit(event, code, signal) +} + +// { : , ... } +var sigListeners = {} +signals.forEach(function (sig) { + sigListeners[sig] = function listener () { + // If there are no other listeners, an exit is coming! + // Simplest way: remove us and then re-send the signal. + // We know that this will kill the process, so we can + // safely emit now. + var listeners = process.listeners(sig) + if (listeners.length === emitter.count) { + unload() + emit('exit', null, sig) + /* istanbul ignore next */ + emit('afterexit', null, sig) + /* istanbul ignore next */ + process.kill(process.pid, sig) + } + } +}) + +module.exports.signals = function () { + return signals +} + +module.exports.load = load + +var loaded = false + +function load () { + if (loaded) { + return + } + loaded = true + + // This is the number of onSignalExit's that are in play. + // It's important so that we can count the correct number of + // listeners on signals, and don't wait for the other one to + // handle it instead of us. + emitter.count += 1 + + signals = signals.filter(function (sig) { + try { + process.on(sig, sigListeners[sig]) + return true + } catch (er) { + return false + } + }) + + process.emit = processEmit + process.reallyExit = processReallyExit +} + +var originalProcessReallyExit = process.reallyExit +function processReallyExit (code) { + process.exitCode = code || 0 + emit('exit', process.exitCode, null) + /* istanbul ignore next */ + emit('afterexit', process.exitCode, null) + /* istanbul ignore next */ + originalProcessReallyExit.call(process, process.exitCode) +} + +var originalProcessEmit = process.emit +function processEmit (ev, arg) { + if (ev === 'exit') { + if (arg !== undefined) { + process.exitCode = arg + } + var ret = originalProcessEmit.apply(this, arguments) + emit('exit', process.exitCode, null) + /* istanbul ignore next */ + emit('afterexit', process.exitCode, null) + return ret + } else { + return originalProcessEmit.apply(this, arguments) + } +} + + +/***/ }), +/* 260 */ +/***/ (function(module, exports, __webpack_require__) { + +module.exports = __webpack_require__(613); + +/***/ }), +/* 261 */ +/***/ (function(module, exports, __webpack_require__) { + +// Copyright 2017 Joyent, Inc. + +module.exports = { + DiffieHellman: DiffieHellman, + generateECDSA: generateECDSA, + generateED25519: generateED25519 +}; + +var assert = __webpack_require__(9); +var crypto = __webpack_require__(7); +var algs = __webpack_require__(17); +var utils = __webpack_require__(13); +var ed; +var nacl; + +var Key = __webpack_require__(18); +var PrivateKey = __webpack_require__(19); + +var CRYPTO_HAVE_ECDH = (crypto.createECDH !== undefined); + +var ecdh, ec, jsbn; + +function DiffieHellman(key) { + utils.assertCompatible(key, Key, [1, 4], 'key'); + this._isPriv = PrivateKey.isPrivateKey(key, [1, 3]); + this._algo = key.type; + this._curve = key.curve; + this._key = key; + if (key.type === 'dsa') { + if (!CRYPTO_HAVE_ECDH) { + throw (new Error('Due to bugs in the node 0.10 ' + + 'crypto API, node 0.12.x or later is required ' + + 'to use DH')); + } + this._dh = crypto.createDiffieHellman( + key.part.p.data, undefined, + key.part.g.data, undefined); + this._p = key.part.p; + this._g = key.part.g; + if (this._isPriv) + this._dh.setPrivateKey(key.part.x.data); + this._dh.setPublicKey(key.part.y.data); + + } else if (key.type === 'ecdsa') { + if (!CRYPTO_HAVE_ECDH) { + if (ecdh === undefined) + ecdh = __webpack_require__(228); + if (ec === undefined) + ec = __webpack_require__(93); + if (jsbn === undefined) + jsbn = __webpack_require__(39).BigInteger; + + this._ecParams = new X9ECParameters(this._curve); + + if (this._isPriv) { + this._priv = new ECPrivate( + this._ecParams, key.part.d.data); + } + return; + } + + var curve = { + 'nistp256': 'prime256v1', + 'nistp384': 'secp384r1', + 'nistp521': 'secp521r1' + }[key.curve]; + this._dh = crypto.createECDH(curve); + if (typeof (this._dh) !== 'object' || + typeof (this._dh.setPrivateKey) !== 'function') { + CRYPTO_HAVE_ECDH = false; + DiffieHellman.call(this, key); + return; + } + if (this._isPriv) + this._dh.setPrivateKey(key.part.d.data); + this._dh.setPublicKey(key.part.Q.data); + + } else if (key.type === 'curve25519') { + if (ed === undefined) + ed = __webpack_require__(150); + + if (this._isPriv) { + this._priv = key.part.r.data; + if (this._priv[0] === 0x00) + this._priv = this._priv.slice(1); + this._priv = this._priv.slice(0, 32); + } + + } else { + throw (new Error('DH not supported for ' + key.type + ' keys')); + } +} + +DiffieHellman.prototype.getPublicKey = function () { + if (this._isPriv) + return (this._key.toPublic()); + return (this._key); +}; + +DiffieHellman.prototype.getPrivateKey = function () { + if (this._isPriv) + return (this._key); + else + return (undefined); +}; +DiffieHellman.prototype.getKey = DiffieHellman.prototype.getPrivateKey; + +DiffieHellman.prototype._keyCheck = function (pk, isPub) { + assert.object(pk, 'key'); + if (!isPub) + utils.assertCompatible(pk, PrivateKey, [1, 3], 'key'); + utils.assertCompatible(pk, Key, [1, 4], 'key'); + + if (pk.type !== this._algo) { + throw (new Error('A ' + pk.type + ' key cannot be used in ' + + this._algo + ' Diffie-Hellman')); + } + + if (pk.curve !== this._curve) { + throw (new Error('A key from the ' + pk.curve + ' curve ' + + 'cannot be used with a ' + this._curve + + ' Diffie-Hellman')); + } + + if (pk.type === 'dsa') { + assert.deepEqual(pk.part.p, this._p, + 'DSA key prime does not match'); + assert.deepEqual(pk.part.g, this._g, + 'DSA key generator does not match'); + } +}; + +DiffieHellman.prototype.setKey = function (pk) { + this._keyCheck(pk); + + if (pk.type === 'dsa') { + this._dh.setPrivateKey(pk.part.x.data); + this._dh.setPublicKey(pk.part.y.data); + + } else if (pk.type === 'ecdsa') { + if (CRYPTO_HAVE_ECDH) { + this._dh.setPrivateKey(pk.part.d.data); + this._dh.setPublicKey(pk.part.Q.data); + } else { + this._priv = new ECPrivate( + this._ecParams, pk.part.d.data); + } + + } else if (pk.type === 'curve25519') { + this._priv = pk.part.r.data; + if (this._priv[0] === 0x00) + this._priv = this._priv.slice(1); + this._priv = this._priv.slice(0, 32); + } + this._key = pk; + this._isPriv = true; +}; +DiffieHellman.prototype.setPrivateKey = DiffieHellman.prototype.setKey; + +DiffieHellman.prototype.computeSecret = function (otherpk) { + this._keyCheck(otherpk, true); + if (!this._isPriv) + throw (new Error('DH exchange has not been initialized with ' + + 'a private key yet')); + + var pub; + if (this._algo === 'dsa') { + return (this._dh.computeSecret( + otherpk.part.y.data)); + + } else if (this._algo === 'ecdsa') { + if (CRYPTO_HAVE_ECDH) { + return (this._dh.computeSecret( + otherpk.part.Q.data)); + } else { + pub = new ECPublic( + this._ecParams, otherpk.part.Q.data); + return (this._priv.deriveSharedSecret(pub)); + } + + } else if (this._algo === 'curve25519') { + pub = otherpk.part.R.data; + if (pub[0] === 0x00) + pub = pub.slice(1); - /** Provides a virtual time scheduler that uses Date for absolute time and number for relative time. */ - Rx.HistoricalScheduler = (function (__super__) { - inherits(HistoricalScheduler, __super__); + var secret = ed.dh.computeKey( + this._priv.toString('binary'), + pub.toString('binary')); - /** - * Creates a new historical scheduler with the specified initial clock value. - * @constructor - * @param {Number} initialClock Initial value for the clock. - * @param {Function} comparer Comparer to determine causality of events based on absolute time. - */ - function HistoricalScheduler(initialClock, comparer) { - var clock = initialClock == null ? 0 : initialClock; - var cmp = comparer || defaultSubComparer; - __super__.call(this, clock, cmp); - } + return (new Buffer(secret, 'binary')); + } - var HistoricalSchedulerProto = HistoricalScheduler.prototype; + throw (new Error('Invalid algorithm: ' + this._algo)); +}; - /** - * Adds a relative time value to an absolute time value. - * @param {Number} absolute Absolute virtual time value. - * @param {Number} relative Relative virtual time value to add. - * @return {Number} Resulting absolute virtual time sum value. - */ - HistoricalSchedulerProto.add = function (absolute, relative) { - return absolute + relative; - }; +DiffieHellman.prototype.generateKey = function () { + var parts = []; + var priv, pub; + if (this._algo === 'dsa') { + this._dh.generateKeys(); - HistoricalSchedulerProto.toAbsoluteTime = function (absolute) { - return new Date(absolute).getTime(); - }; + parts.push({name: 'p', data: this._p.data}); + parts.push({name: 'q', data: this._key.part.q.data}); + parts.push({name: 'g', data: this._g.data}); + parts.push({name: 'y', data: this._dh.getPublicKey()}); + parts.push({name: 'x', data: this._dh.getPrivateKey()}); + this._key = new PrivateKey({ + type: 'dsa', + parts: parts + }); + this._isPriv = true; + return (this._key); - /** - * Converts the TimeSpan value to a relative virtual time value. - * @memberOf HistoricalScheduler - * @param {Number} timeSpan TimeSpan value to convert. - * @return {Number} Corresponding relative virtual time value. - */ - HistoricalSchedulerProto.toRelativeTime = function (timeSpan) { - return timeSpan; - }; + } else if (this._algo === 'ecdsa') { + if (CRYPTO_HAVE_ECDH) { + this._dh.generateKeys(); - return HistoricalScheduler; - }(Rx.VirtualTimeScheduler)); + parts.push({name: 'curve', + data: new Buffer(this._curve)}); + parts.push({name: 'Q', data: this._dh.getPublicKey()}); + parts.push({name: 'd', data: this._dh.getPrivateKey()}); + this._key = new PrivateKey({ + type: 'ecdsa', + curve: this._curve, + parts: parts + }); + this._isPriv = true; + return (this._key); - return Rx; -})); + } else { + var n = this._ecParams.getN(); + var r = new jsbn(crypto.randomBytes(n.bitLength())); + var n1 = n.subtract(jsbn.ONE); + priv = r.mod(n1).add(jsbn.ONE); + pub = this._ecParams.getG().multiply(priv); -/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) + priv = new Buffer(priv.toByteArray()); + pub = new Buffer(this._ecParams.getCurve(). + encodePointHex(pub), 'hex'); -/***/ }), -/* 254 */ -/***/ (function(module, exports, __webpack_require__) { + this._priv = new ECPrivate(this._ecParams, priv); -// Note: since nyc uses this module to output coverage, any lines -// that are in the direct sync flow of nyc's outputCoverage are -// ignored, since we can never get coverage for them. -var assert = __webpack_require__(22) -var signals = __webpack_require__(604) + parts.push({name: 'curve', + data: new Buffer(this._curve)}); + parts.push({name: 'Q', data: pub}); + parts.push({name: 'd', data: priv}); -var EE = __webpack_require__(34) -/* istanbul ignore if */ -if (typeof EE !== 'function') { - EE = EE.EventEmitter -} + this._key = new PrivateKey({ + type: 'ecdsa', + curve: this._curve, + parts: parts + }); + this._isPriv = true; + return (this._key); + } -var emitter -if (process.__signal_exit_emitter__) { - emitter = process.__signal_exit_emitter__ -} else { - emitter = process.__signal_exit_emitter__ = new EE() - emitter.count = 0 - emitter.emitted = {} -} + } else if (this._algo === 'curve25519') { + priv = ed.dh.generateKey(); + pub = ed.dh.publicKey(priv); + this._priv = priv = new Buffer(priv, 'binary'); + pub = new Buffer(pub, 'binary'); -// Because this emitter is a global, we have to check to see if a -// previous version of this library failed to enable infinite listeners. -// I know what you're about to say. But literally everything about -// signal-exit is a compromise with evil. Get used to it. -if (!emitter.infinite) { - emitter.setMaxListeners(Infinity) - emitter.infinite = true -} + parts.push({name: 'R', data: pub}); + parts.push({name: 'r', data: Buffer.concat([priv, pub])}); + this._key = new PrivateKey({ + type: 'curve25519', + parts: parts + }); + this._isPriv = true; + return (this._key); + } -module.exports = function (cb, opts) { - assert.equal(typeof cb, 'function', 'a callback must be provided for exit handler') + throw (new Error('Invalid algorithm: ' + this._algo)); +}; +DiffieHellman.prototype.generateKeys = DiffieHellman.prototype.generateKey; - if (loaded === false) { - load() - } +/* These are helpers for using ecc-jsbn (for node 0.10 compatibility). */ - var ev = 'exit' - if (opts && opts.alwaysLast) { - ev = 'afterexit' - } +function X9ECParameters(name) { + var params = algs.curves[name]; + assert.object(params); - var remove = function () { - emitter.removeListener(ev, cb) - if (emitter.listeners('exit').length === 0 && - emitter.listeners('afterexit').length === 0) { - unload() - } - } - emitter.on(ev, cb) + var p = new jsbn(params.p); + var a = new jsbn(params.a); + var b = new jsbn(params.b); + var n = new jsbn(params.n); + var h = jsbn.ONE; + var curve = new ec.ECCurveFp(p, a, b); + var G = curve.decodePointHex(params.G.toString('hex')); - return remove + this.curve = curve; + this.g = G; + this.n = n; + this.h = h; } +X9ECParameters.prototype.getCurve = function () { return (this.curve); }; +X9ECParameters.prototype.getG = function () { return (this.g); }; +X9ECParameters.prototype.getN = function () { return (this.n); }; +X9ECParameters.prototype.getH = function () { return (this.h); }; -module.exports.unload = unload -function unload () { - if (!loaded) { - return - } - loaded = false - - signals.forEach(function (sig) { - try { - process.removeListener(sig, sigListeners[sig]) - } catch (er) {} - }) - process.emit = originalProcessEmit - process.reallyExit = originalProcessReallyExit - emitter.count -= 1 +function ECPublic(params, buffer) { + this._params = params; + if (buffer[0] === 0x00) + buffer = buffer.slice(1); + this._pub = params.getCurve().decodePointHex(buffer.toString('hex')); } -function emit (event, code, signal) { - if (emitter.emitted[event]) { - return - } - emitter.emitted[event] = true - emitter.emit(event, code, signal) +function ECPrivate(params, buffer) { + this._params = params; + this._priv = new jsbn(utils.mpNormalize(buffer)); } +ECPrivate.prototype.deriveSharedSecret = function (pubKey) { + assert.ok(pubKey instanceof ECPublic); + var S = pubKey._pub.multiply(this._priv); + return (new Buffer(S.getX().toBigInteger().toByteArray())); +}; -// { : , ... } -var sigListeners = {} -signals.forEach(function (sig) { - sigListeners[sig] = function listener () { - // If there are no other listeners, an exit is coming! - // Simplest way: remove us and then re-send the signal. - // We know that this will kill the process, so we can - // safely emit now. - var listeners = process.listeners(sig) - if (listeners.length === emitter.count) { - unload() - emit('exit', null, sig) - /* istanbul ignore next */ - emit('afterexit', null, sig) - /* istanbul ignore next */ - process.kill(process.pid, sig) - } - } -}) +function generateED25519() { + if (nacl === undefined) + nacl = __webpack_require__(110); -module.exports.signals = function () { - return signals + var pair = nacl.sign.keyPair(); + var priv = new Buffer(pair.secretKey); + var pub = new Buffer(pair.publicKey); + assert.strictEqual(priv.length, 64); + assert.strictEqual(pub.length, 32); + + var parts = []; + parts.push({name: 'R', data: pub}); + parts.push({name: 'r', data: priv}); + var key = new PrivateKey({ + type: 'ed25519', + parts: parts + }); + return (key); } -module.exports.load = load +/* Generates a new ECDSA private key on a given curve. */ +function generateECDSA(curve) { + var parts = []; + var key; -var loaded = false + if (CRYPTO_HAVE_ECDH) { + /* + * Node crypto doesn't expose key generation directly, but the + * ECDH instances can generate keys. It turns out this just + * calls into the OpenSSL generic key generator, and we can + * read its output happily without doing an actual DH. So we + * use that here. + */ + var osCurve = { + 'nistp256': 'prime256v1', + 'nistp384': 'secp384r1', + 'nistp521': 'secp521r1' + }[curve]; -function load () { - if (loaded) { - return - } - loaded = true + var dh = crypto.createECDH(osCurve); + dh.generateKeys(); - // This is the number of onSignalExit's that are in play. - // It's important so that we can count the correct number of - // listeners on signals, and don't wait for the other one to - // handle it instead of us. - emitter.count += 1 + parts.push({name: 'curve', + data: new Buffer(curve)}); + parts.push({name: 'Q', data: dh.getPublicKey()}); + parts.push({name: 'd', data: dh.getPrivateKey()}); - signals = signals.filter(function (sig) { - try { - process.on(sig, sigListeners[sig]) - return true - } catch (er) { - return false - } - }) + key = new PrivateKey({ + type: 'ecdsa', + curve: curve, + parts: parts + }); + return (key); - process.emit = processEmit - process.reallyExit = processReallyExit -} + } else { + if (ecdh === undefined) + ecdh = __webpack_require__(228); + if (ec === undefined) + ec = __webpack_require__(93); + if (jsbn === undefined) + jsbn = __webpack_require__(39).BigInteger; -var originalProcessReallyExit = process.reallyExit -function processReallyExit (code) { - process.exitCode = code || 0 - emit('exit', process.exitCode, null) - /* istanbul ignore next */ - emit('afterexit', process.exitCode, null) - /* istanbul ignore next */ - originalProcessReallyExit.call(process, process.exitCode) -} + var ecParams = new X9ECParameters(curve); -var originalProcessEmit = process.emit -function processEmit (ev, arg) { - if (ev === 'exit') { - if (arg !== undefined) { - process.exitCode = arg - } - var ret = originalProcessEmit.apply(this, arguments) - emit('exit', process.exitCode, null) - /* istanbul ignore next */ - emit('afterexit', process.exitCode, null) - return ret - } else { - return originalProcessEmit.apply(this, arguments) - } -} + /* This algorithm taken from FIPS PUB 186-4 (section B.4.1) */ + var n = ecParams.getN(); + /* + * The crypto.randomBytes() function can only give us whole + * bytes, so taking a nod from X9.62, we round up. + */ + var cByteLen = Math.ceil((n.bitLength() + 64) / 8); + var c = new jsbn(crypto.randomBytes(cByteLen)); + var n1 = n.subtract(jsbn.ONE); + var priv = c.mod(n1).add(jsbn.ONE); + var pub = ecParams.getG().multiply(priv); -/***/ }), -/* 255 */ -/***/ (function(module, exports, __webpack_require__) { + priv = new Buffer(priv.toByteArray()); + pub = new Buffer(ecParams.getCurve(). + encodePointHex(pub), 'hex'); + + parts.push({name: 'curve', data: new Buffer(curve)}); + parts.push({name: 'Q', data: pub}); + parts.push({name: 'd', data: priv}); + + key = new PrivateKey({ + type: 'ecdsa', + curve: curve, + parts: parts + }); + return (key); + } +} -module.exports = __webpack_require__(605); /***/ }), -/* 256 */ +/* 262 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. @@ -63331,7 +64690,7 @@ var Signature = __webpack_require__(33); function Verifier(key, hashAlgo) { if (nacl === undefined) - nacl = __webpack_require__(163); + nacl = __webpack_require__(110); if (hashAlgo.toLowerCase() !== 'sha512') throw (new Error('ED25519 only supports the use of ' + @@ -63379,7 +64738,7 @@ Verifier.prototype.verify = function (signature, fmt) { function Signer(key, hashAlgo) { if (nacl === undefined) - nacl = __webpack_require__(163); + nacl = __webpack_require__(110); if (hashAlgo.toLowerCase() !== 'sha512') throw (new Error('ED25519 only supports the use of ' + @@ -63415,7 +64774,7 @@ Signer.prototype.sign = function () { /***/ }), -/* 257 */ +/* 263 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. @@ -63431,8 +64790,8 @@ var Key = __webpack_require__(18); var PrivateKey = __webpack_require__(19); var pem = __webpack_require__(40); -var ssh = __webpack_require__(258); -var rfc4253 = __webpack_require__(47); +var ssh = __webpack_require__(264); +var rfc4253 = __webpack_require__(48); function read(buf, options) { if (typeof (buf) === 'string') { @@ -63494,7 +64853,7 @@ function write(key, options) { /***/ }), -/* 258 */ +/* 264 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. @@ -63505,12 +64864,12 @@ module.exports = { }; var assert = __webpack_require__(9); -var rfc4253 = __webpack_require__(47); +var rfc4253 = __webpack_require__(48); var utils = __webpack_require__(13); var Key = __webpack_require__(18); var PrivateKey = __webpack_require__(19); -var sshpriv = __webpack_require__(101); +var sshpriv = __webpack_require__(107); /*JSSTYLED*/ var SSHKEY_RE = /^([a-z0-9-]+)[ \t]+([a-zA-Z0-9+\/]+[=]*)([\n \t]+([^\n]+))?$/; @@ -63614,29 +64973,30 @@ function write(key, options) { /***/ }), -/* 259 */ +/* 265 */ /***/ (function(module, exports, __webpack_require__) { -// Copyright 2016 Joyent, Inc. +// Copyright 2017 Joyent, Inc. module.exports = { read: read, verify: verify, sign: sign, + signAsync: signAsync, write: write }; var assert = __webpack_require__(9); -var asn1 = __webpack_require__(35); +var asn1 = __webpack_require__(34); var algs = __webpack_require__(17); var utils = __webpack_require__(13); var Key = __webpack_require__(18); var PrivateKey = __webpack_require__(19); var pem = __webpack_require__(40); -var Identity = __webpack_require__(72); +var Identity = __webpack_require__(75); var Signature = __webpack_require__(33); -var Certificate = __webpack_require__(69); -var pkcs8 = __webpack_require__(71); +var Certificate = __webpack_require__(72); +var pkcs8 = __webpack_require__(74); /* * This file is based on RFC5280 (X.509). @@ -63698,7 +65058,10 @@ SIGN_ALGS['1.3.14.3.2.29'] = 'rsa-sha1'; var EXTS = { 'issuerKeyId': '2.5.29.35', - 'altName': '2.5.29.17' + 'altName': '2.5.29.17', + 'basicConstraints': '2.5.29.19', + 'keyUsage': '2.5.29.15', + 'extKeyUsage': '2.5.29.37' }; function read(buf, options) { @@ -63829,6 +65192,26 @@ var ALTNAME = { OID: Context(8) }; +/* RFC5280, section 4.2.1.12 (KeyPurposeId) */ +var EXTPURPOSE = { + 'serverAuth': '1.3.6.1.5.5.7.3.1', + 'clientAuth': '1.3.6.1.5.5.7.3.2', + 'codeSigning': '1.3.6.1.5.5.7.3.3', + + /* See https://github.com/joyent/oid-docs/blob/master/root.md */ + 'joyentDocker': '1.3.6.1.4.1.38678.1.4.1', + 'joyentCmon': '1.3.6.1.4.1.38678.1.4.2' +}; +var EXTPURPOSE_REV = {}; +Object.keys(EXTPURPOSE).forEach(function (k) { + EXTPURPOSE_REV[EXTPURPOSE[k]] = k; +}); + +var KEYUSEBITS = [ + 'signature', 'identity', 'keyEncryption', + 'encryption', 'keyAgreement', 'ca', 'crl' +]; + function readExtension(cert, buf, der) { der.readSequence(); var after = der.offset + der.length; @@ -63842,6 +65225,81 @@ function readExtension(cert, buf, der) { critical = der.readBoolean(); switch (extId) { + case (EXTS.basicConstraints): + der.readSequence(asn1.Ber.OctetString); + der.readSequence(); + var bcEnd = der.offset + der.length; + var ca = false; + if (der.peek() === asn1.Ber.Boolean) + ca = der.readBoolean(); + if (cert.purposes === undefined) + cert.purposes = []; + if (ca === true) + cert.purposes.push('ca'); + var bc = { oid: extId, critical: critical }; + if (der.offset < bcEnd && der.peek() === asn1.Ber.Integer) + bc.pathLen = der.readInt(); + sig.extras.exts.push(bc); + break; + case (EXTS.extKeyUsage): + der.readSequence(asn1.Ber.OctetString); + der.readSequence(); + if (cert.purposes === undefined) + cert.purposes = []; + var ekEnd = der.offset + der.length; + while (der.offset < ekEnd) { + var oid = der.readOID(); + cert.purposes.push(EXTPURPOSE_REV[oid] || oid); + } + /* + * This is a bit of a hack: in the case where we have a cert + * that's only allowed to do serverAuth or clientAuth (and not + * the other), we want to make sure all our Subjects are of + * the right type. But we already parsed our Subjects and + * decided if they were hosts or users earlier (since it appears + * first in the cert). + * + * So we go through and mutate them into the right kind here if + * it doesn't match. This might not be hugely beneficial, as it + * seems that single-purpose certs are not often seen in the + * wild. + */ + if (cert.purposes.indexOf('serverAuth') !== -1 && + cert.purposes.indexOf('clientAuth') === -1) { + cert.subjects.forEach(function (ide) { + if (ide.type !== 'host') { + ide.type = 'host'; + ide.hostname = ide.uid || + ide.email || + ide.components[0].value; + } + }); + } else if (cert.purposes.indexOf('clientAuth') !== -1 && + cert.purposes.indexOf('serverAuth') === -1) { + cert.subjects.forEach(function (ide) { + if (ide.type !== 'user') { + ide.type = 'user'; + ide.uid = ide.hostname || + ide.email || + ide.components[0].value; + } + }); + } + sig.extras.exts.push({ oid: extId, critical: critical }); + break; + case (EXTS.keyUsage): + der.readSequence(asn1.Ber.OctetString); + var bits = der.readString(asn1.Ber.BitString, true); + var setBits = readBitField(bits, KEYUSEBITS); + setBits.forEach(function (bit) { + if (cert.purposes === undefined) + cert.purposes = []; + if (cert.purposes.indexOf(bit) === -1) + cert.purposes.push(bit); + }); + sig.extras.exts.push({ oid: extId, critical: critical, + bits: bits }); + break; case (EXTS.altName): der.readSequence(asn1.Ber.OctetString); der.readSequence(); @@ -63972,6 +65430,32 @@ function sign(cert, key) { return (true); } +function signAsync(cert, signer, done) { + if (cert.signatures.x509 === undefined) + cert.signatures.x509 = {}; + var sig = cert.signatures.x509; + + var der = new asn1.BerWriter(); + writeTBSCert(cert, der); + var blob = der.buffer; + sig.cache = blob; + + signer(blob, function (err, signature) { + if (err) { + done(err); + return; + } + sig.algo = signature.type + '-' + signature.hashAlgorithm; + if (SIGN_ALGS[sig.algo] === undefined) { + done(new Error('Invalid signing algorithm "' + + sig.algo + '"')); + return; + } + sig.signature = signature; + done(); + }); +} + function write(cert, options) { var sig = cert.signatures.x509; assert.object(sig, 'x509 signature'); @@ -64040,13 +65524,27 @@ function writeTBSCert(cert, der) { } if (altNames.length > 0 || subject.type === 'host' || + (cert.purposes !== undefined && cert.purposes.length > 0) || (sig.extras && sig.extras.exts)) { der.startSequence(Local(3)); der.startSequence(); - var exts = [ - { oid: EXTS.altName } - ]; + var exts = []; + if (cert.purposes !== undefined && cert.purposes.length > 0) { + exts.push({ + oid: EXTS.basicConstraints, + critical: true + }); + exts.push({ + oid: EXTS.keyUsage, + critical: true + }); + exts.push({ + oid: EXTS.extKeyUsage, + critical: true + }); + } + exts.push({ oid: EXTS.altName }); if (sig.extras && sig.extras.exts) exts = sig.extras.exts; @@ -64087,6 +65585,54 @@ function writeTBSCert(cert, der) { } der.endSequence(); der.endSequence(); + } else if (exts[i].oid === EXTS.basicConstraints) { + der.startSequence(asn1.Ber.OctetString); + der.startSequence(); + var ca = (cert.purposes.indexOf('ca') !== -1); + var pathLen = exts[i].pathLen; + der.writeBoolean(ca); + if (pathLen !== undefined) + der.writeInt(pathLen); + der.endSequence(); + der.endSequence(); + } else if (exts[i].oid === EXTS.extKeyUsage) { + der.startSequence(asn1.Ber.OctetString); + der.startSequence(); + cert.purposes.forEach(function (purpose) { + if (purpose === 'ca') + return; + if (KEYUSEBITS.indexOf(purpose) !== -1) + return; + var oid = purpose; + if (EXTPURPOSE[purpose] !== undefined) + oid = EXTPURPOSE[purpose]; + der.writeOID(oid); + }); + der.endSequence(); + der.endSequence(); + } else if (exts[i].oid === EXTS.keyUsage) { + der.startSequence(asn1.Ber.OctetString); + /* + * If we parsed this certificate from a byte + * stream (i.e. we didn't generate it in sshpk) + * then we'll have a ".bits" property on the + * ext with the original raw byte contents. + * + * If we have this, use it here instead of + * regenerating it. This guarantees we output + * the same data we parsed, so signatures still + * validate. + */ + if (exts[i].bits !== undefined) { + der.writeBuffer(exts[i].bits, + asn1.Ber.BitString); + } else { + var bits = writeBitField(cert.purposes, + KEYUSEBITS); + der.writeBuffer(bits, + asn1.Ber.BitString); + } + der.endSequence(); } else { der.writeBuffer(exts[i].data, asn1.Ber.OctetString); @@ -64102,236 +65648,64 @@ function writeTBSCert(cert, der) { der.endSequence(); } - -/***/ }), -/* 260 */ -/***/ (function(module, exports, __webpack_require__) { - -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var Buffer = __webpack_require__(55).Buffer; - -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } - - -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; -}; - - -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } - - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; -}; - -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; - -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; +/* + * Reads an ASN.1 BER bitfield out of the Buffer produced by doing + * `BerReader#readString(asn1.Ber.BitString)`. That function gives us the raw + * contents of the BitString tag, which is a count of unused bits followed by + * the bits as a right-padded byte string. + * + * `bits` is the Buffer, `bitIndex` should contain an array of string names + * for the bits in the string, ordered starting with bit #0 in the ASN.1 spec. + * + * Returns an array of Strings, the names of the bits that were set to 1. + */ +function readBitField(bits, bitIndex) { + var bitLen = 8 * (bits.length - 1) - bits[0]; + var setBits = {}; + for (var i = 0; i < bitLen; ++i) { + var byteN = 1 + Math.floor(i / 8); + var bit = 7 - (i % 8); + var mask = 1 << bit; + var bitVal = ((bits[byteN] & mask) !== 0); + var name = bitIndex[i]; + if (bitVal && typeof (name) === 'string') { + setBits[name] = true; + } + } + return (Object.keys(setBits)); } -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; +/* + * `setBits` is an array of strings, containing the names for each bit that + * sould be set to 1. `bitIndex` is same as in `readBitField()`. + * + * Returns a Buffer, ready to be written out with `BerWriter#writeString()`. + */ +function writeBitField(setBits, bitIndex) { + var bitLen = bitIndex.length; + var blen = Math.ceil(bitLen / 8); + var unused = blen * 8 - bitLen; + var bits = new Buffer(1 + blen); + bits.fill(0); + bits[0] = unused; + for (var i = 0; i < bitLen; ++i) { + var byteN = 1 + Math.floor(i / 8); + var bit = 7 - (i % 8); + var mask = 1 << bit; + var name = bitIndex[i]; + if (name === undefined) + continue; + var bitVal = (setBits.indexOf(name) !== -1); + if (bitVal) { + bits[byteN] |= mask; + } + } + return (bits); } /***/ }), -/* 261 */ +/* 266 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64352,10 +65726,11 @@ module.exports = x => { /***/ }), -/* 262 */ +/* 267 */ /***/ (function(module, exports) { var ZEROS = '0000000000000000000' +var SEVENS = '7777777777777777777' var ZERO_OFFSET = '0'.charCodeAt(0) var USTAR = 'ustar\x0000' var MASK = parseInt('7777', 8) @@ -64449,7 +65824,8 @@ var cksum = function (block) { var encodeOct = function (val, n) { val = val.toString(8) - return ZEROS.slice(0, n - val.length) + val + ' ' + if (val.length > n) return SEVENS.slice(0, n) + ' ' + else return ZEROS.slice(0, n - val.length) + val + ' ' } /* Copied from the node-tar repo and modified to meet @@ -64487,10 +65863,13 @@ function parse256 (buf) { return positive ? sum : -1 * sum } -var decodeOct = function (val, offset) { +var decodeOct = function (val, offset, length) { + val = val.slice(offset, offset + length) + offset = 0 + // If prefixed with 0x80 then parse as a base-256 integer if (val[offset] & 0x80) { - return parse256(val.slice(offset, offset + 8)) + return parse256(val) } else { // Older versions of tar can prefix with spaces while (offset < val.length && val[offset] === 32) offset++ @@ -64596,17 +65975,17 @@ exports.decode = function (buf) { var typeflag = buf[156] === 0 ? 0 : buf[156] - ZERO_OFFSET var name = decodeStr(buf, 0, 100) - var mode = decodeOct(buf, 100) - var uid = decodeOct(buf, 108) - var gid = decodeOct(buf, 116) - var size = decodeOct(buf, 124) - var mtime = decodeOct(buf, 136) + var mode = decodeOct(buf, 100, 8) + var uid = decodeOct(buf, 108, 8) + var gid = decodeOct(buf, 116, 8) + var size = decodeOct(buf, 124, 12) + var mtime = decodeOct(buf, 136, 12) var type = toType(typeflag) var linkname = buf[157] === 0 ? null : decodeStr(buf, 157, 100) var uname = decodeStr(buf, 265, 32) var gname = decodeStr(buf, 297, 32) - var devmajor = decodeOct(buf, 329) - var devminor = decodeOct(buf, 337) + var devmajor = decodeOct(buf, 329, 8) + var devminor = decodeOct(buf, 337, 8) if (buf[345]) name = decodeStr(buf, 345, 155) + '/' + name @@ -64619,7 +65998,7 @@ exports.decode = function (buf) { if (c === 8 * 32) return null // valid checksum - if (c !== decodeOct(buf, 148)) throw new Error('Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?') + if (c !== decodeOct(buf, 148, 8)) throw new Error('Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?') return { name: name, @@ -64639,20 +66018,20 @@ exports.decode = function (buf) { /***/ }), -/* 263 */ +/* 268 */ /***/ (function(module, exports, __webpack_require__) { -exports.extract = __webpack_require__(616) -exports.pack = __webpack_require__(617) +exports.extract = __webpack_require__(623) +exports.pack = __webpack_require__(624) /***/ }), -/* 264 */ +/* 269 */ /***/ (function(module, exports, __webpack_require__) { -var Transform = __webpack_require__(575) +var Transform = __webpack_require__(582) , inherits = __webpack_require__(2).inherits - , xtend = __webpack_require__(271) + , xtend = __webpack_require__(276) function DestroyableTransform(opts) { Transform.call(this, opts) @@ -64749,7 +66128,7 @@ module.exports.obj = through2(function (options, transform, flush) { /***/ }), -/* 265 */ +/* 270 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64817,7 +66196,7 @@ exports.pathMatch = pathMatch; /***/ }), -/* 266 */ +/* 271 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64852,7 +66231,7 @@ exports.pathMatch = pathMatch; * POSSIBILITY OF SUCH DAMAGE. */ -var pubsuffix = __webpack_require__(267); +var pubsuffix = __webpack_require__(272); // Gives the permutation of all possible domainMatch()es of a given domain. The // array is in shortest-to-longest order. Handy for indexing. @@ -64880,7 +66259,7 @@ exports.permuteDomain = permuteDomain; /***/ }), -/* 267 */ +/* 272 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -64891,7 +66270,7 @@ exports.permuteDomain = permuteDomain; -var punycode = __webpack_require__(274); +var punycode = __webpack_require__(279); module.exports.getPublicSuffix = function getPublicSuffix(domain) { /*! @@ -64985,7 +66364,7 @@ var index = module.exports.index = Object.freeze( /***/ }), -/* 268 */ +/* 273 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -65063,7 +66442,7 @@ Store.prototype.getAllCookies = function(cb) { /***/ }), -/* 269 */ +/* 274 */ /***/ (function(module, exports) { /** @@ -65092,13 +66471,13 @@ module.exports = bytesToUuid; /***/ }), -/* 270 */ +/* 275 */ /***/ (function(module, exports, __webpack_require__) { // Unique ID creation requires a high quality random # generator. In node.js // this is prett straight-forward - we use the crypto API. -var rb = __webpack_require__(6).randomBytes; +var rb = __webpack_require__(7).randomBytes; function rng() { return rb(16); @@ -65108,7 +66487,7 @@ module.exports = rng; /***/ }), -/* 271 */ +/* 276 */ /***/ (function(module, exports) { module.exports = extend @@ -65133,13 +66512,13 @@ function extend() { /***/ }), -/* 272 */ +/* 277 */ /***/ (function(module, exports) { module.exports = { "name": "yarn", "installationMethod": "unknown", - "version": "0.25.3", + "version": "0.26.1", "license": "BSD-2-Clause", "preferGlobal": true, "description": "📦🐈 Fast, reliable, and secure dependency management.", @@ -65191,13 +66570,11 @@ module.exports = { "babel-preset-node5": "^10.2.0", "babel-preset-stage-0": "^6.0.0", "babylon": "^6.5.0", - "eslint": "^3.3.1", - "eslint-config-fb-strict": "^14.1.3", - "eslint-config-fbjs": "^1.0.0", + "eslint": "^3.19.0", + "eslint-config-fb-strict": "^20.0.1", "eslint-plugin-babel": "^3.3.0", - "eslint-plugin-flowtype": "^2.15.0", - "eslint-plugin-no-async-without-await": "^1.0.0", - "eslint-plugin-react": "5.2.2", + "eslint-plugin-flowtype": "^2.32.1", + "eslint-plugin-react": "^6.7.1", "eslint-plugin-yarn-internal": "file:scripts/eslint-rules", "flow-bin": "^0.43.0", "gulp": "^3.9.0", @@ -65210,6 +66587,7 @@ module.exports = { "gulp-watch": "^4.3.5", "jest": "^19.0.2", "mock-stdin": "^0.3.0", + "prettier": "^1.3.1", "temp": "^0.8.3", "webpack": "^2.1.0-beta.25", "yargs": "^6.3.0" @@ -65223,19 +66601,21 @@ module.exports = { "yarnpkg": "./bin/yarn.js" }, "scripts": { - "test": "yarn lint && yarn test-only", - "test-ci": "yarn build && yarn test-only", - "check-lockfile": "./scripts/check-lockfile.sh", "build": "gulp build", - "watch": "gulp watch", - "test-only": "jest --coverage --verbose", - "lint": "eslint . && flow check", - "release-branch": "./scripts/release-branch.sh", "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-chocolatey": "powershell ./scripts/build-chocolatey.ps1", - "build-win-installer": "scripts\\build-windows-installer.bat" + "build-win-installer": "scripts\\build-windows-installer.bat", + "check-lockfile": "./scripts/check-lockfile.sh", + "lint": "yarn run lint-prettier && eslint . && flow check", + "lint-prettier": "node scripts/prettier.js lint", + "prettier": "node scripts/prettier.js write", + "release-branch": "./scripts/release-branch.sh", + "test": "yarn lint && yarn test-only", + "test-ci": "yarn build && yarn test-only", + "test-only": "jest --coverage --verbose", + "watch": "gulp watch" }, "jest": { "collectCoverageFrom": [ @@ -65255,25 +66635,25 @@ module.exports = { }; /***/ }), -/* 273 */ +/* 278 */ /***/ (function(module, exports) { module.exports = require("constants"); /***/ }), -/* 274 */ +/* 279 */ /***/ (function(module, exports) { module.exports = require("punycode"); /***/ }), -/* 275 */ +/* 280 */ /***/ (function(module, exports) { module.exports = require("tls"); /***/ }), -/* 276 */ +/* 281 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -65282,7 +66662,7 @@ module.exports = require("tls"); var _index; function _load_index() { - return _index = __webpack_require__(79); + return _index = __webpack_require__(82); } var _index2; @@ -65324,27 +66704,27 @@ function _load_config() { var _rc; function _load_rc() { - return _rc = __webpack_require__(354); + return _rc = __webpack_require__(361); } var _yarnVersion; function _load_yarnVersion() { - return _yarnVersion = __webpack_require__(62); + return _yarnVersion = __webpack_require__(65); } 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 commander = __webpack_require__(401); +const commander = __webpack_require__(410); -const fs = __webpack_require__(5); -const invariant = __webpack_require__(7); -const lockfile = __webpack_require__(565); -const loudRejection = __webpack_require__(545); -const net = __webpack_require__(74); -const onDeath = __webpack_require__(441); +const fs = __webpack_require__(6); +const invariant = __webpack_require__(5); +const lockfile = __webpack_require__(572); +const loudRejection = __webpack_require__(552); +const net = __webpack_require__(77); +const onDeath = __webpack_require__(450); const path = __webpack_require__(1); loudRejection(); @@ -65383,7 +66763,7 @@ commander.option('--global-folder ', 'specify a custom folder to store glo commander.option('--modules-folder ', 'rather than installing modules into the node_modules folder relative to the cwd, output them here'); commander.option('--cache-folder ', 'specify a custom folder to store the yarn cache'); commander.option('--mutex [:specifier]', 'use a mutex to ensure only one yarn instance is executing'); -commander.option('--no-emoji', 'disable emoji in output'); +commander.option('--emoji', 'enable emoji in output', process.platform === 'darwin'); commander.option('-s, --silent', 'skip Yarn console logs, other types of logs (script output) will be printed'); commander.option('--proxy ', ''); commander.option('--https-proxy ', ''); @@ -65436,10 +66816,10 @@ commander.args.shift(); // const Reporter = commander.json ? (_index || _load_index()).JSONReporter : (_index || _load_index()).ConsoleReporter; const reporter = new Reporter({ - emoji: commander.emoji && process.stdout.isTTY && process.platform === 'darwin', + emoji: process.stdout.isTTY && commander.emoji, verbose: commander.verbose, noProgress: !commander.progress, - isSilent: commander.silent + isSilent: process.env.YARN_SILENT === '1' || commander.silent }); reporter.initPeakMemoryCounter(); @@ -65476,11 +66856,12 @@ if (command.requireLockfile && !fs.existsSync(path.join(config.cwd, (_constants // const run = () => { invariant(command, 'missing command'); - return command.run(config, reporter, commander, commander.args).then(() => { + return command.run(config, reporter, commander, commander.args).then(exitCode => { reporter.close(); if (outputWrapper) { reporter.footer(false); } + return exitCode; }); }; @@ -65617,6 +66998,7 @@ config.init({ httpProxy: commander.proxy, httpsProxy: commander.httpsProxy, networkConcurrency: commander.networkConcurrency, + networkTimeout: commander.networkTimeout, nonInteractive: commander.nonInteractive, commandName: commandName === 'run' ? commander.args[0] : commandName }).then(() => { @@ -65627,8 +67009,8 @@ config.init({ reporter.disableProgress(); } - const exit = () => { - process.exit(0); + const exit = exitCode => { + process.exit(exitCode || 0); }; // verbose logs outputs process.uptime() with this line we can sync uptime to absolute time on the computer reporter.verbose(`current time: ${new Date().toISOString()}`); @@ -65666,29 +67048,29 @@ config.init({ }); /***/ }), -/* 277 */ +/* 282 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var compileSchema = __webpack_require__(282) +var compileSchema = __webpack_require__(287) , resolve = __webpack_require__(169) - , Cache = __webpack_require__(278) + , Cache = __webpack_require__(283) , SchemaObject = __webpack_require__(170) - , stableStringify = __webpack_require__(150) - , formats = __webpack_require__(281) - , rules = __webpack_require__(283) - , v5 = __webpack_require__(307) + , stableStringify = __webpack_require__(152) + , formats = __webpack_require__(286) + , rules = __webpack_require__(288) + , v5 = __webpack_require__(312) , util = __webpack_require__(41) , async = __webpack_require__(167) - , co = __webpack_require__(210); + , co = __webpack_require__(211); module.exports = Ajv; Ajv.prototype.compileAsync = async.compile; -var customKeyword = __webpack_require__(304); +var customKeyword = __webpack_require__(309); Ajv.prototype.addKeyword = customKeyword.add; Ajv.prototype.getKeyword = customKeyword.get; Ajv.prototype.removeKeyword = customKeyword.remove; @@ -66054,7 +67436,7 @@ function Ajv(opts) { function addDraft4MetaSchema() { if (self._opts.meta !== false) { - var metaSchema = __webpack_require__(305); + var metaSchema = __webpack_require__(310); addMetaSchema(metaSchema, META_SCHEMA_ID, true); self._refs['http://json-schema.org/schema'] = META_SCHEMA_ID; } @@ -66093,7 +67475,7 @@ function Ajv(opts) { /***/ }), -/* 278 */ +/* 283 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -66126,7 +67508,7 @@ Cache.prototype.clear = function Cache_clear() { /***/ }), -/* 279 */ +/* 284 */ /***/ (function(module, exports) { function webpackEmptyContext(req) { @@ -66135,11 +67517,10 @@ function webpackEmptyContext(req) { webpackEmptyContext.keys = function() { return []; }; webpackEmptyContext.resolve = webpackEmptyContext; module.exports = webpackEmptyContext; -webpackEmptyContext.id = 279; - +webpackEmptyContext.id = 284; /***/ }), -/* 280 */ +/* 285 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -66147,13 +67528,13 @@ webpackEmptyContext.id = 279; //all requires must be explicit because browserify won't work with dynamic requires module.exports = { - '$ref': __webpack_require__(300), - allOf: __webpack_require__(286), - anyOf: __webpack_require__(287), - dependencies: __webpack_require__(290), - 'enum': __webpack_require__(291), - format: __webpack_require__(292), - items: __webpack_require__(293), + '$ref': __webpack_require__(305), + allOf: __webpack_require__(291), + anyOf: __webpack_require__(292), + dependencies: __webpack_require__(295), + 'enum': __webpack_require__(296), + format: __webpack_require__(297), + items: __webpack_require__(298), maximum: __webpack_require__(172), minimum: __webpack_require__(172), maxItems: __webpack_require__(173), @@ -66162,19 +67543,19 @@ module.exports = { minLength: __webpack_require__(174), maxProperties: __webpack_require__(175), minProperties: __webpack_require__(175), - multipleOf: __webpack_require__(294), - not: __webpack_require__(295), - oneOf: __webpack_require__(296), - pattern: __webpack_require__(297), - properties: __webpack_require__(299), - required: __webpack_require__(301), - uniqueItems: __webpack_require__(303), + multipleOf: __webpack_require__(299), + not: __webpack_require__(300), + oneOf: __webpack_require__(301), + pattern: __webpack_require__(302), + properties: __webpack_require__(304), + required: __webpack_require__(306), + uniqueItems: __webpack_require__(308), validate: __webpack_require__(176) }; /***/ }), -/* 281 */ +/* 286 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -66185,7 +67566,7 @@ var util = __webpack_require__(41); 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 = /^[0-9a-z](?:(?:[-0-9a-z]{0,61})?[0-9a-z])?(\.[0-9a-z](?:(?:[-0-9a-z]{0,61})?[0-9a-z])?)*$/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 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; @@ -66345,7 +67726,7 @@ function compareDateTime(dt1, dt2) { /***/ }), -/* 282 */ +/* 287 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -66353,7 +67734,7 @@ function compareDateTime(dt1, dt2) { var resolve = __webpack_require__(169) , util = __webpack_require__(41) - , stableStringify = __webpack_require__(150) + , stableStringify = __webpack_require__(152) , async = __webpack_require__(167); var beautify; @@ -66361,7 +67742,7 @@ var beautify; function loadBeautify(){ if (beautify === undefined) { var name = 'js-beautify'; - try { beautify = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND';; throw e; }()).js_beautify; } + try { beautify = !(function webpackMissingModule() { var e = new Error("Cannot find module \".\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()).js_beautify; } catch(e) { beautify = false; } } } @@ -66372,7 +67753,7 @@ var validateGenerator = __webpack_require__(176); * Functions below are used inside compiled validations function */ -var co = __webpack_require__(210); +var co = __webpack_require__(211); var ucs2length = util.ucs2length; var equal = __webpack_require__(168); @@ -66742,13 +68123,13 @@ function vars(arr, statement) { /***/ }), -/* 283 */ +/* 288 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var ruleModules = __webpack_require__(280) +var ruleModules = __webpack_require__(285) , toHash = __webpack_require__(41).toHash; module.exports = function rules() { @@ -66789,7 +68170,7 @@ module.exports = function rules() { /***/ }), -/* 284 */ +/* 289 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -66816,7 +68197,7 @@ module.exports = function ucs2length(str) { /***/ }), -/* 285 */ +/* 290 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -66999,7 +68380,7 @@ module.exports = function generate__formatLimit(it, $keyword) { /***/ }), -/* 286 */ +/* 291 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67049,7 +68430,7 @@ module.exports = function generate_allOf(it, $keyword) { /***/ }), -/* 287 */ +/* 292 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67062,7 +68443,6 @@ module.exports = function generate_anyOf(it, $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; @@ -67096,7 +68476,7 @@ module.exports = function generate_anyOf(it, $keyword) { it.compositeRule = $it.compositeRule = $wasComposite; out += ' ' + ($closingBraces) + ' if (!' + ($valid) + ') { var err = '; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'anyOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + 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\' '; } @@ -67122,7 +68502,7 @@ module.exports = function generate_anyOf(it, $keyword) { /***/ }), -/* 288 */ +/* 293 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67135,7 +68515,6 @@ module.exports = function generate_constant(it, $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 $isData = it.opts.v5 && $schema && $schema.$data, @@ -67154,7 +68533,7 @@ module.exports = function generate_constant(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'constant') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + out += ' { keyword: \'' + ('constant') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; if (it.opts.messages !== false) { out += ' , message: \'should be equal to constant\' '; } @@ -67182,7 +68561,7 @@ module.exports = function generate_constant(it, $keyword) { /***/ }), -/* 289 */ +/* 294 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67209,9 +68588,8 @@ module.exports = function generate_custom(it, $keyword) { } var $rule = this, $definition = 'definition' + $lvl, - $rDef = $rule.definition, - $validate = $rDef.validate, - $compile, $inline, $macro, $ruleValidate, $validateCode; + $rDef = $rule.definition; + var $compile, $inline, $macro, $ruleValidate, $validateCode; if ($isData && $rDef.$data) { $validateCode = 'keywordValidate' + $lvl; var $validateSchema = $rDef.validateSchema; @@ -67410,7 +68788,7 @@ module.exports = function generate_custom(it, $keyword) { /***/ }), -/* 290 */ +/* 295 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67423,7 +68801,6 @@ module.exports = function generate_dependencies(it, $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 $errs = 'errs__' + $lvl; var $it = it.util.copy(it); @@ -67468,7 +68845,7 @@ module.exports = function generate_dependencies(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; + out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; if (it.opts.messages !== false) { out += ' , message: \'should have '; if ($deps.length == 1) { @@ -67511,7 +68888,7 @@ module.exports = function generate_dependencies(it, $keyword) { } out += ' if (' + ($data) + ($prop) + ' === undefined) { var err = '; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; + out += ' { keyword: \'' + ('dependencies') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { property: \'' + (it.util.escapeQuotes($property)) + '\', missingProperty: \'' + ($missingProperty) + '\', depsCount: ' + ($deps.length) + ', deps: \'' + (it.util.escapeQuotes($deps.length == 1 ? $deps[0] : $deps.join(", "))) + '\' } '; if (it.opts.messages !== false) { out += ' , message: \'should have '; if ($deps.length == 1) { @@ -67565,7 +68942,7 @@ module.exports = function generate_dependencies(it, $keyword) { /***/ }), -/* 291 */ +/* 296 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67578,7 +68955,6 @@ module.exports = function generate_enum(it, $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 $isData = it.opts.v5 && $schema && $schema.$data, @@ -67607,7 +68983,7 @@ module.exports = function generate_enum(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; + out += ' { keyword: \'' + ('enum') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { allowedValues: schema' + ($lvl) + ' } '; if (it.opts.messages !== false) { out += ' , message: \'should be equal to one of the allowed values\' '; } @@ -67638,7 +69014,7 @@ module.exports = function generate_enum(it, $keyword) { /***/ }), -/* 292 */ +/* 297 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67651,7 +69027,6 @@ module.exports = function generate_format(it, $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 || ''); if (it.opts.format === false) { if ($breakOnError) { @@ -67735,7 +69110,7 @@ module.exports = function generate_format(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; + out += ' { keyword: \'' + ('format') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { format: '; if ($isData) { out += '' + ($schemaValue); } else { @@ -67784,7 +69159,7 @@ module.exports = function generate_format(it, $keyword) { /***/ }), -/* 293 */ +/* 298 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67797,7 +69172,6 @@ module.exports = function generate_items(it, $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; @@ -67821,7 +69195,7 @@ module.exports = function generate_items(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'additionalItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { limit: ' + ($schema.length) + ' } '; + 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\' '; } @@ -67936,7 +69310,7 @@ module.exports = function generate_items(it, $keyword) { /***/ }), -/* 294 */ +/* 299 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -67949,7 +69323,6 @@ module.exports = function generate_multipleOf(it, $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.v5 && $schema && $schema.$data, $schemaValue; @@ -67978,7 +69351,7 @@ module.exports = function generate_multipleOf(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'multipleOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { multipleOf: ' + ($schemaValue) + ' } '; + 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) { @@ -68020,7 +69393,7 @@ module.exports = function generate_multipleOf(it, $keyword) { /***/ }), -/* 295 */ +/* 300 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68033,7 +69406,6 @@ module.exports = function generate_not(it, $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 $errs = 'errs__' + $lvl; var $it = it.util.copy(it); @@ -68061,7 +69433,7 @@ module.exports = function generate_not(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; if (it.opts.messages !== false) { out += ' , message: \'should NOT be valid\' '; } @@ -68090,7 +69462,7 @@ module.exports = function generate_not(it, $keyword) { } else { out += ' var err = '; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + out += ' { keyword: \'' + ('not') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; if (it.opts.messages !== false) { out += ' , message: \'should NOT be valid\' '; } @@ -68111,7 +69483,7 @@ module.exports = function generate_not(it, $keyword) { /***/ }), -/* 296 */ +/* 301 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68124,7 +69496,6 @@ module.exports = function generate_oneOf(it, $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; @@ -68164,7 +69535,7 @@ module.exports = function generate_oneOf(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'oneOf') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} '; + 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\' '; } @@ -68195,7 +69566,7 @@ module.exports = function generate_oneOf(it, $keyword) { /***/ }), -/* 297 */ +/* 302 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68208,7 +69579,6 @@ module.exports = function generate_pattern(it, $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.v5 && $schema && $schema.$data, $schemaValue; @@ -68228,7 +69598,7 @@ module.exports = function generate_pattern(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; + out += ' { keyword: \'' + ('pattern') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { pattern: '; if ($isData) { out += '' + ($schemaValue); } else { @@ -68277,7 +69647,7 @@ module.exports = function generate_pattern(it, $keyword) { /***/ }), -/* 298 */ +/* 303 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68290,7 +69660,6 @@ module.exports = function generate_patternRequired(it, $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 $key = 'key' + $lvl, @@ -68312,7 +69681,7 @@ module.exports = function generate_patternRequired(it, $keyword) { var $missingPattern = it.util.escapeQuotes($pProperty); out += ' if (!' + ($matched) + ') { ' + ($valid) + ' = false; var err = '; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } '; + out += ' { keyword: \'' + ('patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } '; if (it.opts.messages !== false) { out += ' , message: \'should have property matching pattern \\\'' + ($missingPattern) + '\\\'\' '; } @@ -68336,7 +69705,7 @@ module.exports = function generate_patternRequired(it, $keyword) { /***/ }), -/* 299 */ +/* 304 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68349,7 +69718,6 @@ module.exports = function generate_properties(it, $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; @@ -68443,7 +69811,7 @@ module.exports = function generate_properties(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'additionalProperties') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { additionalProperty: \'' + ($additionalProperty) + '\' } '; + 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\' '; } @@ -68563,7 +69931,7 @@ module.exports = function generate_properties(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + 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) { @@ -68708,7 +70076,7 @@ module.exports = function generate_properties(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; + 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)) + '"\' '; } @@ -68746,7 +70114,7 @@ module.exports = function generate_properties(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'patternGroups') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { reason: \'' + ($reason) + '\', limit: ' + ($limit) + ', pattern: \'' + (it.util.escapeQuotes($pgProperty)) + '\' } '; + 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)) + '"\' '; } @@ -68789,7 +70157,7 @@ module.exports = function generate_properties(it, $keyword) { /***/ }), -/* 300 */ +/* 305 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68801,7 +70169,6 @@ module.exports = function generate_ref(it, $keyword) { var $schema = it.schema[$keyword]; var $errSchemaPath = it.errSchemaPath + '/' + $keyword; var $breakOnError = !it.opts.allErrors; - var $errorKeyword; var $data = 'data' + ($dataLvl || ''); var $valid = 'valid' + $lvl; var $async, $refCode; @@ -68823,7 +70190,7 @@ module.exports = function generate_ref(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || '$ref') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { ref: \'' + (it.util.escapeQuotes($schema)) + '\' } '; + 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)) + '\' '; } @@ -68916,7 +70283,7 @@ module.exports = function generate_ref(it, $keyword) { /***/ }), -/* 301 */ +/* 306 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -68929,7 +70296,6 @@ module.exports = function generate_required(it, $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 $isData = it.opts.v5 && $schema && $schema.$data, @@ -68988,7 +70354,7 @@ module.exports = function generate_required(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + 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) { @@ -69042,7 +70408,7 @@ module.exports = function generate_required(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + 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) { @@ -69086,7 +70452,7 @@ module.exports = function generate_required(it, $keyword) { if ($isData) { out += ' if (' + ($vSchema) + ' && !Array.isArray(' + ($vSchema) + ')) { var err = '; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + 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) { @@ -69107,7 +70473,7 @@ module.exports = function generate_required(it, $keyword) { } out += ' for (var ' + ($i) + ' = 0; ' + ($i) + ' < ' + ($vSchema) + '.length; ' + ($i) + '++) { if (' + ($data) + '[' + ($vSchema) + '[' + ($i) + ']] === undefined) { var err = '; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + 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) { @@ -69142,7 +70508,7 @@ module.exports = function generate_required(it, $keyword) { } out += ' if (' + ($data) + ($prop) + ' === undefined) { var err = '; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'required') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingProperty: \'' + ($missingProperty) + '\' } '; + 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) { @@ -69173,7 +70539,7 @@ module.exports = function generate_required(it, $keyword) { /***/ }), -/* 302 */ +/* 307 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69186,7 +70552,6 @@ module.exports = function generate_switch(it, $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; @@ -69227,7 +70592,7 @@ module.exports = function generate_switch(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } '; + out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } '; if (it.opts.messages !== false) { out += ' , message: \'should pass "switch" keyword validation\' '; } @@ -69267,7 +70632,7 @@ module.exports = function generate_switch(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } '; + out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } '; if (it.opts.messages !== false) { out += ' , message: \'should pass "switch" keyword validation\' '; } @@ -69309,7 +70674,7 @@ module.exports = function generate_switch(it, $keyword) { /***/ }), -/* 303 */ +/* 308 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -69322,7 +70687,6 @@ module.exports = function generate_uniqueItems(it, $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 $isData = it.opts.v5 && $schema && $schema.$data, @@ -69346,7 +70710,7 @@ module.exports = function generate_uniqueItems(it, $keyword) { $$outStack.push(out); out = ''; /* istanbul ignore else */ if (it.createErrors !== false) { - out += ' { keyword: \'' + ($errorKeyword || 'uniqueItems') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { i: i, j: j } '; + 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)\' '; } @@ -69388,14 +70752,14 @@ module.exports = function generate_uniqueItems(it, $keyword) { /***/ }), -/* 304 */ +/* 309 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var IDENTIFIER = /^[a-z_$][a-z0-9_$\-]*$/i; -var customRuleCode = __webpack_require__(289); +var customRuleCode = __webpack_require__(294); module.exports = { add: addKeyword, @@ -69524,7 +70888,7 @@ function removeKeyword(keyword) { /***/ }), -/* 305 */ +/* 310 */ /***/ (function(module, exports) { module.exports = { @@ -69750,7 +71114,7 @@ module.exports = { }; /***/ }), -/* 306 */ +/* 311 */ /***/ (function(module, exports) { module.exports = { @@ -70250,7 +71614,7 @@ module.exports = { }; /***/ }), -/* 307 */ +/* 312 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -70266,14 +71630,14 @@ module.exports = { function enableV5(ajv) { var inlineFunctions = { - 'switch': __webpack_require__(302), - 'constant': __webpack_require__(288), - '_formatLimit': __webpack_require__(285), - 'patternRequired': __webpack_require__(298) + 'switch': __webpack_require__(307), + 'constant': __webpack_require__(293), + '_formatLimit': __webpack_require__(290), + 'patternRequired': __webpack_require__(303) }; if (ajv._opts.meta !== false) { - var metaSchema = __webpack_require__(306); + var metaSchema = __webpack_require__(311); ajv.addMetaSchema(metaSchema, META_SCHEMA_ID); } _addKeyword('constant'); @@ -70309,7 +71673,7 @@ function containsMacro(schema) { /***/ }), -/* 308 */ +/* 313 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -70422,7 +71786,7 @@ x.iTerm.setCwd = function (cwd) { /***/ }), -/* 309 */ +/* 314 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -70495,7 +71859,7 @@ Object.defineProperty(module, 'exports', { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 310 */ +/* 315 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -70508,7 +71872,7 @@ Object.defineProperty(module, 'exports', { -var flatten = __webpack_require__(311); +var flatten = __webpack_require__(316); var slice = [].slice; /** @@ -70560,15 +71924,15 @@ module.exports = diff; /***/ }), -/* 311 */ +/* 316 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; /*! * arr-flatten * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License. + * Copyright (c) 2014-2015, 2017, Jon Schlinkert. + * Released under the MIT License. */ @@ -70577,23 +71941,24 @@ module.exports = function flatten(arr) { return flat(arr, []); }; -function flat(arr, res) { +function flat(arr, acc) { var len = arr.length; - var i = -1; + var idx = -1; - while (len--) { - var cur = arr[++i]; + while (++idx < len) { + var cur = arr[idx]; if (Array.isArray(cur)) { - flat(cur, res); + flat(cur, acc); } else { - res.push(cur); + acc.push(cur); } } - return res; + return acc; } + /***/ }), -/* 312 */ +/* 317 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -70625,7 +71990,7 @@ module.exports = function (arr, predicate, ctx) { /***/ }), -/* 313 */ +/* 318 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -70660,16 +72025,16 @@ module.exports = function unique(arr) { /***/ }), -/* 314 */ +/* 319 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2011 Mark Cavage All rights reserved. -var errors = __webpack_require__(111); -var types = __webpack_require__(112); +var errors = __webpack_require__(117); +var types = __webpack_require__(118); -var Reader = __webpack_require__(315); -var Writer = __webpack_require__(316); +var Reader = __webpack_require__(320); +var Writer = __webpack_require__(321); ///--- Exports @@ -70693,15 +72058,15 @@ for (var e in errors) { /***/ }), -/* 315 */ +/* 320 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2011 Mark Cavage All rights reserved. var assert = __webpack_require__(22); -var ASN1 = __webpack_require__(112); -var errors = __webpack_require__(111); +var ASN1 = __webpack_require__(118); +var errors = __webpack_require__(117); ///--- Globals @@ -70960,14 +72325,14 @@ module.exports = Reader; /***/ }), -/* 316 */ +/* 321 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2011 Mark Cavage All rights reserved. var assert = __webpack_require__(22); -var ASN1 = __webpack_require__(112); -var errors = __webpack_require__(111); +var ASN1 = __webpack_require__(118); +var errors = __webpack_require__(117); ///--- Globals @@ -71282,19 +72647,19 @@ module.exports = Writer; /***/ }), -/* 317 */ +/* 322 */ /***/ (function(module, exports, __webpack_require__) { module.exports = { - parallel : __webpack_require__(319), - serial : __webpack_require__(320), + parallel : __webpack_require__(324), + serial : __webpack_require__(325), serialOrdered : __webpack_require__(183) }; /***/ }), -/* 318 */ +/* 323 */ /***/ (function(module, exports) { module.exports = defer; @@ -71326,7 +72691,7 @@ function defer(fn) /***/ }), -/* 319 */ +/* 324 */ /***/ (function(module, exports, __webpack_require__) { var iterate = __webpack_require__(180) @@ -71375,7 +72740,7 @@ function parallel(list, iterator, callback) /***/ }), -/* 320 */ +/* 325 */ /***/ (function(module, exports, __webpack_require__) { var serialOrdered = __webpack_require__(183); @@ -71398,7 +72763,7 @@ function serial(list, iterator, callback) /***/ }), -/* 321 */ +/* 326 */ /***/ (function(module, exports, __webpack_require__) { @@ -71422,7 +72787,7 @@ function serial(list, iterator, callback) * Module dependencies. */ -var crypto = __webpack_require__(6) +var crypto = __webpack_require__(7) , parse = __webpack_require__(11).parse ; @@ -71616,14 +72981,14 @@ module.exports.canonicalizeResource = canonicalizeResource /***/ }), -/* 322 */ +/* 327 */ /***/ (function(module, exports, __webpack_require__) { var aws4 = exports, url = __webpack_require__(11), - querystring = __webpack_require__(108), - crypto = __webpack_require__(6), - lru = __webpack_require__(323), + querystring = __webpack_require__(114), + crypto = __webpack_require__(7), + lru = __webpack_require__(328), credentialsCache = lru(1000) // http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html @@ -71954,7 +73319,7 @@ aws4.sign = function(request, credentials) { /***/ }), -/* 323 */ +/* 328 */ /***/ (function(module, exports) { module.exports = function(size) { @@ -72056,7 +73421,7 @@ function DoublyLinkedNode(key, val) { /***/ }), -/* 324 */ +/* 329 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72071,7 +73436,7 @@ exports.default = { }; /***/ }), -/* 325 */ +/* 330 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72099,7 +73464,7 @@ function _load_errors() { } /***/ }), -/* 326 */ +/* 331 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72113,7 +73478,7 @@ exports.examples = exports.hasWrapper = exports.setFlags = exports.run = undefin var _buildSubCommands2; function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(36)); + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(35)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72158,7 +73523,7 @@ exports.hasWrapper = hasWrapper; exports.examples = examples; /***/ }), -/* 327 */ +/* 332 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72194,7 +73559,7 @@ function run(config, reporter, flags, args) { } /***/ }), -/* 328 */ +/* 333 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72216,7 +73581,7 @@ exports.hasWrapper = hasWrapper; var _buildSubCommands2; function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(36)); + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(35)); } var _fs; @@ -72293,10 +73658,68 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def clean(config, reporter, flags, args) { return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + let getPackageCachefolders = (() => { + var _ref3 = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (packageName) { + let parentDir = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : config.cacheFolder; + let metadataFile = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : (_constants || _load_constants()).METADATA_FILENAME; + + const folders = yield (_fs || _load_fs()).readdir(parentDir); + const packageFolders = []; + + for (const folder of folders) { + if (folder[0] === '.') { + continue; + } + + const loc = path.join(config.cacheFolder, parentDir.replace(config.cacheFolder, ''), folder); + // Check if this is a scoped package + if (!(yield (_fs || _load_fs()).exists(path.join(loc, metadataFile)))) { + // If so, recurrently read scoped packages metadata + packageFolders.push(...(yield getPackageCachefolders(packageName, loc))); + } else { + var _ref4 = yield config.readPackageMetadata(loc); + + const manifest = _ref4.package; + + if (packageName === manifest.name) { + packageFolders.push(loc); + } + } + } + + return packageFolders; + }); + + return function getPackageCachefolders(_x3) { + return _ref3.apply(this, arguments); + }; + })(); + if (config.cacheFolder) { - yield (_fs || _load_fs()).unlink(config._cacheRootFolder); - yield (_fs || _load_fs()).mkdirp(config.cacheFolder); - reporter.success(reporter.lang('clearedCache')); + const activity = reporter.activity(); + + if (args.length > 0) { + // Clear named package from cache + const folders = yield getPackageCachefolders(args[0]); + + if (folders.length === 0) { + activity.end(); + reporter.warn(reporter.lang('couldntClearPackageFromCache', args[0])); + return; + } + + for (const folder of folders) { + yield (_fs || _load_fs()).unlink(folder); + } + activity.end(); + reporter.success(reporter.lang('clearedPackageFromCache', args[0])); + } else { + // Clear all cache + yield (_fs || _load_fs()).unlink(config._cacheRootFolder); + yield (_fs || _load_fs()).mkdirp(config.cacheFolder); + activity.end(); + reporter.success(reporter.lang('clearedCache')); + } } })(); } @@ -72310,7 +73733,7 @@ exports.setFlags = setFlags; exports.examples = examples; /***/ }), -/* 329 */ +/* 334 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72338,7 +73761,7 @@ exports.hasWrapper = hasWrapper; var _buildSubCommands2; function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(36)); + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(35)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72373,7 +73796,7 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def return false; } - reporter.log(String(config.getOption(args[0]))); + reporter.log(String(config.getOption(args[0], false))); return true; }, @@ -72418,7 +73841,7 @@ exports.setFlags = setFlags; exports.examples = examples; /***/ }), -/* 330 */ +/* 335 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72432,7 +73855,7 @@ exports.run = undefined; var _toArray2; function _load_toArray() { - return _toArray2 = _interopRequireDefault(__webpack_require__(124)); + return _toArray2 = _interopRequireDefault(__webpack_require__(67)); } var _asyncToGenerator2; @@ -72516,7 +73939,7 @@ function _load_index() { var _child; function _load_child() { - return _child = _interopRequireWildcard(__webpack_require__(59)); + return _child = _interopRequireWildcard(__webpack_require__(44)); } var _fs; @@ -72528,7 +73951,7 @@ function _load_fs() { var _global; function _load_global() { - return _global = __webpack_require__(56); + return _global = __webpack_require__(59); } 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; } } @@ -72542,7 +73965,83 @@ function hasWrapper() { } /***/ }), -/* 331 */ +/* 336 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = undefined; + +var _toArray2; + +function _load_toArray() { + return _toArray2 = _interopRequireDefault(__webpack_require__(67)); +} + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} + +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')); + } + + var _args = (0, (_toArray2 || _load_toArray()).default)(args); + + const execName = _args[0], + rest = _args.slice(1); + + yield (_child || _load_child()).spawn(execName, rest, { stdio: 'inherit', env }); + }); + + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); + +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; + +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(3); +} + +var _child; + +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(44)); +} + +var _executeLifecycleScript; + +function _load_executeLifecycleScript() { + return _executeLifecycleScript = __webpack_require__(62); +} + +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() {} + +function hasWrapper() { + return true; +} + +/***/ }), +/* 337 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72611,7 +74110,7 @@ function _load_wrapper() { var _stringify; function _load_stringify() { - return _stringify = _interopRequireDefault(__webpack_require__(78)); + return _stringify = _interopRequireDefault(__webpack_require__(81)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -72629,7 +74128,7 @@ function setFlags(commander) { const examples = exports.examples = ['generate-lock-entry', 'generate-lock-entry --use-manifest ./package.json', 'generate-lock-entry --resolved local-file.tgz#hash']; /***/ }), -/* 332 */ +/* 338 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72715,7 +74214,7 @@ function run(config, reporter, commander, args) { } /***/ }), -/* 333 */ +/* 339 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -72749,7 +74248,7 @@ exports.hasWrapper = hasWrapper; var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } var _check; @@ -72767,37 +74266,37 @@ function _load_errors() { var _baseResolver; function _load_baseResolver() { - return _baseResolver = _interopRequireDefault(__webpack_require__(117)); + return _baseResolver = _interopRequireDefault(__webpack_require__(83)); } var _hostedGitResolver; function _load_hostedGitResolver() { - return _hostedGitResolver = _interopRequireDefault(__webpack_require__(51)); + return _hostedGitResolver = _interopRequireDefault(__webpack_require__(52)); } var _hostedGitResolver2; function _load_hostedGitResolver2() { - return _hostedGitResolver2 = __webpack_require__(51); + return _hostedGitResolver2 = __webpack_require__(52); } var _gistResolver; function _load_gistResolver() { - return _gistResolver = _interopRequireDefault(__webpack_require__(118)); + return _gistResolver = _interopRequireDefault(__webpack_require__(123)); } var _gistResolver2; function _load_gistResolver2() { - return _gistResolver2 = __webpack_require__(118); + return _gistResolver2 = __webpack_require__(123); } var _gitResolver; function _load_gitResolver() { - return _gitResolver = _interopRequireDefault(__webpack_require__(58)); + return _gitResolver = _interopRequireDefault(__webpack_require__(61)); } var _fileResolver; @@ -72815,25 +74314,25 @@ function _load_packageResolver() { var _packageRequest; function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); } var _packageFetcher; function _load_packageFetcher() { - return _packageFetcher = _interopRequireDefault(__webpack_require__(198)); + return _packageFetcher = _interopRequireWildcard(__webpack_require__(198)); } var _packageLinker; function _load_packageLinker() { - return _packageLinker = _interopRequireDefault(__webpack_require__(114)); + return _packageLinker = _interopRequireDefault(__webpack_require__(120)); } var _packageCompatibility; function _load_packageCompatibility() { - return _packageCompatibility = _interopRequireDefault(__webpack_require__(197)); + return _packageCompatibility = _interopRequireWildcard(__webpack_require__(197)); } var _wrapper; @@ -72866,9 +74365,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de const NPM_REGISTRY = /http[s]:\/\/registry.npmjs.org/g; -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); const path = __webpack_require__(1); -const uuid = __webpack_require__(73); +const uuid = __webpack_require__(58); const noArguments = exports.noArguments = true; @@ -73088,7 +74587,7 @@ class ImportPackageResolver extends (_packageResolver || _load_packageResolver() _this3.activity.tick(req.pattern); } const request = new ImportPackageRequest(req, _this3); - yield request.find(); + yield request.find(false); })(); } @@ -73102,6 +74601,9 @@ class ImportPackageResolver extends (_packageResolver || _load_packageResolver() deps = _this4.next; _this4.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 + _this4.resolvePackagesWithExistingVersions(); return; } yield _this4.findAll(deps); @@ -73119,16 +74621,12 @@ class ImportPackageResolver extends (_packageResolver || _load_packageResolver() } } - init(deps, isFlat, rootName) { + init(deps, isFlat) { var _this5 = this; return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { _this5.flat = isFlat; - _this5.rootName = rootName || _this5.rootName; const activity = _this5.activity = _this5.reporter.activity(); - _this5.seedPatterns = deps.map(function (dep) { - return dep.pattern; - }); yield _this5.findAll(deps); _this5.resetOptional(); activity.end(); @@ -73141,8 +74639,6 @@ 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.fetcher = new (_packageFetcher || _load_packageFetcher()).default(config, this.resolver); - this.compatibility = new (_packageCompatibility || _load_packageCompatibility()).default(config, this.resolver, this.flags.ignoreEngines); this.linker = new (_packageLinker || _load_packageLinker()).default(config, this.resolver); } @@ -73161,9 +74657,13 @@ class Import extends (_install || _load_install()).Install { patterns = _ref.patterns, manifest = _ref.manifest; - yield _this6.resolver.init(requests, _this6.flags.flat, manifest.name); - yield _this6.fetcher.init(); - yield _this6.compatibility.init(); + if (manifest.name && _this6.resolver instanceof ImportPackageResolver) { + _this6.resolver.rootName = manifest.name; + } + yield _this6.resolver.init(requests, _this6.flags.flat); + const manifests = yield (_packageFetcher || _load_packageFetcher()).fetch(_this6.resolver.getManifests(), _this6.config); + _this6.resolver.updateManifests(manifests); + yield (_packageCompatibility || _load_packageCompatibility()).check(_this6.resolver.getManifests(), _this6.config, _this6.flags.ignoreEngines); yield _this6.linker.resolvePeerModules(); yield _this6.saveLockfileAndIntegrity(patterns); return patterns; @@ -73179,7 +74679,7 @@ function hasWrapper() { } /***/ }), -/* 334 */ +/* 340 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73220,7 +74720,7 @@ let run = exports.run = (() => { // pass application/json Accept to get full metadata for info command let result = yield config.registries.npm.request(name, { - headers: { 'Accept': 'application/json' } + headers: { Accept: 'application/json' } }); if (!result) { reporter.error(reporter.lang('infoFail')); @@ -73266,12 +74766,12 @@ function _load_npmRegistry() { var _parsePackageName2; function _load_parsePackageName() { - return _parsePackageName2 = _interopRequireDefault(__webpack_require__(379)); + return _parsePackageName2 = _interopRequireDefault(__webpack_require__(388)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const semver = __webpack_require__(27); +const semver = __webpack_require__(26); function clean(object) { if (Array.isArray(object)) { @@ -73310,7 +74810,7 @@ function hasWrapper() { } /***/ }), -/* 335 */ +/* 341 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73342,7 +74842,9 @@ let run = exports.run = (() => { try { repository = { type: 'git', - url: yield (_child || _load_child()).spawn('git', ['config', 'remote.origin.url'], { cwd: config.cwd }) + 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) @@ -73493,7 +74995,7 @@ exports.hasWrapper = hasWrapper; var _util; function _load_util() { - return _util = __webpack_require__(121); + return _util = __webpack_require__(126); } var _index; @@ -73505,7 +75007,7 @@ function _load_index() { var _child; function _load_child() { - return _child = _interopRequireWildcard(__webpack_require__(59)); + return _child = _interopRequireWildcard(__webpack_require__(44)); } var _fs; @@ -73517,14 +75019,14 @@ function _load_fs() { var _validate; function _load_validate() { - return _validate = _interopRequireWildcard(__webpack_require__(60)); + return _validate = _interopRequireWildcard(__webpack_require__(63)); } 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__(243); +const objectPath = __webpack_require__(245); const path = __webpack_require__(1); @@ -73537,7 +75039,7 @@ function hasWrapper() { } /***/ }), -/* 336 */ +/* 342 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73557,7 +75059,7 @@ function _load_slicedToArray() { var _extends2; function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(43)); + return _extends2 = _interopRequireDefault(__webpack_require__(45)); } var _asyncToGenerator2; @@ -73570,7 +75072,7 @@ let getManifests = (() => { var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, flags) { const lockfile = yield (_wrapper || _load_wrapper()).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, true); + yield install.hydrate(true); let manifests = install.resolver.getManifests(); @@ -73610,13 +75112,13 @@ exports.hasWrapper = hasWrapper; var _baseReporter; function _load_baseReporter() { - return _baseReporter = _interopRequireDefault(__webpack_require__(49)); + return _baseReporter = _interopRequireDefault(__webpack_require__(51)); } var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } var _wrapper; @@ -73628,12 +75130,12 @@ function _load_wrapper() { var _buildSubCommands2; function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(36)); + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(35)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); function hasWrapper(flags, args) { return args[0] != 'generate-disclaimer'; @@ -73655,7 +75157,6 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def homepage = _ref2.homepage, author = _ref2.author; - const url = repository ? repository.url : homepage; const vendorUrl = homepage || author && author.url; const vendorName = author && author.name; @@ -73674,7 +75175,9 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def homepage = _ref3.homepage; const children = []; - children.push({ name: `${reporter.format.bold('License:')} ${license || reporter.format.red('UNKNOWN')}` }); + children.push({ + name: `${reporter.format.bold('License:')} ${license || reporter.format.red('UNKNOWN')}` + }); const url = repository ? repository.url : homepage; if (url) { @@ -73772,7 +75275,7 @@ exports.setFlags = setFlags; exports.examples = examples; /***/ }), -/* 337 */ +/* 343 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73816,7 +75319,7 @@ function hasWrapper() { } /***/ }), -/* 338 */ +/* 344 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -73864,9 +75367,9 @@ let run = exports.run = (() => { }); reporter.table(['Package', 'Current', 'Wanted', 'Latest', 'Package Type', 'URL'], body); + return 1; } - - return Promise.resolve(); + return 0; }); return function run(_x, _x2, _x3, _x4) { @@ -73880,7 +75383,7 @@ exports.hasWrapper = hasWrapper; var _packageRequest; function _load_packageRequest() { - return _packageRequest = _interopRequireDefault(__webpack_require__(30)); + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); } var _wrapper; @@ -73892,7 +75395,7 @@ function _load_wrapper() { var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -73908,7 +75411,7 @@ function hasWrapper() { } /***/ }), -/* 339 */ +/* 345 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74002,13 +75505,13 @@ function _load_errors() { var _buildSubCommands2; function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(36)); + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(35)); } var _validate; function _load_validate() { - return _validate = __webpack_require__(60); + return _validate = __webpack_require__(63); } var _tag; @@ -74020,7 +75523,7 @@ function _load_tag() { var _login; function _load_login() { - return _login = __webpack_require__(57); + return _login = __webpack_require__(60); } var _npmRegistry; @@ -74121,7 +75624,7 @@ exports.hasWrapper = hasWrapper; exports.examples = examples; /***/ }), -/* 340 */ +/* 346 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74193,7 +75696,7 @@ let publish = (() => { readme: pkg.readme || '', _attachments: { [tbName]: { - 'content_type': 'application/octet-stream', + content_type: 'application/octet-stream', data: buffer.toString('base64'), length: buffer.length } @@ -74282,7 +75785,7 @@ function _load_npmRegistry() { var _stream; function _load_stream() { - return _stream = __webpack_require__(383); + return _stream = __webpack_require__(392); } var _errors; @@ -74312,7 +75815,7 @@ function _load_pack() { var _login; function _load_login() { - return _login = __webpack_require__(57); + return _login = __webpack_require__(60); } var _misc; @@ -74325,10 +75828,10 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); -const crypto = __webpack_require__(6); +const invariant = __webpack_require__(5); +const crypto = __webpack_require__(7); const url = __webpack_require__(11); -const fs2 = __webpack_require__(5); +const fs2 = __webpack_require__(6); function setFlags(commander) { (0, (_version || _load_version()).setFlags)(commander); @@ -74342,7 +75845,7 @@ function hasWrapper() { } /***/ }), -/* 341 */ +/* 347 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74382,6 +75885,8 @@ let run = exports.run = (() => { } if (cmds.length) { + // propagate YARN_SILENT env variable to executed commands + process.env.YARN_SILENT = '1'; for (const _ref3 of cmds) { var _ref4 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref3, 2); @@ -74463,7 +75968,7 @@ let run = exports.run = (() => { }); return Promise.resolve(); } else { - return yield runCommand(args); + return runCommand(args); } }); @@ -74478,7 +75983,7 @@ exports.hasWrapper = hasWrapper; var _executeLifecycleScript; function _load_executeLifecycleScript() { - return _executeLifecycleScript = __webpack_require__(82); + return _executeLifecycleScript = __webpack_require__(62); } var _errors; @@ -74490,7 +75995,7 @@ function _load_errors() { var _index; function _load_index() { - return _index = __webpack_require__(52); + return _index = __webpack_require__(53); } var _fs; @@ -74509,7 +76014,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const leven = __webpack_require__(544); +const leven = __webpack_require__(551); const path = __webpack_require__(1); @@ -74531,7 +76036,7 @@ function hasWrapper() { } /***/ }), -/* 342 */ +/* 348 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74545,7 +76050,7 @@ exports.examples = exports.hasWrapper = exports.setFlags = exports.run = undefin var _extends2; function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(43)); + return _extends2 = _interopRequireDefault(__webpack_require__(45)); } var _asyncToGenerator2; @@ -74557,19 +76062,19 @@ function _load_asyncToGenerator() { var _toArray2; function _load_toArray() { - return _toArray2 = _interopRequireDefault(__webpack_require__(124)); + return _toArray2 = _interopRequireDefault(__webpack_require__(67)); } var _buildSubCommands2; function _load_buildSubCommands() { - return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(36)); + return _buildSubCommands2 = _interopRequireDefault(__webpack_require__(35)); } var _login; function _load_login() { - return _login = __webpack_require__(57); + return _login = __webpack_require__(60); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -74746,7 +76251,7 @@ exports.hasWrapper = hasWrapper; exports.examples = examples; /***/ }), -/* 343 */ +/* 349 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74770,7 +76275,8 @@ let run = exports.run = (() => { 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('linkUnregistered', name)); + reporter.success(reporter.lang('linkDisusing', name)); + reporter.info(reporter.lang('linkDisusingMessage', name)); } else { throw new (_errors || _load_errors()).MessageError(reporter.lang('linkMissing', name)); } @@ -74800,6 +76306,7 @@ let run = exports.run = (() => { 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)); } @@ -74835,7 +76342,7 @@ function _load_link() { var _global; function _load_global() { - return _global = __webpack_require__(56); + return _global = __webpack_require__(59); } 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; } } @@ -74851,7 +76358,7 @@ function hasWrapper() { } /***/ }), -/* 344 */ +/* 350 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -74893,7 +76400,7 @@ exports.hasWrapper = hasWrapper; var _yarnVersion; function _load_yarnVersion() { - return _yarnVersion = __webpack_require__(62); + return _yarnVersion = __webpack_require__(65); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -74905,7 +76412,7 @@ function hasWrapper() { } /***/ }), -/* 345 */ +/* 351 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75001,7 +76508,7 @@ let run = exports.run = (() => { // init reporter.step(2, 4, reporter.lang('whyInitGraph'), emoji.get('truck')); - const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.cwd, reporter); + const lockfile = yield (_wrapper || _load_wrapper()).default.fromDirectory(config.lockfileFolder, reporter); const install = new (_install || _load_install()).Install(flags, config, reporter, lockfile); var _ref7 = yield install.fetchRequestFromCwd(); @@ -75164,7 +76671,7 @@ exports.hasWrapper = hasWrapper; var _install; function _load_install() { - return _install = __webpack_require__(26); + return _install = __webpack_require__(27); } var _constants; @@ -75197,9 +76704,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de const requireLockfile = exports.requireLockfile = true; -const invariant = __webpack_require__(7); -const bytes = __webpack_require__(394); -const emoji = __webpack_require__(242); +const invariant = __webpack_require__(5); +const bytes = __webpack_require__(403); +const emoji = __webpack_require__(244); const path = __webpack_require__(1); function sum(array) { @@ -75268,7 +76775,101 @@ function hasWrapper() { } /***/ }), -/* 346 */ +/* 352 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.run = undefined; + +var _toArray2; + +function _load_toArray() { + return _toArray2 = _interopRequireDefault(__webpack_require__(67)); +} + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} + +let run = exports.run = (() => { + var _ref = (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* (config, reporter, flags, args) { + const workspaceRootFolder = config.workspaceRootFolder; + + + if (!workspaceRootFolder) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceRootNotFound', config.cwd)); + } + + if (args.length < 1) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceMissingWorkspace')); + } + + if (args.length < 2) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceMissingCommand')); + } + + 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); + + var _args = (0, (_toArray2 || _load_toArray()).default)(args); + + const workspaceName = _args[0], + rest = _args.slice(1); + + if (!Object.prototype.hasOwnProperty.call(workspaces, workspaceName)) { + throw new (_errors || _load_errors()).MessageError(reporter.lang('workspaceUnknownWorkspace', workspaceName)); + } + + try { + yield (_child || _load_child()).spawn(process.argv[0], [process.argv[1], ...rest], { stdio: 'inherit' }); + } catch (err) { + throw err; + } + }); + + return function run(_x, _x2, _x3, _x4) { + return _ref.apply(this, arguments); + }; +})(); + +exports.setFlags = setFlags; +exports.hasWrapper = hasWrapper; + +var _errors; + +function _load_errors() { + return _errors = __webpack_require__(3); +} + +var _child; + +function _load_child() { + return _child = _interopRequireWildcard(__webpack_require__(44)); +} + +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 invariant = __webpack_require__(5); + +function setFlags() {} + +function hasWrapper() { + return true; +} + +/***/ }), +/* 353 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75281,7 +76882,7 @@ Object.defineProperty(exports, "__esModule", { var _extends2; function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(43)); + return _extends2 = _interopRequireDefault(__webpack_require__(45)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -75322,7 +76923,7 @@ const affordances = { exports.default = (0, (_extends2 || _load_extends()).default)({}, shorthands, affordances); /***/ }), -/* 347 */ +/* 354 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75341,7 +76942,7 @@ function _load_asyncToGenerator() { var _baseFetcher; function _load_baseFetcher() { - return _baseFetcher = _interopRequireDefault(__webpack_require__(76)); + return _baseFetcher = _interopRequireDefault(__webpack_require__(79)); } var _fs; @@ -75370,7 +76971,7 @@ class CopyFetcher extends (_baseFetcher || _load_baseFetcher()).default { exports.default = CopyFetcher; /***/ }), -/* 348 */ +/* 355 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75395,13 +76996,13 @@ function _load_errors() { var _baseFetcher; function _load_baseFetcher() { - return _baseFetcher = _interopRequireDefault(__webpack_require__(76)); + return _baseFetcher = _interopRequireDefault(__webpack_require__(79)); } var _git; function _load_git() { - return _git = _interopRequireDefault(__webpack_require__(120)); + return _git = _interopRequireDefault(__webpack_require__(125)); } var _fs; @@ -75419,30 +77020,51 @@ function _load_constants() { var _crypto; function _load_crypto() { - return _crypto = _interopRequireWildcard(__webpack_require__(81)); + return _crypto = _interopRequireWildcard(__webpack_require__(85)); } 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 tarFs = __webpack_require__(103); +const tarFs = __webpack_require__(109); const url = __webpack_require__(11); const path = __webpack_require__(1); -const fs = __webpack_require__(5); +const fs = __webpack_require__(6); -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); class GitFetcher extends (_baseFetcher || _load_baseFetcher()).default { - getLocalAvailabilityStatus() { + setupMirrorFromCache() { var _this = this; return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - // Some mirrors might still have files named "./reponame" instead of "./reponame-commit" - const tarballLegacyMirrorPath = _this.getTarballMirrorPath({ withCommit: false }); - const tarballModernMirrorPath = _this.getTarballMirrorPath(); + const tarballMirrorPath = _this.getTarballMirrorPath(); const tarballCachePath = _this.getTarballCachePath(); + if (tarballMirrorPath == null) { + return; + } + + if (!(yield (_fs || _load_fs()).exists(tarballMirrorPath)) && (yield (_fs || _load_fs()).exists(tarballCachePath))) { + // The tarball doesn't exists in the offline cache but does in the cache; we import it to the mirror + yield (_fs || _load_fs()).mkdirp(path.dirname(tarballMirrorPath)); + yield (_fs || _load_fs()).copy(tarballCachePath, tarballMirrorPath, _this.reporter); + } + })(); + } + + getLocalAvailabilityStatus() { + var _this2 = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + // Some mirrors might still have files named "./reponame" instead of "./reponame-commit" + const tarballLegacyMirrorPath = _this2.getTarballMirrorPath({ + withCommit: false + }); + const tarballModernMirrorPath = _this2.getTarballMirrorPath(); + const tarballCachePath = _this2.getTarballCachePath(); + if (tarballLegacyMirrorPath != null && (yield (_fs || _load_fs()).exists(tarballLegacyMirrorPath))) { return true; } @@ -75486,23 +77108,25 @@ class GitFetcher extends (_baseFetcher || _load_baseFetcher()).default { } fetchFromLocal(override) { - var _this2 = this; + var _this3 = this; return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const tarballLegacyMirrorPath = _this2.getTarballMirrorPath({ withCommit: false }); - const tarballModernMirrorPath = _this2.getTarballMirrorPath(); - const tarballCachePath = _this2.getTarballCachePath(); + const tarballLegacyMirrorPath = _this3.getTarballMirrorPath({ + withCommit: false + }); + const tarballModernMirrorPath = _this3.getTarballMirrorPath(); + const tarballCachePath = _this3.getTarballCachePath(); - const tarballMirrorPath = tarballModernMirrorPath && !(yield (_fs || _load_fs()).exists(tarballModernMirrorPath)) && tarballLegacyMirrorPath && (yield (_fs || _load_fs()).exists(tarballLegacyMirrorPath)) ? tarballLegacyMirrorPath : tarballModernMirrorPath; + const tarballMirrorPath = tarballModernMirrorPath && (yield (_fs || _load_fs()).exists(tarballModernMirrorPath)) ? tarballModernMirrorPath : tarballLegacyMirrorPath && (yield (_fs || _load_fs()).exists(tarballLegacyMirrorPath)) ? tarballLegacyMirrorPath : null; const tarballPath = override || tarballMirrorPath || tarballCachePath; if (!tarballPath || !(yield (_fs || _load_fs()).exists(tarballPath))) { - throw new (_errors || _load_errors()).MessageError(_this2.reporter.lang('tarballNotInNetworkOrCache', _this2.reference, tarballPath)); + throw new (_errors || _load_errors()).MessageError(_this3.reporter.lang('tarballNotInNetworkOrCache', _this3.reference, tarballPath)); } return new Promise(function (resolve, reject) { - const untarStream = tarFs.extract(_this2.dest, { + const untarStream = tarFs.extract(_this3.dest, { dmode: 0o555, // all dirs should be readable fmode: 0o444, // all files should be readable chown: false }); @@ -75511,18 +77135,19 @@ class GitFetcher extends (_baseFetcher || _load_baseFetcher()).default { const cachedStream = fs.createReadStream(tarballPath); cachedStream.pipe(hashStream).pipe(untarStream).on('finish', function () { + const expectHash = _this3.hash; + invariant(expectHash, 'Commit hash required'); - const expectHash = _this2.hash; const actualHash = hashStream.getHash(); // This condition is disabled because "expectHash" actually is the commit hash // This is a design issue that we'll need to fix (https://github.com/yarnpkg/yarn/pull/3449) if (true) { resolve({ - hash: actualHash + hash: expectHash }); } else { - reject(new (_errors || _load_errors()).SecurityError(_this2.reporter.lang('fetchBadHash', expectHash, actualHash))); + reject(new (_errors || _load_errors()).SecurityError(_this3.reporter.lang('fetchBadHash', expectHash, actualHash))); } }).on('error', function (err) { reject(new (_errors || _load_errors()).MessageError(this.reporter.lang('fetchErrorCorrupt', err.message, tarballPath))); @@ -75532,19 +77157,19 @@ class GitFetcher extends (_baseFetcher || _load_baseFetcher()).default { } fetchFromExternal() { - var _this3 = this; + var _this4 = this; return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - const hash = _this3.hash; + const hash = _this4.hash; invariant(hash, 'Commit hash required'); - const gitUrl = (_git || _load_git()).default.npmUrlToGitUrl(_this3.reference); - const git = new (_git || _load_git()).default(_this3.config, gitUrl, hash); + const gitUrl = (_git || _load_git()).default.npmUrlToGitUrl(_this4.reference); + const git = new (_git || _load_git()).default(_this4.config, gitUrl, hash); yield git.init(); - yield git.clone(_this3.dest); + yield git.clone(_this4.dest); - const tarballMirrorPath = _this3.getTarballMirrorPath(); - const tarballCachePath = _this3.getTarballCachePath(); + const tarballMirrorPath = _this4.getTarballMirrorPath(); + const tarballCachePath = _this4.getTarballCachePath(); if (tarballMirrorPath) { yield git.archive(tarballMirrorPath); @@ -75561,13 +77186,13 @@ class GitFetcher extends (_baseFetcher || _load_baseFetcher()).default { } _fetch() { - var _this4 = this; + var _this5 = this; return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { - if (yield _this4.getLocalAvailabilityStatus()) { - return _this4.fetchFromLocal(); + if (yield _this5.getLocalAvailabilityStatus()) { + return _this5.fetchFromLocal(); } else { - return _this4.fetchFromExternal(); + return _this5.fetchFromExternal(); } })(); } @@ -75575,7 +77200,7 @@ class GitFetcher extends (_baseFetcher || _load_baseFetcher()).default { exports.default = GitFetcher; /***/ }), -/* 349 */ +/* 356 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75589,19 +77214,19 @@ exports.tarball = exports.git = exports.copy = exports.base = undefined; var _baseFetcher; function _load_baseFetcher() { - return _baseFetcher = _interopRequireDefault(__webpack_require__(76)); + return _baseFetcher = _interopRequireDefault(__webpack_require__(79)); } var _copyFetcher; function _load_copyFetcher() { - return _copyFetcher = _interopRequireDefault(__webpack_require__(347)); + return _copyFetcher = _interopRequireDefault(__webpack_require__(354)); } var _gitFetcher; function _load_gitFetcher() { - return _gitFetcher = _interopRequireDefault(__webpack_require__(348)); + return _gitFetcher = _interopRequireDefault(__webpack_require__(355)); } var _tarballFetcher; @@ -75618,7 +77243,7 @@ exports.git = (_gitFetcher || _load_gitFetcher()).default; exports.tarball = (_tarballFetcher || _load_tarballFetcher()).default; /***/ }), -/* 350 */ +/* 357 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75627,7 +77252,7 @@ exports.tarball = (_tarballFetcher || _load_tarballFetcher()).default; Object.defineProperty(exports, "__esModule", { value: true }); -const semver = __webpack_require__(27); +const semver = __webpack_require__(26); // This isn't really a "proper" constraint resolver. We just return the highest semver // version in the versions passed that satisfies the input range. This vastly reduces @@ -75651,7 +77276,7 @@ class PackageConstraintResolver { exports.default = PackageConstraintResolver; /***/ }), -/* 351 */ +/* 358 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -75676,7 +77301,7 @@ function _load_misc() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); const path = __webpack_require__(1); let historyCounter = 0; @@ -75743,7 +77368,7 @@ class PackageHoister { this.prepass(patterns); for (const pattern of this.resolver.dedupePatterns(patterns)) { - this._seed(pattern); + this._seed(pattern, { isDirectRequire: true }); } while (true) { @@ -75774,9 +77399,9 @@ class PackageHoister { var _ref6 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref5, 2); const pattern = _ref6[0]; - const parents = _ref6[1]; + const parent = _ref6[1]; - const info = this._seed(pattern, parents); + const info = this._seed(pattern, { isDirectRequire: false, parent }); if (info) { infos.push(info); } @@ -75793,7 +77418,10 @@ class PackageHoister { * Seed the hoister with a specific pattern. */ - _seed(pattern, parent) { + _seed(pattern, _ref7) { + let isDirectRequire = _ref7.isDirectRequire, + parent = _ref7.parent; + // const pkg = this.resolver.getStrictResolvedPattern(pattern); const ref = pkg._reference; @@ -75802,7 +77430,7 @@ class PackageHoister { // let parentParts = []; const isIncompatible = ref.incompatible; - let isRequired = !parent && !ref.ignore && !isIncompatible; + let isRequired = isDirectRequire && !ref.ignore && !isIncompatible; if (parent) { if (!this.tree.get(parent.key)) { @@ -75810,7 +77438,7 @@ class PackageHoister { } // non ignored dependencies inherit parent's ignored status // parent may transition from ignored to non ignored when hoisted if it is used in another non ignored branch - if (!isRequired && !isIncompatible && parent.isRequired) { + if (!isDirectRequire && !isIncompatible && parent.isRequired) { isRequired = true; } parentParts = parent.parts; @@ -76099,7 +77727,10 @@ class PackageHoister { invariant(ref, 'expected reference'); const versions = occurences[pkg.name] = occurences[pkg.name] || {}; - const version = versions[pkg.version] = versions[pkg.version] || { occurences: new Set(), pattern }; + const version = versions[pkg.version] = versions[pkg.version] || { + occurences: new Set(), + pattern + }; version.occurences.add(ancestry[ancestry.length - 1]); for (const depPattern of ref.dependencies) { @@ -76157,7 +77788,7 @@ class PackageHoister { // only hoist this module if it occured more than once if (mostOccurenceCount > 1) { - this._seed(mostOccurencePattern); + this._seed(mostOccurencePattern, { isDirectRequire: false }); } } } @@ -76170,11 +77801,11 @@ class PackageHoister { const flatTree = []; // - for (const _ref7 of this.tree.entries()) { - var _ref8 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref7, 2); + for (const _ref8 of this.tree.entries()) { + var _ref9 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref8, 2); - const key = _ref8[0]; - const info = _ref8[1]; + const key = _ref9[0]; + const info = _ref9[1]; // decompress the location and push it to the flat tree. this path could be made const parts = []; @@ -76190,13 +77821,10 @@ class PackageHoister { if (this.config.modulesFolder) { // remove the first part which will be the folder name and replace it with a // hardcoded modules folder - parts.shift(); - const modulesFolder = this.config.modulesFolder == null ? '' : this.config.modulesFolder; - parts.unshift(modulesFolder); + parts.splice(0, 1, this.config.modulesFolder); } else { // first part will be the registry-specific module folder - const cwd = this.config.cwd == null ? '' : this.config.cwd; - parts.unshift(cwd); + parts.splice(0, 0, this.config.lockfileFolder); } const loc = path.join(...parts); @@ -76205,11 +77833,11 @@ class PackageHoister { // remove ignored modules from the tree const visibleFlatTree = []; - for (const _ref9 of flatTree) { - var _ref10 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref9, 2); + for (const _ref10 of flatTree) { + var _ref11 = (0, (_slicedToArray2 || _load_slicedToArray()).default)(_ref10, 2); - const loc = _ref10[0]; - const info = _ref10[1]; + const loc = _ref11[0]; + const info = _ref11[1]; const ref = info.pkg._reference; invariant(ref, 'expected reference'); @@ -76227,7 +77855,7 @@ class PackageHoister { exports.default = PackageHoister; /***/ }), -/* 352 */ +/* 359 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76252,7 +77880,7 @@ function _load_asyncToGenerator() { var _executeLifecycleScript; function _load_executeLifecycleScript() { - return _executeLifecycleScript = _interopRequireDefault(__webpack_require__(82)); + return _executeLifecycleScript = _interopRequireDefault(__webpack_require__(62)); } var _fs; @@ -76265,7 +77893,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); const INSTALL_STAGES = ['preinstall', 'install', 'postinstall']; @@ -76563,7 +78191,7 @@ class PackageInstallScripts { exports.default = PackageInstallScripts; /***/ }), -/* 353 */ +/* 360 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76685,7 +78313,7 @@ class PackageReference { exports.default = PackageReference; /***/ }), -/* 354 */ +/* 361 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76707,13 +78335,13 @@ function _load_path() { var _parse; function _load_parse() { - return _parse = _interopRequireDefault(__webpack_require__(77)); + return _parse = _interopRequireDefault(__webpack_require__(80)); } var _rc; function _load_rc() { - return _rc = _interopRequireWildcard(__webpack_require__(380)); + return _rc = _interopRequireWildcard(__webpack_require__(389)); } 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; } } @@ -76795,7 +78423,7 @@ function clearRcCache() { } /***/ }), -/* 355 */ +/* 362 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76814,7 +78442,7 @@ function _load_asyncToGenerator() { var _extends2; function _load_extends() { - return _extends2 = _interopRequireDefault(__webpack_require__(43)); + return _extends2 = _interopRequireDefault(__webpack_require__(45)); } var _misc; @@ -76825,7 +78453,7 @@ function _load_misc() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const objectPath = __webpack_require__(243); +const objectPath = __webpack_require__(245); const path = __webpack_require__(1); @@ -76961,7 +78589,7 @@ class BaseRegistry { exports.default = BaseRegistry; /***/ }), -/* 356 */ +/* 363 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -76980,15 +78608,19 @@ function _load_url() { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function isRequestToRegistry(requestUrl, registry) { +function isRequestToRegistry(requestUrl, registry, customHostSuffix) { const requestParsed = (_url || _load_url()).default.parse(requestUrl); const registryParsed = (_url || _load_url()).default.parse(registry); + const requestHost = requestParsed.hostname || ''; + const registryHost = registryParsed.hostname || ''; const requestPort = getPortOrDefaultPort(requestParsed.port, requestParsed.protocol); const registryPort = getPortOrDefaultPort(registryParsed.port, registryParsed.protocol); const requestPath = requestParsed.path || ''; const registryPath = registryParsed.path || ''; - return requestParsed.hostname === registryParsed.hostname && requestPort === registryPort && requestPath.startsWith(registryPath); + return requestHost === registryHost && requestPort === registryPort && (requestPath.startsWith(registryPath) || + // For some registries, the package path does not prefix with the registry path + !!customHostSuffix && customHostSuffix.length > 0 && requestHost.endsWith(customHostSuffix)); } function getPortOrDefaultPort(port, protocol) { @@ -77002,7 +78634,7 @@ function getPortOrDefaultPort(port, protocol) { } /***/ }), -/* 357 */ +/* 364 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77040,13 +78672,13 @@ function _load_npmRegistry() { var _stringify; function _load_stringify() { - return _stringify = _interopRequireDefault(__webpack_require__(78)); + return _stringify = _interopRequireDefault(__webpack_require__(81)); } var _parse; function _load_parse() { - return _parse = _interopRequireDefault(__webpack_require__(77)); + return _parse = _interopRequireDefault(__webpack_require__(80)); } var _fs; @@ -77058,14 +78690,14 @@ function _load_fs() { var _yarnVersion; function _load_yarnVersion() { - return _yarnVersion = __webpack_require__(62); + return _yarnVersion = __webpack_require__(65); } 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 userHome = __webpack_require__(122).default; +const userHome = __webpack_require__(86).default; const path = __webpack_require__(1); @@ -77191,7 +78823,7 @@ exports.default = YarnRegistry; YarnRegistry.filename = 'yarn.json'; /***/ }), -/* 358 */ +/* 365 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77204,7 +78836,7 @@ Object.defineProperty(exports, "__esModule", { var _jsonReporter; function _load_jsonReporter() { - return _jsonReporter = _interopRequireDefault(__webpack_require__(116)); + return _jsonReporter = _interopRequireDefault(__webpack_require__(122)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -77230,7 +78862,7 @@ class BufferReporter extends (_jsonReporter || _load_jsonReporter()).default { exports.default = BufferReporter; /***/ }), -/* 359 */ +/* 366 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77249,25 +78881,25 @@ function _load_asyncToGenerator() { var _baseReporter; function _load_baseReporter() { - return _baseReporter = _interopRequireDefault(__webpack_require__(49)); + return _baseReporter = _interopRequireDefault(__webpack_require__(51)); } var _progressBar; function _load_progressBar() { - return _progressBar = _interopRequireDefault(__webpack_require__(361)); + return _progressBar = _interopRequireDefault(__webpack_require__(368)); } var _spinnerProgress; function _load_spinnerProgress() { - return _spinnerProgress = _interopRequireDefault(__webpack_require__(362)); + return _spinnerProgress = _interopRequireDefault(__webpack_require__(369)); } var _util; function _load_util() { - return _util = __webpack_require__(115); + return _util = __webpack_require__(121); } var _misc; @@ -77279,13 +78911,13 @@ function _load_misc() { var _treeHelper; function _load_treeHelper() { - return _treeHelper = __webpack_require__(360); + return _treeHelper = __webpack_require__(367); } var _inquirer; function _load_inquirer() { - return _inquirer = _interopRequireDefault(__webpack_require__(146)); + return _inquirer = _interopRequireDefault(__webpack_require__(148)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -77294,10 +78926,10 @@ var _require = __webpack_require__(2); const inspect = _require.inspect; -const readline = __webpack_require__(109); +const readline = __webpack_require__(115); const chalk = __webpack_require__(16); -const read = __webpack_require__(571); -const tty = __webpack_require__(110); +const read = __webpack_require__(578); +const tty = __webpack_require__(116); class ConsoleReporter extends (_baseReporter || _load_baseReporter()).default { constructor(opts) { @@ -77486,7 +79118,13 @@ class ConsoleReporter extends (_baseReporter || _load_baseReporter()).default { color = _ref.color; const formatter = this.format; - const out = (0, (_treeHelper || _load_treeHelper()).getFormattedOutput)({ prefix: titlePrefix, hint, color, name, formatter }); + const out = (0, (_treeHelper || _load_treeHelper()).getFormattedOutput)({ + prefix: titlePrefix, + hint, + color, + name, + formatter + }); this.stdout.write(out); if (children && children.length) { @@ -77715,7 +79353,7 @@ class ConsoleReporter extends (_baseReporter || _load_baseReporter()).default { exports.default = ConsoleReporter; /***/ }), -/* 360 */ +/* 367 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77771,7 +79409,7 @@ function formatColor(color, strToFormat, formatter) { } /***/ }), -/* 361 */ +/* 368 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77784,7 +79422,7 @@ Object.defineProperty(exports, "__esModule", { var _util; function _load_util() { - return _util = __webpack_require__(115); + return _util = __webpack_require__(121); } class ProgressBar { @@ -77842,7 +79480,7 @@ exports.default = ProgressBar; ProgressBar.bars = [['█', '░']]; /***/ }), -/* 362 */ +/* 369 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77855,7 +79493,7 @@ Object.defineProperty(exports, "__esModule", { var _util; function _load_util() { - return _util = __webpack_require__(115); + return _util = __webpack_require__(121); } class Spinner { @@ -77876,38 +79514,30 @@ class Spinner { setPrefix(prefix) { this.prefix = prefix; } - setText(text) { this.text = text; } - start() { this.current = 0; this.render(); } - render() { if (this.id) { clearTimeout(this.id); } - // build line ensuring we don't wrap to the next line let msg = `${this.prefix}${this.chars[this.current]} ${this.text}`; const columns = typeof this.stdout.columns === 'number' ? this.stdout.columns : 100; msg = msg.slice(0, columns); - (0, (_util || _load_util()).writeOnNthLine)(this.stdout, this.lineNumber, msg); - this.current = ++this.current % this.chars.length; this.id = setTimeout(() => this.render(), this.delay); } - stop() { if (this.id) { clearTimeout(this.id); this.id = null; } - (0, (_util || _load_util()).clearNthLine)(this.stdout, this.lineNumber); } } @@ -77915,7 +79545,7 @@ exports.default = Spinner; Spinner.spinners = ['|/-\\', '⠂-–—–-', '◐◓◑◒', '◴◷◶◵', '◰◳◲◱', '▖▘▝▗', '■□▪▫', '▌▀▐▄', '▉▊▋▌▍▎▏▎▍▌▋▊▉', '▁▃▄▅▆▇█▇▆▅▄▃', '←↖↑↗→↘↓↙', '┤┘┴└├┌┬┐', '◢◣◤◥', '.oO°Oo.', '.oO@*', '🌍🌎🌏', '◡◡ ⊙⊙ ◠◠', '☱☲☴', '⠋⠙⠹⠸⠼⠴⠦⠧⠇⠏', '⠋⠙⠚⠞⠖⠦⠴⠲⠳⠓', '⠄⠆⠇⠋⠙⠸⠰⠠⠰⠸⠙⠋⠇⠆', '⠋⠙⠚⠒⠂⠂⠒⠲⠴⠦⠖⠒⠐⠐⠒⠓⠋', '⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠴⠲⠒⠂⠂⠒⠚⠙⠉⠁', '⠈⠉⠋⠓⠒⠐⠐⠒⠖⠦⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈', '⠁⠁⠉⠙⠚⠒⠂⠂⠒⠲⠴⠤⠄⠄⠤⠠⠠⠤⠦⠖⠒⠐⠐⠒⠓⠋⠉⠈⠈', '⢄⢂⢁⡁⡈⡐⡠', '⢹⢺⢼⣸⣇⡧⡗⡏', '⣾⣽⣻⢿⡿⣟⣯⣷', '⠁⠂⠄⡀⢀⠠⠐⠈']; /***/ }), -/* 363 */ +/* 370 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77928,12 +79558,12 @@ Object.defineProperty(exports, "__esModule", { var _jsonReporter; function _load_jsonReporter() { - return _jsonReporter = _interopRequireDefault(__webpack_require__(116)); + return _jsonReporter = _interopRequireDefault(__webpack_require__(122)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -var _require = __webpack_require__(34); +var _require = __webpack_require__(49); const EventEmitter = _require.EventEmitter; class EventReporter extends (_jsonReporter || _load_jsonReporter()).default { @@ -77955,7 +79585,7 @@ exports.default = EventReporter; // $FlowFixMe: need to "inherit" from it Object.assign(EventReporter.prototype, EventEmitter.prototype); /***/ }), -/* 364 */ +/* 371 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -77985,6 +79615,8 @@ const messages = { waitingInstance: 'Waiting for the other yarn instance to finish', offlineRetrying: 'There appears to be trouble with your network connection. Retrying...', clearedCache: 'Cleared cache.', + couldntClearPackageFromCache: "Couldn't clear package $0 from cache", + clearedPackageFromCache: 'Cleared package $0 from cache', packWroteTarball: 'Wrote tarball to $0.', manifestPotentialTypo: 'Potential typo $0, did you mean $1?', @@ -78060,9 +79692,7 @@ const messages = { frozenLockfileError: 'Your lockfile needs to be updated, but yarn was run with `--frozen-lockfile`.', fileWriteError: 'Could not write file $0: $1', multiplePackagesCantUnpackInSameDestination: 'Pattern $0 is trying to unpack in the same destination $1 as pattern $2. This could result in a non deterministic behavior, skipping.', - incorrectLockfileEntry: 'Lockfile has incorrect entry for $0. Ingoring it.', - workspacesIncompatibleDependencies: 'Dependency $0 has different versions in $1 and $2', - workspacesRequirePrivateProjects: 'Workspaces can only be enabled for private projects', + incorrectLockfileEntry: 'Lockfile has incorrect entry for $0. Ignoring it.', yarnOutdated: "Your current version of Yarn is out of date. The latest version is $0 while you're on $1.", yarnOutdatedInstaller: 'To upgrade, download the latest installer at $0.', @@ -78095,14 +79725,29 @@ const messages = { binLinkCollision: "There's already a linked binary called $0 in your global Yarn bin. Could not link this package's $0 bin entry.", linkCollision: "There's already a module called $0 registered.", linkMissing: 'No registered module found called $0.', - linkInstallMessage: 'You can now run `yarn link $0` in the projects where you want to use this module and it will be used instead.', linkRegistered: 'Registered $0.', + linkRegisteredMessage: 'You can now run `yarn link $0` in the projects where you want to use this module and it will be used instead.', linkUnregistered: 'Unregistered $0.', + linkUnregisteredMessage: 'You can now run `yarn unlink $0` in the projects where you no longer want to use this module.', linkUsing: 'Using linked module for $0.', + linkDisusing: 'Removed linked module $0.', + linkDisusingMessage: 'You will need to run `yarn` to re-install the package that was linked.', createInvalidBin: 'Invalid bin entry found in package $0.', createMissingPackage: 'Package not found - this is probably an internal error, and should be reported at https://github.com/yarnpkg/yarn/issues.', + workspacesRequirePrivateProjects: 'Workspaces can only be enabled in private projects', + workspaceExperimentalDisabled: 'The workspace feature is currently experimental and needs to be manually enabled - please add "workspaces-experimental true" to your .yarnrc file.', + workspaceRootNotFound: "Cannot find the root of your workspace - are you sure you're currently in a workspace?", + workspaceMissingWorkspace: 'Missing workspace name.', + workspaceMissingCommand: 'Missing command name.', + workspaceUnknownWorkspace: 'Unknown workspace $0.', + workspaceVersionMandatory: 'Missing version in workspace at $0, ignoring.', + workspaceNameMandatory: 'Missing name in workspace at $0, ignoring.', + workspaceNameDuplicate: 'There are more than one workspace with name $0', + + execMissingCommand: 'Missing command name.', + commandNotSpecified: 'No command specified.', binCommands: 'Commands available from binary scripts: ', possibleCommands: 'Project commands', @@ -78203,13 +79848,13 @@ const messages = { infoFail: 'Received invalid response from npm.', malformedRegistryResponse: 'Received malformed response from registry for $0. The registry may be down.', - cantRequestOffline: 'Can\'t make a request in offline mode ($0)', + cantRequestOffline: "Can't make a request in offline mode ($0)", requestManagerNotSetupHAR: 'RequestManager was not setup to capture HAR files', requestError: 'Request $0 returned a $1', requestFailed: 'Request failed $0', tarballNotInNetworkOrCache: '$0: Tarball is not in network and can not be located in cache ($1)', - fetchBadHash: 'Hashes don\'t match. Expected $1 but got $2', - fetchBadHashWithPath: 'Hashes don\'t match when extracting file $0. Expected $1 but got $2', + fetchBadHash: "Hashes don't match. Expected $1 but got $2", + fetchBadHashWithPath: "Hashes don't match when extracting file $0. Expected $1 but got $2", fetchErrorCorrupt: '$0. Mirror tarball appears to be corrupt. You can resolve this by running:\n\n rm -rf $1\n yarn install', errorDecompressingTarball: '$0. Error decompressing $1, it appears to be corrupt.', updateInstalling: 'Installing $0...', @@ -78228,16 +79873,16 @@ const messages = { couldBeDeduped: '$0 could be deduped from $1 to $2', lockfileNotContainPattern: 'Lockfile does not contain pattern: $0', integrityCheckFailed: 'Integrity check failed', - noIntegrityFile: 'Couldn\'t find an integrity file', + noIntegrityFile: "Couldn't find an integrity file", integrityFailedExpectedIsNotAJSON: 'Integrity check: integrity file is not a json', - integrityCheckLinkedModulesDontMatch: 'Integrity check: Linked modules don\'t match', - integrityFlagsDontMatch: 'Integrity check: Flags don\'t match', - integrityLockfilesDontMatch: 'Integrity check: Lock files don\'t match', + integrityCheckLinkedModulesDontMatch: "Integrity check: Linked modules don't match", + integrityFlagsDontMatch: "Integrity check: Flags don't match", + integrityLockfilesDontMatch: "Integrity check: Lock files don't match", integrityFailedFilesMissing: 'Integrity check: Files are missing', packageNotInstalled: '$0 not installed', optionalDepNotInstalled: 'Optional dependency $0 not installed', packageWrongVersion: '$0 is wrong version: expected $1, got $2', - packageDontSatisfy: '$0 doesn\'t satisfy found match of $1', + packageDontSatisfy: "$0 doesn't satisfy found match of $1", lockfileExists: 'Lockfile already exists, not importing.', skippingImport: 'Skipping import of $0 for $1', @@ -78252,7 +79897,7 @@ const messages = { exports.default = messages; /***/ }), -/* 365 */ +/* 372 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78283,13 +79928,13 @@ function _load_index() { var _isCi; function _load_isCi() { - return _isCi = _interopRequireDefault(__webpack_require__(147)); + return _isCi = _interopRequireDefault(__webpack_require__(149)); } var _baseReporter; function _load_baseReporter() { - return _baseReporter = _interopRequireDefault(__webpack_require__(49)); + return _baseReporter = _interopRequireDefault(__webpack_require__(51)); } 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; } } @@ -78378,7 +80023,73 @@ exports.default = NoopReporter; /* eslint no-unused-vars: 0 */ /***/ }), -/* 366 */ +/* 373 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _packageRequest; + +function _load_packageRequest() { + return _packageRequest = _interopRequireDefault(__webpack_require__(28)); +} + +var _baseResolver; + +function _load_baseResolver() { + return _baseResolver = _interopRequireDefault(__webpack_require__(83)); +} + +var _workspaceLayout; + +function _load_workspaceLayout() { + return _workspaceLayout = _interopRequireDefault(__webpack_require__(66)); +} + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const invariant = __webpack_require__(5); + +class WorkspaceResolver extends (_baseResolver || _load_baseResolver()).default { + static isWorkspace(pattern, workspaceLayout) { + return !!workspaceLayout && !!workspaceLayout.getManifestByPattern(pattern); + } + + constructor(request, fragment, workspaceLayout) { + super(request, fragment); + this.workspaceLayout = workspaceLayout; + } + + resolve() { + const workspace = this.workspaceLayout.getManifestByPattern(this.request.pattern); + invariant(workspace, 'expected workspace'); + const manifest = workspace.manifest, + loc = workspace.loc; + + const registry = manifest._registry; + invariant(registry, 'expected reference'); + + manifest._remote = { + type: 'workspace', + registry, + hash: '', + reference: loc + }; + + manifest._uid = manifest.version; + + return Promise.resolve(manifest); + } +} +exports.default = WorkspaceResolver; + +/***/ }), +/* 374 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78391,7 +80102,7 @@ Object.defineProperty(exports, "__esModule", { var _hostedGitResolver; function _load_hostedGitResolver() { - return _hostedGitResolver = _interopRequireDefault(__webpack_require__(51)); + return _hostedGitResolver = _interopRequireDefault(__webpack_require__(52)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -78423,7 +80134,7 @@ BitbucketResolver.hostname = 'bitbucket.org'; BitbucketResolver.protocol = 'bitbucket'; /***/ }), -/* 367 */ +/* 375 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78436,7 +80147,7 @@ Object.defineProperty(exports, "__esModule", { var _hostedGitResolver; function _load_hostedGitResolver() { - return _hostedGitResolver = _interopRequireDefault(__webpack_require__(51)); + return _hostedGitResolver = _interopRequireDefault(__webpack_require__(52)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -78482,7 +80193,7 @@ GitHubResolver.protocol = 'github'; GitHubResolver.hostname = 'github.com'; /***/ }), -/* 368 */ +/* 376 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78495,7 +80206,7 @@ Object.defineProperty(exports, "__esModule", { var _hostedGitResolver; function _load_hostedGitResolver() { - return _hostedGitResolver = _interopRequireDefault(__webpack_require__(51)); + return _hostedGitResolver = _interopRequireDefault(__webpack_require__(52)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -78527,7 +80238,84 @@ GitLabResolver.hostname = 'gitlab.com'; GitLabResolver.protocol = 'gitlab'; /***/ }), -/* 369 */ +/* 377 */ +/***/ (function(module, exports, __webpack_require__) { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _asyncToGenerator2; + +function _load_asyncToGenerator() { + return _asyncToGenerator2 = _interopRequireDefault(__webpack_require__(0)); +} + +var _exoticResolver; + +function _load_exoticResolver() { + return _exoticResolver = _interopRequireDefault(__webpack_require__(43)); +} + +var _misc; + +function _load_misc() { + return _misc = _interopRequireWildcard(__webpack_require__(10)); +} + +var _fs; + +function _load_fs() { + return _fs = _interopRequireWildcard(__webpack_require__(4)); +} + +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__(1); + +class LinkResolver extends (_exoticResolver || _load_exoticResolver()).default { + constructor(request, fragment) { + super(request, fragment); + this.loc = (_misc || _load_misc()).removePrefix(fragment, 'link:'); + } + + resolve() { + var _this = this; + + return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () { + let loc = _this.loc; + if (!path.isAbsolute(loc)) { + loc = path.join(_this.config.cwd, loc); + } + + const name = path.basename(loc); + const registry = 'npm'; + + const manifest = !(yield (_fs || _load_fs()).exists(loc)) ? { _uid: '', name, version: '0.0.0', _registry: registry } : yield _this.config.readManifest(loc, _this.registry); + + manifest._remote = { + type: 'link', + registry, + hash: null, + reference: loc + }; + + manifest._uid = manifest.version; + + return manifest; + })(); + } +} +exports.default = LinkResolver; +LinkResolver.protocol = 'link'; + +/***/ }), +/* 378 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78546,7 +80334,7 @@ function _load_errors() { var _exoticResolver; function _load_exoticResolver() { - return _exoticResolver = _interopRequireDefault(__webpack_require__(50)); + return _exoticResolver = _interopRequireDefault(__webpack_require__(43)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -78574,7 +80362,7 @@ class RegistryResolver extends (_exoticResolver || _load_exoticResolver()).defau exports.default = RegistryResolver; /***/ }), -/* 370 */ +/* 379 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78599,13 +80387,13 @@ function _load_tarballFetcher() { var _exoticResolver; function _load_exoticResolver() { - return _exoticResolver = _interopRequireDefault(__webpack_require__(50)); + return _exoticResolver = _interopRequireDefault(__webpack_require__(43)); } var _gitResolver; function _load_gitResolver() { - return _gitResolver = _interopRequireDefault(__webpack_require__(58)); + return _gitResolver = _interopRequireDefault(__webpack_require__(61)); } var _misc; @@ -78617,13 +80405,13 @@ function _load_misc() { var _version; function _load_version() { - return _version = _interopRequireWildcard(__webpack_require__(123)); + return _version = _interopRequireWildcard(__webpack_require__(127)); } var _crypto; function _load_crypto() { - return _crypto = _interopRequireWildcard(__webpack_require__(81)); + return _crypto = _interopRequireWildcard(__webpack_require__(85)); } var _fs; @@ -78636,7 +80424,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); class TarballResolver extends (_exoticResolver || _load_exoticResolver()).default { constructor(request, fragment) { @@ -78738,7 +80526,7 @@ class TarballResolver extends (_exoticResolver || _load_exoticResolver()).defaul exports.default = TarballResolver; /***/ }), -/* 371 */ +/* 380 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78751,7 +80539,7 @@ Object.defineProperty(exports, "__esModule", { var _baseResolver; function _load_baseResolver() { - return _baseResolver = _interopRequireDefault(__webpack_require__(117)); + return _baseResolver = _interopRequireDefault(__webpack_require__(83)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -78769,7 +80557,7 @@ class RegistryResolver extends (_baseResolver || _load_baseResolver()).default { exports.default = RegistryResolver; /***/ }), -/* 372 */ +/* 381 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78800,7 +80588,7 @@ function envReplace(value) { } /***/ }), -/* 373 */ +/* 382 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78821,7 +80609,7 @@ function fixCmdWinSlashes(cmd) { cmd.replace(regEx, addQuote); return quotes; } - const quotes = findQuotes('"').concat(findQuotes('\'')); + const quotes = findQuotes('"').concat(findQuotes("'")); function isInsideQuotes(index) { return quotes.reduce((result, quote) => { @@ -78841,7 +80629,7 @@ function fixCmdWinSlashes(cmd) { } /***/ }), -/* 374 */ +/* 383 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78869,7 +80657,7 @@ exports.default = key => { }; /***/ }), -/* 375 */ +/* 384 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -78882,7 +80670,7 @@ Object.defineProperty(exports, "__esModule", { var _toArray2; function _load_toArray() { - return _toArray2 = _interopRequireDefault(__webpack_require__(124)); + return _toArray2 = _interopRequireDefault(__webpack_require__(67)); } var _asyncToGenerator2; @@ -78894,19 +80682,19 @@ function _load_asyncToGenerator() { var _util; function _load_util() { - return _util = __webpack_require__(121); + return _util = __webpack_require__(126); } var _index; function _load_index() { - return _index = __webpack_require__(52); + return _index = __webpack_require__(53); } var _inferLicense; function _load_inferLicense() { - return _inferLicense = _interopRequireDefault(__webpack_require__(376)); + return _inferLicense = _interopRequireDefault(__webpack_require__(385)); } var _fs; @@ -78919,7 +80707,7 @@ function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -const semver = __webpack_require__(27); +const semver = __webpack_require__(26); const path = __webpack_require__(1); const url = __webpack_require__(11); @@ -79219,7 +81007,7 @@ exports.default = (() => { })(); /***/ }), -/* 376 */ +/* 385 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79233,7 +81021,7 @@ exports.default = inferLicense; var _licenses; function _load_licenses() { - return _licenses = _interopRequireDefault(__webpack_require__(377)); + return _licenses = _interopRequireDefault(__webpack_require__(386)); } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } @@ -79243,12 +81031,12 @@ function clean(str) { } const REGEXES = { - Unlicense: [/http:\/\/unlicense.org\//], - WTFPL: [/DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE/, /WTFPL\b/], - ISC: [/The ISC License/, /ISC\b/], Apache: [/Apache License\b/], + BSD: [/BSD\b/], + ISC: [/The ISC License/, /ISC\b/], MIT: [/MIT\b/], - BSD: [/BSD\b/] + Unlicense: [/http:\/\/unlicense.org\//], + WTFPL: [/DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE/, /WTFPL\b/] }; function inferLicense(license) { @@ -79274,7 +81062,7 @@ function inferLicense(license) { } /***/ }), -/* 377 */ +/* 386 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79296,12 +81084,12 @@ exports.default = { 'Apache-2.0': new RegExp('(licensed under the apache license version 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 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$|apache license version january http www apache org licenses terms and conditions for use reproduction and distribution definitions license shall mean the terms and conditions for use reproduction and distribution as defined by sections through of this document licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the license legal entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity for the purposes of this definition control means i the power direct or indirect to cause the direction or management of such entity whether by contract or otherwise or ii ownership of fifty percent or more of the outstanding shares or iii beneficial ownership of such entity you or your shall mean an individual or legal entity exercising permissions granted by this license source form shall mean the preferred form for making modifications including but not limited to software source code documentation source and configuration files object form shall mean any form resulting from mechanical transformation or translation of a source form including but not limited to compiled object code generated documentation and conversions to other media types work shall mean the work of authorship whether in source or object form made available under the license as indicated by a copyright notice that is included in or attached to the work an example is provided in the appendix below derivative works shall mean any work whether in source or object form that is based on or derived from the work and for which the editorial revisions annotations elaborations or other modifications represent as a whole an original work of authorship for the purposes of this license derivative works shall not include works that remain separable from or merely link or bind by name to the interfaces of the work and derivative works thereof contribution shall mean any work of authorship including the original version of the work and any modifications or additions to that work or derivative works thereof that is intentionally submitted to licensor for inclusion in the work by the copyright owner or by an individual or legal entity authorized to submit on behalf of the copyright owner for the purposes of this definition submitted means any form of electronic verbal or written communication sent to the licensor or its representatives including but not limited to communication on electronic mailing lists source code control systems and issue tracking systems that are managed by or on behalf of the licensor for the purpose of discussing and improving the work but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as not a contribution contributor shall mean licensor and any individual or legal entity on behalf of whom a contribution has been received by licensor and subsequently incorporated within the work grant of copyright license subject to the terms and conditions of this license each contributor hereby grants to you a perpetual worldwide non exclusive no charge royalty free irrevocable copyright license to reproduce prepare derivative works of publicly display publicly perform sublicense and distribute the work and such derivative works in source or object form grant of patent license subject to the terms and conditions of this license each contributor hereby grants to you a perpetual worldwide non exclusive no charge royalty free irrevocable except as stated in this section patent license to make have made use offer to sell sell import and otherwise transfer the work where such license applies only to those patent claims licensable by such contributor that are necessarily infringed by their contribution s alone or by combination of their contribution s with the work to which such contribution s was submitted if you institute patent litigation against any entity including a cross claim or counterclaim in a lawsuit alleging that the work or a contribution incorporated within the work constitutes direct or contributory patent infringement then any patent licenses granted to you under this license for that work shall terminate as of the date such litigation is filed redistribution you may reproduce and distribute copies of the work or derivative works thereof in any medium with or without modifications and in source or object form provided that you meet the following conditions a you must give any other recipients of the work or derivative works a copy of this license and b you must cause any modified files to carry prominent notices stating that you changed the files and c you must retain in the source form of any derivative works that you distribute all copyright patent trademark and attribution notices from the source form of the work excluding those notices that do not pertain to any part of the derivative works and d if the work includes a notice text file as part of its distribution then any derivative works that you distribute must include a readable copy of the attribution notices contained within such notice file excluding those notices that do not pertain to any part of the derivative works in at least one of the following places within a notice text file distributed as part of the derivative works within the source form or documentation if provided along with the derivative works or within a display generated by the derivative works if and wherever such third party notices normally appear the contents of the notice file are for informational purposes only and do not modify the license you may add your own attribution notices within derivative works that you distribute alongside or as an addendum to the notice text from the work provided that such additional attribution notices cannot be construed as modifying the license you may add your own copyright statement to your modifications and may provide additional or different license terms and conditions for use reproduction or distribution of your modifications or for any such derivative works as a whole provided your use reproduction and distribution of the work otherwise complies with the conditions stated in this license submission of contributions unless you explicitly state otherwise any contribution intentionally submitted for inclusion in the work by you to the licensor shall be under the terms and conditions of this license without any additional terms or conditions notwithstanding the above nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with licensor regarding such contributions trademarks this license does not grant permission to use the trade names trademarks service marks or product names of the licensor except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the notice file disclaimer of warranty unless required by applicable law or agreed to in writing licensor provides the work and each contributor provides its contributions on an as is basis without warranties or conditions of any kind either express or implied including without limitation any warranties or conditions of title non infringement merchantability or fitness for a particular purpose you are solely responsible for determining the appropriateness of using or redistributing the work and assume any risks associated with your exercise of permissions under this license limitation of liability in no event and under no legal theory whether in tort including negligence contract or otherwise unless required by applicable law such as deliberate and grossly negligent acts or agreed to in writing shall any contributor be liable to you for damages including any direct indirect special incidental or consequential damages of any character arising as a result of this license or out of the use or inability to use the work including but not limited to damages for loss of goodwill work stoppage computer failure or malfunction or any and all other commercial damages or losses even if such contributor has been advised of the possibility of such damages accepting warranty or additional liability while redistributing the work or derivative works thereof you may choose to offer and charge a fee for acceptance of support warranty indemnity or other liability obligations and or rights consistent with this license however in accepting such obligations you may act only on your own behalf and on your sole responsibility not on behalf of any other contributor and only if you agree to indemnify defend and hold each contributor harmless for any liability incurred by or claims asserted against such contributor by reason of your accepting any such warranty or additional liability end of terms and conditions$)', 'g'), 'BSD-2-Clause': new RegExp('(redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution this(.*?| )is provided by the copyright holders and contributors as is and any express or implied warranties including but not limited to the implied warranties of merchantability and fitness for a particular purpose are disclaimed in no event shall(.*?| )be liable for any direct indirect incidental special exemplary or consequential damages including but not limited to procurement of substitute goods or services loss of use data or profits or business interruption however caused and on any theory of liability whether in contract strict liability or tort including negligence or otherwise arising in any way out of the use of this(.*?| )even if advised of the possibility of such damage$|redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution this software is provided by the copyright holders and contributors as is and any express or implied warranties including but not limited to the implied warranties of merchantability and fitness for a particular purpose are disclaimed in no event shall(.*?| )be liable for any direct indirect incidental special exemplary or consequential damages including but not limited to procurement of substitute goods or services loss of use data or profits or business interruption however caused and on any theory of liability whether in contract strict liability or tort including negligence or otherwise arising in any way out of the use of this software even if advised of the possibility of such damage$)', 'g'), 'BSD-3-Clause': new RegExp('(redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution neither the name of(.*?| )nor the names of the contributors may be used to endorse or promote products derived from this software without specific prior written permission this software is provided by the copyright holders and contributors as is and any express or implied warranties including but not limited to the implied warranties of merchantability and fitness for a particular purpose are disclaimed in no event shall(.*?| )be liable for any direct indirect incidental special exemplary or consequential damages including but not limited to procurement of substitute goods or services loss of use data or profits or business interruption however caused and on any theory of liability whether in contract strict liability or tort including negligence or otherwise arising in any way out of the use of this software even if advised of the possibility of such damage$|(redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution the names of any contributors may not be used to endorse or promote products derived from this software without specific prior written permission this software is provided by the copyright holders and contributors as is and any express or implied warranties including but not limited to the implied warranties of merchantability and fitness for a particular purpose are disclaimed in no event shall the copyright holders and contributors be liable for any direct indirect incidental special exemplary or consequential damages including but not limited to procurement of substitute goods or services loss of use data or profits or business interruption however caused and on any theory of liability whether in contract strict liability or tort including negligence or otherwise arising in any way out of the use of this software even if advised of the possibility of such damage$|redistribution and use in source and binary forms with or without modification are permitted provided that the following conditions are met redistributions of source code must retain the above copyright notice this list of conditions and the following disclaimer redistributions in binary form must reproduce the above copyright notice this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution neither the name(.*?| )nor the names of(.*?| )contributors may be used to endorse or promote products derived from this software without specific prior written permission this software is provided by(.*?| )as is and any express or implied warranties including but not limited to the implied warranties of merchantability and fitness for a particular purpose are disclaimed in no event shall(.*?| )be liable for any direct indirect incidental special exemplary or consequential damages including but not limited to procurement of substitute goods or services loss of use data or profits or business interruption however caused and on any theory of liability whether in contract strict liability or tort including negligence or otherwise arising in any way out of the use of this software even if advised of the possibility of such damage$))', 'g'), - 'MIT': new RegExp('permission is hereby granted free of charge to any person obtaining a copy of this software and associated documentation files the software to deal in the software without restriction including without limitation the rights to use copy modify merge publish distribute sublicense and or sell copies of the software and to permit persons to whom the software is furnished to do so subject to the following conditions the above copyright notice and this permission notice shall be included in all copies or substantial portions of the software the software is provided as is without warranty of any kind express or implied including but not limited to the warranties of merchantability fitness for a particular purpose and noninfringement in no event shall the authors or copyright holders be liable for any claim damages or other liability whether in an action of contract tort or otherwise arising from out of or in connection with the software or the use or other dealings in the software$', 'g'), - 'Unlicense': new RegExp('this is free and unencumbered software released into the public domain anyone is free to copy modify publish use compile sell or distribute this software either in source code form or as a compiled binary for any purpose commercial or non commercial and by any means in jurisdictions that recognize copyright laws the author or authors of this software dedicate any and all copyright interest in the software to the public domain we make this dedication for the benefit of the public at large and to the detriment of our heirs and successors we intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law the software is provided as is without warranty of any kind express or implied including but not limited to the warranties of merchantability fitness for a particular purpose and noninfringement in no event shall the authors be liable for any claim damages or other liability whether in an action of contract tort or otherwise arising from out of or in connection with the software or the use or other dealings in the software for more information please refer to wildcard$', 'g') + MIT: new RegExp('permission is hereby granted free of charge to any person obtaining a copy of this software and associated documentation files the software to deal in the software without restriction including without limitation the rights to use copy modify merge publish distribute sublicense and or sell copies of the software and to permit persons to whom the software is furnished to do so subject to the following conditions the above copyright notice and this permission notice shall be included in all copies or substantial portions of the software the software is provided as is without warranty of any kind express or implied including but not limited to the warranties of merchantability fitness for a particular purpose and noninfringement in no event shall the authors or copyright holders be liable for any claim damages or other liability whether in an action of contract tort or otherwise arising from out of or in connection with the software or the use or other dealings in the software$', 'g'), + Unlicense: new RegExp('this is free and unencumbered software released into the public domain anyone is free to copy modify publish use compile sell or distribute this software either in source code form or as a compiled binary for any purpose commercial or non commercial and by any means in jurisdictions that recognize copyright laws the author or authors of this software dedicate any and all copyright interest in the software to the public domain we make this dedication for the benefit of the public at large and to the detriment of our heirs and successors we intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law the software is provided as is without warranty of any kind express or implied including but not limited to the warranties of merchantability fitness for a particular purpose and noninfringement in no event shall the authors be liable for any claim damages or other liability whether in an action of contract tort or otherwise arising from out of or in connection with the software or the use or other dealings in the software for more information please refer to wildcard$', 'g') }; /***/ }), -/* 378 */ +/* 387 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79311,29 +81099,29 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.default = { + autohr: 'author', + autor: 'author', + contributers: 'contributors', + depdenencies: 'dependencies', dependancies: 'dependencies', dependecies: 'dependencies', - depdenencies: 'dependencies', - devEependencies: 'devDependencies', depends: 'dependencies', 'dev-dependencies': 'devDependencies', devDependences: 'devDependencies', devDepenencies: 'devDependencies', + devEependencies: 'devDependencies', devdependencies: 'devDependencies', - repostitory: 'repository', - repo: 'repository', - prefereGlobal: 'preferGlobal', - hompage: 'homepage', hampage: 'homepage', - autohr: 'author', - autor: 'author', - contributers: 'contributors', + hompage: 'homepage', + prefereGlobal: 'preferGlobal', publicationConfig: 'publishConfig', + repo: 'repository', + repostitory: 'repository', script: 'scripts' }; /***/ }), -/* 379 */ +/* 388 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79366,7 +81154,7 @@ function parsePackageName(input) { } /***/ }), -/* 380 */ +/* 389 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79380,7 +81168,7 @@ exports.findRc = findRc; var _fs; function _load_fs() { - return _fs = __webpack_require__(5); + return _fs = __webpack_require__(6); } var _path; @@ -79450,7 +81238,7 @@ function findRc(name, parser) { } /***/ }), -/* 381 */ +/* 390 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79473,7 +81261,7 @@ function isRootUser(uid) { } /***/ }), -/* 382 */ +/* 391 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79483,7 +81271,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.satisfiesWithPreleases = satisfiesWithPreleases; -const semver = __webpack_require__(27); +const semver = __webpack_require__(26); /** * Returns whether the given semver version satisfies the given range. Notably this supports @@ -79532,7 +81320,7 @@ function satisfiesWithPreleases(version, range) { } /***/ }), -/* 383 */ +/* 392 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -79541,7 +81329,7 @@ function satisfiesWithPreleases(version, range) { Object.defineProperty(exports, "__esModule", { value: true }); -const invariant = __webpack_require__(7); +const invariant = __webpack_require__(5); const stream = __webpack_require__(14); class ConcatStream extends stream.Transform { @@ -79569,37 +81357,37 @@ class ConcatStream extends stream.Transform { exports.ConcatStream = ConcatStream; /***/ }), -/* 384 */ +/* 393 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(403), __esModule: true }; +module.exports = { "default": __webpack_require__(412), __esModule: true }; /***/ }), -/* 385 */ +/* 394 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(404), __esModule: true }; +module.exports = { "default": __webpack_require__(413), __esModule: true }; /***/ }), -/* 386 */ +/* 395 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(405), __esModule: true }; +module.exports = { "default": __webpack_require__(414), __esModule: true }; /***/ }), -/* 387 */ +/* 396 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(406), __esModule: true }; +module.exports = { "default": __webpack_require__(415), __esModule: true }; /***/ }), -/* 388 */ +/* 397 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = { "default": __webpack_require__(407), __esModule: true }; +module.exports = { "default": __webpack_require__(416), __esModule: true }; /***/ }), -/* 389 */ +/* 398 */ /***/ (function(module, exports) { module.exports = balanced; @@ -79663,10 +81451,10 @@ function range(a, b, str) { /***/ }), -/* 390 */ +/* 399 */ /***/ (function(module, exports, __webpack_require__) { -var DuplexStream = __webpack_require__(572) +var DuplexStream = __webpack_require__(579) , util = __webpack_require__(2) @@ -79868,14 +81656,14 @@ BufferList.prototype.shallowSlice = function shallowSlice (start, end) { , endOffset = this._offset(end) , buffers = this._bufs.slice(startOffset[0], endOffset[0] + 1) - if (startOffset[1] != 0) - buffers[0] = buffers[0].slice(startOffset[1]) - if (endOffset[1] == 0) buffers.pop() else buffers[buffers.length-1] = buffers[buffers.length-1].slice(0, endOffset[1]) + if (startOffset[1] != 0) + buffers[0] = buffers[0].slice(startOffset[1]) + return new BufferList(buffers) } @@ -79949,11 +81737,11 @@ module.exports = BufferList /***/ }), -/* 391 */ +/* 400 */ /***/ (function(module, exports, __webpack_require__) { -var concatMap = __webpack_require__(402); -var balanced = __webpack_require__(389); +var concatMap = __webpack_require__(411); +var balanced = __webpack_require__(398); module.exports = expandTop; @@ -80060,7 +81848,7 @@ function expand(str, isTop) { var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); var isSequence = isNumericSequence || isAlphaSequence; - var isOptions = /^(.*,)+(.+)?$/.test(m.body); + var isOptions = m.body.indexOf(',') >= 0; if (!isSequence && !isOptions) { // {a},b} if (m.post.match(/,.*\}/)) { @@ -80156,7 +81944,7 @@ function expand(str, isTop) { /***/ }), -/* 392 */ +/* 401 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80173,9 +81961,9 @@ function expand(str, isTop) { * Module dependencies */ -var expand = __webpack_require__(453); -var repeat = __webpack_require__(250); -var tokens = __webpack_require__(564); +var expand = __webpack_require__(460); +var repeat = __webpack_require__(255); +var tokens = __webpack_require__(571); /** * Expose `braces` @@ -80562,7 +82350,7 @@ function filter(arr, cb) { /***/ }), -/* 393 */ +/* 402 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80579,7 +82367,7 @@ module.exports = Object.keys(process.binding('natives')).filter(function (el) { /***/ }), -/* 394 */ +/* 403 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80661,6 +82449,7 @@ function bytes(value, options) { * @param {number} [options.decimalPlaces=2] * @param {number} [options.fixedDecimals=false] * @param {string} [options.thousandsSeparator=] + * @param {string} [options.unit=] * @param {string} [options.unitSeparator=] * * @returns {string|null} @@ -80677,16 +82466,20 @@ function format(value, options) { var unitSeparator = (options && options.unitSeparator) || ''; var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; var fixedDecimals = Boolean(options && options.fixedDecimals); - var unit = 'B'; - - if (mag >= map.tb) { - unit = 'TB'; - } else if (mag >= map.gb) { - unit = 'GB'; - } else if (mag >= map.mb) { - unit = 'MB'; - } else if (mag >= map.kb) { - unit = 'kB'; + var unit = (options && options.unit) || ''; + + if (!unit || !map[unit.toLowerCase()]) { + if (mag >= map.tb) { + unit = 'TB'; + } else if (mag >= map.gb) { + unit = 'GB'; + } else if (mag >= map.mb) { + unit = 'MB'; + } else if (mag >= map.kb) { + unit = 'kB'; + } else { + unit = 'B'; + } } var val = value / map[unit.toLowerCase()]; @@ -80743,7 +82536,7 @@ function parse(val) { /***/ }), -/* 395 */ +/* 404 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80755,15 +82548,15 @@ function preserveCamelCase(str) { let isLastLastCharUpper = false; for (let i = 0; i < str.length; i++) { - const c = str.charAt(i); + const c = str[i]; - if (isLastCharLower && (/[a-zA-Z]/).test(c) && c.toUpperCase() === c) { + if (isLastCharLower && /[a-zA-Z]/.test(c) && c.toUpperCase() === c) { str = str.substr(0, i) + '-' + str.substr(i); isLastCharLower = false; isLastLastCharUpper = isLastCharUpper; isLastCharUpper = true; i++; - } else if (isLastCharUpper && isLastLastCharUpper && (/[a-zA-Z]/).test(c) && c.toLowerCase() === c) { + } else if (isLastCharUpper && isLastLastCharUpper && /[a-zA-Z]/.test(c) && c.toLowerCase() === c) { str = str.substr(0, i - 1) + '-' + str.substr(i - 1); isLastLastCharUpper = isLastCharUpper; isLastCharUpper = false; @@ -80778,8 +82571,15 @@ function preserveCamelCase(str) { return str; } -module.exports = function () { - let str = [].map.call(arguments, x => x.trim()).filter(x => x.length).join('-'); +module.exports = function (str) { + if (arguments.length > 1) { + str = Array.from(arguments) + .map(x => x.trim()) + .filter(x => x.length) + .join('-'); + } else { + str = str.trim(); + } if (str.length === 0) { return ''; @@ -80789,7 +82589,15 @@ module.exports = function () { return str.toLowerCase(); } - str = preserveCamelCase(str); + if (/^[a-z0-9]+$/.test(str)) { + return str; + } + + const hasUpperCase = str !== str.toLowerCase(); + + if (hasUpperCase) { + str = preserveCamelCase(str); + } return str .replace(/^[_.\- ]+/, '') @@ -80799,7 +82607,7 @@ module.exports = function () { /***/ }), -/* 396 */ +/* 405 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80856,13 +82664,13 @@ module.exports = (function () { /***/ }), -/* 397 */ +/* 406 */ /***/ (function(module, exports, __webpack_require__) { module.exports = chownr chownr.sync = chownrSync -var fs = __webpack_require__(5) +var fs = __webpack_require__(6) , path = __webpack_require__(1) function chownr (p, uid, gid, cb) { @@ -80914,7 +82722,7 @@ function chownrSync (p, uid, gid) { /***/ }), -/* 398 */ +/* 407 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80968,7 +82776,7 @@ exports.isCI = !!( /***/ }), -/* 399 */ +/* 408 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -80980,7 +82788,7 @@ function normalizeOpts(options) { var defaultOpts = { defaultWidth: 0, output: process.stdout, - tty: __webpack_require__(110) + tty: __webpack_require__(116) }; if (!options) { return defaultOpts; @@ -81024,7 +82832,7 @@ function cliWidth(options) { /***/ }), -/* 400 */ +/* 409 */ /***/ (function(module, exports, __webpack_require__) { // On windows, create a .cmd file. @@ -81040,9 +82848,9 @@ function cliWidth(options) { module.exports = cmdShim cmdShim.ifExists = cmdShimIfExists -var fs = __webpack_require__(233) +var fs = __webpack_require__(235) -var mkdir = __webpack_require__(154) +var mkdir = __webpack_require__(156) , path = __webpack_require__(1) , shebangExpr = /^#\!\s*(?:\/usr\/bin\/env)?\s*([^ \t]+)(.*)$/ @@ -81210,20 +83018,20 @@ function times(n, ok, cb) { /***/ }), -/* 401 */ +/* 410 */ /***/ (function(module, exports, __webpack_require__) { /** * Module dependencies. */ -var EventEmitter = __webpack_require__(34).EventEmitter; -var spawn = __webpack_require__(105).spawn; -var readlink = __webpack_require__(473).readlinkSync; +var EventEmitter = __webpack_require__(49).EventEmitter; +var spawn = __webpack_require__(111).spawn; +var readlink = __webpack_require__(480).readlinkSync; var path = __webpack_require__(1); var dirname = path.dirname; var basename = path.basename; -var fs = __webpack_require__(5); +var fs = __webpack_require__(6); /** * Expose the root command. @@ -82326,7 +84134,7 @@ function exists(file) { /***/ }), -/* 402 */ +/* 411 */ /***/ (function(module, exports) { module.exports = function (xs, fn) { @@ -82345,54 +84153,54 @@ var isArray = Array.isArray || function (xs) { /***/ }), -/* 403 */ +/* 412 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(88); -__webpack_require__(434); +__webpack_require__(92); +__webpack_require__(443); module.exports = __webpack_require__(31).Array.from; /***/ }), -/* 404 */ +/* 413 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(140); -__webpack_require__(88); -module.exports = __webpack_require__(432); +__webpack_require__(143); +__webpack_require__(92); +module.exports = __webpack_require__(441); /***/ }), -/* 405 */ +/* 414 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(140); -__webpack_require__(88); -module.exports = __webpack_require__(433); +__webpack_require__(143); +__webpack_require__(92); +module.exports = __webpack_require__(442); /***/ }), -/* 406 */ +/* 415 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(436); +__webpack_require__(445); module.exports = __webpack_require__(31).Object.assign; /***/ }), -/* 407 */ +/* 416 */ /***/ (function(module, exports, __webpack_require__) { -__webpack_require__(437); -__webpack_require__(88); -__webpack_require__(140); -__webpack_require__(438); +__webpack_require__(446); +__webpack_require__(92); +__webpack_require__(143); +__webpack_require__(447); module.exports = __webpack_require__(31).Promise; /***/ }), -/* 408 */ +/* 417 */ /***/ (function(module, exports) { module.exports = function(){ /* empty */ }; /***/ }), -/* 409 */ +/* 418 */ /***/ (function(module, exports) { module.exports = function(it, Constructor, name, forbiddenField){ @@ -82402,14 +84210,14 @@ module.exports = function(it, Constructor, name, forbiddenField){ }; /***/ }), -/* 410 */ +/* 419 */ /***/ (function(module, exports, __webpack_require__) { // false -> Array#indexOf // true -> Array#includes -var toIObject = __webpack_require__(136) - , toLength = __webpack_require__(137) - , toIndex = __webpack_require__(430); +var toIObject = __webpack_require__(139) + , toLength = __webpack_require__(140) + , toIndex = __webpack_require__(439); module.exports = function(IS_INCLUDES){ return function($this, el, fromIndex){ var O = toIObject($this) @@ -82428,13 +84236,13 @@ module.exports = function(IS_INCLUDES){ }; /***/ }), -/* 411 */ +/* 420 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var $defineProperty = __webpack_require__(65) - , createDesc = __webpack_require__(132); +var $defineProperty = __webpack_require__(70) + , createDesc = __webpack_require__(135); module.exports = function(object, index, value){ if(index in object)$defineProperty.f(object, index, createDesc(0, value)); @@ -82442,15 +84250,15 @@ module.exports = function(object, index, value){ }; /***/ }), -/* 412 */ +/* 421 */ /***/ (function(module, exports, __webpack_require__) { -var ctx = __webpack_require__(63) - , call = __webpack_require__(216) - , isArrayIter = __webpack_require__(215) - , anObject = __webpack_require__(44) - , toLength = __webpack_require__(137) - , getIterFn = __webpack_require__(139) +var ctx = __webpack_require__(68) + , call = __webpack_require__(217) + , isArrayIter = __webpack_require__(216) + , anObject = __webpack_require__(46) + , toLength = __webpack_require__(140) + , getIterFn = __webpack_require__(142) , BREAK = {} , RETURN = {}; var exports = module.exports = function(iterable, entries, fn, that, ITERATOR){ @@ -82472,15 +84280,15 @@ exports.BREAK = BREAK; exports.RETURN = RETURN; /***/ }), -/* 413 */ +/* 422 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = !__webpack_require__(64) && !__webpack_require__(131)(function(){ - return Object.defineProperty(__webpack_require__(130)('div'), 'a', {get: function(){ return 7; }}).a != 7; +module.exports = !__webpack_require__(69) && !__webpack_require__(134)(function(){ + return Object.defineProperty(__webpack_require__(133)('div'), 'a', {get: function(){ return 7; }}).a != 7; }); /***/ }), -/* 414 */ +/* 423 */ /***/ (function(module, exports) { // fast apply, http://jsperf.lnkit.com/fast-apply/5 @@ -82501,18 +84309,18 @@ module.exports = function(fn, args, that){ }; /***/ }), -/* 415 */ +/* 424 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var create = __webpack_require__(419) - , descriptor = __webpack_require__(132) - , setToStringTag = __webpack_require__(133) +var create = __webpack_require__(428) + , descriptor = __webpack_require__(135) + , setToStringTag = __webpack_require__(136) , IteratorPrototype = {}; // 25.1.2.1.1 %IteratorPrototype%[@@iterator]() -__webpack_require__(53)(IteratorPrototype, __webpack_require__(25)('iterator'), function(){ return this; }); +__webpack_require__(54)(IteratorPrototype, __webpack_require__(25)('iterator'), function(){ return this; }); module.exports = function(Constructor, NAME, next){ Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)}); @@ -82520,7 +84328,7 @@ module.exports = function(Constructor, NAME, next){ }; /***/ }), -/* 416 */ +/* 425 */ /***/ (function(module, exports) { module.exports = function(done, value){ @@ -82528,15 +84336,15 @@ module.exports = function(done, value){ }; /***/ }), -/* 417 */ +/* 426 */ /***/ (function(module, exports, __webpack_require__) { -var global = __webpack_require__(28) - , macrotask = __webpack_require__(222).set +var global = __webpack_require__(29) + , macrotask = __webpack_require__(223).set , Observer = global.MutationObserver || global.WebKitMutationObserver , process = global.process , Promise = global.Promise - , isNode = __webpack_require__(84)(process) == 'process'; + , isNode = __webpack_require__(88)(process) == 'process'; module.exports = function(){ var head, last, notify; @@ -82601,21 +84409,21 @@ module.exports = function(){ }; /***/ }), -/* 418 */ +/* 427 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; // 19.1.2.1 Object.assign(target, source, ...) -var getKeys = __webpack_require__(220) - , gOPS = __webpack_require__(421) - , pIE = __webpack_require__(424) - , toObject = __webpack_require__(138) - , IObject = __webpack_require__(214) +var getKeys = __webpack_require__(221) + , gOPS = __webpack_require__(430) + , pIE = __webpack_require__(433) + , toObject = __webpack_require__(141) + , IObject = __webpack_require__(215) , $assign = Object.assign; // should work with symbols and should have deterministic property order (V8 bug) -module.exports = !$assign || __webpack_require__(131)(function(){ +module.exports = !$assign || __webpack_require__(134)(function(){ var A = {} , B = {} , S = Symbol() @@ -82640,27 +84448,27 @@ module.exports = !$assign || __webpack_require__(131)(function(){ } : $assign; /***/ }), -/* 419 */ +/* 428 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties]) -var anObject = __webpack_require__(44) - , dPs = __webpack_require__(420) - , enumBugKeys = __webpack_require__(212) - , IE_PROTO = __webpack_require__(134)('IE_PROTO') +var anObject = __webpack_require__(46) + , dPs = __webpack_require__(429) + , enumBugKeys = __webpack_require__(213) + , IE_PROTO = __webpack_require__(137)('IE_PROTO') , Empty = function(){ /* empty */ } , PROTOTYPE = 'prototype'; // Create object with fake `null` prototype: use iframe Object with cleared prototype var createDict = function(){ // Thrash, waste and sodomy: IE GC bug - var iframe = __webpack_require__(130)('iframe') + var iframe = __webpack_require__(133)('iframe') , i = enumBugKeys.length , lt = '<' , gt = '>' , iframeDocument; iframe.style.display = 'none'; - __webpack_require__(213).appendChild(iframe); + __webpack_require__(214).appendChild(iframe); iframe.src = 'javascript:'; // eslint-disable-line no-script-url // createDict = iframe.contentWindow.Object; // html.removeChild(iframe); @@ -82687,14 +84495,14 @@ module.exports = Object.create || function create(O, Properties){ /***/ }), -/* 420 */ +/* 429 */ /***/ (function(module, exports, __webpack_require__) { -var dP = __webpack_require__(65) - , anObject = __webpack_require__(44) - , getKeys = __webpack_require__(220); +var dP = __webpack_require__(70) + , anObject = __webpack_require__(46) + , getKeys = __webpack_require__(221); -module.exports = __webpack_require__(64) ? Object.defineProperties : function defineProperties(O, Properties){ +module.exports = __webpack_require__(69) ? Object.defineProperties : function defineProperties(O, Properties){ anObject(O); var keys = getKeys(Properties) , length = keys.length @@ -82705,19 +84513,19 @@ module.exports = __webpack_require__(64) ? Object.defineProperties : function de }; /***/ }), -/* 421 */ +/* 430 */ /***/ (function(module, exports) { exports.f = Object.getOwnPropertySymbols; /***/ }), -/* 422 */ +/* 431 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O) -var has = __webpack_require__(86) - , toObject = __webpack_require__(138) - , IE_PROTO = __webpack_require__(134)('IE_PROTO') +var has = __webpack_require__(90) + , toObject = __webpack_require__(141) + , IE_PROTO = __webpack_require__(137)('IE_PROTO') , ObjectProto = Object.prototype; module.exports = Object.getPrototypeOf || function(O){ @@ -82729,13 +84537,13 @@ module.exports = Object.getPrototypeOf || function(O){ }; /***/ }), -/* 423 */ +/* 432 */ /***/ (function(module, exports, __webpack_require__) { -var has = __webpack_require__(86) - , toIObject = __webpack_require__(136) - , arrayIndexOf = __webpack_require__(410)(false) - , IE_PROTO = __webpack_require__(134)('IE_PROTO'); +var has = __webpack_require__(90) + , toIObject = __webpack_require__(139) + , arrayIndexOf = __webpack_require__(419)(false) + , IE_PROTO = __webpack_require__(137)('IE_PROTO'); module.exports = function(object, names){ var O = toIObject(object) @@ -82751,16 +84559,16 @@ module.exports = function(object, names){ }; /***/ }), -/* 424 */ +/* 433 */ /***/ (function(module, exports) { exports.f = {}.propertyIsEnumerable; /***/ }), -/* 425 */ +/* 434 */ /***/ (function(module, exports, __webpack_require__) { -var hide = __webpack_require__(53); +var hide = __webpack_require__(54); module.exports = function(target, src, safe){ for(var key in src){ if(safe && target[key])target[key] = src[key]; @@ -82769,21 +84577,21 @@ module.exports = function(target, src, safe){ }; /***/ }), -/* 426 */ +/* 435 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(53); +module.exports = __webpack_require__(54); /***/ }), -/* 427 */ +/* 436 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var global = __webpack_require__(28) +var global = __webpack_require__(29) , core = __webpack_require__(31) - , dP = __webpack_require__(65) - , DESCRIPTORS = __webpack_require__(64) + , dP = __webpack_require__(70) + , DESCRIPTORS = __webpack_require__(69) , SPECIES = __webpack_require__(25)('species'); module.exports = function(KEY){ @@ -82795,12 +84603,12 @@ module.exports = function(KEY){ }; /***/ }), -/* 428 */ +/* 437 */ /***/ (function(module, exports, __webpack_require__) { // 7.3.20 SpeciesConstructor(O, defaultConstructor) -var anObject = __webpack_require__(44) - , aFunction = __webpack_require__(127) +var anObject = __webpack_require__(46) + , aFunction = __webpack_require__(130) , SPECIES = __webpack_require__(25)('species'); module.exports = function(O, D){ var C = anObject(O).constructor, S; @@ -82808,11 +84616,11 @@ module.exports = function(O, D){ }; /***/ }), -/* 429 */ +/* 438 */ /***/ (function(module, exports, __webpack_require__) { -var toInteger = __webpack_require__(135) - , defined = __webpack_require__(129); +var toInteger = __webpack_require__(138) + , defined = __webpack_require__(132); // true -> String#at // false -> String#codePointAt module.exports = function(TO_STRING){ @@ -82830,10 +84638,10 @@ module.exports = function(TO_STRING){ }; /***/ }), -/* 430 */ +/* 439 */ /***/ (function(module, exports, __webpack_require__) { -var toInteger = __webpack_require__(135) +var toInteger = __webpack_require__(138) , max = Math.max , min = Math.min; module.exports = function(index, length){ @@ -82842,11 +84650,11 @@ module.exports = function(index, length){ }; /***/ }), -/* 431 */ +/* 440 */ /***/ (function(module, exports, __webpack_require__) { // 7.1.1 ToPrimitive(input [, PreferredType]) -var isObject = __webpack_require__(87); +var isObject = __webpack_require__(91); // instead of the ES6 spec version, we didn't implement @@toPrimitive case // and the second argument - flag - preferred type is a string module.exports = function(it, S){ @@ -82859,11 +84667,11 @@ module.exports = function(it, S){ }; /***/ }), -/* 432 */ +/* 441 */ /***/ (function(module, exports, __webpack_require__) { -var anObject = __webpack_require__(44) - , get = __webpack_require__(139); +var anObject = __webpack_require__(46) + , get = __webpack_require__(142); module.exports = __webpack_require__(31).getIterator = function(it){ var iterFn = get(it); if(typeof iterFn != 'function')throw TypeError(it + ' is not iterable!'); @@ -82871,12 +84679,12 @@ module.exports = __webpack_require__(31).getIterator = function(it){ }; /***/ }), -/* 433 */ +/* 442 */ /***/ (function(module, exports, __webpack_require__) { -var classof = __webpack_require__(128) +var classof = __webpack_require__(131) , ITERATOR = __webpack_require__(25)('iterator') - , Iterators = __webpack_require__(54); + , Iterators = __webpack_require__(55); module.exports = __webpack_require__(31).isIterable = function(it){ var O = Object(it); return O[ITERATOR] !== undefined @@ -82885,21 +84693,21 @@ module.exports = __webpack_require__(31).isIterable = function(it){ }; /***/ }), -/* 434 */ +/* 443 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var ctx = __webpack_require__(63) - , $export = __webpack_require__(85) - , toObject = __webpack_require__(138) - , call = __webpack_require__(216) - , isArrayIter = __webpack_require__(215) - , toLength = __webpack_require__(137) - , createProperty = __webpack_require__(411) - , getIterFn = __webpack_require__(139); +var ctx = __webpack_require__(68) + , $export = __webpack_require__(89) + , toObject = __webpack_require__(141) + , call = __webpack_require__(217) + , isArrayIter = __webpack_require__(216) + , toLength = __webpack_require__(140) + , createProperty = __webpack_require__(420) + , getIterFn = __webpack_require__(142); -$export($export.S + $export.F * !__webpack_require__(218)(function(iter){ Array.from(iter); }), 'Array', { +$export($export.S + $export.F * !__webpack_require__(219)(function(iter){ Array.from(iter); }), 'Array', { // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined) from: function from(arrayLike/*, mapfn = undefined, thisArg = undefined*/){ var O = toObject(arrayLike) @@ -82929,21 +84737,21 @@ $export($export.S + $export.F * !__webpack_require__(218)(function(iter){ Array. /***/ }), -/* 435 */ +/* 444 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var addToUnscopables = __webpack_require__(408) - , step = __webpack_require__(416) - , Iterators = __webpack_require__(54) - , toIObject = __webpack_require__(136); +var addToUnscopables = __webpack_require__(417) + , step = __webpack_require__(425) + , Iterators = __webpack_require__(55) + , toIObject = __webpack_require__(139); // 22.1.3.4 Array.prototype.entries() // 22.1.3.13 Array.prototype.keys() // 22.1.3.29 Array.prototype.values() // 22.1.3.30 Array.prototype[@@iterator]() -module.exports = __webpack_require__(217)(Array, 'Array', function(iterated, kind){ +module.exports = __webpack_require__(218)(Array, 'Array', function(iterated, kind){ this._t = toIObject(iterated); // target this._i = 0; // next index this._k = kind; // kind @@ -82969,38 +84777,38 @@ addToUnscopables('values'); addToUnscopables('entries'); /***/ }), -/* 436 */ +/* 445 */ /***/ (function(module, exports, __webpack_require__) { // 19.1.3.1 Object.assign(target, source) -var $export = __webpack_require__(85); +var $export = __webpack_require__(89); -$export($export.S + $export.F, 'Object', {assign: __webpack_require__(418)}); +$export($export.S + $export.F, 'Object', {assign: __webpack_require__(427)}); /***/ }), -/* 437 */ +/* 446 */ /***/ (function(module, exports) { /***/ }), -/* 438 */ +/* 447 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var LIBRARY = __webpack_require__(219) - , global = __webpack_require__(28) - , ctx = __webpack_require__(63) - , classof = __webpack_require__(128) - , $export = __webpack_require__(85) - , isObject = __webpack_require__(87) - , aFunction = __webpack_require__(127) - , anInstance = __webpack_require__(409) - , forOf = __webpack_require__(412) - , speciesConstructor = __webpack_require__(428) - , task = __webpack_require__(222).set - , microtask = __webpack_require__(417)() +var LIBRARY = __webpack_require__(220) + , global = __webpack_require__(29) + , ctx = __webpack_require__(68) + , classof = __webpack_require__(131) + , $export = __webpack_require__(89) + , isObject = __webpack_require__(91) + , aFunction = __webpack_require__(130) + , anInstance = __webpack_require__(418) + , forOf = __webpack_require__(421) + , speciesConstructor = __webpack_require__(437) + , task = __webpack_require__(223).set + , microtask = __webpack_require__(426)() , PROMISE = 'Promise' , TypeError = global.TypeError , process = global.process @@ -83192,7 +85000,7 @@ if(!USE_NATIVE){ this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled this._n = false; // <- notify }; - Internal.prototype = __webpack_require__(425)($Promise.prototype, { + Internal.prototype = __webpack_require__(434)($Promise.prototype, { // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected) then: function then(onFulfilled, onRejected){ var reaction = newPromiseCapability(speciesConstructor(this, $Promise)); @@ -83218,8 +85026,8 @@ if(!USE_NATIVE){ } $export($export.G + $export.W + $export.F * !USE_NATIVE, {Promise: $Promise}); -__webpack_require__(133)($Promise, PROMISE); -__webpack_require__(427)(PROMISE); +__webpack_require__(136)($Promise, PROMISE); +__webpack_require__(436)(PROMISE); Wrapper = __webpack_require__(31)[PROMISE]; // statics @@ -83243,7 +85051,7 @@ $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, { return capability.promise; } }); -$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(218)(function(iter){ +$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(219)(function(iter){ $Promise.all(iter)['catch'](empty); })), PROMISE, { // 25.4.4.1 Promise.all(iterable) @@ -83289,12 +85097,12 @@ $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(218)(functio }); /***/ }), -/* 439 */ +/* 448 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var arrayFindIndex = __webpack_require__(312); +var arrayFindIndex = __webpack_require__(317); module.exports = function () { var unhandledRejections = []; @@ -83329,12 +85137,12 @@ module.exports = function () { /***/ }), -/* 440 */ +/* 449 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var core = __webpack_require__(439); +var core = __webpack_require__(448); module.exports = function (p) { p = p || process; @@ -83348,7 +85156,7 @@ module.exports = function (p) { /***/ }), -/* 441 */ +/* 450 */ /***/ (function(module, exports) { @@ -83419,7 +85227,7 @@ module.exports = function (arg) { /***/ }), -/* 442 */ +/* 451 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83428,7 +85236,7 @@ module.exports = function (arg) { * Expose `debug()` as the module. */ -exports = module.exports = __webpack_require__(225); +exports = module.exports = __webpack_require__(226); exports.log = log; exports.formatArgs = formatArgs; exports.save = save; @@ -83464,20 +85272,20 @@ function useColors() { // NB: In an Electron preload script, document will be defined but not fully // initialized. Since we know we're in Chrome, we'll just detect this case // explicitly - if (typeof window !== 'undefined' && window && typeof window.process !== 'undefined' && window.process.type === 'renderer') { + if (typeof window !== 'undefined' && window.process && window.process.type === 'renderer') { return true; } // is webkit? http://stackoverflow.com/a/16459606/376773 // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return (typeof document !== 'undefined' && document && 'WebkitAppearance' in document.documentElement.style) || + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || // is firebug? http://stackoverflow.com/a/398120/376773 - (typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) || + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || // is firefox >= v31? // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || // double check webkit in userAgent just in case we are in a worker - (typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); } /** @@ -83572,14 +85380,17 @@ function save(namespaces) { */ function load() { + var r; try { - return exports.storage.debug; + r = exports.storage.debug; } catch(e) {} // If debug isn't set in LS, and we're in Electron, try to load $DEBUG - if (typeof process !== 'undefined' && 'env' in process) { - return process.env.DEBUG; + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; } + + return r; } /** @@ -83607,7 +85418,7 @@ function localstorage() { /***/ }), -/* 443 */ +/* 452 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -83616,21 +85427,21 @@ function localstorage() { */ if (typeof process !== 'undefined' && process.type === 'renderer') { - module.exports = __webpack_require__(442); + module.exports = __webpack_require__(451); } else { - module.exports = __webpack_require__(444); + module.exports = __webpack_require__(453); } /***/ }), -/* 444 */ +/* 453 */ /***/ (function(module, exports, __webpack_require__) { /** * Module dependencies. */ -var tty = __webpack_require__(110); +var tty = __webpack_require__(116); var util = __webpack_require__(2); /** @@ -83639,7 +85450,7 @@ var util = __webpack_require__(2); * Expose `debug()` as the module. */ -exports = module.exports = __webpack_require__(225); +exports = module.exports = __webpack_require__(226); exports.init = init; exports.log = log; exports.formatArgs = formatArgs; @@ -83666,7 +85477,7 @@ exports.inspectOpts = Object.keys(process.env).filter(function (key) { var prop = key .substring(6) .toLowerCase() - .replace(/_([a-z])/, function (_, k) { return k.toUpperCase() }); + .replace(/_([a-z])/g, function (_, k) { return k.toUpperCase() }); // coerce string value into JS value var val = process.env[key]; @@ -83809,14 +85620,14 @@ function createWritableStdioStream (fd) { break; case 'FILE': - var fs = __webpack_require__(5); + var fs = __webpack_require__(6); stream = new fs.SyncWriteStream(fd, { autoClose: false }); stream._type = 'fs'; break; case 'PIPE': case 'TCP': - var net = __webpack_require__(74); + var net = __webpack_require__(77); stream = new net.Socket({ fd: fd, readable: false, @@ -83859,7 +85670,12 @@ function createWritableStdioStream (fd) { */ function init (debug) { - debug.inspectOpts = util._extend({}, exports.inspectOpts); + debug.inspectOpts = {}; + + var keys = Object.keys(exports.inspectOpts); + for (var i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } } /** @@ -83870,7 +85686,7 @@ exports.enable(load()); /***/ }), -/* 445 */ +/* 454 */ /***/ (function(module, exports, __webpack_require__) { var Stream = __webpack_require__(14).Stream; @@ -83983,7 +85799,7 @@ DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { /***/ }), -/* 446 */ +/* 455 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84112,10 +85928,10 @@ module.exports = str => { /***/ }), -/* 447 */ +/* 456 */ /***/ (function(module, exports, __webpack_require__) { -var once = __webpack_require__(448); +var once = __webpack_require__(457); var noop = function() {}; @@ -84189,10 +86005,10 @@ var eos = function(stream, opts, callback) { module.exports = eos; /***/ }), -/* 448 */ +/* 457 */ /***/ (function(module, exports, __webpack_require__) { -var wrappy = __webpack_require__(104) +var wrappy = __webpack_require__(163) module.exports = wrappy(once) once.proto = once(function () { @@ -84216,77 +86032,14 @@ function once (fn) { /***/ }), -/* 449 */ -/***/ (function(module, exports, __webpack_require__) { - -var crypto = __webpack_require__(6); -var BigInteger = __webpack_require__(45).BigInteger; -var ECPointFp = __webpack_require__(141).ECPointFp; -exports.ECCurves = __webpack_require__(450); - -// zero prepad -function unstupid(hex,len) -{ - return (hex.length >= len) ? hex : unstupid("0"+hex,len); -} - -exports.ECKey = function(curve, key, isPublic) -{ - var priv; - var c = curve(); - var n = c.getN(); - var bytes = Math.floor(n.bitLength()/8); - - if(key) - { - if(isPublic) - { - var curve = c.getCurve(); -// var x = key.slice(1,bytes+1); // skip the 04 for uncompressed format -// var y = key.slice(bytes+1); -// this.P = new ECPointFp(curve, -// curve.fromBigInteger(new BigInteger(x.toString("hex"), 16)), -// curve.fromBigInteger(new BigInteger(y.toString("hex"), 16))); - this.P = curve.decodePointHex(key.toString("hex")); - }else{ - if(key.length != bytes) return false; - priv = new BigInteger(key.toString("hex"), 16); - } - }else{ - var n1 = n.subtract(BigInteger.ONE); - var r = new BigInteger(crypto.randomBytes(n.bitLength())); - priv = r.mod(n1).add(BigInteger.ONE); - this.P = c.getG().multiply(priv); - } - if(this.P) - { -// var pubhex = unstupid(this.P.getX().toBigInteger().toString(16),bytes*2)+unstupid(this.P.getY().toBigInteger().toString(16),bytes*2); -// this.PublicKey = new Buffer("04"+pubhex,"hex"); - this.PublicKey = new Buffer(c.getCurve().encodeCompressedPointHex(this.P),"hex"); - } - if(priv) - { - this.PrivateKey = new Buffer(unstupid(priv.toString(16),bytes*2),"hex"); - this.deriveSharedSecret = function(key) - { - if(!key || !key.P) return false; - var S = key.P.multiply(priv); - return new Buffer(unstupid(S.getX().toBigInteger().toString(16),bytes*2),"hex"); - } - } -} - - - -/***/ }), -/* 450 */ +/* 458 */ /***/ (function(module, exports, __webpack_require__) { // Named EC curves // Requires ec.js, jsbn.js, and jsbn2.js -var BigInteger = __webpack_require__(45).BigInteger -var ECCurveFp = __webpack_require__(141).ECCurveFp +var BigInteger = __webpack_require__(39).BigInteger +var ECCurveFp = __webpack_require__(93).ECCurveFp // ---------------- @@ -84455,34 +86208,7 @@ module.exports = { /***/ }), -/* 451 */ -/***/ (function(module, exports, __webpack_require__) { - -var wrappy = __webpack_require__(104) -module.exports = wrappy(once) - -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) -}) - -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} - - -/***/ }), -/* 452 */ +/* 459 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84495,7 +86221,7 @@ function once (fn) { -var isPosixBracket = __webpack_require__(532); +var isPosixBracket = __webpack_require__(539); /** * POSIX character classes @@ -84652,7 +86378,7 @@ brackets.match = function(arr, pattern) { /***/ }), -/* 453 */ +/* 460 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -84665,7 +86391,7 @@ brackets.match = function(arr, pattern) { -var fill = __webpack_require__(461); +var fill = __webpack_require__(468); module.exports = function expandRange(str, options, fn) { if (typeof str !== 'string') { @@ -84702,7 +86428,7 @@ module.exports = function expandRange(str, options, fn) { /***/ }), -/* 454 */ +/* 461 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.0 @@ -84737,7 +86463,7 @@ module.exports = function expandRange(str, options, fn) { /***/ }), -/* 455 */ +/* 462 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.0 @@ -84772,7 +86498,7 @@ module.exports = function expandRange(str, options, fn) { /***/ }), -/* 456 */ +/* 463 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.0 @@ -84807,7 +86533,7 @@ module.exports = function expandRange(str, options, fn) { /***/ }), -/* 457 */ +/* 464 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.12.0 @@ -84842,7 +86568,7 @@ module.exports = function expandRange(str, options, fn) { /***/ }), -/* 458 */ +/* 465 */ /***/ (function(module, exports, __webpack_require__) { // Generated by CoffeeScript 1.12.0 @@ -84857,21 +86583,21 @@ module.exports = function expandRange(str, options, fn) { var CreateFileError, ExternalEditor, FS, LaunchEditorError, ReadFileError, RemoveFileError, Spawn, SpawnSync, Temp, bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; - FS = __webpack_require__(5); + FS = __webpack_require__(6); - Temp = __webpack_require__(619); + Temp = __webpack_require__(626); - SpawnSync = __webpack_require__(105).spawnSync; + SpawnSync = __webpack_require__(111).spawnSync; - Spawn = __webpack_require__(105).spawn; + Spawn = __webpack_require__(111).spawn; - CreateFileError = __webpack_require__(454); + CreateFileError = __webpack_require__(461); - ReadFileError = __webpack_require__(456); + ReadFileError = __webpack_require__(463); - RemoveFileError = __webpack_require__(457); + RemoveFileError = __webpack_require__(464); - LaunchEditorError = __webpack_require__(455); + LaunchEditorError = __webpack_require__(462); ExternalEditor = (function() { ExternalEditor.edit = function(text) { @@ -85056,7 +86782,7 @@ module.exports = function expandRange(str, options, fn) { /***/ }), -/* 459 */ +/* 466 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85073,7 +86799,7 @@ module.exports = function expandRange(str, options, fn) { * Module dependencies */ -var isExtglob = __webpack_require__(95); +var isExtglob = __webpack_require__(100); var re, cache = {}; /** @@ -85241,7 +86967,7 @@ function toRegex(pattern, contains, isNegated) { /***/ }), -/* 460 */ +/* 467 */ /***/ (function(module, exports) { /*! @@ -85257,7 +86983,7 @@ module.exports = function filenameRegex() { /***/ }), -/* 461 */ +/* 468 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85270,11 +86996,11 @@ module.exports = function filenameRegex() { -var isObject = __webpack_require__(535); -var isNumber = __webpack_require__(236); -var randomize = __webpack_require__(570); -var repeatStr = __webpack_require__(577); -var repeat = __webpack_require__(250); +var isObject = __webpack_require__(542); +var isNumber = __webpack_require__(238); +var randomize = __webpack_require__(577); +var repeatStr = __webpack_require__(585); +var repeat = __webpack_require__(255); /** * Expose `fillRange` @@ -85672,7 +87398,7 @@ function length(val) { /***/ }), -/* 462 */ +/* 469 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85695,7 +87421,7 @@ module.exports = function forIn(obj, fn, thisArg) { /***/ }), -/* 463 */ +/* 470 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -85708,7 +87434,7 @@ module.exports = function forIn(obj, fn, thisArg) { -var forIn = __webpack_require__(462); +var forIn = __webpack_require__(469); var hasOwn = Object.prototype.hasOwnProperty; module.exports = function forOwn(obj, fn, thisArg) { @@ -85721,17 +87447,17 @@ module.exports = function forOwn(obj, fn, thisArg) { /***/ }), -/* 464 */ +/* 471 */ /***/ (function(module, exports, __webpack_require__) { module.exports = ForeverAgent ForeverAgent.SSL = ForeverAgentSSL var util = __webpack_require__(2) - , Agent = __webpack_require__(48).Agent - , net = __webpack_require__(74) - , tls = __webpack_require__(275) - , AgentSSL = __webpack_require__(106).Agent + , Agent = __webpack_require__(50).Agent + , net = __webpack_require__(77) + , tls = __webpack_require__(280) + , AgentSSL = __webpack_require__(112).Agent function getConnectionName(host, port) { var name = '' @@ -85865,19 +87591,19 @@ function createConnectionSSL (port, host, options) { /***/ }), -/* 465 */ +/* 472 */ /***/ (function(module, exports, __webpack_require__) { -var CombinedStream = __webpack_require__(211); +var CombinedStream = __webpack_require__(212); var util = __webpack_require__(2); var path = __webpack_require__(1); -var http = __webpack_require__(48); -var https = __webpack_require__(106); +var http = __webpack_require__(50); +var https = __webpack_require__(112); var parseUrl = __webpack_require__(11).parse; -var fs = __webpack_require__(5); -var mime = __webpack_require__(240); -var asynckit = __webpack_require__(317); -var populate = __webpack_require__(466); +var fs = __webpack_require__(6); +var mime = __webpack_require__(242); +var asynckit = __webpack_require__(322); +var populate = __webpack_require__(473); // Public API module.exports = FormData; @@ -86309,9 +88035,13 @@ FormData.prototype._error = function(err) { } }; +FormData.prototype.toString = function () { + return '[object FormData]'; +}; + /***/ }), -/* 466 */ +/* 473 */ /***/ (function(module, exports) { // populates missing values @@ -86327,7 +88057,7 @@ module.exports = function(dst, src) { /***/ }), -/* 467 */ +/* 474 */ /***/ (function(module, exports, __webpack_require__) { // Copyright Joyent, Inc. and other Node contributors. @@ -86353,7 +88083,7 @@ module.exports = function(dst, src) { var pathModule = __webpack_require__(1); var isWindows = process.platform === 'win32'; -var fs = __webpack_require__(5); +var fs = __webpack_require__(6); // JavaScript implementation of realpath, ported from node pre-v6 @@ -86636,7 +88366,7 @@ exports.realpath = function realpath(p, cache, cb) { /***/ }), -/* 468 */ +/* 475 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -86650,8 +88380,8 @@ exports.realpath = function realpath(p, cache, cb) { var path = __webpack_require__(1); -var parent = __webpack_require__(469); -var isGlob = __webpack_require__(96); +var parent = __webpack_require__(476); +var isGlob = __webpack_require__(101); module.exports = function globBase(pattern) { if (typeof pattern !== 'string') { @@ -86694,14 +88424,14 @@ function dirname(glob) { /***/ }), -/* 469 */ +/* 476 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var path = __webpack_require__(1); -var isglob = __webpack_require__(96); +var isglob = __webpack_require__(101); module.exports = function globParent(str) { str += 'a'; // preserves full path in case of trailing path separator @@ -86711,22 +88441,22 @@ module.exports = function globParent(str) { /***/ }), -/* 470 */ +/* 477 */ /***/ (function(module, exports, __webpack_require__) { module.exports = globSync globSync.GlobSync = GlobSync -var fs = __webpack_require__(5) -var rp = __webpack_require__(230) -var minimatch = __webpack_require__(153) +var fs = __webpack_require__(6) +var rp = __webpack_require__(232) +var minimatch = __webpack_require__(155) var Minimatch = minimatch.Minimatch -var Glob = __webpack_require__(144).Glob +var Glob = __webpack_require__(146).Glob var util = __webpack_require__(2) var path = __webpack_require__(1) var assert = __webpack_require__(22) -var isAbsolute = __webpack_require__(156) -var common = __webpack_require__(231) +var isAbsolute = __webpack_require__(157) +var common = __webpack_require__(233) var alphasort = common.alphasort var alphasorti = common.alphasorti var setopts = common.setopts @@ -87203,7 +88933,7 @@ GlobSync.prototype._makeAbs = function (f) { /***/ }), -/* 471 */ +/* 478 */ /***/ (function(module, exports, __webpack_require__) { var Stream = __webpack_require__(14).Stream @@ -87327,11 +89057,11 @@ function legacy (fs) { /***/ }), -/* 472 */ +/* 479 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(232) -var constants = __webpack_require__(273) +var fs = __webpack_require__(234) +var constants = __webpack_require__(278) var origCwd = process.cwd var cwd = null @@ -87663,10 +89393,10 @@ function chownErOk (er) { /***/ }), -/* 473 */ +/* 480 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(5) +var fs = __webpack_require__(6) , lstat = fs.lstatSync; exports.readlinkSync = function (p) { @@ -87681,15 +89411,15 @@ exports.readlinkSync = function (p) { /***/ }), -/* 474 */ +/* 481 */ /***/ (function(module, exports, __webpack_require__) { var zlib = __webpack_require__(165) -var peek = __webpack_require__(562) -var through = __webpack_require__(264) -var pumpify = __webpack_require__(567) -var isGzip = __webpack_require__(531) -var isDeflate = __webpack_require__(527) +var peek = __webpack_require__(569) +var through = __webpack_require__(269) +var pumpify = __webpack_require__(574) +var isGzip = __webpack_require__(538) +var isDeflate = __webpack_require__(534) var isCompressed = function (data) { if (isGzip(data)) return 1 @@ -87716,7 +89446,7 @@ module.exports = gunzip /***/ }), -/* 475 */ +/* 482 */ /***/ (function(module, exports) { module.exports = { @@ -87750,7 +89480,7 @@ module.exports = { }; /***/ }), -/* 476 */ +/* 483 */ /***/ (function(module, exports) { module.exports = { @@ -87784,7 +89514,7 @@ module.exports = { }; /***/ }), -/* 477 */ +/* 484 */ /***/ (function(module, exports) { module.exports = { @@ -87808,7 +89538,7 @@ module.exports = { }; /***/ }), -/* 478 */ +/* 485 */ /***/ (function(module, exports) { module.exports = { @@ -87841,7 +89571,7 @@ module.exports = { }; /***/ }), -/* 479 */ +/* 486 */ /***/ (function(module, exports) { module.exports = { @@ -87874,7 +89604,7 @@ module.exports = { }; /***/ }), -/* 480 */ +/* 487 */ /***/ (function(module, exports) { module.exports = { @@ -87917,7 +89647,7 @@ module.exports = { }; /***/ }), -/* 481 */ +/* 488 */ /***/ (function(module, exports) { module.exports = { @@ -87941,7 +89671,7 @@ module.exports = { }; /***/ }), -/* 482 */ +/* 489 */ /***/ (function(module, exports) { module.exports = { @@ -88002,7 +89732,7 @@ module.exports = { }; /***/ }), -/* 483 */ +/* 490 */ /***/ (function(module, exports) { module.exports = { @@ -88019,7 +89749,7 @@ module.exports = { }; /***/ }), -/* 484 */ +/* 491 */ /***/ (function(module, exports) { module.exports = { @@ -88043,36 +89773,36 @@ module.exports = { }; /***/ }), -/* 485 */ +/* 492 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; module.exports = { - afterRequest: __webpack_require__(475), - beforeRequest: __webpack_require__(476), - browser: __webpack_require__(477), - cache: __webpack_require__(478), - content: __webpack_require__(479), - cookie: __webpack_require__(480), - creator: __webpack_require__(481), - entry: __webpack_require__(482), - har: __webpack_require__(483), - header: __webpack_require__(484), - log: __webpack_require__(486), - page: __webpack_require__(487), - pageTimings: __webpack_require__(488), - postData: __webpack_require__(489), - query: __webpack_require__(490), - request: __webpack_require__(491), - response: __webpack_require__(492), - timings: __webpack_require__(493) + afterRequest: __webpack_require__(482), + beforeRequest: __webpack_require__(483), + browser: __webpack_require__(484), + cache: __webpack_require__(485), + content: __webpack_require__(486), + cookie: __webpack_require__(487), + creator: __webpack_require__(488), + entry: __webpack_require__(489), + har: __webpack_require__(490), + header: __webpack_require__(491), + log: __webpack_require__(493), + page: __webpack_require__(494), + pageTimings: __webpack_require__(495), + postData: __webpack_require__(496), + query: __webpack_require__(497), + request: __webpack_require__(498), + response: __webpack_require__(499), + timings: __webpack_require__(500) } /***/ }), -/* 486 */ +/* 493 */ /***/ (function(module, exports) { module.exports = { @@ -88112,7 +89842,7 @@ module.exports = { }; /***/ }), -/* 487 */ +/* 494 */ /***/ (function(module, exports) { module.exports = { @@ -88148,7 +89878,7 @@ module.exports = { }; /***/ }), -/* 488 */ +/* 495 */ /***/ (function(module, exports) { module.exports = { @@ -88170,7 +89900,7 @@ module.exports = { }; /***/ }), -/* 489 */ +/* 496 */ /***/ (function(module, exports) { module.exports = { @@ -88217,7 +89947,7 @@ module.exports = { }; /***/ }), -/* 490 */ +/* 497 */ /***/ (function(module, exports) { module.exports = { @@ -88241,7 +89971,7 @@ module.exports = { }; /***/ }), -/* 491 */ +/* 498 */ /***/ (function(module, exports) { module.exports = { @@ -88302,7 +90032,7 @@ module.exports = { }; /***/ }), -/* 492 */ +/* 499 */ /***/ (function(module, exports) { module.exports = { @@ -88360,7 +90090,7 @@ module.exports = { }; /***/ }), -/* 493 */ +/* 500 */ /***/ (function(module, exports) { module.exports = { @@ -88406,7 +90136,7 @@ module.exports = { }; /***/ }), -/* 494 */ +/* 501 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -88434,7 +90164,7 @@ HARError.prototype = Error.prototype; module.exports = exports['default']; /***/ }), -/* 495 */ +/* 502 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -88463,15 +90193,15 @@ exports.request = request; exports.response = response; exports.timings = timings; -var _harSchema = __webpack_require__(485); +var _harSchema = __webpack_require__(492); var schemas = _interopRequireWildcard(_harSchema); -var _ajv = __webpack_require__(277); +var _ajv = __webpack_require__(282); var _ajv2 = _interopRequireDefault(_ajv); -var _error = __webpack_require__(494); +var _error = __webpack_require__(501); var _error2 = _interopRequireDefault(_error); @@ -88572,7 +90302,7 @@ function timings(data) { } /***/ }), -/* 496 */ +/* 503 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -88583,16 +90313,16 @@ module.exports = re.test.bind(re); /***/ }), -/* 497 */ +/* 504 */ /***/ (function(module, exports, __webpack_require__) { // Load modules var Url = __webpack_require__(11); -var Hoek = __webpack_require__(90); -var Cryptiles = __webpack_require__(224); -var Crypto = __webpack_require__(145); -var Utils = __webpack_require__(89); +var Hoek = __webpack_require__(95); +var Cryptiles = __webpack_require__(225); +var Crypto = __webpack_require__(147); +var Utils = __webpack_require__(94); // Declare internals @@ -88958,18 +90688,18 @@ exports.message = function (host, port, message, options) { /***/ }), -/* 498 */ +/* 505 */ /***/ (function(module, exports, __webpack_require__) { // Export sub-modules -exports.error = exports.Error = __webpack_require__(83); -exports.sntp = __webpack_require__(255); +exports.error = exports.Error = __webpack_require__(87); +exports.sntp = __webpack_require__(260); -exports.server = __webpack_require__(499); -exports.client = __webpack_require__(497); -exports.crypto = __webpack_require__(145); -exports.utils = __webpack_require__(89); +exports.server = __webpack_require__(506); +exports.client = __webpack_require__(504); +exports.crypto = __webpack_require__(147); +exports.utils = __webpack_require__(94); exports.uri = { authenticate: exports.server.authenticateBewit, @@ -88979,16 +90709,16 @@ exports.uri = { /***/ }), -/* 499 */ +/* 506 */ /***/ (function(module, exports, __webpack_require__) { // Load modules -var Boom = __webpack_require__(83); -var Hoek = __webpack_require__(90); -var Cryptiles = __webpack_require__(224); -var Crypto = __webpack_require__(145); -var Utils = __webpack_require__(89); +var Boom = __webpack_require__(87); +var Hoek = __webpack_require__(95); +var Cryptiles = __webpack_require__(225); +var Crypto = __webpack_require__(147); +var Utils = __webpack_require__(94); // Declare internals @@ -89533,7 +91263,7 @@ internals.nonceFunc = function (key, nonce, ts, nonceCallback) { /***/ }), -/* 500 */ +/* 507 */ /***/ (function(module, exports) { module.exports = { @@ -89572,7 +91302,7 @@ module.exports = { }; /***/ }), -/* 501 */ +/* 508 */ /***/ (function(module, exports) { // Declare internals @@ -89710,15 +91440,15 @@ internals.safeCharCodes = (function () { /***/ }), -/* 502 */ +/* 509 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. -var parser = __webpack_require__(503); -var signer = __webpack_require__(504); -var verify = __webpack_require__(505); -var utils = __webpack_require__(91); +var parser = __webpack_require__(510); +var signer = __webpack_require__(511); +var verify = __webpack_require__(512); +var utils = __webpack_require__(96); @@ -89745,14 +91475,14 @@ module.exports = { /***/ }), -/* 503 */ +/* 510 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2012 Joyent, Inc. All rights reserved. -var assert = __webpack_require__(92); +var assert = __webpack_require__(97); var util = __webpack_require__(2); -var utils = __webpack_require__(91); +var utils = __webpack_require__(96); @@ -90069,18 +91799,18 @@ module.exports = { /***/ }), -/* 504 */ +/* 511 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2012 Joyent, Inc. All rights reserved. -var assert = __webpack_require__(92); -var crypto = __webpack_require__(6); -var http = __webpack_require__(48); +var assert = __webpack_require__(97); +var crypto = __webpack_require__(7); +var http = __webpack_require__(50); var util = __webpack_require__(2); var sshpk = __webpack_require__(161); -var jsprim = __webpack_require__(543); -var utils = __webpack_require__(91); +var jsprim = __webpack_require__(550); +var utils = __webpack_require__(96); var sprintf = __webpack_require__(2).format; @@ -90474,15 +92204,15 @@ module.exports = { /***/ }), -/* 505 */ +/* 512 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2015 Joyent, Inc. -var assert = __webpack_require__(92); -var crypto = __webpack_require__(6); +var assert = __webpack_require__(97); +var crypto = __webpack_require__(7); var sshpk = __webpack_require__(161); -var utils = __webpack_require__(91); +var utils = __webpack_require__(96); var HASH_ALGOS = utils.HASH_ALGOS; var PK_ALGOS = utils.PK_ALGOS; @@ -90568,12 +92298,12 @@ module.exports = { /***/ }), -/* 506 */ +/* 513 */ /***/ (function(module, exports, __webpack_require__) { -var wrappy = __webpack_require__(104) +var wrappy = __webpack_require__(163) var reqs = Object.create(null) -var once = __webpack_require__(155) +var once = __webpack_require__(104) module.exports = wrappy(inflight) @@ -90628,7 +92358,7 @@ function slice (args) { /***/ }), -/* 507 */ +/* 514 */ /***/ (function(module, exports) { if (typeof Object.create === 'function') { @@ -90657,7 +92387,7 @@ if (typeof Object.create === 'function') { /***/ }), -/* 508 */ +/* 515 */ /***/ (function(module, exports) { @@ -90853,7 +92583,7 @@ function unsafe (val, doUnesc) { /***/ }), -/* 509 */ +/* 516 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -90895,15 +92625,15 @@ var Choice = module.exports = function (val, answers) { /***/ }), -/* 510 */ +/* 517 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var assert = __webpack_require__(22); var _ = __webpack_require__(21); -var Separator = __webpack_require__(93); -var Choice = __webpack_require__(509); +var Separator = __webpack_require__(98); +var Choice = __webpack_require__(516); /** * Choices collection @@ -91014,7 +92744,7 @@ Choices.prototype.push = function () { /***/ }), -/* 511 */ +/* 518 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91024,11 +92754,11 @@ Choices.prototype.push = function () { var _ = __webpack_require__(21); var util = __webpack_require__(2); var chalk = __webpack_require__(16); -var cliCursor = __webpack_require__(209); -var figures = __webpack_require__(143); -var Base = __webpack_require__(38); -var observe = __webpack_require__(39); -var Paginator = __webpack_require__(94); +var cliCursor = __webpack_require__(210); +var figures = __webpack_require__(145); +var Base = __webpack_require__(37); +var observe = __webpack_require__(38); +var Paginator = __webpack_require__(99); /** * Module exports @@ -91056,6 +92786,7 @@ function Prompt() { } this.pointer = 0; + this.firstRender = true; // Make sure no default is set (so it won't be printed) this.opt.default = null; @@ -91091,6 +92822,7 @@ Prompt.prototype._run = function (cb) { // Init the prompt cliCursor.hide(); this.render(); + this.firstRender = false; return this; }; @@ -91105,7 +92837,7 @@ Prompt.prototype.render = function (error) { var message = this.getQuestion(); var bottomContent = ''; - if (!this.spaceKeyPressed) { + if (this.firstRender) { message += '(Press ' + chalk.cyan.bold('') + ' to select, ' + chalk.cyan.bold('') + ' to toggle all, ' + chalk.cyan.bold('') + ' to inverse selection)'; } @@ -91174,7 +92906,6 @@ Prompt.prototype.onNumberKey = function (input) { }; Prompt.prototype.onSpaceKey = function () { - this.spaceKeyPressed = true; this.toggleChoice(this.pointer); this.render(); }; @@ -91255,7 +92986,7 @@ function getCheckbox(checked) { /***/ }), -/* 512 */ +/* 519 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91265,8 +92996,8 @@ function getCheckbox(checked) { var _ = __webpack_require__(21); var util = __webpack_require__(2); var chalk = __webpack_require__(16); -var Base = __webpack_require__(38); -var observe = __webpack_require__(39); +var Base = __webpack_require__(37); +var observe = __webpack_require__(38); /** * Module exports @@ -91367,7 +93098,7 @@ Prompt.prototype.onKeypress = function () { /***/ }), -/* 513 */ +/* 520 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91376,10 +93107,10 @@ Prompt.prototype.onKeypress = function () { var util = __webpack_require__(2); var chalk = __webpack_require__(16); -var ExternalEditor = __webpack_require__(458); -var Base = __webpack_require__(38); -var observe = __webpack_require__(39); -var rx = __webpack_require__(100); +var ExternalEditor = __webpack_require__(465); +var Base = __webpack_require__(37); +var observe = __webpack_require__(38); +var rx = __webpack_require__(106); /** * Module exports @@ -91484,7 +93215,7 @@ Prompt.prototype.onError = function (state) { /***/ }), -/* 514 */ +/* 521 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91494,10 +93225,10 @@ Prompt.prototype.onError = function (state) { var _ = __webpack_require__(21); var util = __webpack_require__(2); var chalk = __webpack_require__(16); -var Base = __webpack_require__(38); -var Separator = __webpack_require__(93); -var observe = __webpack_require__(39); -var Paginator = __webpack_require__(94); +var Base = __webpack_require__(37); +var Separator = __webpack_require__(98); +var observe = __webpack_require__(38); +var Paginator = __webpack_require__(99); /** * Module exports @@ -91750,7 +93481,7 @@ function renderChoices(choices, pointer) { /***/ }), -/* 515 */ +/* 522 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91759,8 +93490,8 @@ function renderChoices(choices, pointer) { var util = __webpack_require__(2); var chalk = __webpack_require__(16); -var Base = __webpack_require__(38); -var observe = __webpack_require__(39); +var Base = __webpack_require__(37); +var observe = __webpack_require__(38); /** * Module exports @@ -91860,7 +93591,7 @@ Prompt.prototype.onKeypress = function () { /***/ }), -/* 516 */ +/* 523 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -91870,12 +93601,12 @@ Prompt.prototype.onKeypress = function () { var _ = __webpack_require__(21); var util = __webpack_require__(2); var chalk = __webpack_require__(16); -var figures = __webpack_require__(143); -var cliCursor = __webpack_require__(209); -var runAsync = __webpack_require__(99); -var Base = __webpack_require__(38); -var observe = __webpack_require__(39); -var Paginator = __webpack_require__(94); +var figures = __webpack_require__(145); +var cliCursor = __webpack_require__(210); +var runAsync = __webpack_require__(105); +var Base = __webpack_require__(37); +var observe = __webpack_require__(38); +var Paginator = __webpack_require__(99); /** * Module exports @@ -92053,7 +93784,7 @@ function listRender(choices, pointer) { /***/ }), -/* 517 */ +/* 524 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92062,8 +93793,8 @@ function listRender(choices, pointer) { var util = __webpack_require__(2); var chalk = __webpack_require__(16); -var Base = __webpack_require__(38); -var observe = __webpack_require__(39); +var Base = __webpack_require__(37); +var observe = __webpack_require__(38); function mask(input) { input = String(input); @@ -92174,7 +93905,7 @@ Prompt.prototype.onKeypress = function () { /***/ }), -/* 518 */ +/* 525 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92184,10 +93915,10 @@ Prompt.prototype.onKeypress = function () { var _ = __webpack_require__(21); var util = __webpack_require__(2); var chalk = __webpack_require__(16); -var Base = __webpack_require__(38); -var Separator = __webpack_require__(93); -var observe = __webpack_require__(39); -var Paginator = __webpack_require__(94); +var Base = __webpack_require__(37); +var Separator = __webpack_require__(98); +var observe = __webpack_require__(38); +var Paginator = __webpack_require__(99); /** * Module exports @@ -92359,7 +94090,7 @@ function renderChoices(choices, pointer) { /***/ }), -/* 519 */ +/* 526 */ /***/ (function(module, exports, __webpack_require__) { /** @@ -92367,9 +94098,9 @@ function renderChoices(choices, pointer) { */ var util = __webpack_require__(2); -var through = __webpack_require__(618); -var Base = __webpack_require__(234); -var rlUtils = __webpack_require__(235); +var through = __webpack_require__(625); +var Base = __webpack_require__(236); +var rlUtils = __webpack_require__(237); var _ = __webpack_require__(21); /** @@ -92470,17 +94201,17 @@ Prompt.prototype.write = function (message) { /***/ }), -/* 520 */ +/* 527 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(21); -var rx = __webpack_require__(100); +var rx = __webpack_require__(106); var util = __webpack_require__(2); -var runAsync = __webpack_require__(99); -var utils = __webpack_require__(522); -var Base = __webpack_require__(234); +var runAsync = __webpack_require__(105); +var utils = __webpack_require__(529); +var Base = __webpack_require__(236); /** * Base interface class other can inherits from @@ -92592,16 +94323,16 @@ PromptUI.prototype.filterIfRunnable = function (question) { /***/ }), -/* 521 */ +/* 528 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(21); -var util = __webpack_require__(235); -var cliWidth = __webpack_require__(399); +var util = __webpack_require__(237); +var cliWidth = __webpack_require__(408); var stripAnsi = __webpack_require__(162); -var stringWidth = __webpack_require__(524); +var stringWidth = __webpack_require__(531); function height(content) { return content.split('\n').length; @@ -92734,14 +94465,14 @@ function forceLineReturn(content, width) { /***/ }), -/* 522 */ +/* 529 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var _ = __webpack_require__(21); -var rx = __webpack_require__(100); -var runAsync = __webpack_require__(99); +var rx = __webpack_require__(106); +var runAsync = __webpack_require__(105); /** * Resolve a question property value if it is passed as a function. @@ -92767,7 +94498,7 @@ exports.fetchAsyncQuestionProperty = function (question, prop, answers) { /***/ }), -/* 523 */ +/* 530 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -92820,13 +94551,13 @@ module.exports = x => { /***/ }), -/* 524 */ +/* 531 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; const stripAnsi = __webpack_require__(162); -const isFullwidthCodePoint = __webpack_require__(523); +const isFullwidthCodePoint = __webpack_require__(530); module.exports = str => { if (typeof str !== 'string' || str.length === 0) { @@ -92862,7 +94593,7 @@ module.exports = str => { /***/ }), -/* 525 */ +/* 532 */ /***/ (function(module, exports) { /*! @@ -92889,12 +94620,12 @@ function isSlowBuffer (obj) { /***/ }), -/* 526 */ +/* 533 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var builtinModules = __webpack_require__(393); +var builtinModules = __webpack_require__(402); module.exports = function (str) { if (typeof str !== 'string') { @@ -92906,7 +94637,7 @@ module.exports = function (str) { /***/ }), -/* 527 */ +/* 534 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -92919,7 +94650,7 @@ module.exports = function (buf) { /***/ }), -/* 528 */ +/* 535 */ /***/ (function(module, exports) { /*! @@ -92940,7 +94671,7 @@ module.exports = function(str) { /***/ }), -/* 529 */ +/* 536 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -92953,7 +94684,7 @@ module.exports = function(str) { -var isPrimitive = __webpack_require__(237); +var isPrimitive = __webpack_require__(239); module.exports = function isEqual(a, b) { if (!a && !b) { return true; } @@ -92974,7 +94705,7 @@ module.exports = function isEqual(a, b) { /***/ }), -/* 530 */ +/* 537 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -92994,7 +94725,7 @@ module.exports = function isExtendable(val) { /***/ }), -/* 531 */ +/* 538 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -93017,7 +94748,7 @@ module.exports = function (buf) { /***/ }), -/* 532 */ +/* 539 */ /***/ (function(module, exports) { /*! @@ -93033,7 +94764,7 @@ module.exports = function isPosixBracket(str) { /***/ }), -/* 533 */ +/* 540 */ /***/ (function(module, exports) { module.exports = isPromise; @@ -93044,7 +94775,7 @@ function isPromise(obj) { /***/ }), -/* 534 */ +/* 541 */ /***/ (function(module, exports) { module.exports = isTypedArray @@ -93091,7 +94822,7 @@ function isLooseTypedArray(arr) { /***/ }), -/* 535 */ +/* 542 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -93104,7 +94835,7 @@ function isLooseTypedArray(arr) { -var isArray = __webpack_require__(238); +var isArray = __webpack_require__(240); module.exports = function isObject(val) { return val != null && typeof val === 'object' && isArray(val) === false; @@ -93112,7 +94843,7 @@ module.exports = function isObject(val) { /***/ }), -/* 536 */ +/* 543 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -93131,9 +94862,9 @@ module.exports = function isObject(val) { * You should have received a copy of the license along with this program. */ -var core = __webpack_require__(97); -var utils = __webpack_require__(98); -var curve255 = __webpack_require__(149); +var core = __webpack_require__(102); +var utils = __webpack_require__(103); +var curve255 = __webpack_require__(151); /** @@ -93230,7 +94961,7 @@ module.exports = ns; /***/ }), -/* 537 */ +/* 544 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -93250,11 +94981,11 @@ module.exports = ns; * You should have received a copy of the license along with this program. */ -var core = __webpack_require__(97); -var curve255 = __webpack_require__(149); -var utils = __webpack_require__(98); -var BigInteger = __webpack_require__(45).BigInteger; -var crypto = __webpack_require__(6); +var core = __webpack_require__(102); +var curve255 = __webpack_require__(151); +var utils = __webpack_require__(103); +var BigInteger = __webpack_require__(39).BigInteger; +var crypto = __webpack_require__(7); /** * @exports jodid25519/eddsa @@ -93810,7 +95541,7 @@ module.exports = ns; /***/ }), -/* 538 */ +/* 545 */ /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/** @@ -94090,7 +95821,7 @@ return exports; /***/ }), -/* 539 */ +/* 546 */ /***/ (function(module, exports) { exports = module.exports = stringify @@ -94123,15 +95854,15 @@ function serializer(replacer, cycleReplacer) { /***/ }), -/* 540 */ +/* 547 */ /***/ (function(module, exports, __webpack_require__) { -exports.parse = __webpack_require__(541); -exports.stringify = __webpack_require__(542); +exports.parse = __webpack_require__(548); +exports.stringify = __webpack_require__(549); /***/ }), -/* 541 */ +/* 548 */ /***/ (function(module, exports) { var at, // The index of the current character @@ -94410,7 +96141,7 @@ module.exports = function (source, reviver) { /***/ }), -/* 542 */ +/* 549 */ /***/ (function(module, exports) { var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, @@ -94570,19 +96301,19 @@ module.exports = function (value, replacer, space) { /***/ }), -/* 543 */ +/* 550 */ /***/ (function(module, exports, __webpack_require__) { /* * lib/jsprim.js: utilities for primitive JavaScript types */ -var mod_assert = __webpack_require__(22); +var mod_assert = __webpack_require__(9); var mod_util = __webpack_require__(2); -var mod_extsprintf = __webpack_require__(229); -var mod_verror = __webpack_require__(628); -var mod_jsonschema = __webpack_require__(538); +var mod_extsprintf = __webpack_require__(231); +var mod_verror = __webpack_require__(635); +var mod_jsonschema = __webpack_require__(545); /* * Public interface @@ -94604,6 +96335,8 @@ exports.mergeObjects = mergeObjects; exports.startsWith = startsWith; exports.endsWith = endsWith; +exports.parseInteger = parseInteger; + exports.iso8601 = iso8601; exports.rfc1123 = rfc1123; exports.parseDateTime = parseDateTime; @@ -94854,6 +96587,251 @@ function parseDateTime(str) } } + +/* + * Number.*_SAFE_INTEGER isn't present before node v0.12, so we hardcode + * the ES6 definitions here, while allowing for them to someday be higher. + */ +var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; +var MIN_SAFE_INTEGER = Number.MIN_SAFE_INTEGER || -9007199254740991; + + +/* + * Default options for parseInteger(). + */ +var PI_DEFAULTS = { + base: 10, + allowSign: true, + allowPrefix: false, + allowTrailing: false, + allowImprecise: false, + trimWhitespace: false, + leadingZeroIsOctal: false +}; + +var CP_0 = 0x30; +var CP_9 = 0x39; + +var CP_A = 0x41; +var CP_B = 0x42; +var CP_O = 0x4f; +var CP_T = 0x54; +var CP_X = 0x58; +var CP_Z = 0x5a; + +var CP_a = 0x61; +var CP_b = 0x62; +var CP_o = 0x6f; +var CP_t = 0x74; +var CP_x = 0x78; +var CP_z = 0x7a; + +var PI_CONV_DEC = 0x30; +var PI_CONV_UC = 0x37; +var PI_CONV_LC = 0x57; + + +/* + * A stricter version of parseInt() that provides options for changing what + * is an acceptable string (for example, disallowing trailing characters). + */ +function parseInteger(str, uopts) +{ + mod_assert.string(str, 'str'); + mod_assert.optionalObject(uopts, 'options'); + + var baseOverride = false; + var options = PI_DEFAULTS; + + if (uopts) { + baseOverride = hasKey(uopts, 'base'); + options = mergeObjects(options, uopts); + mod_assert.number(options.base, 'options.base'); + mod_assert.ok(options.base >= 2, 'options.base >= 2'); + mod_assert.ok(options.base <= 36, 'options.base <= 36'); + mod_assert.bool(options.allowSign, 'options.allowSign'); + mod_assert.bool(options.allowPrefix, 'options.allowPrefix'); + mod_assert.bool(options.allowTrailing, + 'options.allowTrailing'); + mod_assert.bool(options.allowImprecise, + 'options.allowImprecise'); + mod_assert.bool(options.trimWhitespace, + 'options.trimWhitespace'); + mod_assert.bool(options.leadingZeroIsOctal, + 'options.leadingZeroIsOctal'); + + if (options.leadingZeroIsOctal) { + mod_assert.ok(!baseOverride, + '"base" and "leadingZeroIsOctal" are ' + + 'mutually exclusive'); + } + } + + var c; + var pbase = -1; + var base = options.base; + var start; + var mult = 1; + var value = 0; + var idx = 0; + var len = str.length; + + /* Trim any whitespace on the left side. */ + if (options.trimWhitespace) { + while (idx < len && isSpace(str.charCodeAt(idx))) { + ++idx; + } + } + + /* Check the number for a leading sign. */ + if (options.allowSign) { + if (str[idx] === '-') { + idx += 1; + mult = -1; + } else if (str[idx] === '+') { + idx += 1; + } + } + + /* Parse the base-indicating prefix if there is one. */ + if (str[idx] === '0') { + if (options.allowPrefix) { + pbase = prefixToBase(str.charCodeAt(idx + 1)); + if (pbase !== -1 && (!baseOverride || pbase === base)) { + base = pbase; + idx += 2; + } + } + + if (pbase === -1 && options.leadingZeroIsOctal) { + base = 8; + } + } + + /* Parse the actual digits. */ + for (start = idx; idx < len; ++idx) { + c = translateDigit(str.charCodeAt(idx)); + if (c !== -1 && c < base) { + value *= base; + value += c; + } else { + break; + } + } + + /* If we didn't parse any digits, we have an invalid number. */ + if (start === idx) { + return (new Error('invalid number: ' + JSON.stringify(str))); + } + + /* Trim any whitespace on the right side. */ + if (options.trimWhitespace) { + while (idx < len && isSpace(str.charCodeAt(idx))) { + ++idx; + } + } + + /* Check for trailing characters. */ + if (idx < len && !options.allowTrailing) { + return (new Error('trailing characters after number: ' + + JSON.stringify(str.slice(idx)))); + } + + /* If our value is 0, we return now, to avoid returning -0. */ + if (value === 0) { + return (0); + } + + /* Calculate our final value. */ + var result = value * mult; + + /* + * If the string represents a value that cannot be precisely represented + * by JavaScript, then we want to check that: + * + * - We never increased the value past MAX_SAFE_INTEGER + * - We don't make the result negative and below MIN_SAFE_INTEGER + * + * Because we only ever increment the value during parsing, there's no + * chance of moving past MAX_SAFE_INTEGER and then dropping below it + * again, losing precision in the process. This means that we only need + * to do our checks here, at the end. + */ + if (!options.allowImprecise && + (value > MAX_SAFE_INTEGER || result < MIN_SAFE_INTEGER)) { + return (new Error('number is outside of the supported range: ' + + JSON.stringify(str.slice(start, idx)))); + } + + return (result); +} + + +/* + * Interpret a character code as a base-36 digit. + */ +function translateDigit(d) +{ + if (d >= CP_0 && d <= CP_9) { + /* '0' to '9' -> 0 to 9 */ + return (d - PI_CONV_DEC); + } else if (d >= CP_A && d <= CP_Z) { + /* 'A' - 'Z' -> 10 to 35 */ + return (d - PI_CONV_UC); + } else if (d >= CP_a && d <= CP_z) { + /* 'a' - 'z' -> 10 to 35 */ + return (d - PI_CONV_LC); + } else { + /* Invalid character code */ + return (-1); + } +} + + +/* + * Test if a value matches the ECMAScript definition of trimmable whitespace. + */ +function isSpace(c) +{ + return (c === 0x20) || + (c >= 0x0009 && c <= 0x000d) || + (c === 0x00a0) || + (c === 0x1680) || + (c === 0x180e) || + (c >= 0x2000 && c <= 0x200a) || + (c === 0x2028) || + (c === 0x2029) || + (c === 0x202f) || + (c === 0x205f) || + (c === 0x3000) || + (c === 0xfeff); +} + + +/* + * Determine which base a character indicates (e.g., 'x' indicates hex). + */ +function prefixToBase(c) +{ + if (c === CP_b || c === CP_B) { + /* 0b/0B (binary) */ + return (2); + } else if (c === CP_o || c === CP_O) { + /* 0o/0O (octal) */ + return (8); + } else if (c === CP_t || c === CP_T) { + /* 0t/0T (decimal) */ + return (10); + } else if (c === CP_x || c === CP_X) { + /* 0x/0X (hexadecimal) */ + return (16); + } else { + /* Not a meaningful character */ + return (-1); + } +} + + function validateJsonObjectJS(schema, input) { var report = mod_jsonschema.validate(input, schema); @@ -95064,7 +97042,7 @@ function mergeObjects(provided, overrides, defaults) /***/ }), -/* 544 */ +/* 551 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -95156,14 +97134,14 @@ module.exports = function (a, b) { /***/ }), -/* 545 */ +/* 552 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var util = __webpack_require__(2); -var onExit = __webpack_require__(254); -var currentlyUnhandled = __webpack_require__(440); +var onExit = __webpack_require__(259); +var currentlyUnhandled = __webpack_require__(449); var installed = false; @@ -95199,7 +97177,7 @@ module.exports = function (log) { /***/ }), -/* 546 */ +/* 553 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -95212,8 +97190,8 @@ module.exports = function (log) { -var expand = __webpack_require__(548); -var utils = __webpack_require__(152); +var expand = __webpack_require__(555); +var utils = __webpack_require__(154); /** * The main function. Pass an array of filepaths, @@ -95637,7 +97615,7 @@ module.exports = micromatch; /***/ }), -/* 547 */ +/* 554 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -95711,7 +97689,7 @@ module.exports = chars; /***/ }), -/* 548 */ +/* 555 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -95724,8 +97702,8 @@ module.exports = chars; -var utils = __webpack_require__(152); -var Glob = __webpack_require__(549); +var utils = __webpack_require__(154); +var Glob = __webpack_require__(556); /** * Expose `expand` @@ -96022,14 +98000,14 @@ function globstar(dotfile) { /***/ }), -/* 549 */ +/* 556 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var chars = __webpack_require__(547); -var utils = __webpack_require__(152); +var chars = __webpack_require__(554); +var utils = __webpack_require__(154); /** * Expose `Glob` @@ -96222,7 +98200,7 @@ function unesc(str) { /***/ }), -/* 550 */ +/* 557 */ /***/ (function(module, exports) { module.exports = { @@ -96577,9 +98555,15 @@ module.exports = { "application/emergencycalldata.comment+xml": { "source": "iana" }, + "application/emergencycalldata.control+xml": { + "source": "iana" + }, "application/emergencycalldata.deviceinfo+xml": { "source": "iana" }, + "application/emergencycalldata.ecall.msd": { + "source": "iana" + }, "application/emergencycalldata.providerinfo+xml": { "source": "iana" }, @@ -96589,6 +98573,9 @@ module.exports = { "application/emergencycalldata.subscriberinfo+xml": { "source": "iana" }, + "application/emergencycalldata.veds+xml": { + "source": "iana" + }, "application/emma+xml": { "source": "iana", "extensions": [ @@ -96663,6 +98650,9 @@ module.exports = { "geojson" ] }, + "application/geo+json-seq": { + "source": "iana" + }, "application/gml+xml": { "source": "iana", "extensions": [ @@ -97080,6 +99070,12 @@ module.exports = { "mxf" ] }, + "application/n-quads": { + "source": "iana" + }, + "application/n-triples": { + "source": "iana" + }, "application/nasdata": { "source": "iana" }, @@ -97948,6 +99944,10 @@ module.exports = { "source": "iana", "compressible": true }, + "application/vnd.apothekende.reservation+json": { + "source": "iana", + "compressible": true + }, "application/vnd.apple.installer+xml": { "source": "iana", "extensions": [ @@ -98465,6 +100465,12 @@ module.exports = { "application/vnd.ecowin.seriesupdate": { "source": "iana" }, + "application/vnd.efi.img": { + "source": "iana" + }, + "application/vnd.efi.iso": { + "source": "iana" + }, "application/vnd.emclient.accessrequest+xml": { "source": "iana" }, @@ -99052,6 +101058,9 @@ module.exports = { "igl" ] }, + "application/vnd.imagemeter.image+zip": { + "source": "iana" + }, "application/vnd.immervision-ivp": { "source": "iana", "extensions": [ @@ -99336,6 +101345,10 @@ module.exports = { "sse" ] }, + "application/vnd.las.las+json": { + "source": "iana", + "compressible": true + }, "application/vnd.las.las+xml": { "source": "iana", "extensions": [ @@ -100103,6 +102116,9 @@ module.exports = { "application/vnd.obn": { "source": "iana" }, + "application/vnd.ocf+cbor": { + "source": "iana" + }, "application/vnd.oftn.l10n+json": { "source": "iana", "compressible": true @@ -102772,6 +104788,18 @@ module.exports = { "audio/lpc": { "source": "iana" }, + "audio/melp": { + "source": "iana" + }, + "audio/melp1200": { + "source": "iana" + }, + "audio/melp2400": { + "source": "iana" + }, + "audio/melp600": { + "source": "iana" + }, "audio/midi": { "source": "apache", "extensions": [ @@ -103244,6 +105272,12 @@ module.exports = { "otf" ] }, + "image/apng": { + "compressible": false, + "extensions": [ + "apng" + ] + }, "image/bmp": { "source": "iana", "compressible": true, @@ -104867,7 +106901,7 @@ module.exports = { }; /***/ }), -/* 551 */ +/* 558 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -104880,11 +106914,11 @@ module.exports = { * Module exports. */ -module.exports = __webpack_require__(550) +module.exports = __webpack_require__(557) /***/ }), -/* 552 */ +/* 559 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -104898,18 +106932,18 @@ module.exports = (to, from) => { /***/ }), -/* 553 */ +/* 560 */ /***/ (function(module, exports) { /** * Helpers. */ -var s = 1000 -var m = s * 60 -var h = m * 60 -var d = h * 24 -var y = d * 365.25 +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var y = d * 365.25; /** * Parse or format the given `val`. @@ -104919,24 +106953,25 @@ var y = d * 365.25 * - `long` verbose formatting [false] * * @param {String|Number} val - * @param {Object} options + * @param {Object} [options] * @throws {Error} throw an error if val is not a non-empty string or a number * @return {String|Number} * @api public */ -module.exports = function (val, options) { - options = options || {} - var type = typeof val +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; if (type === 'string' && val.length > 0) { - return parse(val) + return parse(val); } else if (type === 'number' && isNaN(val) === false) { - return options.long ? - fmtLong(val) : - fmtShort(val) + return options.long ? fmtLong(val) : fmtShort(val); } - throw new Error('val is not a non-empty string or a valid number. val=' + JSON.stringify(val)) -} + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; /** * Parse the given `str` and return milliseconds. @@ -104947,53 +106982,55 @@ module.exports = function (val, options) { */ function parse(str) { - str = String(str) - if (str.length > 10000) { - return + str = String(str); + if (str.length > 100) { + return; } - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(str) + var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec( + str + ); if (!match) { - return + return; } - var n = parseFloat(match[1]) - var type = (match[2] || 'ms').toLowerCase() + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); switch (type) { case 'years': case 'year': case 'yrs': case 'yr': case 'y': - return n * y + return n * y; case 'days': case 'day': case 'd': - return n * d + return n * d; case 'hours': case 'hour': case 'hrs': case 'hr': case 'h': - return n * h + return n * h; case 'minutes': case 'minute': case 'mins': case 'min': case 'm': - return n * m + return n * m; case 'seconds': case 'second': case 'secs': case 'sec': case 's': - return n * s + return n * s; case 'milliseconds': case 'millisecond': case 'msecs': case 'msec': case 'ms': - return n + return n; default: - return undefined + return undefined; } } @@ -105007,18 +107044,18 @@ function parse(str) { function fmtShort(ms) { if (ms >= d) { - return Math.round(ms / d) + 'd' + return Math.round(ms / d) + 'd'; } if (ms >= h) { - return Math.round(ms / h) + 'h' + return Math.round(ms / h) + 'h'; } if (ms >= m) { - return Math.round(ms / m) + 'm' + return Math.round(ms / m) + 'm'; } if (ms >= s) { - return Math.round(ms / s) + 's' + return Math.round(ms / s) + 's'; } - return ms + 'ms' + return ms + 'ms'; } /** @@ -105034,7 +107071,7 @@ function fmtLong(ms) { plural(ms, h, 'hour') || plural(ms, m, 'minute') || plural(ms, s, 'second') || - ms + ' ms' + ms + ' ms'; } /** @@ -105043,21 +107080,21 @@ function fmtLong(ms) { function plural(ms, n, name) { if (ms < n) { - return + return; } if (ms < n * 1.5) { - return Math.floor(ms / n) + ' ' + name + return Math.floor(ms / n) + ' ' + name; } - return Math.ceil(ms / n) + ' ' + name + 's' + return Math.ceil(ms / n) + ' ' + name + 's'; } /***/ }), -/* 554 */ +/* 561 */ /***/ (function(module, exports, __webpack_require__) { /*jslint node: true*/ -__webpack_require__(614); +__webpack_require__(621); "use strict"; @@ -105090,7 +107127,7 @@ var trim = function(str) { * Emoji namespace */ var Emoji = module.exports = { - emoji: __webpack_require__(555) + emoji: __webpack_require__(562) }; /** @@ -105187,7 +107224,7 @@ Emoji.search = function search(str) { /***/ }), -/* 555 */ +/* 562 */ /***/ (function(module, exports) { module.exports = { @@ -106535,34 +108572,36 @@ module.exports = { }; /***/ }), -/* 556 */ -/***/ (function(module, exports) { +/* 563 */ +/***/ (function(module, exports, __webpack_require__) { /*! * normalize-path * - * Copyright (c) 2014-2015, Jon Schlinkert. - * Licensed under the MIT License + * Copyright (c) 2014-2017, Jon Schlinkert. + * Released under the MIT License. */ +var removeTrailingSeparator = __webpack_require__(584); + module.exports = function normalizePath(str, stripTrailing) { if (typeof str !== 'string') { throw new TypeError('expected a string'); } str = str.replace(/[\\\/]+/g, '/'); if (stripTrailing !== false) { - str = str.replace(/\/$/, ''); + str = removeTrailingSeparator(str); } return str; }; /***/ }), -/* 557 */ +/* 564 */ /***/ (function(module, exports, __webpack_require__) { -var crypto = __webpack_require__(6) - , qs = __webpack_require__(108) +var crypto = __webpack_require__(7) + , qs = __webpack_require__(114) ; function sha1 (key, body) { @@ -106700,7 +108739,7 @@ exports.generateBase = generateBase /***/ }), -/* 558 */ +/* 565 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -106713,8 +108752,8 @@ exports.generateBase = generateBase -var isObject = __webpack_require__(530); -var forOwn = __webpack_require__(463); +var isObject = __webpack_require__(537); +var forOwn = __webpack_require__(470); module.exports = function omit(obj, keys) { if (!isObject(obj)) return {}; @@ -106747,15 +108786,15 @@ module.exports = function omit(obj, keys) { /***/ }), -/* 559 */ +/* 566 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const mimicFn = __webpack_require__(552); +const mimicFn = __webpack_require__(559); module.exports = (fn, opts) => { - // TODO: remove this in v3 + // TODO: Remove this in v3 if (opts === true) { throw new TypeError('The second argument is now an options object'); } @@ -106768,12 +108807,12 @@ module.exports = (fn, opts) => { let ret; let called = false; + const fnName = fn.displayName || fn.name || ''; const onetime = function () { if (called) { if (opts.throw === true) { - const name = fn.displayName || fn.name || ''; - throw new Error(`Function \`${name}\` can only be called once`); + throw new Error(`Function \`${fnName}\` can only be called once`); } return ret; @@ -106793,7 +108832,7 @@ module.exports = (fn, opts) => { /***/ }), -/* 560 */ +/* 567 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -106825,7 +108864,7 @@ module.exports = function () { /***/ }), -/* 561 */ +/* 568 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -106838,10 +108877,10 @@ module.exports = function () { -var isGlob = __webpack_require__(96); -var findBase = __webpack_require__(468); -var extglob = __webpack_require__(95); -var dotfile = __webpack_require__(528); +var isGlob = __webpack_require__(101); +var findBase = __webpack_require__(475); +var extglob = __webpack_require__(100); +var dotfile = __webpack_require__(535); /** * Expose `cache` @@ -106988,11 +109027,11 @@ function unescape(str) { /***/ }), -/* 562 */ +/* 569 */ /***/ (function(module, exports, __webpack_require__) { -var duplexify = __webpack_require__(226) -var through = __webpack_require__(264) +var duplexify = __webpack_require__(227) +var through = __webpack_require__(269) var noop = function() {} @@ -107069,7 +109108,7 @@ var peek = function(opts, onpeek) { module.exports = peek /***/ }), -/* 563 */ +/* 570 */ /***/ (function(module, exports) { // Generated by CoffeeScript 1.7.1 @@ -107107,7 +109146,7 @@ module.exports = peek /***/ }), -/* 564 */ +/* 571 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -107167,16 +109206,16 @@ function randomize() { var cache = {}; /***/ }), -/* 565 */ +/* 572 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const fs = __webpack_require__(233); +const fs = __webpack_require__(235); const path = __webpack_require__(1); -const retry = __webpack_require__(591); -const syncFs = __webpack_require__(566); +const retry = __webpack_require__(599); +const syncFs = __webpack_require__(573); const locks = {}; @@ -107308,7 +109347,13 @@ threshold'), { code: 'ECOMPROMISED' })); // Unref the timer so that the nodejs process can exit freely // This is safe because all acquired locks will be automatically released // on process exit - lock.updateTimeout.unref(); + + // We first check that `lock.updateTimeout.unref` exists because some users + // may be using this module outside of NodeJS (e.g., in an electron app), + // and in those cases `setTimeout` return an integer. + if (lock.updateTimeout.unref) { + lock.updateTimeout.unref(); + } } function compromisedLock(file, lock, err) { @@ -107548,7 +109593,7 @@ module.exports.checkSync = checkSync; /***/ }), -/* 566 */ +/* 573 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -107595,12 +109640,12 @@ module.exports = syncFs; /***/ }), -/* 567 */ +/* 574 */ /***/ (function(module, exports, __webpack_require__) { -var pump = __webpack_require__(244) -var inherits = __webpack_require__(37) -var Duplexify = __webpack_require__(226) +var pump = __webpack_require__(246) +var inherits = __webpack_require__(36) +var Duplexify = __webpack_require__(227) var toArray = function(args) { if (!args.length) return [] @@ -107656,13 +109701,13 @@ module.exports.obj = define({destroy:false, objectMode:true, highWaterMark:16}) /***/ }), -/* 568 */ +/* 575 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var utils = __webpack_require__(247); +var utils = __webpack_require__(249); var has = Object.prototype.hasOwnProperty; @@ -107830,14 +109875,14 @@ module.exports = function (str, opts) { /***/ }), -/* 569 */ +/* 576 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var utils = __webpack_require__(247); -var formats = __webpack_require__(245); +var utils = __webpack_require__(249); +var formats = __webpack_require__(247); var arrayPrefixGenerators = { brackets: function brackets(prefix) { // eslint-disable-line func-name-matching @@ -108044,7 +110089,7 @@ module.exports = function (object, opts) { /***/ }), -/* 570 */ +/* 577 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -108058,8 +110103,8 @@ module.exports = function (object, opts) { -var isNumber = __webpack_require__(236); -var typeOf = __webpack_require__(151); +var isNumber = __webpack_require__(238); +var typeOf = __webpack_require__(153); /** * Expose `randomatic` @@ -108134,14 +110179,14 @@ function randomatic(pattern, length, options) { /***/ }), -/* 571 */ +/* 578 */ /***/ (function(module, exports, __webpack_require__) { module.exports = read -var readline = __webpack_require__(109) -var Mute = __webpack_require__(241) +var readline = __webpack_require__(115) +var Mute = __webpack_require__(243) function read (opts, cb) { if (opts.num) { @@ -108253,14 +110298,14 @@ function read (opts, cb) { /***/ }), -/* 572 */ +/* 579 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(46) +module.exports = __webpack_require__(47).Duplex /***/ }), -/* 573 */ +/* 580 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -108272,11 +110317,11 @@ module.exports = __webpack_require__(46) module.exports = PassThrough; -var Transform = __webpack_require__(158); +var Transform = __webpack_require__(251); /**/ -var util = __webpack_require__(66); -util.inherits = __webpack_require__(37); +var util = __webpack_require__(71); +util.inherits = __webpack_require__(36); /**/ util.inherits(PassThrough, Transform); @@ -108292,15 +110337,15 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) { }; /***/ }), -/* 574 */ +/* 581 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var Buffer = __webpack_require__(55).Buffer; +var Buffer = __webpack_require__(76).Buffer; /**/ -var bufferShim = __webpack_require__(125); +var bufferShim = __webpack_require__(128); /**/ module.exports = BufferList; @@ -108362,14 +110407,14 @@ BufferList.prototype.concat = function (n) { }; /***/ }), -/* 575 */ +/* 582 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(158) +module.exports = __webpack_require__(47).Transform /***/ }), -/* 576 */ +/* 583 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -108382,8 +110427,8 @@ module.exports = __webpack_require__(158) -var isPrimitive = __webpack_require__(237); -var equal = __webpack_require__(529); +var isPrimitive = __webpack_require__(239); +var equal = __webpack_require__(536); var basic = {}; var cache = {}; @@ -108445,7 +110490,26 @@ module.exports.basic = basic; /***/ }), -/* 577 */ +/* 584 */ +/***/ (function(module, exports) { + +const isWin = process.platform === 'win32'; + +module.exports = function (str) { + while (endsInSeparator(str)) { + str = str.slice(0, -1); + } + return str; +}; + +function endsInSeparator(str) { + var last = str[str.length - 1]; + return str.length > 1 && (last === '/' || (isWin && last === '\\')); +} + + +/***/ }), +/* 585 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -108522,7 +110586,7 @@ function repeat(str, num) { /***/ }), -/* 578 */ +/* 586 */ /***/ (function(module, exports) { module.exports = { @@ -108558,11 +110622,11 @@ module.exports = { }; /***/ }), -/* 579 */ +/* 587 */ /***/ (function(module, exports, __webpack_require__) { -var fs = __webpack_require__(5); -var pkg = __webpack_require__(578); +var fs = __webpack_require__(6); +var pkg = __webpack_require__(586); function buildHarHeaders (headers) { return headers ? Object.keys(headers).map(function (key) { @@ -108706,7 +110770,7 @@ module.exports = HarWrapper; /***/ }), -/* 580 */ +/* 588 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -108726,8 +110790,8 @@ module.exports = HarWrapper; -var extend = __webpack_require__(142) - , cookies = __webpack_require__(251) +var extend = __webpack_require__(144) + , cookies = __webpack_require__(256) , helpers = __webpack_require__(159) var paramsHaveRequestBody = helpers.paramsHaveRequestBody @@ -108853,7 +110917,7 @@ request.forever = function (agentOptions, optionsArg) { // Exports module.exports = request -request.Request = __webpack_require__(589) +request.Request = __webpack_require__(597) request.initParams = initParams // Backwards compatibility for request.debug @@ -108869,14 +110933,14 @@ Object.defineProperty(request, 'debug', { /***/ }), -/* 581 */ +/* 589 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var caseless = __webpack_require__(126) - , uuid = __webpack_require__(73) +var caseless = __webpack_require__(129) + , uuid = __webpack_require__(58) , helpers = __webpack_require__(159) var md5 = helpers.md5 @@ -109044,7 +111108,7 @@ exports.Auth = Auth /***/ }), -/* 582 */ +/* 590 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -109130,16 +111194,16 @@ module.exports = getProxyFromURI /***/ }), -/* 583 */ +/* 591 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var fs = __webpack_require__(5) -var qs = __webpack_require__(108) -var validate = __webpack_require__(495) -var extend = __webpack_require__(142) +var fs = __webpack_require__(6) +var qs = __webpack_require__(114) +var validate = __webpack_require__(502) +var extend = __webpack_require__(144) function Har (request) { this.request = request @@ -109352,16 +111416,16 @@ exports.Har = Har /***/ }), -/* 584 */ +/* 592 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var uuid = __webpack_require__(73) - , CombinedStream = __webpack_require__(211) - , isstream = __webpack_require__(239) - , Buffer = __webpack_require__(68).Buffer +var uuid = __webpack_require__(58) + , CombinedStream = __webpack_require__(212) + , isstream = __webpack_require__(241) + , Buffer = __webpack_require__(57).Buffer function Multipart (request) { @@ -109472,19 +111536,19 @@ exports.Multipart = Multipart /***/ }), -/* 585 */ +/* 593 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var url = __webpack_require__(11) - , qs = __webpack_require__(246) - , caseless = __webpack_require__(126) - , uuid = __webpack_require__(73) - , oauth = __webpack_require__(557) - , crypto = __webpack_require__(6) - , Buffer = __webpack_require__(68).Buffer + , qs = __webpack_require__(248) + , caseless = __webpack_require__(129) + , uuid = __webpack_require__(58) + , oauth = __webpack_require__(564) + , crypto = __webpack_require__(7) + , Buffer = __webpack_require__(57).Buffer function OAuth (request) { @@ -109627,14 +111691,14 @@ exports.OAuth = OAuth /***/ }), -/* 586 */ +/* 594 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var qs = __webpack_require__(246) - , querystring = __webpack_require__(108) +var qs = __webpack_require__(248) + , querystring = __webpack_require__(114) function Querystring (request) { @@ -109685,7 +111749,7 @@ exports.Querystring = Querystring /***/ }), -/* 587 */ +/* 595 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -109849,14 +111913,14 @@ exports.Redirect = Redirect /***/ }), -/* 588 */ +/* 596 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var url = __webpack_require__(11) - , tunnel = __webpack_require__(623) + , tunnel = __webpack_require__(630) var defaultProxyHeaderWhiteList = [ 'accept', @@ -110032,42 +112096,42 @@ exports.Tunnel = Tunnel /***/ }), -/* 589 */ +/* 597 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var http = __webpack_require__(48) - , https = __webpack_require__(106) +var http = __webpack_require__(50) + , https = __webpack_require__(112) , url = __webpack_require__(11) , util = __webpack_require__(2) , stream = __webpack_require__(14) , zlib = __webpack_require__(165) - , hawk = __webpack_require__(498) - , aws2 = __webpack_require__(321) - , aws4 = __webpack_require__(322) - , httpSignature = __webpack_require__(502) - , mime = __webpack_require__(240) - , stringstream = __webpack_require__(615) - , caseless = __webpack_require__(126) - , ForeverAgent = __webpack_require__(464) - , FormData = __webpack_require__(465) - , extend = __webpack_require__(142) - , isstream = __webpack_require__(239) - , isTypedArray = __webpack_require__(534).strict + , hawk = __webpack_require__(505) + , aws2 = __webpack_require__(326) + , aws4 = __webpack_require__(327) + , httpSignature = __webpack_require__(509) + , mime = __webpack_require__(242) + , stringstream = __webpack_require__(622) + , caseless = __webpack_require__(129) + , ForeverAgent = __webpack_require__(471) + , FormData = __webpack_require__(472) + , extend = __webpack_require__(144) + , isstream = __webpack_require__(241) + , isTypedArray = __webpack_require__(541).strict , helpers = __webpack_require__(159) - , cookies = __webpack_require__(251) - , getProxyFromURI = __webpack_require__(582) - , Querystring = __webpack_require__(586).Querystring - , Har = __webpack_require__(583).Har - , Auth = __webpack_require__(581).Auth - , OAuth = __webpack_require__(585).OAuth - , Multipart = __webpack_require__(584).Multipart - , Redirect = __webpack_require__(587).Redirect - , Tunnel = __webpack_require__(588).Tunnel - , now = __webpack_require__(563) - , Buffer = __webpack_require__(68).Buffer + , cookies = __webpack_require__(256) + , getProxyFromURI = __webpack_require__(590) + , Querystring = __webpack_require__(594).Querystring + , Har = __webpack_require__(591).Har + , Auth = __webpack_require__(589).Auth + , OAuth = __webpack_require__(593).OAuth + , Multipart = __webpack_require__(592).Multipart + , Redirect = __webpack_require__(595).Redirect + , Tunnel = __webpack_require__(596).Tunnel + , now = __webpack_require__(570) + , Buffer = __webpack_require__(57).Buffer var safeStringify = helpers.safeStringify , isReadStream = helpers.isReadStream @@ -111604,13 +113668,13 @@ module.exports = Request /***/ }), -/* 590 */ +/* 598 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -const onetime = __webpack_require__(559); -const signalExit = __webpack_require__(254); +const onetime = __webpack_require__(566); +const signalExit = __webpack_require__(259); module.exports = onetime(() => { signalExit(() => { @@ -111620,16 +113684,16 @@ module.exports = onetime(() => { /***/ }), -/* 591 */ +/* 599 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(592); +module.exports = __webpack_require__(600); /***/ }), -/* 592 */ +/* 600 */ /***/ (function(module, exports, __webpack_require__) { -var RetryOperation = __webpack_require__(593); +var RetryOperation = __webpack_require__(601); exports.operation = function(options) { var timeouts = exports.timeouts(options); @@ -111731,7 +113795,7 @@ exports.wrap = function(obj, options, methods) { /***/ }), -/* 593 */ +/* 601 */ /***/ (function(module, exports) { function RetryOperation(timeouts, options) { @@ -111880,7 +113944,7 @@ RetryOperation.prototype.mainError = function() { /***/ }), -/* 594 */ +/* 602 */ /***/ (function(module, exports, __webpack_require__) { module.exports = rimraf @@ -111888,8 +113952,8 @@ rimraf.sync = rimrafSync var assert = __webpack_require__(22) var path = __webpack_require__(1) -var fs = __webpack_require__(5) -var glob = __webpack_require__(144) +var fs = __webpack_require__(6) +var glob = __webpack_require__(146) var defaultGlobOpts = { nosort: true, @@ -112249,7 +114313,7 @@ function rmkidsSync (p, options) { /***/ }), -/* 595 */ +/* 603 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -112275,7 +114339,7 @@ function rmkidsSync (p, options) { // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -113622,7 +115686,7 @@ function rmkidsSync (p, options) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 596 */ +/* 604 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -113648,7 +115712,7 @@ function rmkidsSync (p, options) { // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(252), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(257), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { root.Rx = factory(root, exports, Rx); return root.Rx; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), @@ -114162,7 +116226,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 597 */ +/* 605 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -114188,7 +116252,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) { // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -114786,7 +116850,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 598 */ +/* 606 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -114812,7 +116876,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) { // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -115417,7 +117481,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 599 */ +/* 607 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -115443,7 +117507,7 @@ Observable.fromNodeCallback = function (fn, ctx, selector) { // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -116015,7 +118079,7 @@ observableProto.flatMapWithMaxConcurrent = observableProto.flatMapMaxConcurrent /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 600 */ +/* 608 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -116041,7 +118105,7 @@ observableProto.flatMapWithMaxConcurrent = observableProto.flatMapMaxConcurrent // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -116366,7 +118430,7 @@ observableProto.flatMapWithMaxConcurrent = observableProto.flatMapMaxConcurrent /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 601 */ +/* 609 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -116392,7 +118456,7 @@ observableProto.flatMapWithMaxConcurrent = observableProto.flatMapMaxConcurrent // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -116445,7 +118509,7 @@ observableProto.flatMapWithMaxConcurrent = observableProto.flatMapMaxConcurrent /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 602 */ +/* 610 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -116471,7 +118535,7 @@ observableProto.flatMapWithMaxConcurrent = observableProto.flatMapMaxConcurrent // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(253), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(258), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { root.Rx = factory(root, exports, Rx); return root.Rx; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), @@ -116962,7 +119026,7 @@ var ReactiveTest = Rx.ReactiveTest = { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 603 */ +/* 611 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Copyright (c) Microsoft, All rights reserved. See License.txt in the project root for license information. @@ -116988,7 +119052,7 @@ var ReactiveTest = Rx.ReactiveTest = { // Because of build optimizers if (true) { - !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(29)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { + !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(30)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Rx, exports) { return factory(root, exports, Rx); }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); @@ -118442,7 +120506,7 @@ var ReactiveTest = Rx.ReactiveTest = { /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 604 */ +/* 612 */ /***/ (function(module, exports) { // This is not the set of all possible signals. @@ -118501,14 +120565,14 @@ if (process.platform === 'linux') { /***/ }), -/* 605 */ +/* 613 */ /***/ (function(module, exports, __webpack_require__) { // Load modules -var Dgram = __webpack_require__(629); -var Dns = __webpack_require__(630); -var Hoek = __webpack_require__(90); +var Dgram = __webpack_require__(636); +var Dns = __webpack_require__(637); +var Hoek = __webpack_require__(95); // Declare internals @@ -118919,10 +120983,10 @@ internals.ignore = function () { /***/ }), -/* 606 */ +/* 614 */ /***/ (function(module, exports, __webpack_require__) { -var licenseIDs = __webpack_require__(609); +var licenseIDs = __webpack_require__(617); function valid(string) { return licenseIDs.indexOf(string) > -1; @@ -119162,10 +121226,10 @@ module.exports = function(identifier) { /***/ }), -/* 607 */ +/* 615 */ /***/ (function(module, exports, __webpack_require__) { -var parser = __webpack_require__(608).parser +var parser = __webpack_require__(616).parser module.exports = function (argument) { return parser.parse(argument) @@ -119173,7 +121237,7 @@ module.exports = function (argument) { /***/ }), -/* 608 */ +/* 616 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(module) {/* parser generated by jison 0.4.17 */ @@ -120526,7 +122590,7 @@ exports.main = function commonjsMain(args) { console.log('Usage: '+args[0]+' FILE'); process.exit(1); } - var source = __webpack_require__(5).readFileSync(__webpack_require__(1).normalize(args[1]), "utf8"); + var source = __webpack_require__(6).readFileSync(__webpack_require__(1).normalize(args[1]), "utf8"); return exports.parser.parse(source); }; if (typeof module !== 'undefined' && __webpack_require__.c[__webpack_require__.s] === module) { @@ -120537,7 +122601,7 @@ if (typeof module !== 'undefined' && __webpack_require__.c[__webpack_require__.s /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(20)(module))) /***/ }), -/* 609 */ +/* 617 */ /***/ (function(module, exports) { module.exports = [ @@ -120876,332 +122940,16 @@ module.exports = [ ]; /***/ }), -/* 610 */ -/***/ (function(module, exports, __webpack_require__) { - -// Copyright 2015 Joyent, Inc. - -module.exports = DiffieHellman; - -var assert = __webpack_require__(9); -var crypto = __webpack_require__(6); -var algs = __webpack_require__(17); -var utils = __webpack_require__(13); -var ed; - -var Key = __webpack_require__(18); -var PrivateKey = __webpack_require__(19); - -var CRYPTO_HAVE_ECDH = (crypto.createECDH !== undefined); - -var ecdh, ec, jsbn; - -function DiffieHellman(key) { - utils.assertCompatible(key, Key, [1, 4], 'key'); - this._isPriv = PrivateKey.isPrivateKey(key, [1, 3]); - this._algo = key.type; - this._curve = key.curve; - this._key = key; - if (key.type === 'dsa') { - if (!CRYPTO_HAVE_ECDH) { - throw (new Error('Due to bugs in the node 0.10 ' + - 'crypto API, node 0.12.x or later is required ' + - 'to use DH')); - } - this._dh = crypto.createDiffieHellman( - key.part.p.data, undefined, - key.part.g.data, undefined); - this._p = key.part.p; - this._g = key.part.g; - if (this._isPriv) - this._dh.setPrivateKey(key.part.x.data); - this._dh.setPublicKey(key.part.y.data); - - } else if (key.type === 'ecdsa') { - if (!CRYPTO_HAVE_ECDH) { - if (ecdh === undefined) - ecdh = __webpack_require__(449); - if (ec === undefined) - ec = __webpack_require__(141); - if (jsbn === undefined) - jsbn = __webpack_require__(45).BigInteger; - - this._ecParams = new X9ECParameters(this._curve); - - if (this._isPriv) { - this._priv = new ECPrivate( - this._ecParams, key.part.d.data); - } - return; - } - - var curve = { - 'nistp256': 'prime256v1', - 'nistp384': 'secp384r1', - 'nistp521': 'secp521r1' - }[key.curve]; - this._dh = crypto.createECDH(curve); - if (typeof (this._dh) !== 'object' || - typeof (this._dh.setPrivateKey) !== 'function') { - CRYPTO_HAVE_ECDH = false; - DiffieHellman.call(this, key); - return; - } - if (this._isPriv) - this._dh.setPrivateKey(key.part.d.data); - this._dh.setPublicKey(key.part.Q.data); - - } else if (key.type === 'curve25519') { - if (ed === undefined) - ed = __webpack_require__(148); - - if (this._isPriv) { - this._priv = key.part.r.data; - if (this._priv[0] === 0x00) - this._priv = this._priv.slice(1); - this._priv = this._priv.slice(0, 32); - } - - } else { - throw (new Error('DH not supported for ' + key.type + ' keys')); - } -} - -DiffieHellman.prototype.getPublicKey = function () { - if (this._isPriv) - return (this._key.toPublic()); - return (this._key); -}; - -DiffieHellman.prototype.getPrivateKey = function () { - if (this._isPriv) - return (this._key); - else - return (undefined); -}; -DiffieHellman.prototype.getKey = DiffieHellman.prototype.getPrivateKey; - -DiffieHellman.prototype._keyCheck = function (pk, isPub) { - assert.object(pk, 'key'); - if (!isPub) - utils.assertCompatible(pk, PrivateKey, [1, 3], 'key'); - utils.assertCompatible(pk, Key, [1, 4], 'key'); - - if (pk.type !== this._algo) { - throw (new Error('A ' + pk.type + ' key cannot be used in ' + - this._algo + ' Diffie-Hellman')); - } - - if (pk.curve !== this._curve) { - throw (new Error('A key from the ' + pk.curve + ' curve ' + - 'cannot be used with a ' + this._curve + - ' Diffie-Hellman')); - } - - if (pk.type === 'dsa') { - assert.deepEqual(pk.part.p, this._p, - 'DSA key prime does not match'); - assert.deepEqual(pk.part.g, this._g, - 'DSA key generator does not match'); - } -}; - -DiffieHellman.prototype.setKey = function (pk) { - this._keyCheck(pk); - - if (pk.type === 'dsa') { - this._dh.setPrivateKey(pk.part.x.data); - this._dh.setPublicKey(pk.part.y.data); - - } else if (pk.type === 'ecdsa') { - if (CRYPTO_HAVE_ECDH) { - this._dh.setPrivateKey(pk.part.d.data); - this._dh.setPublicKey(pk.part.Q.data); - } else { - this._priv = new ECPrivate( - this._ecParams, pk.part.d.data); - } - - } else if (pk.type === 'curve25519') { - this._priv = pk.part.r.data; - if (this._priv[0] === 0x00) - this._priv = this._priv.slice(1); - this._priv = this._priv.slice(0, 32); - } - this._key = pk; - this._isPriv = true; -}; -DiffieHellman.prototype.setPrivateKey = DiffieHellman.prototype.setKey; - -DiffieHellman.prototype.computeSecret = function (otherpk) { - this._keyCheck(otherpk, true); - if (!this._isPriv) - throw (new Error('DH exchange has not been initialized with ' + - 'a private key yet')); - - var pub; - if (this._algo === 'dsa') { - return (this._dh.computeSecret( - otherpk.part.y.data)); - - } else if (this._algo === 'ecdsa') { - if (CRYPTO_HAVE_ECDH) { - return (this._dh.computeSecret( - otherpk.part.Q.data)); - } else { - pub = new ECPublic( - this._ecParams, otherpk.part.Q.data); - return (this._priv.deriveSharedSecret(pub)); - } - - } else if (this._algo === 'curve25519') { - pub = otherpk.part.R.data; - if (pub[0] === 0x00) - pub = pub.slice(1); - - var secret = ed.dh.computeKey( - this._priv.toString('binary'), - pub.toString('binary')); - - return (new Buffer(secret, 'binary')); - } - - throw (new Error('Invalid algorithm: ' + this._algo)); -}; - -DiffieHellman.prototype.generateKey = function () { - var parts = []; - var priv, pub; - if (this._algo === 'dsa') { - this._dh.generateKeys(); - - parts.push({name: 'p', data: this._p.data}); - parts.push({name: 'q', data: this._key.part.q.data}); - parts.push({name: 'g', data: this._g.data}); - parts.push({name: 'y', data: this._dh.getPublicKey()}); - parts.push({name: 'x', data: this._dh.getPrivateKey()}); - this._key = new PrivateKey({ - type: 'dsa', - parts: parts - }); - this._isPriv = true; - return (this._key); - - } else if (this._algo === 'ecdsa') { - if (CRYPTO_HAVE_ECDH) { - this._dh.generateKeys(); - - parts.push({name: 'curve', - data: new Buffer(this._curve)}); - parts.push({name: 'Q', data: this._dh.getPublicKey()}); - parts.push({name: 'd', data: this._dh.getPrivateKey()}); - this._key = new PrivateKey({ - type: 'ecdsa', - curve: this._curve, - parts: parts - }); - this._isPriv = true; - return (this._key); - - } else { - var n = this._ecParams.getN(); - var r = new jsbn(crypto.randomBytes(n.bitLength())); - var n1 = n.subtract(jsbn.ONE); - priv = r.mod(n1).add(jsbn.ONE); - pub = this._ecParams.getG().multiply(priv); - - priv = new Buffer(priv.toByteArray()); - pub = new Buffer(this._ecParams.getCurve(). - encodePointHex(pub), 'hex'); - - this._priv = new ECPrivate(this._ecParams, priv); - - parts.push({name: 'curve', - data: new Buffer(this._curve)}); - parts.push({name: 'Q', data: pub}); - parts.push({name: 'd', data: priv}); - - this._key = new PrivateKey({ - type: 'ecdsa', - curve: this._curve, - parts: parts - }); - this._isPriv = true; - return (this._key); - } - - } else if (this._algo === 'curve25519') { - priv = ed.dh.generateKey(); - pub = ed.dh.publicKey(priv); - this._priv = priv = new Buffer(priv, 'binary'); - pub = new Buffer(pub, 'binary'); - - parts.push({name: 'R', data: pub}); - parts.push({name: 'r', data: Buffer.concat([priv, pub])}); - this._key = new PrivateKey({ - type: 'curve25519', - parts: parts - }); - this._isPriv = true; - return (this._key); - } - - throw (new Error('Invalid algorithm: ' + this._algo)); -}; -DiffieHellman.prototype.generateKeys = DiffieHellman.prototype.generateKey; - -/* These are helpers for using ecc-jsbn (for node 0.10 compatibility). */ - -function X9ECParameters(name) { - var params = algs.curves[name]; - assert.object(params); - - var p = new jsbn(params.p); - var a = new jsbn(params.a); - var b = new jsbn(params.b); - var n = new jsbn(params.n); - var h = jsbn.ONE; - var curve = new ec.ECCurveFp(p, a, b); - var G = curve.decodePointHex(params.G.toString('hex')); - - this.curve = curve; - this.g = G; - this.n = n; - this.h = h; -} -X9ECParameters.prototype.getCurve = function () { return (this.curve); }; -X9ECParameters.prototype.getG = function () { return (this.g); }; -X9ECParameters.prototype.getN = function () { return (this.n); }; -X9ECParameters.prototype.getH = function () { return (this.h); }; - -function ECPublic(params, buffer) { - this._params = params; - if (buffer[0] === 0x00) - buffer = buffer.slice(1); - this._pub = params.getCurve().decodePointHex(buffer.toString('hex')); -} - -function ECPrivate(params, buffer) { - this._params = params; - this._priv = new jsbn(utils.mpNormalize(buffer)); -} -ECPrivate.prototype.deriveSharedSecret = function (pubKey) { - assert.ok(pubKey instanceof ECPublic); - var S = pubKey._pub.multiply(this._priv); - return (new Buffer(S.getX().toBigInteger().toByteArray())); -}; - - -/***/ }), -/* 611 */ +/* 618 */ /***/ (function(module, exports, __webpack_require__) { -// Copyright 2016 Joyent, Inc. +// Copyright 2017 Joyent, Inc. module.exports = { read: read, verify: verify, sign: sign, + signAsync: signAsync, write: write, /* Internal private API */ @@ -121210,16 +122958,16 @@ module.exports = { }; var assert = __webpack_require__(9); -var SSHBuffer = __webpack_require__(102); -var crypto = __webpack_require__(6); +var SSHBuffer = __webpack_require__(108); +var crypto = __webpack_require__(7); var algs = __webpack_require__(17); var Key = __webpack_require__(18); var PrivateKey = __webpack_require__(19); -var Identity = __webpack_require__(72); -var rfc4253 = __webpack_require__(47); +var Identity = __webpack_require__(75); +var rfc4253 = __webpack_require__(48); var Signature = __webpack_require__(33); var utils = __webpack_require__(13); -var Certificate = __webpack_require__(69); +var Certificate = __webpack_require__(72); function verify(cert, key) { /* @@ -121386,6 +123134,38 @@ function sign(cert, key) { return (true); } +function signAsync(cert, signer, done) { + if (cert.signatures.openssh === undefined) + cert.signatures.openssh = {}; + try { + var blob = toBuffer(cert, true); + } catch (e) { + delete (cert.signatures.openssh); + done(e); + return; + } + var sig = cert.signatures.openssh; + + signer(blob, function (err, signature) { + if (err) { + done(err); + return; + } + try { + /* + * This will throw if the signature isn't of a + * type/algo that can be used for SSH. + */ + signature.toBuffer('ssh'); + } catch (e) { + done(e); + return; + } + sig.signature = signature; + done(); + }); +} + function write(cert, options) { if (options === undefined) options = {}; @@ -121488,12 +123268,12 @@ function getCertType(key) { /***/ }), -/* 612 */ +/* 619 */ /***/ (function(module, exports, __webpack_require__) { // Copyright 2016 Joyent, Inc. -var x509 = __webpack_require__(259); +var x509 = __webpack_require__(265); module.exports = { read: read, @@ -121503,15 +123283,15 @@ module.exports = { }; var assert = __webpack_require__(9); -var asn1 = __webpack_require__(35); +var asn1 = __webpack_require__(34); var algs = __webpack_require__(17); var utils = __webpack_require__(13); var Key = __webpack_require__(18); var PrivateKey = __webpack_require__(19); var pem = __webpack_require__(40); -var Identity = __webpack_require__(72); +var Identity = __webpack_require__(75); var Signature = __webpack_require__(33); -var Certificate = __webpack_require__(69); +var Certificate = __webpack_require__(72); function read(buf, options) { if (typeof (buf) !== 'string') { @@ -121571,7 +123351,7 @@ function write(cert, options) { /***/ }), -/* 613 */ +/* 620 */ /***/ (function(module, exports) { module.exports = shift @@ -121597,7 +123377,7 @@ function getStateLength (state) { /***/ }), -/* 614 */ +/* 621 */ /***/ (function(module, exports) { /*! http://mths.be/codepointat v0.2.0 by @mathias */ @@ -121657,7 +123437,7 @@ if (!String.prototype.codePointAt) { /***/ }), -/* 615 */ +/* 622 */ /***/ (function(module, exports, __webpack_require__) { var util = __webpack_require__(2) @@ -121765,16 +123545,16 @@ function alignedWrite(buffer) { /***/ }), -/* 616 */ +/* 623 */ /***/ (function(module, exports, __webpack_require__) { var util = __webpack_require__(2) -var bl = __webpack_require__(390) -var xtend = __webpack_require__(271) -var headers = __webpack_require__(262) +var bl = __webpack_require__(399) +var xtend = __webpack_require__(276) +var headers = __webpack_require__(267) -var Writable = __webpack_require__(67).Writable -var PassThrough = __webpack_require__(67).PassThrough +var Writable = __webpack_require__(47).Writable +var PassThrough = __webpack_require__(47).PassThrough var noop = function () {} @@ -121936,7 +123716,7 @@ var Extract = function (opts) { self._locked = true - if (!header.size) { + if (!header.size || header.type === 'directory') { self._parse(512, onheader) self.emit('entry', header, emptyStream(self, offset), onunlock) return @@ -122017,18 +123797,18 @@ module.exports = Extract /***/ }), -/* 617 */ +/* 624 */ /***/ (function(module, exports, __webpack_require__) { -var constants = __webpack_require__(273) -var eos = __webpack_require__(227) +var constants = __webpack_require__(278) +var eos = __webpack_require__(229) var util = __webpack_require__(2) -var Readable = __webpack_require__(67).Readable -var Writable = __webpack_require__(67).Writable +var Readable = __webpack_require__(47).Readable +var Writable = __webpack_require__(47).Writable var StringDecoder = __webpack_require__(164).StringDecoder -var headers = __webpack_require__(262) +var headers = __webpack_require__(267) var DMODE = parseInt('755', 8) var FMODE = parseInt('644', 8) @@ -122277,7 +124057,7 @@ module.exports = Pack /***/ }), -/* 618 */ +/* 625 */ /***/ (function(module, exports, __webpack_require__) { var Stream = __webpack_require__(14) @@ -122391,7 +124171,7 @@ function through (write, end, opts) { /***/ }), -/* 619 */ +/* 626 */ /***/ (function(module, exports, __webpack_require__) { /*! @@ -122406,10 +124186,10 @@ function through (write, end, opts) { * Module dependencies. */ var - fs = __webpack_require__(5), + fs = __webpack_require__(6), path = __webpack_require__(1), - crypto = __webpack_require__(6), - tmpDir = __webpack_require__(560), + crypto = __webpack_require__(7), + tmpDir = __webpack_require__(567), _c = process.binding('constants'); @@ -122886,7 +124666,7 @@ module.exports.setGracefulCleanup = _setGracefulCleanup; /***/ }), -/* 620 */ +/* 627 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -122921,17 +124701,17 @@ module.exports.setGracefulCleanup = _setGracefulCleanup; * POSSIBILITY OF SUCH DAMAGE. */ -var net = __webpack_require__(74); +var net = __webpack_require__(77); var urlParse = __webpack_require__(11).parse; -var pubsuffix = __webpack_require__(267); -var Store = __webpack_require__(268).Store; -var MemoryCookieStore = __webpack_require__(621).MemoryCookieStore; -var pathMatch = __webpack_require__(265).pathMatch; -var VERSION = __webpack_require__(622).version; +var pubsuffix = __webpack_require__(272); +var Store = __webpack_require__(273).Store; +var MemoryCookieStore = __webpack_require__(628).MemoryCookieStore; +var pathMatch = __webpack_require__(270).pathMatch; +var VERSION = __webpack_require__(629).version; var punycode; try { - punycode = __webpack_require__(274); + punycode = __webpack_require__(279); } catch(e) { console.warn("cookie: can't load punycode; won't use punycode for domain normalization"); } @@ -124222,14 +126002,14 @@ module.exports = { pathMatch: pathMatch, getPublicSuffix: pubsuffix.getPublicSuffix, cookieCompare: cookieCompare, - permuteDomain: __webpack_require__(266).permuteDomain, + permuteDomain: __webpack_require__(271).permuteDomain, permutePath: permutePath, canonicalDomain: canonicalDomain }; /***/ }), -/* 621 */ +/* 628 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; @@ -124264,9 +126044,9 @@ module.exports = { * POSSIBILITY OF SUCH DAMAGE. */ -var Store = __webpack_require__(268).Store; -var permuteDomain = __webpack_require__(266).permuteDomain; -var pathMatch = __webpack_require__(265).pathMatch; +var Store = __webpack_require__(273).Store; +var permuteDomain = __webpack_require__(271).permuteDomain; +var pathMatch = __webpack_require__(270).pathMatch; var util = __webpack_require__(2); function MemoryCookieStore() { @@ -124406,7 +126186,7 @@ MemoryCookieStore.prototype.getAllCookies = function(cb) { /***/ }), -/* 622 */ +/* 629 */ /***/ (function(module, exports) { module.exports = { @@ -124485,20 +126265,20 @@ module.exports = { }; /***/ }), -/* 623 */ +/* 630 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; -var net = __webpack_require__(74) - , tls = __webpack_require__(275) - , http = __webpack_require__(48) - , https = __webpack_require__(106) - , events = __webpack_require__(34) +var net = __webpack_require__(77) + , tls = __webpack_require__(280) + , http = __webpack_require__(50) + , https = __webpack_require__(112) + , events = __webpack_require__(49) , assert = __webpack_require__(22) , util = __webpack_require__(2) - , Buffer = __webpack_require__(68).Buffer + , Buffer = __webpack_require__(57).Buffer ; exports.httpOverHttp = httpOverHttp @@ -124736,7 +126516,7 @@ exports.debug = debug // for test /***/ }), -/* 624 */ +/* 631 */ /***/ (function(module, exports, __webpack_require__) { @@ -124748,14 +126528,14 @@ module.exports = __webpack_require__(2).deprecate; /***/ }), -/* 625 */ +/* 632 */ /***/ (function(module, exports, __webpack_require__) { // Unique ID creation requires a high quality random # generator. We feature // detect to determine the best RNG source, normalizing to a function that // returns 128-bits of randomness, since that's what's usually required -var rng = __webpack_require__(270); -var bytesToUuid = __webpack_require__(269); +var rng = __webpack_require__(275); +var bytesToUuid = __webpack_require__(274); // **`v1()` - Generate time-based UUID** // @@ -124857,11 +126637,11 @@ module.exports = v1; /***/ }), -/* 626 */ +/* 633 */ /***/ (function(module, exports, __webpack_require__) { -var rng = __webpack_require__(270); -var bytesToUuid = __webpack_require__(269); +var rng = __webpack_require__(275); +var bytesToUuid = __webpack_require__(274); function v4(options, buf, offset) { var i = buf && offset || 0; @@ -124892,11 +126672,11 @@ module.exports = v4; /***/ }), -/* 627 */ +/* 634 */ /***/ (function(module, exports, __webpack_require__) { -var parse = __webpack_require__(607); -var correct = __webpack_require__(606); +var parse = __webpack_require__(615); +var correct = __webpack_require__(614); var genericWarning = ( 'license should be ' + @@ -124982,7 +126762,7 @@ module.exports = function(argument) { /***/ }), -/* 628 */ +/* 635 */ /***/ (function(module, exports, __webpack_require__) { /* @@ -124992,7 +126772,7 @@ module.exports = function(argument) { var mod_assert = __webpack_require__(22); var mod_util = __webpack_require__(2); -var mod_extsprintf = __webpack_require__(229); +var mod_extsprintf = __webpack_require__(231); /* * Public interface @@ -125145,22 +126925,22 @@ WError.prototype.cause = function we_cause(c) /***/ }), -/* 629 */ +/* 636 */ /***/ (function(module, exports) { module.exports = require("dgram"); /***/ }), -/* 630 */ +/* 637 */ /***/ (function(module, exports) { module.exports = require("dns"); /***/ }), -/* 631 */ +/* 638 */ /***/ (function(module, exports, __webpack_require__) { -module.exports = __webpack_require__(276); +module.exports = __webpack_require__(281); /***/ }) diff --git a/typings/fcopy-pre-bundled.d.ts b/typings/fcopy-pre-bundled.d.ts new file mode 100644 index 0000000000..5a07f20040 --- /dev/null +++ b/typings/fcopy-pre-bundled.d.ts @@ -0,0 +1,3 @@ +declare module "fcopy-pre-bundled" { + export default function fcopy(src: string, dest: string, opts: any, callback: (error?: Error) => void) +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 09f79cd1b4..1dad1c2db1 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1231,6 +1231,10 @@ fb-watchman@^2.0.0: dependencies: bser "^2.0.0" +fcopy-pre-bundled@^0.1.2: + version "0.1.2" + resolved "https://registry.yarnpkg.com/fcopy-pre-bundled/-/fcopy-pre-bundled-0.1.2.tgz#656baeb0d0c450cafa9c902664d440ceb99bcde1" + feature-detect-es6@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/feature-detect-es6/-/feature-detect-es6-1.3.1.tgz#f888736af9cb0c91f55663bfa4762eb96ee7047f"