From aa1a3cb452e470436f1094b4f87b2cff3c72dd02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20Nison?= Date: Fri, 2 Aug 2019 22:36:00 +0200 Subject: [PATCH] wip --- .gitignore | 4 - .pnp.js | 19 + packages/berry-builder/lib/boot-dev.js | 2 - packages/berry-builder/lib/boot.js | 6 - packages/berry-builder/lib/cli.js | 23 - .../lib/commands/build/bundle.js | 107 - .../lib/commands/build/plugin.js | 115 - packages/berry-builder/lib/commands/help.js | 20 - .../berry-builder/lib/commands/new/plugin.js | 92 - .../berry-builder/lib/data/dynamicLibs.js | 22 - .../berry-builder/lib/tools/findPlugins.js | 18 - .../berry-builder/lib/tools/makeConfig.js | 51 - packages/berry-builder/lib/tools/reindent.js | 20 - packages/berry-builder/package.json | 4 +- packages/berry-builder/sources/boot-dev.js | 2 +- packages/berry-builder/sources/boot.js | 6 +- packages/berry-cli/bin/berry.js | 7 +- packages/berry-pnp/sources/loader/makeApi.ts | 2 + packages/berry-pnpify/lib/NodeModulesFS.d.ts | 14 - .../berry-pnpify/lib/NodePathResolver.d.ts | 71 - packages/berry-pnpify/lib/PortablePnPApi.d.ts | 29 - packages/berry-pnpify/lib/bin.d.ts | 1 - packages/berry-pnpify/lib/bin.js | 3040 ----------------- packages/berry-pnpify/lib/dynamicRequire.d.ts | 2 - packages/berry-pnpify/lib/generateSdk.d.ts | 3 - packages/berry-pnpify/lib/index.d.ts | 3 - packages/berry-pnpify/lib/index.js | 1455 -------- packages/berry-pnpify/package.json | 12 +- packages/berry-pnpify/sources/boot-dev.js | 4 + packages/berry-pnpify/sources/boot.js | 1 + .../berry-pnpify/sources/{bin.ts => cli.ts} | 2 +- packages/berry-pnpify/tsconfig.json | 59 +- yarn.lock | 3 +- 33 files changed, 44 insertions(+), 5175 deletions(-) delete mode 100644 packages/berry-builder/lib/boot-dev.js delete mode 100644 packages/berry-builder/lib/boot.js delete mode 100644 packages/berry-builder/lib/cli.js delete mode 100644 packages/berry-builder/lib/commands/build/bundle.js delete mode 100644 packages/berry-builder/lib/commands/build/plugin.js delete mode 100644 packages/berry-builder/lib/commands/help.js delete mode 100644 packages/berry-builder/lib/commands/new/plugin.js delete mode 100644 packages/berry-builder/lib/data/dynamicLibs.js delete mode 100644 packages/berry-builder/lib/tools/findPlugins.js delete mode 100644 packages/berry-builder/lib/tools/makeConfig.js delete mode 100644 packages/berry-builder/lib/tools/reindent.js delete mode 100644 packages/berry-pnpify/lib/NodeModulesFS.d.ts delete mode 100644 packages/berry-pnpify/lib/NodePathResolver.d.ts delete mode 100644 packages/berry-pnpify/lib/PortablePnPApi.d.ts delete mode 100644 packages/berry-pnpify/lib/bin.d.ts delete mode 100644 packages/berry-pnpify/lib/bin.js delete mode 100644 packages/berry-pnpify/lib/dynamicRequire.d.ts delete mode 100644 packages/berry-pnpify/lib/generateSdk.d.ts delete mode 100644 packages/berry-pnpify/lib/index.d.ts delete mode 100644 packages/berry-pnpify/lib/index.js create mode 100644 packages/berry-pnpify/sources/boot-dev.js create mode 100644 packages/berry-pnpify/sources/boot.js rename packages/berry-pnpify/sources/{bin.ts => cli.ts} (97%) diff --git a/.gitignore b/.gitignore index 21c2fe8f35e1..dee86f7047bc 100644 --- a/.gitignore +++ b/.gitignore @@ -14,10 +14,6 @@ junit.xml # Those folders are meant to contain the prepack build artifacts; we don't commit them lib -# We check-in pnpify and builder because we need them in order to compile the rest of the code -!/packages/berry-builder/lib -!/packages/berry-pnpify/lib - # We check-in the PnP hook because it would be heavy to regenerate it before each bundle build !/packages/berry-pnp/lib/hook.js diff --git a/.pnp.js b/.pnp.js index be00d7a38809..bff36f832e9c 100755 --- a/.pnp.js +++ b/.pnp.js @@ -3171,6 +3171,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:62cfaafaea02f229113389f4598b50cc66d5eab2c6e550e5087b6df728c935df26ec42213167bc95f60dabcb1307de436bd210874a73a5186c65ff2aa293298d#virtual:ebda344aac3d4e2c5e1a7f09ca03a20b768b09c34c877988dc4728f1bbd588bc0781f345fc383448215cc1cf688c22707f0757da5361f31e9a446c4ff7d97a3c#npm:3.3.2"] @@ -3185,6 +3186,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:084295d92e5d79f83eae27a4d713651bc56c02e7eced743c8687a64581a2cf7c7d6f806c508ec836c8f857844a6b32a9a4d9aff3d20a98c279c8985f734056a2#npm:3.3.2"] @@ -3199,6 +3201,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:ebda344aac3d4e2c5e1a7f09ca03a20b768b09c34c877988dc4728f1bbd588bc0781f345fc383448215cc1cf688c22707f0757da5361f31e9a446c4ff7d97a3c#npm:3.3.2"] @@ -3213,6 +3216,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:3567f48dde412faeedd72867112ff7908dea950c4514f3acadbd741846d13a989856d71986b117878761e0a02e48fd285846f0bac350c9276c9f55ae393c1bb6#virtual:88bf0fd813c3ba3cdff3158185976970b82deecf2d8542a02698a905f41bf70978521adb55bd6740da91a6efd87dada9b6c89dc11a76ac81e03171c97bf9e512#npm:3.3.2"] @@ -3227,6 +3231,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:cfccf1ec62c750456e00cefffa4efcdca489c05ea07941a190b09de8b946945370bf21154ce31f24d8c8c1100fc6c1f0f91f20f778b3f08a8705820eda965f25#virtual:ebda344aac3d4e2c5e1a7f09ca03a20b768b09c34c877988dc4728f1bbd588bc0781f345fc383448215cc1cf688c22707f0757da5361f31e9a446c4ff7d97a3c#npm:3.3.2"] @@ -3241,6 +3246,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:b9837795e64e120904d27e33de49c0b8e803ec181240c7f81e821b522b4b72dd6b3f65a1040fe1d4bede7af08e0583c01603f9d4c7b74c428a891f74941ad816#npm:3.3.2"] @@ -3255,6 +3261,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:e1f9f8205713ba840c1eaa64a4fef8d662dff69a9d66f67fb7f0bc614c6a728afe1d12fe47e91acadc5777f88a44c8dd8679cfc0e9a6d2b48280ccabf71b2b3b#npm:3.3.2"] @@ -3269,6 +3276,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:bf720cc4a1ad6062ba6c0264067362e8d4e5e40f707b399f7174246aa0c135f8317e4392830b097cf0817015cbe315ed8d96f482de35c813723621d8ff77a5f7#npm:3.3.2"] @@ -3283,6 +3291,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:5c86ac5a7ab46c5922cbd85089e5840fc0e5add86bbbbbfdc4b2795772f78e9b7a5ac1990b2e5f9e3cf80ff339ec736da77a24d9d939f60e1b1f0c223ee68f3b#npm:3.3.2"] @@ -3297,6 +3306,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:e473704238ca9e94dd23c55c23a35f3d933b0f3951240c94324158f62f085b4c7733cee7b3c465f41bcc42c3b713fec98822abf9f8a861f5191053979320ae98#npm:3.3.2"] @@ -3311,6 +3321,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:8ee34d2dfc5cb775e2b73dd74bd1c27de0a22464dbde8bfdb58627e95fdc9061a1b88c779a017ff942f2dac4739cab0e54b6d4bc416b8cb3bc88cab9998be5cf#npm:3.3.2"] @@ -3325,6 +3336,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", "npm:5.16.0"], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:4360deae1e446a1bbda907566d928a7f59cf80b6b0f4cffd92c49c13d113c2d09cd5ab3ab436185adf2fc40ecdc08512ccf983172e3453fdaae9084e674e7afd#npm:3.3.2"] @@ -3339,6 +3351,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:b5ad5cc1737cd8e2a0141f0ced6af9d0b3c75788d95105ee239f65e292955efd4dbd60b9065608c494107ebce893bc8722fde17efd3c04d3884162dc50188a51#npm:3.3.2"] @@ -3353,6 +3366,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:156d1ae3be9fd8c8ccccfddaf6faf9fd62cdca17e3b3b55b01cf40779daea91b6828fdfe4f565499659c5e7d10369e65334f9ed48645aac31eba0dd0c6ac83fd#npm:3.3.2"] @@ -3367,6 +3381,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:5dc4321d4efc80e9fe6908fb4bef694ac4c7360a4ddbe90c61517bd499e08dc5afdb8ff81bde4c9eb57776ef2cd2235fe6eb0c22fd5ecca928cb2b714bc86435#npm:3.3.2"] @@ -3381,6 +3396,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:dd342b9cc5dc9bd043058cc775464375237e910716804efdfff68b073d94c50173df6dfe91670e4ad5282e85dcd92ef6e630271c887af4c5ed4c1fb089a88326#npm:3.3.2"] @@ -3395,6 +3411,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:f1013090d7ec7f639986726ebb5dd6b6c3f0c9f49aa47a31bbe0cb197b7602ddddf60a05833d0f95d1f8a9e0e164b5fb174eee12eda8020ef94a381c15d9f1a8#npm:3.3.2"] @@ -3409,6 +3426,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", null], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:c2ebc1d8d4ce2c3f1f78762fce3ac1e1162c11de01383a6923a5bf98c376510a88b6dd410484cc1dd8c531a7ca91b8bc64c9df6aa4de57ddce8aa96c8d17bf05#npm:3.3.2"] @@ -3423,6 +3441,7 @@ function $$SETUP_STATE(hydrateRuntimeState) { ["@types/eslint", "npm:4.16.6"], ["cross-spawn", "npm:6.0.5"], ["eslint", "npm:5.16.0"], + ["ts-node", "npm:7.0.1"], ["typescript", "npm:3.3.3333"], ["webpack", "npm:4.28.4"], ["webpack-cli", "virtual:88bf0fd813c3ba3cdff3158185976970b82deecf2d8542a02698a905f41bf70978521adb55bd6740da91a6efd87dada9b6c89dc11a76ac81e03171c97bf9e512#npm:3.3.2"] diff --git a/packages/berry-builder/lib/boot-dev.js b/packages/berry-builder/lib/boot-dev.js deleted file mode 100644 index 34cbe26bcce4..000000000000 --- a/packages/berry-builder/lib/boot-dev.js +++ /dev/null @@ -1,2 +0,0 @@ -require(`ts-node`).register(); -require(`./boot`); diff --git a/packages/berry-builder/lib/boot.js b/packages/berry-builder/lib/boot.js deleted file mode 100644 index fb589e780450..000000000000 --- a/packages/berry-builder/lib/boot.js +++ /dev/null @@ -1,6 +0,0 @@ -// TypeScript (ts-loader) isn't able to find out the typeRoots when using zip -// loading (because they're stored within the zip files). So we need to use -// PnPify to help them find them without having to manually list them all in -// the typeRoots setting. -require(`@berry/pnpify/lib`).patchFs(); -require(`./cli`); diff --git a/packages/berry-builder/lib/cli.js b/packages/berry-builder/lib/cli.js deleted file mode 100644 index 79d01bb6df5a..000000000000 --- a/packages/berry-builder/lib/cli.js +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env node -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const clipanion_1 = require("clipanion"); -const bundle_1 = __importDefault(require("./commands/build/bundle")); -const plugin_1 = __importDefault(require("./commands/build/plugin")); -const help_1 = __importDefault(require("./commands/help")); -const plugin_2 = __importDefault(require("./commands/new/plugin")); -const cli = new clipanion_1.Cli({ - binaryName: `yarn builder`, -}); -cli.register(plugin_2.default); -cli.register(bundle_1.default); -cli.register(plugin_1.default); -cli.register(help_1.default); -cli.runExit(process.argv.slice(2), { - stdin: process.stdin, - stdout: process.stdout, - stderr: process.stderr, -}); diff --git a/packages/berry-builder/lib/commands/build/bundle.js b/packages/berry-builder/lib/commands/build/bundle.js deleted file mode 100644 index 151699d732d6..000000000000 --- a/packages/berry-builder/lib/commands/build/bundle.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const chalk_1 = __importDefault(require("chalk")); -const clipanion_1 = require("clipanion"); -const filesize_1 = __importDefault(require("filesize")); -const fs_1 = __importDefault(require("fs")); -const path_1 = __importDefault(require("path")); -const webpack_1 = __importDefault(require("webpack")); -const dynamicLibs_1 = require("../../data/dynamicLibs"); -const findPlugins_1 = require("../../tools/findPlugins"); -const makeConfig_1 = require("../../tools/makeConfig"); -const pkgJsonVersion = (basedir) => { - const pkgJson = require(`${basedir}/package.json`); - return JSON.stringify(pkgJson["version"]); -}; -// eslint-disable-next-line arca/no-default-export -class BuildBundleCommand extends clipanion_1.Command { - constructor() { - super(...arguments); - this.profile = `standard`; - this.plugins = []; - } - async execute() { - const basedir = process.cwd(); - const plugins = findPlugins_1.findPlugins({ basedir, profile: this.profile, plugins: this.plugins }); - const modules = Array.from(dynamicLibs_1.dynamicLibs).concat(plugins); - const output = `${basedir}/bundles/berry.js`; - const compiler = webpack_1.default(makeConfig_1.makeConfig({ - context: basedir, - entry: `./sources/cli.ts`, - bail: true, - output: { - filename: path_1.default.basename(output), - path: path_1.default.dirname(output), - }, - module: { - rules: [{ - // This file is particular in that it exposes the bundle - // configuration to the bundle itself (primitive introspection). - test: path_1.default.resolve(basedir, `sources/pluginConfiguration.raw.js`), - use: { - loader: require.resolve(`val-loader`), - options: { modules, plugins }, - }, - }], - }, - plugins: [ - new webpack_1.default.BannerPlugin({ - entryOnly: true, - banner: `#!/usr/bin/env node`, - raw: true, - }), - new webpack_1.default.DefinePlugin({ - [`BERRY_VERSION`]: pkgJsonVersion(basedir), - }), - ], - })); - const buildErrors = await new Promise((resolve, reject) => { - compiler.run((err, stats) => { - if (err) { - reject(err); - } - else if (stats.compilation.errors.length > 0) { - resolve(stats.toString(`errors-only`)); - } - else { - resolve(null); - } - }); - }); - if (buildErrors) { - this.context.stdout.write(`${chalk_1.default.red(`✗`)} Failed to build the CLI:\n`); - this.context.stdout.write(`${buildErrors}\n`); - return 1; - } - else { - this.context.stdout.write(`${chalk_1.default.green(`✓`)} Done building the CLI!\n`); - this.context.stdout.write(`${chalk_1.default.cyan(`?`)} Bundle path: ${output}\n`); - this.context.stdout.write(`${chalk_1.default.cyan(`?`)} Bundle size: ${filesize_1.default(fs_1.default.statSync(output).size)}\n`); - for (const plugin of plugins) - this.context.stdout.write(` ${chalk_1.default.yellow(`→`)} ${plugin}\n`); - return 0; - } - } -} -BuildBundleCommand.usage = clipanion_1.Command.Usage({ - description: `build the local bundle`, -}); -__decorate([ - clipanion_1.Command.String(`--profile`) -], BuildBundleCommand.prototype, "profile", void 0); -__decorate([ - clipanion_1.Command.Array(`--plugin`) -], BuildBundleCommand.prototype, "plugins", void 0); -__decorate([ - clipanion_1.Command.Path(`build`, `bundle`) -], BuildBundleCommand.prototype, "execute", null); -exports.default = BuildBundleCommand; diff --git a/packages/berry-builder/lib/commands/build/plugin.js b/packages/berry-builder/lib/commands/build/plugin.js deleted file mode 100644 index 7d70ff76ded9..000000000000 --- a/packages/berry-builder/lib/commands/build/plugin.js +++ /dev/null @@ -1,115 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const chalk_1 = __importDefault(require("chalk")); -const clipanion_1 = require("clipanion"); -const filesize_1 = __importDefault(require("filesize")); -const fs_1 = __importDefault(require("fs")); -const path_1 = __importDefault(require("path")); -const webpack_sources_1 = require("webpack-sources"); -const webpack_1 = __importDefault(require("webpack")); -const dynamicLibs_1 = require("../../data/dynamicLibs"); -const makeConfig_1 = require("../../tools/makeConfig"); -const reindent_1 = require("../../tools/reindent"); -// The name gets normalized so that everyone can override some plugins by -// their own (@arcanis/berry-plugin-foo would override @berry/plugin-foo -// as well as @mael/berry-plugin-foo) -const getNormalizedName = (name) => { - const parsing = name.match(/^(?:@berry\/|(?:@[^\/]+\/)?berry-)(plugin-[^\/]+)/); - if (parsing === null) - throw new clipanion_1.UsageError(`Invalid plugin name "${name}" - it should be "berry-plugin-"`); - return `@berry/${parsing[1]}`; -}; -// eslint-disable-next-line arca/no-default-export -class BuildPluginCommand extends clipanion_1.Command { - async execute() { - const basedir = process.cwd(); - const { name: rawName } = require(`${basedir}/package.json`); - const name = getNormalizedName(rawName); - const output = `${basedir}/bundles/${name}.js`; - const compiler = webpack_1.default(makeConfig_1.makeConfig({ - context: basedir, - entry: `.`, - output: { - filename: path_1.default.basename(output), - path: path_1.default.dirname(output), - libraryTarget: `var`, - library: `plugin`, - }, - externals: [ - (context, request, callback) => { - if (request !== name && dynamicLibs_1.isDynamicLib(request)) { - callback(null, `commonjs ${request}`); - } - else { - callback(); - } - }, - ], - plugins: [ - // This plugin wraps the generated bundle so that it doesn't actually - // get evaluated right now - until after we give it a custom require - // function that will be able to fetch the dynamic modules. - { apply: (compiler) => { - compiler.hooks.compilation.tap(`MyPlugin`, (compilation) => { - compilation.hooks.optimizeChunkAssets.tap(`MyPlugin`, (chunks) => { - for (const chunk of chunks) { - for (const file of chunk.files) { - compilation.assets[file] = new webpack_sources_1.RawSource(reindent_1.reindent(` - module.exports = {}; - - module.exports.factory = function (require) { -${reindent_1.reindent(compilation.assets[file].source().replace(/^ +/, ``), 11)} - return plugin; - }; - - module.exports.name = ${JSON.stringify(name)}; - `)); - } - } - }); - }); - } }, - ], - })); - const buildErrors = await new Promise((resolve, reject) => { - compiler.run((err, stats) => { - if (err) { - reject(err); - } - else if (stats.compilation.errors.length > 0) { - resolve(stats.toString(`errors-only`)); - } - else { - resolve(null); - } - }); - }); - if (buildErrors !== null) { - this.context.stdout.write(`${chalk_1.default.red(`✗`)} Failed to build ${name}:\n`); - this.context.stdout.write(`${buildErrors}\n`); - return 1; - } - else { - this.context.stdout.write(`${chalk_1.default.green(`✓`)} Done building ${name}!\n`); - this.context.stdout.write(`${chalk_1.default.cyan(`?`)} Bundle path: ${output}\n`); - this.context.stdout.write(`${chalk_1.default.cyan(`?`)} Bundle size: ${filesize_1.default(fs_1.default.statSync(output).size)}\n`); - return 0; - } - } -} -BuildPluginCommand.usage = clipanion_1.Command.Usage({ - description: `build the local plugin`, -}); -__decorate([ - clipanion_1.Command.Path(`build`, `plugin`) -], BuildPluginCommand.prototype, "execute", null); -exports.default = BuildPluginCommand; diff --git a/packages/berry-builder/lib/commands/help.js b/packages/berry-builder/lib/commands/help.js deleted file mode 100644 index 3832fa5be021..000000000000 --- a/packages/berry-builder/lib/commands/help.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const clipanion_1 = require("clipanion"); -// eslint-disable-next-line arca/no-default-export -class HelpCommand extends clipanion_1.Command { - async execute() { - this.context.stdout.write(this.cli.usage(null)); - } -} -__decorate([ - clipanion_1.Command.Path(`--help`), - clipanion_1.Command.Path(`-h`) -], HelpCommand.prototype, "execute", null); -exports.default = HelpCommand; diff --git a/packages/berry-builder/lib/commands/new/plugin.js b/packages/berry-builder/lib/commands/new/plugin.js deleted file mode 100644 index 547fcf237164..000000000000 --- a/packages/berry-builder/lib/commands/new/plugin.js +++ /dev/null @@ -1,92 +0,0 @@ -"use strict"; -var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { - var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; - if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); - else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; - return c > 3 && r && Object.defineProperty(target, key, r), r; -}; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const fslib_1 = require("@berry/fslib"); -const chalk_1 = __importDefault(require("chalk")); -const clipanion_1 = require("clipanion"); -const path_1 = __importDefault(require("path")); -// eslint-disable-next-line arca/no-default-export -class NewPluginCommand extends clipanion_1.Command { - async execute() { - const target = fslib_1.NodeFS.toPortablePath(path_1.default.resolve(this.target)); - if (await fslib_1.xfs.existsPromise(target)) { - const listing = await fslib_1.xfs.readdirPromise(target); - if (listing.length !== 0) { - throw new clipanion_1.UsageError(`The target directory (${this.target}) isn't empty; aborting the scaffolding.`); - } - } - await fslib_1.xfs.mkdirpPromise(target); - await fslib_1.xfs.mkdirpPromise(fslib_1.ppath.join(target, `sources`)); - await fslib_1.xfs.writeFilePromise(fslib_1.ppath.join(target, `sources/index.ts`), [ - `import {CommandContext, Plugin} from '@berry/core';\n`, - `import {Command} from 'clipanion';\n`, - `\n`, - `class HelloWorldCommand extends Command {\n`, - ` @Command.String(\`--name\`)\n`, - ` name: string = \`John Doe\`;\n`, - `\n`, - ` @Command.Path(\`hello\`, \`world\`)\n`, - ` async execute() {\n`, - ` console.log(\`Hello \${this.name}!\`);\n`, - ` }\n`, - `}\n`, - `\n`, - `const plugin: Plugin = {\n`, - ` hooks: {\n`, - ` afterAllInstalled: () => {\n`, - ` console.log(\`What a great install, am I right?\`);\n`, - ` },\n`, - ` },\n`, - ` commands: [\n`, - ` HelloWorldCommand,\n`, - ` ],\n`, - `};\n`, - `\n`, - `export default plugin;\n`, - ].join(``)); - await fslib_1.xfs.writeFilePromise(fslib_1.ppath.join(target, `package.json`), JSON.stringify({ - name: `berry-plugin-helloworld`, - main: `./sources/index.ts`, - dependencies: { - [`@berry/core`]: require(`@berry/builder/package.json`).dependencies[`@berry/core`], - [`@berry/builder`]: `^${require(`@berry/builder/package.json`).version}`, - [`@types/node`]: `^${process.versions.node.split(`.`)[0]}.0.0`, - [`clipanion`]: require(`@berry/builder/package.json`).dependencies[`clipanion`], - [`typescript`]: `^3.3.3333`, - }, - scripts: { - build: `yarn builder build plugin`, - }, - }, null, 2)); - await fslib_1.xfs.writeFilePromise(fslib_1.ppath.join(target, `tsconfig.json`), JSON.stringify({ - compilerOptions: { - experimentalDecorators: true, - module: `commonjs`, - target: `es2017`, - lib: [`es2017`], - }, - include: [ - `sources/**/*.ts`, - ], - }, null, 2)); - this.context.stdout.write(`Scaffolding done! Just go into ${chalk_1.default.magenta(fslib_1.NodeFS.fromPortablePath(target))} and run ${chalk_1.default.cyan(`yarn && yarn build`)} 🙂\n`); - } -} -NewPluginCommand.usage = clipanion_1.Command.Usage({ - description: `generate the template for a new plugin`, -}); -__decorate([ - clipanion_1.Command.String() -], NewPluginCommand.prototype, "target", void 0); -__decorate([ - clipanion_1.Command.Path(`new`, `plugin`) -], NewPluginCommand.prototype, "execute", null); -exports.default = NewPluginCommand; diff --git a/packages/berry-builder/lib/data/dynamicLibs.js b/packages/berry-builder/lib/data/dynamicLibs.js deleted file mode 100644 index 678c56f19449..000000000000 --- a/packages/berry-builder/lib/data/dynamicLibs.js +++ /dev/null @@ -1,22 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.dynamicLibs = new Set([ - `@berry/cli`, - `@berry/core`, - `@berry/fslib`, - `@berry/parsers`, - `@berry/shell`, - // Those ones are always useful - `clipanion`, - `semver`, - `yup`, - // This one register `exit` handlers; it would generate warnings on "foreach" if a plugin happened to use it - `tmp`, -]); -exports.isDynamicLib = (request) => { - if (exports.dynamicLibs.has(request)) - return true; - if (request.match(/^@berry\/plugin-/)) - return true; - return false; -}; diff --git a/packages/berry-builder/lib/tools/findPlugins.js b/packages/berry-builder/lib/tools/findPlugins.js deleted file mode 100644 index a4040e9c4381..000000000000 --- a/packages/berry-builder/lib/tools/findPlugins.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const clipanion_1 = require("clipanion"); -function findPlugins({ basedir, profile, plugins }) { - const pkgJson = require(`${basedir}/package.json`); - if (!pkgJson[`@berry/builder`] || !pkgJson[`@berry/builder`].bundles) - throw new clipanion_1.UsageError(`This command requires your package.json to contain specific configuration keys`); - if (!profile) - profile = `standard`; - const profiles = profile.split(/\+/g); - const supported = new Set(Object.keys(pkgJson[`@berry/builder`].bundles)); - if (profiles.some(profile => !supported.has(profile))) - throw new clipanion_1.UsageError(`Invalid profile "${profile}", expected one of ${[...supported].join(`, `)}`); - return Array.from(new Set(profiles.reduce((acc, profile) => { - return acc.concat(pkgJson[`@berry/builder`].bundles[profile]); - }, plugins))); -} -exports.findPlugins = findPlugins; diff --git a/packages/berry-builder/lib/tools/makeConfig.js b/packages/berry-builder/lib/tools/makeConfig.js deleted file mode 100644 index c0a54203812f..000000000000 --- a/packages/berry-builder/lib/tools/makeConfig.js +++ /dev/null @@ -1,51 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -// @ts-ignore -const pnp_webpack_plugin_1 = __importDefault(require("pnp-webpack-plugin")); -const webpack_merge_1 = __importDefault(require("webpack-merge")); -const webpack_1 = __importDefault(require("webpack")); -exports.makeConfig = (config) => webpack_merge_1.default({ - mode: `none`, - devtool: false, - target: `node`, - node: { - __dirname: false, - __filename: false, - }, - output: { - libraryTarget: `commonjs2`, - }, - resolve: { - alias: { - [`supports-color`]: `supports-color/index`, - [`agentkeepalive`]: `agentkeepalive/index`, - }, - extensions: [`.js`, `.ts`, `.tsx`, `.json`], - mainFields: [`browser`, `module`, `main`], - plugins: [pnp_webpack_plugin_1.default], - }, - module: { - rules: [{ - test: /\.tsx?$/, - exclude: /\.d\.ts$/, - loader: require.resolve(`ts-loader`), - options: pnp_webpack_plugin_1.default.tsLoaderOptions({ - compilerOptions: { - declaration: false, - }, - }), - }], - }, - externals: { - // Both of those are native dependencies of text-buffer we can't bundle - [`fs-admin`]: `{}`, - [`pathwatcher`]: `{}`, - }, - plugins: [ - new webpack_1.default.IgnorePlugin(/^encoding$/, /node-fetch/), - new webpack_1.default.DefinePlugin({ [`IS_WEBPACK`]: `true` }), - ], -}, config); diff --git a/packages/berry-builder/lib/tools/reindent.js b/packages/berry-builder/lib/tools/reindent.js deleted file mode 100644 index 20dc42353f81..000000000000 --- a/packages/berry-builder/lib/tools/reindent.js +++ /dev/null @@ -1,20 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -function reindent(text, level = 0) { - const lines = text.replace(/^\n+/, ``).split(`\n`).map(line => { - return line.replace(/ +$/, ``); - }); - let minIndent = Infinity; - for (const line of lines) { - if (line.length !== 0) { - const indent = line.match(/^ */)[0].length; - if (indent < minIndent) { - minIndent = indent; - } - } - } - return lines.map(line => { - return line ? ` `.repeat(level) + line.slice(minIndent) : line; - }).join(`\n`); -} -exports.reindent = reindent; diff --git a/packages/berry-builder/package.json b/packages/berry-builder/package.json index e9f78b571f11..2c239f9de6fd 100644 --- a/packages/berry-builder/package.json +++ b/packages/berry-builder/package.json @@ -24,8 +24,8 @@ "typescript": "*" }, "scripts": { - "build:pnpify": "rm -rf lib && mkdir -p lib && rsync -a --exclude '*.ts' sources/ lib/ && pnpify tsc", - "prepack": "run build:pnpify", + "postpack": "rm -rf lib", + "prepack": "mkdir -p lib && rsync -a --exclude '*.ts' sources/ lib/ && pnpify tsc", "release": "yarn npm publish" }, "publishConfig": { diff --git a/packages/berry-builder/sources/boot-dev.js b/packages/berry-builder/sources/boot-dev.js index 34cbe26bcce4..e12a0e16d0bd 100644 --- a/packages/berry-builder/sources/boot-dev.js +++ b/packages/berry-builder/sources/boot-dev.js @@ -1,2 +1,2 @@ -require(`ts-node`).register(); +require(`ts-node`).register({transpileOnly: true}); require(`./boot`); diff --git a/packages/berry-builder/sources/boot.js b/packages/berry-builder/sources/boot.js index fb589e780450..45bab8c84e35 100644 --- a/packages/berry-builder/sources/boot.js +++ b/packages/berry-builder/sources/boot.js @@ -1,6 +1,2 @@ -// TypeScript (ts-loader) isn't able to find out the typeRoots when using zip -// loading (because they're stored within the zip files). So we need to use -// PnPify to help them find them without having to manually list them all in -// the typeRoots setting. -require(`@berry/pnpify/lib`).patchFs(); +require(`@berry/pnpify`).patchFs(); require(`./cli`); diff --git a/packages/berry-cli/bin/berry.js b/packages/berry-cli/bin/berry.js index 4001c19bf161..e6f0ee69991d 100644 --- a/packages/berry-cli/bin/berry.js +++ b/packages/berry-cli/bin/berry.js @@ -126660,9 +126660,9 @@ class DlxCommand extends clipanion_1.Command { if (!this.quiet) this.context.stdout.write(`\n`); const configuration = await core_1.Configuration.find(tmpDir, this.context.plugins); - const { project, workspace } = await core_1.Project.find(configuration, tmpDir); + const { workspace } = await core_1.Project.find(configuration, tmpDir); if (workspace === null) - throw new cli_1.WorkspaceRequiredError(this.context.cwd); + throw new cli_1.WorkspaceRequiredError(tmpDir); return await core_2.scriptUtils.executeWorkspaceAccessibleBinary(workspace, command, this.args, { cwd: this.context.cwd, stdin: this.context.stdin, @@ -139104,7 +139104,7 @@ exports.generateSplitScript = generateSplitScript; /* 1037 */ /***/ (function(module, exports) { -module.exports = "module.exports =\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 10);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __importDefault(__webpack_require__(6));\nexports.PortablePath = {\n root: `/`,\n dot: `.`,\n};\nexports.npath = path_1.default;\nexports.ppath = path_1.default.posix;\nconst WINDOWS_PATH_REGEXP = /^[a-zA-Z]:.*$/;\nconst PORTABLE_PATH_REGEXP = /^\\/[a-zA-Z]:.*$/;\n// Path should look like \"/N:/berry/scripts/plugin-pack.js\"\n// And transform to \"N:\\berry\\scripts\\plugin-pack.js\"\nfunction fromPortablePath(p) {\n if (process.platform !== 'win32')\n return p;\n return p.match(PORTABLE_PATH_REGEXP) ? p.substring(1).replace(/\\//g, `\\\\`) : p;\n}\nexports.fromPortablePath = fromPortablePath;\n// Path should look like \"N:/berry/scripts/plugin-pack.js\"\n// And transform to \"/N:/berry/scripts/plugin-pack.js\"\nfunction toPortablePath(p) {\n if (process.platform !== 'win32')\n return p;\n return (p.match(WINDOWS_PATH_REGEXP) ? `/${p}` : p).replace(/\\\\/g, `/`);\n}\nexports.toPortablePath = toPortablePath;\nfunction convertPath(targetPathUtils, sourcePath) {\n return (targetPathUtils === exports.npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath));\n}\nexports.convertPath = convertPath;\nfunction toFilename(filename) {\n if (exports.npath.parse(filename).dir !== '' || exports.ppath.parse(filename).dir !== '')\n throw new Error(`Invalid filename: \"${filename}\"`);\n return filename;\n}\nexports.toFilename = toFilename;\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = __importDefault(__webpack_require__(3));\nconst FakeFS_1 = __webpack_require__(5);\nconst path_1 = __webpack_require__(0);\nconst path_2 = __webpack_require__(0);\nclass NodeFS extends FakeFS_1.BasePortableFakeFS {\n constructor(realFs = fs_1.default) {\n super();\n this.realFs = realFs;\n }\n getRealPath() {\n return path_1.PortablePath.root;\n }\n async openPromise(p, flags, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.open(NodeFS.fromPortablePath(p), flags, mode, this.makeCallback(resolve, reject));\n });\n }\n openSync(p, flags, mode) {\n return this.realFs.openSync(NodeFS.fromPortablePath(p), flags, mode);\n }\n async closePromise(fd) {\n await new Promise((resolve, reject) => {\n this.realFs.close(fd, this.makeCallback(resolve, reject));\n });\n }\n closeSync(fd) {\n this.realFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p);\n return this.realFs.createReadStream(realPath, opts);\n }\n createWriteStream(p, opts) {\n const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p);\n return this.realFs.createWriteStream(realPath, opts);\n }\n async realpathPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.realpath(NodeFS.fromPortablePath(p), {}, this.makeCallback(resolve, reject));\n }).then(path => {\n return NodeFS.toPortablePath(path);\n });\n }\n realpathSync(p) {\n return NodeFS.toPortablePath(this.realFs.realpathSync(NodeFS.fromPortablePath(p), {}));\n }\n async existsPromise(p) {\n return await new Promise(resolve => {\n this.realFs.exists(NodeFS.fromPortablePath(p), resolve);\n });\n }\n accessSync(p, mode) {\n return this.realFs.accessSync(NodeFS.fromPortablePath(p), mode);\n }\n async accessPromise(p, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.access(NodeFS.fromPortablePath(p), mode, this.makeCallback(resolve, reject));\n });\n }\n existsSync(p) {\n return this.realFs.existsSync(NodeFS.fromPortablePath(p));\n }\n async statPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.stat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n statSync(p) {\n return this.realFs.statSync(NodeFS.fromPortablePath(p));\n }\n async lstatPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.lstat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n lstatSync(p) {\n return this.realFs.lstatSync(NodeFS.fromPortablePath(p));\n }\n async chmodPromise(p, mask) {\n return await new Promise((resolve, reject) => {\n this.realFs.chmod(NodeFS.fromPortablePath(p), mask, this.makeCallback(resolve, reject));\n });\n }\n chmodSync(p, mask) {\n return this.realFs.chmodSync(NodeFS.fromPortablePath(p), mask);\n }\n async renamePromise(oldP, newP) {\n return await new Promise((resolve, reject) => {\n this.realFs.rename(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP), this.makeCallback(resolve, reject));\n });\n }\n renameSync(oldP, newP) {\n return this.realFs.renameSync(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP));\n }\n async copyFilePromise(sourceP, destP, flags = 0) {\n return await new Promise((resolve, reject) => {\n this.realFs.copyFile(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags, this.makeCallback(resolve, reject));\n });\n }\n copyFileSync(sourceP, destP, flags = 0) {\n return this.realFs.copyFileSync(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags);\n }\n async writeFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n if (opts) {\n this.realFs.writeFile(NodeFS.fromPortablePath(p), content, opts, this.makeCallback(resolve, reject));\n }\n else {\n this.realFs.writeFile(NodeFS.fromPortablePath(p), content, this.makeCallback(resolve, reject));\n }\n });\n }\n writeFileSync(p, content, opts) {\n if (opts) {\n this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content, opts);\n }\n else {\n this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content);\n }\n }\n async unlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.unlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n unlinkSync(p) {\n return this.realFs.unlinkSync(NodeFS.fromPortablePath(p));\n }\n async utimesPromise(p, atime, mtime) {\n return await new Promise((resolve, reject) => {\n this.realFs.utimes(NodeFS.fromPortablePath(p), atime, mtime, this.makeCallback(resolve, reject));\n });\n }\n utimesSync(p, atime, mtime) {\n this.realFs.utimesSync(NodeFS.fromPortablePath(p), atime, mtime);\n }\n async mkdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.mkdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n mkdirSync(p) {\n return this.realFs.mkdirSync(NodeFS.fromPortablePath(p));\n }\n async rmdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.rmdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n rmdirSync(p) {\n return this.realFs.rmdirSync(NodeFS.fromPortablePath(p));\n }\n async symlinkPromise(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return await new Promise((resolve, reject) => {\n this.realFs.symlink(NodeFS.fromPortablePath(target.replace(/\\/+$/, ``)), NodeFS.fromPortablePath(p), type, this.makeCallback(resolve, reject));\n });\n }\n symlinkSync(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return this.realFs.symlinkSync(NodeFS.fromPortablePath(target.replace(/\\/+$/, ``)), NodeFS.fromPortablePath(p), type);\n }\n async readFilePromise(p, encoding) {\n return await new Promise((resolve, reject) => {\n this.realFs.readFile(NodeFS.fromPortablePath(p), encoding, this.makeCallback(resolve, reject));\n });\n }\n readFileSync(p, encoding) {\n return this.realFs.readFileSync(NodeFS.fromPortablePath(p), encoding);\n }\n async readdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n readdirSync(p) {\n return this.realFs.readdirSync(NodeFS.fromPortablePath(p));\n }\n async readlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n }).then(path => {\n return NodeFS.toPortablePath(path);\n });\n }\n readlinkSync(p) {\n return NodeFS.toPortablePath(this.realFs.readlinkSync(NodeFS.fromPortablePath(p)));\n }\n watch(p, a, b) {\n return this.realFs.watch(NodeFS.fromPortablePath(p), \n // @ts-ignore\n a, b);\n }\n makeCallback(resolve, reject) {\n return (err, result) => {\n if (err) {\n reject(err);\n }\n else {\n resolve(result);\n }\n };\n }\n static fromPortablePath(p) {\n return path_2.fromPortablePath(p);\n }\n static toPortablePath(p) {\n return path_2.toPortablePath(p);\n }\n}\nexports.NodeFS = NodeFS;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst FakeFS_1 = __webpack_require__(5);\nclass ProxiedFS extends FakeFS_1.FakeFS {\n resolve(path) {\n return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path)));\n }\n getRealPath() {\n return this.mapFromBase(this.baseFs.getRealPath());\n }\n openPromise(p, flags, mode) {\n return this.baseFs.openPromise(this.mapToBase(p), flags, mode);\n }\n openSync(p, flags, mode) {\n return this.baseFs.openSync(this.mapToBase(p), flags, mode);\n }\n closePromise(fd) {\n return this.baseFs.closePromise(fd);\n }\n closeSync(fd) {\n this.baseFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n return this.baseFs.createReadStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n createWriteStream(p, opts) {\n return this.baseFs.createWriteStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n async realpathPromise(p) {\n return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(p)));\n }\n realpathSync(p) {\n return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(p)));\n }\n existsPromise(p) {\n return this.baseFs.existsPromise(this.mapToBase(p));\n }\n existsSync(p) {\n return this.baseFs.existsSync(this.mapToBase(p));\n }\n accessSync(p, mode) {\n return this.baseFs.accessSync(this.mapToBase(p), mode);\n }\n accessPromise(p, mode) {\n return this.baseFs.accessPromise(this.mapToBase(p), mode);\n }\n statPromise(p) {\n return this.baseFs.statPromise(this.mapToBase(p));\n }\n statSync(p) {\n return this.baseFs.statSync(this.mapToBase(p));\n }\n lstatPromise(p) {\n return this.baseFs.lstatPromise(this.mapToBase(p));\n }\n lstatSync(p) {\n return this.baseFs.lstatSync(this.mapToBase(p));\n }\n chmodPromise(p, mask) {\n return this.baseFs.chmodPromise(this.mapToBase(p), mask);\n }\n chmodSync(p, mask) {\n return this.baseFs.chmodSync(this.mapToBase(p), mask);\n }\n renamePromise(oldP, newP) {\n return this.baseFs.renamePromise(this.mapToBase(oldP), this.mapToBase(newP));\n }\n renameSync(oldP, newP) {\n return this.baseFs.renameSync(this.mapToBase(oldP), this.mapToBase(newP));\n }\n copyFilePromise(sourceP, destP, flags = 0) {\n return this.baseFs.copyFilePromise(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n copyFileSync(sourceP, destP, flags = 0) {\n return this.baseFs.copyFileSync(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n writeFilePromise(p, content, opts) {\n return this.baseFs.writeFilePromise(this.mapToBase(p), content, opts);\n }\n writeFileSync(p, content, opts) {\n return this.baseFs.writeFileSync(this.mapToBase(p), content, opts);\n }\n unlinkPromise(p) {\n return this.baseFs.unlinkPromise(this.mapToBase(p));\n }\n unlinkSync(p) {\n return this.baseFs.unlinkSync(this.mapToBase(p));\n }\n utimesPromise(p, atime, mtime) {\n return this.baseFs.utimesPromise(this.mapToBase(p), atime, mtime);\n }\n utimesSync(p, atime, mtime) {\n return this.baseFs.utimesSync(this.mapToBase(p), atime, mtime);\n }\n mkdirPromise(p) {\n return this.baseFs.mkdirPromise(this.mapToBase(p));\n }\n mkdirSync(p) {\n return this.baseFs.mkdirSync(this.mapToBase(p));\n }\n rmdirPromise(p) {\n return this.baseFs.rmdirPromise(this.mapToBase(p));\n }\n rmdirSync(p) {\n return this.baseFs.rmdirSync(this.mapToBase(p));\n }\n symlinkPromise(target, p) {\n return this.baseFs.symlinkPromise(this.mapToBase(target), this.mapToBase(p));\n }\n symlinkSync(target, p) {\n return this.baseFs.symlinkSync(this.mapToBase(target), this.mapToBase(p));\n }\n readFilePromise(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFilePromise(this.mapToBase(p), encoding);\n }\n else {\n return this.baseFs.readFilePromise(this.mapToBase(p), encoding);\n }\n }\n readFileSync(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFileSync(this.mapToBase(p), encoding);\n }\n else {\n return this.baseFs.readFileSync(this.mapToBase(p), encoding);\n }\n }\n readdirPromise(p) {\n return this.baseFs.readdirPromise(this.mapToBase(p));\n }\n readdirSync(p) {\n return this.baseFs.readdirSync(this.mapToBase(p));\n }\n async readlinkPromise(p) {\n return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(p)));\n }\n readlinkSync(p) {\n return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(p)));\n }\n watch(p, a, b) {\n return this.baseFs.watch(this.mapToBase(p), \n // @ts-ignore\n a, b);\n }\n}\nexports.ProxiedFS = ProxiedFS;\n\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"fs\");\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nvar path_1 = __webpack_require__(0);\nexports.PortablePath = path_1.PortablePath;\nvar path_2 = __webpack_require__(0);\nexports.npath = path_2.npath;\nexports.ppath = path_2.ppath;\nexports.toFilename = path_2.toFilename;\nvar AliasFS_1 = __webpack_require__(11);\nexports.AliasFS = AliasFS_1.AliasFS;\nvar FakeFS_1 = __webpack_require__(5);\nexports.FakeFS = FakeFS_1.FakeFS;\nvar CwdFS_1 = __webpack_require__(12);\nexports.CwdFS = CwdFS_1.CwdFS;\nvar JailFS_1 = __webpack_require__(13);\nexports.JailFS = JailFS_1.JailFS;\nvar LazyFS_1 = __webpack_require__(14);\nexports.LazyFS = LazyFS_1.LazyFS;\nvar NodeFS_2 = __webpack_require__(1);\nexports.NodeFS = NodeFS_2.NodeFS;\nvar PosixFS_1 = __webpack_require__(15);\nexports.PosixFS = PosixFS_1.PosixFS;\nvar ProxiedFS_1 = __webpack_require__(2);\nexports.ProxiedFS = ProxiedFS_1.ProxiedFS;\nvar VirtualFS_1 = __webpack_require__(16);\nexports.VirtualFS = VirtualFS_1.VirtualFS;\nvar ZipFS_1 = __webpack_require__(8);\nexports.ZipFS = ZipFS_1.ZipFS;\nvar ZipOpenFS_1 = __webpack_require__(22);\nexports.ZipOpenFS = ZipOpenFS_1.ZipOpenFS;\nfunction patchFs(patchedFs, fakeFs) {\n const SYNC_IMPLEMENTATIONS = new Set([\n `accessSync`,\n `createReadStream`,\n `chmodSync`,\n `copyFileSync`,\n `lstatSync`,\n `openSync`,\n `readlinkSync`,\n `readFileSync`,\n `readdirSync`,\n `readlinkSync`,\n `realpathSync`,\n `rmdirSync`,\n `statSync`,\n `symlinkSync`,\n `unlinkSync`,\n `utimesSync`,\n `watch`,\n `writeFileSync`,\n ]);\n const ASYNC_IMPLEMENTATIONS = new Set([\n `accessPromise`,\n `chmodPromise`,\n `copyFilePromise`,\n `lstatPromise`,\n `openPromise`,\n `readdirPromise`,\n `realpathPromise`,\n `readFilePromise`,\n `readdirPromise`,\n `readlinkPromise`,\n `rmdirPromise`,\n `statPromise`,\n `symlinkPromise`,\n `unlinkPromise`,\n `utimesPromise`,\n `writeFilePromise`,\n ]);\n patchedFs.existsSync = (p) => {\n try {\n return fakeFs.existsSync(p);\n }\n catch (error) {\n return false;\n }\n };\n patchedFs.exists = (p, callback) => {\n fakeFs.existsPromise(p).then(result => {\n if (callback) {\n callback(result);\n }\n }, () => {\n if (callback) {\n callback(false);\n }\n });\n };\n for (const fnName of ASYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName.replace(/Promise$/, ``);\n patchedFs[origName] = (...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => { };\n fakeImpl(...args).then((result) => {\n callback(undefined, result);\n }, (error) => {\n callback(error);\n });\n };\n }\n for (const fnName of SYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName;\n patchedFs[origName] = fakeImpl;\n }\n patchedFs.realpathSync.native = patchedFs.realpathSync;\n patchedFs.realpath.native = patchedFs.realpath;\n}\nexports.patchFs = patchFs;\nfunction extendFs(realFs, fakeFs) {\n const patchedFs = Object.create(realFs);\n patchFs(patchedFs, fakeFs);\n return patchedFs;\n}\nexports.extendFs = extendFs;\nexports.xfs = new NodeFS_1.NodeFS();\n\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __webpack_require__(0);\nconst path_2 = __webpack_require__(0);\nclass FakeFS {\n constructor(pathUtils) {\n this.pathUtils = pathUtils;\n }\n async removePromise(p) {\n let stat;\n try {\n stat = await this.lstatPromise(p);\n }\n catch (error) {\n if (error.code === `ENOENT`) {\n return;\n }\n else {\n throw error;\n }\n }\n if (stat.isDirectory()) {\n for (const entry of await this.readdirPromise(p))\n await this.removePromise(this.pathUtils.resolve(p, entry));\n // 5 gives 1s worth of retries at worst\n for (let t = 0; t < 5; ++t) {\n try {\n await this.rmdirPromise(p);\n break;\n }\n catch (error) {\n if (error.code === `EBUSY` || error.code === `ENOTEMPTY`) {\n await new Promise(resolve => setTimeout(resolve, t * 100));\n continue;\n }\n else {\n throw error;\n }\n }\n }\n }\n else {\n await this.unlinkPromise(p);\n }\n }\n removeSync(p) {\n let stat;\n try {\n stat = this.lstatSync(p);\n }\n catch (error) {\n if (error.code === `ENOENT`) {\n return;\n }\n else {\n throw error;\n }\n }\n if (stat.isDirectory()) {\n for (const entry of this.readdirSync(p))\n this.removeSync(this.pathUtils.resolve(p, entry));\n this.rmdirSync(p);\n }\n else {\n this.unlinkSync(p);\n }\n }\n async mkdirpPromise(p, { chmod, utimes } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p))\n return;\n const parts = p.split(this.pathUtils.sep);\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n if (!this.existsSync(subPath)) {\n try {\n await this.mkdirPromise(subPath);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n }\n else {\n throw error;\n }\n }\n if (chmod != null)\n await this.chmodPromise(subPath, chmod);\n if (utimes != null) {\n await this.utimesPromise(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n mkdirpSync(p, { chmod, utimes } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p))\n return;\n const parts = p.split(this.pathUtils.sep);\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n if (!this.existsSync(subPath)) {\n try {\n this.mkdirSync(subPath);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n }\n else {\n throw error;\n }\n }\n if (chmod != null)\n this.chmodSync(subPath, chmod);\n if (utimes != null) {\n this.utimesSync(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n async copyPromise(destination, source, { baseFs = this, overwrite = true } = {}) {\n const stat = await baseFs.lstatPromise(source);\n const exists = await this.existsSync(destination);\n if (stat.isDirectory()) {\n await this.mkdirpPromise(destination);\n const directoryListing = await baseFs.readdirPromise(source);\n await Promise.all(directoryListing.map(entry => {\n return this.copyPromise(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });\n }));\n }\n else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists)\n await this.removePromise(destination);\n const content = await baseFs.readFilePromise(source);\n await this.writeFilePromise(destination, content);\n }\n }\n else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists)\n await this.removePromise(destination);\n const target = await baseFs.readlinkPromise(source);\n await this.symlinkPromise(path_2.convertPath(this.pathUtils, target), destination);\n }\n }\n else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n const mode = stat.mode & 0o777;\n await this.chmodPromise(destination, mode);\n }\n copySync(destination, source, { baseFs = this, overwrite = true } = {}) {\n const stat = baseFs.lstatSync(source);\n const exists = this.existsSync(destination);\n if (stat.isDirectory()) {\n this.mkdirpSync(destination);\n const directoryListing = baseFs.readdirSync(source);\n for (const entry of directoryListing) {\n this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });\n }\n }\n else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists)\n this.removeSync(destination);\n const content = baseFs.readFileSync(source);\n this.writeFileSync(destination, content);\n }\n }\n else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists)\n this.removeSync(destination);\n const target = baseFs.readlinkSync(source);\n this.symlinkSync(path_2.convertPath(this.pathUtils, target), destination);\n }\n }\n else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n const mode = stat.mode & 0o777;\n this.chmodSync(destination, mode);\n }\n async changeFilePromise(p, content) {\n try {\n const current = await this.readFilePromise(p, `utf8`);\n if (current === content) {\n return;\n }\n }\n catch (error) {\n // ignore errors, no big deal\n }\n await this.writeFilePromise(p, content);\n }\n changeFileSync(p, content) {\n try {\n const current = this.readFileSync(p, `utf8`);\n if (current === content) {\n return;\n }\n }\n catch (error) {\n // ignore errors, no big deal\n }\n this.writeFileSync(p, content);\n }\n async movePromise(fromP, toP) {\n try {\n await this.renamePromise(fromP, toP);\n }\n catch (error) {\n if (error.code === `EXDEV`) {\n await this.copyPromise(toP, fromP);\n await this.removePromise(fromP);\n }\n else {\n throw error;\n }\n }\n }\n moveSync(fromP, toP) {\n try {\n this.renameSync(fromP, toP);\n }\n catch (error) {\n if (error.code === `EXDEV`) {\n this.copySync(toP, fromP);\n this.removeSync(fromP);\n }\n else {\n throw error;\n }\n }\n }\n async lockPromise(affectedPath, callback) {\n const lockPath = `${affectedPath}.lock`;\n const interval = 1000 / 60;\n const timeout = Date.now() + 60 * 1000;\n let fd = null;\n while (fd === null) {\n try {\n fd = await this.openPromise(lockPath, `wx`);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n if (Date.now() < timeout) {\n await new Promise(resolve => setTimeout(resolve, interval));\n }\n else {\n throw new Error(`Couldn't acquire a lock in a reasonable time (via ${lockPath})`);\n }\n }\n else {\n throw error;\n }\n }\n }\n try {\n return await callback();\n }\n finally {\n await this.closePromise(fd);\n await this.unlinkPromise(lockPath);\n }\n }\n}\nexports.FakeFS = FakeFS;\n;\nclass BasePortableFakeFS extends FakeFS {\n constructor() {\n super(path_2.ppath);\n }\n resolve(p) {\n return this.pathUtils.resolve(path_1.PortablePath.root, p);\n }\n}\nexports.BasePortableFakeFS = BasePortableFakeFS;\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"path\");\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"module\");\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst libzip_1 = __importDefault(__webpack_require__(17));\nconst fs_1 = __webpack_require__(3);\nconst stream_1 = __webpack_require__(20);\nconst util_1 = __webpack_require__(21);\nconst FakeFS_1 = __webpack_require__(5);\nconst NodeFS_1 = __webpack_require__(1);\nconst path_1 = __webpack_require__(0);\nconst S_IFMT = 0o170000;\nconst S_IFDIR = 0o040000;\nconst S_IFREG = 0o100000;\nconst S_IFLNK = 0o120000;\nclass StatEntry {\n constructor() {\n this.dev = 0;\n this.ino = 0;\n this.mode = 0;\n this.nlink = 1;\n this.rdev = 0;\n this.blocks = 1;\n }\n isBlockDevice() {\n return false;\n }\n isCharacterDevice() {\n return false;\n }\n isDirectory() {\n return (this.mode & S_IFMT) === S_IFDIR;\n }\n isFIFO() {\n return false;\n }\n isFile() {\n return (this.mode & S_IFMT) === S_IFREG;\n }\n isSocket() {\n return false;\n }\n isSymbolicLink() {\n return (this.mode & S_IFMT) === S_IFLNK;\n }\n}\nfunction makeDefaultStats() {\n return Object.assign(new StatEntry(), {\n uid: 0,\n gid: 0,\n size: 0,\n blksize: 0,\n atimeMs: 0,\n mtimeMs: 0,\n ctimeMs: 0,\n birthtimeMs: 0,\n atime: new Date(0),\n mtime: new Date(0),\n ctime: new Date(0),\n birthtime: new Date(0),\n mode: S_IFREG | 0o644,\n });\n}\nfunction toUnixTimestamp(time) {\n if (typeof time === 'string' && String(+time) === time)\n return +time;\n // @ts-ignore\n if (Number.isFinite(time)) {\n if (time < 0) {\n return Date.now() / 1000;\n }\n else {\n return time;\n }\n }\n // convert to 123.456 UNIX timestamp\n if (util_1.isDate(time))\n return time.getTime() / 1000;\n throw new Error(`Invalid time`);\n}\nclass ZipFS extends FakeFS_1.BasePortableFakeFS {\n constructor(source, opts) {\n super();\n this.listings = new Map();\n this.entries = new Map();\n this.ready = false;\n const pathOptions = opts;\n if (typeof source === `string`) {\n const { baseFs = new NodeFS_1.NodeFS() } = pathOptions;\n this.baseFs = baseFs;\n this.path = source;\n }\n else {\n this.path = null;\n this.baseFs = null;\n }\n if (opts.stats) {\n this.stats = opts.stats;\n }\n else {\n if (typeof source === `string`) {\n try {\n this.stats = this.baseFs.statSync(source);\n }\n catch (error) {\n if (error.code === `ENOENT` && pathOptions.create) {\n this.stats = makeDefaultStats();\n }\n else {\n throw error;\n }\n }\n }\n else {\n this.stats = makeDefaultStats();\n }\n }\n const errPtr = libzip_1.default.malloc(4);\n try {\n let flags = 0;\n if (typeof source === `string` && pathOptions.create)\n flags |= libzip_1.default.ZIP_CREATE | libzip_1.default.ZIP_TRUNCATE;\n if (opts.readOnly)\n flags |= libzip_1.default.ZIP_RDONLY;\n if (typeof source === `string`) {\n this.zip = libzip_1.default.open(NodeFS_1.NodeFS.fromPortablePath(source), flags, errPtr);\n }\n else {\n const lzSource = this.allocateUnattachedSource(source);\n try {\n this.zip = libzip_1.default.openFromSource(lzSource, flags, errPtr);\n }\n catch (error) {\n libzip_1.default.source.free(lzSource);\n throw error;\n }\n }\n if (this.zip === 0) {\n const error = libzip_1.default.struct.errorS();\n libzip_1.default.error.initWithCode(error, libzip_1.default.getValue(errPtr, `i32`));\n throw new Error(libzip_1.default.error.strerror(error));\n }\n }\n finally {\n libzip_1.default.free(errPtr);\n }\n this.listings.set(path_1.PortablePath.root, new Set());\n const entryCount = libzip_1.default.getNumEntries(this.zip, 0);\n for (let t = 0; t < entryCount; ++t) {\n const raw = libzip_1.default.getName(this.zip, t, 0);\n if (path_1.ppath.isAbsolute(raw))\n continue;\n const p = path_1.ppath.resolve(path_1.PortablePath.root, raw);\n this.registerEntry(p, t);\n // If the raw path is a directory, register it\n // to prevent empty folder being skipped\n if (raw.endsWith('/')) {\n this.registerListing(p);\n }\n }\n this.ready = true;\n }\n getAllFiles() {\n return Array.from(this.entries.keys());\n }\n getRealPath() {\n if (!this.path)\n throw new Error(`ZipFS don't have real paths when loaded from a buffer`);\n return this.path;\n }\n saveAndClose() {\n if (!this.path || !this.baseFs)\n throw new Error(`ZipFS cannot be saved and must be discarded when loaded from a buffer`);\n if (!this.ready)\n throw Object.assign(new Error(`EBUSY: archive closed, close`), { code: `EBUSY` });\n const previousMod = this.baseFs.existsSync(this.path)\n ? this.baseFs.statSync(this.path).mode & 0o777\n : null;\n const rc = libzip_1.default.close(this.zip);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n // Libzip overrides the chmod when writing the archive, which is a weird\n // behavior I don't totally understand (plus the umask seems bogus in some\n // weird cases - maybe related to emscripten?)\n //\n // See also https://github.com/nih-at/libzip/issues/77\n if (previousMod !== null && previousMod !== (this.baseFs.statSync(this.path).mode & 0o777))\n this.baseFs.chmodSync(this.path, previousMod);\n this.ready = false;\n }\n discardAndClose() {\n libzip_1.default.discard(this.zip);\n this.ready = false;\n }\n async openPromise(p, flags, mode) {\n return this.openSync(p, flags, mode);\n }\n openSync(p, flags, mode) {\n throw new Error(`Unimplemented`);\n }\n async closePromise(fd) {\n this.closeSync(fd);\n }\n closeSync(fd) {\n throw new Error(`Unimplemented`);\n }\n createReadStream(p, { encoding } = {}) {\n if (p === null)\n throw new Error(`Unimplemented`);\n const stream = Object.assign(new stream_1.PassThrough(), {\n bytesRead: 0,\n path: p,\n close: () => {\n clearImmediate(immediate);\n },\n });\n const immediate = setImmediate(() => {\n try {\n const data = this.readFileSync(p, encoding);\n stream.bytesRead = data.length;\n stream.write(data);\n stream.end();\n }\n catch (error) {\n stream.emit(`error`, error);\n stream.end();\n }\n });\n return stream;\n }\n createWriteStream(p, { encoding } = {}) {\n if (p === null)\n throw new Error(`Unimplemented`);\n const stream = Object.assign(new stream_1.PassThrough(), {\n bytesWritten: 0,\n path: p,\n close: () => {\n stream.end();\n },\n });\n const chunks = [];\n stream.on(`data`, chunk => {\n const chunkBuffer = Buffer.from(chunk);\n stream.bytesWritten += chunkBuffer.length;\n chunks.push(chunkBuffer);\n });\n stream.on(`end`, () => {\n this.writeFileSync(p, Buffer.concat(chunks), encoding);\n });\n return stream;\n }\n async realpathPromise(p) {\n return this.realpathSync(p);\n }\n realpathSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, lstat '${p}'`), { code: `ENOENT` });\n return resolvedP;\n }\n async existsPromise(p) {\n return this.existsSync(p);\n }\n existsSync(p) {\n let resolvedP;\n try {\n resolvedP = this.resolveFilename(`stat '${p}'`, p);\n }\n catch (error) {\n return false;\n }\n return this.entries.has(resolvedP) || this.listings.has(resolvedP);\n }\n async accessPromise(p, mode) {\n return this.accessSync(p, mode);\n }\n accessSync(p, mode) {\n const resolvedP = this.resolveFilename(`access '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) {\n throw Object.assign(new Error(`ENOENT: no such file or directory, access '${p}'`), { code: `ENOENT` });\n }\n }\n async statPromise(p) {\n return this.statSync(p);\n }\n statSync(p) {\n const resolvedP = this.resolveFilename(`stat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, stat '${p}'`), { code: `ENOENT` });\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, stat '${p}'`), { code: `ENOTDIR` });\n return this.statImpl(`stat '${p}'`, resolvedP);\n }\n async lstatPromise(p) {\n return this.lstatSync(p);\n }\n lstatSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, lstat '${p}'`), { code: `ENOENT` });\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, lstat '${p}'`), { code: `ENOTDIR` });\n return this.statImpl(`lstat '${p}'`, resolvedP);\n }\n statImpl(reason, p) {\n if (this.listings.has(p)) {\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = 0;\n const blksize = 512;\n const blocks = 0;\n const atimeMs = this.stats.mtimeMs;\n const birthtimeMs = this.stats.mtimeMs;\n const ctimeMs = this.stats.mtimeMs;\n const mtimeMs = this.stats.mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = S_IFDIR | 0o755;\n return Object.assign(new StatEntry(), { uid, gid, size, blksize, blocks, atime, birthtime, ctime, mtime, atimeMs, birthtimeMs, ctimeMs, mtimeMs, mode });\n }\n const entry = this.entries.get(p);\n if (entry !== undefined) {\n const stat = libzip_1.default.struct.statS();\n const rc = libzip_1.default.statIndex(this.zip, entry, 0, 0, stat);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = (libzip_1.default.struct.statSize(stat) >>> 0);\n const blksize = 512;\n const blocks = Math.ceil(size / blksize);\n const mtimeMs = (libzip_1.default.struct.statMtime(stat) >>> 0) * 1000;\n const atimeMs = mtimeMs;\n const birthtimeMs = mtimeMs;\n const ctimeMs = mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = this.getUnixMode(entry, S_IFREG | 0o644);\n return Object.assign(new StatEntry(), { uid, gid, size, blksize, blocks, atime, birthtime, ctime, mtime, atimeMs, birthtimeMs, ctimeMs, mtimeMs, mode });\n }\n throw new Error(`Unreachable`);\n }\n getUnixMode(index, defaultMode) {\n const rc = libzip_1.default.file.getExternalAttributes(this.zip, index, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n return defaultMode;\n return libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n }\n registerListing(p) {\n let listing = this.listings.get(p);\n if (listing)\n return listing;\n const parentListing = this.registerListing(path_1.ppath.dirname(p));\n listing = new Set();\n parentListing.add(path_1.ppath.basename(p));\n this.listings.set(p, listing);\n return listing;\n }\n registerEntry(p, index) {\n const parentListing = this.registerListing(path_1.ppath.dirname(p));\n parentListing.add(path_1.ppath.basename(p));\n this.entries.set(p, index);\n }\n resolveFilename(reason, p, resolveLastComponent = true) {\n if (!this.ready)\n throw Object.assign(new Error(`EBUSY: archive closed, ${reason}`), { code: `EBUSY` });\n let resolvedP = path_1.ppath.resolve(path_1.PortablePath.root, p);\n if (resolvedP === `/`)\n return path_1.PortablePath.root;\n while (true) {\n const parentP = this.resolveFilename(reason, path_1.ppath.dirname(resolvedP), true);\n const isDir = this.listings.has(parentP);\n const doesExist = this.entries.has(parentP);\n if (!isDir && !doesExist)\n throw Object.assign(new Error(`ENOENT: no such file or directory, ${reason}`), { code: `ENOENT` });\n if (!isDir)\n throw Object.assign(new Error(`ENOTDIR: not a directory, ${reason}`), { code: `ENOTDIR` });\n resolvedP = path_1.ppath.resolve(parentP, path_1.ppath.basename(resolvedP));\n if (!resolveLastComponent)\n break;\n const index = libzip_1.default.name.locate(this.zip, resolvedP);\n if (index === -1)\n break;\n if (this.isSymbolicLink(index)) {\n const target = this.getFileSource(index).toString();\n resolvedP = path_1.ppath.resolve(path_1.ppath.dirname(resolvedP), target);\n }\n else {\n break;\n }\n }\n return resolvedP;\n }\n allocateBuffer(content) {\n if (!Buffer.isBuffer(content))\n content = Buffer.from(content);\n const buffer = libzip_1.default.malloc(content.byteLength);\n if (!buffer)\n throw new Error(`Couldn't allocate enough memory`);\n // Copy the file into the Emscripten heap\n const heap = new Uint8Array(libzip_1.default.HEAPU8.buffer, buffer, content.byteLength);\n heap.set(content);\n return { buffer, byteLength: content.byteLength };\n }\n allocateUnattachedSource(content) {\n const error = libzip_1.default.struct.errorS();\n const { buffer, byteLength } = this.allocateBuffer(content);\n const source = libzip_1.default.source.fromUnattachedBuffer(buffer, byteLength, 0, true, error);\n if (source === 0) {\n libzip_1.default.free(error);\n throw new Error(libzip_1.default.error.strerror(error));\n }\n return source;\n }\n allocateSource(content) {\n const { buffer, byteLength } = this.allocateBuffer(content);\n const source = libzip_1.default.source.fromBuffer(this.zip, buffer, byteLength, 0, true);\n if (source === 0) {\n libzip_1.default.free(buffer);\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n return source;\n }\n setFileSource(p, content) {\n const target = path_1.ppath.relative(path_1.PortablePath.root, p);\n const lzSource = this.allocateSource(content);\n try {\n return libzip_1.default.file.add(this.zip, target, lzSource, libzip_1.default.ZIP_FL_OVERWRITE);\n }\n catch (error) {\n libzip_1.default.source.free(lzSource);\n throw error;\n }\n }\n isSymbolicLink(index) {\n const attrs = libzip_1.default.file.getExternalAttributes(this.zip, index, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (attrs === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n return false;\n const attributes = libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n return (attributes & S_IFMT) === S_IFLNK;\n }\n getFileSource(index) {\n const stat = libzip_1.default.struct.statS();\n const rc = libzip_1.default.statIndex(this.zip, index, 0, 0, stat);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const size = libzip_1.default.struct.statSize(stat);\n const buffer = libzip_1.default.malloc(size);\n try {\n const file = libzip_1.default.fopenIndex(this.zip, index, 0, 0);\n if (file === 0)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n try {\n const rc = libzip_1.default.fread(file, buffer, size, 0);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.file.getError(file)));\n else if (rc < size)\n throw new Error(`Incomplete read`);\n else if (rc > size)\n throw new Error(`Overread`);\n const memory = libzip_1.default.HEAPU8.subarray(buffer, buffer + size);\n const data = Buffer.from(memory);\n return data;\n }\n finally {\n libzip_1.default.fclose(file);\n }\n }\n finally {\n libzip_1.default.free(buffer);\n }\n }\n async chmodPromise(p, mask) {\n return this.chmodSync(p, mask);\n }\n chmodSync(p, mask) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n // We silently ignore chmod requests for directories\n if (this.listings.has(resolvedP))\n return;\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const oldMod = this.getUnixMode(entry, S_IFREG | 0o000);\n const newMod = oldMod & (~0o777) | mask;\n const rc = libzip_1.default.file.setExternalAttributes(this.zip, entry, 0, 0, libzip_1.default.ZIP_OPSYS_UNIX, newMod << 16);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async renamePromise(oldP, newP) {\n return this.renameSync(oldP, newP);\n }\n renameSync(oldP, newP) {\n throw new Error(`Unimplemented`);\n }\n async copyFilePromise(sourceP, destP, flags) {\n return this.copyFileSync(sourceP, destP, flags);\n }\n copyFileSync(sourceP, destP, flags = 0) {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`ENOSYS: unsupported clone operation, copyfile '${sourceP}' -> ${destP}'`), { code: `ENOSYS` });\n const resolvedSourceP = this.resolveFilename(`copyfile '${sourceP} -> ${destP}'`, sourceP);\n const indexSource = this.entries.get(resolvedSourceP);\n if (typeof indexSource === `undefined`)\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n const resolvedDestP = this.resolveFilename(`copyfile '${sourceP}' -> ${destP}'`, destP);\n const indexDest = this.entries.get(resolvedDestP);\n if ((flags & (fs_1.constants.COPYFILE_EXCL | fs_1.constants.COPYFILE_FICLONE_FORCE)) !== 0 && typeof indexDest !== `undefined`)\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n const source = this.getFileSource(indexSource);\n const newIndex = this.setFileSource(resolvedDestP, source);\n if (newIndex !== indexDest) {\n this.registerEntry(resolvedDestP, newIndex);\n }\n }\n async writeFilePromise(p, content, opts) {\n return this.writeFileSync(p, content, opts);\n }\n writeFileSync(p, content, opts) {\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, open '${p}'`), { code: `EISDIR` });\n const index = this.entries.get(resolvedP);\n if (index !== undefined && typeof opts === `object` && opts.flag && opts.flag.includes(`a`))\n content = Buffer.concat([this.getFileSource(index), Buffer.from(content)]);\n let encoding = null;\n if (typeof opts === `string`)\n encoding = opts;\n else if (typeof opts === `object` && opts.encoding)\n encoding = opts.encoding;\n if (encoding !== null)\n content = content.toString(encoding);\n const newIndex = this.setFileSource(resolvedP, content);\n if (newIndex !== index) {\n this.registerEntry(resolvedP, newIndex);\n }\n }\n async unlinkPromise(p) {\n return this.unlinkSync(p);\n }\n unlinkSync(p) {\n throw new Error(`Unimplemented`);\n }\n async utimesPromise(p, atime, mtime) {\n return this.utimesSync(p, atime, mtime);\n }\n utimesSync(p, atime, mtime) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p);\n return this.utimesImpl(resolvedP, mtime);\n }\n async lutimesPromise(p, atime, mtime) {\n return this.lutimesSync(p, atime, mtime);\n }\n lutimesSync(p, atime, mtime) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n return this.utimesImpl(resolvedP, mtime);\n }\n utimesImpl(resolvedP, mtime) {\n if (this.listings.has(resolvedP))\n if (!this.entries.has(resolvedP))\n this.hydrateDirectory(resolvedP);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const rc = libzip_1.default.file.setMtime(this.zip, entry, 0, toUnixTimestamp(mtime), 0);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async mkdirPromise(p) {\n return this.mkdirSync(p);\n }\n mkdirSync(p) {\n const resolvedP = this.resolveFilename(`mkdir '${p}'`, p);\n if (this.entries.has(resolvedP) || this.listings.has(resolvedP))\n throw Object.assign(new Error(`EEXIST: file already exists, mkdir '${p}'`), { code: `EEXIST` });\n this.hydrateDirectory(resolvedP);\n }\n async rmdirPromise(p) {\n return this.rmdirSync(p);\n }\n rmdirSync(p) {\n throw new Error(`Unimplemented`);\n }\n hydrateDirectory(resolvedP) {\n const index = libzip_1.default.dir.add(this.zip, path_1.ppath.relative(path_1.PortablePath.root, resolvedP));\n if (index === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n this.registerListing(resolvedP);\n this.registerEntry(resolvedP, index);\n return index;\n }\n async symlinkPromise(target, p) {\n return this.symlinkSync(target, p);\n }\n symlinkSync(target, p) {\n const resolvedP = this.resolveFilename(`symlink '${target}' -> '${p}'`, p);\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, symlink '${target}' -> '${p}'`), { code: `EISDIR` });\n if (this.entries.has(resolvedP))\n throw Object.assign(new Error(`EEXIST: file already exists, symlink '${target}' -> '${p}'`), { code: `EEXIST` });\n const index = this.setFileSource(resolvedP, target);\n this.registerEntry(resolvedP, index);\n const rc = libzip_1.default.file.setExternalAttributes(this.zip, index, 0, 0, libzip_1.default.ZIP_OPSYS_UNIX, (0o120000 | 0o777) << 16);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async readFilePromise(p, encoding) {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.readFileSync(p, encoding);\n default:\n return this.readFileSync(p, encoding);\n }\n }\n readFileSync(p, encoding) {\n // This is messed up regarding the TS signatures\n if (typeof encoding === `object`)\n // @ts-ignore\n encoding = encoding ? encoding.encoding : undefined;\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, open '${p}'`), { code: `ENOENT` });\n // Ensures that the last component is a directory, if the user said so (even if it is we'll throw right after with EISDIR anyway)\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, open '${p}'`), { code: `ENOTDIR` });\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, read`), { code: `EISDIR` });\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const data = this.getFileSource(entry);\n return encoding ? data.toString(encoding) : data;\n }\n async readdirPromise(p) {\n return this.readdirSync(p);\n }\n readdirSync(p) {\n const resolvedP = this.resolveFilename(`scandir '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, scandir '${p}'`), { code: `ENOENT` });\n const directoryListing = this.listings.get(resolvedP);\n if (!directoryListing)\n throw Object.assign(new Error(`ENOTDIR: not a directory, scandir '${p}'`), { code: `ENOTDIR` });\n return Array.from(directoryListing);\n }\n async readlinkPromise(p) {\n return this.readlinkSync(p);\n }\n readlinkSync(p) {\n const resolvedP = this.resolveFilename(`readlink '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, readlink '${p}'`), { code: `ENOENT` });\n // Ensure that the last component is a directory (if it is we'll throw right after with EISDIR anyway)\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, open '${p}'`), { code: `ENOTDIR` });\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const rc = libzip_1.default.file.getExternalAttributes(this.zip, entry, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n const attributes = libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n if ((attributes & 0o170000) !== 0o120000)\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n return this.getFileSource(entry).toString();\n }\n watch(p, a, b) {\n let persistent;\n switch (typeof a) {\n case `function`:\n case `string`:\n case `undefined`:\n {\n persistent = true;\n }\n break;\n default:\n {\n // @ts-ignore\n ({ persistent = true } = a);\n }\n break;\n }\n if (!persistent)\n return { on: () => { }, close: () => { } };\n const interval = setInterval(() => { }, 24 * 60 * 60 * 1000);\n return { on: () => { }, close: () => { clearInterval(interval); } };\n }\n}\nexports.ZipFS = ZipFS;\n;\n\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ErrorCode;\n(function (ErrorCode) {\n ErrorCode[\"API_ERROR\"] = \"API_ERROR\";\n ErrorCode[\"BLACKLISTED\"] = \"BLACKLISTED\";\n ErrorCode[\"BUILTIN_NODE_RESOLUTION_FAILED\"] = \"BUILTIN_NODE_RESOLUTION_FAILED\";\n ErrorCode[\"MISSING_DEPENDENCY\"] = \"MISSING_DEPENDENCY\";\n ErrorCode[\"MISSING_PEER_DEPENDENCY\"] = \"MISSING_PEER_DEPENDENCY\";\n ErrorCode[\"QUALIFIED_PATH_RESOLUTION_FAILED\"] = \"QUALIFIED_PATH_RESOLUTION_FAILED\";\n ErrorCode[\"INTERNAL\"] = \"INTERNAL\";\n ErrorCode[\"UNDECLARED_DEPENDENCY\"] = \"UNDECLARED_DEPENDENCY\";\n ErrorCode[\"UNSUPPORTED\"] = \"UNSUPPORTED\";\n})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));\n;\n// Some errors are exposed as MODULE_NOT_FOUND for compatibility with packages\n// that expect this umbrella error when the resolution fails\nconst MODULE_NOT_FOUND_ERRORS = new Set([\n ErrorCode.BLACKLISTED,\n ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED,\n ErrorCode.MISSING_DEPENDENCY,\n ErrorCode.MISSING_PEER_DEPENDENCY,\n ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED,\n ErrorCode.UNDECLARED_DEPENDENCY,\n]);\n/**\n * Simple helper function that assign an error code to an error, so that it can more easily be caught and used\n * by third-parties.\n */\nfunction makeError(pnpCode, message, data = {}) {\n const code = MODULE_NOT_FOUND_ERRORS.has(pnpCode)\n ? `MODULE_NOT_FOUND`\n : pnpCode;\n return Object.assign(new Error(message), {\n code, pnpCode, data,\n });\n}\nexports.makeError = makeError;\n/**\n * Returns the module that should be used to resolve require calls. It's usually the direct parent, except if we're\n * inside an eval expression.\n */\nfunction getIssuerModule(parent) {\n let issuer = parent;\n while (issuer && (issuer.id === '[eval]' || issuer.id === '' || !issuer.filename))\n issuer = issuer.parent;\n return issuer;\n}\nexports.getIssuerModule = getIssuerModule;\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(4);\nconst fs_1 = __importDefault(__webpack_require__(3));\nconst module_1 = __importDefault(__webpack_require__(7));\nconst path_1 = __importDefault(__webpack_require__(6));\nconst string_decoder_1 = __importDefault(__webpack_require__(23));\nconst applyPatch_1 = __webpack_require__(24);\nconst hydrateRuntimeState_1 = __webpack_require__(25);\nconst makeApi_1 = __webpack_require__(26);\n// We must copy the fs into a local, because otherwise\n// 1. we would make the NodeFS instance use the function that we patched (infinite loop)\n// 2. Object.create(fs) isn't enough, since it won't prevent the proto from being modified\nconst localFs = Object.assign({}, fs_1.default);\nconst nodeFs = new fslib_1.NodeFS(localFs);\nconst runtimeState = $$SETUP_STATE(hydrateRuntimeState_1.hydrateRuntimeState);\nlet underlyingFs = new fslib_1.ZipOpenFS({ baseFs: nodeFs });\nfor (const virtualRoot of runtimeState.virtualRoots)\n underlyingFs = new fslib_1.VirtualFS(virtualRoot, { baseFs: underlyingFs });\nmodule.exports = makeApi_1.makeApi(runtimeState, {\n compatibilityMode: true,\n fakeFs: underlyingFs,\n pnpapiResolution: path_1.default.resolve(__dirname, __filename),\n});\nmodule.exports.setup = () => {\n applyPatch_1.applyPatch(module.exports, {\n compatibilityMode: true,\n fakeFs: underlyingFs,\n });\n};\nif (__non_webpack_module__.parent && __non_webpack_module__.parent.id === 'internal/preload') {\n module.exports.setup();\n if (__non_webpack_module__.filename) {\n // We delete it from the cache in order to support the case where the CLI resolver is invoked from \"yarn run\"\n // It's annoying because it might cause some issues when the file is multiple times in NODE_OPTIONS, but it shouldn't happen anyway.\n // @ts-ignore\n delete module_1.default._cache[__non_webpack_module__.filename];\n }\n}\n// @ts-ignore\nif (process.mainModule === __non_webpack_module__) {\n const reportError = (code, message, data) => {\n process.stdout.write(`${JSON.stringify([{ code, message, data }, null])}\\n`);\n };\n const reportSuccess = (resolution) => {\n process.stdout.write(`${JSON.stringify([null, resolution])}\\n`);\n };\n const processResolution = (request, issuer) => {\n try {\n reportSuccess(module.exports.resolveRequest(request, issuer));\n }\n catch (error) {\n reportError(error.code, error.message, error.data);\n }\n };\n const processRequest = (data) => {\n try {\n const [request, issuer] = JSON.parse(data);\n processResolution(request, issuer);\n }\n catch (error) {\n reportError(`INVALID_JSON`, error.message, error.data);\n }\n };\n if (process.argv.length > 2) {\n if (process.argv.length !== 4) {\n process.stderr.write(`Usage: ${process.argv[0]} ${process.argv[1]} \\n`);\n process.exitCode = 64; /* EX_USAGE */\n }\n else {\n processResolution(process.argv[2], process.argv[3]);\n }\n }\n else {\n let buffer = '';\n const decoder = new string_decoder_1.default.StringDecoder();\n process.stdin.on('data', chunk => {\n buffer += decoder.write(chunk);\n do {\n const index = buffer.indexOf('\\n');\n if (index === -1)\n break;\n const line = buffer.slice(0, index);\n buffer = buffer.slice(index + 1);\n processRequest(line);\n } while (true);\n });\n }\n}\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ProxiedFS_1 = __webpack_require__(2);\nclass AliasFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs, pathUtils }) {\n super(pathUtils);\n this.target = target;\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.target;\n }\n getBaseFs() {\n return this.baseFs;\n }\n mapFromBase(p) {\n return p;\n }\n mapToBase(p) {\n return p;\n }\n}\nexports.AliasFS = AliasFS;\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(2);\nconst path_1 = __webpack_require__(0);\nclass CwdFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.target = target;\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n mapFromBase(path) {\n return this.pathUtils.relative(this.getRealPath(), path);\n }\n mapToBase(path) {\n return this.pathUtils.resolve(this.getRealPath(), path);\n }\n}\nexports.CwdFS = CwdFS;\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(2);\nconst path_1 = __webpack_require__(0);\nconst JAIL_ROOT = path_1.PortablePath.root;\nclass JailFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.target = this.pathUtils.resolve(path_1.PortablePath.root, target);\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.pathUtils.relative(path_1.PortablePath.root, this.target));\n }\n getTarget() {\n return this.target;\n }\n getBaseFs() {\n return this.baseFs;\n }\n mapToBase(p) {\n const normalized = this.pathUtils.normalize(p);\n if (this.pathUtils.isAbsolute(p))\n return this.pathUtils.resolve(this.target, this.pathUtils.relative(JAIL_ROOT, p));\n if (normalized.match(/^\\.\\.\\//))\n throw new Error(`Resolving this path (${p}) would escape the jail`);\n return this.pathUtils.resolve(this.target, p);\n }\n mapFromBase(p) {\n return this.pathUtils.resolve(JAIL_ROOT, this.pathUtils.relative(this.target, p));\n }\n}\nexports.JailFS = JailFS;\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ProxiedFS_1 = __webpack_require__(2);\nclass LazyFS extends ProxiedFS_1.ProxiedFS {\n constructor(factory, pathUtils) {\n super(pathUtils);\n this.instance = null;\n this.factory = factory;\n }\n get baseFs() {\n if (!this.instance)\n this.instance = this.factory();\n return this.instance;\n }\n mapFromBase(p) {\n return p;\n }\n mapToBase(p) {\n return p;\n }\n}\nexports.LazyFS = LazyFS;\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(2);\nconst path_1 = __webpack_require__(0);\nclass PosixFS extends ProxiedFS_1.ProxiedFS {\n constructor(baseFs) {\n super(path_1.npath);\n this.baseFs = baseFs;\n }\n mapFromBase(path) {\n return NodeFS_1.NodeFS.fromPortablePath(path);\n }\n mapToBase(path) {\n return NodeFS_1.NodeFS.toPortablePath(path);\n }\n}\nexports.PosixFS = PosixFS;\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(2);\nconst path_1 = __webpack_require__(0);\n// https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js\nconst escapeRegexp = (s) => s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\nclass VirtualFS extends ProxiedFS_1.ProxiedFS {\n static makeVirtualPath(base, component, to) {\n // Obtains the relative distance between the virtual path and its actual target\n const target = path_1.ppath.relative(path_1.ppath.dirname(base), to);\n const segments = target.split(`/`);\n // Counts how many levels we need to go back to start applying the rest of the path\n let depth = 0;\n while (depth < segments.length && segments[depth] === `..`)\n depth += 1;\n const finalSegments = segments.slice(depth);\n const fullVirtualPath = path_1.ppath.join(base, component, String(depth), ...finalSegments);\n return fullVirtualPath;\n }\n constructor(virtual, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.baseFs = baseFs;\n this.target = path_1.ppath.dirname(virtual);\n this.virtual = virtual;\n this.mapToBaseRegExp = new RegExp(`^(${escapeRegexp(this.virtual)})((?:/([^\\/]+)(?:/([^/]+))?)?((?:/.*)?))$`);\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n realpathSync(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return this.baseFs.realpathSync(p);\n if (!match[5])\n return p;\n const realpath = this.baseFs.realpathSync(this.mapToBase(p));\n return VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n async realpathPromise(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return await this.baseFs.realpathPromise(p);\n if (!match[5])\n return p;\n const realpath = await this.baseFs.realpathPromise(this.mapToBase(p));\n return VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n mapToBase(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return p;\n if (match[3])\n return this.mapToBase(path_1.ppath.join(this.target, `../`.repeat(Number(match[4])), match[5]));\n return this.target;\n }\n mapFromBase(p) {\n return p;\n }\n}\nexports.VirtualFS = VirtualFS;\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst libzip_1 = __importDefault(__webpack_require__(18));\nconst number64 = [\n `number`,\n `number`,\n];\n// eslint-disable-next-line arca/no-default-export\nexports.default = {\n // Those are getters because they can change after memory growth\n get HEAP8() { return libzip_1.default.HEAP8; },\n get HEAPU8() { return libzip_1.default.HEAPU8; },\n ZIP_CHECKCONS: 4,\n ZIP_CREATE: 1,\n ZIP_EXCL: 2,\n ZIP_TRUNCATE: 8,\n ZIP_RDONLY: 16,\n ZIP_FL_OVERWRITE: 8192,\n ZIP_OPSYS_DOS: 0x00,\n ZIP_OPSYS_AMIGA: 0x01,\n ZIP_OPSYS_OPENVMS: 0x02,\n ZIP_OPSYS_UNIX: 0x03,\n ZIP_OPSYS_VM_CMS: 0x04,\n ZIP_OPSYS_ATARI_ST: 0x05,\n ZIP_OPSYS_OS_2: 0x06,\n ZIP_OPSYS_MACINTOSH: 0x07,\n ZIP_OPSYS_Z_SYSTEM: 0x08,\n ZIP_OPSYS_CPM: 0x09,\n ZIP_OPSYS_WINDOWS_NTFS: 0x0a,\n ZIP_OPSYS_MVS: 0x0b,\n ZIP_OPSYS_VSE: 0x0c,\n ZIP_OPSYS_ACORN_RISC: 0x0d,\n ZIP_OPSYS_VFAT: 0x0e,\n ZIP_OPSYS_ALTERNATE_MVS: 0x0f,\n ZIP_OPSYS_BEOS: 0x10,\n ZIP_OPSYS_TANDEM: 0x11,\n ZIP_OPSYS_OS_400: 0x12,\n ZIP_OPSYS_OS_X: 0x13,\n uint08S: libzip_1.default._malloc(1),\n uint16S: libzip_1.default._malloc(2),\n uint32S: libzip_1.default._malloc(4),\n uint64S: libzip_1.default._malloc(8),\n malloc: libzip_1.default._malloc,\n free: libzip_1.default._free,\n getValue: libzip_1.default.getValue,\n open: libzip_1.default.cwrap(`zip_open`, `number`, [`string`, `number`, `number`]),\n openFromSource: libzip_1.default.cwrap(`zip_open_from_source`, `number`, [`number`, `number`, `number`]),\n close: libzip_1.default.cwrap(`zip_close`, `number`, [`number`]),\n discard: libzip_1.default.cwrap(`zip_discard`, `void`, [`number`]),\n getError: libzip_1.default.cwrap(`zip_get_error`, `number`, [`number`]),\n getName: libzip_1.default.cwrap(`zip_get_name`, `string`, [`number`, `number`, `number`]),\n getNumEntries: libzip_1.default.cwrap(`zip_get_num_entries`, `number`, [`number`, `number`]),\n stat: libzip_1.default.cwrap(`zip_stat`, `number`, [`number`, `string`, `number`, `number`]),\n statIndex: libzip_1.default.cwrap(`zip_stat_index`, `number`, [`number`, ...number64, `number`, `number`]),\n fopen: libzip_1.default.cwrap(`zip_fopen`, `number`, [`number`, `string`, `number`]),\n fopenIndex: libzip_1.default.cwrap(`zip_fopen_index`, `number`, [`number`, ...number64, `number`]),\n fread: libzip_1.default.cwrap(`zip_fread`, `number`, [`number`, `number`, `number`, `number`]),\n fclose: libzip_1.default.cwrap(`zip_fclose`, `number`, [`number`]),\n dir: {\n add: libzip_1.default.cwrap(`zip_dir_add`, `number`, [`number`, `string`]),\n },\n file: {\n add: libzip_1.default.cwrap(`zip_file_add`, `number`, [`number`, `string`, `number`, `number`]),\n getError: libzip_1.default.cwrap(`zip_file_get_error`, `number`, [`number`]),\n getExternalAttributes: libzip_1.default.cwrap(`zip_file_get_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setExternalAttributes: libzip_1.default.cwrap(`zip_file_set_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setMtime: libzip_1.default.cwrap(`zip_file_set_mtime`, `number`, [`number`, ...number64, `number`, `number`]),\n },\n error: {\n initWithCode: libzip_1.default.cwrap(`zip_error_init_with_code`, `void`, [`number`, `number`]),\n strerror: libzip_1.default.cwrap(`zip_error_strerror`, `string`, [`number`]),\n },\n name: {\n locate: libzip_1.default.cwrap(`zip_name_locate`, `number`, [`number`, `string`, `number`]),\n },\n source: {\n fromUnattachedBuffer: libzip_1.default.cwrap(`zip_source_buffer_create`, `number`, [`number`, `number`, `number`, `number`]),\n fromBuffer: libzip_1.default.cwrap(`zip_source_buffer`, `number`, [`number`, `number`, ...number64, `number`]),\n free: libzip_1.default.cwrap(`zip_source_free`, `void`, [`number`]),\n },\n struct: {\n stat: libzip_1.default.cwrap(`zipstruct_stat`, `number`, []),\n statS: libzip_1.default.cwrap(`zipstruct_statS`, `number`, []),\n statName: libzip_1.default.cwrap(`zipstruct_stat_name`, `string`, [`number`]),\n statIndex: libzip_1.default.cwrap(`zipstruct_stat_index`, `number`, [`number`]),\n statSize: libzip_1.default.cwrap(`zipstruct_stat_size`, `number`, [`number`]),\n statMtime: libzip_1.default.cwrap(`zipstruct_stat_mtime`, `number`, [`number`]),\n error: libzip_1.default.cwrap(`zipstruct_error`, `number`, []),\n errorS: libzip_1.default.cwrap(`zipstruct_errorS`, `number`, []),\n },\n};\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar frozenFs = Object.assign({}, __webpack_require__(3));\nvar Module=typeof Module!==\"undefined\"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module[\"arguments\"]=[];Module[\"thisProgram\"]=\"./this.program\";Module[\"quit\"]=function(status,toThrow){throw toThrow};Module[\"preRun\"]=[];Module[\"postRun\"]=[];var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=true;if(Module[\"ENVIRONMENT\"]){throw new Error(\"Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)\")}var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){if(!(typeof process===\"object\"&&\"function\"===\"function\"))throw new Error(\"not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)\");scriptDirectory=__dirname+\"/\";var nodeFS;var nodePath;Module[\"read\"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=frozenFs;if(!nodePath)nodePath=__webpack_require__(6);filename=nodePath[\"normalize\"](filename);ret=nodeFS[\"readFileSync\"](filename)}return binary?ret:ret.toString()};Module[\"readBinary\"]=function readBinary(filename){var ret=Module[\"read\"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){Module[\"thisProgram\"]=process[\"argv\"][1].replace(/\\\\/g,\"/\")}Module[\"arguments\"]=process[\"argv\"].slice(2);if(true){module[\"exports\"]=Module}(function(){})(\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});(function(){})(\"unhandledRejection\",abort);Module[\"quit\"]=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else{throw new Error(\"environment detection error\")}var out=Module[\"print\"]||(typeof console!==\"undefined\"?console.log.bind(console):typeof print!==\"undefined\"?print:null);var err=Module[\"printErr\"]||(typeof printErr!==\"undefined\"?printErr:typeof console!==\"undefined\"&&console.warn.bind(console)||out);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;assert(typeof Module[\"memoryInitializerPrefixURL\"]===\"undefined\",\"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"pthreadMainPrefixURL\"]===\"undefined\",\"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"cdInitializerPrefixURL\"]===\"undefined\",\"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"filePackagePrefixURL\"]===\"undefined\",\"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");stackSave=stackRestore=stackAlloc=function(){abort(\"cannot use the stack before compiled code is ready to run, and has provided stack access\")};function dynamicAlloc(size){assert(DYNAMICTOP_PTR);var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;if(end<=_emscripten_get_heap_size()){HEAP32[DYNAMICTOP_PTR>>2]=end}else{var success=_emscripten_resize_heap(end);if(!success)return 0}return ret}function getNativeTypeSize(type){switch(type){case\"i1\":case\"i8\":return 1;case\"i16\":return 2;case\"i32\":return 4;case\"i64\":return 8;case\"float\":return 4;case\"double\":return 8;default:{if(type[type.length-1]===\"*\"){return 4}else if(type[0]===\"i\"){var bits=parseInt(type.substr(1));assert(bits%8===0,\"getNativeTypeSize invalid bits \"+bits+\", type \"+type);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}var asm2wasmImports={\"f64-rem\":function(x,y){return x%y},\"debugger\":function(){debugger}};var functionPointers=new Array(0);var tempRet0=0;var setTempRet0=function(value){tempRet0=value};if(typeof WebAssembly!==\"object\"){abort(\"No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.\")}function getValue(ptr,type,noSafe){type=type||\"i8\";if(type.charAt(type.length-1)===\"*\")type=\"i32\";if(noSafe){switch(type){case\"i1\":return HEAP8[ptr>>0];case\"i8\":return HEAP8[ptr>>0];case\"i16\":return HEAP16[ptr>>1];case\"i32\":return HEAP32[ptr>>2];case\"i64\":return HEAP32[ptr>>2];case\"float\":return HEAPF32[ptr>>2];case\"double\":return HEAPF64[ptr>>3];default:abort(\"invalid type for getValue: \"+type)}}else{switch(type){case\"i1\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i8\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i16\":return SAFE_HEAP_LOAD(ptr|0,2,0)|0;case\"i32\":return SAFE_HEAP_LOAD(ptr|0,4,0)|0;case\"i64\":return SAFE_HEAP_LOAD(ptr|0,8,0)|0;case\"float\":return Math_fround(SAFE_HEAP_LOAD_D(ptr|0,4,0));case\"double\":return+SAFE_HEAP_LOAD_D(ptr|0,8,0);default:abort(\"invalid type for getValue: \"+type)}}return null}function getSafeHeapType(bytes,isFloat){switch(bytes){case 1:return\"i8\";case 2:return\"i16\";case 4:return isFloat?\"float\":\"i32\";case 8:return\"double\";default:assert(0)}}function SAFE_HEAP_STORE(dest,value,bytes,isFloat){if(dest<=0)abort(\"segmentation fault storing \"+bytes+\" bytes to address \"+dest);if(dest%bytes!==0)abort(\"alignment error storing to address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when storing \"+bytes+\" bytes to address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);setValue(dest,value,getSafeHeapType(bytes,isFloat),1)}function SAFE_HEAP_STORE_D(dest,value,bytes){SAFE_HEAP_STORE(dest,value,bytes,true)}function SAFE_HEAP_LOAD(dest,bytes,unsigned,isFloat){if(dest<=0)abort(\"segmentation fault loading \"+bytes+\" bytes from address \"+dest);if(dest%bytes!==0)abort(\"alignment error loading from address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when loading \"+bytes+\" bytes from address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);var type=getSafeHeapType(bytes,isFloat);var ret=getValue(dest,type,1);if(unsigned)ret=unSign(ret,parseInt(type.substr(1)),1);return ret}function SAFE_HEAP_LOAD_D(dest,bytes,unsigned){return SAFE_HEAP_LOAD(dest,bytes,unsigned,true)}function segfault(){abort(\"segmentation fault\")}function alignfault(){abort(\"alignment fault\")}var wasmMemory;var wasmTable;var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!==\"array\",'Return type should not be \"array\".');if(args){for(var i=0;i>0]=value;break;case\"i8\":HEAP8[ptr>>0]=value;break;case\"i16\":HEAP16[ptr>>1]=value;break;case\"i32\":HEAP32[ptr>>2]=value;break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case\"float\":HEAPF32[ptr>>2]=value;break;case\"double\":HEAPF64[ptr>>3]=value;break;default:abort(\"invalid type for setValue: \"+type)}}else{switch(type){case\"i1\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i8\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i16\":SAFE_HEAP_STORE(ptr|0,value|0,2);break;case\"i32\":SAFE_HEAP_STORE(ptr|0,value|0,4);break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],SAFE_HEAP_STORE(ptr|0,tempI64[0]|0,4),SAFE_HEAP_STORE(ptr+4|0,tempI64[1]|0,4);break;case\"float\":SAFE_HEAP_STORE_D(ptr|0,Math_fround(value),4);break;case\"double\":SAFE_HEAP_STORE_D(ptr|0,+value,8);break;default:abort(\"invalid type for setValue: \"+type)}}}var ALLOC_NORMAL=0;var ALLOC_NONE=3;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab===\"number\"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types===\"string\"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[_malloc,stackAlloc,dynamicAlloc][allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var stop;ptr=ret;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType===\"i8\"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str=\"\";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>=2097152)warnOnce(\"Invalid Unicode code point 0x\"+u.toString(16)+\" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF).\");outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){assert(typeof maxBytesToWrite==\"number\",\"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!==\"undefined\"?new TextDecoder(\"utf-16le\"):undefined;function writeArrayToMemory(array,buffer){assert(array.length>=0,\"writeArrayToMemory array must have a length (should be an array or typed array)\");HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module[\"HEAP8\"]=HEAP8=new Int8Array(buffer);Module[\"HEAP16\"]=HEAP16=new Int16Array(buffer);Module[\"HEAP32\"]=HEAP32=new Int32Array(buffer);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buffer);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buffer);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buffer);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buffer);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buffer)}var STACK_BASE=22720,STACK_MAX=5265600,DYNAMIC_BASE=5265600,DYNAMICTOP_PTR=22464;assert(STACK_BASE%16===0,\"stack must start aligned\");assert(DYNAMIC_BASE%16===0,\"heap must start aligned\");var TOTAL_STACK=5242880;if(Module[\"TOTAL_STACK\"])assert(TOTAL_STACK===Module[\"TOTAL_STACK\"],\"the stack size can no longer be determined at runtime\");var INITIAL_TOTAL_MEMORY=Module[\"TOTAL_MEMORY\"]||16777216;if(INITIAL_TOTAL_MEMORY>2]=DYNAMIC_BASE;function writeStackCookie(){assert((STACK_MAX&3)==0);HEAPU32[(STACK_MAX>>2)-1]=34821223;HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(HEAPU32[(STACK_MAX>>2)-1]!=34821223||HEAPU32[(STACK_MAX>>2)-2]!=2310721022){abort(\"Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x\"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+\" \"+HEAPU32[(STACK_MAX>>2)-1].toString(16))}if(HEAP32[0]!==1668509029)throw\"Runtime error: The application has corrupted its heap memory area (address zero)!\"}function abortStackOverflow(allocSize){abort(\"Stack overflow! Attempted to allocate \"+allocSize+\" bytes on the stack, but stack has only \"+(STACK_MAX-stackSave()+allocSize)+\" bytes available!\")}HEAP32[0]=1668509029;HEAP16[1]=25459;if(HEAPU8[2]!==115||HEAPU8[3]!==99)throw\"Runtime error: expected the system to be little-endian!\";function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback();continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){Module[\"dynCall_v\"](func)}else{Module[\"dynCall_vi\"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){checkStackCookie();if(runtimeInitialized)return;runtimeInitialized=true;if(!Module[\"noFSInit\"]&&!FS.init.initialized)FS.init();TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<=0){err(\"Memory size incompatibility issues may be due to changing TOTAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set TOTAL_MEMORY at runtime to something smaller than it was at compile time).\")}return false}receiveInstance(instance,module);return Module[\"asm\"]}Module[\"asm\"]=function(global,env,providedBuffer){env[\"memory\"]=wasmMemory;env[\"table\"]=wasmTable=new WebAssembly.Table({\"initial\":55,\"maximum\":55,\"element\":\"anyfunc\"});env[\"__memory_base\"]=1024;env[\"__table_base\"]=0;var exports=createWasm(env);assert(exports,\"binaryen setup failed (no wasm support?)\");return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}});var tempDoublePtr=22704;assert(tempDoublePtr%8==0);var ENV={};function ___buildEnvironment(environ){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV[\"USER\"]=ENV[\"LOGNAME\"]=\"web_user\";ENV[\"PATH\"]=\"/\";ENV[\"PWD\"]=\"/\";ENV[\"HOME\"]=\"/home/web_user\";ENV[\"LANG\"]=\"C.UTF-8\";ENV[\"_\"]=Module[\"thisProgram\"];poolPtr=getMemory(TOTAL_ENV_SIZE);envPtr=getMemory(MAX_ENV_VALUES*4);SAFE_HEAP_STORE(envPtr|0,poolPtr|0,4);SAFE_HEAP_STORE(environ|0,envPtr|0,4)}else{envPtr=SAFE_HEAP_LOAD(environ|0,4,0)|0;poolPtr=SAFE_HEAP_LOAD(envPtr|0,4,0)|0}var strings=[];var totalSize=0;for(var key in ENV){if(typeof ENV[key]===\"string\"){var line=key+\"=\"+ENV[key];strings.push(line);totalSize+=line.length}}if(totalSize>TOTAL_ENV_SIZE){throw new Error(\"Environment size exceeded TOTAL_ENV_SIZE!\")}var ptrSize=4;for(var i=0;i=0;i--){var last=parts[i];if(last===\".\"){parts.splice(i,1)}else if(last===\"..\"){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift(\"..\")}}return parts},normalize:function(path){var isAbsolute=path.charAt(0)===\"/\",trailingSlash=path.substr(-1)===\"/\";path=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),!isAbsolute).join(\"/\");if(!path&&!isAbsolute){path=\".\"}if(path&&trailingSlash){path+=\"/\"}return(isAbsolute?\"/\":\"\")+path},dirname:function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return\".\"}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:function(path){if(path===\"/\")return\"/\";var lastSlash=path.lastIndexOf(\"/\");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join(\"/\"))},join2:function(l,r){return PATH.normalize(l+\"/\"+r)},resolve:function(){var resolvedPath=\"\",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!==\"string\"){throw new TypeError(\"Arguments to path.resolve must be strings\")}else if(!path){return\"\"}resolvedPath=path+\"/\"+resolvedPath;resolvedAbsolute=path.charAt(0)===\"/\"}resolvedPath=PATH.normalizeArray(resolvedPath.split(\"/\").filter(function(p){return!!p}),!resolvedAbsolute).join(\"/\");return(resolvedAbsolute?\"/\":\"\")+resolvedPath||\".\"},relative:function(from,to){from=PATH.resolve(from).substr(1);to=PATH.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!==\"\")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split(\"/\"));var toParts=trim(to.split(\"/\"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString(\"utf-8\")}else{result=null}}else if(typeof window!=\"undefined\"&&typeof window.prompt==\"function\"){result=window.prompt(\"Input: \");if(result!==null){result+=\"\\n\"}}else if(typeof readline==\"function\"){result=readline();if(result!==null){result+=\"\\n\"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,\"/\",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node}return node},getFileDataAsRegularArray:function(node){if(node.contents&&node.contents.subarray){var arr=[];for(var i=0;i=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);return},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;return}if(!node.contents||node.contents.subarray){var oldContents=node.contents;node.contents=new Uint8Array(new ArrayBuffer(newSize));if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize;return}if(!node.contents)node.contents=[];if(node.contents.length>newSize)node.contents.length=newSize;else while(node.contents.length=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return stat.mode},realPath:function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)},flagsForNode:function(flags){flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;var newFlags=0;for(var k in NODEFS.flagsForNodeMap){if(flags&k){newFlags|=NODEFS.flagsForNodeMap[k];flags^=k}}if(!flags){return newFlags}else{throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}},node_ops:{getattr:function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}},setattr:function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)},mknod:function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,\"\",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return node},rename:function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(node){var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsForNode(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(stream,buffer,offset,length,position){if(length===0)return 0;try{return fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}},write:function(stream,buffer,offset,length,position){try{return fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=fs.fstatSync(stream.nfd);position+=stat.size}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position}}};var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};var NODERAWFS={lookupPath:function(path){return{path:path,node:{mode:NODEFS.getMode(path)}}},createStandardStreams:function(){FS.streams[0]={fd:0,nfd:0,position:0,path:\"\",flags:0,tty:true,seekable:false};for(var i=1;i<3;i++){FS.streams[i]={fd:i,nfd:i,position:0,path:\"\",flags:577,tty:true,seekable:false}}},cwd:function(){return process.cwd()},chdir:function(){process.chdir.apply(void 0,arguments)},mknod:function(path,mode){if(FS.isDir(path)){fs.mkdirSync(path,mode)}else{fs.writeFileSync(path,\"\",{mode:mode})}},mkdir:function(){fs.mkdirSync.apply(void 0,arguments)},symlink:function(){fs.symlinkSync.apply(void 0,arguments)},rename:function(){fs.renameSync.apply(void 0,arguments)},rmdir:function(){fs.rmdirSync.apply(void 0,arguments)},readdir:function(){fs.readdirSync.apply(void 0,arguments)},unlink:function(){fs.unlinkSync.apply(void 0,arguments)},readlink:function(){return fs.readlinkSync.apply(void 0,arguments)},stat:function(){return fs.statSync.apply(void 0,arguments)},lstat:function(){return fs.lstatSync.apply(void 0,arguments)},chmod:function(){fs.chmodSync.apply(void 0,arguments)},fchmod:function(){fs.fchmodSync.apply(void 0,arguments)},chown:function(){fs.chownSync.apply(void 0,arguments)},fchown:function(){fs.fchownSync.apply(void 0,arguments)},truncate:function(){fs.truncateSync.apply(void 0,arguments)},ftruncate:function(){fs.ftruncateSync.apply(void 0,arguments)},utime:function(){fs.utimesSync.apply(void 0,arguments)},open:function(path,flags,mode,suggestFD){if(typeof flags===\"string\"){flags=VFS.modeStringToFlags(flags)}var nfd=fs.openSync(path,NODEFS.flagsForNode(flags),mode);var fd=suggestFD!=null?suggestFD:FS.nextfd(nfd);var stream={fd:fd,nfd:nfd,position:0,path:path,flags:flags,seekable:true};FS.streams[fd]=stream;return stream},close:function(stream){if(!stream.stream_ops){fs.closeSync(stream.nfd)}FS.closeStream(stream.fd)},llseek:function(stream,offset,whence){if(stream.stream_ops){return VFS.llseek(stream,offset,whence)}var position=offset;if(whence===1){position+=stream.position}else if(whence===2){position+=fs.fstatSync(stream.nfd).size}else if(whence!==0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}stream.position=position;return position},read:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.read(stream,buffer,offset,length,position)}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesRead=fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.write(stream,buffer,offset,length,position)}if(stream.flags&+\"1024\"){FS.llseek(stream,0,+\"2\")}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesWritten=fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:function(){throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)},mmap:function(){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)},msync:function(){return 0},munmap:function(){return 0},ioctl:function(){throw new FS.ErrnoError(ERRNO_CODES.ENOTTY)}};var ERRNO_MESSAGES={0:\"Success\",1:\"Not super-user\",2:\"No such file or directory\",3:\"No such process\",4:\"Interrupted system call\",5:\"I/O error\",6:\"No such device or address\",7:\"Arg list too long\",8:\"Exec format error\",9:\"Bad file number\",10:\"No children\",11:\"No more processes\",12:\"Not enough core\",13:\"Permission denied\",14:\"Bad address\",15:\"Block device required\",16:\"Mount device busy\",17:\"File exists\",18:\"Cross-device link\",19:\"No such device\",20:\"Not a directory\",21:\"Is a directory\",22:\"Invalid argument\",23:\"Too many open files in system\",24:\"Too many open files\",25:\"Not a typewriter\",26:\"Text file busy\",27:\"File too large\",28:\"No space left on device\",29:\"Illegal seek\",30:\"Read only file system\",31:\"Too many links\",32:\"Broken pipe\",33:\"Math arg out of domain of func\",34:\"Math result not representable\",35:\"File locking deadlock error\",36:\"File or path name too long\",37:\"No record locks available\",38:\"Function not implemented\",39:\"Directory not empty\",40:\"Too many symbolic links\",42:\"No message of desired type\",43:\"Identifier removed\",44:\"Channel number out of range\",45:\"Level 2 not synchronized\",46:\"Level 3 halted\",47:\"Level 3 reset\",48:\"Link number out of range\",49:\"Protocol driver not attached\",50:\"No CSI structure available\",51:\"Level 2 halted\",52:\"Invalid exchange\",53:\"Invalid request descriptor\",54:\"Exchange full\",55:\"No anode\",56:\"Invalid request code\",57:\"Invalid slot\",59:\"Bad font file fmt\",60:\"Device not a stream\",61:\"No data (for no delay io)\",62:\"Timer expired\",63:\"Out of streams resources\",64:\"Machine is not on the network\",65:\"Package not installed\",66:\"The object is remote\",67:\"The link has been severed\",68:\"Advertise error\",69:\"Srmount error\",70:\"Communication error on send\",71:\"Protocol error\",72:\"Multihop attempted\",73:\"Cross mount point (not really error)\",74:\"Trying to read unreadable message\",75:\"Value too large for defined data type\",76:\"Given log. name not unique\",77:\"f.d. invalid for this operation\",78:\"Remote address changed\",79:\"Can access a needed shared lib\",80:\"Accessing a corrupted shared lib\",81:\".lib section in a.out corrupted\",82:\"Attempting to link in too many libs\",83:\"Attempting to exec a shared library\",84:\"Illegal byte sequence\",86:\"Streams pipe error\",87:\"Too many users\",88:\"Socket operation on non-socket\",89:\"Destination address required\",90:\"Message too long\",91:\"Protocol wrong type for socket\",92:\"Protocol not available\",93:\"Unknown protocol\",94:\"Socket type not supported\",95:\"Not supported\",96:\"Protocol family not supported\",97:\"Address family not supported by protocol family\",98:\"Address already in use\",99:\"Address not available\",100:\"Network interface is not configured\",101:\"Network is unreachable\",102:\"Connection reset by network\",103:\"Connection aborted\",104:\"Connection reset by peer\",105:\"No buffer space available\",106:\"Socket is already connected\",107:\"Socket is not connected\",108:\"Can't send after socket shutdown\",109:\"Too many references\",110:\"Connection timed out\",111:\"Connection refused\",112:\"Host is down\",113:\"Host is unreachable\",114:\"Socket already connected\",115:\"Connection already in progress\",116:\"Stale file handle\",122:\"Quota exceeded\",123:\"No medium (in tape drive)\",125:\"Operation canceled\",130:\"Previous owner died\",131:\"State not recoverable\"};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:\"/\",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+\" : \"+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(path,opts){path=PATH.resolve(FS.cwd(),path);opts=opts||{};if(!path)return{path:\"\",node:null};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(40)}var parts=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),false);var current=FS.root;var current_path=\"/\";for(var i=0;i40){throw new FS.ErrnoError(40)}}}}return{path:current_path,node:current}},getPath:function(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!==\"/\"?mount+\"/\"+path:mount+path}path=path?node.name+\"/\"+path:node.name;node=node.parent}},hashName:function(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:function(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:function(parent,name,mode,rdev){if(!FS.FSNode){FS.FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:function(node){FS.hashRemoveNode(node)},isRoot:function(node){return node===node.parent},isMountpoint:function(node){return!!node.mounted},isFile:function(mode){return(mode&61440)===32768},isDir:function(mode){return(mode&61440)===16384},isLink:function(mode){return(mode&61440)===40960},isChrdev:function(mode){return(mode&61440)===8192},isBlkdev:function(mode){return(mode&61440)===24576},isFIFO:function(mode){return(mode&61440)===4096},isSocket:function(mode){return(mode&49152)===49152},flagModes:{\"r\":0,\"rs\":1052672,\"r+\":2,\"w\":577,\"wx\":705,\"xw\":705,\"w+\":578,\"wx+\":706,\"xw+\":706,\"a\":1089,\"ax\":1217,\"xa\":1217,\"a+\":1090,\"ax+\":1218,\"xa+\":1218},modeStringToFlags:function(str){var flags=FS.flagModes[str];if(typeof flags===\"undefined\"){throw new Error(\"Unknown file open mode: \"+str)}return flags},flagsToPermissionString:function(flag){var perms=[\"r\",\"w\",\"rw\"][flag&3];if(flag&512){perms+=\"w\"}return perms},nodePermissions:function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf(\"r\")!==-1&&!(node.mode&292)){return 13}else if(perms.indexOf(\"w\")!==-1&&!(node.mode&146)){return 13}else if(perms.indexOf(\"x\")!==-1&&!(node.mode&73)){return 13}return 0},mayLookup:function(dir){var err=FS.nodePermissions(dir,\"x\");if(err)return err;if(!dir.node_ops.lookup)return 13;return 0},mayCreate:function(dir,name){try{var node=FS.lookupNode(dir,name);return 17}catch(e){}return FS.nodePermissions(dir,\"wx\")},mayDelete:function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,\"wx\");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return 20}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 16}}else{if(FS.isDir(node.mode)){return 21}}return 0},mayOpen:function(node,flags){if(!node){return 2}if(FS.isLink(node.mode)){return 40}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!==\"r\"||flags&512){return 21}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(24)},getStream:function(fd){return FS.streams[fd]},createStream:function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=function(){};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:function(fd){FS.streams[fd]=null},chrdev_stream_ops:{open:function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:function(){throw new FS.ErrnoError(29)}},major:function(dev){return dev>>8},minor:function(dev){return dev&255},makedev:function(ma,mi){return ma<<8|mi},registerDevice:function(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:function(dev){return FS.devices[dev]},getMounts:function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:function(populate,callback){if(typeof populate===\"function\"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){console.log(\"warning: \"+FS.syncFSRequests+\" FS.syncfs operations in flight at once, probably just doing extra work\")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(err){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(err)}function done(err){if(err){if(!done.errored){done.errored=true;return doCallback(err)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:function(type,opts,mountpoint){var root=mountpoint===\"/\";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(16)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(16)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(20)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(22)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)},lookup:function(parent,name){return parent.node_ops.lookup(parent,name)},mknod:function(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name===\".\"||name===\"..\"){throw new FS.ErrnoError(22)}var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(1)}return parent.node_ops.mknod(parent,name,mode,dev)},create:function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:function(path,mode){var dirs=path.split(\"/\");var d=\"\";for(var i=0;i\"})},staticInit:function(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},\"/\");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={\"MEMFS\":MEMFS,\"NODEFS\":NODEFS}},init:function(input,output,error){assert(!FS.init.initialized,\"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)\");FS.init.initialized=true;FS.ensureErrnoError();Module[\"stdin\"]=input||Module[\"stdin\"];Module[\"stdout\"]=output||Module[\"stdout\"];Module[\"stderr\"]=error||Module[\"stderr\"];FS.createStandardStreams()},quit:function(){FS.init.initialized=false;var fflush=Module[\"_fflush\"];if(fflush)fflush(0);for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open(\"HEAD\",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);var datalength=Number(xhr.getResponseHeader(\"Content-length\"));var header;var hasByteServing=(header=xhr.getResponseHeader(\"Accept-Ranges\"))&&header===\"bytes\";var usesGzip=(header=xhr.getResponseHeader(\"Content-Encoding\"))&&header===\"gzip\";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=function(from,to){if(from>to)throw new Error(\"invalid range (\"+from+\", \"+to+\") or no bytes requested!\");if(to>datalength-1)throw new Error(\"only \"+datalength+\" bytes available! programmer error!\");var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);if(datalength!==chunkSize)xhr.setRequestHeader(\"Range\",\"bytes=\"+from+\"-\"+to);if(typeof Uint8Array!=\"undefined\")xhr.responseType=\"arraybuffer\";if(xhr.overrideMimeType){xhr.overrideMimeType(\"text/plain; charset=x-user-defined\")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||\"\",true)}};var lazyArray=this;lazyArray.setDataGetter(function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]===\"undefined\"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]===\"undefined\")throw new Error(\"doXHR failed!\");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;console.log(\"LazyFiles on gzip forces download of the whole file when length is accessed\")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!==\"undefined\"){if(!ENVIRONMENT_IS_WORKER)throw\"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc\";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}return fn.apply(null,arguments)}});stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i=0)assert(high===0);else assert(high===-1);return low},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall10(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.unlink(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);SAFE_HEAP_STORE(result|0,stream.position|0,4);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doWritev(stream,iov,iovcnt)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall15(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),mode=SYSCALLS.get();FS.chmod(path,mode);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall195(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall197(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),cmd=SYSCALLS.get();switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-ERRNO_CODES.EINVAL}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 12:{var arg=SYSCALLS.get();var offset=0;SAFE_HEAP_STORE(arg+offset|0,2|0,2);return 0}case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall38(which,varargs){SYSCALLS.varargs=varargs;try{var old_path=SYSCALLS.getStr(),new_path=SYSCALLS.getStr();FS.rename(old_path,new_path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall40(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.rmdir(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21509:case 21505:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21519:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;var argp=SYSCALLS.get();SAFE_HEAP_STORE(argp|0,0|0,4);return 0}case 21520:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return-ERRNO_CODES.EINVAL}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21524:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}default:abort(\"bad ioctl syscall \"+op)}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall60(which,varargs){SYSCALLS.varargs=varargs;try{var mask=SYSCALLS.get();var old=SYSCALLS.umask;SYSCALLS.umask=mask;return old}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___unlock(){}function _emscripten_get_heap_size(){return HEAP8.length}function abortOnCannotGrowMemory(requestedSize){abort(\"Cannot enlarge memory arrays to size \"+requestedSize+\" bytes (OOM). Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value \"+HEAP8.length+\", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 \")}function emscripten_realloc_buffer(size){var PAGE_MULTIPLE=65536;size=alignUp(size,PAGE_MULTIPLE);var oldSize=buffer.byteLength;try{var result=wasmMemory.grow((size-oldSize)/65536);if(result!==(-1|0)){return buffer=wasmMemory.buffer}else{return null}}catch(e){console.error(\"emscripten_realloc_buffer: Attempted to grow from \"+oldSize+\" bytes to \"+size+\" bytes, but got error: \"+e);return null}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();assert(requestedSize>oldSize);var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){err(\"Cannot enlarge memory, asked to go up to \"+requestedSize+\" bytes, but the limit is \"+LIMIT+\" bytes!\");return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}SAFE_HEAP_STORE(tmPtr+24|0,date.getDay()|0,4);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;SAFE_HEAP_STORE(tmPtr+28|0,yday|0,4);return date.getTime()/1e3|0}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){SAFE_HEAP_STORE(ptr|0,ret|0,4)}return ret}if(ENVIRONMENT_IS_NODE){_emscripten_get_now=function _emscripten_get_now_actual(){var t=process[\"hrtime\"]();return t[0]*1e3+t[1]/1e6}}else if(typeof dateNow!==\"undefined\"){_emscripten_get_now=dateNow}else if(typeof performance===\"object\"&&performance&&typeof performance[\"now\"]===\"function\"){_emscripten_get_now=function(){return performance[\"now\"]()}}else{_emscripten_get_now=Date.now}FS.staticInit();if(ENVIRONMENT_IS_NODE){var fs=frozenFs;var NODEJS_PATH=__webpack_require__(6);NODEFS.staticInit()}if(ENVIRONMENT_IS_NODE){var _wrapNodeError=function(func){return function(){try{return func.apply(this,arguments)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}};var VFS=Object.assign({},FS);for(var _key in NODERAWFS)FS[_key]=_wrapNodeError(NODERAWFS[_key])}else{throw new Error(\"NODERAWFS is currently only supported on Node.js environment.\")}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var decodeBase64=typeof atob===\"function\"?atob:function(input){var keyStr=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";var output=\"\";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}writeStackCookie();preRun();if(runDependencies>0)return;if(Module[\"calledRun\"])return;function doRun(){if(Module[\"calledRun\"])return;Module[\"calledRun\"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();assert(!Module[\"_main\"],'compiled without a main, but one is present. if you added it from JS, use Module[\"onRuntimeInitialized\"]');postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}checkStackCookie()}Module[\"run\"]=run;var abortDecorators=[];function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else{what=\"\"}ABORT=true;EXITSTATUS=1;var extra=\"\";var output=\"abort(\"+what+\") at \"+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach(function(decorator){output=decorator(output,what)})}throw output}Module[\"abort\"]=abort;if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}Module[\"noExitRuntime\"]=true;run();\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"crypto\");\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"stream\");\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"util\");\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = __webpack_require__(3);\nconst FakeFS_1 = __webpack_require__(5);\nconst NodeFS_1 = __webpack_require__(1);\nconst ZipFS_1 = __webpack_require__(8);\nconst path_1 = __webpack_require__(0);\nclass ZipOpenFS extends FakeFS_1.BasePortableFakeFS {\n constructor({ baseFs = new NodeFS_1.NodeFS(), filter = null, useCache = true } = {}) {\n super();\n this.isZip = new Set();\n this.notZip = new Set();\n this.baseFs = baseFs;\n this.zipInstances = useCache ? new Map() : null;\n this.filter = filter;\n this.isZip = new Set();\n this.notZip = new Set();\n }\n static open(fn) {\n const zipOpenFs = new ZipOpenFS();\n try {\n return fn(zipOpenFs);\n }\n finally {\n zipOpenFs.saveAndClose();\n }\n }\n static async openPromise(fn) {\n const zipOpenFs = new ZipOpenFS();\n try {\n return await fn(zipOpenFs);\n }\n finally {\n zipOpenFs.saveAndClose();\n }\n }\n getRealPath() {\n return this.baseFs.getRealPath();\n }\n saveAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.saveAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n discardAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.discardAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n async openPromise(p, flags, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.openPromise(p, flags, mode);\n }, async (zipFs, { archivePath, subPath }) => {\n throw new Error(`Unsupported action (we wouldn't be able to disambiguate the close)`);\n });\n }\n openSync(p, flags, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.openSync(p, flags, mode);\n }, (zipFs, { archivePath, subPath }) => {\n throw new Error(`Unsupported action (we wouldn't be able to disambiguate the close)`);\n });\n }\n async closePromise(fd) {\n return await this.baseFs.closePromise(fd);\n }\n closeSync(fd) {\n return this.baseFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n if (p === null)\n return this.baseFs.createReadStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createReadStream(p, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.createReadStream(subPath, opts);\n });\n }\n createWriteStream(p, opts) {\n if (p === null)\n return this.baseFs.createWriteStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createWriteStream(p, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.createWriteStream(subPath, opts);\n });\n }\n async realpathPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.realpathPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return this.pathUtils.resolve(await this.baseFs.realpathPromise(archivePath), this.pathUtils.relative(path_1.PortablePath.root, await zipFs.realpathPromise(subPath)));\n });\n }\n realpathSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.realpathSync(p);\n }, (zipFs, { archivePath, subPath }) => {\n return this.pathUtils.resolve(this.baseFs.realpathSync(archivePath), this.pathUtils.relative(path_1.PortablePath.root, zipFs.realpathSync(subPath)));\n });\n }\n async existsPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.existsPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.existsPromise(subPath);\n });\n }\n existsSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.existsSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.existsSync(subPath);\n });\n }\n async accessPromise(p, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.accessPromise(p, mode);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.accessPromise(subPath, mode);\n });\n }\n accessSync(p, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.accessSync(p, mode);\n }, (zipFs, { subPath }) => {\n return zipFs.accessSync(subPath, mode);\n });\n }\n async statPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.statPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.statPromise(subPath);\n });\n }\n statSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.statSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.statSync(subPath);\n });\n }\n async lstatPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.lstatPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.lstatPromise(subPath);\n });\n }\n lstatSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.lstatSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.lstatSync(subPath);\n });\n }\n async chmodPromise(p, mask) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.chmodPromise(p, mask);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.chmodPromise(subPath, mask);\n });\n }\n chmodSync(p, mask) {\n return this.makeCallSync(p, () => {\n return this.baseFs.chmodSync(p, mask);\n }, (zipFs, { subPath }) => {\n return zipFs.chmodSync(subPath, mask);\n });\n }\n async renamePromise(oldP, newP) {\n return await this.makeCallPromise(oldP, async () => {\n return await this.makeCallPromise(newP, async () => {\n return await this.baseFs.renamePromise(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n });\n }, async (zipFsO, { archivePath: archivePathO, subPath: subPathO }) => {\n return await this.makeCallPromise(newP, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }, async (zipFsN, { archivePath: archivePathN, subPath: subPathN }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }\n else {\n return await zipFsO.renamePromise(subPathO, subPathN);\n }\n });\n });\n }\n renameSync(oldP, newP) {\n return this.makeCallSync(oldP, () => {\n return this.makeCallSync(newP, () => {\n return this.baseFs.renameSync(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n });\n }, (zipFsO, { archivePath: archivePathO, subPath: subPathO }) => {\n return this.makeCallSync(newP, () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }, (zipFsN, { archivePath: archivePathN, subPath: subPathN }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }\n else {\n return zipFsO.renameSync(subPathO, subPathN);\n }\n });\n });\n }\n async copyFilePromise(sourceP, destP, flags = 0) {\n const fallback = async (sourceFs, sourceP, destFs, destP) => {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), { code: `EXDEV` });\n if ((flags & fs_1.constants.COPYFILE_EXCL) && await this.existsPromise(sourceP))\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n let content;\n try {\n content = await sourceFs.readFilePromise(sourceP);\n }\n catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n }\n await destFs.writeFilePromise(destP, content);\n };\n return await this.makeCallPromise(sourceP, async () => {\n return await this.makeCallPromise(destP, async () => {\n return await this.baseFs.copyFilePromise(sourceP, destP, flags);\n }, async (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n return await fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, async (zipFsS, { archivePath: archivePathS, subPath: subPathS }) => {\n return await this.makeCallPromise(destP, async () => {\n return await fallback(zipFsS, subPathS, this.baseFs, destP);\n }, async (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n if (zipFsS !== zipFsD) {\n return await fallback(zipFsS, subPathS, zipFsD, subPathD);\n }\n else {\n return await zipFsS.copyFilePromise(subPathS, subPathD, flags);\n }\n });\n });\n }\n copyFileSync(sourceP, destP, flags = 0) {\n const fallback = (sourceFs, sourceP, destFs, destP) => {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), { code: `EXDEV` });\n if ((flags & fs_1.constants.COPYFILE_EXCL) && this.existsSync(sourceP))\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n let content;\n try {\n content = sourceFs.readFileSync(sourceP);\n }\n catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n }\n destFs.writeFileSync(destP, content);\n };\n return this.makeCallSync(sourceP, () => {\n return this.makeCallSync(destP, () => {\n return this.baseFs.copyFileSync(sourceP, destP, flags);\n }, (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n return fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, (zipFsS, { archivePath: archivePathS, subPath: subPathS }) => {\n return this.makeCallSync(destP, () => {\n return fallback(zipFsS, subPathS, this.baseFs, destP);\n }, (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n if (zipFsS !== zipFsD) {\n return fallback(zipFsS, subPathS, zipFsD, subPathD);\n }\n else {\n return zipFsS.copyFileSync(subPathS, subPathD, flags);\n }\n });\n });\n }\n async writeFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.writeFilePromise(p, content, opts);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.writeFilePromise(subPath, content, opts);\n });\n }\n writeFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.writeFileSync(p, content, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.writeFileSync(subPath, content, opts);\n });\n }\n async unlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.unlinkPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.unlinkPromise(subPath);\n });\n }\n unlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.unlinkSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.unlinkSync(subPath);\n });\n }\n async utimesPromise(p, atime, mtime) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.utimesPromise(p, atime, mtime);\n }, async (zipFs, { subPath }) => {\n return await zipFs.utimesPromise(subPath, atime, mtime);\n });\n }\n utimesSync(p, atime, mtime) {\n return this.makeCallSync(p, () => {\n return this.baseFs.utimesSync(p, atime, mtime);\n }, (zipFs, { subPath }) => {\n return zipFs.utimesSync(subPath, atime, mtime);\n });\n }\n async mkdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.mkdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.mkdirPromise(subPath);\n });\n }\n mkdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.mkdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.mkdirSync(subPath);\n });\n }\n async rmdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.rmdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.rmdirPromise(subPath);\n });\n }\n rmdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.rmdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.rmdirSync(subPath);\n });\n }\n async symlinkPromise(target, p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.symlinkPromise(target, p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.symlinkPromise(target, subPath);\n });\n }\n symlinkSync(target, p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.symlinkSync(target, p);\n }, (zipFs, { subPath }) => {\n return zipFs.symlinkSync(target, subPath);\n });\n }\n async readFilePromise(p, encoding) {\n return this.makeCallPromise(p, async () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return await this.baseFs.readFilePromise(p, encoding);\n default:\n return await this.baseFs.readFilePromise(p, encoding);\n }\n }, async (zipFs, { subPath }) => {\n return await zipFs.readFilePromise(subPath, encoding);\n });\n }\n readFileSync(p, encoding) {\n return this.makeCallSync(p, () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.baseFs.readFileSync(p, encoding);\n default:\n return this.baseFs.readFileSync(p, encoding);\n }\n }, (zipFs, { subPath }) => {\n return zipFs.readFileSync(subPath, encoding);\n });\n }\n async readdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.readdirPromise(subPath);\n }, {\n requireSubpath: false,\n });\n }\n readdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.readdirSync(subPath);\n }, {\n requireSubpath: false,\n });\n }\n async readlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readlinkPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.readlinkPromise(subPath);\n });\n }\n readlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readlinkSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.readlinkSync(subPath);\n });\n }\n watch(p, a, b) {\n return this.makeCallSync(p, () => {\n return this.baseFs.watch(p, \n // @ts-ignore\n a, b);\n }, (zipFs, { subPath }) => {\n return zipFs.watch(subPath, \n // @ts-ignore\n a, b);\n });\n }\n async makeCallPromise(p, discard, accept, { requireSubpath = true } = {}) {\n p = this.pathUtils.normalize(this.pathUtils.resolve(path_1.PortablePath.root, p));\n const zipInfo = this.findZip(p);\n if (!zipInfo)\n return await discard();\n if (requireSubpath && zipInfo.subPath === `/`)\n return await discard();\n return await this.getZipPromise(zipInfo.archivePath, async (zipFs) => await accept(zipFs, zipInfo));\n }\n makeCallSync(p, discard, accept, { requireSubpath = true } = {}) {\n p = this.pathUtils.normalize(this.pathUtils.resolve(path_1.PortablePath.root, p));\n const zipInfo = this.findZip(p);\n if (!zipInfo)\n return discard();\n if (requireSubpath && zipInfo.subPath === `/`)\n return discard();\n return this.getZipSync(zipInfo.archivePath, zipFs => accept(zipFs, zipInfo));\n }\n findZip(p) {\n if (this.filter && !this.filter.test(p))\n return null;\n const parts = p.split(/\\//g);\n for (let t = 2; t <= parts.length; ++t) {\n const archivePath = parts.slice(0, t).join(`/`);\n if (this.notZip.has(archivePath))\n continue;\n if (this.isZip.has(archivePath))\n return { archivePath, subPath: this.pathUtils.resolve(path_1.PortablePath.root, parts.slice(t).join(`/`)) };\n let realArchivePath = archivePath;\n let stat;\n while (true) {\n try {\n stat = this.baseFs.lstatSync(realArchivePath);\n }\n catch (error) {\n return null;\n }\n if (stat.isSymbolicLink()) {\n realArchivePath = this.pathUtils.resolve(this.pathUtils.dirname(realArchivePath), this.baseFs.readlinkSync(realArchivePath));\n }\n else {\n break;\n }\n }\n const isZip = stat.isFile() && this.pathUtils.extname(realArchivePath) === `.zip`;\n if (isZip) {\n this.isZip.add(archivePath);\n return { archivePath, subPath: this.pathUtils.resolve(path_1.PortablePath.root, parts.slice(t).join(`/`)) };\n }\n else {\n this.notZip.add(archivePath);\n if (stat.isFile()) {\n return null;\n }\n }\n }\n return null;\n }\n async getZipPromise(p, accept) {\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs)\n this.zipInstances.set(p, zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs, stats: await this.baseFs.statPromise(p) }));\n return await accept(zipFs);\n }\n else {\n const zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs, stats: await this.baseFs.statPromise(p) });\n try {\n return await accept(zipFs);\n }\n finally {\n zipFs.saveAndClose();\n }\n }\n }\n getZipSync(p, accept) {\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs)\n this.zipInstances.set(p, zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs }));\n return accept(zipFs);\n }\n else {\n const zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs });\n try {\n return accept(zipFs);\n }\n finally {\n zipFs.saveAndClose();\n }\n }\n }\n}\nexports.ZipOpenFS = ZipOpenFS;\n\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"string_decoder\");\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(4);\nconst fs_1 = __importDefault(__webpack_require__(3));\nconst module_1 = __importDefault(__webpack_require__(7));\nconst path_1 = __importDefault(__webpack_require__(6));\nconst internalTools_1 = __webpack_require__(9);\nfunction applyPatch(pnpapi, opts) {\n // @ts-ignore\n const builtinModules = new Set(module_1.default.builtinModules || Object.keys(process.binding('natives')));\n // The callback function gets called to wrap the return value of the module names matching the regexp\n const patchedModules = [];\n if (opts.compatibilityMode) {\n // Modern versions of `resolve` support a specific entry point that custom resolvers can use\n // to inject a specific resolution logic without having to patch the whole package.\n //\n // Cf: https://github.com/browserify/resolve/pull/174\n patchedModules.push([\n /^\\.\\/normalize-options\\.js$/,\n (issuer, normalizeOptions) => {\n if (!issuer || issuer.name !== 'resolve')\n return normalizeOptions;\n return (request, opts) => {\n opts = opts || {};\n if (opts.forceNodeResolution)\n return opts;\n opts.preserveSymlinks = true;\n opts.paths = function (request, basedir, getNodeModulesDir, opts) {\n // Extract the name of the package being requested (1=full name, 2=scope name, 3=local name)\n const parts = request.match(/^((?:(@[^\\/]+)\\/)?([^\\/]+))/);\n if (!parts)\n throw new Error(`Assertion failed: Expected the \"resolve\" package to call the \"paths\" callback with package names only (got \"${request}\")`);\n // make sure that basedir ends with a slash\n if (basedir.charAt(basedir.length - 1) !== '/')\n basedir = path_1.default.join(basedir, '/');\n // TODO Handle portable paths\n // This is guaranteed to return the path to the \"package.json\" file from the given package\n const manifestPath = pnpapi.resolveToUnqualified(`${parts[1]}/package.json`, basedir, {\n considerBuiltins: false,\n });\n if (manifestPath === null)\n throw new Error(`Assertion failed: The resolution thinks that \"${parts[1]}\" is a Node builtin`);\n // The first dirname strips the package.json, the second strips the local named folder\n let nodeModules = path_1.default.dirname(path_1.default.dirname(manifestPath));\n // Strips the scope named folder if needed\n if (parts[2])\n nodeModules = path_1.default.dirname(nodeModules);\n return [nodeModules];\n };\n return opts;\n };\n },\n ]);\n }\n /**\n * Used to disable the resolution hooks (for when we want to fallback to the previous resolution - we then need\n * a way to \"reset\" the environment temporarily)\n */\n let enableNativeHooks = true;\n // @ts-ignore\n process.versions.pnp = String(pnpapi.VERSIONS.std);\n // A small note: we don't replace the cache here (and instead use the native one). This is an effort to not\n // break code similar to \"delete require.cache[require.resolve(FOO)]\", where FOO is a package located outside\n // of the Yarn dependency tree. In this case, we defer the load to the native loader. If we were to replace the\n // cache by our own, the native loader would populate its own cache, which wouldn't be exposed anymore, so the\n // delete call would be broken.\n const originalModuleLoad = module_1.default._load;\n module_1.default._load = function (request, parent, isMain) {\n if (!enableNativeHooks)\n return originalModuleLoad.call(module_1.default, request, parent, isMain);\n // Builtins are managed by the regular Node loader\n if (builtinModules.has(request)) {\n try {\n enableNativeHooks = false;\n return originalModuleLoad.call(module_1.default, request, parent, isMain);\n }\n finally {\n enableNativeHooks = true;\n }\n }\n // The 'pnpapi' name is reserved to return the PnP api currently in use by the program\n if (request === `pnpapi`)\n return pnpapi;\n // Request `Module._resolveFilename` (ie. `resolveRequest`) to tell us which file we should load\n const modulePath = module_1.default._resolveFilename(request, parent, isMain);\n // Check if the module has already been created for the given file\n const cacheEntry = module_1.default._cache[modulePath];\n if (cacheEntry)\n return cacheEntry.exports;\n // Create a new module and store it into the cache\n // @ts-ignore\n const module = new module_1.default(modulePath, parent);\n module_1.default._cache[modulePath] = module;\n // The main module is exposed as global variable\n if (isMain) {\n // @ts-ignore\n process.mainModule = module;\n module.id = '.';\n }\n // Try to load the module, and remove it from the cache if it fails\n let hasThrown = true;\n try {\n module.load(modulePath);\n hasThrown = false;\n }\n finally {\n if (hasThrown) {\n delete module_1.default._cache[modulePath];\n }\n }\n // Some modules might have to be patched for compatibility purposes\n for (const [filter, patchFn] of patchedModules) {\n if (filter.test(request)) {\n const issuer = parent && parent.filename ? pnpapi.findPackageLocator(parent.filename) : null;\n module.exports = patchFn(issuer, module.exports);\n }\n }\n return module.exports;\n };\n const originalModuleResolveFilename = module_1.default._resolveFilename;\n module_1.default._resolveFilename = function (request, parent, isMain, options) {\n if (request === `pnpapi`)\n return request;\n if (!enableNativeHooks)\n return originalModuleResolveFilename.call(module_1.default, request, parent, isMain, options);\n if (options && options.plugnplay === false) {\n try {\n enableNativeHooks = false;\n return originalModuleResolveFilename.call(module_1.default, request, parent, isMain, options);\n }\n finally {\n enableNativeHooks = true;\n }\n }\n let issuers;\n if (options) {\n const optionNames = new Set(Object.keys(options));\n optionNames.delete(`paths`);\n optionNames.delete(`plugnplay`);\n if (optionNames.size > 0) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNSUPPORTED, `Some options passed to require() aren't supported by PnP yet (${Array.from(optionNames).join(', ')})`);\n }\n if (options.paths) {\n issuers = options.paths.map((entry) => {\n return `${path_1.default.normalize(entry)}/`;\n });\n }\n }\n if (!issuers) {\n const issuerModule = internalTools_1.getIssuerModule(parent);\n const issuer = issuerModule ? issuerModule.filename : `${fslib_1.NodeFS.toPortablePath(process.cwd())}/`;\n issuers = [issuer];\n }\n // When Node is called, it tries to require the main script but can't\n // because PnP already patched 'Module'\n // We test it for an absolute Windows path and convert it to a portable path.\n // We should probably always call toPortablePath and check for this directly\n if (/^[A-Z]:.*/.test(request))\n request = fslib_1.NodeFS.toPortablePath(request);\n let firstError;\n for (const issuer of issuers) {\n let resolution;\n try {\n resolution = pnpapi.resolveRequest(request, issuer);\n }\n catch (error) {\n firstError = firstError || error;\n continue;\n }\n return resolution !== null ? resolution : request;\n }\n throw firstError;\n };\n const originalFindPath = module_1.default._findPath;\n module_1.default._findPath = function (request, paths, isMain) {\n if (request === `pnpapi`)\n return false;\n if (!enableNativeHooks)\n return originalFindPath.call(module_1.default, request, paths, isMain);\n for (const path of paths) {\n let resolution;\n try {\n // TODO Convert path to portable path?\n resolution = pnpapi.resolveRequest(request, path);\n }\n catch (error) {\n continue;\n }\n if (resolution) {\n return resolution;\n }\n }\n return false;\n };\n fslib_1.patchFs(fs_1.default, new fslib_1.PosixFS(opts.fakeFs));\n}\nexports.applyPatch = applyPatch;\n;\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(4);\nfunction hydrateRuntimeState(data, { basePath }) {\n const portablePath = fslib_1.NodeFS.toPortablePath(basePath);\n const ignorePattern = data.ignorePatternData !== null\n ? new RegExp(data.ignorePatternData)\n : null;\n const packageRegistry = new Map(data.packageRegistryData.map(([packageName, packageStoreData]) => {\n return [packageName, new Map(packageStoreData.map(([packageReference, packageInformationData]) => {\n return [packageReference, {\n packageLocation: fslib_1.ppath.resolve(portablePath, packageInformationData.packageLocation),\n packageDependencies: new Map(packageInformationData.packageDependencies),\n }];\n }))];\n }));\n const packageLocatorsByLocations = new Map();\n for (const [packageName, storeData] of data.packageRegistryData) {\n for (const [packageReference, packageInformationData] of storeData) {\n if ((packageName === null) !== (packageReference === null))\n throw new Error(`Assertion failed: The name and reference should be null, or neither should`);\n // @ts-ignore: TypeScript isn't smart enough to understand the type assertion\n const packageLocator = { name: packageName, reference: packageReference };\n packageLocatorsByLocations.set(packageInformationData.packageLocation, packageLocator);\n }\n }\n for (const location of data.locationBlacklistData)\n packageLocatorsByLocations.set(location, null);\n const fallbackExclusionList = new Map(data.fallbackExclusionList.map(([packageName, packageReferences]) => {\n return [packageName, new Set(packageReferences)];\n }));\n const virtualRoots = data.virtualRoots.map(virtualRoot => {\n return fslib_1.ppath.resolve(portablePath, virtualRoot);\n });\n const enableTopLevelFallback = data.enableTopLevelFallback;\n const packageLocationLengths = data.locationLengthData;\n return {\n basePath: portablePath,\n enableTopLevelFallback,\n fallbackExclusionList,\n ignorePattern,\n packageLocationLengths,\n packageLocatorsByLocations,\n packageRegistry,\n virtualRoots,\n };\n}\nexports.hydrateRuntimeState = hydrateRuntimeState;\n\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(4);\nconst fslib_2 = __webpack_require__(4);\nconst module_1 = __importDefault(__webpack_require__(7));\nconst internalTools_1 = __webpack_require__(9);\nfunction makeApi(runtimeState, opts) {\n // @ts-ignore\n const builtinModules = new Set(module_1.default.builtinModules || Object.keys(process.binding('natives')));\n // Splits a require request into its components, or return null if the request is a file path\n const pathRegExp = /^(?![a-zA-Z]:[\\\\\\/]|\\\\\\\\|\\.{0,2}(?:\\/|$))((?:@[^\\/]+\\/)?[^\\/]+)\\/?(.*|)$/;\n // Matches if the path starts with a valid path qualifier (./, ../, /)\n // eslint-disable-next-line no-unused-vars\n const isStrictRegExp = /^\\.{0,2}\\//;\n // Matches if the path must point to a directory (ie ends with /)\n const isDirRegExp = /\\/$/;\n // We only instantiate one of those so that we can use strict-equal comparisons\n const topLevelLocator = { name: null, reference: null };\n // Used for compatibility purposes - cf setupCompatibilityLayer\n const fallbackLocators = [];\n if (runtimeState.enableTopLevelFallback === true)\n fallbackLocators.push(topLevelLocator);\n if (opts.compatibilityMode) {\n // ESLint currently doesn't have any portable way for shared configs to\n // specify their own plugins that should be used (cf issue #10125). This\n // will likely get fixed at some point but it'll take time, so in the\n // meantime we'll just add additional fallback entries for common shared\n // configs.\n // Similarly, Gatsby generates files within the `public` folder located\n // within the project, but doesn't pre-resolve the `require` calls to use\n // its own dependencies. Meaning that when PnP see a file from the `public`\n // folder making a require, it thinks that your project forgot to list one\n // of your dependencies.\n for (const name of [`react-scripts`, `gatsby`]) {\n const packageStore = runtimeState.packageRegistry.get(name);\n if (packageStore) {\n for (const reference of packageStore.keys()) {\n if (reference === null) {\n throw new Error(`Assertion failed: This reference shouldn't be null`);\n }\n else {\n fallbackLocators.push({ name, reference });\n }\n }\n }\n }\n }\n /**\n * The setup code will be injected here. The tables listed below are guaranteed to be filled after the call to\n * the $$DYNAMICALLY_GENERATED_CODE function.\n */\n const { ignorePattern, packageRegistry, packageLocatorsByLocations, packageLocationLengths, } = runtimeState;\n /**\n * Allows to print useful logs just be setting a value in the environment\n */\n function makeLogEntry(name, args) {\n return {\n fn: name,\n args: args,\n error: null,\n result: null,\n };\n }\n function maybeLog(name, fn) {\n if (opts.allowDebug === false)\n return fn;\n const level = Number(process.env.PNP_DEBUG_LEVEL);\n if (Number.isFinite(level)) {\n if (level >= 2) {\n return (...args) => {\n const logEntry = makeLogEntry(name, args);\n try {\n return logEntry.result = fn(...args);\n }\n catch (error) {\n throw logEntry.error = error;\n }\n finally {\n console.error(logEntry);\n }\n };\n }\n else if (level >= 1) {\n return (...args) => {\n try {\n return fn(...args);\n }\n catch (error) {\n const logEntry = makeLogEntry(name, args);\n logEntry.error = error;\n console.error(logEntry);\n throw error;\n }\n };\n }\n }\n return fn;\n }\n /**\n * Returns information about a package in a safe way (will throw if they cannot be retrieved)\n */\n function getPackageInformationSafe(packageLocator) {\n const packageInformation = getPackageInformation(packageLocator);\n if (!packageInformation) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.INTERNAL, `Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)`);\n }\n return packageInformation;\n }\n /**\n * Implements the node resolution for folder access and extension selection\n */\n function applyNodeExtensionResolution(unqualifiedPath, candidates, { extensions }) {\n // We use this \"infinite while\" so that we can restart the process as long as we hit package folders\n while (true) {\n let stat;\n try {\n candidates.push(unqualifiedPath);\n stat = opts.fakeFs.statSync(unqualifiedPath);\n }\n catch (error) { }\n // If the file exists and is a file, we can stop right there\n if (stat && !stat.isDirectory()) {\n // If the very last component of the resolved path is a symlink to a file, we then resolve it to a file. We only\n // do this first the last component, and not the rest of the path! This allows us to support the case of bin\n // symlinks, where a symlink in \"/xyz/pkg-name/.bin/bin-name\" will point somewhere else (like \"/xyz/pkg-name/index.js\").\n // In such a case, we want relative requires to be resolved relative to \"/xyz/pkg-name/\" rather than \"/xyz/pkg-name/.bin/\".\n //\n // Also note that the reason we must use readlink on the last component (instead of realpath on the whole path)\n // is that we must preserve the other symlinks, in particular those used by pnp to deambiguate packages using\n // peer dependencies. For example, \"/xyz/.pnp/local/pnp-01234569/.bin/bin-name\" should see its relative requires\n // be resolved relative to \"/xyz/.pnp/local/pnp-0123456789/\" rather than \"/xyz/pkg-with-peers/\", because otherwise\n // we would lose the information that would tell us what are the dependencies of pkg-with-peers relative to its\n // ancestors.\n if (opts.fakeFs.lstatSync(unqualifiedPath).isSymbolicLink())\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(fslib_2.ppath.dirname(unqualifiedPath), opts.fakeFs.readlinkSync(unqualifiedPath)));\n return unqualifiedPath;\n }\n // If the file is a directory, we must check if it contains a package.json with a \"main\" entry\n if (stat && stat.isDirectory()) {\n let pkgJson;\n try {\n pkgJson = JSON.parse(opts.fakeFs.readFileSync(fslib_2.ppath.join(unqualifiedPath, fslib_2.toFilename(`package.json`)), `utf8`));\n }\n catch (error) { }\n let nextUnqualifiedPath;\n if (pkgJson && pkgJson.main)\n nextUnqualifiedPath = fslib_2.ppath.resolve(unqualifiedPath, pkgJson.main);\n // If the \"main\" field changed the path, we start again from this new location\n if (nextUnqualifiedPath && nextUnqualifiedPath !== unqualifiedPath) {\n const resolution = applyNodeExtensionResolution(nextUnqualifiedPath, candidates, { extensions });\n if (resolution !== null) {\n return resolution;\n }\n }\n }\n // Otherwise we check if we find a file that match one of the supported extensions\n const qualifiedPath = extensions\n .map(extension => {\n return `${unqualifiedPath}${extension}`;\n })\n .find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (qualifiedPath)\n return qualifiedPath;\n // Otherwise, we check if the path is a folder - in such a case, we try to use its index\n if (stat && stat.isDirectory()) {\n const indexPath = extensions\n .map(extension => {\n return fslib_2.ppath.format({ dir: unqualifiedPath, name: fslib_2.toFilename(`index`), ext: extension });\n })\n .find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (indexPath) {\n return indexPath;\n }\n }\n // Otherwise there's nothing else we can do :(\n return null;\n }\n }\n /**\n * This function creates fake modules that can be used with the _resolveFilename function.\n * Ideally it would be nice to be able to avoid this, since it causes useless allocations\n * and cannot be cached efficiently (we recompute the nodeModulePaths every time).\n *\n * Fortunately, this should only affect the fallback, and there hopefully shouldn't have a\n * lot of them.\n */\n function makeFakeModule(path) {\n // @ts-ignore\n const fakeModule = new module_1.default(path, null);\n fakeModule.filename = path;\n fakeModule.paths = module_1.default._nodeModulePaths(path);\n return fakeModule;\n }\n /**\n * Normalize path to posix format.\n */\n function normalizePath(p) {\n return fslib_1.NodeFS.toPortablePath(p);\n }\n /**\n * Forward the resolution to the next resolver (usually the native one)\n */\n function callNativeResolution(request, issuer) {\n if (issuer.endsWith(`/`))\n issuer = fslib_2.ppath.join(issuer, fslib_2.toFilename(`internal.js`));\n // Since we would need to create a fake module anyway (to call _resolveLookupPath that\n // would give us the paths to give to _resolveFilename), we can as well not use\n // the {paths} option at all, since it internally makes _resolveFilename create another\n // fake module anyway.\n return module_1.default._resolveFilename(request, makeFakeModule(fslib_1.NodeFS.fromPortablePath(issuer)), false, { plugnplay: false });\n }\n /**\n * This key indicates which version of the standard is implemented by this resolver. The `std` key is the\n * Plug'n'Play standard, and any other key are third-party extensions. Third-party extensions are not allowed\n * to override the standard, and can only offer new methods.\n *\n * If an new version of the Plug'n'Play standard is released and some extensions conflict with newly added\n * functions, they'll just have to fix the conflicts and bump their own version number.\n */\n const VERSIONS = { std: 2 };\n /**\n * We export a special symbol for easy access to the top level locator.\n */\n const topLevel = topLevelLocator;\n /**\n * Gets the package information for a given locator. Returns null if they cannot be retrieved.\n */\n function getPackageInformation({ name, reference }) {\n const packageInformationStore = packageRegistry.get(name);\n if (!packageInformationStore)\n return null;\n const packageInformation = packageInformationStore.get(reference);\n if (!packageInformation)\n return null;\n return packageInformation;\n }\n /**\n * Finds the package locator that owns the specified path. If none is found, returns null instead.\n */\n function findPackageLocator(location) {\n let relativeLocation = normalizePath(fslib_2.ppath.relative(runtimeState.basePath, location));\n if (!relativeLocation.match(isStrictRegExp))\n relativeLocation = `./${relativeLocation}`;\n if (location.match(isDirRegExp) && !relativeLocation.endsWith(`/`))\n relativeLocation = `${relativeLocation}/`;\n let from = 0;\n // If someone wants to use a binary search to go from O(n) to O(log n), be my guest\n while (from < packageLocationLengths.length && packageLocationLengths[from] > relativeLocation.length)\n from += 1;\n for (let t = from; t < packageLocationLengths.length; ++t) {\n const locator = packageLocatorsByLocations.get(relativeLocation.substr(0, packageLocationLengths[t]));\n if (typeof locator === `undefined`)\n continue;\n // Ensures that the returned locator isn't a blacklisted one.\n //\n // Blacklisted packages are packages that cannot be used because their dependencies cannot be deduced. This only\n // happens with peer dependencies, which effectively have different sets of dependencies depending on their\n // parents.\n //\n // In order to deambiguate those different sets of dependencies, the Yarn implementation of PnP will generate a\n // symlink for each combination of // it will find, and will\n // blacklist the target of those symlinks. By doing this, we ensure that files loaded through a specific path\n // will always have the same set of dependencies, provided the symlinks are correctly preserved.\n //\n // Unfortunately, some tools do not preserve them, and when it happens PnP isn't able anymore to deduce the set of\n // dependencies based on the path of the file that makes the require calls. But since we've blacklisted those\n // paths, we're able to print a more helpful error message that points out that a third-party package is doing\n // something incompatible!\n if (locator === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BLACKLISTED, `A forbidden path has been used in the package resolution process - this is usually caused by one of your tools calling 'fs.realpath' on the return value of 'require.resolve'. Since we need to use symlinks to simultaneously provide valid filesystem paths and disambiguate peer dependencies, they must be passed untransformed to 'require'.\\n\\nForbidden path: ${location}`, { location });\n }\n return locator;\n }\n return null;\n }\n /**\n * Transforms a request (what's typically passed as argument to the require function) into an unqualified path.\n * This path is called \"unqualified\" because it only changes the package name to the package location on the disk,\n * which means that the end result still cannot be directly accessed (for example, it doesn't try to resolve the\n * file extension, or to resolve directories to their \"index.js\" content). Use the \"resolveUnqualified\" function\n * to convert them to fully-qualified paths, or just use \"resolveRequest\" that do both operations in one go.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n function resolveToUnqualified(request, issuer, { considerBuiltins = true } = {}) {\n // The 'pnpapi' request is reserved and will always return the path to the PnP file, from everywhere\n if (request === `pnpapi`)\n return fslib_1.NodeFS.toPortablePath(opts.pnpapiResolution);\n // Bailout if the request is a native module\n if (considerBuiltins && builtinModules.has(request))\n return null;\n // We allow disabling the pnp resolution for some subpaths. This is because some projects, often legacy,\n // contain multiple levels of dependencies (ie. a yarn.lock inside a subfolder of a yarn.lock). This is\n // typically solved using workspaces, but not all of them have been converted already.\n if (ignorePattern && issuer && ignorePattern.test(normalizePath(issuer))) {\n const result = callNativeResolution(request, issuer);\n if (result === false) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp)\\n\\nRequire request: \"${request}\"\\nRequired by: ${issuer}\\n`, { request, issuer });\n }\n return fslib_1.NodeFS.toPortablePath(result);\n }\n let unqualifiedPath;\n // If the request is a relative or absolute path, we just return it normalized\n const dependencyNameMatch = request.match(pathRegExp);\n if (!dependencyNameMatch) {\n if (fslib_2.ppath.isAbsolute(request)) {\n unqualifiedPath = fslib_2.ppath.normalize(request);\n }\n else {\n if (!issuer) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, { request, issuer });\n }\n if (issuer.match(isDirRegExp)) {\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(issuer, request));\n }\n else {\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(fslib_2.ppath.dirname(issuer), request));\n }\n }\n // No need to use the return value; we just want to check the blacklist status\n findPackageLocator(unqualifiedPath);\n }\n // Things are more hairy if it's a package require - we then need to figure out which package is needed, and in\n // particular the exact version for the given location on the dependency tree\n else {\n if (!issuer) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, { request, issuer });\n }\n const [, dependencyName, subPath] = dependencyNameMatch;\n const issuerLocator = findPackageLocator(issuer);\n // If the issuer file doesn't seem to be owned by a package managed through pnp, then we resort to using the next\n // resolution algorithm in the chain, usually the native Node resolution one\n if (!issuerLocator) {\n const result = callNativeResolution(request, issuer);\n if (result === false) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree)\\n\\nRequire path: \"${request}\"\\nRequired by: ${issuer}\\n`, { request, issuer });\n }\n return fslib_1.NodeFS.toPortablePath(result);\n }\n const issuerInformation = getPackageInformationSafe(issuerLocator);\n // We obtain the dependency reference in regard to the package that request it\n let dependencyReference = issuerInformation.packageDependencies.get(dependencyName);\n // If we can't find it, we check if we can potentially load it from the packages that have been defined as potential fallbacks.\n // It's a bit of a hack, but it improves compatibility with the existing Node ecosystem. Hopefully we should eventually be able\n // to kill this logic and become stricter once pnp gets enough traction and the affected packages fix themselves.\n if (issuerLocator.name !== null) {\n // To allow programs to become gradually stricter, starting from the v2 we enforce that workspaces cannot depend on fallbacks.\n // This works by having a list containing all their locators, and checking when a fallback is required whether it's one of them.\n const exclusionEntry = runtimeState.fallbackExclusionList.get(issuerLocator.name);\n const canUseFallbacks = !exclusionEntry || !exclusionEntry.has(issuerLocator.reference);\n if (canUseFallbacks) {\n for (let t = 0, T = fallbackLocators.length; dependencyReference === undefined && t < T; ++t) {\n const fallbackInformation = getPackageInformationSafe(fallbackLocators[t]);\n const fallbackReference = fallbackInformation.packageDependencies.get(dependencyName);\n if (fallbackReference !== null) {\n dependencyReference = fallbackReference;\n }\n }\n }\n }\n // If we can't find the path, and if the package making the request is the top-level, we can offer nicer error messages\n if (dependencyReference === null) {\n if (issuerLocator.name === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_PEER_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a peer dependency; this isn't allowed as the peer dependency cannot be provided by any parent package\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, { request, issuer, dependencyName });\n }\n else {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_PEER_DEPENDENCY, `A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, issuerLocator: Object.assign({}, issuerLocator), dependencyName });\n }\n }\n else if (dependencyReference === undefined) {\n if (issuerLocator.name === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNDECLARED_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, { request, issuer, dependencyName });\n }\n else {\n const candidates = Array.from(issuerInformation.packageDependencies.keys());\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNDECLARED_DEPENDENCY, `A package is trying to access another package without the second one being listed as a dependency of the first one\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, issuerLocator: Object.assign({}, issuerLocator), dependencyName, candidates });\n }\n }\n // We need to check that the package exists on the filesystem, because it might not have been installed\n const dependencyLocator = Array.isArray(dependencyReference)\n ? { name: dependencyReference[0], reference: dependencyReference[1] }\n : { name: dependencyName, reference: dependencyReference };\n const dependencyInformation = getPackageInformationSafe(dependencyLocator);\n if (!dependencyInformation.packageLocation) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_DEPENDENCY, `A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.\\n\\nRequired package: ${dependencyLocator.name}@${dependencyLocator.reference} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, dependencyLocator: Object.assign({}, dependencyLocator) });\n }\n // Now that we know which package we should resolve to, we only have to find out the file location\n const dependencyLocation = fslib_2.ppath.resolve(runtimeState.basePath, dependencyInformation.packageLocation);\n if (subPath) {\n unqualifiedPath = fslib_2.ppath.resolve(dependencyLocation, subPath);\n }\n else {\n unqualifiedPath = dependencyLocation;\n }\n }\n return fslib_2.ppath.normalize(unqualifiedPath);\n }\n ;\n /**\n * Transforms an unqualified path into a qualified path by using the Node resolution algorithm (which automatically\n * appends \".js\" / \".json\", and transforms directory accesses into \"index.js\").\n */\n function resolveUnqualified(unqualifiedPath, { extensions = Object.keys(module_1.default._extensions) } = {}) {\n const candidates = [];\n const qualifiedPath = applyNodeExtensionResolution(unqualifiedPath, candidates, { extensions });\n if (qualifiedPath) {\n return fslib_2.ppath.normalize(qualifiedPath);\n }\n else {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED, `Couldn't find a suitable Node resolution for the specified unqualified path\\n\\nSource path: ${unqualifiedPath}\\n${candidates.map(candidate => `Rejected resolution: ${candidate}\\n`).join(``)}`, { unqualifiedPath });\n }\n }\n ;\n /**\n * Transforms a request into a fully qualified path.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n function resolveRequest(request, issuer, { considerBuiltins, extensions } = {}) {\n let unqualifiedPath = resolveToUnqualified(request, issuer, { considerBuiltins });\n if (unqualifiedPath === null)\n return null;\n try {\n return resolveUnqualified(unqualifiedPath, { extensions });\n }\n catch (resolutionError) {\n if (resolutionError.pnpCode === 'QUALIFIED_PATH_RESOLUTION_FAILED')\n Object.assign(resolutionError.data, { request, issuer });\n throw resolutionError;\n }\n }\n ;\n return {\n VERSIONS,\n topLevel,\n getPackageInformation: (locator) => {\n const info = getPackageInformation(locator);\n if (info === null)\n return null;\n const packageLocation = fslib_1.NodeFS.fromPortablePath(info.packageLocation);\n const nativeInfo = Object.assign({}, info, { packageLocation });\n return nativeInfo;\n },\n findPackageLocator: (path) => {\n return findPackageLocator(fslib_1.NodeFS.toPortablePath(path));\n },\n resolveToUnqualified: maybeLog(`resolveToUnqualified`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? fslib_1.NodeFS.toPortablePath(issuer) : null;\n const resolution = resolveToUnqualified(fslib_1.NodeFS.toPortablePath(request), portableIssuer, opts);\n if (resolution === null)\n return null;\n return fslib_1.NodeFS.fromPortablePath(resolution);\n }),\n resolveUnqualified: maybeLog(`resolveUnqualified`, (unqualifiedPath, opts) => {\n return fslib_1.NodeFS.fromPortablePath(resolveUnqualified(fslib_1.NodeFS.toPortablePath(unqualifiedPath), opts));\n }),\n resolveRequest: maybeLog(`resolveRequest`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? fslib_1.NodeFS.toPortablePath(issuer) : null;\n const resolution = resolveRequest(fslib_1.NodeFS.toPortablePath(request), portableIssuer, opts);\n if (resolution === null)\n return null;\n return fslib_1.NodeFS.fromPortablePath(resolution);\n }),\n };\n}\nexports.makeApi = makeApi;\n\n\n/***/ })\n/******/ ]);"; +module.exports = "module.exports =\n/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 11);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __importDefault(__webpack_require__(4));\nexports.PortablePath = {\n root: `/`,\n dot: `.`,\n};\nexports.npath = path_1.default;\nexports.ppath = path_1.default.posix;\nconst WINDOWS_PATH_REGEXP = /^[a-zA-Z]:.*$/;\nconst PORTABLE_PATH_REGEXP = /^\\/[a-zA-Z]:.*$/;\n// Path should look like \"/N:/berry/scripts/plugin-pack.js\"\n// And transform to \"N:\\berry\\scripts\\plugin-pack.js\"\nfunction fromPortablePath(p) {\n if (process.platform !== 'win32')\n return p;\n return p.match(PORTABLE_PATH_REGEXP) ? p.substring(1).replace(/\\//g, `\\\\`) : p;\n}\nexports.fromPortablePath = fromPortablePath;\n// Path should look like \"N:/berry/scripts/plugin-pack.js\"\n// And transform to \"/N:/berry/scripts/plugin-pack.js\"\nfunction toPortablePath(p) {\n if (process.platform !== 'win32')\n return p;\n return (p.match(WINDOWS_PATH_REGEXP) ? `/${p}` : p).replace(/\\\\/g, `/`);\n}\nexports.toPortablePath = toPortablePath;\nfunction convertPath(targetPathUtils, sourcePath) {\n return (targetPathUtils === exports.npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath));\n}\nexports.convertPath = convertPath;\nfunction toFilename(filename) {\n if (exports.npath.parse(filename).dir !== '' || exports.ppath.parse(filename).dir !== '')\n throw new Error(`Invalid filename: \"${filename}\"`);\n return filename;\n}\nexports.toFilename = toFilename;\n\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst FakeFS_1 = __webpack_require__(6);\nconst path_1 = __webpack_require__(0);\nconst path_2 = __webpack_require__(0);\nclass NodeFS extends FakeFS_1.BasePortableFakeFS {\n constructor(realFs = fs_1.default) {\n super();\n this.realFs = realFs;\n }\n getRealPath() {\n return path_1.PortablePath.root;\n }\n async openPromise(p, flags, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.open(NodeFS.fromPortablePath(p), flags, mode, this.makeCallback(resolve, reject));\n });\n }\n openSync(p, flags, mode) {\n return this.realFs.openSync(NodeFS.fromPortablePath(p), flags, mode);\n }\n async closePromise(fd) {\n await new Promise((resolve, reject) => {\n this.realFs.close(fd, this.makeCallback(resolve, reject));\n });\n }\n closeSync(fd) {\n this.realFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p);\n return this.realFs.createReadStream(realPath, opts);\n }\n createWriteStream(p, opts) {\n const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p);\n return this.realFs.createWriteStream(realPath, opts);\n }\n async realpathPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.realpath(NodeFS.fromPortablePath(p), {}, this.makeCallback(resolve, reject));\n }).then(path => {\n return NodeFS.toPortablePath(path);\n });\n }\n realpathSync(p) {\n return NodeFS.toPortablePath(this.realFs.realpathSync(NodeFS.fromPortablePath(p), {}));\n }\n async existsPromise(p) {\n return await new Promise(resolve => {\n this.realFs.exists(NodeFS.fromPortablePath(p), resolve);\n });\n }\n accessSync(p, mode) {\n return this.realFs.accessSync(NodeFS.fromPortablePath(p), mode);\n }\n async accessPromise(p, mode) {\n return await new Promise((resolve, reject) => {\n this.realFs.access(NodeFS.fromPortablePath(p), mode, this.makeCallback(resolve, reject));\n });\n }\n existsSync(p) {\n return this.realFs.existsSync(NodeFS.fromPortablePath(p));\n }\n async statPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.stat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n statSync(p) {\n return this.realFs.statSync(NodeFS.fromPortablePath(p));\n }\n async lstatPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.lstat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n lstatSync(p) {\n return this.realFs.lstatSync(NodeFS.fromPortablePath(p));\n }\n async chmodPromise(p, mask) {\n return await new Promise((resolve, reject) => {\n this.realFs.chmod(NodeFS.fromPortablePath(p), mask, this.makeCallback(resolve, reject));\n });\n }\n chmodSync(p, mask) {\n return this.realFs.chmodSync(NodeFS.fromPortablePath(p), mask);\n }\n async renamePromise(oldP, newP) {\n return await new Promise((resolve, reject) => {\n this.realFs.rename(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP), this.makeCallback(resolve, reject));\n });\n }\n renameSync(oldP, newP) {\n return this.realFs.renameSync(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP));\n }\n async copyFilePromise(sourceP, destP, flags = 0) {\n return await new Promise((resolve, reject) => {\n this.realFs.copyFile(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags, this.makeCallback(resolve, reject));\n });\n }\n copyFileSync(sourceP, destP, flags = 0) {\n return this.realFs.copyFileSync(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags);\n }\n async writeFilePromise(p, content, opts) {\n return await new Promise((resolve, reject) => {\n if (opts) {\n this.realFs.writeFile(NodeFS.fromPortablePath(p), content, opts, this.makeCallback(resolve, reject));\n }\n else {\n this.realFs.writeFile(NodeFS.fromPortablePath(p), content, this.makeCallback(resolve, reject));\n }\n });\n }\n writeFileSync(p, content, opts) {\n if (opts) {\n this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content, opts);\n }\n else {\n this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content);\n }\n }\n async unlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.unlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n unlinkSync(p) {\n return this.realFs.unlinkSync(NodeFS.fromPortablePath(p));\n }\n async utimesPromise(p, atime, mtime) {\n return await new Promise((resolve, reject) => {\n this.realFs.utimes(NodeFS.fromPortablePath(p), atime, mtime, this.makeCallback(resolve, reject));\n });\n }\n utimesSync(p, atime, mtime) {\n this.realFs.utimesSync(NodeFS.fromPortablePath(p), atime, mtime);\n }\n async mkdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.mkdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n mkdirSync(p) {\n return this.realFs.mkdirSync(NodeFS.fromPortablePath(p));\n }\n async rmdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.rmdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n rmdirSync(p) {\n return this.realFs.rmdirSync(NodeFS.fromPortablePath(p));\n }\n async symlinkPromise(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return await new Promise((resolve, reject) => {\n this.realFs.symlink(NodeFS.fromPortablePath(target.replace(/\\/+$/, ``)), NodeFS.fromPortablePath(p), type, this.makeCallback(resolve, reject));\n });\n }\n symlinkSync(target, p) {\n const type = target.endsWith(`/`) ? `dir` : `file`;\n return this.realFs.symlinkSync(NodeFS.fromPortablePath(target.replace(/\\/+$/, ``)), NodeFS.fromPortablePath(p), type);\n }\n async readFilePromise(p, encoding) {\n return await new Promise((resolve, reject) => {\n this.realFs.readFile(NodeFS.fromPortablePath(p), encoding, this.makeCallback(resolve, reject));\n });\n }\n readFileSync(p, encoding) {\n return this.realFs.readFileSync(NodeFS.fromPortablePath(p), encoding);\n }\n async readdirPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n });\n }\n readdirSync(p) {\n return this.realFs.readdirSync(NodeFS.fromPortablePath(p));\n }\n async readlinkPromise(p) {\n return await new Promise((resolve, reject) => {\n this.realFs.readlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject));\n }).then(path => {\n return NodeFS.toPortablePath(path);\n });\n }\n readlinkSync(p) {\n return NodeFS.toPortablePath(this.realFs.readlinkSync(NodeFS.fromPortablePath(p)));\n }\n watch(p, a, b) {\n return this.realFs.watch(NodeFS.fromPortablePath(p), \n // @ts-ignore\n a, b);\n }\n makeCallback(resolve, reject) {\n return (err, result) => {\n if (err) {\n reject(err);\n }\n else {\n resolve(result);\n }\n };\n }\n static fromPortablePath(p) {\n return path_2.fromPortablePath(p);\n }\n static toPortablePath(p) {\n return path_2.toPortablePath(p);\n }\n}\nexports.NodeFS = NodeFS;\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"fs\");\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst FakeFS_1 = __webpack_require__(6);\nclass ProxiedFS extends FakeFS_1.FakeFS {\n resolve(path) {\n return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path)));\n }\n getRealPath() {\n return this.mapFromBase(this.baseFs.getRealPath());\n }\n openPromise(p, flags, mode) {\n return this.baseFs.openPromise(this.mapToBase(p), flags, mode);\n }\n openSync(p, flags, mode) {\n return this.baseFs.openSync(this.mapToBase(p), flags, mode);\n }\n closePromise(fd) {\n return this.baseFs.closePromise(fd);\n }\n closeSync(fd) {\n this.baseFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n return this.baseFs.createReadStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n createWriteStream(p, opts) {\n return this.baseFs.createWriteStream(p !== null ? this.mapToBase(p) : p, opts);\n }\n async realpathPromise(p) {\n return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(p)));\n }\n realpathSync(p) {\n return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(p)));\n }\n existsPromise(p) {\n return this.baseFs.existsPromise(this.mapToBase(p));\n }\n existsSync(p) {\n return this.baseFs.existsSync(this.mapToBase(p));\n }\n accessSync(p, mode) {\n return this.baseFs.accessSync(this.mapToBase(p), mode);\n }\n accessPromise(p, mode) {\n return this.baseFs.accessPromise(this.mapToBase(p), mode);\n }\n statPromise(p) {\n return this.baseFs.statPromise(this.mapToBase(p));\n }\n statSync(p) {\n return this.baseFs.statSync(this.mapToBase(p));\n }\n lstatPromise(p) {\n return this.baseFs.lstatPromise(this.mapToBase(p));\n }\n lstatSync(p) {\n return this.baseFs.lstatSync(this.mapToBase(p));\n }\n chmodPromise(p, mask) {\n return this.baseFs.chmodPromise(this.mapToBase(p), mask);\n }\n chmodSync(p, mask) {\n return this.baseFs.chmodSync(this.mapToBase(p), mask);\n }\n renamePromise(oldP, newP) {\n return this.baseFs.renamePromise(this.mapToBase(oldP), this.mapToBase(newP));\n }\n renameSync(oldP, newP) {\n return this.baseFs.renameSync(this.mapToBase(oldP), this.mapToBase(newP));\n }\n copyFilePromise(sourceP, destP, flags = 0) {\n return this.baseFs.copyFilePromise(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n copyFileSync(sourceP, destP, flags = 0) {\n return this.baseFs.copyFileSync(this.mapToBase(sourceP), this.mapToBase(destP), flags);\n }\n writeFilePromise(p, content, opts) {\n return this.baseFs.writeFilePromise(this.mapToBase(p), content, opts);\n }\n writeFileSync(p, content, opts) {\n return this.baseFs.writeFileSync(this.mapToBase(p), content, opts);\n }\n unlinkPromise(p) {\n return this.baseFs.unlinkPromise(this.mapToBase(p));\n }\n unlinkSync(p) {\n return this.baseFs.unlinkSync(this.mapToBase(p));\n }\n utimesPromise(p, atime, mtime) {\n return this.baseFs.utimesPromise(this.mapToBase(p), atime, mtime);\n }\n utimesSync(p, atime, mtime) {\n return this.baseFs.utimesSync(this.mapToBase(p), atime, mtime);\n }\n mkdirPromise(p) {\n return this.baseFs.mkdirPromise(this.mapToBase(p));\n }\n mkdirSync(p) {\n return this.baseFs.mkdirSync(this.mapToBase(p));\n }\n rmdirPromise(p) {\n return this.baseFs.rmdirPromise(this.mapToBase(p));\n }\n rmdirSync(p) {\n return this.baseFs.rmdirSync(this.mapToBase(p));\n }\n symlinkPromise(target, p) {\n return this.baseFs.symlinkPromise(this.mapToBase(target), this.mapToBase(p));\n }\n symlinkSync(target, p) {\n return this.baseFs.symlinkSync(this.mapToBase(target), this.mapToBase(p));\n }\n readFilePromise(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFilePromise(this.mapToBase(p), encoding);\n }\n else {\n return this.baseFs.readFilePromise(this.mapToBase(p), encoding);\n }\n }\n readFileSync(p, encoding) {\n // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n if (encoding === 'utf8') {\n return this.baseFs.readFileSync(this.mapToBase(p), encoding);\n }\n else {\n return this.baseFs.readFileSync(this.mapToBase(p), encoding);\n }\n }\n readdirPromise(p) {\n return this.baseFs.readdirPromise(this.mapToBase(p));\n }\n readdirSync(p) {\n return this.baseFs.readdirSync(this.mapToBase(p));\n }\n async readlinkPromise(p) {\n return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(p)));\n }\n readlinkSync(p) {\n return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(p)));\n }\n watch(p, a, b) {\n return this.baseFs.watch(this.mapToBase(p), \n // @ts-ignore\n a, b);\n }\n}\nexports.ProxiedFS = ProxiedFS;\n\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"path\");\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst tmp_1 = __importDefault(__webpack_require__(12));\nconst NodeFS_1 = __webpack_require__(1);\nvar path_1 = __webpack_require__(0);\nexports.PortablePath = path_1.PortablePath;\nvar path_2 = __webpack_require__(0);\nexports.npath = path_2.npath;\nexports.ppath = path_2.ppath;\nexports.toFilename = path_2.toFilename;\nvar AliasFS_1 = __webpack_require__(14);\nexports.AliasFS = AliasFS_1.AliasFS;\nvar FakeFS_1 = __webpack_require__(6);\nexports.FakeFS = FakeFS_1.FakeFS;\nvar CwdFS_1 = __webpack_require__(15);\nexports.CwdFS = CwdFS_1.CwdFS;\nvar JailFS_1 = __webpack_require__(16);\nexports.JailFS = JailFS_1.JailFS;\nvar LazyFS_1 = __webpack_require__(17);\nexports.LazyFS = LazyFS_1.LazyFS;\nvar NodeFS_2 = __webpack_require__(1);\nexports.NodeFS = NodeFS_2.NodeFS;\nvar PosixFS_1 = __webpack_require__(18);\nexports.PosixFS = PosixFS_1.PosixFS;\nvar ProxiedFS_1 = __webpack_require__(3);\nexports.ProxiedFS = ProxiedFS_1.ProxiedFS;\nvar VirtualFS_1 = __webpack_require__(19);\nexports.VirtualFS = VirtualFS_1.VirtualFS;\nvar ZipFS_1 = __webpack_require__(9);\nexports.ZipFS = ZipFS_1.ZipFS;\nvar ZipOpenFS_1 = __webpack_require__(24);\nexports.ZipOpenFS = ZipOpenFS_1.ZipOpenFS;\nfunction patchFs(patchedFs, fakeFs) {\n const SYNC_IMPLEMENTATIONS = new Set([\n `accessSync`,\n `createReadStream`,\n `chmodSync`,\n `copyFileSync`,\n `lstatSync`,\n `openSync`,\n `readlinkSync`,\n `readFileSync`,\n `readdirSync`,\n `readlinkSync`,\n `realpathSync`,\n `rmdirSync`,\n `statSync`,\n `symlinkSync`,\n `unlinkSync`,\n `utimesSync`,\n `watch`,\n `writeFileSync`,\n ]);\n const ASYNC_IMPLEMENTATIONS = new Set([\n `accessPromise`,\n `chmodPromise`,\n `copyFilePromise`,\n `lstatPromise`,\n `openPromise`,\n `readdirPromise`,\n `realpathPromise`,\n `readFilePromise`,\n `readdirPromise`,\n `readlinkPromise`,\n `rmdirPromise`,\n `statPromise`,\n `symlinkPromise`,\n `unlinkPromise`,\n `utimesPromise`,\n `writeFilePromise`,\n ]);\n patchedFs.existsSync = (p) => {\n try {\n return fakeFs.existsSync(p);\n }\n catch (error) {\n return false;\n }\n };\n patchedFs.exists = (p, callback) => {\n fakeFs.existsPromise(p).then(result => {\n if (callback) {\n callback(result);\n }\n }, () => {\n if (callback) {\n callback(false);\n }\n });\n };\n for (const fnName of ASYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName.replace(/Promise$/, ``);\n patchedFs[origName] = (...args) => {\n const hasCallback = typeof args[args.length - 1] === `function`;\n const callback = hasCallback ? args.pop() : () => { };\n fakeImpl(...args).then((result) => {\n callback(undefined, result);\n }, (error) => {\n callback(error);\n });\n };\n }\n for (const fnName of SYNC_IMPLEMENTATIONS) {\n const fakeImpl = fakeFs[fnName].bind(fakeFs);\n const origName = fnName;\n patchedFs[origName] = fakeImpl;\n }\n patchedFs.realpathSync.native = patchedFs.realpathSync;\n patchedFs.realpath.native = patchedFs.realpath;\n}\nexports.patchFs = patchFs;\nfunction extendFs(realFs, fakeFs) {\n const patchedFs = Object.create(realFs);\n patchFs(patchedFs, fakeFs);\n return patchedFs;\n}\nexports.extendFs = extendFs;\nexports.xfs = Object.assign(new NodeFS_1.NodeFS(), {\n mktempSync(cb) {\n const { name, removeCallback } = tmp_1.default.dirSync({ unsafeCleanup: true });\n if (typeof cb === `undefined`) {\n return NodeFS_1.NodeFS.toPortablePath(name);\n }\n else {\n try {\n return cb(NodeFS_1.NodeFS.toPortablePath(name));\n }\n finally {\n removeCallback();\n }\n }\n },\n mktempPromise(cb) {\n if (typeof cb === `undefined`) {\n return new Promise((resolve, reject) => {\n tmp_1.default.dir({ unsafeCleanup: true }, (err, path) => {\n if (err) {\n reject(err);\n }\n else {\n resolve(NodeFS_1.NodeFS.toPortablePath(path));\n }\n });\n });\n }\n else {\n return new Promise((resolve, reject) => {\n tmp_1.default.dir({ unsafeCleanup: true }, (err, path, cleanup) => {\n if (err) {\n reject(err);\n }\n else {\n Promise.resolve(NodeFS_1.NodeFS.toPortablePath(path)).then(cb).then(result => {\n cleanup();\n resolve(result);\n }, error => {\n cleanup();\n reject(error);\n });\n }\n });\n });\n }\n },\n});\n\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst path_1 = __webpack_require__(0);\nconst path_2 = __webpack_require__(0);\nclass FakeFS {\n constructor(pathUtils) {\n this.pathUtils = pathUtils;\n }\n async removePromise(p) {\n let stat;\n try {\n stat = await this.lstatPromise(p);\n }\n catch (error) {\n if (error.code === `ENOENT`) {\n return;\n }\n else {\n throw error;\n }\n }\n if (stat.isDirectory()) {\n for (const entry of await this.readdirPromise(p))\n await this.removePromise(this.pathUtils.resolve(p, entry));\n // 5 gives 1s worth of retries at worst\n for (let t = 0; t < 5; ++t) {\n try {\n await this.rmdirPromise(p);\n break;\n }\n catch (error) {\n if (error.code === `EBUSY` || error.code === `ENOTEMPTY`) {\n await new Promise(resolve => setTimeout(resolve, t * 100));\n continue;\n }\n else {\n throw error;\n }\n }\n }\n }\n else {\n await this.unlinkPromise(p);\n }\n }\n removeSync(p) {\n let stat;\n try {\n stat = this.lstatSync(p);\n }\n catch (error) {\n if (error.code === `ENOENT`) {\n return;\n }\n else {\n throw error;\n }\n }\n if (stat.isDirectory()) {\n for (const entry of this.readdirSync(p))\n this.removeSync(this.pathUtils.resolve(p, entry));\n this.rmdirSync(p);\n }\n else {\n this.unlinkSync(p);\n }\n }\n async mkdirpPromise(p, { chmod, utimes } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p))\n return;\n const parts = p.split(this.pathUtils.sep);\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n if (!this.existsSync(subPath)) {\n try {\n await this.mkdirPromise(subPath);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n }\n else {\n throw error;\n }\n }\n if (chmod != null)\n await this.chmodPromise(subPath, chmod);\n if (utimes != null) {\n await this.utimesPromise(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n mkdirpSync(p, { chmod, utimes } = {}) {\n p = this.resolve(p);\n if (p === this.pathUtils.dirname(p))\n return;\n const parts = p.split(this.pathUtils.sep);\n for (let u = 2; u <= parts.length; ++u) {\n const subPath = parts.slice(0, u).join(this.pathUtils.sep);\n if (!this.existsSync(subPath)) {\n try {\n this.mkdirSync(subPath);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n continue;\n }\n else {\n throw error;\n }\n }\n if (chmod != null)\n this.chmodSync(subPath, chmod);\n if (utimes != null) {\n this.utimesSync(subPath, utimes[0], utimes[1]);\n }\n }\n }\n }\n async copyPromise(destination, source, { baseFs = this, overwrite = true } = {}) {\n const stat = await baseFs.lstatPromise(source);\n const exists = await this.existsSync(destination);\n if (stat.isDirectory()) {\n await this.mkdirpPromise(destination);\n const directoryListing = await baseFs.readdirPromise(source);\n await Promise.all(directoryListing.map(entry => {\n return this.copyPromise(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });\n }));\n }\n else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists)\n await this.removePromise(destination);\n const content = await baseFs.readFilePromise(source);\n await this.writeFilePromise(destination, content);\n }\n }\n else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists)\n await this.removePromise(destination);\n const target = await baseFs.readlinkPromise(source);\n await this.symlinkPromise(path_2.convertPath(this.pathUtils, target), destination);\n }\n }\n else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n const mode = stat.mode & 0o777;\n await this.chmodPromise(destination, mode);\n }\n copySync(destination, source, { baseFs = this, overwrite = true } = {}) {\n const stat = baseFs.lstatSync(source);\n const exists = this.existsSync(destination);\n if (stat.isDirectory()) {\n this.mkdirpSync(destination);\n const directoryListing = baseFs.readdirSync(source);\n for (const entry of directoryListing) {\n this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite });\n }\n }\n else if (stat.isFile()) {\n if (!exists || overwrite) {\n if (exists)\n this.removeSync(destination);\n const content = baseFs.readFileSync(source);\n this.writeFileSync(destination, content);\n }\n }\n else if (stat.isSymbolicLink()) {\n if (!exists || overwrite) {\n if (exists)\n this.removeSync(destination);\n const target = baseFs.readlinkSync(source);\n this.symlinkSync(path_2.convertPath(this.pathUtils, target), destination);\n }\n }\n else {\n throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`);\n }\n const mode = stat.mode & 0o777;\n this.chmodSync(destination, mode);\n }\n async changeFilePromise(p, content) {\n try {\n const current = await this.readFilePromise(p, `utf8`);\n if (current === content) {\n return;\n }\n }\n catch (error) {\n // ignore errors, no big deal\n }\n await this.writeFilePromise(p, content);\n }\n changeFileSync(p, content) {\n try {\n const current = this.readFileSync(p, `utf8`);\n if (current === content) {\n return;\n }\n }\n catch (error) {\n // ignore errors, no big deal\n }\n this.writeFileSync(p, content);\n }\n async movePromise(fromP, toP) {\n try {\n await this.renamePromise(fromP, toP);\n }\n catch (error) {\n if (error.code === `EXDEV`) {\n await this.copyPromise(toP, fromP);\n await this.removePromise(fromP);\n }\n else {\n throw error;\n }\n }\n }\n moveSync(fromP, toP) {\n try {\n this.renameSync(fromP, toP);\n }\n catch (error) {\n if (error.code === `EXDEV`) {\n this.copySync(toP, fromP);\n this.removeSync(fromP);\n }\n else {\n throw error;\n }\n }\n }\n async lockPromise(affectedPath, callback) {\n const lockPath = `${affectedPath}.lock`;\n const interval = 1000 / 60;\n const timeout = Date.now() + 60 * 1000;\n let fd = null;\n while (fd === null) {\n try {\n fd = await this.openPromise(lockPath, `wx`);\n }\n catch (error) {\n if (error.code === `EEXIST`) {\n if (Date.now() < timeout) {\n await new Promise(resolve => setTimeout(resolve, interval));\n }\n else {\n throw new Error(`Couldn't acquire a lock in a reasonable time (via ${lockPath})`);\n }\n }\n else {\n throw error;\n }\n }\n }\n try {\n return await callback();\n }\n finally {\n await this.closePromise(fd);\n await this.unlinkPromise(lockPath);\n }\n }\n}\nexports.FakeFS = FakeFS;\n;\nclass BasePortableFakeFS extends FakeFS {\n constructor() {\n super(path_2.ppath);\n }\n resolve(p) {\n return this.pathUtils.resolve(path_1.PortablePath.root, p);\n }\n}\nexports.BasePortableFakeFS = BasePortableFakeFS;\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"module\");\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"crypto\");\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst libzip_1 = __importDefault(__webpack_require__(20));\nconst fs_1 = __webpack_require__(2);\nconst stream_1 = __webpack_require__(22);\nconst util_1 = __webpack_require__(23);\nconst FakeFS_1 = __webpack_require__(6);\nconst NodeFS_1 = __webpack_require__(1);\nconst path_1 = __webpack_require__(0);\nconst S_IFMT = 0o170000;\nconst S_IFDIR = 0o040000;\nconst S_IFREG = 0o100000;\nconst S_IFLNK = 0o120000;\nclass StatEntry {\n constructor() {\n this.dev = 0;\n this.ino = 0;\n this.mode = 0;\n this.nlink = 1;\n this.rdev = 0;\n this.blocks = 1;\n }\n isBlockDevice() {\n return false;\n }\n isCharacterDevice() {\n return false;\n }\n isDirectory() {\n return (this.mode & S_IFMT) === S_IFDIR;\n }\n isFIFO() {\n return false;\n }\n isFile() {\n return (this.mode & S_IFMT) === S_IFREG;\n }\n isSocket() {\n return false;\n }\n isSymbolicLink() {\n return (this.mode & S_IFMT) === S_IFLNK;\n }\n}\nfunction makeDefaultStats() {\n return Object.assign(new StatEntry(), {\n uid: 0,\n gid: 0,\n size: 0,\n blksize: 0,\n atimeMs: 0,\n mtimeMs: 0,\n ctimeMs: 0,\n birthtimeMs: 0,\n atime: new Date(0),\n mtime: new Date(0),\n ctime: new Date(0),\n birthtime: new Date(0),\n mode: S_IFREG | 0o644,\n });\n}\nfunction toUnixTimestamp(time) {\n if (typeof time === 'string' && String(+time) === time)\n return +time;\n // @ts-ignore\n if (Number.isFinite(time)) {\n if (time < 0) {\n return Date.now() / 1000;\n }\n else {\n return time;\n }\n }\n // convert to 123.456 UNIX timestamp\n if (util_1.isDate(time))\n return time.getTime() / 1000;\n throw new Error(`Invalid time`);\n}\nclass ZipFS extends FakeFS_1.BasePortableFakeFS {\n constructor(source, opts) {\n super();\n this.listings = new Map();\n this.entries = new Map();\n this.ready = false;\n const pathOptions = opts;\n if (typeof source === `string`) {\n const { baseFs = new NodeFS_1.NodeFS() } = pathOptions;\n this.baseFs = baseFs;\n this.path = source;\n }\n else {\n this.path = null;\n this.baseFs = null;\n }\n if (opts.stats) {\n this.stats = opts.stats;\n }\n else {\n if (typeof source === `string`) {\n try {\n this.stats = this.baseFs.statSync(source);\n }\n catch (error) {\n if (error.code === `ENOENT` && pathOptions.create) {\n this.stats = makeDefaultStats();\n }\n else {\n throw error;\n }\n }\n }\n else {\n this.stats = makeDefaultStats();\n }\n }\n const errPtr = libzip_1.default.malloc(4);\n try {\n let flags = 0;\n if (typeof source === `string` && pathOptions.create)\n flags |= libzip_1.default.ZIP_CREATE | libzip_1.default.ZIP_TRUNCATE;\n if (opts.readOnly)\n flags |= libzip_1.default.ZIP_RDONLY;\n if (typeof source === `string`) {\n this.zip = libzip_1.default.open(NodeFS_1.NodeFS.fromPortablePath(source), flags, errPtr);\n }\n else {\n const lzSource = this.allocateUnattachedSource(source);\n try {\n this.zip = libzip_1.default.openFromSource(lzSource, flags, errPtr);\n }\n catch (error) {\n libzip_1.default.source.free(lzSource);\n throw error;\n }\n }\n if (this.zip === 0) {\n const error = libzip_1.default.struct.errorS();\n libzip_1.default.error.initWithCode(error, libzip_1.default.getValue(errPtr, `i32`));\n throw new Error(libzip_1.default.error.strerror(error));\n }\n }\n finally {\n libzip_1.default.free(errPtr);\n }\n this.listings.set(path_1.PortablePath.root, new Set());\n const entryCount = libzip_1.default.getNumEntries(this.zip, 0);\n for (let t = 0; t < entryCount; ++t) {\n const raw = libzip_1.default.getName(this.zip, t, 0);\n if (path_1.ppath.isAbsolute(raw))\n continue;\n const p = path_1.ppath.resolve(path_1.PortablePath.root, raw);\n this.registerEntry(p, t);\n // If the raw path is a directory, register it\n // to prevent empty folder being skipped\n if (raw.endsWith('/')) {\n this.registerListing(p);\n }\n }\n this.ready = true;\n }\n getAllFiles() {\n return Array.from(this.entries.keys());\n }\n getRealPath() {\n if (!this.path)\n throw new Error(`ZipFS don't have real paths when loaded from a buffer`);\n return this.path;\n }\n saveAndClose() {\n if (!this.path || !this.baseFs)\n throw new Error(`ZipFS cannot be saved and must be discarded when loaded from a buffer`);\n if (!this.ready)\n throw Object.assign(new Error(`EBUSY: archive closed, close`), { code: `EBUSY` });\n const previousMod = this.baseFs.existsSync(this.path)\n ? this.baseFs.statSync(this.path).mode & 0o777\n : null;\n const rc = libzip_1.default.close(this.zip);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n // Libzip overrides the chmod when writing the archive, which is a weird\n // behavior I don't totally understand (plus the umask seems bogus in some\n // weird cases - maybe related to emscripten?)\n //\n // See also https://github.com/nih-at/libzip/issues/77\n if (previousMod !== null && previousMod !== (this.baseFs.statSync(this.path).mode & 0o777))\n this.baseFs.chmodSync(this.path, previousMod);\n this.ready = false;\n }\n discardAndClose() {\n libzip_1.default.discard(this.zip);\n this.ready = false;\n }\n async openPromise(p, flags, mode) {\n return this.openSync(p, flags, mode);\n }\n openSync(p, flags, mode) {\n throw new Error(`Unimplemented`);\n }\n async closePromise(fd) {\n this.closeSync(fd);\n }\n closeSync(fd) {\n throw new Error(`Unimplemented`);\n }\n createReadStream(p, { encoding } = {}) {\n if (p === null)\n throw new Error(`Unimplemented`);\n const stream = Object.assign(new stream_1.PassThrough(), {\n bytesRead: 0,\n path: p,\n close: () => {\n clearImmediate(immediate);\n },\n });\n const immediate = setImmediate(() => {\n try {\n const data = this.readFileSync(p, encoding);\n stream.bytesRead = data.length;\n stream.write(data);\n stream.end();\n }\n catch (error) {\n stream.emit(`error`, error);\n stream.end();\n }\n });\n return stream;\n }\n createWriteStream(p, { encoding } = {}) {\n if (p === null)\n throw new Error(`Unimplemented`);\n const stream = Object.assign(new stream_1.PassThrough(), {\n bytesWritten: 0,\n path: p,\n close: () => {\n stream.end();\n },\n });\n const chunks = [];\n stream.on(`data`, chunk => {\n const chunkBuffer = Buffer.from(chunk);\n stream.bytesWritten += chunkBuffer.length;\n chunks.push(chunkBuffer);\n });\n stream.on(`end`, () => {\n this.writeFileSync(p, Buffer.concat(chunks), encoding);\n });\n return stream;\n }\n async realpathPromise(p) {\n return this.realpathSync(p);\n }\n realpathSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, lstat '${p}'`), { code: `ENOENT` });\n return resolvedP;\n }\n async existsPromise(p) {\n return this.existsSync(p);\n }\n existsSync(p) {\n let resolvedP;\n try {\n resolvedP = this.resolveFilename(`stat '${p}'`, p);\n }\n catch (error) {\n return false;\n }\n return this.entries.has(resolvedP) || this.listings.has(resolvedP);\n }\n async accessPromise(p, mode) {\n return this.accessSync(p, mode);\n }\n accessSync(p, mode) {\n const resolvedP = this.resolveFilename(`access '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP)) {\n throw Object.assign(new Error(`ENOENT: no such file or directory, access '${p}'`), { code: `ENOENT` });\n }\n }\n async statPromise(p) {\n return this.statSync(p);\n }\n statSync(p) {\n const resolvedP = this.resolveFilename(`stat '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, stat '${p}'`), { code: `ENOENT` });\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, stat '${p}'`), { code: `ENOTDIR` });\n return this.statImpl(`stat '${p}'`, resolvedP);\n }\n async lstatPromise(p) {\n return this.lstatSync(p);\n }\n lstatSync(p) {\n const resolvedP = this.resolveFilename(`lstat '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, lstat '${p}'`), { code: `ENOENT` });\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, lstat '${p}'`), { code: `ENOTDIR` });\n return this.statImpl(`lstat '${p}'`, resolvedP);\n }\n statImpl(reason, p) {\n if (this.listings.has(p)) {\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = 0;\n const blksize = 512;\n const blocks = 0;\n const atimeMs = this.stats.mtimeMs;\n const birthtimeMs = this.stats.mtimeMs;\n const ctimeMs = this.stats.mtimeMs;\n const mtimeMs = this.stats.mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = S_IFDIR | 0o755;\n return Object.assign(new StatEntry(), { uid, gid, size, blksize, blocks, atime, birthtime, ctime, mtime, atimeMs, birthtimeMs, ctimeMs, mtimeMs, mode });\n }\n const entry = this.entries.get(p);\n if (entry !== undefined) {\n const stat = libzip_1.default.struct.statS();\n const rc = libzip_1.default.statIndex(this.zip, entry, 0, 0, stat);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const uid = this.stats.uid;\n const gid = this.stats.gid;\n const size = (libzip_1.default.struct.statSize(stat) >>> 0);\n const blksize = 512;\n const blocks = Math.ceil(size / blksize);\n const mtimeMs = (libzip_1.default.struct.statMtime(stat) >>> 0) * 1000;\n const atimeMs = mtimeMs;\n const birthtimeMs = mtimeMs;\n const ctimeMs = mtimeMs;\n const atime = new Date(atimeMs);\n const birthtime = new Date(birthtimeMs);\n const ctime = new Date(ctimeMs);\n const mtime = new Date(mtimeMs);\n const mode = this.getUnixMode(entry, S_IFREG | 0o644);\n return Object.assign(new StatEntry(), { uid, gid, size, blksize, blocks, atime, birthtime, ctime, mtime, atimeMs, birthtimeMs, ctimeMs, mtimeMs, mode });\n }\n throw new Error(`Unreachable`);\n }\n getUnixMode(index, defaultMode) {\n const rc = libzip_1.default.file.getExternalAttributes(this.zip, index, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n return defaultMode;\n return libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n }\n registerListing(p) {\n let listing = this.listings.get(p);\n if (listing)\n return listing;\n const parentListing = this.registerListing(path_1.ppath.dirname(p));\n listing = new Set();\n parentListing.add(path_1.ppath.basename(p));\n this.listings.set(p, listing);\n return listing;\n }\n registerEntry(p, index) {\n const parentListing = this.registerListing(path_1.ppath.dirname(p));\n parentListing.add(path_1.ppath.basename(p));\n this.entries.set(p, index);\n }\n resolveFilename(reason, p, resolveLastComponent = true) {\n if (!this.ready)\n throw Object.assign(new Error(`EBUSY: archive closed, ${reason}`), { code: `EBUSY` });\n let resolvedP = path_1.ppath.resolve(path_1.PortablePath.root, p);\n if (resolvedP === `/`)\n return path_1.PortablePath.root;\n while (true) {\n const parentP = this.resolveFilename(reason, path_1.ppath.dirname(resolvedP), true);\n const isDir = this.listings.has(parentP);\n const doesExist = this.entries.has(parentP);\n if (!isDir && !doesExist)\n throw Object.assign(new Error(`ENOENT: no such file or directory, ${reason}`), { code: `ENOENT` });\n if (!isDir)\n throw Object.assign(new Error(`ENOTDIR: not a directory, ${reason}`), { code: `ENOTDIR` });\n resolvedP = path_1.ppath.resolve(parentP, path_1.ppath.basename(resolvedP));\n if (!resolveLastComponent)\n break;\n const index = libzip_1.default.name.locate(this.zip, resolvedP);\n if (index === -1)\n break;\n if (this.isSymbolicLink(index)) {\n const target = this.getFileSource(index).toString();\n resolvedP = path_1.ppath.resolve(path_1.ppath.dirname(resolvedP), target);\n }\n else {\n break;\n }\n }\n return resolvedP;\n }\n allocateBuffer(content) {\n if (!Buffer.isBuffer(content))\n content = Buffer.from(content);\n const buffer = libzip_1.default.malloc(content.byteLength);\n if (!buffer)\n throw new Error(`Couldn't allocate enough memory`);\n // Copy the file into the Emscripten heap\n const heap = new Uint8Array(libzip_1.default.HEAPU8.buffer, buffer, content.byteLength);\n heap.set(content);\n return { buffer, byteLength: content.byteLength };\n }\n allocateUnattachedSource(content) {\n const error = libzip_1.default.struct.errorS();\n const { buffer, byteLength } = this.allocateBuffer(content);\n const source = libzip_1.default.source.fromUnattachedBuffer(buffer, byteLength, 0, true, error);\n if (source === 0) {\n libzip_1.default.free(error);\n throw new Error(libzip_1.default.error.strerror(error));\n }\n return source;\n }\n allocateSource(content) {\n const { buffer, byteLength } = this.allocateBuffer(content);\n const source = libzip_1.default.source.fromBuffer(this.zip, buffer, byteLength, 0, true);\n if (source === 0) {\n libzip_1.default.free(buffer);\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n return source;\n }\n setFileSource(p, content) {\n const target = path_1.ppath.relative(path_1.PortablePath.root, p);\n const lzSource = this.allocateSource(content);\n try {\n return libzip_1.default.file.add(this.zip, target, lzSource, libzip_1.default.ZIP_FL_OVERWRITE);\n }\n catch (error) {\n libzip_1.default.source.free(lzSource);\n throw error;\n }\n }\n isSymbolicLink(index) {\n const attrs = libzip_1.default.file.getExternalAttributes(this.zip, index, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (attrs === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n return false;\n const attributes = libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n return (attributes & S_IFMT) === S_IFLNK;\n }\n getFileSource(index) {\n const stat = libzip_1.default.struct.statS();\n const rc = libzip_1.default.statIndex(this.zip, index, 0, 0, stat);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const size = libzip_1.default.struct.statSize(stat);\n const buffer = libzip_1.default.malloc(size);\n try {\n const file = libzip_1.default.fopenIndex(this.zip, index, 0, 0);\n if (file === 0)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n try {\n const rc = libzip_1.default.fread(file, buffer, size, 0);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.file.getError(file)));\n else if (rc < size)\n throw new Error(`Incomplete read`);\n else if (rc > size)\n throw new Error(`Overread`);\n const memory = libzip_1.default.HEAPU8.subarray(buffer, buffer + size);\n const data = Buffer.from(memory);\n return data;\n }\n finally {\n libzip_1.default.fclose(file);\n }\n }\n finally {\n libzip_1.default.free(buffer);\n }\n }\n async chmodPromise(p, mask) {\n return this.chmodSync(p, mask);\n }\n chmodSync(p, mask) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n // We silently ignore chmod requests for directories\n if (this.listings.has(resolvedP))\n return;\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const oldMod = this.getUnixMode(entry, S_IFREG | 0o000);\n const newMod = oldMod & (~0o777) | mask;\n const rc = libzip_1.default.file.setExternalAttributes(this.zip, entry, 0, 0, libzip_1.default.ZIP_OPSYS_UNIX, newMod << 16);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async renamePromise(oldP, newP) {\n return this.renameSync(oldP, newP);\n }\n renameSync(oldP, newP) {\n throw new Error(`Unimplemented`);\n }\n async copyFilePromise(sourceP, destP, flags) {\n return this.copyFileSync(sourceP, destP, flags);\n }\n copyFileSync(sourceP, destP, flags = 0) {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`ENOSYS: unsupported clone operation, copyfile '${sourceP}' -> ${destP}'`), { code: `ENOSYS` });\n const resolvedSourceP = this.resolveFilename(`copyfile '${sourceP} -> ${destP}'`, sourceP);\n const indexSource = this.entries.get(resolvedSourceP);\n if (typeof indexSource === `undefined`)\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n const resolvedDestP = this.resolveFilename(`copyfile '${sourceP}' -> ${destP}'`, destP);\n const indexDest = this.entries.get(resolvedDestP);\n if ((flags & (fs_1.constants.COPYFILE_EXCL | fs_1.constants.COPYFILE_FICLONE_FORCE)) !== 0 && typeof indexDest !== `undefined`)\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n const source = this.getFileSource(indexSource);\n const newIndex = this.setFileSource(resolvedDestP, source);\n if (newIndex !== indexDest) {\n this.registerEntry(resolvedDestP, newIndex);\n }\n }\n async writeFilePromise(p, content, opts) {\n return this.writeFileSync(p, content, opts);\n }\n writeFileSync(p, content, opts) {\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, open '${p}'`), { code: `EISDIR` });\n const index = this.entries.get(resolvedP);\n if (index !== undefined && typeof opts === `object` && opts.flag && opts.flag.includes(`a`))\n content = Buffer.concat([this.getFileSource(index), Buffer.from(content)]);\n let encoding = null;\n if (typeof opts === `string`)\n encoding = opts;\n else if (typeof opts === `object` && opts.encoding)\n encoding = opts.encoding;\n if (encoding !== null)\n content = content.toString(encoding);\n const newIndex = this.setFileSource(resolvedP, content);\n if (newIndex !== index) {\n this.registerEntry(resolvedP, newIndex);\n }\n }\n async unlinkPromise(p) {\n return this.unlinkSync(p);\n }\n unlinkSync(p) {\n throw new Error(`Unimplemented`);\n }\n async utimesPromise(p, atime, mtime) {\n return this.utimesSync(p, atime, mtime);\n }\n utimesSync(p, atime, mtime) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p);\n return this.utimesImpl(resolvedP, mtime);\n }\n async lutimesPromise(p, atime, mtime) {\n return this.lutimesSync(p, atime, mtime);\n }\n lutimesSync(p, atime, mtime) {\n const resolvedP = this.resolveFilename(`chmod '${p}'`, p, false);\n return this.utimesImpl(resolvedP, mtime);\n }\n utimesImpl(resolvedP, mtime) {\n if (this.listings.has(resolvedP))\n if (!this.entries.has(resolvedP))\n this.hydrateDirectory(resolvedP);\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const rc = libzip_1.default.file.setMtime(this.zip, entry, 0, toUnixTimestamp(mtime), 0);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async mkdirPromise(p) {\n return this.mkdirSync(p);\n }\n mkdirSync(p) {\n const resolvedP = this.resolveFilename(`mkdir '${p}'`, p);\n if (this.entries.has(resolvedP) || this.listings.has(resolvedP))\n throw Object.assign(new Error(`EEXIST: file already exists, mkdir '${p}'`), { code: `EEXIST` });\n this.hydrateDirectory(resolvedP);\n }\n async rmdirPromise(p) {\n return this.rmdirSync(p);\n }\n rmdirSync(p) {\n throw new Error(`Unimplemented`);\n }\n hydrateDirectory(resolvedP) {\n const index = libzip_1.default.dir.add(this.zip, path_1.ppath.relative(path_1.PortablePath.root, resolvedP));\n if (index === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n this.registerListing(resolvedP);\n this.registerEntry(resolvedP, index);\n return index;\n }\n async symlinkPromise(target, p) {\n return this.symlinkSync(target, p);\n }\n symlinkSync(target, p) {\n const resolvedP = this.resolveFilename(`symlink '${target}' -> '${p}'`, p);\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, symlink '${target}' -> '${p}'`), { code: `EISDIR` });\n if (this.entries.has(resolvedP))\n throw Object.assign(new Error(`EEXIST: file already exists, symlink '${target}' -> '${p}'`), { code: `EEXIST` });\n const index = this.setFileSource(resolvedP, target);\n this.registerEntry(resolvedP, index);\n const rc = libzip_1.default.file.setExternalAttributes(this.zip, index, 0, 0, libzip_1.default.ZIP_OPSYS_UNIX, (0o120000 | 0o777) << 16);\n if (rc === -1) {\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n }\n }\n async readFilePromise(p, encoding) {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.readFileSync(p, encoding);\n default:\n return this.readFileSync(p, encoding);\n }\n }\n readFileSync(p, encoding) {\n // This is messed up regarding the TS signatures\n if (typeof encoding === `object`)\n // @ts-ignore\n encoding = encoding ? encoding.encoding : undefined;\n const resolvedP = this.resolveFilename(`open '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, open '${p}'`), { code: `ENOENT` });\n // Ensures that the last component is a directory, if the user said so (even if it is we'll throw right after with EISDIR anyway)\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, open '${p}'`), { code: `ENOTDIR` });\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EISDIR: illegal operation on a directory, read`), { code: `EISDIR` });\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const data = this.getFileSource(entry);\n return encoding ? data.toString(encoding) : data;\n }\n async readdirPromise(p) {\n return this.readdirSync(p);\n }\n readdirSync(p) {\n const resolvedP = this.resolveFilename(`scandir '${p}'`, p);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, scandir '${p}'`), { code: `ENOENT` });\n const directoryListing = this.listings.get(resolvedP);\n if (!directoryListing)\n throw Object.assign(new Error(`ENOTDIR: not a directory, scandir '${p}'`), { code: `ENOTDIR` });\n return Array.from(directoryListing);\n }\n async readlinkPromise(p) {\n return this.readlinkSync(p);\n }\n readlinkSync(p) {\n const resolvedP = this.resolveFilename(`readlink '${p}'`, p, false);\n if (!this.entries.has(resolvedP) && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOENT: no such file or directory, readlink '${p}'`), { code: `ENOENT` });\n // Ensure that the last component is a directory (if it is we'll throw right after with EISDIR anyway)\n if (p[p.length - 1] === `/` && !this.listings.has(resolvedP))\n throw Object.assign(new Error(`ENOTDIR: not a directory, open '${p}'`), { code: `ENOTDIR` });\n if (this.listings.has(resolvedP))\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n const entry = this.entries.get(resolvedP);\n if (entry === undefined)\n throw new Error(`Unreachable`);\n const rc = libzip_1.default.file.getExternalAttributes(this.zip, entry, 0, 0, libzip_1.default.uint08S, libzip_1.default.uint32S);\n if (rc === -1)\n throw new Error(libzip_1.default.error.strerror(libzip_1.default.getError(this.zip)));\n const opsys = libzip_1.default.getValue(libzip_1.default.uint08S, `i8`) >>> 0;\n if (opsys !== libzip_1.default.ZIP_OPSYS_UNIX)\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n const attributes = libzip_1.default.getValue(libzip_1.default.uint32S, `i32`) >>> 16;\n if ((attributes & 0o170000) !== 0o120000)\n throw Object.assign(new Error(`EINVAL: invalid argument, readlink '${p}'`), { code: `EINVAL` });\n return this.getFileSource(entry).toString();\n }\n watch(p, a, b) {\n let persistent;\n switch (typeof a) {\n case `function`:\n case `string`:\n case `undefined`:\n {\n persistent = true;\n }\n break;\n default:\n {\n // @ts-ignore\n ({ persistent = true } = a);\n }\n break;\n }\n if (!persistent)\n return { on: () => { }, close: () => { } };\n const interval = setInterval(() => { }, 24 * 60 * 60 * 1000);\n return { on: () => { }, close: () => { clearInterval(interval); } };\n }\n}\nexports.ZipFS = ZipFS;\n;\n\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar ErrorCode;\n(function (ErrorCode) {\n ErrorCode[\"API_ERROR\"] = \"API_ERROR\";\n ErrorCode[\"BLACKLISTED\"] = \"BLACKLISTED\";\n ErrorCode[\"BUILTIN_NODE_RESOLUTION_FAILED\"] = \"BUILTIN_NODE_RESOLUTION_FAILED\";\n ErrorCode[\"MISSING_DEPENDENCY\"] = \"MISSING_DEPENDENCY\";\n ErrorCode[\"MISSING_PEER_DEPENDENCY\"] = \"MISSING_PEER_DEPENDENCY\";\n ErrorCode[\"QUALIFIED_PATH_RESOLUTION_FAILED\"] = \"QUALIFIED_PATH_RESOLUTION_FAILED\";\n ErrorCode[\"INTERNAL\"] = \"INTERNAL\";\n ErrorCode[\"UNDECLARED_DEPENDENCY\"] = \"UNDECLARED_DEPENDENCY\";\n ErrorCode[\"UNSUPPORTED\"] = \"UNSUPPORTED\";\n})(ErrorCode = exports.ErrorCode || (exports.ErrorCode = {}));\n;\n// Some errors are exposed as MODULE_NOT_FOUND for compatibility with packages\n// that expect this umbrella error when the resolution fails\nconst MODULE_NOT_FOUND_ERRORS = new Set([\n ErrorCode.BLACKLISTED,\n ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED,\n ErrorCode.MISSING_DEPENDENCY,\n ErrorCode.MISSING_PEER_DEPENDENCY,\n ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED,\n ErrorCode.UNDECLARED_DEPENDENCY,\n]);\n/**\n * Simple helper function that assign an error code to an error, so that it can more easily be caught and used\n * by third-parties.\n */\nfunction makeError(pnpCode, message, data = {}) {\n const code = MODULE_NOT_FOUND_ERRORS.has(pnpCode)\n ? `MODULE_NOT_FOUND`\n : pnpCode;\n return Object.assign(new Error(message), {\n code, pnpCode, data,\n });\n}\nexports.makeError = makeError;\n/**\n * Returns the module that should be used to resolve require calls. It's usually the direct parent, except if we're\n * inside an eval expression.\n */\nfunction getIssuerModule(parent) {\n let issuer = parent;\n while (issuer && (issuer.id === '[eval]' || issuer.id === '' || !issuer.filename))\n issuer = issuer.parent;\n return issuer;\n}\nexports.getIssuerModule = getIssuerModule;\n\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst module_1 = __importDefault(__webpack_require__(7));\nconst path_1 = __importDefault(__webpack_require__(4));\nconst string_decoder_1 = __importDefault(__webpack_require__(25));\nconst applyPatch_1 = __webpack_require__(26);\nconst hydrateRuntimeState_1 = __webpack_require__(27);\nconst makeApi_1 = __webpack_require__(28);\n// We must copy the fs into a local, because otherwise\n// 1. we would make the NodeFS instance use the function that we patched (infinite loop)\n// 2. Object.create(fs) isn't enough, since it won't prevent the proto from being modified\nconst localFs = Object.assign({}, fs_1.default);\nconst nodeFs = new fslib_1.NodeFS(localFs);\nconst runtimeState = $$SETUP_STATE(hydrateRuntimeState_1.hydrateRuntimeState);\nlet underlyingFs = new fslib_1.ZipOpenFS({ baseFs: nodeFs });\nfor (const virtualRoot of runtimeState.virtualRoots)\n underlyingFs = new fslib_1.VirtualFS(virtualRoot, { baseFs: underlyingFs });\nmodule.exports = makeApi_1.makeApi(runtimeState, {\n compatibilityMode: true,\n fakeFs: underlyingFs,\n pnpapiResolution: path_1.default.resolve(__dirname, __filename),\n});\nmodule.exports.setup = () => {\n applyPatch_1.applyPatch(module.exports, {\n compatibilityMode: true,\n fakeFs: underlyingFs,\n });\n};\nif (__non_webpack_module__.parent && __non_webpack_module__.parent.id === 'internal/preload') {\n module.exports.setup();\n if (__non_webpack_module__.filename) {\n // We delete it from the cache in order to support the case where the CLI resolver is invoked from \"yarn run\"\n // It's annoying because it might cause some issues when the file is multiple times in NODE_OPTIONS, but it shouldn't happen anyway.\n // @ts-ignore\n delete module_1.default._cache[__non_webpack_module__.filename];\n }\n}\n// @ts-ignore\nif (process.mainModule === __non_webpack_module__) {\n const reportError = (code, message, data) => {\n process.stdout.write(`${JSON.stringify([{ code, message, data }, null])}\\n`);\n };\n const reportSuccess = (resolution) => {\n process.stdout.write(`${JSON.stringify([null, resolution])}\\n`);\n };\n const processResolution = (request, issuer) => {\n try {\n reportSuccess(module.exports.resolveRequest(request, issuer));\n }\n catch (error) {\n reportError(error.code, error.message, error.data);\n }\n };\n const processRequest = (data) => {\n try {\n const [request, issuer] = JSON.parse(data);\n processResolution(request, issuer);\n }\n catch (error) {\n reportError(`INVALID_JSON`, error.message, error.data);\n }\n };\n if (process.argv.length > 2) {\n if (process.argv.length !== 4) {\n process.stderr.write(`Usage: ${process.argv[0]} ${process.argv[1]} \\n`);\n process.exitCode = 64; /* EX_USAGE */\n }\n else {\n processResolution(process.argv[2], process.argv[3]);\n }\n }\n else {\n let buffer = '';\n const decoder = new string_decoder_1.default.StringDecoder();\n process.stdin.on('data', chunk => {\n buffer += decoder.write(chunk);\n do {\n const index = buffer.indexOf('\\n');\n if (index === -1)\n break;\n const line = buffer.slice(0, index);\n buffer = buffer.slice(index + 1);\n processRequest(line);\n } while (true);\n });\n }\n}\n\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/*!\n * Tmp\n *\n * Copyright (c) 2011-2017 KARASZI Istvan \n *\n * MIT Licensed\n */\n\n/*\n * Module dependencies.\n */\nconst fs = __webpack_require__(2);\nconst path = __webpack_require__(4);\nconst crypto = __webpack_require__(8);\nconst osTmpDir = __webpack_require__(13);\nconst _c = process.binding('constants');\n\n/*\n * The working inner variables.\n */\nconst\n /**\n * The temporary directory.\n * @type {string}\n */\n tmpDir = osTmpDir(),\n\n // the random characters to choose from\n RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',\n\n TEMPLATE_PATTERN = /XXXXXX/,\n\n DEFAULT_TRIES = 3,\n\n CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR),\n\n EBADF = _c.EBADF || _c.os.errno.EBADF,\n ENOENT = _c.ENOENT || _c.os.errno.ENOENT,\n\n DIR_MODE = 448 /* 0o700 */,\n FILE_MODE = 384 /* 0o600 */,\n\n // this will hold the objects need to be removed on exit\n _removeObjects = [];\n\nvar\n _gracefulCleanup = false,\n _uncaughtException = false;\n\n/**\n * Random name generator based on crypto.\n * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript\n *\n * @param {number} howMany\n * @returns {string} the generated random name\n * @private\n */\nfunction _randomChars(howMany) {\n var\n value = [],\n rnd = null;\n\n // make sure that we do not fail because we ran out of entropy\n try {\n rnd = crypto.randomBytes(howMany);\n } catch (e) {\n rnd = crypto.pseudoRandomBytes(howMany);\n }\n\n for (var i = 0; i < howMany; i++) {\n value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]);\n }\n\n return value.join('');\n}\n\n/**\n * Checks whether the `obj` parameter is defined or not.\n *\n * @param {Object} obj\n * @returns {boolean} true if the object is undefined\n * @private\n */\nfunction _isUndefined(obj) {\n return typeof obj === 'undefined';\n}\n\n/**\n * Parses the function arguments.\n *\n * This function helps to have optional arguments.\n *\n * @param {(Options|Function)} options\n * @param {Function} callback\n * @returns {Array} parsed arguments\n * @private\n */\nfunction _parseArguments(options, callback) {\n if (typeof options == 'function') {\n return [callback || {}, options];\n }\n\n if (_isUndefined(options)) {\n return [{}, callback];\n }\n\n return [options, callback];\n}\n\n/**\n * Generates a new temporary name.\n *\n * @param {Object} opts\n * @returns {string} the new random name according to opts\n * @private\n */\nfunction _generateTmpName(opts) {\n if (opts.name) {\n return path.join(opts.dir || tmpDir, opts.name);\n }\n\n // mkstemps like template\n if (opts.template) {\n return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6));\n }\n\n // prefix and postfix\n const name = [\n opts.prefix || 'tmp-',\n process.pid,\n _randomChars(12),\n opts.postfix || ''\n ].join('');\n\n return path.join(opts.dir || tmpDir, name);\n}\n\n/**\n * Gets a temporary file name.\n *\n * @param {(Options|tmpNameCallback)} options options or callback\n * @param {?tmpNameCallback} callback the callback function\n */\nfunction tmpName(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n return cb(new Error('Invalid tries'));\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n return cb(new Error('Invalid template provided'));\n\n (function _getUniqueName() {\n const name = _generateTmpName(opts);\n\n // check whether the path exists then retry if needed\n fs.stat(name, function (err) {\n if (!err) {\n if (tries-- > 0) return _getUniqueName();\n\n return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name));\n }\n\n cb(null, name);\n });\n }());\n}\n\n/**\n * Synchronous version of tmpName.\n *\n * @param {Object} options\n * @returns {string} the generated random name\n * @throws {Error} if the options are invalid or could not generate a filename\n */\nfunction tmpNameSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0],\n tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES;\n\n if (isNaN(tries) || tries < 0)\n throw new Error('Invalid tries');\n\n if (opts.template && !opts.template.match(TEMPLATE_PATTERN))\n throw new Error('Invalid template provided');\n\n do {\n const name = _generateTmpName(opts);\n try {\n fs.statSync(name);\n } catch (e) {\n return name;\n }\n } while (tries-- > 0);\n\n throw new Error('Could not get a unique tmp filename, max tries reached');\n}\n\n/**\n * Creates and opens a temporary file.\n *\n * @param {(Options|fileCallback)} options the config options or the callback function\n * @param {?fileCallback} callback\n */\nfunction file(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix;\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create and open the file\n fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) {\n if (err) return cb(err);\n\n if (opts.discardDescriptor) {\n return fs.close(fd, function _discardCallback(err) {\n if (err) {\n // Low probability, and the file exists, so this could be\n // ignored. If it isn't we certainly need to unlink the\n // file, and if that fails too its error is more\n // important.\n try {\n fs.unlinkSync(name);\n } catch (e) {\n if (!isENOENT(e)) {\n err = e;\n }\n }\n return cb(err);\n }\n cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts));\n });\n }\n if (opts.detachDescriptor) {\n return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts));\n }\n cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts));\n });\n });\n}\n\n/**\n * Synchronous version of file.\n *\n * @param {Options} options\n * @returns {FileSyncObject} object consists of name, fd and removeCallback\n * @throws {Error} if cannot create a file\n */\nfunction fileSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n opts.postfix = opts.postfix || '.tmp';\n\n const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor;\n const name = tmpNameSync(opts);\n var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE);\n if (opts.discardDescriptor) {\n fs.closeSync(fd); \n fd = undefined;\n }\n\n return {\n name: name,\n fd: fd,\n removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts)\n };\n}\n\n/**\n * Removes files and folders in a directory recursively.\n *\n * @param {string} root\n * @private\n */\nfunction _rmdirRecursiveSync(root) {\n const dirs = [root];\n\n do {\n var\n dir = dirs.pop(),\n deferred = false,\n files = fs.readdirSync(dir);\n\n for (var i = 0, length = files.length; i < length; i++) {\n var\n file = path.join(dir, files[i]),\n stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories\n\n if (stat.isDirectory()) {\n if (!deferred) {\n deferred = true;\n dirs.push(dir);\n }\n dirs.push(file);\n } else {\n fs.unlinkSync(file);\n }\n }\n\n if (!deferred) {\n fs.rmdirSync(dir);\n }\n } while (dirs.length !== 0);\n}\n\n/**\n * Creates a temporary directory.\n *\n * @param {(Options|dirCallback)} options the options or the callback function\n * @param {?dirCallback} callback\n */\nfunction dir(options, callback) {\n var\n args = _parseArguments(options, callback),\n opts = args[0],\n cb = args[1];\n\n // gets a temporary filename\n tmpName(opts, function _tmpNameCreated(err, name) {\n if (err) return cb(err);\n\n // create the directory\n fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) {\n if (err) return cb(err);\n\n cb(null, name, _prepareTmpDirRemoveCallback(name, opts));\n });\n });\n}\n\n/**\n * Synchronous version of dir.\n *\n * @param {Options} options\n * @returns {DirSyncObject} object consists of name and removeCallback\n * @throws {Error} if it cannot create a directory\n */\nfunction dirSync(options) {\n var\n args = _parseArguments(options),\n opts = args[0];\n\n const name = tmpNameSync(opts);\n fs.mkdirSync(name, opts.mode || DIR_MODE);\n\n return {\n name: name,\n removeCallback: _prepareTmpDirRemoveCallback(name, opts)\n };\n}\n\n/**\n * Prepares the callback for removal of the temporary file.\n *\n * @param {string} name the path of the file\n * @param {number} fd file descriptor\n * @param {Object} opts\n * @returns {fileCallback}\n * @private\n */\nfunction _prepareTmpFileRemoveCallback(name, fd, opts) {\n const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) {\n try {\n if (0 <= fdPath[0]) {\n fs.closeSync(fdPath[0]);\n }\n }\n catch (e) {\n // under some node/windows related circumstances, a temporary file\n // may have not be created as expected or the file was already closed\n // by the user, in which case we will simply ignore the error\n if (!isEBADF(e) && !isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n try {\n fs.unlinkSync(fdPath[1]);\n }\n catch (e) {\n if (!isENOENT(e)) {\n // reraise any unanticipated error\n throw e;\n }\n }\n }, [fd, name]);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Prepares the callback for removal of the temporary directory.\n *\n * @param {string} name\n * @param {Object} opts\n * @returns {Function} the callback\n * @private\n */\nfunction _prepareTmpDirRemoveCallback(name, opts) {\n const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs);\n const removeCallback = _prepareRemoveCallback(removeFunction, name);\n\n if (!opts.keep) {\n _removeObjects.unshift(removeCallback);\n }\n\n return removeCallback;\n}\n\n/**\n * Creates a guarded function wrapping the removeFunction call.\n *\n * @param {Function} removeFunction\n * @param {Object} arg\n * @returns {Function}\n * @private\n */\nfunction _prepareRemoveCallback(removeFunction, arg) {\n var called = false;\n\n return function _cleanupCallback(next) {\n if (!called) {\n const index = _removeObjects.indexOf(_cleanupCallback);\n if (index >= 0) {\n _removeObjects.splice(index, 1);\n }\n\n called = true;\n removeFunction(arg);\n }\n\n if (next) next(null);\n };\n}\n\n/**\n * The garbage collector.\n *\n * @private\n */\nfunction _garbageCollector() {\n if (_uncaughtException && !_gracefulCleanup) {\n return;\n }\n\n // the function being called removes itself from _removeObjects,\n // loop until _removeObjects is empty\n while (_removeObjects.length) {\n try {\n _removeObjects[0].call(null);\n } catch (e) {\n // already removed?\n }\n }\n}\n\n/**\n * Helper for testing against EBADF to compensate changes made to Node 7.x under Windows.\n */\nfunction isEBADF(error) {\n return isExpectedError(error, -EBADF, 'EBADF');\n}\n\n/**\n * Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows.\n */\nfunction isENOENT(error) {\n return isExpectedError(error, -ENOENT, 'ENOENT');\n}\n\n/**\n * Helper to determine whether the expected error code matches the actual code and errno,\n * which will differ between the supported node versions.\n *\n * - Node >= 7.0:\n * error.code {String}\n * error.errno {String|Number} any numerical value will be negated\n *\n * - Node >= 6.0 < 7.0:\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 4.0 < 6.0: introduces SystemError\n * error.code {String}\n * error.errno {Number} negated\n *\n * - Node >= 0.10 < 4.0:\n * error.code {Number} negated\n * error.errno n/a\n */\nfunction isExpectedError(error, code, errno) {\n return error.code == code || error.code == errno;\n}\n\n/**\n * Sets the graceful cleanup.\n *\n * Also removes the created files and directories when an uncaught exception occurs.\n */\nfunction setGracefulCleanup() {\n _gracefulCleanup = true;\n}\n\nconst version = process.versions.node.split('.').map(function (value) {\n return parseInt(value, 10);\n});\n\nif (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) {\n process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) {\n _uncaughtException = true;\n _garbageCollector();\n\n throw err;\n });\n}\n\nprocess.addListener('exit', function _exit(code) {\n if (code) _uncaughtException = true;\n _garbageCollector();\n});\n\n/**\n * Configuration options.\n *\n * @typedef {Object} Options\n * @property {?number} tries the number of tries before give up the name generation\n * @property {?string} template the \"mkstemp\" like filename template\n * @property {?string} name fix name\n * @property {?string} dir the tmp directory to use\n * @property {?string} prefix prefix for the generated name\n * @property {?string} postfix postfix for the generated name\n */\n\n/**\n * @typedef {Object} FileSyncObject\n * @property {string} name the name of the file\n * @property {string} fd the file descriptor\n * @property {fileCallback} removeCallback the callback function to remove the file\n */\n\n/**\n * @typedef {Object} DirSyncObject\n * @property {string} name the name of the directory\n * @property {fileCallback} removeCallback the callback function to remove the directory\n */\n\n/**\n * @callback tmpNameCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n */\n\n/**\n * @callback fileCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {number} fd the file descriptor\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * @callback dirCallback\n * @param {?Error} err the error object if anything goes wrong\n * @param {string} name the temporary file name\n * @param {cleanupCallback} fn the cleanup callback function\n */\n\n/**\n * Removes the temporary created file or directory.\n *\n * @callback cleanupCallback\n * @param {simpleCallback} [next] function to call after entry was removed\n */\n\n/**\n * Callback function for function composition.\n * @see {@link https://github.com/raszi/node-tmp/issues/57|raszi/node-tmp#57}\n *\n * @callback simpleCallback\n */\n\n// exporting all the needed methods\nmodule.exports.tmpdir = tmpDir;\n\nmodule.exports.dir = dir;\nmodule.exports.dirSync = dirSync;\n\nmodule.exports.file = file;\nmodule.exports.fileSync = fileSync;\n\nmodule.exports.tmpName = tmpName;\nmodule.exports.tmpNameSync = tmpNameSync;\n\nmodule.exports.setGracefulCleanup = setGracefulCleanup;\n\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar isWindows = process.platform === 'win32';\nvar trailingSlashRe = isWindows ? /[^:]\\\\$/ : /.\\/$/;\n\n// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43\nmodule.exports = function () {\n\tvar path;\n\n\tif (isWindows) {\n\t\tpath = process.env.TEMP ||\n\t\t\tprocess.env.TMP ||\n\t\t\t(process.env.SystemRoot || process.env.windir) + '\\\\temp';\n\t} else {\n\t\tpath = process.env.TMPDIR ||\n\t\t\tprocess.env.TMP ||\n\t\t\tprocess.env.TEMP ||\n\t\t\t'/tmp';\n\t}\n\n\tif (trailingSlashRe.test(path)) {\n\t\tpath = path.slice(0, -1);\n\t}\n\n\treturn path;\n};\n\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ProxiedFS_1 = __webpack_require__(3);\nclass AliasFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs, pathUtils }) {\n super(pathUtils);\n this.target = target;\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.target;\n }\n getBaseFs() {\n return this.baseFs;\n }\n mapFromBase(p) {\n return p;\n }\n mapToBase(p) {\n return p;\n }\n}\nexports.AliasFS = AliasFS;\n\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nclass CwdFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.target = target;\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n mapFromBase(path) {\n return this.pathUtils.relative(this.getRealPath(), path);\n }\n mapToBase(path) {\n return this.pathUtils.resolve(this.getRealPath(), path);\n }\n}\nexports.CwdFS = CwdFS;\n\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nconst JAIL_ROOT = path_1.PortablePath.root;\nclass JailFS extends ProxiedFS_1.ProxiedFS {\n constructor(target, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.target = this.pathUtils.resolve(path_1.PortablePath.root, target);\n this.baseFs = baseFs;\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.pathUtils.relative(path_1.PortablePath.root, this.target));\n }\n getTarget() {\n return this.target;\n }\n getBaseFs() {\n return this.baseFs;\n }\n mapToBase(p) {\n const normalized = this.pathUtils.normalize(p);\n if (this.pathUtils.isAbsolute(p))\n return this.pathUtils.resolve(this.target, this.pathUtils.relative(JAIL_ROOT, p));\n if (normalized.match(/^\\.\\.\\//))\n throw new Error(`Resolving this path (${p}) would escape the jail`);\n return this.pathUtils.resolve(this.target, p);\n }\n mapFromBase(p) {\n return this.pathUtils.resolve(JAIL_ROOT, this.pathUtils.relative(this.target, p));\n }\n}\nexports.JailFS = JailFS;\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst ProxiedFS_1 = __webpack_require__(3);\nclass LazyFS extends ProxiedFS_1.ProxiedFS {\n constructor(factory, pathUtils) {\n super(pathUtils);\n this.instance = null;\n this.factory = factory;\n }\n get baseFs() {\n if (!this.instance)\n this.instance = this.factory();\n return this.instance;\n }\n mapFromBase(p) {\n return p;\n }\n mapToBase(p) {\n return p;\n }\n}\nexports.LazyFS = LazyFS;\n\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\nclass PosixFS extends ProxiedFS_1.ProxiedFS {\n constructor(baseFs) {\n super(path_1.npath);\n this.baseFs = baseFs;\n }\n mapFromBase(path) {\n return NodeFS_1.NodeFS.fromPortablePath(path);\n }\n mapToBase(path) {\n return NodeFS_1.NodeFS.toPortablePath(path);\n }\n}\nexports.PosixFS = PosixFS;\n\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst NodeFS_1 = __webpack_require__(1);\nconst ProxiedFS_1 = __webpack_require__(3);\nconst path_1 = __webpack_require__(0);\n// https://github.com/benjamingr/RegExp.escape/blob/master/polyfill.js\nconst escapeRegexp = (s) => s.replace(/[\\\\^$*+?.()|[\\]{}]/g, '\\\\$&');\nclass VirtualFS extends ProxiedFS_1.ProxiedFS {\n static makeVirtualPath(base, component, to) {\n // Obtains the relative distance between the virtual path and its actual target\n const target = path_1.ppath.relative(path_1.ppath.dirname(base), to);\n const segments = target.split(`/`);\n // Counts how many levels we need to go back to start applying the rest of the path\n let depth = 0;\n while (depth < segments.length && segments[depth] === `..`)\n depth += 1;\n const finalSegments = segments.slice(depth);\n const fullVirtualPath = path_1.ppath.join(base, component, String(depth), ...finalSegments);\n return fullVirtualPath;\n }\n constructor(virtual, { baseFs = new NodeFS_1.NodeFS() } = {}) {\n super(path_1.ppath);\n this.baseFs = baseFs;\n this.target = path_1.ppath.dirname(virtual);\n this.virtual = virtual;\n this.mapToBaseRegExp = new RegExp(`^(${escapeRegexp(this.virtual)})((?:/([^\\/]+)(?:/([^/]+))?)?((?:/.*)?))$`);\n }\n getRealPath() {\n return this.pathUtils.resolve(this.baseFs.getRealPath(), this.target);\n }\n realpathSync(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return this.baseFs.realpathSync(p);\n if (!match[5])\n return p;\n const realpath = this.baseFs.realpathSync(this.mapToBase(p));\n return VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n async realpathPromise(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return await this.baseFs.realpathPromise(p);\n if (!match[5])\n return p;\n const realpath = await this.baseFs.realpathPromise(this.mapToBase(p));\n return VirtualFS.makeVirtualPath(this.virtual, match[3], realpath);\n }\n mapToBase(p) {\n const match = p.match(this.mapToBaseRegExp);\n if (!match)\n return p;\n if (match[3])\n return this.mapToBase(path_1.ppath.join(this.target, `../`.repeat(Number(match[4])), match[5]));\n return this.target;\n }\n mapFromBase(p) {\n return p;\n }\n}\nexports.VirtualFS = VirtualFS;\n\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst libzip_1 = __importDefault(__webpack_require__(21));\nconst number64 = [\n `number`,\n `number`,\n];\n// eslint-disable-next-line arca/no-default-export\nexports.default = {\n // Those are getters because they can change after memory growth\n get HEAP8() { return libzip_1.default.HEAP8; },\n get HEAPU8() { return libzip_1.default.HEAPU8; },\n ZIP_CHECKCONS: 4,\n ZIP_CREATE: 1,\n ZIP_EXCL: 2,\n ZIP_TRUNCATE: 8,\n ZIP_RDONLY: 16,\n ZIP_FL_OVERWRITE: 8192,\n ZIP_OPSYS_DOS: 0x00,\n ZIP_OPSYS_AMIGA: 0x01,\n ZIP_OPSYS_OPENVMS: 0x02,\n ZIP_OPSYS_UNIX: 0x03,\n ZIP_OPSYS_VM_CMS: 0x04,\n ZIP_OPSYS_ATARI_ST: 0x05,\n ZIP_OPSYS_OS_2: 0x06,\n ZIP_OPSYS_MACINTOSH: 0x07,\n ZIP_OPSYS_Z_SYSTEM: 0x08,\n ZIP_OPSYS_CPM: 0x09,\n ZIP_OPSYS_WINDOWS_NTFS: 0x0a,\n ZIP_OPSYS_MVS: 0x0b,\n ZIP_OPSYS_VSE: 0x0c,\n ZIP_OPSYS_ACORN_RISC: 0x0d,\n ZIP_OPSYS_VFAT: 0x0e,\n ZIP_OPSYS_ALTERNATE_MVS: 0x0f,\n ZIP_OPSYS_BEOS: 0x10,\n ZIP_OPSYS_TANDEM: 0x11,\n ZIP_OPSYS_OS_400: 0x12,\n ZIP_OPSYS_OS_X: 0x13,\n uint08S: libzip_1.default._malloc(1),\n uint16S: libzip_1.default._malloc(2),\n uint32S: libzip_1.default._malloc(4),\n uint64S: libzip_1.default._malloc(8),\n malloc: libzip_1.default._malloc,\n free: libzip_1.default._free,\n getValue: libzip_1.default.getValue,\n open: libzip_1.default.cwrap(`zip_open`, `number`, [`string`, `number`, `number`]),\n openFromSource: libzip_1.default.cwrap(`zip_open_from_source`, `number`, [`number`, `number`, `number`]),\n close: libzip_1.default.cwrap(`zip_close`, `number`, [`number`]),\n discard: libzip_1.default.cwrap(`zip_discard`, `void`, [`number`]),\n getError: libzip_1.default.cwrap(`zip_get_error`, `number`, [`number`]),\n getName: libzip_1.default.cwrap(`zip_get_name`, `string`, [`number`, `number`, `number`]),\n getNumEntries: libzip_1.default.cwrap(`zip_get_num_entries`, `number`, [`number`, `number`]),\n stat: libzip_1.default.cwrap(`zip_stat`, `number`, [`number`, `string`, `number`, `number`]),\n statIndex: libzip_1.default.cwrap(`zip_stat_index`, `number`, [`number`, ...number64, `number`, `number`]),\n fopen: libzip_1.default.cwrap(`zip_fopen`, `number`, [`number`, `string`, `number`]),\n fopenIndex: libzip_1.default.cwrap(`zip_fopen_index`, `number`, [`number`, ...number64, `number`]),\n fread: libzip_1.default.cwrap(`zip_fread`, `number`, [`number`, `number`, `number`, `number`]),\n fclose: libzip_1.default.cwrap(`zip_fclose`, `number`, [`number`]),\n dir: {\n add: libzip_1.default.cwrap(`zip_dir_add`, `number`, [`number`, `string`]),\n },\n file: {\n add: libzip_1.default.cwrap(`zip_file_add`, `number`, [`number`, `string`, `number`, `number`]),\n getError: libzip_1.default.cwrap(`zip_file_get_error`, `number`, [`number`]),\n getExternalAttributes: libzip_1.default.cwrap(`zip_file_get_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setExternalAttributes: libzip_1.default.cwrap(`zip_file_set_external_attributes`, `number`, [`number`, ...number64, `number`, `number`, `number`]),\n setMtime: libzip_1.default.cwrap(`zip_file_set_mtime`, `number`, [`number`, ...number64, `number`, `number`]),\n },\n error: {\n initWithCode: libzip_1.default.cwrap(`zip_error_init_with_code`, `void`, [`number`, `number`]),\n strerror: libzip_1.default.cwrap(`zip_error_strerror`, `string`, [`number`]),\n },\n name: {\n locate: libzip_1.default.cwrap(`zip_name_locate`, `number`, [`number`, `string`, `number`]),\n },\n source: {\n fromUnattachedBuffer: libzip_1.default.cwrap(`zip_source_buffer_create`, `number`, [`number`, `number`, `number`, `number`]),\n fromBuffer: libzip_1.default.cwrap(`zip_source_buffer`, `number`, [`number`, `number`, ...number64, `number`]),\n free: libzip_1.default.cwrap(`zip_source_free`, `void`, [`number`]),\n },\n struct: {\n stat: libzip_1.default.cwrap(`zipstruct_stat`, `number`, []),\n statS: libzip_1.default.cwrap(`zipstruct_statS`, `number`, []),\n statName: libzip_1.default.cwrap(`zipstruct_stat_name`, `string`, [`number`]),\n statIndex: libzip_1.default.cwrap(`zipstruct_stat_index`, `number`, [`number`]),\n statSize: libzip_1.default.cwrap(`zipstruct_stat_size`, `number`, [`number`]),\n statMtime: libzip_1.default.cwrap(`zipstruct_stat_mtime`, `number`, [`number`]),\n error: libzip_1.default.cwrap(`zipstruct_error`, `number`, []),\n errorS: libzip_1.default.cwrap(`zipstruct_errorS`, `number`, []),\n },\n};\n\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar frozenFs = Object.assign({}, __webpack_require__(2));\nvar Module=typeof Module!==\"undefined\"?Module:{};var moduleOverrides={};var key;for(key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}Module[\"arguments\"]=[];Module[\"thisProgram\"]=\"./this.program\";Module[\"quit\"]=function(status,toThrow){throw toThrow};Module[\"preRun\"]=[];Module[\"postRun\"]=[];var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=true;if(Module[\"ENVIRONMENT\"]){throw new Error(\"Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -s ENVIRONMENT=web or -s ENVIRONMENT=node)\")}var scriptDirectory=\"\";function locateFile(path){if(Module[\"locateFile\"]){return Module[\"locateFile\"](path,scriptDirectory)}else{return scriptDirectory+path}}if(ENVIRONMENT_IS_NODE){if(!(typeof process===\"object\"&&\"function\"===\"function\"))throw new Error(\"not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)\");scriptDirectory=__dirname+\"/\";var nodeFS;var nodePath;Module[\"read\"]=function shell_read(filename,binary){var ret;ret=tryParseAsDataURI(filename);if(!ret){if(!nodeFS)nodeFS=frozenFs;if(!nodePath)nodePath=__webpack_require__(4);filename=nodePath[\"normalize\"](filename);ret=nodeFS[\"readFileSync\"](filename)}return binary?ret:ret.toString()};Module[\"readBinary\"]=function readBinary(filename){var ret=Module[\"read\"](filename,true);if(!ret.buffer){ret=new Uint8Array(ret)}assert(ret.buffer);return ret};if(process[\"argv\"].length>1){Module[\"thisProgram\"]=process[\"argv\"][1].replace(/\\\\/g,\"/\")}Module[\"arguments\"]=process[\"argv\"].slice(2);if(true){module[\"exports\"]=Module}(function(){})(\"uncaughtException\",function(ex){if(!(ex instanceof ExitStatus)){throw ex}});(function(){})(\"unhandledRejection\",abort);Module[\"quit\"]=function(status){process[\"exit\"](status)};Module[\"inspect\"]=function(){return\"[Emscripten Module object]\"}}else{throw new Error(\"environment detection error\")}var out=Module[\"print\"]||(typeof console!==\"undefined\"?console.log.bind(console):typeof print!==\"undefined\"?print:null);var err=Module[\"printErr\"]||(typeof printErr!==\"undefined\"?printErr:typeof console!==\"undefined\"&&console.warn.bind(console)||out);for(key in moduleOverrides){if(moduleOverrides.hasOwnProperty(key)){Module[key]=moduleOverrides[key]}}moduleOverrides=undefined;assert(typeof Module[\"memoryInitializerPrefixURL\"]===\"undefined\",\"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"pthreadMainPrefixURL\"]===\"undefined\",\"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"cdInitializerPrefixURL\"]===\"undefined\",\"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");assert(typeof Module[\"filePackagePrefixURL\"]===\"undefined\",\"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");stackSave=stackRestore=stackAlloc=function(){abort(\"cannot use the stack before compiled code is ready to run, and has provided stack access\")};function dynamicAlloc(size){assert(DYNAMICTOP_PTR);var ret=HEAP32[DYNAMICTOP_PTR>>2];var end=ret+size+15&-16;if(end<=_emscripten_get_heap_size()){HEAP32[DYNAMICTOP_PTR>>2]=end}else{var success=_emscripten_resize_heap(end);if(!success)return 0}return ret}function getNativeTypeSize(type){switch(type){case\"i1\":case\"i8\":return 1;case\"i16\":return 2;case\"i32\":return 4;case\"i64\":return 8;case\"float\":return 4;case\"double\":return 8;default:{if(type[type.length-1]===\"*\"){return 4}else if(type[0]===\"i\"){var bits=parseInt(type.substr(1));assert(bits%8===0,\"getNativeTypeSize invalid bits \"+bits+\", type \"+type);return bits/8}else{return 0}}}}function warnOnce(text){if(!warnOnce.shown)warnOnce.shown={};if(!warnOnce.shown[text]){warnOnce.shown[text]=1;err(text)}}var asm2wasmImports={\"f64-rem\":function(x,y){return x%y},\"debugger\":function(){debugger}};var functionPointers=new Array(0);var tempRet0=0;var setTempRet0=function(value){tempRet0=value};if(typeof WebAssembly!==\"object\"){abort(\"No WebAssembly support found. Build with -s WASM=0 to target JavaScript instead.\")}function getValue(ptr,type,noSafe){type=type||\"i8\";if(type.charAt(type.length-1)===\"*\")type=\"i32\";if(noSafe){switch(type){case\"i1\":return HEAP8[ptr>>0];case\"i8\":return HEAP8[ptr>>0];case\"i16\":return HEAP16[ptr>>1];case\"i32\":return HEAP32[ptr>>2];case\"i64\":return HEAP32[ptr>>2];case\"float\":return HEAPF32[ptr>>2];case\"double\":return HEAPF64[ptr>>3];default:abort(\"invalid type for getValue: \"+type)}}else{switch(type){case\"i1\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i8\":return SAFE_HEAP_LOAD(ptr|0,1,0)|0;case\"i16\":return SAFE_HEAP_LOAD(ptr|0,2,0)|0;case\"i32\":return SAFE_HEAP_LOAD(ptr|0,4,0)|0;case\"i64\":return SAFE_HEAP_LOAD(ptr|0,8,0)|0;case\"float\":return Math_fround(SAFE_HEAP_LOAD_D(ptr|0,4,0));case\"double\":return+SAFE_HEAP_LOAD_D(ptr|0,8,0);default:abort(\"invalid type for getValue: \"+type)}}return null}function getSafeHeapType(bytes,isFloat){switch(bytes){case 1:return\"i8\";case 2:return\"i16\";case 4:return isFloat?\"float\":\"i32\";case 8:return\"double\";default:assert(0)}}function SAFE_HEAP_STORE(dest,value,bytes,isFloat){if(dest<=0)abort(\"segmentation fault storing \"+bytes+\" bytes to address \"+dest);if(dest%bytes!==0)abort(\"alignment error storing to address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when storing \"+bytes+\" bytes to address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);setValue(dest,value,getSafeHeapType(bytes,isFloat),1)}function SAFE_HEAP_STORE_D(dest,value,bytes){SAFE_HEAP_STORE(dest,value,bytes,true)}function SAFE_HEAP_LOAD(dest,bytes,unsigned,isFloat){if(dest<=0)abort(\"segmentation fault loading \"+bytes+\" bytes from address \"+dest);if(dest%bytes!==0)abort(\"alignment error loading from address \"+dest+\", which was expected to be aligned to a multiple of \"+bytes);if(dest+bytes>HEAP32[DYNAMICTOP_PTR>>2])abort(\"segmentation fault, exceeded the top of the available dynamic heap when loading \"+bytes+\" bytes from address \"+dest+\". DYNAMICTOP=\"+HEAP32[DYNAMICTOP_PTR>>2]);assert(DYNAMICTOP_PTR);assert(HEAP32[DYNAMICTOP_PTR>>2]<=HEAP8.length);var type=getSafeHeapType(bytes,isFloat);var ret=getValue(dest,type,1);if(unsigned)ret=unSign(ret,parseInt(type.substr(1)),1);return ret}function SAFE_HEAP_LOAD_D(dest,bytes,unsigned){return SAFE_HEAP_LOAD(dest,bytes,unsigned,true)}function segfault(){abort(\"segmentation fault\")}function alignfault(){abort(\"alignment fault\")}var wasmMemory;var wasmTable;var ABORT=false;var EXITSTATUS=0;function assert(condition,text){if(!condition){abort(\"Assertion failed: \"+text)}}function getCFunc(ident){var func=Module[\"_\"+ident];assert(func,\"Cannot call unknown function \"+ident+\", make sure it is exported\");return func}function ccall(ident,returnType,argTypes,args,opts){var toC={\"string\":function(str){var ret=0;if(str!==null&&str!==undefined&&str!==0){var len=(str.length<<2)+1;ret=stackAlloc(len);stringToUTF8(str,ret,len)}return ret},\"array\":function(arr){var ret=stackAlloc(arr.length);writeArrayToMemory(arr,ret);return ret}};function convertReturnValue(ret){if(returnType===\"string\")return UTF8ToString(ret);if(returnType===\"boolean\")return Boolean(ret);return ret}var func=getCFunc(ident);var cArgs=[];var stack=0;assert(returnType!==\"array\",'Return type should not be \"array\".');if(args){for(var i=0;i>0]=value;break;case\"i8\":HEAP8[ptr>>0]=value;break;case\"i16\":HEAP16[ptr>>1]=value;break;case\"i32\":HEAP32[ptr>>2]=value;break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],HEAP32[ptr>>2]=tempI64[0],HEAP32[ptr+4>>2]=tempI64[1];break;case\"float\":HEAPF32[ptr>>2]=value;break;case\"double\":HEAPF64[ptr>>3]=value;break;default:abort(\"invalid type for setValue: \"+type)}}else{switch(type){case\"i1\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i8\":SAFE_HEAP_STORE(ptr|0,value|0,1);break;case\"i16\":SAFE_HEAP_STORE(ptr|0,value|0,2);break;case\"i32\":SAFE_HEAP_STORE(ptr|0,value|0,4);break;case\"i64\":tempI64=[value>>>0,(tempDouble=value,+Math_abs(tempDouble)>=1?tempDouble>0?(Math_min(+Math_floor(tempDouble/4294967296),4294967295)|0)>>>0:~~+Math_ceil((tempDouble-+(~~tempDouble>>>0))/4294967296)>>>0:0)],SAFE_HEAP_STORE(ptr|0,tempI64[0]|0,4),SAFE_HEAP_STORE(ptr+4|0,tempI64[1]|0,4);break;case\"float\":SAFE_HEAP_STORE_D(ptr|0,Math_fround(value),4);break;case\"double\":SAFE_HEAP_STORE_D(ptr|0,+value,8);break;default:abort(\"invalid type for setValue: \"+type)}}}var ALLOC_NORMAL=0;var ALLOC_NONE=3;function allocate(slab,types,allocator,ptr){var zeroinit,size;if(typeof slab===\"number\"){zeroinit=true;size=slab}else{zeroinit=false;size=slab.length}var singleType=typeof types===\"string\"?types:null;var ret;if(allocator==ALLOC_NONE){ret=ptr}else{ret=[_malloc,stackAlloc,dynamicAlloc][allocator](Math.max(size,singleType?1:types.length))}if(zeroinit){var stop;ptr=ret;assert((ret&3)==0);stop=ret+(size&~3);for(;ptr>2]=0}stop=ret+size;while(ptr>0]=0}return ret}if(singleType===\"i8\"){if(slab.subarray||slab.slice){HEAPU8.set(slab,ret)}else{HEAPU8.set(new Uint8Array(slab),ret)}return ret}var i=0,type,typeSize,previousType;while(i=endIdx))++endPtr;if(endPtr-idx>16&&u8Array.subarray&&UTF8Decoder){return UTF8Decoder.decode(u8Array.subarray(idx,endPtr))}else{var str=\"\";while(idx>10,56320|ch&1023)}}}return str}function UTF8ToString(ptr,maxBytesToRead){return ptr?UTF8ArrayToString(HEAPU8,ptr,maxBytesToRead):\"\"}function stringToUTF8Array(str,outU8Array,outIdx,maxBytesToWrite){if(!(maxBytesToWrite>0))return 0;var startIdx=outIdx;var endIdx=outIdx+maxBytesToWrite-1;for(var i=0;i=55296&&u<=57343){var u1=str.charCodeAt(++i);u=65536+((u&1023)<<10)|u1&1023}if(u<=127){if(outIdx>=endIdx)break;outU8Array[outIdx++]=u}else if(u<=2047){if(outIdx+1>=endIdx)break;outU8Array[outIdx++]=192|u>>6;outU8Array[outIdx++]=128|u&63}else if(u<=65535){if(outIdx+2>=endIdx)break;outU8Array[outIdx++]=224|u>>12;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}else{if(outIdx+3>=endIdx)break;if(u>=2097152)warnOnce(\"Invalid Unicode code point 0x\"+u.toString(16)+\" encountered when serializing a JS string to an UTF-8 string on the asm.js/wasm heap! (Valid unicode code points should be in range 0-0x1FFFFF).\");outU8Array[outIdx++]=240|u>>18;outU8Array[outIdx++]=128|u>>12&63;outU8Array[outIdx++]=128|u>>6&63;outU8Array[outIdx++]=128|u&63}}outU8Array[outIdx]=0;return outIdx-startIdx}function stringToUTF8(str,outPtr,maxBytesToWrite){assert(typeof maxBytesToWrite==\"number\",\"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!\");return stringToUTF8Array(str,HEAPU8,outPtr,maxBytesToWrite)}function lengthBytesUTF8(str){var len=0;for(var i=0;i=55296&&u<=57343)u=65536+((u&1023)<<10)|str.charCodeAt(++i)&1023;if(u<=127)++len;else if(u<=2047)len+=2;else if(u<=65535)len+=3;else len+=4}return len}var UTF16Decoder=typeof TextDecoder!==\"undefined\"?new TextDecoder(\"utf-16le\"):undefined;function writeArrayToMemory(array,buffer){assert(array.length>=0,\"writeArrayToMemory array must have a length (should be an array or typed array)\");HEAP8.set(array,buffer)}function writeAsciiToMemory(str,buffer,dontAddNull){for(var i=0;i0){x+=multiple-x%multiple}return x}var buffer,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64;function updateGlobalBufferViews(){Module[\"HEAP8\"]=HEAP8=new Int8Array(buffer);Module[\"HEAP16\"]=HEAP16=new Int16Array(buffer);Module[\"HEAP32\"]=HEAP32=new Int32Array(buffer);Module[\"HEAPU8\"]=HEAPU8=new Uint8Array(buffer);Module[\"HEAPU16\"]=HEAPU16=new Uint16Array(buffer);Module[\"HEAPU32\"]=HEAPU32=new Uint32Array(buffer);Module[\"HEAPF32\"]=HEAPF32=new Float32Array(buffer);Module[\"HEAPF64\"]=HEAPF64=new Float64Array(buffer)}var STACK_BASE=22720,STACK_MAX=5265600,DYNAMIC_BASE=5265600,DYNAMICTOP_PTR=22464;assert(STACK_BASE%16===0,\"stack must start aligned\");assert(DYNAMIC_BASE%16===0,\"heap must start aligned\");var TOTAL_STACK=5242880;if(Module[\"TOTAL_STACK\"])assert(TOTAL_STACK===Module[\"TOTAL_STACK\"],\"the stack size can no longer be determined at runtime\");var INITIAL_TOTAL_MEMORY=Module[\"TOTAL_MEMORY\"]||16777216;if(INITIAL_TOTAL_MEMORY>2]=DYNAMIC_BASE;function writeStackCookie(){assert((STACK_MAX&3)==0);HEAPU32[(STACK_MAX>>2)-1]=34821223;HEAPU32[(STACK_MAX>>2)-2]=2310721022}function checkStackCookie(){if(HEAPU32[(STACK_MAX>>2)-1]!=34821223||HEAPU32[(STACK_MAX>>2)-2]!=2310721022){abort(\"Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x02135467, but received 0x\"+HEAPU32[(STACK_MAX>>2)-2].toString(16)+\" \"+HEAPU32[(STACK_MAX>>2)-1].toString(16))}if(HEAP32[0]!==1668509029)throw\"Runtime error: The application has corrupted its heap memory area (address zero)!\"}function abortStackOverflow(allocSize){abort(\"Stack overflow! Attempted to allocate \"+allocSize+\" bytes on the stack, but stack has only \"+(STACK_MAX-stackSave()+allocSize)+\" bytes available!\")}HEAP32[0]=1668509029;HEAP16[1]=25459;if(HEAPU8[2]!==115||HEAPU8[3]!==99)throw\"Runtime error: expected the system to be little-endian!\";function callRuntimeCallbacks(callbacks){while(callbacks.length>0){var callback=callbacks.shift();if(typeof callback==\"function\"){callback();continue}var func=callback.func;if(typeof func===\"number\"){if(callback.arg===undefined){Module[\"dynCall_v\"](func)}else{Module[\"dynCall_vi\"](func,callback.arg)}}else{func(callback.arg===undefined?null:callback.arg)}}}var __ATPRERUN__=[];var __ATINIT__=[];var __ATMAIN__=[];var __ATPOSTRUN__=[];var runtimeInitialized=false;var runtimeExited=false;function preRun(){if(Module[\"preRun\"]){if(typeof Module[\"preRun\"]==\"function\")Module[\"preRun\"]=[Module[\"preRun\"]];while(Module[\"preRun\"].length){addOnPreRun(Module[\"preRun\"].shift())}}callRuntimeCallbacks(__ATPRERUN__)}function ensureInitRuntime(){checkStackCookie();if(runtimeInitialized)return;runtimeInitialized=true;if(!Module[\"noFSInit\"]&&!FS.init.initialized)FS.init();TTY.init();callRuntimeCallbacks(__ATINIT__)}function preMain(){checkStackCookie();FS.ignorePermissions=false;callRuntimeCallbacks(__ATMAIN__)}function postRun(){checkStackCookie();if(Module[\"postRun\"]){if(typeof Module[\"postRun\"]==\"function\")Module[\"postRun\"]=[Module[\"postRun\"]];while(Module[\"postRun\"].length){addOnPostRun(Module[\"postRun\"].shift())}}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(cb){__ATPRERUN__.unshift(cb)}function addOnPostRun(cb){__ATPOSTRUN__.unshift(cb)}function unSign(value,bits,ignore){if(value>=0){return value}return bits<=32?2*Math.abs(1<=0){err(\"Memory size incompatibility issues may be due to changing TOTAL_MEMORY at runtime to something too large. Use ALLOW_MEMORY_GROWTH to allow any size memory (and also make sure not to set TOTAL_MEMORY at runtime to something smaller than it was at compile time).\")}return false}receiveInstance(instance,module);return Module[\"asm\"]}Module[\"asm\"]=function(global,env,providedBuffer){env[\"memory\"]=wasmMemory;env[\"table\"]=wasmTable=new WebAssembly.Table({\"initial\":55,\"maximum\":55,\"element\":\"anyfunc\"});env[\"__memory_base\"]=1024;env[\"__table_base\"]=0;var exports=createWasm(env);assert(exports,\"binaryen setup failed (no wasm support?)\");return exports};__ATINIT__.push({func:function(){___emscripten_environ_constructor()}});var tempDoublePtr=22704;assert(tempDoublePtr%8==0);var ENV={};function ___buildEnvironment(environ){var MAX_ENV_VALUES=64;var TOTAL_ENV_SIZE=1024;var poolPtr;var envPtr;if(!___buildEnvironment.called){___buildEnvironment.called=true;ENV[\"USER\"]=ENV[\"LOGNAME\"]=\"web_user\";ENV[\"PATH\"]=\"/\";ENV[\"PWD\"]=\"/\";ENV[\"HOME\"]=\"/home/web_user\";ENV[\"LANG\"]=\"C.UTF-8\";ENV[\"_\"]=Module[\"thisProgram\"];poolPtr=getMemory(TOTAL_ENV_SIZE);envPtr=getMemory(MAX_ENV_VALUES*4);SAFE_HEAP_STORE(envPtr|0,poolPtr|0,4);SAFE_HEAP_STORE(environ|0,envPtr|0,4)}else{envPtr=SAFE_HEAP_LOAD(environ|0,4,0)|0;poolPtr=SAFE_HEAP_LOAD(envPtr|0,4,0)|0}var strings=[];var totalSize=0;for(var key in ENV){if(typeof ENV[key]===\"string\"){var line=key+\"=\"+ENV[key];strings.push(line);totalSize+=line.length}}if(totalSize>TOTAL_ENV_SIZE){throw new Error(\"Environment size exceeded TOTAL_ENV_SIZE!\")}var ptrSize=4;for(var i=0;i=0;i--){var last=parts[i];if(last===\".\"){parts.splice(i,1)}else if(last===\"..\"){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up;up--){parts.unshift(\"..\")}}return parts},normalize:function(path){var isAbsolute=path.charAt(0)===\"/\",trailingSlash=path.substr(-1)===\"/\";path=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),!isAbsolute).join(\"/\");if(!path&&!isAbsolute){path=\".\"}if(path&&trailingSlash){path+=\"/\"}return(isAbsolute?\"/\":\"\")+path},dirname:function(path){var result=PATH.splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return\".\"}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir},basename:function(path){if(path===\"/\")return\"/\";var lastSlash=path.lastIndexOf(\"/\");if(lastSlash===-1)return path;return path.substr(lastSlash+1)},extname:function(path){return PATH.splitPath(path)[3]},join:function(){var paths=Array.prototype.slice.call(arguments,0);return PATH.normalize(paths.join(\"/\"))},join2:function(l,r){return PATH.normalize(l+\"/\"+r)},resolve:function(){var resolvedPath=\"\",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:FS.cwd();if(typeof path!==\"string\"){throw new TypeError(\"Arguments to path.resolve must be strings\")}else if(!path){return\"\"}resolvedPath=path+\"/\"+resolvedPath;resolvedAbsolute=path.charAt(0)===\"/\"}resolvedPath=PATH.normalizeArray(resolvedPath.split(\"/\").filter(function(p){return!!p}),!resolvedAbsolute).join(\"/\");return(resolvedAbsolute?\"/\":\"\")+resolvedPath||\".\"},relative:function(from,to){from=PATH.resolve(from).substr(1);to=PATH.resolve(to).substr(1);function trim(arr){var start=0;for(;start=0;end--){if(arr[end]!==\"\")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split(\"/\"));var toParts=trim(to.split(\"/\"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i0){result=buf.slice(0,bytesRead).toString(\"utf-8\")}else{result=null}}else if(typeof window!=\"undefined\"&&typeof window.prompt==\"function\"){result=window.prompt(\"Input: \");if(result!==null){result+=\"\\n\"}}else if(typeof readline==\"function\"){result=readline();if(result!==null){result+=\"\\n\"}}if(!result){return null}tty.input=intArrayFromString(result,true)}return tty.input.shift()},put_char:function(tty,val){if(val===null||val===10){out(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){out(UTF8ArrayToString(tty.output,0));tty.output=[]}}},default_tty1_ops:{put_char:function(tty,val){if(val===null||val===10){err(UTF8ArrayToString(tty.output,0));tty.output=[]}else{if(val!=0)tty.output.push(val)}},flush:function(tty){if(tty.output&&tty.output.length>0){err(UTF8ArrayToString(tty.output,0));tty.output=[]}}}};var MEMFS={ops_table:null,mount:function(mount){return MEMFS.createNode(null,\"/\",16384|511,0)},createNode:function(parent,name,mode,dev){if(FS.isBlkdev(mode)||FS.isFIFO(mode)){throw new FS.ErrnoError(ERRNO_CODES.EPERM)}if(!MEMFS.ops_table){MEMFS.ops_table={dir:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,lookup:MEMFS.node_ops.lookup,mknod:MEMFS.node_ops.mknod,rename:MEMFS.node_ops.rename,unlink:MEMFS.node_ops.unlink,rmdir:MEMFS.node_ops.rmdir,readdir:MEMFS.node_ops.readdir,symlink:MEMFS.node_ops.symlink},stream:{llseek:MEMFS.stream_ops.llseek}},file:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:{llseek:MEMFS.stream_ops.llseek,read:MEMFS.stream_ops.read,write:MEMFS.stream_ops.write,allocate:MEMFS.stream_ops.allocate,mmap:MEMFS.stream_ops.mmap,msync:MEMFS.stream_ops.msync}},link:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr,readlink:MEMFS.node_ops.readlink},stream:{}},chrdev:{node:{getattr:MEMFS.node_ops.getattr,setattr:MEMFS.node_ops.setattr},stream:FS.chrdev_stream_ops}}}var node=FS.createNode(parent,name,mode,dev);if(FS.isDir(node.mode)){node.node_ops=MEMFS.ops_table.dir.node;node.stream_ops=MEMFS.ops_table.dir.stream;node.contents={}}else if(FS.isFile(node.mode)){node.node_ops=MEMFS.ops_table.file.node;node.stream_ops=MEMFS.ops_table.file.stream;node.usedBytes=0;node.contents=null}else if(FS.isLink(node.mode)){node.node_ops=MEMFS.ops_table.link.node;node.stream_ops=MEMFS.ops_table.link.stream}else if(FS.isChrdev(node.mode)){node.node_ops=MEMFS.ops_table.chrdev.node;node.stream_ops=MEMFS.ops_table.chrdev.stream}node.timestamp=Date.now();if(parent){parent.contents[name]=node}return node},getFileDataAsRegularArray:function(node){if(node.contents&&node.contents.subarray){var arr=[];for(var i=0;i=newCapacity)return;var CAPACITY_DOUBLING_MAX=1024*1024;newCapacity=Math.max(newCapacity,prevCapacity*(prevCapacity0)node.contents.set(oldContents.subarray(0,node.usedBytes),0);return},resizeFileStorage:function(node,newSize){if(node.usedBytes==newSize)return;if(newSize==0){node.contents=null;node.usedBytes=0;return}if(!node.contents||node.contents.subarray){var oldContents=node.contents;node.contents=new Uint8Array(new ArrayBuffer(newSize));if(oldContents){node.contents.set(oldContents.subarray(0,Math.min(newSize,node.usedBytes)))}node.usedBytes=newSize;return}if(!node.contents)node.contents=[];if(node.contents.length>newSize)node.contents.length=newSize;else while(node.contents.length=stream.node.usedBytes)return 0;var size=Math.min(stream.node.usedBytes-position,length);assert(size>=0);if(size>8&&contents.subarray){buffer.set(contents.subarray(position,position+size),offset)}else{for(var i=0;i0||position+length>2}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return stat.mode},realPath:function(node){var parts=[];while(node.parent!==node){parts.push(node.name);node=node.parent}parts.push(node.mount.opts.root);parts.reverse();return PATH.join.apply(null,parts)},flagsForNode:function(flags){flags&=~2097152;flags&=~2048;flags&=~32768;flags&=~524288;var newFlags=0;for(var k in NODEFS.flagsForNodeMap){if(flags&k){newFlags|=NODEFS.flagsForNodeMap[k];flags^=k}}if(!flags){return newFlags}else{throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}},node_ops:{getattr:function(node){var path=NODEFS.realPath(node);var stat;try{stat=fs.lstatSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}if(NODEFS.isWindows&&!stat.blksize){stat.blksize=4096}if(NODEFS.isWindows&&!stat.blocks){stat.blocks=(stat.size+stat.blksize-1)/stat.blksize|0}return{dev:stat.dev,ino:stat.ino,mode:stat.mode,nlink:stat.nlink,uid:stat.uid,gid:stat.gid,rdev:stat.rdev,size:stat.size,atime:stat.atime,mtime:stat.mtime,ctime:stat.ctime,blksize:stat.blksize,blocks:stat.blocks}},setattr:function(node,attr){var path=NODEFS.realPath(node);try{if(attr.mode!==undefined){fs.chmodSync(path,attr.mode);node.mode=attr.mode}if(attr.timestamp!==undefined){var date=new Date(attr.timestamp);fs.utimesSync(path,date,date)}if(attr.size!==undefined){fs.truncateSync(path,attr.size)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},lookup:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);var mode=NODEFS.getMode(path);return NODEFS.createNode(parent,name,mode)},mknod:function(parent,name,mode,dev){var node=NODEFS.createNode(parent,name,mode,dev);var path=NODEFS.realPath(node);try{if(FS.isDir(node.mode)){fs.mkdirSync(path,node.mode)}else{fs.writeFileSync(path,\"\",{mode:node.mode})}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}return node},rename:function(oldNode,newDir,newName){var oldPath=NODEFS.realPath(oldNode);var newPath=PATH.join2(NODEFS.realPath(newDir),newName);try{fs.renameSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},unlink:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.unlinkSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},rmdir:function(parent,name){var path=PATH.join2(NODEFS.realPath(parent),name);try{fs.rmdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readdir:function(node){var path=NODEFS.realPath(node);try{return fs.readdirSync(path)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},symlink:function(parent,newName,oldPath){var newPath=PATH.join2(NODEFS.realPath(parent),newName);try{fs.symlinkSync(oldPath,newPath)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},readlink:function(node){var path=NODEFS.realPath(node);try{path=fs.readlinkSync(path);path=NODEJS_PATH.relative(NODEJS_PATH.resolve(node.mount.opts.root),path);return path}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}},stream_ops:{open:function(stream){var path=NODEFS.realPath(stream.node);try{if(FS.isFile(stream.node.mode)){stream.nfd=fs.openSync(path,NODEFS.flagsForNode(stream.flags))}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},close:function(stream){try{if(FS.isFile(stream.node.mode)&&stream.nfd){fs.closeSync(stream.nfd)}}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}},read:function(stream,buffer,offset,length,position){if(length===0)return 0;try{return fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}},write:function(stream,buffer,offset,length,position){try{return fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position)}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}},llseek:function(stream,offset,whence){var position=offset;if(whence===1){position+=stream.position}else if(whence===2){if(FS.isFile(stream.node.mode)){try{var stat=fs.fstatSync(stream.nfd);position+=stat.size}catch(e){throw new FS.ErrnoError(ERRNO_CODES[e.code])}}}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}return position}}};var ERRNO_CODES={EPERM:1,ENOENT:2,ESRCH:3,EINTR:4,EIO:5,ENXIO:6,E2BIG:7,ENOEXEC:8,EBADF:9,ECHILD:10,EAGAIN:11,EWOULDBLOCK:11,ENOMEM:12,EACCES:13,EFAULT:14,ENOTBLK:15,EBUSY:16,EEXIST:17,EXDEV:18,ENODEV:19,ENOTDIR:20,EISDIR:21,EINVAL:22,ENFILE:23,EMFILE:24,ENOTTY:25,ETXTBSY:26,EFBIG:27,ENOSPC:28,ESPIPE:29,EROFS:30,EMLINK:31,EPIPE:32,EDOM:33,ERANGE:34,ENOMSG:42,EIDRM:43,ECHRNG:44,EL2NSYNC:45,EL3HLT:46,EL3RST:47,ELNRNG:48,EUNATCH:49,ENOCSI:50,EL2HLT:51,EDEADLK:35,ENOLCK:37,EBADE:52,EBADR:53,EXFULL:54,ENOANO:55,EBADRQC:56,EBADSLT:57,EDEADLOCK:35,EBFONT:59,ENOSTR:60,ENODATA:61,ETIME:62,ENOSR:63,ENONET:64,ENOPKG:65,EREMOTE:66,ENOLINK:67,EADV:68,ESRMNT:69,ECOMM:70,EPROTO:71,EMULTIHOP:72,EDOTDOT:73,EBADMSG:74,ENOTUNIQ:76,EBADFD:77,EREMCHG:78,ELIBACC:79,ELIBBAD:80,ELIBSCN:81,ELIBMAX:82,ELIBEXEC:83,ENOSYS:38,ENOTEMPTY:39,ENAMETOOLONG:36,ELOOP:40,EOPNOTSUPP:95,EPFNOSUPPORT:96,ECONNRESET:104,ENOBUFS:105,EAFNOSUPPORT:97,EPROTOTYPE:91,ENOTSOCK:88,ENOPROTOOPT:92,ESHUTDOWN:108,ECONNREFUSED:111,EADDRINUSE:98,ECONNABORTED:103,ENETUNREACH:101,ENETDOWN:100,ETIMEDOUT:110,EHOSTDOWN:112,EHOSTUNREACH:113,EINPROGRESS:115,EALREADY:114,EDESTADDRREQ:89,EMSGSIZE:90,EPROTONOSUPPORT:93,ESOCKTNOSUPPORT:94,EADDRNOTAVAIL:99,ENETRESET:102,EISCONN:106,ENOTCONN:107,ETOOMANYREFS:109,EUSERS:87,EDQUOT:122,ESTALE:116,ENOTSUP:95,ENOMEDIUM:123,EILSEQ:84,EOVERFLOW:75,ECANCELED:125,ENOTRECOVERABLE:131,EOWNERDEAD:130,ESTRPIPE:86};var NODERAWFS={lookupPath:function(path){return{path:path,node:{mode:NODEFS.getMode(path)}}},createStandardStreams:function(){FS.streams[0]={fd:0,nfd:0,position:0,path:\"\",flags:0,tty:true,seekable:false};for(var i=1;i<3;i++){FS.streams[i]={fd:i,nfd:i,position:0,path:\"\",flags:577,tty:true,seekable:false}}},cwd:function(){return process.cwd()},chdir:function(){process.chdir.apply(void 0,arguments)},mknod:function(path,mode){if(FS.isDir(path)){fs.mkdirSync(path,mode)}else{fs.writeFileSync(path,\"\",{mode:mode})}},mkdir:function(){fs.mkdirSync.apply(void 0,arguments)},symlink:function(){fs.symlinkSync.apply(void 0,arguments)},rename:function(){fs.renameSync.apply(void 0,arguments)},rmdir:function(){fs.rmdirSync.apply(void 0,arguments)},readdir:function(){fs.readdirSync.apply(void 0,arguments)},unlink:function(){fs.unlinkSync.apply(void 0,arguments)},readlink:function(){return fs.readlinkSync.apply(void 0,arguments)},stat:function(){return fs.statSync.apply(void 0,arguments)},lstat:function(){return fs.lstatSync.apply(void 0,arguments)},chmod:function(){fs.chmodSync.apply(void 0,arguments)},fchmod:function(){fs.fchmodSync.apply(void 0,arguments)},chown:function(){fs.chownSync.apply(void 0,arguments)},fchown:function(){fs.fchownSync.apply(void 0,arguments)},truncate:function(){fs.truncateSync.apply(void 0,arguments)},ftruncate:function(){fs.ftruncateSync.apply(void 0,arguments)},utime:function(){fs.utimesSync.apply(void 0,arguments)},open:function(path,flags,mode,suggestFD){if(typeof flags===\"string\"){flags=VFS.modeStringToFlags(flags)}var nfd=fs.openSync(path,NODEFS.flagsForNode(flags),mode);var fd=suggestFD!=null?suggestFD:FS.nextfd(nfd);var stream={fd:fd,nfd:nfd,position:0,path:path,flags:flags,seekable:true};FS.streams[fd]=stream;return stream},close:function(stream){if(!stream.stream_ops){fs.closeSync(stream.nfd)}FS.closeStream(stream.fd)},llseek:function(stream,offset,whence){if(stream.stream_ops){return VFS.llseek(stream,offset,whence)}var position=offset;if(whence===1){position+=stream.position}else if(whence===2){position+=fs.fstatSync(stream.nfd).size}else if(whence!==0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}if(position<0){throw new FS.ErrnoError(ERRNO_CODES.EINVAL)}stream.position=position;return position},read:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.read(stream,buffer,offset,length,position)}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesRead=fs.readSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesRead;return bytesRead},write:function(stream,buffer,offset,length,position){if(stream.stream_ops){return VFS.write(stream,buffer,offset,length,position)}if(stream.flags&+\"1024\"){FS.llseek(stream,0,+\"2\")}var seeking=typeof position!==\"undefined\";if(!seeking&&stream.seekable)position=stream.position;var bytesWritten=fs.writeSync(stream.nfd,NODEFS.bufferFrom(buffer.buffer),offset,length,position);if(!seeking)stream.position+=bytesWritten;return bytesWritten},allocate:function(){throw new FS.ErrnoError(ERRNO_CODES.EOPNOTSUPP)},mmap:function(){throw new FS.ErrnoError(ERRNO_CODES.ENODEV)},msync:function(){return 0},munmap:function(){return 0},ioctl:function(){throw new FS.ErrnoError(ERRNO_CODES.ENOTTY)}};var ERRNO_MESSAGES={0:\"Success\",1:\"Not super-user\",2:\"No such file or directory\",3:\"No such process\",4:\"Interrupted system call\",5:\"I/O error\",6:\"No such device or address\",7:\"Arg list too long\",8:\"Exec format error\",9:\"Bad file number\",10:\"No children\",11:\"No more processes\",12:\"Not enough core\",13:\"Permission denied\",14:\"Bad address\",15:\"Block device required\",16:\"Mount device busy\",17:\"File exists\",18:\"Cross-device link\",19:\"No such device\",20:\"Not a directory\",21:\"Is a directory\",22:\"Invalid argument\",23:\"Too many open files in system\",24:\"Too many open files\",25:\"Not a typewriter\",26:\"Text file busy\",27:\"File too large\",28:\"No space left on device\",29:\"Illegal seek\",30:\"Read only file system\",31:\"Too many links\",32:\"Broken pipe\",33:\"Math arg out of domain of func\",34:\"Math result not representable\",35:\"File locking deadlock error\",36:\"File or path name too long\",37:\"No record locks available\",38:\"Function not implemented\",39:\"Directory not empty\",40:\"Too many symbolic links\",42:\"No message of desired type\",43:\"Identifier removed\",44:\"Channel number out of range\",45:\"Level 2 not synchronized\",46:\"Level 3 halted\",47:\"Level 3 reset\",48:\"Link number out of range\",49:\"Protocol driver not attached\",50:\"No CSI structure available\",51:\"Level 2 halted\",52:\"Invalid exchange\",53:\"Invalid request descriptor\",54:\"Exchange full\",55:\"No anode\",56:\"Invalid request code\",57:\"Invalid slot\",59:\"Bad font file fmt\",60:\"Device not a stream\",61:\"No data (for no delay io)\",62:\"Timer expired\",63:\"Out of streams resources\",64:\"Machine is not on the network\",65:\"Package not installed\",66:\"The object is remote\",67:\"The link has been severed\",68:\"Advertise error\",69:\"Srmount error\",70:\"Communication error on send\",71:\"Protocol error\",72:\"Multihop attempted\",73:\"Cross mount point (not really error)\",74:\"Trying to read unreadable message\",75:\"Value too large for defined data type\",76:\"Given log. name not unique\",77:\"f.d. invalid for this operation\",78:\"Remote address changed\",79:\"Can access a needed shared lib\",80:\"Accessing a corrupted shared lib\",81:\".lib section in a.out corrupted\",82:\"Attempting to link in too many libs\",83:\"Attempting to exec a shared library\",84:\"Illegal byte sequence\",86:\"Streams pipe error\",87:\"Too many users\",88:\"Socket operation on non-socket\",89:\"Destination address required\",90:\"Message too long\",91:\"Protocol wrong type for socket\",92:\"Protocol not available\",93:\"Unknown protocol\",94:\"Socket type not supported\",95:\"Not supported\",96:\"Protocol family not supported\",97:\"Address family not supported by protocol family\",98:\"Address already in use\",99:\"Address not available\",100:\"Network interface is not configured\",101:\"Network is unreachable\",102:\"Connection reset by network\",103:\"Connection aborted\",104:\"Connection reset by peer\",105:\"No buffer space available\",106:\"Socket is already connected\",107:\"Socket is not connected\",108:\"Can't send after socket shutdown\",109:\"Too many references\",110:\"Connection timed out\",111:\"Connection refused\",112:\"Host is down\",113:\"Host is unreachable\",114:\"Socket already connected\",115:\"Connection already in progress\",116:\"Stale file handle\",122:\"Quota exceeded\",123:\"No medium (in tape drive)\",125:\"Operation canceled\",130:\"Previous owner died\",131:\"State not recoverable\"};var FS={root:null,mounts:[],devices:{},streams:[],nextInode:1,nameTable:null,currentPath:\"/\",initialized:false,ignorePermissions:true,trackingDelegate:{},tracking:{openFlags:{READ:1,WRITE:2}},ErrnoError:null,genericErrors:{},filesystems:null,syncFSRequests:0,handleFSError:function(e){if(!(e instanceof FS.ErrnoError))throw e+\" : \"+stackTrace();return ___setErrNo(e.errno)},lookupPath:function(path,opts){path=PATH.resolve(FS.cwd(),path);opts=opts||{};if(!path)return{path:\"\",node:null};var defaults={follow_mount:true,recurse_count:0};for(var key in defaults){if(opts[key]===undefined){opts[key]=defaults[key]}}if(opts.recurse_count>8){throw new FS.ErrnoError(40)}var parts=PATH.normalizeArray(path.split(\"/\").filter(function(p){return!!p}),false);var current=FS.root;var current_path=\"/\";for(var i=0;i40){throw new FS.ErrnoError(40)}}}}return{path:current_path,node:current}},getPath:function(node){var path;while(true){if(FS.isRoot(node)){var mount=node.mount.mountpoint;if(!path)return mount;return mount[mount.length-1]!==\"/\"?mount+\"/\"+path:mount+path}path=path?node.name+\"/\"+path:node.name;node=node.parent}},hashName:function(parentid,name){var hash=0;for(var i=0;i>>0)%FS.nameTable.length},hashAddNode:function(node){var hash=FS.hashName(node.parent.id,node.name);node.name_next=FS.nameTable[hash];FS.nameTable[hash]=node},hashRemoveNode:function(node){var hash=FS.hashName(node.parent.id,node.name);if(FS.nameTable[hash]===node){FS.nameTable[hash]=node.name_next}else{var current=FS.nameTable[hash];while(current){if(current.name_next===node){current.name_next=node.name_next;break}current=current.name_next}}},lookupNode:function(parent,name){var err=FS.mayLookup(parent);if(err){throw new FS.ErrnoError(err,parent)}var hash=FS.hashName(parent.id,name);for(var node=FS.nameTable[hash];node;node=node.name_next){var nodeName=node.name;if(node.parent.id===parent.id&&nodeName===name){return node}}return FS.lookup(parent,name)},createNode:function(parent,name,mode,rdev){if(!FS.FSNode){FS.FSNode=function(parent,name,mode,rdev){if(!parent){parent=this}this.parent=parent;this.mount=parent.mount;this.mounted=null;this.id=FS.nextInode++;this.name=name;this.mode=mode;this.node_ops={};this.stream_ops={};this.rdev=rdev};FS.FSNode.prototype={};var readMode=292|73;var writeMode=146;Object.defineProperties(FS.FSNode.prototype,{read:{get:function(){return(this.mode&readMode)===readMode},set:function(val){val?this.mode|=readMode:this.mode&=~readMode}},write:{get:function(){return(this.mode&writeMode)===writeMode},set:function(val){val?this.mode|=writeMode:this.mode&=~writeMode}},isFolder:{get:function(){return FS.isDir(this.mode)}},isDevice:{get:function(){return FS.isChrdev(this.mode)}}})}var node=new FS.FSNode(parent,name,mode,rdev);FS.hashAddNode(node);return node},destroyNode:function(node){FS.hashRemoveNode(node)},isRoot:function(node){return node===node.parent},isMountpoint:function(node){return!!node.mounted},isFile:function(mode){return(mode&61440)===32768},isDir:function(mode){return(mode&61440)===16384},isLink:function(mode){return(mode&61440)===40960},isChrdev:function(mode){return(mode&61440)===8192},isBlkdev:function(mode){return(mode&61440)===24576},isFIFO:function(mode){return(mode&61440)===4096},isSocket:function(mode){return(mode&49152)===49152},flagModes:{\"r\":0,\"rs\":1052672,\"r+\":2,\"w\":577,\"wx\":705,\"xw\":705,\"w+\":578,\"wx+\":706,\"xw+\":706,\"a\":1089,\"ax\":1217,\"xa\":1217,\"a+\":1090,\"ax+\":1218,\"xa+\":1218},modeStringToFlags:function(str){var flags=FS.flagModes[str];if(typeof flags===\"undefined\"){throw new Error(\"Unknown file open mode: \"+str)}return flags},flagsToPermissionString:function(flag){var perms=[\"r\",\"w\",\"rw\"][flag&3];if(flag&512){perms+=\"w\"}return perms},nodePermissions:function(node,perms){if(FS.ignorePermissions){return 0}if(perms.indexOf(\"r\")!==-1&&!(node.mode&292)){return 13}else if(perms.indexOf(\"w\")!==-1&&!(node.mode&146)){return 13}else if(perms.indexOf(\"x\")!==-1&&!(node.mode&73)){return 13}return 0},mayLookup:function(dir){var err=FS.nodePermissions(dir,\"x\");if(err)return err;if(!dir.node_ops.lookup)return 13;return 0},mayCreate:function(dir,name){try{var node=FS.lookupNode(dir,name);return 17}catch(e){}return FS.nodePermissions(dir,\"wx\")},mayDelete:function(dir,name,isdir){var node;try{node=FS.lookupNode(dir,name)}catch(e){return e.errno}var err=FS.nodePermissions(dir,\"wx\");if(err){return err}if(isdir){if(!FS.isDir(node.mode)){return 20}if(FS.isRoot(node)||FS.getPath(node)===FS.cwd()){return 16}}else{if(FS.isDir(node.mode)){return 21}}return 0},mayOpen:function(node,flags){if(!node){return 2}if(FS.isLink(node.mode)){return 40}else if(FS.isDir(node.mode)){if(FS.flagsToPermissionString(flags)!==\"r\"||flags&512){return 21}}return FS.nodePermissions(node,FS.flagsToPermissionString(flags))},MAX_OPEN_FDS:4096,nextfd:function(fd_start,fd_end){fd_start=fd_start||0;fd_end=fd_end||FS.MAX_OPEN_FDS;for(var fd=fd_start;fd<=fd_end;fd++){if(!FS.streams[fd]){return fd}}throw new FS.ErrnoError(24)},getStream:function(fd){return FS.streams[fd]},createStream:function(stream,fd_start,fd_end){if(!FS.FSStream){FS.FSStream=function(){};FS.FSStream.prototype={};Object.defineProperties(FS.FSStream.prototype,{object:{get:function(){return this.node},set:function(val){this.node=val}},isRead:{get:function(){return(this.flags&2097155)!==1}},isWrite:{get:function(){return(this.flags&2097155)!==0}},isAppend:{get:function(){return this.flags&1024}}})}var newStream=new FS.FSStream;for(var p in stream){newStream[p]=stream[p]}stream=newStream;var fd=FS.nextfd(fd_start,fd_end);stream.fd=fd;FS.streams[fd]=stream;return stream},closeStream:function(fd){FS.streams[fd]=null},chrdev_stream_ops:{open:function(stream){var device=FS.getDevice(stream.node.rdev);stream.stream_ops=device.stream_ops;if(stream.stream_ops.open){stream.stream_ops.open(stream)}},llseek:function(){throw new FS.ErrnoError(29)}},major:function(dev){return dev>>8},minor:function(dev){return dev&255},makedev:function(ma,mi){return ma<<8|mi},registerDevice:function(dev,ops){FS.devices[dev]={stream_ops:ops}},getDevice:function(dev){return FS.devices[dev]},getMounts:function(mount){var mounts=[];var check=[mount];while(check.length){var m=check.pop();mounts.push(m);check.push.apply(check,m.mounts)}return mounts},syncfs:function(populate,callback){if(typeof populate===\"function\"){callback=populate;populate=false}FS.syncFSRequests++;if(FS.syncFSRequests>1){console.log(\"warning: \"+FS.syncFSRequests+\" FS.syncfs operations in flight at once, probably just doing extra work\")}var mounts=FS.getMounts(FS.root.mount);var completed=0;function doCallback(err){assert(FS.syncFSRequests>0);FS.syncFSRequests--;return callback(err)}function done(err){if(err){if(!done.errored){done.errored=true;return doCallback(err)}return}if(++completed>=mounts.length){doCallback(null)}}mounts.forEach(function(mount){if(!mount.type.syncfs){return done(null)}mount.type.syncfs(mount,populate,done)})},mount:function(type,opts,mountpoint){var root=mountpoint===\"/\";var pseudo=!mountpoint;var node;if(root&&FS.root){throw new FS.ErrnoError(16)}else if(!root&&!pseudo){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});mountpoint=lookup.path;node=lookup.node;if(FS.isMountpoint(node)){throw new FS.ErrnoError(16)}if(!FS.isDir(node.mode)){throw new FS.ErrnoError(20)}}var mount={type:type,opts:opts,mountpoint:mountpoint,mounts:[]};var mountRoot=type.mount(mount);mountRoot.mount=mount;mount.root=mountRoot;if(root){FS.root=mountRoot}else if(node){node.mounted=mount;if(node.mount){node.mount.mounts.push(mount)}}return mountRoot},unmount:function(mountpoint){var lookup=FS.lookupPath(mountpoint,{follow_mount:false});if(!FS.isMountpoint(lookup.node)){throw new FS.ErrnoError(22)}var node=lookup.node;var mount=node.mounted;var mounts=FS.getMounts(mount);Object.keys(FS.nameTable).forEach(function(hash){var current=FS.nameTable[hash];while(current){var next=current.name_next;if(mounts.indexOf(current.mount)!==-1){FS.destroyNode(current)}current=next}});node.mounted=null;var idx=node.mount.mounts.indexOf(mount);assert(idx!==-1);node.mount.mounts.splice(idx,1)},lookup:function(parent,name){return parent.node_ops.lookup(parent,name)},mknod:function(path,mode,dev){var lookup=FS.lookupPath(path,{parent:true});var parent=lookup.node;var name=PATH.basename(path);if(!name||name===\".\"||name===\"..\"){throw new FS.ErrnoError(22)}var err=FS.mayCreate(parent,name);if(err){throw new FS.ErrnoError(err)}if(!parent.node_ops.mknod){throw new FS.ErrnoError(1)}return parent.node_ops.mknod(parent,name,mode,dev)},create:function(path,mode){mode=mode!==undefined?mode:438;mode&=4095;mode|=32768;return FS.mknod(path,mode,0)},mkdir:function(path,mode){mode=mode!==undefined?mode:511;mode&=511|512;mode|=16384;return FS.mknod(path,mode,0)},mkdirTree:function(path,mode){var dirs=path.split(\"/\");var d=\"\";for(var i=0;i\"})},staticInit:function(){FS.ensureErrnoError();FS.nameTable=new Array(4096);FS.mount(MEMFS,{},\"/\");FS.createDefaultDirectories();FS.createDefaultDevices();FS.createSpecialDirectories();FS.filesystems={\"MEMFS\":MEMFS,\"NODEFS\":NODEFS}},init:function(input,output,error){assert(!FS.init.initialized,\"FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)\");FS.init.initialized=true;FS.ensureErrnoError();Module[\"stdin\"]=input||Module[\"stdin\"];Module[\"stdout\"]=output||Module[\"stdout\"];Module[\"stderr\"]=error||Module[\"stderr\"];FS.createStandardStreams()},quit:function(){FS.init.initialized=false;var fflush=Module[\"_fflush\"];if(fflush)fflush(0);for(var i=0;ithis.length-1||idx<0){return undefined}var chunkOffset=idx%this.chunkSize;var chunkNum=idx/this.chunkSize|0;return this.getter(chunkNum)[chunkOffset]};LazyUint8Array.prototype.setDataGetter=function LazyUint8Array_setDataGetter(getter){this.getter=getter};LazyUint8Array.prototype.cacheLength=function LazyUint8Array_cacheLength(){var xhr=new XMLHttpRequest;xhr.open(\"HEAD\",url,false);xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);var datalength=Number(xhr.getResponseHeader(\"Content-length\"));var header;var hasByteServing=(header=xhr.getResponseHeader(\"Accept-Ranges\"))&&header===\"bytes\";var usesGzip=(header=xhr.getResponseHeader(\"Content-Encoding\"))&&header===\"gzip\";var chunkSize=1024*1024;if(!hasByteServing)chunkSize=datalength;var doXHR=function(from,to){if(from>to)throw new Error(\"invalid range (\"+from+\", \"+to+\") or no bytes requested!\");if(to>datalength-1)throw new Error(\"only \"+datalength+\" bytes available! programmer error!\");var xhr=new XMLHttpRequest;xhr.open(\"GET\",url,false);if(datalength!==chunkSize)xhr.setRequestHeader(\"Range\",\"bytes=\"+from+\"-\"+to);if(typeof Uint8Array!=\"undefined\")xhr.responseType=\"arraybuffer\";if(xhr.overrideMimeType){xhr.overrideMimeType(\"text/plain; charset=x-user-defined\")}xhr.send(null);if(!(xhr.status>=200&&xhr.status<300||xhr.status===304))throw new Error(\"Couldn't load \"+url+\". Status: \"+xhr.status);if(xhr.response!==undefined){return new Uint8Array(xhr.response||[])}else{return intArrayFromString(xhr.responseText||\"\",true)}};var lazyArray=this;lazyArray.setDataGetter(function(chunkNum){var start=chunkNum*chunkSize;var end=(chunkNum+1)*chunkSize-1;end=Math.min(end,datalength-1);if(typeof lazyArray.chunks[chunkNum]===\"undefined\"){lazyArray.chunks[chunkNum]=doXHR(start,end)}if(typeof lazyArray.chunks[chunkNum]===\"undefined\")throw new Error(\"doXHR failed!\");return lazyArray.chunks[chunkNum]});if(usesGzip||!datalength){chunkSize=datalength=1;datalength=this.getter(0).length;chunkSize=datalength;console.log(\"LazyFiles on gzip forces download of the whole file when length is accessed\")}this._length=datalength;this._chunkSize=chunkSize;this.lengthKnown=true};if(typeof XMLHttpRequest!==\"undefined\"){if(!ENVIRONMENT_IS_WORKER)throw\"Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc\";var lazyArray=new LazyUint8Array;Object.defineProperties(lazyArray,{length:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._length}},chunkSize:{get:function(){if(!this.lengthKnown){this.cacheLength()}return this._chunkSize}}});var properties={isDevice:false,contents:lazyArray}}else{var properties={isDevice:false,url:url}}var node=FS.createFile(parent,name,properties,canRead,canWrite);if(properties.contents){node.contents=properties.contents}else if(properties.url){node.contents=null;node.url=properties.url}Object.defineProperties(node,{usedBytes:{get:function(){return this.contents.length}}});var stream_ops={};var keys=Object.keys(node.stream_ops);keys.forEach(function(key){var fn=node.stream_ops[key];stream_ops[key]=function forceLoadLazyFile(){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}return fn.apply(null,arguments)}});stream_ops.read=function stream_ops_read(stream,buffer,offset,length,position){if(!FS.forceLoadFile(node)){throw new FS.ErrnoError(5)}var contents=stream.node.contents;if(position>=contents.length)return 0;var size=Math.min(contents.length-position,length);assert(size>=0);if(contents.slice){for(var i=0;i=0)assert(high===0);else assert(high===-1);return low},getZero:function(){assert(SYSCALLS.get()===0)}};function ___syscall10(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.unlink(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall140(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),offset_high=SYSCALLS.get(),offset_low=SYSCALLS.get(),result=SYSCALLS.get(),whence=SYSCALLS.get();var offset=offset_low;FS.llseek(stream,offset,whence);SAFE_HEAP_STORE(result|0,stream.position|0,4);if(stream.getdents&&offset===0&&whence===0)stream.getdents=null;return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall145(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doReadv(stream,iov,iovcnt)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall146(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),iov=SYSCALLS.get(),iovcnt=SYSCALLS.get();return SYSCALLS.doWritev(stream,iov,iovcnt)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall15(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),mode=SYSCALLS.get();FS.chmod(path,mode);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall195(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,path,buf)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall197(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),buf=SYSCALLS.get();return SYSCALLS.doStat(FS.stat,stream.path,buf)}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall221(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),cmd=SYSCALLS.get();switch(cmd){case 0:{var arg=SYSCALLS.get();if(arg<0){return-ERRNO_CODES.EINVAL}var newStream;newStream=FS.open(stream.path,stream.flags,0,arg);return newStream.fd}case 1:case 2:return 0;case 3:return stream.flags;case 4:{var arg=SYSCALLS.get();stream.flags|=arg;return 0}case 12:{var arg=SYSCALLS.get();var offset=0;SAFE_HEAP_STORE(arg+offset|0,2|0,2);return 0}case 13:case 14:return 0;case 16:case 8:return-ERRNO_CODES.EINVAL;case 9:___setErrNo(ERRNO_CODES.EINVAL);return-1;default:{return-ERRNO_CODES.EINVAL}}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall38(which,varargs){SYSCALLS.varargs=varargs;try{var old_path=SYSCALLS.getStr(),new_path=SYSCALLS.getStr();FS.rename(old_path,new_path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall40(which,varargs){SYSCALLS.varargs=varargs;try{var path=SYSCALLS.getStr();FS.rmdir(path);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall5(which,varargs){SYSCALLS.varargs=varargs;try{var pathname=SYSCALLS.getStr(),flags=SYSCALLS.get(),mode=SYSCALLS.get();var stream=FS.open(pathname,flags,mode);return stream.fd}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall54(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD(),op=SYSCALLS.get();switch(op){case 21509:case 21505:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21510:case 21511:case 21512:case 21506:case 21507:case 21508:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21519:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;var argp=SYSCALLS.get();SAFE_HEAP_STORE(argp|0,0|0,4);return 0}case 21520:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return-ERRNO_CODES.EINVAL}case 21531:{var argp=SYSCALLS.get();return FS.ioctl(stream,op,argp)}case 21523:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}case 21524:{if(!stream.tty)return-ERRNO_CODES.ENOTTY;return 0}default:abort(\"bad ioctl syscall \"+op)}}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall6(which,varargs){SYSCALLS.varargs=varargs;try{var stream=SYSCALLS.getStreamFromFD();FS.close(stream);return 0}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___syscall60(which,varargs){SYSCALLS.varargs=varargs;try{var mask=SYSCALLS.get();var old=SYSCALLS.umask;SYSCALLS.umask=mask;return old}catch(e){if(typeof FS===\"undefined\"||!(e instanceof FS.ErrnoError))abort(e);return-e.errno}}function ___unlock(){}function _emscripten_get_heap_size(){return HEAP8.length}function abortOnCannotGrowMemory(requestedSize){abort(\"Cannot enlarge memory arrays to size \"+requestedSize+\" bytes (OOM). Either (1) compile with -s TOTAL_MEMORY=X with X higher than the current value \"+HEAP8.length+\", (2) compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the size at runtime, or (3) if you want malloc to return NULL (0) instead of this abort, compile with -s ABORTING_MALLOC=0 \")}function emscripten_realloc_buffer(size){var PAGE_MULTIPLE=65536;size=alignUp(size,PAGE_MULTIPLE);var oldSize=buffer.byteLength;try{var result=wasmMemory.grow((size-oldSize)/65536);if(result!==(-1|0)){return buffer=wasmMemory.buffer}else{return null}}catch(e){console.error(\"emscripten_realloc_buffer: Attempted to grow from \"+oldSize+\" bytes to \"+size+\" bytes, but got error: \"+e);return null}}function _emscripten_resize_heap(requestedSize){var oldSize=_emscripten_get_heap_size();assert(requestedSize>oldSize);var PAGE_MULTIPLE=65536;var LIMIT=2147483648-PAGE_MULTIPLE;if(requestedSize>LIMIT){err(\"Cannot enlarge memory, asked to go up to \"+requestedSize+\" bytes, but the limit is \"+LIMIT+\" bytes!\");return false}var MIN_TOTAL_MEMORY=16777216;var newSize=Math.max(oldSize,MIN_TOTAL_MEMORY);while(newSize0!=(dstOffset==guessedOffset)){var nonDstOffset=Math.max(winterOffset,summerOffset);var trueOffset=dst>0?dstOffset:nonDstOffset;date.setTime(date.getTime()+(trueOffset-guessedOffset)*6e4)}SAFE_HEAP_STORE(tmPtr+24|0,date.getDay()|0,4);var yday=(date.getTime()-start.getTime())/(1e3*60*60*24)|0;SAFE_HEAP_STORE(tmPtr+28|0,yday|0,4);return date.getTime()/1e3|0}function _time(ptr){var ret=Date.now()/1e3|0;if(ptr){SAFE_HEAP_STORE(ptr|0,ret|0,4)}return ret}if(ENVIRONMENT_IS_NODE){_emscripten_get_now=function _emscripten_get_now_actual(){var t=process[\"hrtime\"]();return t[0]*1e3+t[1]/1e6}}else if(typeof dateNow!==\"undefined\"){_emscripten_get_now=dateNow}else if(typeof performance===\"object\"&&performance&&typeof performance[\"now\"]===\"function\"){_emscripten_get_now=function(){return performance[\"now\"]()}}else{_emscripten_get_now=Date.now}FS.staticInit();if(ENVIRONMENT_IS_NODE){var fs=frozenFs;var NODEJS_PATH=__webpack_require__(4);NODEFS.staticInit()}if(ENVIRONMENT_IS_NODE){var _wrapNodeError=function(func){return function(){try{return func.apply(this,arguments)}catch(e){if(!e.code)throw e;throw new FS.ErrnoError(ERRNO_CODES[e.code])}}};var VFS=Object.assign({},FS);for(var _key in NODERAWFS)FS[_key]=_wrapNodeError(NODERAWFS[_key])}else{throw new Error(\"NODERAWFS is currently only supported on Node.js environment.\")}function intArrayFromString(stringy,dontAddNull,length){var len=length>0?length:lengthBytesUTF8(stringy)+1;var u8array=new Array(len);var numBytesWritten=stringToUTF8Array(stringy,u8array,0,u8array.length);if(dontAddNull)u8array.length=numBytesWritten;return u8array}var decodeBase64=typeof atob===\"function\"?atob:function(input){var keyStr=\"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\";var output=\"\";var chr1,chr2,chr3;var enc1,enc2,enc3,enc4;var i=0;input=input.replace(/[^A-Za-z0-9\\+\\/\\=]/g,\"\");do{enc1=keyStr.indexOf(input.charAt(i++));enc2=keyStr.indexOf(input.charAt(i++));enc3=keyStr.indexOf(input.charAt(i++));enc4=keyStr.indexOf(input.charAt(i++));chr1=enc1<<2|enc2>>4;chr2=(enc2&15)<<4|enc3>>2;chr3=(enc3&3)<<6|enc4;output=output+String.fromCharCode(chr1);if(enc3!==64){output=output+String.fromCharCode(chr2)}if(enc4!==64){output=output+String.fromCharCode(chr3)}}while(i0){return}writeStackCookie();preRun();if(runDependencies>0)return;if(Module[\"calledRun\"])return;function doRun(){if(Module[\"calledRun\"])return;Module[\"calledRun\"]=true;if(ABORT)return;ensureInitRuntime();preMain();if(Module[\"onRuntimeInitialized\"])Module[\"onRuntimeInitialized\"]();assert(!Module[\"_main\"],'compiled without a main, but one is present. if you added it from JS, use Module[\"onRuntimeInitialized\"]');postRun()}if(Module[\"setStatus\"]){Module[\"setStatus\"](\"Running...\");setTimeout(function(){setTimeout(function(){Module[\"setStatus\"](\"\")},1);doRun()},1)}else{doRun()}checkStackCookie()}Module[\"run\"]=run;var abortDecorators=[];function abort(what){if(Module[\"onAbort\"]){Module[\"onAbort\"](what)}if(what!==undefined){out(what);err(what);what=JSON.stringify(what)}else{what=\"\"}ABORT=true;EXITSTATUS=1;var extra=\"\";var output=\"abort(\"+what+\") at \"+stackTrace()+extra;if(abortDecorators){abortDecorators.forEach(function(decorator){output=decorator(output,what)})}throw output}Module[\"abort\"]=abort;if(Module[\"preInit\"]){if(typeof Module[\"preInit\"]==\"function\")Module[\"preInit\"]=[Module[\"preInit\"]];while(Module[\"preInit\"].length>0){Module[\"preInit\"].pop()()}}Module[\"noExitRuntime\"]=true;run();\n\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"stream\");\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"util\");\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fs_1 = __webpack_require__(2);\nconst FakeFS_1 = __webpack_require__(6);\nconst NodeFS_1 = __webpack_require__(1);\nconst ZipFS_1 = __webpack_require__(9);\nconst path_1 = __webpack_require__(0);\nclass ZipOpenFS extends FakeFS_1.BasePortableFakeFS {\n constructor({ baseFs = new NodeFS_1.NodeFS(), filter = null, useCache = true } = {}) {\n super();\n this.isZip = new Set();\n this.notZip = new Set();\n this.baseFs = baseFs;\n this.zipInstances = useCache ? new Map() : null;\n this.filter = filter;\n this.isZip = new Set();\n this.notZip = new Set();\n }\n static open(fn) {\n const zipOpenFs = new ZipOpenFS();\n try {\n return fn(zipOpenFs);\n }\n finally {\n zipOpenFs.saveAndClose();\n }\n }\n static async openPromise(fn) {\n const zipOpenFs = new ZipOpenFS();\n try {\n return await fn(zipOpenFs);\n }\n finally {\n zipOpenFs.saveAndClose();\n }\n }\n getRealPath() {\n return this.baseFs.getRealPath();\n }\n saveAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.saveAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n discardAndClose() {\n if (this.zipInstances) {\n for (const [path, zipFs] of this.zipInstances.entries()) {\n zipFs.discardAndClose();\n this.zipInstances.delete(path);\n }\n }\n }\n async openPromise(p, flags, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.openPromise(p, flags, mode);\n }, async (zipFs, { archivePath, subPath }) => {\n throw new Error(`Unsupported action (we wouldn't be able to disambiguate the close)`);\n });\n }\n openSync(p, flags, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.openSync(p, flags, mode);\n }, (zipFs, { archivePath, subPath }) => {\n throw new Error(`Unsupported action (we wouldn't be able to disambiguate the close)`);\n });\n }\n async closePromise(fd) {\n return await this.baseFs.closePromise(fd);\n }\n closeSync(fd) {\n return this.baseFs.closeSync(fd);\n }\n createReadStream(p, opts) {\n if (p === null)\n return this.baseFs.createReadStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createReadStream(p, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.createReadStream(subPath, opts);\n });\n }\n createWriteStream(p, opts) {\n if (p === null)\n return this.baseFs.createWriteStream(p, opts);\n return this.makeCallSync(p, () => {\n return this.baseFs.createWriteStream(p, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.createWriteStream(subPath, opts);\n });\n }\n async realpathPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.realpathPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return this.pathUtils.resolve(await this.baseFs.realpathPromise(archivePath), this.pathUtils.relative(path_1.PortablePath.root, await zipFs.realpathPromise(subPath)));\n });\n }\n realpathSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.realpathSync(p);\n }, (zipFs, { archivePath, subPath }) => {\n return this.pathUtils.resolve(this.baseFs.realpathSync(archivePath), this.pathUtils.relative(path_1.PortablePath.root, zipFs.realpathSync(subPath)));\n });\n }\n async existsPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.existsPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.existsPromise(subPath);\n });\n }\n existsSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.existsSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.existsSync(subPath);\n });\n }\n async accessPromise(p, mode) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.accessPromise(p, mode);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.accessPromise(subPath, mode);\n });\n }\n accessSync(p, mode) {\n return this.makeCallSync(p, () => {\n return this.baseFs.accessSync(p, mode);\n }, (zipFs, { subPath }) => {\n return zipFs.accessSync(subPath, mode);\n });\n }\n async statPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.statPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.statPromise(subPath);\n });\n }\n statSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.statSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.statSync(subPath);\n });\n }\n async lstatPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.lstatPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.lstatPromise(subPath);\n });\n }\n lstatSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.lstatSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.lstatSync(subPath);\n });\n }\n async chmodPromise(p, mask) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.chmodPromise(p, mask);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.chmodPromise(subPath, mask);\n });\n }\n chmodSync(p, mask) {\n return this.makeCallSync(p, () => {\n return this.baseFs.chmodSync(p, mask);\n }, (zipFs, { subPath }) => {\n return zipFs.chmodSync(subPath, mask);\n });\n }\n async renamePromise(oldP, newP) {\n return await this.makeCallPromise(oldP, async () => {\n return await this.makeCallPromise(newP, async () => {\n return await this.baseFs.renamePromise(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n });\n }, async (zipFsO, { archivePath: archivePathO, subPath: subPathO }) => {\n return await this.makeCallPromise(newP, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }, async (zipFsN, { archivePath: archivePathN, subPath: subPathN }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }\n else {\n return await zipFsO.renamePromise(subPathO, subPathN);\n }\n });\n });\n }\n renameSync(oldP, newP) {\n return this.makeCallSync(oldP, () => {\n return this.makeCallSync(newP, () => {\n return this.baseFs.renameSync(oldP, newP);\n }, async () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n });\n }, (zipFsO, { archivePath: archivePathO, subPath: subPathO }) => {\n return this.makeCallSync(newP, () => {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }, (zipFsN, { archivePath: archivePathN, subPath: subPathN }) => {\n if (zipFsO !== zipFsN) {\n throw Object.assign(new Error(`EEXDEV: cross-device link not permitted`), { code: `EEXDEV` });\n }\n else {\n return zipFsO.renameSync(subPathO, subPathN);\n }\n });\n });\n }\n async copyFilePromise(sourceP, destP, flags = 0) {\n const fallback = async (sourceFs, sourceP, destFs, destP) => {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), { code: `EXDEV` });\n if ((flags & fs_1.constants.COPYFILE_EXCL) && await this.existsPromise(sourceP))\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n let content;\n try {\n content = await sourceFs.readFilePromise(sourceP);\n }\n catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n }\n await destFs.writeFilePromise(destP, content);\n };\n return await this.makeCallPromise(sourceP, async () => {\n return await this.makeCallPromise(destP, async () => {\n return await this.baseFs.copyFilePromise(sourceP, destP, flags);\n }, async (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n return await fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, async (zipFsS, { archivePath: archivePathS, subPath: subPathS }) => {\n return await this.makeCallPromise(destP, async () => {\n return await fallback(zipFsS, subPathS, this.baseFs, destP);\n }, async (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n if (zipFsS !== zipFsD) {\n return await fallback(zipFsS, subPathS, zipFsD, subPathD);\n }\n else {\n return await zipFsS.copyFilePromise(subPathS, subPathD, flags);\n }\n });\n });\n }\n copyFileSync(sourceP, destP, flags = 0) {\n const fallback = (sourceFs, sourceP, destFs, destP) => {\n if ((flags & fs_1.constants.COPYFILE_FICLONE_FORCE) !== 0)\n throw Object.assign(new Error(`EXDEV: cross-device clone not permitted, copyfile '${sourceP}' -> ${destP}'`), { code: `EXDEV` });\n if ((flags & fs_1.constants.COPYFILE_EXCL) && this.existsSync(sourceP))\n throw Object.assign(new Error(`EEXIST: file already exists, copyfile '${sourceP}' -> '${destP}'`), { code: `EEXIST` });\n let content;\n try {\n content = sourceFs.readFileSync(sourceP);\n }\n catch (error) {\n throw Object.assign(new Error(`EINVAL: invalid argument, copyfile '${sourceP}' -> '${destP}'`), { code: `EINVAL` });\n }\n destFs.writeFileSync(destP, content);\n };\n return this.makeCallSync(sourceP, () => {\n return this.makeCallSync(destP, () => {\n return this.baseFs.copyFileSync(sourceP, destP, flags);\n }, (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n return fallback(this.baseFs, sourceP, zipFsD, subPathD);\n });\n }, (zipFsS, { archivePath: archivePathS, subPath: subPathS }) => {\n return this.makeCallSync(destP, () => {\n return fallback(zipFsS, subPathS, this.baseFs, destP);\n }, (zipFsD, { archivePath: archivePathD, subPath: subPathD }) => {\n if (zipFsS !== zipFsD) {\n return fallback(zipFsS, subPathS, zipFsD, subPathD);\n }\n else {\n return zipFsS.copyFileSync(subPathS, subPathD, flags);\n }\n });\n });\n }\n async writeFilePromise(p, content, opts) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.writeFilePromise(p, content, opts);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.writeFilePromise(subPath, content, opts);\n });\n }\n writeFileSync(p, content, opts) {\n return this.makeCallSync(p, () => {\n return this.baseFs.writeFileSync(p, content, opts);\n }, (zipFs, { subPath }) => {\n return zipFs.writeFileSync(subPath, content, opts);\n });\n }\n async unlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.unlinkPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.unlinkPromise(subPath);\n });\n }\n unlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.unlinkSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.unlinkSync(subPath);\n });\n }\n async utimesPromise(p, atime, mtime) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.utimesPromise(p, atime, mtime);\n }, async (zipFs, { subPath }) => {\n return await zipFs.utimesPromise(subPath, atime, mtime);\n });\n }\n utimesSync(p, atime, mtime) {\n return this.makeCallSync(p, () => {\n return this.baseFs.utimesSync(p, atime, mtime);\n }, (zipFs, { subPath }) => {\n return zipFs.utimesSync(subPath, atime, mtime);\n });\n }\n async mkdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.mkdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.mkdirPromise(subPath);\n });\n }\n mkdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.mkdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.mkdirSync(subPath);\n });\n }\n async rmdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.rmdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.rmdirPromise(subPath);\n });\n }\n rmdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.rmdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.rmdirSync(subPath);\n });\n }\n async symlinkPromise(target, p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.symlinkPromise(target, p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.symlinkPromise(target, subPath);\n });\n }\n symlinkSync(target, p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.symlinkSync(target, p);\n }, (zipFs, { subPath }) => {\n return zipFs.symlinkSync(target, subPath);\n });\n }\n async readFilePromise(p, encoding) {\n return this.makeCallPromise(p, async () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return await this.baseFs.readFilePromise(p, encoding);\n default:\n return await this.baseFs.readFilePromise(p, encoding);\n }\n }, async (zipFs, { subPath }) => {\n return await zipFs.readFilePromise(subPath, encoding);\n });\n }\n readFileSync(p, encoding) {\n return this.makeCallSync(p, () => {\n // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered)\n switch (encoding) {\n case `utf8`:\n return this.baseFs.readFileSync(p, encoding);\n default:\n return this.baseFs.readFileSync(p, encoding);\n }\n }, (zipFs, { subPath }) => {\n return zipFs.readFileSync(subPath, encoding);\n });\n }\n async readdirPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readdirPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.readdirPromise(subPath);\n }, {\n requireSubpath: false,\n });\n }\n readdirSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readdirSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.readdirSync(subPath);\n }, {\n requireSubpath: false,\n });\n }\n async readlinkPromise(p) {\n return await this.makeCallPromise(p, async () => {\n return await this.baseFs.readlinkPromise(p);\n }, async (zipFs, { archivePath, subPath }) => {\n return await zipFs.readlinkPromise(subPath);\n });\n }\n readlinkSync(p) {\n return this.makeCallSync(p, () => {\n return this.baseFs.readlinkSync(p);\n }, (zipFs, { subPath }) => {\n return zipFs.readlinkSync(subPath);\n });\n }\n watch(p, a, b) {\n return this.makeCallSync(p, () => {\n return this.baseFs.watch(p, \n // @ts-ignore\n a, b);\n }, (zipFs, { subPath }) => {\n return zipFs.watch(subPath, \n // @ts-ignore\n a, b);\n });\n }\n async makeCallPromise(p, discard, accept, { requireSubpath = true } = {}) {\n p = this.pathUtils.normalize(this.pathUtils.resolve(path_1.PortablePath.root, p));\n const zipInfo = this.findZip(p);\n if (!zipInfo)\n return await discard();\n if (requireSubpath && zipInfo.subPath === `/`)\n return await discard();\n return await this.getZipPromise(zipInfo.archivePath, async (zipFs) => await accept(zipFs, zipInfo));\n }\n makeCallSync(p, discard, accept, { requireSubpath = true } = {}) {\n p = this.pathUtils.normalize(this.pathUtils.resolve(path_1.PortablePath.root, p));\n const zipInfo = this.findZip(p);\n if (!zipInfo)\n return discard();\n if (requireSubpath && zipInfo.subPath === `/`)\n return discard();\n return this.getZipSync(zipInfo.archivePath, zipFs => accept(zipFs, zipInfo));\n }\n findZip(p) {\n if (this.filter && !this.filter.test(p))\n return null;\n const parts = p.split(/\\//g);\n for (let t = 2; t <= parts.length; ++t) {\n const archivePath = parts.slice(0, t).join(`/`);\n if (this.notZip.has(archivePath))\n continue;\n if (this.isZip.has(archivePath))\n return { archivePath, subPath: this.pathUtils.resolve(path_1.PortablePath.root, parts.slice(t).join(`/`)) };\n let realArchivePath = archivePath;\n let stat;\n while (true) {\n try {\n stat = this.baseFs.lstatSync(realArchivePath);\n }\n catch (error) {\n return null;\n }\n if (stat.isSymbolicLink()) {\n realArchivePath = this.pathUtils.resolve(this.pathUtils.dirname(realArchivePath), this.baseFs.readlinkSync(realArchivePath));\n }\n else {\n break;\n }\n }\n const isZip = stat.isFile() && this.pathUtils.extname(realArchivePath) === `.zip`;\n if (isZip) {\n this.isZip.add(archivePath);\n return { archivePath, subPath: this.pathUtils.resolve(path_1.PortablePath.root, parts.slice(t).join(`/`)) };\n }\n else {\n this.notZip.add(archivePath);\n if (stat.isFile()) {\n return null;\n }\n }\n }\n return null;\n }\n async getZipPromise(p, accept) {\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs)\n this.zipInstances.set(p, zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs, stats: await this.baseFs.statPromise(p) }));\n return await accept(zipFs);\n }\n else {\n const zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs, stats: await this.baseFs.statPromise(p) });\n try {\n return await accept(zipFs);\n }\n finally {\n zipFs.saveAndClose();\n }\n }\n }\n getZipSync(p, accept) {\n if (this.zipInstances) {\n let zipFs = this.zipInstances.get(p);\n if (!zipFs)\n this.zipInstances.set(p, zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs }));\n return accept(zipFs);\n }\n else {\n const zipFs = new ZipFS_1.ZipFS(p, { baseFs: this.baseFs });\n try {\n return accept(zipFs);\n }\n finally {\n zipFs.saveAndClose();\n }\n }\n }\n}\nexports.ZipOpenFS = ZipOpenFS;\n\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports) {\n\nmodule.exports = require(\"string_decoder\");\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fs_1 = __importDefault(__webpack_require__(2));\nconst module_1 = __importDefault(__webpack_require__(7));\nconst path_1 = __importDefault(__webpack_require__(4));\nconst internalTools_1 = __webpack_require__(10);\nfunction applyPatch(pnpapi, opts) {\n // @ts-ignore\n const builtinModules = new Set(module_1.default.builtinModules || Object.keys(process.binding('natives')));\n // The callback function gets called to wrap the return value of the module names matching the regexp\n const patchedModules = [];\n if (opts.compatibilityMode) {\n // Modern versions of `resolve` support a specific entry point that custom resolvers can use\n // to inject a specific resolution logic without having to patch the whole package.\n //\n // Cf: https://github.com/browserify/resolve/pull/174\n patchedModules.push([\n /^\\.\\/normalize-options\\.js$/,\n (issuer, normalizeOptions) => {\n if (!issuer || issuer.name !== 'resolve')\n return normalizeOptions;\n return (request, opts) => {\n opts = opts || {};\n if (opts.forceNodeResolution)\n return opts;\n opts.preserveSymlinks = true;\n opts.paths = function (request, basedir, getNodeModulesDir, opts) {\n // Extract the name of the package being requested (1=full name, 2=scope name, 3=local name)\n const parts = request.match(/^((?:(@[^\\/]+)\\/)?([^\\/]+))/);\n if (!parts)\n throw new Error(`Assertion failed: Expected the \"resolve\" package to call the \"paths\" callback with package names only (got \"${request}\")`);\n // make sure that basedir ends with a slash\n if (basedir.charAt(basedir.length - 1) !== '/')\n basedir = path_1.default.join(basedir, '/');\n // TODO Handle portable paths\n // This is guaranteed to return the path to the \"package.json\" file from the given package\n const manifestPath = pnpapi.resolveToUnqualified(`${parts[1]}/package.json`, basedir, {\n considerBuiltins: false,\n });\n if (manifestPath === null)\n throw new Error(`Assertion failed: The resolution thinks that \"${parts[1]}\" is a Node builtin`);\n // The first dirname strips the package.json, the second strips the local named folder\n let nodeModules = path_1.default.dirname(path_1.default.dirname(manifestPath));\n // Strips the scope named folder if needed\n if (parts[2])\n nodeModules = path_1.default.dirname(nodeModules);\n return [nodeModules];\n };\n return opts;\n };\n },\n ]);\n }\n /**\n * Used to disable the resolution hooks (for when we want to fallback to the previous resolution - we then need\n * a way to \"reset\" the environment temporarily)\n */\n let enableNativeHooks = true;\n // @ts-ignore\n process.versions.pnp = String(pnpapi.VERSIONS.std);\n // A small note: we don't replace the cache here (and instead use the native one). This is an effort to not\n // break code similar to \"delete require.cache[require.resolve(FOO)]\", where FOO is a package located outside\n // of the Yarn dependency tree. In this case, we defer the load to the native loader. If we were to replace the\n // cache by our own, the native loader would populate its own cache, which wouldn't be exposed anymore, so the\n // delete call would be broken.\n const originalModuleLoad = module_1.default._load;\n module_1.default._load = function (request, parent, isMain) {\n if (!enableNativeHooks)\n return originalModuleLoad.call(module_1.default, request, parent, isMain);\n // Builtins are managed by the regular Node loader\n if (builtinModules.has(request)) {\n try {\n enableNativeHooks = false;\n return originalModuleLoad.call(module_1.default, request, parent, isMain);\n }\n finally {\n enableNativeHooks = true;\n }\n }\n // The 'pnpapi' name is reserved to return the PnP api currently in use by the program\n if (request === `pnpapi`)\n return pnpapi;\n // Request `Module._resolveFilename` (ie. `resolveRequest`) to tell us which file we should load\n const modulePath = module_1.default._resolveFilename(request, parent, isMain);\n // Check if the module has already been created for the given file\n const cacheEntry = module_1.default._cache[modulePath];\n if (cacheEntry)\n return cacheEntry.exports;\n // Create a new module and store it into the cache\n // @ts-ignore\n const module = new module_1.default(modulePath, parent);\n module_1.default._cache[modulePath] = module;\n // The main module is exposed as global variable\n if (isMain) {\n // @ts-ignore\n process.mainModule = module;\n module.id = '.';\n }\n // Try to load the module, and remove it from the cache if it fails\n let hasThrown = true;\n try {\n module.load(modulePath);\n hasThrown = false;\n }\n finally {\n if (hasThrown) {\n delete module_1.default._cache[modulePath];\n }\n }\n // Some modules might have to be patched for compatibility purposes\n for (const [filter, patchFn] of patchedModules) {\n if (filter.test(request)) {\n const issuer = parent && parent.filename ? pnpapi.findPackageLocator(parent.filename) : null;\n module.exports = patchFn(issuer, module.exports);\n }\n }\n return module.exports;\n };\n const originalModuleResolveFilename = module_1.default._resolveFilename;\n module_1.default._resolveFilename = function (request, parent, isMain, options) {\n if (request === `pnpapi`)\n return request;\n if (!enableNativeHooks)\n return originalModuleResolveFilename.call(module_1.default, request, parent, isMain, options);\n if (options && options.plugnplay === false) {\n try {\n enableNativeHooks = false;\n return originalModuleResolveFilename.call(module_1.default, request, parent, isMain, options);\n }\n finally {\n enableNativeHooks = true;\n }\n }\n let issuers;\n if (options) {\n const optionNames = new Set(Object.keys(options));\n optionNames.delete(`paths`);\n optionNames.delete(`plugnplay`);\n if (optionNames.size > 0) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNSUPPORTED, `Some options passed to require() aren't supported by PnP yet (${Array.from(optionNames).join(', ')})`);\n }\n if (options.paths) {\n issuers = options.paths.map((entry) => {\n return `${path_1.default.normalize(entry)}/`;\n });\n }\n }\n if (!issuers) {\n const issuerModule = internalTools_1.getIssuerModule(parent);\n const issuer = issuerModule ? issuerModule.filename : `${fslib_1.NodeFS.toPortablePath(process.cwd())}/`;\n issuers = [issuer];\n }\n // When Node is called, it tries to require the main script but can't\n // because PnP already patched 'Module'\n // We test it for an absolute Windows path and convert it to a portable path.\n // We should probably always call toPortablePath and check for this directly\n if (/^[A-Z]:.*/.test(request))\n request = fslib_1.NodeFS.toPortablePath(request);\n let firstError;\n for (const issuer of issuers) {\n let resolution;\n try {\n resolution = pnpapi.resolveRequest(request, issuer);\n }\n catch (error) {\n firstError = firstError || error;\n continue;\n }\n return resolution !== null ? resolution : request;\n }\n throw firstError;\n };\n const originalFindPath = module_1.default._findPath;\n module_1.default._findPath = function (request, paths, isMain) {\n if (request === `pnpapi`)\n return false;\n if (!enableNativeHooks)\n return originalFindPath.call(module_1.default, request, paths, isMain);\n for (const path of paths) {\n let resolution;\n try {\n // TODO Convert path to portable path?\n resolution = pnpapi.resolveRequest(request, path);\n }\n catch (error) {\n continue;\n }\n if (resolution) {\n return resolution;\n }\n }\n return false;\n };\n fslib_1.patchFs(fs_1.default, new fslib_1.PosixFS(opts.fakeFs));\n}\nexports.applyPatch = applyPatch;\n;\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nfunction hydrateRuntimeState(data, { basePath }) {\n const portablePath = fslib_1.NodeFS.toPortablePath(basePath);\n const ignorePattern = data.ignorePatternData !== null\n ? new RegExp(data.ignorePatternData)\n : null;\n const packageRegistry = new Map(data.packageRegistryData.map(([packageName, packageStoreData]) => {\n return [packageName, new Map(packageStoreData.map(([packageReference, packageInformationData]) => {\n return [packageReference, {\n packageLocation: fslib_1.ppath.resolve(portablePath, packageInformationData.packageLocation),\n packageDependencies: new Map(packageInformationData.packageDependencies),\n }];\n }))];\n }));\n const packageLocatorsByLocations = new Map();\n for (const [packageName, storeData] of data.packageRegistryData) {\n for (const [packageReference, packageInformationData] of storeData) {\n if ((packageName === null) !== (packageReference === null))\n throw new Error(`Assertion failed: The name and reference should be null, or neither should`);\n // @ts-ignore: TypeScript isn't smart enough to understand the type assertion\n const packageLocator = { name: packageName, reference: packageReference };\n packageLocatorsByLocations.set(packageInformationData.packageLocation, packageLocator);\n }\n }\n for (const location of data.locationBlacklistData)\n packageLocatorsByLocations.set(location, null);\n const fallbackExclusionList = new Map(data.fallbackExclusionList.map(([packageName, packageReferences]) => {\n return [packageName, new Set(packageReferences)];\n }));\n const virtualRoots = data.virtualRoots.map(virtualRoot => {\n return fslib_1.ppath.resolve(portablePath, virtualRoot);\n });\n const enableTopLevelFallback = data.enableTopLevelFallback;\n const packageLocationLengths = data.locationLengthData;\n return {\n basePath: portablePath,\n enableTopLevelFallback,\n fallbackExclusionList,\n ignorePattern,\n packageLocationLengths,\n packageLocatorsByLocations,\n packageRegistry,\n virtualRoots,\n };\n}\nexports.hydrateRuntimeState = hydrateRuntimeState;\n\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst fslib_1 = __webpack_require__(5);\nconst fslib_2 = __webpack_require__(5);\nconst module_1 = __importDefault(__webpack_require__(7));\nconst internalTools_1 = __webpack_require__(10);\nfunction makeApi(runtimeState, opts) {\n // @ts-ignore\n const builtinModules = new Set(module_1.default.builtinModules || Object.keys(process.binding('natives')));\n // Splits a require request into its components, or return null if the request is a file path\n const pathRegExp = /^(?![a-zA-Z]:[\\\\\\/]|\\\\\\\\|\\.{0,2}(?:\\/|$))((?:@[^\\/]+\\/)?[^\\/]+)\\/?(.*|)$/;\n // Matches if the path starts with a valid path qualifier (./, ../, /)\n // eslint-disable-next-line no-unused-vars\n const isStrictRegExp = /^\\.{0,2}\\//;\n // Matches if the path must point to a directory (ie ends with /)\n const isDirRegExp = /\\/$/;\n // We only instantiate one of those so that we can use strict-equal comparisons\n const topLevelLocator = { name: null, reference: null };\n // Used for compatibility purposes - cf setupCompatibilityLayer\n const fallbackLocators = [];\n if (runtimeState.enableTopLevelFallback === true)\n fallbackLocators.push(topLevelLocator);\n if (opts.compatibilityMode) {\n // ESLint currently doesn't have any portable way for shared configs to\n // specify their own plugins that should be used (cf issue #10125). This\n // will likely get fixed at some point but it'll take time, so in the\n // meantime we'll just add additional fallback entries for common shared\n // configs.\n // Similarly, Gatsby generates files within the `public` folder located\n // within the project, but doesn't pre-resolve the `require` calls to use\n // its own dependencies. Meaning that when PnP see a file from the `public`\n // folder making a require, it thinks that your project forgot to list one\n // of your dependencies.\n for (const name of [`react-scripts`, `gatsby`]) {\n const packageStore = runtimeState.packageRegistry.get(name);\n if (packageStore) {\n for (const reference of packageStore.keys()) {\n if (reference === null) {\n throw new Error(`Assertion failed: This reference shouldn't be null`);\n }\n else {\n fallbackLocators.push({ name, reference });\n }\n }\n }\n }\n }\n /**\n * The setup code will be injected here. The tables listed below are guaranteed to be filled after the call to\n * the $$DYNAMICALLY_GENERATED_CODE function.\n */\n const { ignorePattern, packageRegistry, packageLocatorsByLocations, packageLocationLengths, } = runtimeState;\n /**\n * Allows to print useful logs just be setting a value in the environment\n */\n function makeLogEntry(name, args) {\n return {\n fn: name,\n args: args,\n error: null,\n result: null,\n };\n }\n function maybeLog(name, fn) {\n if (opts.allowDebug === false)\n return fn;\n const level = Number(process.env.PNP_DEBUG_LEVEL);\n if (Number.isFinite(level)) {\n if (level >= 2) {\n return (...args) => {\n const logEntry = makeLogEntry(name, args);\n try {\n return logEntry.result = fn(...args);\n }\n catch (error) {\n throw logEntry.error = error;\n }\n finally {\n console.error(logEntry);\n }\n };\n }\n else if (level >= 1) {\n return (...args) => {\n try {\n return fn(...args);\n }\n catch (error) {\n const logEntry = makeLogEntry(name, args);\n logEntry.error = error;\n console.error(logEntry);\n throw error;\n }\n };\n }\n }\n return fn;\n }\n /**\n * Returns information about a package in a safe way (will throw if they cannot be retrieved)\n */\n function getPackageInformationSafe(packageLocator) {\n const packageInformation = getPackageInformation(packageLocator);\n if (!packageInformation) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.INTERNAL, `Couldn't find a matching entry in the dependency tree for the specified parent (this is probably an internal error)`);\n }\n return packageInformation;\n }\n /**\n * Implements the node resolution for folder access and extension selection\n */\n function applyNodeExtensionResolution(unqualifiedPath, candidates, { extensions }) {\n // We use this \"infinite while\" so that we can restart the process as long as we hit package folders\n while (true) {\n let stat;\n try {\n candidates.push(unqualifiedPath);\n stat = opts.fakeFs.statSync(unqualifiedPath);\n }\n catch (error) { }\n // If the file exists and is a file, we can stop right there\n if (stat && !stat.isDirectory()) {\n // If the very last component of the resolved path is a symlink to a file, we then resolve it to a file. We only\n // do this first the last component, and not the rest of the path! This allows us to support the case of bin\n // symlinks, where a symlink in \"/xyz/pkg-name/.bin/bin-name\" will point somewhere else (like \"/xyz/pkg-name/index.js\").\n // In such a case, we want relative requires to be resolved relative to \"/xyz/pkg-name/\" rather than \"/xyz/pkg-name/.bin/\".\n //\n // Also note that the reason we must use readlink on the last component (instead of realpath on the whole path)\n // is that we must preserve the other symlinks, in particular those used by pnp to deambiguate packages using\n // peer dependencies. For example, \"/xyz/.pnp/local/pnp-01234569/.bin/bin-name\" should see its relative requires\n // be resolved relative to \"/xyz/.pnp/local/pnp-0123456789/\" rather than \"/xyz/pkg-with-peers/\", because otherwise\n // we would lose the information that would tell us what are the dependencies of pkg-with-peers relative to its\n // ancestors.\n if (opts.fakeFs.lstatSync(unqualifiedPath).isSymbolicLink())\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(fslib_2.ppath.dirname(unqualifiedPath), opts.fakeFs.readlinkSync(unqualifiedPath)));\n return unqualifiedPath;\n }\n // If the file is a directory, we must check if it contains a package.json with a \"main\" entry\n if (stat && stat.isDirectory()) {\n let pkgJson;\n try {\n pkgJson = JSON.parse(opts.fakeFs.readFileSync(fslib_2.ppath.join(unqualifiedPath, fslib_2.toFilename(`package.json`)), `utf8`));\n }\n catch (error) { }\n let nextUnqualifiedPath;\n if (pkgJson && pkgJson.main)\n nextUnqualifiedPath = fslib_2.ppath.resolve(unqualifiedPath, pkgJson.main);\n // If the \"main\" field changed the path, we start again from this new location\n if (nextUnqualifiedPath && nextUnqualifiedPath !== unqualifiedPath) {\n const resolution = applyNodeExtensionResolution(nextUnqualifiedPath, candidates, { extensions });\n if (resolution !== null) {\n return resolution;\n }\n }\n }\n // Otherwise we check if we find a file that match one of the supported extensions\n const qualifiedPath = extensions\n .map(extension => {\n return `${unqualifiedPath}${extension}`;\n })\n .find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (qualifiedPath)\n return qualifiedPath;\n // Otherwise, we check if the path is a folder - in such a case, we try to use its index\n if (stat && stat.isDirectory()) {\n const indexPath = extensions\n .map(extension => {\n return fslib_2.ppath.format({ dir: unqualifiedPath, name: fslib_2.toFilename(`index`), ext: extension });\n })\n .find(candidateFile => {\n candidates.push(candidateFile);\n return opts.fakeFs.existsSync(candidateFile);\n });\n if (indexPath) {\n return indexPath;\n }\n }\n // Otherwise there's nothing else we can do :(\n return null;\n }\n }\n /**\n * This function creates fake modules that can be used with the _resolveFilename function.\n * Ideally it would be nice to be able to avoid this, since it causes useless allocations\n * and cannot be cached efficiently (we recompute the nodeModulePaths every time).\n *\n * Fortunately, this should only affect the fallback, and there hopefully shouldn't have a\n * lot of them.\n */\n function makeFakeModule(path) {\n // @ts-ignore\n const fakeModule = new module_1.default(path, null);\n fakeModule.filename = path;\n fakeModule.paths = module_1.default._nodeModulePaths(path);\n return fakeModule;\n }\n /**\n * Normalize path to posix format.\n */\n function normalizePath(p) {\n return fslib_1.NodeFS.toPortablePath(p);\n }\n /**\n * Forward the resolution to the next resolver (usually the native one)\n */\n function callNativeResolution(request, issuer) {\n if (issuer.endsWith(`/`))\n issuer = fslib_2.ppath.join(issuer, fslib_2.toFilename(`internal.js`));\n // Since we would need to create a fake module anyway (to call _resolveLookupPath that\n // would give us the paths to give to _resolveFilename), we can as well not use\n // the {paths} option at all, since it internally makes _resolveFilename create another\n // fake module anyway.\n return module_1.default._resolveFilename(request, makeFakeModule(fslib_1.NodeFS.fromPortablePath(issuer)), false, { plugnplay: false });\n }\n /**\n * This key indicates which version of the standard is implemented by this resolver. The `std` key is the\n * Plug'n'Play standard, and any other key are third-party extensions. Third-party extensions are not allowed\n * to override the standard, and can only offer new methods.\n *\n * If an new version of the Plug'n'Play standard is released and some extensions conflict with newly added\n * functions, they'll just have to fix the conflicts and bump their own version number.\n */\n const VERSIONS = { std: 2 };\n /**\n * We export a special symbol for easy access to the top level locator.\n */\n const topLevel = topLevelLocator;\n /**\n * Gets the package information for a given locator. Returns null if they cannot be retrieved.\n */\n function getPackageInformation({ name, reference }) {\n const packageInformationStore = packageRegistry.get(name);\n if (!packageInformationStore)\n return null;\n const packageInformation = packageInformationStore.get(reference);\n if (!packageInformation)\n return null;\n return packageInformation;\n }\n /**\n * Finds the package locator that owns the specified path. If none is found, returns null instead.\n */\n function findPackageLocator(location) {\n let relativeLocation = normalizePath(fslib_2.ppath.relative(runtimeState.basePath, location));\n if (!relativeLocation.match(isStrictRegExp))\n relativeLocation = `./${relativeLocation}`;\n if (location.match(isDirRegExp) && !relativeLocation.endsWith(`/`))\n relativeLocation = `${relativeLocation}/`;\n let from = 0;\n // If someone wants to use a binary search to go from O(n) to O(log n), be my guest\n while (from < packageLocationLengths.length && packageLocationLengths[from] > relativeLocation.length)\n from += 1;\n for (let t = from; t < packageLocationLengths.length; ++t) {\n const locator = packageLocatorsByLocations.get(relativeLocation.substr(0, packageLocationLengths[t]));\n if (typeof locator === `undefined`)\n continue;\n // Ensures that the returned locator isn't a blacklisted one.\n //\n // Blacklisted packages are packages that cannot be used because their dependencies cannot be deduced. This only\n // happens with peer dependencies, which effectively have different sets of dependencies depending on their\n // parents.\n //\n // In order to deambiguate those different sets of dependencies, the Yarn implementation of PnP will generate a\n // symlink for each combination of // it will find, and will\n // blacklist the target of those symlinks. By doing this, we ensure that files loaded through a specific path\n // will always have the same set of dependencies, provided the symlinks are correctly preserved.\n //\n // Unfortunately, some tools do not preserve them, and when it happens PnP isn't able anymore to deduce the set of\n // dependencies based on the path of the file that makes the require calls. But since we've blacklisted those\n // paths, we're able to print a more helpful error message that points out that a third-party package is doing\n // something incompatible!\n if (locator === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BLACKLISTED, `A forbidden path has been used in the package resolution process - this is usually caused by one of your tools calling 'fs.realpath' on the return value of 'require.resolve'. Since we need to use symlinks to simultaneously provide valid filesystem paths and disambiguate peer dependencies, they must be passed untransformed to 'require'.\\n\\nForbidden path: ${location}`, { location });\n }\n return locator;\n }\n return null;\n }\n /**\n * Transforms a request (what's typically passed as argument to the require function) into an unqualified path.\n * This path is called \"unqualified\" because it only changes the package name to the package location on the disk,\n * which means that the end result still cannot be directly accessed (for example, it doesn't try to resolve the\n * file extension, or to resolve directories to their \"index.js\" content). Use the \"resolveUnqualified\" function\n * to convert them to fully-qualified paths, or just use \"resolveRequest\" that do both operations in one go.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n function resolveToUnqualified(request, issuer, { considerBuiltins = true } = {}) {\n // The 'pnpapi' request is reserved and will always return the path to the PnP file, from everywhere\n if (request === `pnpapi`)\n return fslib_1.NodeFS.toPortablePath(opts.pnpapiResolution);\n // Bailout if the request is a native module\n if (considerBuiltins && builtinModules.has(request))\n return null;\n // We allow disabling the pnp resolution for some subpaths. This is because some projects, often legacy,\n // contain multiple levels of dependencies (ie. a yarn.lock inside a subfolder of a yarn.lock). This is\n // typically solved using workspaces, but not all of them have been converted already.\n if (ignorePattern && issuer && ignorePattern.test(normalizePath(issuer))) {\n const result = callNativeResolution(request, issuer);\n if (result === false) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer was explicitely ignored by the regexp)\\n\\nRequire request: \"${request}\"\\nRequired by: ${issuer}\\n`, { request, issuer });\n }\n return fslib_1.NodeFS.toPortablePath(result);\n }\n let unqualifiedPath;\n // If the request is a relative or absolute path, we just return it normalized\n const dependencyNameMatch = request.match(pathRegExp);\n if (!dependencyNameMatch) {\n if (fslib_2.ppath.isAbsolute(request)) {\n unqualifiedPath = fslib_2.ppath.normalize(request);\n }\n else {\n if (!issuer) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, { request, issuer });\n }\n if (issuer.match(isDirRegExp)) {\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(issuer, request));\n }\n else {\n unqualifiedPath = fslib_2.ppath.normalize(fslib_2.ppath.resolve(fslib_2.ppath.dirname(issuer), request));\n }\n }\n // No need to use the return value; we just want to check the blacklist status\n findPackageLocator(unqualifiedPath);\n }\n // Things are more hairy if it's a package require - we then need to figure out which package is needed, and in\n // particular the exact version for the given location on the dependency tree\n else {\n if (!issuer) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.API_ERROR, `The resolveToUnqualified function must be called with a valid issuer when the path isn't a builtin nor absolute`, { request, issuer });\n }\n const [, dependencyName, subPath] = dependencyNameMatch;\n const issuerLocator = findPackageLocator(issuer);\n // If the issuer file doesn't seem to be owned by a package managed through pnp, then we resort to using the next\n // resolution algorithm in the chain, usually the native Node resolution one\n if (!issuerLocator) {\n const result = callNativeResolution(request, issuer);\n if (result === false) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.BUILTIN_NODE_RESOLUTION_FAILED, `The builtin node resolution algorithm was unable to resolve the requested module (it didn't go through the pnp resolver because the issuer doesn't seem to be part of the Yarn-managed dependency tree)\\n\\nRequire path: \"${request}\"\\nRequired by: ${issuer}\\n`, { request, issuer });\n }\n return fslib_1.NodeFS.toPortablePath(result);\n }\n const issuerInformation = getPackageInformationSafe(issuerLocator);\n // We obtain the dependency reference in regard to the package that request it\n let dependencyReference = issuerInformation.packageDependencies.get(dependencyName);\n // If we can't find it, we check if we can potentially load it from the packages that have been defined as potential fallbacks.\n // It's a bit of a hack, but it improves compatibility with the existing Node ecosystem. Hopefully we should eventually be able\n // to kill this logic and become stricter once pnp gets enough traction and the affected packages fix themselves.\n if (issuerLocator.name !== null) {\n // To allow programs to become gradually stricter, starting from the v2 we enforce that workspaces cannot depend on fallbacks.\n // This works by having a list containing all their locators, and checking when a fallback is required whether it's one of them.\n const exclusionEntry = runtimeState.fallbackExclusionList.get(issuerLocator.name);\n const canUseFallbacks = !exclusionEntry || !exclusionEntry.has(issuerLocator.reference);\n if (canUseFallbacks) {\n for (let t = 0, T = fallbackLocators.length; dependencyReference === undefined && t < T; ++t) {\n const fallbackInformation = getPackageInformationSafe(fallbackLocators[t]);\n const fallbackReference = fallbackInformation.packageDependencies.get(dependencyName);\n if (fallbackReference !== null) {\n dependencyReference = fallbackReference;\n }\n }\n }\n }\n // If we can't find the path, and if the package making the request is the top-level, we can offer nicer error messages\n if (dependencyReference === null) {\n if (issuerLocator.name === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_PEER_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a peer dependency; this isn't allowed as the peer dependency cannot be provided by any parent package\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, { request, issuer, dependencyName });\n }\n else {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_PEER_DEPENDENCY, `A package is trying to access a peer dependency that should be provided by its direct ancestor but isn't\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, issuerLocator: Object.assign({}, issuerLocator), dependencyName });\n }\n }\n else if (dependencyReference === undefined) {\n if (issuerLocator.name === null) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNDECLARED_DEPENDENCY, `Something that got detected as your top-level application (because it doesn't seem to belong to any package) tried to access a package that is not declared in your dependencies\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuer}\\n`, { request, issuer, dependencyName });\n }\n else {\n const candidates = Array.from(issuerInformation.packageDependencies.keys());\n throw internalTools_1.makeError(internalTools_1.ErrorCode.UNDECLARED_DEPENDENCY, `A package is trying to access another package without the second one being listed as a dependency of the first one\\n\\nRequired package: ${dependencyName} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, issuerLocator: Object.assign({}, issuerLocator), dependencyName, candidates });\n }\n }\n // We need to check that the package exists on the filesystem, because it might not have been installed\n const dependencyLocator = Array.isArray(dependencyReference)\n ? { name: dependencyReference[0], reference: dependencyReference[1] }\n : { name: dependencyName, reference: dependencyReference };\n const dependencyInformation = getPackageInformationSafe(dependencyLocator);\n if (!dependencyInformation.packageLocation) {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.MISSING_DEPENDENCY, `A dependency seems valid but didn't get installed for some reason. This might be caused by a partial install, such as dev vs prod.\\n\\nRequired package: ${dependencyLocator.name}@${dependencyLocator.reference} (via \"${request}\")\\nRequired by: ${issuerLocator.name}@${issuerLocator.reference} (via ${issuer})\\n`, { request, issuer, dependencyLocator: Object.assign({}, dependencyLocator) });\n }\n // Now that we know which package we should resolve to, we only have to find out the file location\n const dependencyLocation = fslib_2.ppath.resolve(runtimeState.basePath, dependencyInformation.packageLocation);\n if (subPath) {\n unqualifiedPath = fslib_2.ppath.resolve(dependencyLocation, subPath);\n }\n else {\n unqualifiedPath = dependencyLocation;\n }\n }\n return fslib_2.ppath.normalize(unqualifiedPath);\n }\n ;\n /**\n * Transforms an unqualified path into a qualified path by using the Node resolution algorithm (which automatically\n * appends \".js\" / \".json\", and transforms directory accesses into \"index.js\").\n */\n function resolveUnqualified(unqualifiedPath, { extensions = Object.keys(module_1.default._extensions) } = {}) {\n const candidates = [];\n const qualifiedPath = applyNodeExtensionResolution(unqualifiedPath, candidates, { extensions });\n if (qualifiedPath) {\n return fslib_2.ppath.normalize(qualifiedPath);\n }\n else {\n throw internalTools_1.makeError(internalTools_1.ErrorCode.QUALIFIED_PATH_RESOLUTION_FAILED, `Couldn't find a suitable Node resolution for the specified unqualified path\\n\\nSource path: ${unqualifiedPath}\\n${candidates.map(candidate => `Rejected resolution: ${candidate}\\n`).join(``)}`, { unqualifiedPath });\n }\n }\n ;\n /**\n * Transforms a request into a fully qualified path.\n *\n * Note that it is extremely important that the `issuer` path ends with a forward slash if the issuer is to be\n * treated as a folder (ie. \"/tmp/foo/\" rather than \"/tmp/foo\" if \"foo\" is a directory). Otherwise relative\n * imports won't be computed correctly (they'll get resolved relative to \"/tmp/\" instead of \"/tmp/foo/\").\n */\n function resolveRequest(request, issuer, { considerBuiltins, extensions } = {}) {\n let unqualifiedPath = resolveToUnqualified(request, issuer, { considerBuiltins });\n if (unqualifiedPath === null)\n return null;\n try {\n return resolveUnqualified(unqualifiedPath, { extensions });\n }\n catch (resolutionError) {\n if (resolutionError.pnpCode === 'QUALIFIED_PATH_RESOLUTION_FAILED')\n Object.assign(resolutionError.data, { request, issuer });\n throw resolutionError;\n }\n }\n ;\n return {\n VERSIONS,\n topLevel,\n getPackageInformation: (locator) => {\n const info = getPackageInformation(locator);\n if (info === null)\n return null;\n const packageLocation = fslib_1.NodeFS.fromPortablePath(info.packageLocation);\n const nativeInfo = Object.assign({}, info, { packageLocation });\n return nativeInfo;\n },\n findPackageLocator: (path) => {\n return findPackageLocator(fslib_1.NodeFS.toPortablePath(path));\n },\n resolveToUnqualified: maybeLog(`resolveToUnqualified`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? fslib_1.NodeFS.toPortablePath(issuer) : null;\n const resolution = resolveToUnqualified(fslib_1.NodeFS.toPortablePath(request), portableIssuer, opts);\n if (resolution === null)\n return null;\n return fslib_1.NodeFS.fromPortablePath(resolution);\n }),\n resolveUnqualified: maybeLog(`resolveUnqualified`, (unqualifiedPath, opts) => {\n return fslib_1.NodeFS.fromPortablePath(resolveUnqualified(fslib_1.NodeFS.toPortablePath(unqualifiedPath), opts));\n }),\n resolveRequest: maybeLog(`resolveRequest`, (request, issuer, opts) => {\n const portableIssuer = issuer !== null ? fslib_1.NodeFS.toPortablePath(issuer) : null;\n const resolution = resolveRequest(fslib_1.NodeFS.toPortablePath(request), portableIssuer, opts);\n if (resolution === null)\n return null;\n return fslib_1.NodeFS.fromPortablePath(resolution);\n }),\n };\n}\nexports.makeApi = makeApi;\n\n\n/***/ })\n/******/ ]);"; /***/ }), @@ -139564,6 +139564,7 @@ exports.hydrateRuntimeState = hydrateRuntimeState; "use strict"; +/// var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; diff --git a/packages/berry-pnp/sources/loader/makeApi.ts b/packages/berry-pnp/sources/loader/makeApi.ts index 9245b2a66e20..40735343b39d 100644 --- a/packages/berry-pnp/sources/loader/makeApi.ts +++ b/packages/berry-pnp/sources/loader/makeApi.ts @@ -1,3 +1,5 @@ +/// + import {FakeFS, NodeFS, PortablePath, NativePath, Path} from '@berry/fslib'; import {ppath, toFilename} from '@berry/fslib'; import Module from 'module'; diff --git a/packages/berry-pnpify/lib/NodeModulesFS.d.ts b/packages/berry-pnpify/lib/NodeModulesFS.d.ts deleted file mode 100644 index a64ec2147540..000000000000 --- a/packages/berry-pnpify/lib/NodeModulesFS.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -/// -import { FakeFS, ProxiedFS } from '@berry/fslib'; -import { NativePath, PortablePath } from '@berry/fslib'; -import { PnpApi } from '@berry/pnp'; -import fs from 'fs'; -export declare type NodeModulesFSOptions = { - realFs?: typeof fs; -}; -export declare class NodeModulesFS extends ProxiedFS { - protected readonly baseFs: FakeFS; - constructor(pnp: PnpApi, { realFs }?: NodeModulesFSOptions); - protected mapFromBase(path: PortablePath): NativePath; - protected mapToBase(path: NativePath): PortablePath; -} diff --git a/packages/berry-pnpify/lib/NodePathResolver.d.ts b/packages/berry-pnpify/lib/NodePathResolver.d.ts deleted file mode 100644 index 2c93797b960c..000000000000 --- a/packages/berry-pnpify/lib/NodePathResolver.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { PortablePath, Filename } from '@berry/fslib'; -import { PnpApi, PackageInformation } from '@berry/pnp'; -/** - * Resolved `/node_modules` path inside PnP project info. - * - * Dirs ending with '/node_modules/foo/node_modules' or '.../node_modules/foo/node_modules/@scope' - * do not physically exist, but we must pretend they do exist if package `foo` has dependencies - * and there is some package `@scope/bar` inside these dependencies. We need two things to emulate - * these dirs existence: - * - * 1. List of entries in these dirs. We retrieve them by calling PnP API and getting dependencies - * for the issuer `.../foo/` and store into `dirList` field - * 2. And we need either fake stats or we can forward underlying fs to stat the issuer dir. - * The issuer dir exists on fs. We store issuer dir into `statPath` field - */ -export interface ResolvedPath { - /** - * Fully resolved path `/node_modules/...` path within PnP project, - * `null` if path does not exist. - */ - resolvedPath: PortablePath | null; - /** - * The path that should be used for stats. This field is returned for pathes ending - * with `/node_modules[/@scope]`. - * - * These pathes are special in the sense they do not exists as physical dirs in PnP projects. - * We emulate these pathes by forwarding issuer path to underlying fs. - */ - statPath?: PortablePath; - /** - * Directory entries list, returned for pathes ending with `/node_modules[/@scope]` - */ - dirList?: Filename[]; -} -/** - * Resolves `node_modules` paths inside PnP projects. - * - * The idea: for path like `node_modules/foo/node_modules/bar` we use `foo` as an issuer - * and resolve `bar` for this issuer using `pnpapi`. - */ -export declare class NodePathResolver { - private pnp; - /** - * Constructs new instance of Node path resolver - * - * @param pnp PnP API instance - */ - constructor(pnp: PnpApi); - /** - * Returns `readdir`-like result for partially resolved pnp path - * - * @param issuerInfo issuer package information - * @param scope null - for `/node_modules` dir list or '@scope' - for `/node_modules/@scope` dir list - * - * @returns `undefined` - if dir does not exist, or `readdir`-like list of subdirs in the virtual dir - */ - readDir(issuerInfo: PackageInformation, scope: string | null): Filename[] | undefined; - private getIssuer; - /** - * Resolves paths containing `/node_modules` inside PnP projects. If path is outside PnP - * project it is not changed. - * - * This method extracts `.../node_modules/pkgName/...` from the path - * and uses previous package as an issuer for the next package. - * - * @param nodePath full path containing `node_modules` - * - * @returns resolved path - */ - resolvePath(nodePath: PortablePath): ResolvedPath; -} diff --git a/packages/berry-pnpify/lib/PortablePnPApi.d.ts b/packages/berry-pnpify/lib/PortablePnPApi.d.ts deleted file mode 100644 index 821b0c34d50d..000000000000 --- a/packages/berry-pnpify/lib/PortablePnPApi.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { PortablePath } from '@berry/fslib'; -import { PnpApi, PackageInformation, PackageLocator } from '@berry/pnp'; -/** - * PnP API wrapper working with portable paths - */ -export declare class PortablePnPApi { - private pnp; - VERSIONS: { - std: number; - [key: string]: number; - }; - topLevel: { - name: null; - reference: null; - }; - constructor(baseApi: PnpApi); - getPackageInformation(locator: PackageLocator): PackageInformation | null; - findPackageLocator(location: PortablePath): PackageLocator | null; - resolveToUnqualified(request: string, issuer: PortablePath | null, opts?: { - considerBuiltins?: boolean; - }): PortablePath | null; - resolveUnqualified(unqualified: PortablePath, opts?: { - extensions?: Array; - }): PortablePath; - resolveRequest(request: string, issuer: PortablePath | null, opts?: { - considerBuiltins?: boolean; - extensions?: Array; - }): PortablePath | null; -} diff --git a/packages/berry-pnpify/lib/bin.d.ts b/packages/berry-pnpify/lib/bin.d.ts deleted file mode 100644 index cb0ff5c3b541..000000000000 --- a/packages/berry-pnpify/lib/bin.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/berry-pnpify/lib/bin.js b/packages/berry-pnpify/lib/bin.js deleted file mode 100644 index a516ee4afb42..000000000000 --- a/packages/berry-pnpify/lib/bin.js +++ /dev/null @@ -1,3040 +0,0 @@ -#!/usr/bin/env node -module.exports = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ 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; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __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 = 33); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PortablePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return npath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ppath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return fromPortablePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return toPortablePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertPath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return toFilename; }); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); - -const PortablePath = { - root: `/`, - dot: `.`, -}; -const npath = path__WEBPACK_IMPORTED_MODULE_0___default.a; -const ppath = path__WEBPACK_IMPORTED_MODULE_0___default.a.posix; -const WINDOWS_PATH_REGEXP = /^[a-zA-Z]:.*$/; -const PORTABLE_PATH_REGEXP = /^\/[a-zA-Z]:.*$/; -// Path should look like "/N:/berry/scripts/plugin-pack.js" -// And transform to "N:\berry\scripts\plugin-pack.js" -function fromPortablePath(p) { - if (process.platform !== 'win32') - return p; - return p.match(PORTABLE_PATH_REGEXP) ? p.substring(1).replace(/\//g, `\\`) : p; -} -// Path should look like "N:/berry/scripts/plugin-pack.js" -// And transform to "/N:/berry/scripts/plugin-pack.js" -function toPortablePath(p) { - if (process.platform !== 'win32') - return p; - return (p.match(WINDOWS_PATH_REGEXP) ? `/${p}` : p).replace(/\\/g, `/`); -} -function convertPath(targetPathUtils, sourcePath) { - return (targetPathUtils === npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath)); -} -function toFilename(filename) { - if (npath.parse(filename).dir !== '' || ppath.parse(filename).dir !== '') - throw new Error(`Invalid filename: "${filename}"`); - return filename; -} - - -/***/ }), -/* 1 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return patchFs; }); -/* unused harmony export extendFs */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return xfs; }); -/* harmony import */ var _NodeFS__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); - - - - - - - - - - - - - - -function patchFs(patchedFs, fakeFs) { - const SYNC_IMPLEMENTATIONS = new Set([ - `accessSync`, - `createReadStream`, - `chmodSync`, - `copyFileSync`, - `lstatSync`, - `openSync`, - `readlinkSync`, - `readFileSync`, - `readdirSync`, - `readlinkSync`, - `realpathSync`, - `rmdirSync`, - `statSync`, - `symlinkSync`, - `unlinkSync`, - `utimesSync`, - `watch`, - `writeFileSync`, - ]); - const ASYNC_IMPLEMENTATIONS = new Set([ - `accessPromise`, - `chmodPromise`, - `copyFilePromise`, - `lstatPromise`, - `openPromise`, - `readdirPromise`, - `realpathPromise`, - `readFilePromise`, - `readdirPromise`, - `readlinkPromise`, - `rmdirPromise`, - `statPromise`, - `symlinkPromise`, - `unlinkPromise`, - `utimesPromise`, - `writeFilePromise`, - ]); - patchedFs.existsSync = (p) => { - try { - return fakeFs.existsSync(p); - } - catch (error) { - return false; - } - }; - patchedFs.exists = (p, callback) => { - fakeFs.existsPromise(p).then(result => { - if (callback) { - callback(result); - } - }, () => { - if (callback) { - callback(false); - } - }); - }; - for (const fnName of ASYNC_IMPLEMENTATIONS) { - const fakeImpl = fakeFs[fnName].bind(fakeFs); - const origName = fnName.replace(/Promise$/, ``); - patchedFs[origName] = (...args) => { - const hasCallback = typeof args[args.length - 1] === `function`; - const callback = hasCallback ? args.pop() : () => { }; - fakeImpl(...args).then((result) => { - callback(undefined, result); - }, (error) => { - callback(error); - }); - }; - } - for (const fnName of SYNC_IMPLEMENTATIONS) { - const fakeImpl = fakeFs[fnName].bind(fakeFs); - const origName = fnName; - patchedFs[origName] = fakeImpl; - } - patchedFs.realpathSync.native = patchedFs.realpathSync; - patchedFs.realpath.native = patchedFs.realpath; -} -function extendFs(realFs, fakeFs) { - const patchedFs = Object.create(realFs); - patchFs(patchedFs, fakeFs); - return patchedFs; -} -const xfs = new _NodeFS__WEBPACK_IMPORTED_MODULE_0__[/* NodeFS */ "a"](); - - -/***/ }), -/* 2 */ -/***/ (function(module, exports) { - -module.exports = require("fs"); - -/***/ }), -/* 3 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return FakeFS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BasePortableFakeFS; }); -/* harmony import */ var _path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); - - -class FakeFS { - constructor(pathUtils) { - this.pathUtils = pathUtils; - } - async removePromise(p) { - let stat; - try { - stat = await this.lstatPromise(p); - } - catch (error) { - if (error.code === `ENOENT`) { - return; - } - else { - throw error; - } - } - if (stat.isDirectory()) { - for (const entry of await this.readdirPromise(p)) - await this.removePromise(this.pathUtils.resolve(p, entry)); - // 5 gives 1s worth of retries at worst - for (let t = 0; t < 5; ++t) { - try { - await this.rmdirPromise(p); - break; - } - catch (error) { - if (error.code === `EBUSY` || error.code === `ENOTEMPTY`) { - await new Promise(resolve => setTimeout(resolve, t * 100)); - continue; - } - else { - throw error; - } - } - } - } - else { - await this.unlinkPromise(p); - } - } - removeSync(p) { - let stat; - try { - stat = this.lstatSync(p); - } - catch (error) { - if (error.code === `ENOENT`) { - return; - } - else { - throw error; - } - } - if (stat.isDirectory()) { - for (const entry of this.readdirSync(p)) - this.removeSync(this.pathUtils.resolve(p, entry)); - this.rmdirSync(p); - } - else { - this.unlinkSync(p); - } - } - async mkdirpPromise(p, { chmod, utimes } = {}) { - p = this.resolve(p); - if (p === this.pathUtils.dirname(p)) - return; - const parts = p.split(this.pathUtils.sep); - for (let u = 2; u <= parts.length; ++u) { - const subPath = parts.slice(0, u).join(this.pathUtils.sep); - if (!this.existsSync(subPath)) { - try { - await this.mkdirPromise(subPath); - } - catch (error) { - if (error.code === `EEXIST`) { - continue; - } - else { - throw error; - } - } - if (chmod != null) - await this.chmodPromise(subPath, chmod); - if (utimes != null) { - await this.utimesPromise(subPath, utimes[0], utimes[1]); - } - } - } - } - mkdirpSync(p, { chmod, utimes } = {}) { - p = this.resolve(p); - if (p === this.pathUtils.dirname(p)) - return; - const parts = p.split(this.pathUtils.sep); - for (let u = 2; u <= parts.length; ++u) { - const subPath = parts.slice(0, u).join(this.pathUtils.sep); - if (!this.existsSync(subPath)) { - try { - this.mkdirSync(subPath); - } - catch (error) { - if (error.code === `EEXIST`) { - continue; - } - else { - throw error; - } - } - if (chmod != null) - this.chmodSync(subPath, chmod); - if (utimes != null) { - this.utimesSync(subPath, utimes[0], utimes[1]); - } - } - } - } - async copyPromise(destination, source, { baseFs = this, overwrite = true } = {}) { - const stat = await baseFs.lstatPromise(source); - const exists = await this.existsSync(destination); - if (stat.isDirectory()) { - await this.mkdirpPromise(destination); - const directoryListing = await baseFs.readdirPromise(source); - await Promise.all(directoryListing.map(entry => { - return this.copyPromise(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite }); - })); - } - else if (stat.isFile()) { - if (!exists || overwrite) { - if (exists) - await this.removePromise(destination); - const content = await baseFs.readFilePromise(source); - await this.writeFilePromise(destination, content); - } - } - else if (stat.isSymbolicLink()) { - if (!exists || overwrite) { - if (exists) - await this.removePromise(destination); - const target = await baseFs.readlinkPromise(source); - await this.symlinkPromise(Object(_path__WEBPACK_IMPORTED_MODULE_0__[/* convertPath */ "b"])(this.pathUtils, target), destination); - } - } - else { - throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`); - } - const mode = stat.mode & 0o777; - await this.chmodPromise(destination, mode); - } - copySync(destination, source, { baseFs = this, overwrite = true } = {}) { - const stat = baseFs.lstatSync(source); - const exists = this.existsSync(destination); - if (stat.isDirectory()) { - this.mkdirpSync(destination); - const directoryListing = baseFs.readdirSync(source); - for (const entry of directoryListing) { - this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite }); - } - } - else if (stat.isFile()) { - if (!exists || overwrite) { - if (exists) - this.removeSync(destination); - const content = baseFs.readFileSync(source); - this.writeFileSync(destination, content); - } - } - else if (stat.isSymbolicLink()) { - if (!exists || overwrite) { - if (exists) - this.removeSync(destination); - const target = baseFs.readlinkSync(source); - this.symlinkSync(Object(_path__WEBPACK_IMPORTED_MODULE_0__[/* convertPath */ "b"])(this.pathUtils, target), destination); - } - } - else { - throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`); - } - const mode = stat.mode & 0o777; - this.chmodSync(destination, mode); - } - async changeFilePromise(p, content) { - try { - const current = await this.readFilePromise(p, `utf8`); - if (current === content) { - return; - } - } - catch (error) { - // ignore errors, no big deal - } - await this.writeFilePromise(p, content); - } - changeFileSync(p, content) { - try { - const current = this.readFileSync(p, `utf8`); - if (current === content) { - return; - } - } - catch (error) { - // ignore errors, no big deal - } - this.writeFileSync(p, content); - } - async movePromise(fromP, toP) { - try { - await this.renamePromise(fromP, toP); - } - catch (error) { - if (error.code === `EXDEV`) { - await this.copyPromise(toP, fromP); - await this.removePromise(fromP); - } - else { - throw error; - } - } - } - moveSync(fromP, toP) { - try { - this.renameSync(fromP, toP); - } - catch (error) { - if (error.code === `EXDEV`) { - this.copySync(toP, fromP); - this.removeSync(fromP); - } - else { - throw error; - } - } - } - async lockPromise(affectedPath, callback) { - const lockPath = `${affectedPath}.lock`; - const interval = 1000 / 60; - const timeout = Date.now() + 60 * 1000; - let fd = null; - while (fd === null) { - try { - fd = await this.openPromise(lockPath, `wx`); - } - catch (error) { - if (error.code === `EEXIST`) { - if (Date.now() < timeout) { - await new Promise(resolve => setTimeout(resolve, interval)); - } - else { - throw new Error(`Couldn't acquire a lock in a reasonable time (via ${lockPath})`); - } - } - else { - throw error; - } - } - } - try { - return await callback(); - } - finally { - await this.closePromise(fd); - await this.unlinkPromise(lockPath); - } - } -} -; -class BasePortableFakeFS extends FakeFS { - constructor() { - super(_path__WEBPACK_IMPORTED_MODULE_0__[/* ppath */ "e"]); - } - resolve(p) { - return this.pathUtils.resolve(_path__WEBPACK_IMPORTED_MODULE_0__[/* PortablePath */ "a"].root, p); - } -} - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - -module.exports = require("path"); - -/***/ }), -/* 5 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NodeFS; }); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _FakeFS__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); -/* harmony import */ var _path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); - - - - -class NodeFS extends _FakeFS__WEBPACK_IMPORTED_MODULE_1__[/* BasePortableFakeFS */ "a"] { - constructor(realFs = fs__WEBPACK_IMPORTED_MODULE_0___default.a) { - super(); - this.realFs = realFs; - } - getRealPath() { - return _path__WEBPACK_IMPORTED_MODULE_2__[/* PortablePath */ "a"].root; - } - async openPromise(p, flags, mode) { - return await new Promise((resolve, reject) => { - this.realFs.open(NodeFS.fromPortablePath(p), flags, mode, this.makeCallback(resolve, reject)); - }); - } - openSync(p, flags, mode) { - return this.realFs.openSync(NodeFS.fromPortablePath(p), flags, mode); - } - async closePromise(fd) { - await new Promise((resolve, reject) => { - this.realFs.close(fd, this.makeCallback(resolve, reject)); - }); - } - closeSync(fd) { - this.realFs.closeSync(fd); - } - createReadStream(p, opts) { - const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p); - return this.realFs.createReadStream(realPath, opts); - } - createWriteStream(p, opts) { - const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p); - return this.realFs.createWriteStream(realPath, opts); - } - async realpathPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.realpath(NodeFS.fromPortablePath(p), {}, this.makeCallback(resolve, reject)); - }).then(path => { - return NodeFS.toPortablePath(path); - }); - } - realpathSync(p) { - return NodeFS.toPortablePath(this.realFs.realpathSync(NodeFS.fromPortablePath(p), {})); - } - async existsPromise(p) { - return await new Promise(resolve => { - this.realFs.exists(NodeFS.fromPortablePath(p), resolve); - }); - } - accessSync(p, mode) { - return this.realFs.accessSync(NodeFS.fromPortablePath(p), mode); - } - async accessPromise(p, mode) { - return await new Promise((resolve, reject) => { - this.realFs.access(NodeFS.fromPortablePath(p), mode, this.makeCallback(resolve, reject)); - }); - } - existsSync(p) { - return this.realFs.existsSync(NodeFS.fromPortablePath(p)); - } - async statPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.stat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - statSync(p) { - return this.realFs.statSync(NodeFS.fromPortablePath(p)); - } - async lstatPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.lstat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - lstatSync(p) { - return this.realFs.lstatSync(NodeFS.fromPortablePath(p)); - } - async chmodPromise(p, mask) { - return await new Promise((resolve, reject) => { - this.realFs.chmod(NodeFS.fromPortablePath(p), mask, this.makeCallback(resolve, reject)); - }); - } - chmodSync(p, mask) { - return this.realFs.chmodSync(NodeFS.fromPortablePath(p), mask); - } - async renamePromise(oldP, newP) { - return await new Promise((resolve, reject) => { - this.realFs.rename(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP), this.makeCallback(resolve, reject)); - }); - } - renameSync(oldP, newP) { - return this.realFs.renameSync(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP)); - } - async copyFilePromise(sourceP, destP, flags = 0) { - return await new Promise((resolve, reject) => { - this.realFs.copyFile(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags, this.makeCallback(resolve, reject)); - }); - } - copyFileSync(sourceP, destP, flags = 0) { - return this.realFs.copyFileSync(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags); - } - async writeFilePromise(p, content, opts) { - return await new Promise((resolve, reject) => { - if (opts) { - this.realFs.writeFile(NodeFS.fromPortablePath(p), content, opts, this.makeCallback(resolve, reject)); - } - else { - this.realFs.writeFile(NodeFS.fromPortablePath(p), content, this.makeCallback(resolve, reject)); - } - }); - } - writeFileSync(p, content, opts) { - if (opts) { - this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content, opts); - } - else { - this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content); - } - } - async unlinkPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.unlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - unlinkSync(p) { - return this.realFs.unlinkSync(NodeFS.fromPortablePath(p)); - } - async utimesPromise(p, atime, mtime) { - return await new Promise((resolve, reject) => { - this.realFs.utimes(NodeFS.fromPortablePath(p), atime, mtime, this.makeCallback(resolve, reject)); - }); - } - utimesSync(p, atime, mtime) { - this.realFs.utimesSync(NodeFS.fromPortablePath(p), atime, mtime); - } - async mkdirPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.mkdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - mkdirSync(p) { - return this.realFs.mkdirSync(NodeFS.fromPortablePath(p)); - } - async rmdirPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.rmdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - rmdirSync(p) { - return this.realFs.rmdirSync(NodeFS.fromPortablePath(p)); - } - async symlinkPromise(target, p) { - const type = target.endsWith(`/`) ? `dir` : `file`; - return await new Promise((resolve, reject) => { - this.realFs.symlink(NodeFS.fromPortablePath(target.replace(/\/+$/, ``)), NodeFS.fromPortablePath(p), type, this.makeCallback(resolve, reject)); - }); - } - symlinkSync(target, p) { - const type = target.endsWith(`/`) ? `dir` : `file`; - return this.realFs.symlinkSync(NodeFS.fromPortablePath(target.replace(/\/+$/, ``)), NodeFS.fromPortablePath(p), type); - } - async readFilePromise(p, encoding) { - return await new Promise((resolve, reject) => { - this.realFs.readFile(NodeFS.fromPortablePath(p), encoding, this.makeCallback(resolve, reject)); - }); - } - readFileSync(p, encoding) { - return this.realFs.readFileSync(NodeFS.fromPortablePath(p), encoding); - } - async readdirPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.readdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - readdirSync(p) { - return this.realFs.readdirSync(NodeFS.fromPortablePath(p)); - } - async readlinkPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.readlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }).then(path => { - return NodeFS.toPortablePath(path); - }); - } - readlinkSync(p) { - return NodeFS.toPortablePath(this.realFs.readlinkSync(NodeFS.fromPortablePath(p))); - } - watch(p, a, b) { - return this.realFs.watch(NodeFS.fromPortablePath(p), - // @ts-ignore - a, b); - } - makeCallback(resolve, reject) { - return (err, result) => { - if (err) { - reject(err); - } - else { - resolve(result); - } - }; - } - static fromPortablePath(p) { - return Object(_path__WEBPACK_IMPORTED_MODULE_2__[/* fromPortablePath */ "c"])(p); - } - static toPortablePath(p) { - return Object(_path__WEBPACK_IMPORTED_MODULE_2__[/* toPortablePath */ "g"])(p); - } -} - - -/***/ }), -/* 6 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return dynamicRequire; }); -const dynamicRequire = true - ? require - : undefined; - - - -/***/ }), -/* 7 */, -/* 8 */, -/* 9 */, -/* 10 */, -/* 11 */, -/* 12 */, -/* 13 */, -/* 14 */, -/* 15 */, -/* 16 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const cp = __webpack_require__(17); -const parse = __webpack_require__(18); -const enoent = __webpack_require__(31); - -function spawn(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); - - // Spawn the child process - const spawned = cp.spawn(parsed.command, parsed.args, parsed.options); - - // Hook into child process "exit" event to emit an error if the command - // does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - enoent.hookChildProcess(spawned, parsed); - - return spawned; -} - -function spawnSync(command, args, options) { - // Parse the arguments - const parsed = parse(command, args, options); - - // Spawn the child process - const result = cp.spawnSync(parsed.command, parsed.args, parsed.options); - - // Analyze if the command does not exist, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16 - result.error = result.error || enoent.verifyENOENTSync(result.status, parsed); - - return result; -} - -module.exports = spawn; -module.exports.spawn = spawn; -module.exports.sync = spawnSync; - -module.exports._parse = parse; -module.exports._enoent = enoent; - - -/***/ }), -/* 17 */ -/***/ (function(module, exports) { - -module.exports = require("child_process"); - -/***/ }), -/* 18 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const path = __webpack_require__(4); -const niceTry = __webpack_require__(19); -const resolveCommand = __webpack_require__(20); -const escape = __webpack_require__(26); -const readShebang = __webpack_require__(27); -const semver = __webpack_require__(30); - -const isWin = process.platform === 'win32'; -const isExecutableRegExp = /\.(?:com|exe)$/i; -const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; - -// `options.shell` is supported in Node ^4.8.0, ^5.7.0 and >= 6.0.0 -const supportsShellOption = niceTry(() => semver.satisfies(process.version, '^4.8.0 || ^5.7.0 || >= 6.0.0', true)) || false; - -function detectShebang(parsed) { - parsed.file = resolveCommand(parsed); - - const shebang = parsed.file && readShebang(parsed.file); - - if (shebang) { - parsed.args.unshift(parsed.file); - parsed.command = shebang; - - return resolveCommand(parsed); - } - - return parsed.file; -} - -function parseNonShell(parsed) { - if (!isWin) { - return parsed; - } - - // Detect & add support for shebangs - const commandFile = detectShebang(parsed); - - // We don't need a shell if the command filename is an executable - const needsShell = !isExecutableRegExp.test(commandFile); - - // If a shell is required, use cmd.exe and take care of escaping everything correctly - // Note that `forceShell` is an hidden option used only in tests - if (parsed.options.forceShell || needsShell) { - // Need to double escape meta chars if the command is a cmd-shim located in `node_modules/.bin/` - // The cmd-shim simply calls execute the package bin file with NodeJS, proxying any argument - // Because the escape of metachars with ^ gets interpreted when the cmd.exe is first called, - // we need to double escape them - const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile); - - // Normalize posix paths into OS compatible paths (e.g.: foo/bar -> foo\bar) - // This is necessary otherwise it will always fail with ENOENT in those cases - parsed.command = path.normalize(parsed.command); - - // Escape command & arguments - parsed.command = escape.command(parsed.command); - parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars)); - - const shellCommand = [parsed.command].concat(parsed.args).join(' '); - - parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; - parsed.command = process.env.comspec || 'cmd.exe'; - parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped - } - - return parsed; -} - -function parseShell(parsed) { - // If node supports the shell option, there's no need to mimic its behavior - if (supportsShellOption) { - return parsed; - } - - // Mimic node shell option - // See https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335 - const shellCommand = [parsed.command].concat(parsed.args).join(' '); - - if (isWin) { - parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe'; - parsed.args = ['/d', '/s', '/c', `"${shellCommand}"`]; - parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped - } else { - if (typeof parsed.options.shell === 'string') { - parsed.command = parsed.options.shell; - } else if (process.platform === 'android') { - parsed.command = '/system/bin/sh'; - } else { - parsed.command = '/bin/sh'; - } - - parsed.args = ['-c', shellCommand]; - } - - return parsed; -} - -function parse(command, args, options) { - // Normalize arguments, similar to nodejs - if (args && !Array.isArray(args)) { - options = args; - args = null; - } - - args = args ? args.slice(0) : []; // Clone array to avoid changing the original - options = Object.assign({}, options); // Clone object to avoid changing the original - - // Build our parsed object - const parsed = { - command, - args, - options, - file: undefined, - original: { - command, - args, - }, - }; - - // Delegate further parsing to shell or non-shell - return options.shell ? parseShell(parsed) : parseNonShell(parsed); -} - -module.exports = parse; - - -/***/ }), -/* 19 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -/** - * Tries to execute a function and discards any error that occurs. - * @param {Function} fn - Function that might or might not throw an error. - * @returns {?*} Return-value of the function when no error occurred. - */ -module.exports = function(fn) { - - try { return fn() } catch (e) {} - -} - -/***/ }), -/* 20 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const path = __webpack_require__(4); -const which = __webpack_require__(21); -const pathKey = __webpack_require__(25)(); - -function resolveCommandAttempt(parsed, withoutPathExt) { - const cwd = process.cwd(); - const hasCustomCwd = parsed.options.cwd != null; - - // If a custom `cwd` was specified, we need to change the process cwd - // because `which` will do stat calls but does not support a custom cwd - if (hasCustomCwd) { - try { - process.chdir(parsed.options.cwd); - } catch (err) { - /* Empty */ - } - } - - let resolved; - - try { - resolved = which.sync(parsed.command, { - path: (parsed.options.env || process.env)[pathKey], - pathExt: withoutPathExt ? path.delimiter : undefined, - }); - } catch (e) { - /* Empty */ - } finally { - process.chdir(cwd); - } - - // If we successfully resolved, ensure that an absolute path is returned - // Note that when a custom `cwd` was used, we need to resolve to an absolute path based on it - if (resolved) { - resolved = path.resolve(hasCustomCwd ? parsed.options.cwd : '', resolved); - } - - return resolved; -} - -function resolveCommand(parsed) { - return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true); -} - -module.exports = resolveCommand; - - -/***/ }), -/* 21 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = which -which.sync = whichSync - -var isWindows = process.platform === 'win32' || - process.env.OSTYPE === 'cygwin' || - process.env.OSTYPE === 'msys' - -var path = __webpack_require__(4) -var COLON = isWindows ? ';' : ':' -var isexe = __webpack_require__(22) - -function getNotFoundError (cmd) { - var er = new Error('not found: ' + cmd) - er.code = 'ENOENT' - - return er -} - -function getPathInfo (cmd, opt) { - var colon = opt.colon || COLON - var pathEnv = opt.path || process.env.PATH || '' - var pathExt = [''] - - pathEnv = pathEnv.split(colon) - - var pathExtExe = '' - if (isWindows) { - pathEnv.unshift(process.cwd()) - pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM') - pathExt = pathExtExe.split(colon) - - - // Always test the cmd itself first. isexe will check to make sure - // it's found in the pathExt set. - if (cmd.indexOf('.') !== -1 && pathExt[0] !== '') - pathExt.unshift('') - } - - // If it has a slash, then we don't bother searching the pathenv. - // just check the file itself, and that's it. - if (cmd.match(/\//) || isWindows && cmd.match(/\\/)) - pathEnv = [''] - - return { - env: pathEnv, - ext: pathExt, - extExe: pathExtExe - } -} - -function which (cmd, opt, cb) { - if (typeof opt === 'function') { - cb = opt - opt = {} - } - - var info = getPathInfo(cmd, opt) - var pathEnv = info.env - var pathExt = info.ext - var pathExtExe = info.extExe - var found = [] - - ;(function F (i, l) { - if (i === l) { - if (opt.all && found.length) - return cb(null, found) - else - return cb(getNotFoundError(cmd)) - } - - var pathPart = pathEnv[i] - if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') - pathPart = pathPart.slice(1, -1) - - var p = path.join(pathPart, cmd) - if (!pathPart && (/^\.[\\\/]/).test(cmd)) { - p = cmd.slice(0, 2) + p - } - ;(function E (ii, ll) { - if (ii === ll) return F(i + 1, l) - var ext = pathExt[ii] - isexe(p + ext, { pathExt: pathExtExe }, function (er, is) { - if (!er && is) { - if (opt.all) - found.push(p + ext) - else - return cb(null, p + ext) - } - return E(ii + 1, ll) - }) - })(0, pathExt.length) - })(0, pathEnv.length) -} - -function whichSync (cmd, opt) { - opt = opt || {} - - var info = getPathInfo(cmd, opt) - var pathEnv = info.env - var pathExt = info.ext - var pathExtExe = info.extExe - var found = [] - - for (var i = 0, l = pathEnv.length; i < l; i ++) { - var pathPart = pathEnv[i] - if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"') - pathPart = pathPart.slice(1, -1) - - var p = path.join(pathPart, cmd) - if (!pathPart && /^\.[\\\/]/.test(cmd)) { - p = cmd.slice(0, 2) + p - } - for (var j = 0, ll = pathExt.length; j < ll; j ++) { - var cur = p + pathExt[j] - var is - try { - is = isexe.sync(cur, { pathExt: pathExtExe }) - if (is) { - if (opt.all) - found.push(cur) - else - return cur - } - } catch (ex) {} - } - } - - if (opt.all && found.length) - return found - - if (opt.nothrow) - return null - - throw getNotFoundError(cmd) -} - - -/***/ }), -/* 22 */ -/***/ (function(module, exports, __webpack_require__) { - -var fs = __webpack_require__(2) -var core -if (process.platform === 'win32' || global.TESTING_WINDOWS) { - core = __webpack_require__(23) -} else { - core = __webpack_require__(24) -} - -module.exports = isexe -isexe.sync = sync - -function isexe (path, options, cb) { - if (typeof options === 'function') { - cb = options - options = {} - } - - if (!cb) { - if (typeof Promise !== 'function') { - throw new TypeError('callback not provided') - } - - return new Promise(function (resolve, reject) { - isexe(path, options || {}, function (er, is) { - if (er) { - reject(er) - } else { - resolve(is) - } - }) - }) - } - - core(path, options || {}, function (er, is) { - // ignore EACCES because that just means we aren't allowed to run it - if (er) { - if (er.code === 'EACCES' || options && options.ignoreErrors) { - er = null - is = false - } - } - cb(er, is) - }) -} - -function sync (path, options) { - // my kingdom for a filtered catch - try { - return core.sync(path, options || {}) - } catch (er) { - if (options && options.ignoreErrors || er.code === 'EACCES') { - return false - } else { - throw er - } - } -} - - -/***/ }), -/* 23 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = isexe -isexe.sync = sync - -var fs = __webpack_require__(2) - -function checkPathExt (path, options) { - var pathext = options.pathExt !== undefined ? - options.pathExt : process.env.PATHEXT - - if (!pathext) { - return true - } - - pathext = pathext.split(';') - if (pathext.indexOf('') !== -1) { - return true - } - for (var i = 0; i < pathext.length; i++) { - var p = pathext[i].toLowerCase() - if (p && path.substr(-p.length).toLowerCase() === p) { - return true - } - } - return false -} - -function checkStat (stat, path, options) { - if (!stat.isSymbolicLink() && !stat.isFile()) { - return false - } - return checkPathExt(path, options) -} - -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, path, options)) - }) -} - -function sync (path, options) { - return checkStat(fs.statSync(path), path, options) -} - - -/***/ }), -/* 24 */ -/***/ (function(module, exports, __webpack_require__) { - -module.exports = isexe -isexe.sync = sync - -var fs = __webpack_require__(2) - -function isexe (path, options, cb) { - fs.stat(path, function (er, stat) { - cb(er, er ? false : checkStat(stat, options)) - }) -} - -function sync (path, options) { - return checkStat(fs.statSync(path), options) -} - -function checkStat (stat, options) { - return stat.isFile() && checkMode(stat, options) -} - -function checkMode (stat, options) { - var mod = stat.mode - var uid = stat.uid - var gid = stat.gid - - var myUid = options.uid !== undefined ? - options.uid : process.getuid && process.getuid() - var myGid = options.gid !== undefined ? - options.gid : process.getgid && process.getgid() - - var u = parseInt('100', 8) - var g = parseInt('010', 8) - var o = parseInt('001', 8) - var ug = u | g - - var ret = (mod & o) || - (mod & g) && gid === myGid || - (mod & u) && uid === myUid || - (mod & ug) && myUid === 0 - - return ret -} - - -/***/ }), -/* 25 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -module.exports = opts => { - opts = opts || {}; - - const env = opts.env || process.env; - const platform = opts.platform || process.platform; - - if (platform !== 'win32') { - return 'PATH'; - } - - return Object.keys(env).find(x => x.toUpperCase() === 'PATH') || 'Path'; -}; - - -/***/ }), -/* 26 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -// See http://www.robvanderwoude.com/escapechars.php -const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g; - -function escapeCommand(arg) { - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); - - return arg; -} - -function escapeArgument(arg, doubleEscapeMetaChars) { - // Convert to string - arg = `${arg}`; - - // Algorithm below is based on https://qntm.org/cmd - - // Sequence of backslashes followed by a double quote: - // double up all the backslashes and escape the double quote - arg = arg.replace(/(\\*)"/g, '$1$1\\"'); - - // Sequence of backslashes followed by the end of the string - // (which will become a double quote later): - // double up all the backslashes - arg = arg.replace(/(\\*)$/, '$1$1'); - - // All other backslashes occur literally - - // Quote the whole thing: - arg = `"${arg}"`; - - // Escape meta chars - arg = arg.replace(metaCharsRegExp, '^$1'); - - // Double escape meta chars if necessary - if (doubleEscapeMetaChars) { - arg = arg.replace(metaCharsRegExp, '^$1'); - } - - return arg; -} - -module.exports.command = escapeCommand; -module.exports.argument = escapeArgument; - - -/***/ }), -/* 27 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const fs = __webpack_require__(2); -const shebangCommand = __webpack_require__(28); - -function readShebang(command) { - // Read the first 150 bytes from the file - const size = 150; - let buffer; - - if (Buffer.alloc) { - // Node.js v4.5+ / v5.10+ - buffer = Buffer.alloc(size); - } else { - // Old Node.js API - buffer = new Buffer(size); - buffer.fill(0); // zero-fill - } - - let fd; - - try { - fd = fs.openSync(command, 'r'); - fs.readSync(fd, buffer, 0, size, 0); - fs.closeSync(fd); - } catch (e) { /* Empty */ } - - // Attempt to extract shebang (null is returned if not a shebang) - return shebangCommand(buffer.toString()); -} - -module.exports = readShebang; - - -/***/ }), -/* 28 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -var shebangRegex = __webpack_require__(29); - -module.exports = function (str) { - var match = str.match(shebangRegex); - - if (!match) { - return null; - } - - var arr = match[0].replace(/#! ?/, '').split(' '); - var bin = arr[0].split('/').pop(); - var arg = arr[1]; - - return (bin === 'env' ? - arg : - bin + (arg ? ' ' + arg : '') - ); -}; - - -/***/ }), -/* 29 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - -module.exports = /^#!.*/; - - -/***/ }), -/* 30 */ -/***/ (function(module, exports) { - -exports = module.exports = SemVer; - -// 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'; - -var MAX_LENGTH = 256; -var MAX_SAFE_INTEGER = Number.MAX_SAFE_INTEGER || 9007199254740991; - -// Max safe segment length for coercion. -var MAX_SAFE_COMPONENT_LENGTH = 16; - -// The actual regexps go on exports.re -var re = exports.re = []; -var src = exports.src = []; -var R = 0; - -// The following Regular Expressions can be used for tokenizing, -// validating, and parsing SemVer version strings. - -// ## Numeric Identifier -// A single `0`, or a non-zero digit followed by zero or more digits. - -var NUMERICIDENTIFIER = R++; -src[NUMERICIDENTIFIER] = '0|[1-9]\\d*'; -var NUMERICIDENTIFIERLOOSE = R++; -src[NUMERICIDENTIFIERLOOSE] = '[0-9]+'; - - -// ## Non-numeric Identifier -// Zero or more digits, followed by a letter or hyphen, and then zero or -// more letters, digits, or hyphens. - -var NONNUMERICIDENTIFIER = R++; -src[NONNUMERICIDENTIFIER] = '\\d*[a-zA-Z-][a-zA-Z0-9-]*'; - - -// ## Main Version -// Three dot-separated numeric identifiers. - -var MAINVERSION = R++; -src[MAINVERSION] = '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')\\.' + - '(' + src[NUMERICIDENTIFIER] + ')'; - -var MAINVERSIONLOOSE = R++; -src[MAINVERSIONLOOSE] = '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')\\.' + - '(' + src[NUMERICIDENTIFIERLOOSE] + ')'; - -// ## Pre-release Version Identifier -// A numeric identifier, or a non-numeric identifier. - -var PRERELEASEIDENTIFIER = R++; -src[PRERELEASEIDENTIFIER] = '(?:' + src[NUMERICIDENTIFIER] + - '|' + src[NONNUMERICIDENTIFIER] + ')'; - -var PRERELEASEIDENTIFIERLOOSE = R++; -src[PRERELEASEIDENTIFIERLOOSE] = '(?:' + src[NUMERICIDENTIFIERLOOSE] + - '|' + src[NONNUMERICIDENTIFIER] + ')'; - - -// ## Pre-release Version -// Hyphen, followed by one or more dot-separated pre-release version -// identifiers. - -var PRERELEASE = R++; -src[PRERELEASE] = '(?:-(' + src[PRERELEASEIDENTIFIER] + - '(?:\\.' + src[PRERELEASEIDENTIFIER] + ')*))'; - -var PRERELEASELOOSE = R++; -src[PRERELEASELOOSE] = '(?:-?(' + src[PRERELEASEIDENTIFIERLOOSE] + - '(?:\\.' + src[PRERELEASEIDENTIFIERLOOSE] + ')*))'; - -// ## Build Metadata Identifier -// Any combination of digits, letters, or hyphens. - -var BUILDIDENTIFIER = R++; -src[BUILDIDENTIFIER] = '[0-9A-Za-z-]+'; - -// ## Build Metadata -// Plus sign, followed by one or more period-separated build metadata -// identifiers. - -var BUILD = R++; -src[BUILD] = '(?:\\+(' + src[BUILDIDENTIFIER] + - '(?:\\.' + src[BUILDIDENTIFIER] + ')*))'; - - -// ## Full Version String -// A main version, followed optionally by a pre-release version and -// build metadata. - -// Note that the only major, minor, patch, and pre-release sections of -// the version string are capturing groups. The build metadata is not a -// capturing group, because it should not ever be used in version -// comparison. - -var FULL = R++; -var FULLPLAIN = 'v?' + src[MAINVERSION] + - src[PRERELEASE] + '?' + - src[BUILD] + '?'; - -src[FULL] = '^' + FULLPLAIN + '$'; - -// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. -// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty -// common in the npm registry. -var LOOSEPLAIN = '[v=\\s]*' + src[MAINVERSIONLOOSE] + - src[PRERELEASELOOSE] + '?' + - src[BUILD] + '?'; - -var LOOSE = R++; -src[LOOSE] = '^' + LOOSEPLAIN + '$'; - -var GTLT = R++; -src[GTLT] = '((?:<|>)?=?)'; - -// Something like "2.*" or "1.2.x". -// Note that "x.x" is a valid xRange identifer, meaning "any version" -// Only the first item is strictly required. -var XRANGEIDENTIFIERLOOSE = R++; -src[XRANGEIDENTIFIERLOOSE] = src[NUMERICIDENTIFIERLOOSE] + '|x|X|\\*'; -var XRANGEIDENTIFIER = R++; -src[XRANGEIDENTIFIER] = src[NUMERICIDENTIFIER] + '|x|X|\\*'; - -var XRANGEPLAIN = R++; -src[XRANGEPLAIN] = '[v=\\s]*(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIER] + ')' + - '(?:' + src[PRERELEASE] + ')?' + - src[BUILD] + '?' + - ')?)?'; - -var XRANGEPLAINLOOSE = R++; -src[XRANGEPLAINLOOSE] = '[v=\\s]*(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:\\.(' + src[XRANGEIDENTIFIERLOOSE] + ')' + - '(?:' + src[PRERELEASELOOSE] + ')?' + - src[BUILD] + '?' + - ')?)?'; - -var XRANGE = R++; -src[XRANGE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAIN] + '$'; -var XRANGELOOSE = R++; -src[XRANGELOOSE] = '^' + src[GTLT] + '\\s*' + src[XRANGEPLAINLOOSE] + '$'; - -// Coercion. -// Extract anything that could conceivably be a part of a valid semver -var COERCE = R++; -src[COERCE] = '(?:^|[^\\d])' + - '(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '})' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:\\.(\\d{1,' + MAX_SAFE_COMPONENT_LENGTH + '}))?' + - '(?:$|[^\\d])'; - -// Tilde ranges. -// Meaning is "reasonably at or greater than" -var LONETILDE = R++; -src[LONETILDE] = '(?:~>?)'; - -var TILDETRIM = R++; -src[TILDETRIM] = '(\\s*)' + src[LONETILDE] + '\\s+'; -re[TILDETRIM] = new RegExp(src[TILDETRIM], 'g'); -var tildeTrimReplace = '$1~'; - -var TILDE = R++; -src[TILDE] = '^' + src[LONETILDE] + src[XRANGEPLAIN] + '$'; -var TILDELOOSE = R++; -src[TILDELOOSE] = '^' + src[LONETILDE] + src[XRANGEPLAINLOOSE] + '$'; - -// Caret ranges. -// Meaning is "at least and backwards compatible with" -var LONECARET = R++; -src[LONECARET] = '(?:\\^)'; - -var CARETTRIM = R++; -src[CARETTRIM] = '(\\s*)' + src[LONECARET] + '\\s+'; -re[CARETTRIM] = new RegExp(src[CARETTRIM], 'g'); -var caretTrimReplace = '$1^'; - -var CARET = R++; -src[CARET] = '^' + src[LONECARET] + src[XRANGEPLAIN] + '$'; -var CARETLOOSE = R++; -src[CARETLOOSE] = '^' + src[LONECARET] + src[XRANGEPLAINLOOSE] + '$'; - -// 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 + ')$|^$'; - - -// 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] + ')'; - -// this one has to use the /g flag -re[COMPARATORTRIM] = new RegExp(src[COMPARATORTRIM], 'g'); -var comparatorTrimReplace = '$1$2$3'; - - -// Something like `1.2.3 - 1.2.4` -// Note that these all use the loose form, because they'll be -// checked against either the strict or loose comparator form -// later. -var HYPHENRANGE = R++; -src[HYPHENRANGE] = '^\\s*(' + src[XRANGEPLAIN] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAIN] + ')' + - '\\s*$'; - -var HYPHENRANGELOOSE = R++; -src[HYPHENRANGELOOSE] = '^\\s*(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s+-\\s+' + - '(' + src[XRANGEPLAINLOOSE] + ')' + - '\\s*$'; - -// Star ranges basically just allow anything at all. -var STAR = R++; -src[STAR] = '(<|>)?=?\\s*\\*'; - -// 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]); -} - -exports.parse = parse; -function parse(version, options) { - if (!options || typeof options !== 'object') - options = { loose: !!options, includePrerelease: false } - - if (version instanceof SemVer) - return version; - - if (typeof version !== 'string') - return null; - - if (version.length > MAX_LENGTH) - return null; - - var r = options.loose ? re[LOOSE] : re[FULL]; - if (!r.test(version)) - return null; - - try { - return new SemVer(version, options); - } catch (er) { - return null; - } -} - -exports.valid = valid; -function valid(version, options) { - var v = parse(version, options); - return v ? v.version : null; -} - - -exports.clean = clean; -function clean(version, options) { - var s = parse(version.trim().replace(/^[=v]+/, ''), options); - return s ? s.version : null; -} - -exports.SemVer = SemVer; - -function SemVer(version, options) { - if (!options || typeof options !== 'object') - options = { loose: !!options, includePrerelease: false } - if (version instanceof SemVer) { - if (version.loose === options.loose) - return version; - else - version = version.version; - } else if (typeof version !== 'string') { - throw new TypeError('Invalid Version: ' + version); - } - - if (version.length > MAX_LENGTH) - throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters') - - if (!(this instanceof SemVer)) - return new SemVer(version, options); - - debug('SemVer', version, options); - this.options = options; - this.loose = !!options.loose; - - var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]); - - if (!m) - throw new TypeError('Invalid Version: ' + version); - - this.raw = version; - - // these are actually numbers - this.major = +m[1]; - this.minor = +m[2]; - this.patch = +m[3]; - - if (this.major > MAX_SAFE_INTEGER || this.major < 0) - throw new TypeError('Invalid major version') - - if (this.minor > MAX_SAFE_INTEGER || this.minor < 0) - throw new TypeError('Invalid minor version') - - if (this.patch > MAX_SAFE_INTEGER || this.patch < 0) - throw new TypeError('Invalid patch version') - - // numberify any prerelease numeric ids - if (!m[4]) - this.prerelease = []; - else - this.prerelease = m[4].split('.').map(function(id) { - if (/^[0-9]+$/.test(id)) { - var num = +id; - if (num >= 0 && num < MAX_SAFE_INTEGER) - return num; - } - return id; - }); - - this.build = m[5] ? m[5].split('.') : []; - this.format(); -} - -SemVer.prototype.format = function() { - this.version = this.major + '.' + this.minor + '.' + this.patch; - if (this.prerelease.length) - this.version += '-' + this.prerelease.join('.'); - return this.version; -}; - -SemVer.prototype.toString = function() { - return this.version; -}; - -SemVer.prototype.compare = function(other) { - debug('SemVer.compare', this.version, this.options, other); - if (!(other instanceof SemVer)) - other = new SemVer(other, this.options); - - return this.compareMain(other) || this.comparePre(other); -}; - -SemVer.prototype.compareMain = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.options); - - return compareIdentifiers(this.major, other.major) || - compareIdentifiers(this.minor, other.minor) || - compareIdentifiers(this.patch, other.patch); -}; - -SemVer.prototype.comparePre = function(other) { - if (!(other instanceof SemVer)) - other = new SemVer(other, this.options); - - // NOT having a prerelease is > having one - if (this.prerelease.length && !other.prerelease.length) - return -1; - else if (!this.prerelease.length && other.prerelease.length) - return 1; - else if (!this.prerelease.length && !other.prerelease.length) - return 0; - - 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); -}; - -// 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; - - 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); - } - if (identifier) { - // 1.2.0-beta.1 bumps to 1.2.0-beta.2, - // 1.2.0-beta.fooblz or 1.2.0-beta bumps to 1.2.0-beta.0 - if (this.prerelease[0] === identifier) { - if (isNaN(this.prerelease[1])) - this.prerelease = [identifier, 0]; - } else - this.prerelease = [identifier, 0]; - } - break; - - default: - throw new Error('invalid increment argument: ' + release); - } - this.format(); - this.raw = this.version; - return this; -}; - -exports.inc = inc; -function inc(version, release, loose, identifier) { - if (typeof(loose) === 'string') { - identifier = loose; - loose = undefined; - } - - try { - return new SemVer(version, loose).inc(release, identifier).version; - } catch (er) { - return null; - } -} - -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; - } - } - } - return 'prerelease'; - } - for (var key in v1) { - if (key === 'major' || key === 'minor' || key === 'patch') { - if (v1[key] !== v2[key]) { - return key; - } - } - } - } -} - -exports.compareIdentifiers = compareIdentifiers; - -var numeric = /^[0-9]+$/; -function compareIdentifiers(a, b) { - var anum = numeric.test(a); - var bnum = numeric.test(b); - - if (anum && bnum) { - a = +a; - b = +b; - } - - return (anum && !bnum) ? -1 : - (bnum && !anum) ? 1 : - a < b ? -1 : - a > b ? 1 : - 0; -} - -exports.rcompareIdentifiers = rcompareIdentifiers; -function rcompareIdentifiers(a, b) { - return compareIdentifiers(b, a); -} - -exports.major = major; -function major(a, loose) { - return new SemVer(a, loose).major; -} - -exports.minor = minor; -function minor(a, loose) { - return new SemVer(a, loose).minor; -} - -exports.patch = patch; -function patch(a, loose) { - return new SemVer(a, loose).patch; -} - -exports.compare = compare; -function compare(a, b, loose) { - return new SemVer(a, loose).compare(new SemVer(b, loose)); -} - -exports.compareLoose = compareLoose; -function compareLoose(a, b) { - return compare(a, b, true); -} - -exports.rcompare = rcompare; -function rcompare(a, b, loose) { - return compare(b, a, loose); -} - -exports.sort = sort; -function sort(list, loose) { - return list.sort(function(a, b) { - return exports.compare(a, b, loose); - }); -} - -exports.rsort = rsort; -function rsort(list, loose) { - return list.sort(function(a, b) { - return exports.rcompare(a, b, loose); - }); -} - -exports.gt = gt; -function gt(a, b, loose) { - return compare(a, b, loose) > 0; -} - -exports.lt = lt; -function lt(a, b, loose) { - return compare(a, b, loose) < 0; -} - -exports.eq = eq; -function eq(a, b, loose) { - return compare(a, b, loose) === 0; -} - -exports.neq = neq; -function neq(a, b, loose) { - return compare(a, b, loose) !== 0; -} - -exports.gte = gte; -function gte(a, b, loose) { - return compare(a, b, loose) >= 0; -} - -exports.lte = lte; -function lte(a, b, loose) { - return compare(a, b, loose) <= 0; -} - -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; -} - -exports.Comparator = Comparator; -function Comparator(comp, options) { - if (!options || typeof options !== 'object') - options = { loose: !!options, includePrerelease: false } - - if (comp instanceof Comparator) { - if (comp.loose === !!options.loose) - return comp; - else - comp = comp.value; - } - - if (!(this instanceof Comparator)) - return new Comparator(comp, options); - - debug('comparator', comp, options); - this.options = options; - this.loose = !!options.loose; - this.parse(comp); - - if (this.semver === ANY) - this.value = ''; - else - this.value = this.operator + this.semver.version; - - debug('comp', this); -} - -var ANY = {}; -Comparator.prototype.parse = function(comp) { - var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; - var m = comp.match(r); - - if (!m) - throw new TypeError('Invalid comparator: ' + comp); - - this.operator = m[1]; - if (this.operator === '=') - this.operator = ''; - - // if it literally is just '>' or '' then allow anything. - if (!m[2]) - this.semver = ANY; - else - this.semver = new SemVer(m[2], this.options.loose); -}; - -Comparator.prototype.toString = function() { - return this.value; -}; - -Comparator.prototype.test = function(version) { - debug('Comparator.test', version, this.options.loose); - - if (this.semver === ANY) - return true; - - if (typeof version === 'string') - version = new SemVer(version, this.options); - - return cmp(version, this.operator, this.semver, this.options); -}; - -Comparator.prototype.intersects = function(comp, options) { - if (!(comp instanceof Comparator)) { - throw new TypeError('a Comparator is required'); - } - - if (!options || typeof options !== 'object') - options = { loose: !!options, includePrerelease: false } - - var rangeTmp; - - if (this.operator === '') { - rangeTmp = new Range(comp.value, options); - return satisfies(this.value, rangeTmp, options); - } else if (comp.operator === '') { - rangeTmp = new Range(this.value, options); - return satisfies(comp.semver, rangeTmp, options); - } - - var sameDirectionIncreasing = - (this.operator === '>=' || this.operator === '>') && - (comp.operator === '>=' || comp.operator === '>'); - var sameDirectionDecreasing = - (this.operator === '<=' || this.operator === '<') && - (comp.operator === '<=' || comp.operator === '<'); - var sameSemVer = this.semver.version === comp.semver.version; - var differentDirectionsInclusive = - (this.operator === '>=' || this.operator === '<=') && - (comp.operator === '>=' || comp.operator === '<='); - var oppositeDirectionsLessThan = - cmp(this.semver, '<', comp.semver, options) && - ((this.operator === '>=' || this.operator === '>') && - (comp.operator === '<=' || comp.operator === '<')); - var oppositeDirectionsGreaterThan = - cmp(this.semver, '>', comp.semver, options) && - ((this.operator === '<=' || this.operator === '<') && - (comp.operator === '>=' || comp.operator === '>')); - - return sameDirectionIncreasing || sameDirectionDecreasing || - (sameSemVer && differentDirectionsInclusive) || - oppositeDirectionsLessThan || oppositeDirectionsGreaterThan; -}; - - -exports.Range = Range; -function Range(range, options) { - if (!options || typeof options !== 'object') - options = { loose: !!options, includePrerelease: false } - - if (range instanceof Range) { - if (range.loose === !!options.loose && - range.includePrerelease === !!options.includePrerelease) { - return range; - } else { - return new Range(range.raw, options); - } - } - - if (range instanceof Comparator) { - return new Range(range.value, options); - } - - if (!(this instanceof Range)) - return new Range(range, options); - - this.options = options; - this.loose = !!options.loose; - this.includePrerelease = !!options.includePrerelease - - // 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); - } - - this.format(); -} - -Range.prototype.format = function() { - this.range = this.set.map(function(comps) { - return comps.join(' ').trim(); - }).join('||').trim(); - return this.range; -}; - -Range.prototype.toString = function() { - return this.range; -}; - -Range.prototype.parseRange = function(range) { - var loose = this.options.loose; - range = range.trim(); - // `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]); - - // `~ 1.2.3` => `~1.2.3` - range = range.replace(re[TILDETRIM], tildeTrimReplace); - - // `^ 1.2.3` => `^1.2.3` - range = range.replace(re[CARETTRIM], caretTrimReplace); - - // normalize spaces - range = range.split(/\s+/).join(' '); - - // At this point, the range is completely trimmed and - // ready to be split into comparators. - - var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR]; - var set = range.split(' ').map(function(comp) { - return parseComparator(comp, this.options); - }, this).join(' ').split(/\s+/); - if (this.options.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, this.options); - }, this); - - return set; -}; - -Range.prototype.intersects = function(range, options) { - if (!(range instanceof Range)) { - throw new TypeError('a Range is required'); - } - - return this.set.some(function(thisComparators) { - return thisComparators.every(function(thisComparator) { - return range.set.some(function(rangeComparators) { - return rangeComparators.every(function(rangeComparator) { - return thisComparator.intersects(rangeComparator, options); - }); - }); - }); - }); -}; - -// Mostly just for testing and legacy API reasons -exports.toComparators = toComparators; -function toComparators(range, options) { - return new Range(range, options).set.map(function(comp) { - return comp.map(function(c) { - return c.value; - }).join(' ').trim().split(' '); - }); -} - -// 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, options) { - debug('comp', comp, options); - comp = replaceCarets(comp, options); - debug('caret', comp); - comp = replaceTildes(comp, options); - debug('tildes', comp); - comp = replaceXRanges(comp, options); - debug('xrange', comp); - comp = replaceStars(comp, options); - debug('stars', comp); - return comp; -} - -function isX(id) { - return !id || id.toLowerCase() === 'x' || id === '*'; -} - -// ~, ~> --> * (any, kinda silly) -// ~2, ~2.x, ~2.x.x, ~>2, ~>2.x ~>2.x.x --> >=2.0.0 <3.0.0 -// ~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, options) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceTilde(comp, options); - }).join(' '); -} - -function replaceTilde(comp, options) { - if (!options || typeof options !== 'object') - options = { loose: !!options, includePrerelease: false } - var r = options.loose ? re[TILDELOOSE] : re[TILDE]; - return comp.replace(r, function(_, M, m, p, pr) { - debug('tilde', comp, _, M, m, p, pr); - var ret; - - 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'; - - debug('tilde return', ret); - return ret; - }); -} - -// ^ --> * (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, options) { - return comp.trim().split(/\s+/).map(function(comp) { - return replaceCaret(comp, options); - }).join(' '); -} - -function replaceCaret(comp, options) { - debug('caret', comp, options); - if (!options || typeof options !== 'object') - options = { loose: !!options, includePrerelease: false } - var r = options.loose ? re[CARETLOOSE] : re[CARET]; - return comp.replace(r, function(_, M, m, p, pr) { - debug('caret', comp, _, M, m, p, pr); - var ret; - - 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, options) { - debug('replaceXRanges', comp, options); - return comp.split(/\s+/).map(function(comp) { - return replaceXRange(comp, options); - }).join(' '); -} - -function replaceXRange(comp, options) { - comp = comp.trim(); - if (!options || typeof options !== 'object') - options = { loose: !!options, includePrerelease: false } - var r = options.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; - - 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; - } - - 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'; - } - - debug('xRange return', ret); - - return ret; - }); -} - -// Because * is AND-ed with everything else in the comparator, -// and '' means "any version", just remove the *s entirely. -function replaceStars(comp, options) { - debug('replaceStars', comp, options); - // Looseness is ignored here. star is always as loose as it gets! - return comp.trim().replace(re[STAR], ''); -} - -// 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) { - - if (isX(fM)) - from = ''; - else if (isX(fm)) - from = '>=' + fM + '.0.0'; - else if (isX(fp)) - from = '>=' + fM + '.' + fm + '.0'; - else - from = '>=' + from; - - 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; - - return (from + ' ' + to).trim(); -} - - -// if ANY of the sets match ALL of its comparators, then pass -Range.prototype.test = function(version) { - if (!version) - return false; - - if (typeof version === 'string') - version = new SemVer(version, this.options); - - for (var i = 0; i < this.set.length; i++) { - if (testSet(this.set[i], version, this.options)) - return true; - } - return false; -}; - -function testSet(set, version, options) { - for (var i = 0; i < set.length; i++) { - if (!set[i].test(version)) - return false; - } - - if (!options) - options = {} - - if (version.prerelease.length && !options.includePrerelease) { - // Find the set of versions that are allowed to have prereleases - // For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0 - // That should allow `1.2.3-pr.2` to pass. - // However, `1.2.4-alpha.notready` should NOT be allowed, - // even though it's within the range set by the comparators. - for (var i = 0; i < set.length; i++) { - debug(set[i].semver); - if (set[i].semver === ANY) - continue; - - 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; - } - - return true; -} - -exports.satisfies = satisfies; -function satisfies(version, range, options) { - try { - range = new Range(range, options); - } catch (er) { - return false; - } - return range.test(version); -} - -exports.maxSatisfying = maxSatisfying; -function maxSatisfying(versions, range, options) { - var max = null; - var maxSV = null; - try { - var rangeObj = new Range(range, options); - } catch (er) { - return null; - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { // satisfies(v, range, options) - if (!max || maxSV.compare(v) === -1) { // compare(max, v, true) - max = v; - maxSV = new SemVer(max, options); - } - } - }) - return max; -} - -exports.minSatisfying = minSatisfying; -function minSatisfying(versions, range, options) { - var min = null; - var minSV = null; - try { - var rangeObj = new Range(range, options); - } catch (er) { - return null; - } - versions.forEach(function (v) { - if (rangeObj.test(v)) { // satisfies(v, range, options) - if (!min || minSV.compare(v) === 1) { // compare(min, v, true) - min = v; - minSV = new SemVer(min, options); - } - } - }) - return min; -} - -exports.validRange = validRange; -function validRange(range, options) { - try { - // Return '*' instead of '' so that truthiness works. - // This will throw if it's invalid anyway - return new Range(range, options).range || '*'; - } catch (er) { - return null; - } -} - -// Determine if version is less than all the versions possible in the range -exports.ltr = ltr; -function ltr(version, range, options) { - return outside(version, range, '<', options); -} - -// Determine if version is greater than all the versions possible in the range. -exports.gtr = gtr; -function gtr(version, range, options) { - return outside(version, range, '>', options); -} - -exports.outside = outside; -function outside(version, range, hilo, options) { - version = new SemVer(version, options); - range = new Range(range, options); - - 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 ">"'); - } - - // If it satisifes the range it is not outside - if (satisfies(version, range, options)) { - return false; - } - - // From now on, variable terms are as if we're in "gtr" mode. - // but note that everything is flipped for the "ltr" function. - - for (var i = 0; i < range.set.length; ++i) { - var comparators = range.set[i]; - - var high = null; - var low = null; - - 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, options)) { - high = comparator; - } else if (ltfn(comparator.semver, low.semver, options)) { - low = comparator; - } - }); - - // If the edge version comparator has a operator then our version - // isn't outside it - if (high.operator === comp || high.operator === ecomp) { - return false; - } - - // If the lowest version comparator has an operator and our version - // is less than it then it isn't higher than the range - if ((!low.operator || low.operator === comp) && - ltefn(version, low.semver)) { - return false; - } else if (low.operator === ecomp && ltfn(version, low.semver)) { - return false; - } - } - return true; -} - -exports.prerelease = prerelease; -function prerelease(version, options) { - var parsed = parse(version, options); - return (parsed && parsed.prerelease.length) ? parsed.prerelease : null; -} - -exports.intersects = intersects; -function intersects(r1, r2, options) { - r1 = new Range(r1, options) - r2 = new Range(r2, options) - return r1.intersects(r2) -} - -exports.coerce = coerce; -function coerce(version) { - if (version instanceof SemVer) - return version; - - if (typeof version !== 'string') - return null; - - var match = version.match(re[COERCE]); - - if (match == null) - return null; - - return parse((match[1] || '0') + '.' + (match[2] || '0') + '.' + (match[3] || '0')); -} - - -/***/ }), -/* 31 */ -/***/ (function(module, exports, __webpack_require__) { - -"use strict"; - - -const isWin = process.platform === 'win32'; - -function notFoundError(original, syscall) { - return Object.assign(new Error(`${syscall} ${original.command} ENOENT`), { - code: 'ENOENT', - errno: 'ENOENT', - syscall: `${syscall} ${original.command}`, - path: original.command, - spawnargs: original.args, - }); -} - -function hookChildProcess(cp, parsed) { - if (!isWin) { - return; - } - - const originalEmit = cp.emit; - - cp.emit = function (name, arg1) { - // If emitting "exit" event and exit code is 1, we need to check if - // the command exists and emit an "error" instead - // See https://github.com/IndigoUnited/node-cross-spawn/issues/16 - if (name === 'exit') { - const err = verifyENOENT(arg1, parsed, 'spawn'); - - if (err) { - return originalEmit.call(cp, 'error', err); - } - } - - return originalEmit.apply(cp, arguments); // eslint-disable-line prefer-rest-params - }; -} - -function verifyENOENT(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawn'); - } - - return null; -} - -function verifyENOENTSync(status, parsed) { - if (isWin && status === 1 && !parsed.file) { - return notFoundError(parsed.original, 'spawnSync'); - } - - return null; -} - -module.exports = { - hookChildProcess, - verifyENOENT, - verifyENOENTSync, - notFoundError, -}; - - -/***/ }), -/* 32 */, -/* 33 */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ../berry-fslib/sources/NodeFS.ts -var NodeFS = __webpack_require__(5); - -// EXTERNAL MODULE: /Users/mael.nison/berry/.yarn/cache/cross-spawn-npm-6.0.5-0ba5f883cf582a4248c1c8575ef31c368634c587aa0b9731c596cf866746bf5e.zip/node_modules/cross-spawn/index.js -var cross_spawn = __webpack_require__(16); -var cross_spawn_default = /*#__PURE__*/__webpack_require__.n(cross_spawn); - -// EXTERNAL MODULE: ./sources/dynamicRequire.ts -var dynamicRequire = __webpack_require__(6); - -// EXTERNAL MODULE: ../berry-fslib/sources/path.ts -var path = __webpack_require__(0); - -// EXTERNAL MODULE: ../berry-fslib/sources/index.ts -var sources = __webpack_require__(1); - -// CONCATENATED MODULE: ./sources/generateSdk.ts - - -const TEMPLATE = (relPnpApiPath, module, { usePnpify }) => [ - `const relPnpApiPath = ${JSON.stringify(NodeFS["a" /* NodeFS */].toPortablePath(relPnpApiPath))};\n`, - `const absPnpApiPath = require(\`path\`).resolve(__dirname, relPnpApiPath);\n`, - `\n`, - `// Setup the environment to be able to require ${module}\n`, - `require(absPnpApiPath).setup();\n`, - `\n`, - `// Prepare the environment (to be ready in case of child_process.spawn etc)\n`, - `process.env.NODE_OPTIONS = process.env.NODE_OPTIONS || \`\`;\n`, - `process.env.NODE_OPTIONS += \` -r \${absPnpApiPath}\`;\n`, - ...(usePnpify ? [ - `process.env.NODE_OPTIONS += \` -r \${require.resolve(\`@berry/pnpify/lib\`)}\`;\n`, - `\n`, - `// Apply PnPify to the current process\n`, - `require(\`@berry/pnpify/lib\`).patchFs();\n`, - ] : []), - `\n`, - `// Defer to the real ${module} your application uses\n`, - `module.exports = require(\`${module}\`);\n`, -].join(``); -const addVSCodeWorkspaceSettings = async (projectRoot, settings) => { - const settingsPath = path["e" /* ppath */].join(projectRoot, `.vscode/settings.json`); - const content = await sources["b" /* xfs */].existsPromise(settingsPath) ? await sources["b" /* xfs */].readFilePromise(settingsPath, `utf8`) : `{}`; - const data = JSON.parse(content); - const patched = `${JSON.stringify(Object.assign({}, data, settings), null, 2)}\n`; - await sources["b" /* xfs */].mkdirpPromise(path["e" /* ppath */].dirname(settingsPath)); - await sources["b" /* xfs */].changeFilePromise(settingsPath, patched); -}; -const generateTypescriptWrapper = async (projectRoot, target) => { - const typescript = path["e" /* ppath */].join(target, `typescript`); - const manifest = path["e" /* ppath */].join(typescript, `package.json`); - const tsserver = path["e" /* ppath */].join(typescript, `lib/tsserver.js`); - const relPnpApiPath = path["e" /* ppath */].relative(path["e" /* ppath */].dirname(tsserver), path["e" /* ppath */].join(projectRoot, `.pnp.js`)); - await sources["b" /* xfs */].mkdirpPromise(path["e" /* ppath */].dirname(tsserver)); - await sources["b" /* xfs */].writeFilePromise(manifest, JSON.stringify({ name: 'typescript', version: `${Object(dynamicRequire["a" /* dynamicRequire */])('typescript/package.json').version}-pnpify` }, null, 2)); - await sources["b" /* xfs */].writeFilePromise(tsserver, TEMPLATE(relPnpApiPath, "typescript/lib/tsserver", { usePnpify: true })); - await addVSCodeWorkspaceSettings(projectRoot, { 'typescript.tsdk': NodeFS["a" /* NodeFS */].fromPortablePath(path["e" /* ppath */].relative(projectRoot, path["e" /* ppath */].dirname(tsserver))) }); -}; -const generateEslintWrapper = async (projectRoot, target) => { - const eslint = path["e" /* ppath */].join(target, `eslint`); - const manifest = path["e" /* ppath */].join(eslint, `package.json`); - const api = path["e" /* ppath */].join(eslint, `lib/api.js`); - const relPnpApiPath = path["e" /* ppath */].relative(path["e" /* ppath */].dirname(api), path["e" /* ppath */].join(projectRoot, `.pnp.js`)); - await sources["b" /* xfs */].mkdirpPromise(path["e" /* ppath */].dirname(api)); - await sources["b" /* xfs */].writeFilePromise(manifest, JSON.stringify({ name: 'eslint', version: `${Object(dynamicRequire["a" /* dynamicRequire */])('eslint/package.json').version}-pnpify`, main: 'lib/api.js' }, null, 2)); - await sources["b" /* xfs */].writeFilePromise(api, TEMPLATE(relPnpApiPath, "eslint", { usePnpify: false })); - await addVSCodeWorkspaceSettings(projectRoot, { 'eslint.nodePath': NodeFS["a" /* NodeFS */].fromPortablePath(path["e" /* ppath */].relative(projectRoot, path["e" /* ppath */].dirname(eslint))) }); -}; -const generateSdk = async (projectRoot) => { - const targetFolder = path["e" /* ppath */].join(projectRoot, `.vscode/pnpify`); - await sources["b" /* xfs */].removePromise(targetFolder); - await generateTypescriptWrapper(projectRoot, targetFolder); - await generateEslintWrapper(projectRoot, targetFolder); -}; - -// CONCATENATED MODULE: ./sources/bin.ts - - - - -const [, , bin_name, ...rest] = process.argv; -if (bin_name === `--help` || bin_name === `-h`) - help(false); -else if (bin_name === `--sdk` && rest.length === 0) - sdk(); -else if (typeof bin_name !== `undefined` && bin_name[0] !== `-`) - run(bin_name, rest); -else - help(true); -function help(error) { - const logFn = error ? console.error : console.log; - process.exitCode = error ? 1 : 0; - logFn(`Usage: yarn pnpify --sdk`); - logFn(`Usage: yarn pnpify [...argv]`); - logFn(); - logFn(`Setups a TypeScript sdk for use within your VSCode editor instance`); - logFn(`More info at https://yarnpkg.github.io/berry/advanced/pnpify`); -} -function sdk() { - const { getPackageInformation, topLevel } = Object(dynamicRequire["a" /* dynamicRequire */])(`pnpapi`); - const { packageLocation } = getPackageInformation(topLevel); - const projectRoot = NodeFS["a" /* NodeFS */].toPortablePath(packageLocation); - generateSdk(projectRoot).catch(error => { - console.error(error.stack); - process.exitCode = 1; - }); -} -function run(name, argv) { - let { NODE_OPTIONS } = process.env; - NODE_OPTIONS = `${NODE_OPTIONS || ``} --require ${dynamicRequire["a" /* dynamicRequire */].resolve(`@berry/pnpify/lib`)}`.trim(); - const child = cross_spawn_default()(name, argv, { - env: Object.assign({}, process.env, { NODE_OPTIONS }), - stdio: `inherit`, - }); - child.on(`exit`, code => { - process.exitCode = code !== null ? code : 1; - }); -} - - -/***/ }) -/******/ ]); \ No newline at end of file diff --git a/packages/berry-pnpify/lib/dynamicRequire.d.ts b/packages/berry-pnpify/lib/dynamicRequire.d.ts deleted file mode 100644 index 89c85635123a..000000000000 --- a/packages/berry-pnpify/lib/dynamicRequire.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -declare const dynamicRequire: any; -export { dynamicRequire }; diff --git a/packages/berry-pnpify/lib/generateSdk.d.ts b/packages/berry-pnpify/lib/generateSdk.d.ts deleted file mode 100644 index fc43fe5b27ac..000000000000 --- a/packages/berry-pnpify/lib/generateSdk.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { PortablePath } from '@berry/fslib'; -export declare const generateEslintWrapper: (projectRoot: PortablePath, target: PortablePath) => Promise; -export declare const generateSdk: (projectRoot: PortablePath) => Promise; diff --git a/packages/berry-pnpify/lib/index.d.ts b/packages/berry-pnpify/lib/index.d.ts deleted file mode 100644 index 258a41aba7c1..000000000000 --- a/packages/berry-pnpify/lib/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { NodeModulesFS } from './NodeModulesFS'; -export declare const patchFs: () => void; -export { NodeModulesFS }; diff --git a/packages/berry-pnpify/lib/index.js b/packages/berry-pnpify/lib/index.js deleted file mode 100644 index 666e05819218..000000000000 --- a/packages/berry-pnpify/lib/index.js +++ /dev/null @@ -1,1455 +0,0 @@ -module.exports = -/******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ 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; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __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 = 32); -/******/ }) -/************************************************************************/ -/******/ ({ - -/***/ 0: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return PortablePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return npath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "e", function() { return ppath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return fromPortablePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "g", function() { return toPortablePath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return convertPath; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "f", function() { return toFilename; }); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4); -/* harmony import */ var path__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path__WEBPACK_IMPORTED_MODULE_0__); - -const PortablePath = { - root: `/`, - dot: `.`, -}; -const npath = path__WEBPACK_IMPORTED_MODULE_0___default.a; -const ppath = path__WEBPACK_IMPORTED_MODULE_0___default.a.posix; -const WINDOWS_PATH_REGEXP = /^[a-zA-Z]:.*$/; -const PORTABLE_PATH_REGEXP = /^\/[a-zA-Z]:.*$/; -// Path should look like "/N:/berry/scripts/plugin-pack.js" -// And transform to "N:\berry\scripts\plugin-pack.js" -function fromPortablePath(p) { - if (process.platform !== 'win32') - return p; - return p.match(PORTABLE_PATH_REGEXP) ? p.substring(1).replace(/\//g, `\\`) : p; -} -// Path should look like "N:/berry/scripts/plugin-pack.js" -// And transform to "/N:/berry/scripts/plugin-pack.js" -function toPortablePath(p) { - if (process.platform !== 'win32') - return p; - return (p.match(WINDOWS_PATH_REGEXP) ? `/${p}` : p).replace(/\\/g, `/`); -} -function convertPath(targetPathUtils, sourcePath) { - return (targetPathUtils === npath ? fromPortablePath(sourcePath) : toPortablePath(sourcePath)); -} -function toFilename(filename) { - if (npath.parse(filename).dir !== '' || ppath.parse(filename).dir !== '') - throw new Error(`Invalid filename: "${filename}"`); - return filename; -} - - -/***/ }), - -/***/ 1: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return patchFs; }); -/* unused harmony export extendFs */ -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return xfs; }); -/* harmony import */ var _NodeFS__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); - - - - - - - - - - - - - - -function patchFs(patchedFs, fakeFs) { - const SYNC_IMPLEMENTATIONS = new Set([ - `accessSync`, - `createReadStream`, - `chmodSync`, - `copyFileSync`, - `lstatSync`, - `openSync`, - `readlinkSync`, - `readFileSync`, - `readdirSync`, - `readlinkSync`, - `realpathSync`, - `rmdirSync`, - `statSync`, - `symlinkSync`, - `unlinkSync`, - `utimesSync`, - `watch`, - `writeFileSync`, - ]); - const ASYNC_IMPLEMENTATIONS = new Set([ - `accessPromise`, - `chmodPromise`, - `copyFilePromise`, - `lstatPromise`, - `openPromise`, - `readdirPromise`, - `realpathPromise`, - `readFilePromise`, - `readdirPromise`, - `readlinkPromise`, - `rmdirPromise`, - `statPromise`, - `symlinkPromise`, - `unlinkPromise`, - `utimesPromise`, - `writeFilePromise`, - ]); - patchedFs.existsSync = (p) => { - try { - return fakeFs.existsSync(p); - } - catch (error) { - return false; - } - }; - patchedFs.exists = (p, callback) => { - fakeFs.existsPromise(p).then(result => { - if (callback) { - callback(result); - } - }, () => { - if (callback) { - callback(false); - } - }); - }; - for (const fnName of ASYNC_IMPLEMENTATIONS) { - const fakeImpl = fakeFs[fnName].bind(fakeFs); - const origName = fnName.replace(/Promise$/, ``); - patchedFs[origName] = (...args) => { - const hasCallback = typeof args[args.length - 1] === `function`; - const callback = hasCallback ? args.pop() : () => { }; - fakeImpl(...args).then((result) => { - callback(undefined, result); - }, (error) => { - callback(error); - }); - }; - } - for (const fnName of SYNC_IMPLEMENTATIONS) { - const fakeImpl = fakeFs[fnName].bind(fakeFs); - const origName = fnName; - patchedFs[origName] = fakeImpl; - } - patchedFs.realpathSync.native = patchedFs.realpathSync; - patchedFs.realpath.native = patchedFs.realpath; -} -function extendFs(realFs, fakeFs) { - const patchedFs = Object.create(realFs); - patchFs(patchedFs, fakeFs); - return patchedFs; -} -const xfs = new _NodeFS__WEBPACK_IMPORTED_MODULE_0__[/* NodeFS */ "a"](); - - -/***/ }), - -/***/ 2: -/***/ (function(module, exports) { - -module.exports = require("fs"); - -/***/ }), - -/***/ 3: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return FakeFS; }); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BasePortableFakeFS; }); -/* harmony import */ var _path__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); - - -class FakeFS { - constructor(pathUtils) { - this.pathUtils = pathUtils; - } - async removePromise(p) { - let stat; - try { - stat = await this.lstatPromise(p); - } - catch (error) { - if (error.code === `ENOENT`) { - return; - } - else { - throw error; - } - } - if (stat.isDirectory()) { - for (const entry of await this.readdirPromise(p)) - await this.removePromise(this.pathUtils.resolve(p, entry)); - // 5 gives 1s worth of retries at worst - for (let t = 0; t < 5; ++t) { - try { - await this.rmdirPromise(p); - break; - } - catch (error) { - if (error.code === `EBUSY` || error.code === `ENOTEMPTY`) { - await new Promise(resolve => setTimeout(resolve, t * 100)); - continue; - } - else { - throw error; - } - } - } - } - else { - await this.unlinkPromise(p); - } - } - removeSync(p) { - let stat; - try { - stat = this.lstatSync(p); - } - catch (error) { - if (error.code === `ENOENT`) { - return; - } - else { - throw error; - } - } - if (stat.isDirectory()) { - for (const entry of this.readdirSync(p)) - this.removeSync(this.pathUtils.resolve(p, entry)); - this.rmdirSync(p); - } - else { - this.unlinkSync(p); - } - } - async mkdirpPromise(p, { chmod, utimes } = {}) { - p = this.resolve(p); - if (p === this.pathUtils.dirname(p)) - return; - const parts = p.split(this.pathUtils.sep); - for (let u = 2; u <= parts.length; ++u) { - const subPath = parts.slice(0, u).join(this.pathUtils.sep); - if (!this.existsSync(subPath)) { - try { - await this.mkdirPromise(subPath); - } - catch (error) { - if (error.code === `EEXIST`) { - continue; - } - else { - throw error; - } - } - if (chmod != null) - await this.chmodPromise(subPath, chmod); - if (utimes != null) { - await this.utimesPromise(subPath, utimes[0], utimes[1]); - } - } - } - } - mkdirpSync(p, { chmod, utimes } = {}) { - p = this.resolve(p); - if (p === this.pathUtils.dirname(p)) - return; - const parts = p.split(this.pathUtils.sep); - for (let u = 2; u <= parts.length; ++u) { - const subPath = parts.slice(0, u).join(this.pathUtils.sep); - if (!this.existsSync(subPath)) { - try { - this.mkdirSync(subPath); - } - catch (error) { - if (error.code === `EEXIST`) { - continue; - } - else { - throw error; - } - } - if (chmod != null) - this.chmodSync(subPath, chmod); - if (utimes != null) { - this.utimesSync(subPath, utimes[0], utimes[1]); - } - } - } - } - async copyPromise(destination, source, { baseFs = this, overwrite = true } = {}) { - const stat = await baseFs.lstatPromise(source); - const exists = await this.existsSync(destination); - if (stat.isDirectory()) { - await this.mkdirpPromise(destination); - const directoryListing = await baseFs.readdirPromise(source); - await Promise.all(directoryListing.map(entry => { - return this.copyPromise(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite }); - })); - } - else if (stat.isFile()) { - if (!exists || overwrite) { - if (exists) - await this.removePromise(destination); - const content = await baseFs.readFilePromise(source); - await this.writeFilePromise(destination, content); - } - } - else if (stat.isSymbolicLink()) { - if (!exists || overwrite) { - if (exists) - await this.removePromise(destination); - const target = await baseFs.readlinkPromise(source); - await this.symlinkPromise(Object(_path__WEBPACK_IMPORTED_MODULE_0__[/* convertPath */ "b"])(this.pathUtils, target), destination); - } - } - else { - throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`); - } - const mode = stat.mode & 0o777; - await this.chmodPromise(destination, mode); - } - copySync(destination, source, { baseFs = this, overwrite = true } = {}) { - const stat = baseFs.lstatSync(source); - const exists = this.existsSync(destination); - if (stat.isDirectory()) { - this.mkdirpSync(destination); - const directoryListing = baseFs.readdirSync(source); - for (const entry of directoryListing) { - this.copySync(this.pathUtils.join(destination, entry), baseFs.pathUtils.join(source, entry), { baseFs, overwrite }); - } - } - else if (stat.isFile()) { - if (!exists || overwrite) { - if (exists) - this.removeSync(destination); - const content = baseFs.readFileSync(source); - this.writeFileSync(destination, content); - } - } - else if (stat.isSymbolicLink()) { - if (!exists || overwrite) { - if (exists) - this.removeSync(destination); - const target = baseFs.readlinkSync(source); - this.symlinkSync(Object(_path__WEBPACK_IMPORTED_MODULE_0__[/* convertPath */ "b"])(this.pathUtils, target), destination); - } - } - else { - throw new Error(`Unsupported file type (file: ${source}, mode: 0o${stat.mode.toString(8).padStart(6, `0`)})`); - } - const mode = stat.mode & 0o777; - this.chmodSync(destination, mode); - } - async changeFilePromise(p, content) { - try { - const current = await this.readFilePromise(p, `utf8`); - if (current === content) { - return; - } - } - catch (error) { - // ignore errors, no big deal - } - await this.writeFilePromise(p, content); - } - changeFileSync(p, content) { - try { - const current = this.readFileSync(p, `utf8`); - if (current === content) { - return; - } - } - catch (error) { - // ignore errors, no big deal - } - this.writeFileSync(p, content); - } - async movePromise(fromP, toP) { - try { - await this.renamePromise(fromP, toP); - } - catch (error) { - if (error.code === `EXDEV`) { - await this.copyPromise(toP, fromP); - await this.removePromise(fromP); - } - else { - throw error; - } - } - } - moveSync(fromP, toP) { - try { - this.renameSync(fromP, toP); - } - catch (error) { - if (error.code === `EXDEV`) { - this.copySync(toP, fromP); - this.removeSync(fromP); - } - else { - throw error; - } - } - } - async lockPromise(affectedPath, callback) { - const lockPath = `${affectedPath}.lock`; - const interval = 1000 / 60; - const timeout = Date.now() + 60 * 1000; - let fd = null; - while (fd === null) { - try { - fd = await this.openPromise(lockPath, `wx`); - } - catch (error) { - if (error.code === `EEXIST`) { - if (Date.now() < timeout) { - await new Promise(resolve => setTimeout(resolve, interval)); - } - else { - throw new Error(`Couldn't acquire a lock in a reasonable time (via ${lockPath})`); - } - } - else { - throw error; - } - } - } - try { - return await callback(); - } - finally { - await this.closePromise(fd); - await this.unlinkPromise(lockPath); - } - } -} -; -class BasePortableFakeFS extends FakeFS { - constructor() { - super(_path__WEBPACK_IMPORTED_MODULE_0__[/* ppath */ "e"]); - } - resolve(p) { - return this.pathUtils.resolve(_path__WEBPACK_IMPORTED_MODULE_0__[/* PortablePath */ "a"].root, p); - } -} - - -/***/ }), - -/***/ 32: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); - -// EXTERNAL MODULE: ../berry-fslib/sources/index.ts -var sources = __webpack_require__(1); - -// EXTERNAL MODULE: external "fs" -var external_fs_ = __webpack_require__(2); -var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_); - -// EXTERNAL MODULE: ../berry-fslib/sources/ProxiedFS.ts -var ProxiedFS = __webpack_require__(7); - -// EXTERNAL MODULE: ../berry-fslib/sources/NodeFS.ts -var NodeFS = __webpack_require__(5); - -// EXTERNAL MODULE: ../berry-fslib/sources/FakeFS.ts -var FakeFS = __webpack_require__(3); - -// EXTERNAL MODULE: ../berry-fslib/sources/path.ts -var sources_path = __webpack_require__(0); - -// CONCATENATED MODULE: ./sources/PortablePnPApi.ts - -/** - * PnP API wrapper working with portable paths - */ -class PortablePnPApi_PortablePnPApi { - constructor(baseApi) { - this.pnp = baseApi; - this.VERSIONS = baseApi.VERSIONS; - this.topLevel = baseApi.topLevel; - } - getPackageInformation(locator) { - const nativeInfo = this.pnp.getPackageInformation(locator); - let portableInfo = null; - if (nativeInfo) { - portableInfo = { - packageLocation: NodeFS["a" /* NodeFS */].toPortablePath(nativeInfo.packageLocation), - packageDependencies: nativeInfo.packageDependencies, - }; - } - return portableInfo; - } - findPackageLocator(location) { - return this.pnp.findPackageLocator(NodeFS["a" /* NodeFS */].fromPortablePath(location)); - } - resolveToUnqualified(request, issuer, opts) { - const result = this.pnp.resolveToUnqualified(request, !issuer ? null : NodeFS["a" /* NodeFS */].fromPortablePath(issuer), opts); - return !result ? null : NodeFS["a" /* NodeFS */].toPortablePath(result); - } - resolveUnqualified(unqualified, opts) { - return NodeFS["a" /* NodeFS */].toPortablePath(this.pnp.resolveUnqualified(NodeFS["a" /* NodeFS */].fromPortablePath(unqualified), opts)); - } - resolveRequest(request, issuer, opts) { - const result = this.pnp.resolveRequest(request, !issuer ? null : NodeFS["a" /* NodeFS */].fromPortablePath(issuer), opts); - return !result ? null : NodeFS["a" /* NodeFS */].toPortablePath(result); - } -} - -// CONCATENATED MODULE: ./sources/NodePathResolver.ts - - -/** - * Regexp for pathname that catches the following paths: - * - * 1. A path without `/node_modules` in the beginning. We don't process these, since they cannot be inside any of PnP package roots - * 2. A path with incomplete or complete package name inside, e.g. `/node_modules[/@scope][/foo]` - * - * And everything at the end of the pathname - */ -const NODE_MODULES_REGEXP = /(?:\/node_modules((?:\/@[^\/]+)?(?:\/[^@][^\/]+)?))?(.*)/; -/** - * Resolves `node_modules` paths inside PnP projects. - * - * The idea: for path like `node_modules/foo/node_modules/bar` we use `foo` as an issuer - * and resolve `bar` for this issuer using `pnpapi`. - */ -class NodePathResolver_NodePathResolver { - /** - * Constructs new instance of Node path resolver - * - * @param pnp PnP API instance - */ - constructor(pnp) { - this.pnp = new PortablePnPApi_PortablePnPApi(pnp); - } - /** - * Returns `readdir`-like result for partially resolved pnp path - * - * @param issuerInfo issuer package information - * @param scope null - for `/node_modules` dir list or '@scope' - for `/node_modules/@scope` dir list - * - * @returns `undefined` - if dir does not exist, or `readdir`-like list of subdirs in the virtual dir - */ - readDir(issuerInfo, scope) { - const result = new Set(); - for (const key of issuerInfo.packageDependencies.keys()) { - const [pkgNameOrScope, pkgName] = key.split('/'); - if (!scope) { - if (!result.has(Object(sources_path["f" /* toFilename */])(pkgNameOrScope))) { - result.add(Object(sources_path["f" /* toFilename */])(pkgNameOrScope)); - } - } - else if (scope === pkgNameOrScope) { - result.add(Object(sources_path["f" /* toFilename */])(pkgName)); - } - } - return result.size === 0 ? undefined : Array.from(result); - } - getIssuer(pnp, pathname) { - const locator = pnp.findPackageLocator(sources_path["e" /* ppath */].join(pathname, sources_path["e" /* ppath */].sep)); - const info = locator && pnp.getPackageInformation(locator); - return !info ? undefined : info.packageLocation; - } - /** - * Resolves paths containing `/node_modules` inside PnP projects. If path is outside PnP - * project it is not changed. - * - * This method extracts `.../node_modules/pkgName/...` from the path - * and uses previous package as an issuer for the next package. - * - * @param nodePath full path containing `node_modules` - * - * @returns resolved path - */ - resolvePath(nodePath) { - const result = { resolvedPath: nodePath }; - const marker = `/node_modules`; - const index = nodePath.indexOf(marker); - // Non-node_modules paths should not be processed - if (index === -1 || (index + marker.length < nodePath.length && nodePath.charAt(index + marker.length) !== `/`)) - return result; - // Directories that start with a dot are usually cache folders and shouldn't be touched - if (nodePath.charAt(index + marker.length + 1) === `.`) - return result; - // Extract first issuer from the path using PnP API - let issuer = this.getIssuer(this.pnp, nodePath); - // If we have something left in a path to parse, do that - if (issuer && nodePath.length > issuer.length) { - let request = nodePath.substring(issuer.length); - let m; - let rest; - let pkgName; - let partialPackageName = false; - do { - m = request.match(NODE_MODULES_REGEXP); - if (m && issuer) { - [, pkgName, rest] = m; - request = rest; - // Strip starting / - pkgName = pkgName ? pkgName.substring(1) : pkgName; - // Check if full package name was provided - if (pkgName !== undefined) { - if (pkgName.length > 0 && (pkgName[0] !== '@' || pkgName.indexOf(sources_path["e" /* ppath */].sep) > 0)) { - try { - let res = this.pnp.resolveToUnqualified(pkgName, sources_path["e" /* ppath */].join(issuer, sources_path["e" /* ppath */].sep)); - issuer = res === null || res === issuer ? undefined : res; - } - catch (e) { - issuer = undefined; - break; - } - } - else { - request = pkgName; - pkgName = undefined; - partialPackageName = true; - } - } - } - // Continue parsing path remainder until we have something left in a `request` - // and we still have not lost the issuer - } while (request && pkgName && issuer); - if (issuer) { - if (partialPackageName) { - const locator = this.pnp.findPackageLocator(sources_path["e" /* ppath */].join(issuer, sources_path["e" /* ppath */].sep)); - const issuerInfo = locator ? this.pnp.getPackageInformation(locator) : undefined; - if (issuerInfo) { - const scope = request || null; - result.dirList = this.readDir(issuerInfo, scope); - } - if (result.dirList) { - result.statPath = issuer; - } - else { - result.resolvedPath = null; - } - } - else { - result.resolvedPath = sources_path["e" /* ppath */].join(issuer, request); - } - } - else { - // If we don't have issuer here, it means the path cannot exist in PnP project - result.resolvedPath = null; - } - } - return result; - } -} - -// CONCATENATED MODULE: ./sources/NodeModulesFS.ts - - - - -class NodeModulesFS_NodeModulesFS extends ProxiedFS["a" /* ProxiedFS */] { - constructor(pnp, { realFs = external_fs_default.a } = {}) { - super(sources_path["d" /* npath */]); - this.baseFs = new NodeModulesFS_PortableNodeModulesFs(pnp, { baseFs: new NodeFS["a" /* NodeFS */](realFs) }); - } - mapFromBase(path) { - return NodeFS["a" /* NodeFS */].fromPortablePath(path); - } - mapToBase(path) { - return NodeFS["a" /* NodeFS */].toPortablePath(path); - } -} -class NodeModulesFS_PortableNodeModulesFs extends FakeFS["b" /* FakeFS */] { - constructor(pnp, { baseFs = new NodeFS["a" /* NodeFS */]() } = {}) { - super(sources_path["e" /* ppath */]); - this.baseFs = baseFs; - this.pathResolver = new NodePathResolver_NodePathResolver(pnp); - } - resolve(path) { - return this.baseFs.resolve(this.resolvePath(path).resolvedPath); - } - getBaseFs() { - return this.baseFs; - } - resolvePath(p) { - const fullOriginalPath = this.pathUtils.resolve(p); - return Object.assign({}, this.pathResolver.resolvePath(fullOriginalPath), { fullOriginalPath }); - } - resolveFilePath(p) { - const pnpPath = this.resolvePath(p); - if (!pnpPath.resolvedPath) { - throw NodeModulesFS_PortableNodeModulesFs.createFsError('ENOENT', `no such file or directory, stat '${p}'`); - } - else { - return pnpPath.resolvedPath; - } - } - resolveLink(p, op, onSymlink, onRealPath) { - const pnpPath = this.resolvePath(p); - if (!pnpPath.resolvedPath) { - throw NodeModulesFS_PortableNodeModulesFs.createFsError('ENOENT', `no such file or directory, ${op} '${p}'`); - } - else { - if (pnpPath.resolvedPath !== pnpPath.fullOriginalPath) { - try { - const stats = this.baseFs.lstatSync(pnpPath.statPath || pnpPath.resolvedPath); - if (stats.isDirectory()) { - throw NodeModulesFS_PortableNodeModulesFs.createFsError('EINVAL', `invalid argument, ${op} '${p}'`); - } - else { - return onSymlink(stats, this.pathUtils.relative(this.pathUtils.dirname(pnpPath.fullOriginalPath), pnpPath.statPath || pnpPath.resolvedPath)); - } - } - catch (e) { - } - } - } - return onRealPath(pnpPath.statPath || pnpPath.resolvedPath); - } - static makeSymlinkStats(stats) { - return Object.assign(stats, { - isFile: () => false, - isDirectory: () => false, - isSymbolicLink: () => true, - }); - } - static createFsError(code, message) { - return Object.assign(new Error(`${code}: ${message}`), { code }); - } - throwIfPathReadonly(op, p) { - const pnpPath = this.resolvePath(p); - if (pnpPath.resolvedPath !== pnpPath.fullOriginalPath) { - throw NodeModulesFS_PortableNodeModulesFs.createFsError('EPERM', `operation not permitted, ${op} '${p}'`); - } - else { - return p; - } - } - resolveDirOrFilePath(p) { - const pnpPath = this.resolvePath(p); - if (!pnpPath.resolvedPath) { - throw NodeModulesFS_PortableNodeModulesFs.createFsError('ENOENT', `no such file or directory, stat '${p}'`); - } - else { - return pnpPath.statPath || pnpPath.resolvedPath; - } - } - getRealPath() { - return this.baseFs.getRealPath(); - } - async openPromise(p, flags, mode) { - return await this.baseFs.openPromise(this.resolveFilePath(p), flags, mode); - } - openSync(p, flags, mode) { - return this.baseFs.openSync(this.resolveFilePath(p), flags, mode); - } - async closePromise(fd) { - await this.baseFs.closePromise(fd); - } - closeSync(fd) { - this.baseFs.closeSync(fd); - } - createReadStream(p, opts) { - return this.baseFs.createReadStream(this.resolveFilePath(p), opts); - } - createWriteStream(p, opts) { - return this.baseFs.createWriteStream(this.throwIfPathReadonly('createWriteStream', p), opts); - } - async realpathPromise(p) { - const targetPath = this.resolveFilePath(p); - const stats = await this.baseFs.statPromise(targetPath); - // We return the symlink paths for folder to try to keep virtual paths alive as long as we can - return stats.isDirectory() ? targetPath : await this.baseFs.realpathPromise(targetPath); - } - realpathSync(p) { - const targetPath = this.resolveFilePath(p); - const stats = this.baseFs.statSync(targetPath); - // We return the symlink paths for folder to try to keep virtual paths alive as long as we can - return stats.isDirectory() ? targetPath : this.baseFs.realpathSync(targetPath); - } - async existsPromise(p) { - const pnpPath = this.resolvePath(p); - if (!pnpPath.resolvedPath) { - return false; - } - else if (pnpPath.statPath) { - return true; - } - else { - return await this.baseFs.existsPromise(pnpPath.resolvedPath); - } - } - existsSync(p) { - const pnpPath = this.resolvePath(p); - if (!pnpPath.resolvedPath) { - return false; - } - else if (pnpPath.statPath) { - return true; - } - else { - return this.baseFs.existsSync(pnpPath.resolvedPath); - } - } - async accessPromise(p, mode) { - return await this.baseFs.accessPromise(this.resolveDirOrFilePath(p), mode); - } - accessSync(p, mode) { - return this.baseFs.accessSync(this.resolveDirOrFilePath(p), mode); - } - async statPromise(p) { - return await this.baseFs.statPromise(this.resolveDirOrFilePath(p)); - } - statSync(p) { - return this.baseFs.statSync(this.resolveDirOrFilePath(p)); - } - async lstatPromise(p) { - return this.resolveLink(p, 'lstat', (stats) => NodeModulesFS_PortableNodeModulesFs.makeSymlinkStats(stats), async (resolvedPath) => await this.baseFs.lstatPromise(resolvedPath)); - } - lstatSync(p) { - return this.resolveLink(p, 'lstat', (stats) => NodeModulesFS_PortableNodeModulesFs.makeSymlinkStats(stats), (resolvedPath) => this.baseFs.lstatSync(this.resolveDirOrFilePath(resolvedPath))); - } - async chmodPromise(p, mask) { - return await this.baseFs.chmodPromise(this.throwIfPathReadonly('chmod', p), mask); - } - chmodSync(p, mask) { - return this.baseFs.chmodSync(this.throwIfPathReadonly('chmodSync', p), mask); - } - async renamePromise(oldP, newP) { - return await this.baseFs.renamePromise(this.throwIfPathReadonly('rename', oldP), this.throwIfPathReadonly('rename', newP)); - } - renameSync(oldP, newP) { - return this.baseFs.renameSync(this.throwIfPathReadonly('renameSync', oldP), this.throwIfPathReadonly('renameSync', newP)); - } - async copyFilePromise(sourceP, destP, flags) { - return await this.baseFs.copyFilePromise(this.resolveFilePath(sourceP), this.throwIfPathReadonly('copyFile', destP), flags); - } - copyFileSync(sourceP, destP, flags) { - return this.baseFs.copyFileSync(this.resolveFilePath(sourceP), this.throwIfPathReadonly('copyFileSync', destP), flags); - } - async writeFilePromise(p, content, opts) { - return await this.baseFs.writeFilePromise(this.throwIfPathReadonly('writeFile', p), content, opts); - } - writeFileSync(p, content, opts) { - return this.baseFs.writeFileSync(this.throwIfPathReadonly('writeFileSync', p), content, opts); - } - async unlinkPromise(p) { - return await this.baseFs.unlinkPromise(this.throwIfPathReadonly('unlink', p)); - } - unlinkSync(p) { - return this.baseFs.unlinkSync(this.throwIfPathReadonly('unlinkSync', p)); - } - async utimesPromise(p, atime, mtime) { - return await this.baseFs.utimesPromise(this.resolveDirOrFilePath(p), atime, mtime); - } - utimesSync(p, atime, mtime) { - return this.baseFs.utimesSync(this.resolveDirOrFilePath(p), atime, mtime); - } - async mkdirPromise(p) { - return await this.baseFs.mkdirPromise(this.throwIfPathReadonly('mkdir', p)); - } - mkdirSync(p) { - return this.baseFs.mkdirSync(this.throwIfPathReadonly('mkdirSync', p)); - } - async rmdirPromise(p) { - return await this.baseFs.rmdirPromise(this.throwIfPathReadonly('rmdir', p)); - } - rmdirSync(p) { - return this.baseFs.rmdirSync(this.throwIfPathReadonly('rmdirSync', p)); - } - async symlinkPromise(target, p) { - return await this.baseFs.symlinkPromise(this.resolveDirOrFilePath(target), this.throwIfPathReadonly('symlink', p)); - } - symlinkSync(target, p) { - return this.baseFs.symlinkSync(this.resolveDirOrFilePath(target), this.throwIfPathReadonly('symlinkSync', p)); - } - async readFilePromise(p, encoding) { - // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered) - switch (encoding) { - case `utf8`: - return await this.baseFs.readFilePromise(this.resolveFilePath(p), encoding); - default: - return await this.baseFs.readFilePromise(this.resolveFilePath(p), encoding); - } - } - readFileSync(p, encoding) { - // This weird switch is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered) - switch (encoding) { - case `utf8`: - return this.baseFs.readFileSync(this.resolveFilePath(p), encoding); - default: - return this.baseFs.readFileSync(this.resolveFilePath(p), encoding); - } - } - async readdirPromise(p) { - const pnpPath = this.resolvePath(p); - if (!pnpPath.resolvedPath) { - throw NodeModulesFS_PortableNodeModulesFs.createFsError('ENOENT', `no such file or directory, scandir '${p}'`); - } - else if (pnpPath.dirList) { - return pnpPath.dirList; - } - else { - return await this.baseFs.readdirPromise(pnpPath.resolvedPath); - } - } - readdirSync(p) { - const pnpPath = this.resolvePath(p); - if (!pnpPath.resolvedPath) { - throw NodeModulesFS_PortableNodeModulesFs.createFsError('ENOENT', `no such file or directory, scandir '${p}'`); - } - else if (pnpPath.dirList) { - return pnpPath.dirList; - } - else { - return this.baseFs.readdirSync(pnpPath.resolvedPath); - } - } - async readlinkPromise(p) { - return this.resolveLink(p, 'readlink', (_stats, targetPath) => targetPath, async (targetPath) => await this.baseFs.readlinkPromise(this.resolveDirOrFilePath(targetPath))); - } - readlinkSync(p) { - return this.resolveLink(p, 'readlink', (_stats, targetPath) => targetPath, (targetPath) => this.baseFs.readlinkSync(this.resolveDirOrFilePath(targetPath))); - } - watch(p, a, b) { - return this.baseFs.watch(p, - // @ts-ignore - a, b); - } -} - -// EXTERNAL MODULE: ./sources/dynamicRequire.ts -var dynamicRequire = __webpack_require__(6); - -// CONCATENATED MODULE: ./sources/index.ts -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "patchFs", function() { return patchFs; }); -/* concated harmony reexport NodeModulesFS */__webpack_require__.d(__webpack_exports__, "NodeModulesFS", function() { return NodeModulesFS_NodeModulesFS; }); - - - - -let fsPatched = false; -let sources_pnp; -try { - sources_pnp = Object(dynamicRequire["a" /* dynamicRequire */])('pnpapi'); -} -catch (e) { -} -const patchFs = () => { - if (sources_pnp && !fsPatched) { - const realFs = Object.assign({}, external_fs_default.a); - const nodeModulesFS = new NodeModulesFS_NodeModulesFS(sources_pnp, { realFs }); - Object(sources["a" /* patchFs */])(external_fs_default.a, nodeModulesFS); - fsPatched = true; - } -}; -if (!process.mainModule) - patchFs(); - - - -/***/ }), - -/***/ 4: -/***/ (function(module, exports) { - -module.exports = require("path"); - -/***/ }), - -/***/ 5: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return NodeFS; }); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); -/* harmony import */ var fs__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(fs__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _FakeFS__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); -/* harmony import */ var _path__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); - - - - -class NodeFS extends _FakeFS__WEBPACK_IMPORTED_MODULE_1__[/* BasePortableFakeFS */ "a"] { - constructor(realFs = fs__WEBPACK_IMPORTED_MODULE_0___default.a) { - super(); - this.realFs = realFs; - } - getRealPath() { - return _path__WEBPACK_IMPORTED_MODULE_2__[/* PortablePath */ "a"].root; - } - async openPromise(p, flags, mode) { - return await new Promise((resolve, reject) => { - this.realFs.open(NodeFS.fromPortablePath(p), flags, mode, this.makeCallback(resolve, reject)); - }); - } - openSync(p, flags, mode) { - return this.realFs.openSync(NodeFS.fromPortablePath(p), flags, mode); - } - async closePromise(fd) { - await new Promise((resolve, reject) => { - this.realFs.close(fd, this.makeCallback(resolve, reject)); - }); - } - closeSync(fd) { - this.realFs.closeSync(fd); - } - createReadStream(p, opts) { - const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p); - return this.realFs.createReadStream(realPath, opts); - } - createWriteStream(p, opts) { - const realPath = (p !== null ? NodeFS.fromPortablePath(p) : p); - return this.realFs.createWriteStream(realPath, opts); - } - async realpathPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.realpath(NodeFS.fromPortablePath(p), {}, this.makeCallback(resolve, reject)); - }).then(path => { - return NodeFS.toPortablePath(path); - }); - } - realpathSync(p) { - return NodeFS.toPortablePath(this.realFs.realpathSync(NodeFS.fromPortablePath(p), {})); - } - async existsPromise(p) { - return await new Promise(resolve => { - this.realFs.exists(NodeFS.fromPortablePath(p), resolve); - }); - } - accessSync(p, mode) { - return this.realFs.accessSync(NodeFS.fromPortablePath(p), mode); - } - async accessPromise(p, mode) { - return await new Promise((resolve, reject) => { - this.realFs.access(NodeFS.fromPortablePath(p), mode, this.makeCallback(resolve, reject)); - }); - } - existsSync(p) { - return this.realFs.existsSync(NodeFS.fromPortablePath(p)); - } - async statPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.stat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - statSync(p) { - return this.realFs.statSync(NodeFS.fromPortablePath(p)); - } - async lstatPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.lstat(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - lstatSync(p) { - return this.realFs.lstatSync(NodeFS.fromPortablePath(p)); - } - async chmodPromise(p, mask) { - return await new Promise((resolve, reject) => { - this.realFs.chmod(NodeFS.fromPortablePath(p), mask, this.makeCallback(resolve, reject)); - }); - } - chmodSync(p, mask) { - return this.realFs.chmodSync(NodeFS.fromPortablePath(p), mask); - } - async renamePromise(oldP, newP) { - return await new Promise((resolve, reject) => { - this.realFs.rename(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP), this.makeCallback(resolve, reject)); - }); - } - renameSync(oldP, newP) { - return this.realFs.renameSync(NodeFS.fromPortablePath(oldP), NodeFS.fromPortablePath(newP)); - } - async copyFilePromise(sourceP, destP, flags = 0) { - return await new Promise((resolve, reject) => { - this.realFs.copyFile(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags, this.makeCallback(resolve, reject)); - }); - } - copyFileSync(sourceP, destP, flags = 0) { - return this.realFs.copyFileSync(NodeFS.fromPortablePath(sourceP), NodeFS.fromPortablePath(destP), flags); - } - async writeFilePromise(p, content, opts) { - return await new Promise((resolve, reject) => { - if (opts) { - this.realFs.writeFile(NodeFS.fromPortablePath(p), content, opts, this.makeCallback(resolve, reject)); - } - else { - this.realFs.writeFile(NodeFS.fromPortablePath(p), content, this.makeCallback(resolve, reject)); - } - }); - } - writeFileSync(p, content, opts) { - if (opts) { - this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content, opts); - } - else { - this.realFs.writeFileSync(NodeFS.fromPortablePath(p), content); - } - } - async unlinkPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.unlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - unlinkSync(p) { - return this.realFs.unlinkSync(NodeFS.fromPortablePath(p)); - } - async utimesPromise(p, atime, mtime) { - return await new Promise((resolve, reject) => { - this.realFs.utimes(NodeFS.fromPortablePath(p), atime, mtime, this.makeCallback(resolve, reject)); - }); - } - utimesSync(p, atime, mtime) { - this.realFs.utimesSync(NodeFS.fromPortablePath(p), atime, mtime); - } - async mkdirPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.mkdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - mkdirSync(p) { - return this.realFs.mkdirSync(NodeFS.fromPortablePath(p)); - } - async rmdirPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.rmdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - rmdirSync(p) { - return this.realFs.rmdirSync(NodeFS.fromPortablePath(p)); - } - async symlinkPromise(target, p) { - const type = target.endsWith(`/`) ? `dir` : `file`; - return await new Promise((resolve, reject) => { - this.realFs.symlink(NodeFS.fromPortablePath(target.replace(/\/+$/, ``)), NodeFS.fromPortablePath(p), type, this.makeCallback(resolve, reject)); - }); - } - symlinkSync(target, p) { - const type = target.endsWith(`/`) ? `dir` : `file`; - return this.realFs.symlinkSync(NodeFS.fromPortablePath(target.replace(/\/+$/, ``)), NodeFS.fromPortablePath(p), type); - } - async readFilePromise(p, encoding) { - return await new Promise((resolve, reject) => { - this.realFs.readFile(NodeFS.fromPortablePath(p), encoding, this.makeCallback(resolve, reject)); - }); - } - readFileSync(p, encoding) { - return this.realFs.readFileSync(NodeFS.fromPortablePath(p), encoding); - } - async readdirPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.readdir(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }); - } - readdirSync(p) { - return this.realFs.readdirSync(NodeFS.fromPortablePath(p)); - } - async readlinkPromise(p) { - return await new Promise((resolve, reject) => { - this.realFs.readlink(NodeFS.fromPortablePath(p), this.makeCallback(resolve, reject)); - }).then(path => { - return NodeFS.toPortablePath(path); - }); - } - readlinkSync(p) { - return NodeFS.toPortablePath(this.realFs.readlinkSync(NodeFS.fromPortablePath(p))); - } - watch(p, a, b) { - return this.realFs.watch(NodeFS.fromPortablePath(p), - // @ts-ignore - a, b); - } - makeCallback(resolve, reject) { - return (err, result) => { - if (err) { - reject(err); - } - else { - resolve(result); - } - }; - } - static fromPortablePath(p) { - return Object(_path__WEBPACK_IMPORTED_MODULE_2__[/* fromPortablePath */ "c"])(p); - } - static toPortablePath(p) { - return Object(_path__WEBPACK_IMPORTED_MODULE_2__[/* toPortablePath */ "g"])(p); - } -} - - -/***/ }), - -/***/ 6: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return dynamicRequire; }); -const dynamicRequire = true - ? require - : undefined; - - - -/***/ }), - -/***/ 7: -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ProxiedFS; }); -/* harmony import */ var _FakeFS__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3); - -class ProxiedFS extends _FakeFS__WEBPACK_IMPORTED_MODULE_0__[/* FakeFS */ "b"] { - resolve(path) { - return this.mapFromBase(this.baseFs.resolve(this.mapToBase(path))); - } - getRealPath() { - return this.mapFromBase(this.baseFs.getRealPath()); - } - openPromise(p, flags, mode) { - return this.baseFs.openPromise(this.mapToBase(p), flags, mode); - } - openSync(p, flags, mode) { - return this.baseFs.openSync(this.mapToBase(p), flags, mode); - } - closePromise(fd) { - return this.baseFs.closePromise(fd); - } - closeSync(fd) { - this.baseFs.closeSync(fd); - } - createReadStream(p, opts) { - return this.baseFs.createReadStream(p !== null ? this.mapToBase(p) : p, opts); - } - createWriteStream(p, opts) { - return this.baseFs.createWriteStream(p !== null ? this.mapToBase(p) : p, opts); - } - async realpathPromise(p) { - return this.mapFromBase(await this.baseFs.realpathPromise(this.mapToBase(p))); - } - realpathSync(p) { - return this.mapFromBase(this.baseFs.realpathSync(this.mapToBase(p))); - } - existsPromise(p) { - return this.baseFs.existsPromise(this.mapToBase(p)); - } - existsSync(p) { - return this.baseFs.existsSync(this.mapToBase(p)); - } - accessSync(p, mode) { - return this.baseFs.accessSync(this.mapToBase(p), mode); - } - accessPromise(p, mode) { - return this.baseFs.accessPromise(this.mapToBase(p), mode); - } - statPromise(p) { - return this.baseFs.statPromise(this.mapToBase(p)); - } - statSync(p) { - return this.baseFs.statSync(this.mapToBase(p)); - } - lstatPromise(p) { - return this.baseFs.lstatPromise(this.mapToBase(p)); - } - lstatSync(p) { - return this.baseFs.lstatSync(this.mapToBase(p)); - } - chmodPromise(p, mask) { - return this.baseFs.chmodPromise(this.mapToBase(p), mask); - } - chmodSync(p, mask) { - return this.baseFs.chmodSync(this.mapToBase(p), mask); - } - renamePromise(oldP, newP) { - return this.baseFs.renamePromise(this.mapToBase(oldP), this.mapToBase(newP)); - } - renameSync(oldP, newP) { - return this.baseFs.renameSync(this.mapToBase(oldP), this.mapToBase(newP)); - } - copyFilePromise(sourceP, destP, flags = 0) { - return this.baseFs.copyFilePromise(this.mapToBase(sourceP), this.mapToBase(destP), flags); - } - copyFileSync(sourceP, destP, flags = 0) { - return this.baseFs.copyFileSync(this.mapToBase(sourceP), this.mapToBase(destP), flags); - } - writeFilePromise(p, content, opts) { - return this.baseFs.writeFilePromise(this.mapToBase(p), content, opts); - } - writeFileSync(p, content, opts) { - return this.baseFs.writeFileSync(this.mapToBase(p), content, opts); - } - unlinkPromise(p) { - return this.baseFs.unlinkPromise(this.mapToBase(p)); - } - unlinkSync(p) { - return this.baseFs.unlinkSync(this.mapToBase(p)); - } - utimesPromise(p, atime, mtime) { - return this.baseFs.utimesPromise(this.mapToBase(p), atime, mtime); - } - utimesSync(p, atime, mtime) { - return this.baseFs.utimesSync(this.mapToBase(p), atime, mtime); - } - mkdirPromise(p) { - return this.baseFs.mkdirPromise(this.mapToBase(p)); - } - mkdirSync(p) { - return this.baseFs.mkdirSync(this.mapToBase(p)); - } - rmdirPromise(p) { - return this.baseFs.rmdirPromise(this.mapToBase(p)); - } - rmdirSync(p) { - return this.baseFs.rmdirSync(this.mapToBase(p)); - } - symlinkPromise(target, p) { - return this.baseFs.symlinkPromise(this.mapToBase(target), this.mapToBase(p)); - } - symlinkSync(target, p) { - return this.baseFs.symlinkSync(this.mapToBase(target), this.mapToBase(p)); - } - readFilePromise(p, encoding) { - // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered) - if (encoding === 'utf8') { - return this.baseFs.readFilePromise(this.mapToBase(p), encoding); - } - else { - return this.baseFs.readFilePromise(this.mapToBase(p), encoding); - } - } - readFileSync(p, encoding) { - // This weird condition is required to tell TypeScript that the signatures are proper (otherwise it thinks that only the generic one is covered) - if (encoding === 'utf8') { - return this.baseFs.readFileSync(this.mapToBase(p), encoding); - } - else { - return this.baseFs.readFileSync(this.mapToBase(p), encoding); - } - } - readdirPromise(p) { - return this.baseFs.readdirPromise(this.mapToBase(p)); - } - readdirSync(p) { - return this.baseFs.readdirSync(this.mapToBase(p)); - } - async readlinkPromise(p) { - return this.mapFromBase(await this.baseFs.readlinkPromise(this.mapToBase(p))); - } - readlinkSync(p) { - return this.mapFromBase(this.baseFs.readlinkSync(this.mapToBase(p))); - } - watch(p, a, b) { - return this.baseFs.watch(this.mapToBase(p), - // @ts-ignore - a, b); - } -} - - -/***/ }) - -/******/ }); \ No newline at end of file diff --git a/packages/berry-pnpify/package.json b/packages/berry-pnpify/package.json index 220011c661d3..e03926523fc7 100644 --- a/packages/berry-pnpify/package.json +++ b/packages/berry-pnpify/package.json @@ -2,7 +2,7 @@ "name": "@berry/pnpify", "version": "0.1.1", "main": "./sources/index.ts", - "bin": "./lib/bin.js", + "bin": "./sources/boot-dev.js", "sideEffects": false, "dependencies": { "@berry/fslib": "workspace:0.1.1", @@ -12,6 +12,7 @@ "@berry/pnp": "workspace:0.1.0", "@types/eslint": "4.16.6", "eslint": "^5.16.0", + "ts-node": "^7.0.1", "typescript": "^3.3.3333", "webpack": "^4.28.4", "webpack-cli": "^3.2.1" @@ -29,14 +30,13 @@ } }, "scripts": { - "build:pnpify": "run webpack-cli --config webpack.config.pkg.js", - "prepack": "rm -rf lib && run build:pnpify && yarn pnpify tsc --emitDeclarationOnly --declaration", - "release": "yarn npm publish", - "test:pnpify:watch": "run test:pnpify --watch", - "test:pnpify": "run test:unit packages/berry-pnpify" + "postpack": "rm -rf lib", + "prepack": "pnpify tsc", + "release": "yarn npm publish" }, "publishConfig": { "main": "./lib/index.js", + "bin": "./lib/boot.js", "types": "./lib/index.d.ts" }, "files": [ diff --git a/packages/berry-pnpify/sources/boot-dev.js b/packages/berry-pnpify/sources/boot-dev.js new file mode 100644 index 000000000000..d5adcf8c2798 --- /dev/null +++ b/packages/berry-pnpify/sources/boot-dev.js @@ -0,0 +1,4 @@ +process.env.NODE_OPTIONS += ` --require ts-node/register/transpile-only`; +require(`ts-node/register/transpile-only`); + +require(`./boot`); diff --git a/packages/berry-pnpify/sources/boot.js b/packages/berry-pnpify/sources/boot.js new file mode 100644 index 000000000000..ad0a6ac7f90b --- /dev/null +++ b/packages/berry-pnpify/sources/boot.js @@ -0,0 +1 @@ +require(`./cli`); diff --git a/packages/berry-pnpify/sources/bin.ts b/packages/berry-pnpify/sources/cli.ts similarity index 97% rename from packages/berry-pnpify/sources/bin.ts rename to packages/berry-pnpify/sources/cli.ts index e521b80525d3..7b765a52150d 100644 --- a/packages/berry-pnpify/sources/bin.ts +++ b/packages/berry-pnpify/sources/cli.ts @@ -41,7 +41,7 @@ function sdk() { function run(name: string, argv: Array) { let {NODE_OPTIONS} = process.env; - NODE_OPTIONS = `${NODE_OPTIONS || ``} --require ${dynamicRequire.resolve(`@berry/pnpify/lib`)}`.trim(); + NODE_OPTIONS = `${NODE_OPTIONS || ``} --require ${dynamicRequire.resolve(`@berry/pnpify`)}`.trim(); const child = crossSpawn(name, argv, { env: {...process.env, NODE_OPTIONS}, diff --git a/packages/berry-pnpify/tsconfig.json b/packages/berry-pnpify/tsconfig.json index b469e1a35ef9..578abd49b004 100644 --- a/packages/berry-pnpify/tsconfig.json +++ b/packages/berry-pnpify/tsconfig.json @@ -2,64 +2,7 @@ "extends": "../../tsconfig.json", "compilerOptions": { "outDir": "lib", - "module": "es2015", - "moduleResolution": "node", - "typeRoots": [ - "../berry-pnp/types", - "../../.yarn/cache/@types-cross-spawn-npm-6.0.0-ac0917e4f56743a2809d07a05b3c47617b6aaa9c1fa45db48f0c56051f0ace06.zip/node_modules/@types", - "../../.yarn/cache/@types-yup-npm-0.26.12-1aea08e4aabab3166ce596f0de76b21e24bd49f8e8a5536f2fba743abf140a94.zip/node_modules/@types", - "../../.yarn/cache/@types-react-redux-npm-6.0.13-ddd59f0426a54cef191d9d551e4f40deb0a957389f987f104433bb135a44c82d.zip/node_modules/@types", - "../../.yarn/cache/@types-minimatch-npm-3.0.3-24dabc9f39e217574c429ee38f9f25d8c38ca0e121194f89a9b3101ab3b7e9f6.zip/node_modules/@types", - "../../.yarn/cache/@types-mkdirp-npm-0.5.2-95df724ec443b3f54a0ba71f52e002fcd8c9d06ad6eacb87c2974b25fd6b39ae.zip/node_modules/@types", - "../../.yarn/cache/@types-dateformat-npm-1.0.2-c2dcc6b887a7584c74b347ff05eed65d51a0c46cf750b8a11b6e264cb21981e2.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-time-npm-4.0.3-7e3b19d21ab7c47ca26b33633d6bb89e5996310b8b8d05491544a3e07ec0746f.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-joinpatterns-npm-4.0.1-ee28590189da422acb28c6344edebf0c412140715e91b5fc597b5f94c17fe03f.zip/node_modules/@types", - "../../.yarn/cache/@types-redux-saga-npm-0.10.5-eb52ec1da1dcdc403de6d136c021d70202c28ffa818d2ab0bcaa06334bdcf420.zip/node_modules/@types", - "../../.yarn/cache/@types-execa-npm-0.9.0-aa65692b626348bb20ebb27795dc5a399c86668610d02798a0e1c38f0c4640d0.zip/node_modules/@types", - "../../.yarn/cache/@types-globby-npm-8.0.0-e4b089ad90af3a7346ae4313c69bbdf2f3818184e37bd1dc28e825643157e4c0.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-testing-npm-4.0.1-be7ebb9a6bf4c77f6168c226a5e3dd2f9bde472a64c70611dc43d3ee953a63ae.zip/node_modules/@types", - "../../.yarn/cache/@types-lodash-npm-4.14.119-8b9b06db8a00c90a15f5492c74cfd7a6bc3bb18e1870f83ead1d9b71d47ade54.zip/node_modules/@types", - "../../.yarn/cache/@types-caseless-npm-0.12.1-18ead2346441234304c3a4f12121e43aa098642f1002c5b4df2ac9eca6aabaa6.zip/node_modules/@types", - "../../.yarn/cache/@types-stream-to-promise-npm-2.2.0-8dd6adb109c5260b3d9acb1d4d1ef06843193494359cdcf54577fd5fa7b4e8ac.zip/node_modules/@types", - "../../.yarn/cache/@types-through-npm-0.0.29-b271b140c179e87d2a3dd23f5119cbf6134f106b22e6db386d2e2617c08e3b1b.zip/node_modules/@types", - "../../.yarn/cache/@types-node-emoji-npm-1.8.0-52226a03b4a94877dcebe03a26a519dddd737a49f121e68c9d59bea5b9163ec0.zip/node_modules/@types", - "../../.yarn/cache/@types-inquirer-npm-0.0.43-eb3f9a4e5073fc101030dcd1214d6a6bf5dbc9c1ae01dcb13df86f1e0ebacb45.zip/node_modules/@types", - "../../.yarn/cache/@types-tmp-npm-0.0.33-5719fa010a09de15117d9aa45352cb66769e4c7a640088c8bc5a16d9717cb057.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-async-npm-4.0.2-3ef5257be1e9e2b2bf99dce6c90fa25d5f7c0d8ccc95764cb5af097af9fa3d97.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-core-binding-npm-4.0.4-b7cfcc7551dd05c7dd469b141708ea3cd8739741c9348fc4acfddd54db903f9f.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-virtualtime-npm-4.0.3-9ac27d8e86a22738f98daaf394a09f422b6db478460bf59b5151c7c41206400f.zip/node_modules/@types", - "../../.yarn/cache/@types-react-npm-16.7.20-77ca39feddb04246df80127973f6ef547be05595371ef6a8745a89f5eed9814a.zip/node_modules/@types", - "../../.yarn/cache/@types-got-npm-8.3.5-3b8e3b9d72951dc6c6fca27ec970313eb51c544352be9a6cbedc2ebca6cab8fe.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-core-npm-4.0.3-bee87bde3bbaa960f2cdbd9e4c74ab07d4161316f88153b92cd21d113fccf5b9.zip/node_modules/@types", - "../../.yarn/cache/@types-tough-cookie-npm-2.3.4-e329dd6ffa416b51f858d98cf4c9baf0e69d99d0b5c70beede9d9dc80cdba8fa.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-npm-4.1.1-99d94ea3f00816e21b0f661ae1fa211bb3a5e4c5c2a28fbe3448411e63a46d2d.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-coincidence-npm-4.0.3-94aa7137afeed5e9c443900d6c00ef8005aa33dc8d2ae2d15e79b94cc1cb4c63.zip/node_modules/@types", - "../../.yarn/cache/@types-glob-npm-7.1.1-36f1d937a17b29eb2bc6a74c31397b2d8390cf9bc62e02717aadacad06bcc45a.zip/node_modules/@types", - "../../.yarn/cache/@types-semver-npm-5.5.0-12309742d77b2c2edccd1e54f8ef218f2882ca1558bc7039cfd3d04a6add797a.zip/node_modules/@types", - "../../.yarn/cache/@types-fs-extra-npm-5.0.4-d63b5580f1b40f6171d93746e68a844ff67520b4395110af36c53b882c669688.zip/node_modules/@types", - "../../.yarn/cache/@types-node-npm-10.12.18-f313e3cbe0a74d5544c7606df46c31c7505253a046a7e1f18c4da36b6ee0014f.zip/node_modules/@types", - "../../.yarn/cache/@types-tar-npm-4.0.0-d33f2e435f0d8a19c7919e96af64980f1ad78c9bd089e98ba58517bab9663bba.zip/node_modules/@types", - "../../.yarn/cache/@types-eventemitter3-npm-2.0.2-5633c2cfea45bb9e18841339982898fe14040ce740304376a4ee32350dc6930d.zip/node_modules/@types", - "../../.yarn/cache/@types-form-data-npm-2.2.1-9ca8e293cefd3c8b80e6fabe2d7ed71f718d4b7c50c624db0d668d1b16363059.zip/node_modules/@types", - "../../.yarn/cache/@types-events-npm-1.2.0-193ebe9364ff9a266baf2bf2b867b3cb6df836413e4c2a4801377c746eaa12a7.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-backpressure-npm-4.0.3-c02fc1aa27317d0dc2a11755dbd0732f13e2fd6708e96459e15de943d1b1f87e.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-aggregates-npm-4.0.3-4817ee10ee27131e50128e9a93de0621c506a30ac676a4d764ac0f3b06abae75.zip/node_modules/@types", - "../../.yarn/cache/@types-supports-color-npm-5.3.0-c80f98cd0ae66e734d0ea8e7593634ab8defddfded89dc2d0abb1b58075a37e7.zip/node_modules/@types", - "../../.yarn/cache/@types-request-npm-2.48.1-b2dcf234ce58b0021946322eb2c5ca3071bf5e1cb2c50fd7507967ceb114f580.zip/node_modules/@types", - "../../.yarn/cache/@types-node-fetch-npm-2.1.4-5bd7bd1246ba6eb7b9aee5874f67f126a9196128a626f4f95d0180b95e17cf2a.zip/node_modules/@types", - "../../.yarn/cache/@types-joi-npm-13.6.3-702732a54ef5f760bab98003df3254a481778956c3df35fdb12d3a4d8bf67b2c.zip/node_modules/@types", - "../../.yarn/cache/@types-jest-npm-24.0.11-0204fe3ee4b723379f130da15da7281f42601b92a45318ed330cb2b46a340f4b.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-experimental-npm-4.0.1-372b763126d0353abdf351effce766126ed4b2fde3218542187d35a8df415b74.zip/node_modules/@types", - "../../.yarn/cache/@types-tunnel-npm-0.0.0-896ac469b4d9fcd2d58b9828d1aa40d95c150284cbdbe0a91852a8229c8bee20.zip/node_modules/@types", - "../../.yarn/cache/@types-prop-types-npm-15.5.8-70b1fa434397dfdccf557bf20ce884ff42498ade32dde15fe7b95f91f51b88b1.zip/node_modules/@types", - "../../.yarn/cache/@types-emscripten-npm-0.0.31-afc8476899e781fc22cd363b2df530064787557c97186475b2b79ea001f6a8df.zip/node_modules/@types", - "../../.yarn/cache/@types-rx-lite-npm-4.0.6-02ccf9689921a3a6a5e284dba8d356da7c0a3cb2de98acb1a1e5943b7a6c7cf9.zip/node_modules/@types", - "../../.yarn/cache/@types-webassembly-js-api-npm-0.0.2-34b91f83db3de874c1dcf0068c60ffc7f7c3cd99b0b5d14a378ee471eabe8243.zip/node_modules/@types", - "../../.yarn/cache/@types-lockfile-npm-1.0.0-387a9d830f9cab332bc2599b97171f05e344ca97c96c0f9ed69d969972152ca1.zip/node_modules/@types", - "../../.yarn/cache/@types-faker-npm-4.1.4-b57898d70da524b60488238cda60835e91c6690d80114a4443e088872f9b3a34.zip/node_modules/@types", - "../../.yarn/cache/@types-treeify-npm-1.0.0-e2b628e676f3c152cf50527014992ca8e6964cafeeac3704f11e5b83320f3979.zip/node_modules/@types", - "../../.yarn/cache/@types-lodash.get-npm-4.4.6-6d10cfdb339bcfa15c1b34009448ad172d832deb03038988e7a7df7cef333575.zip/node_modules/@types" - ] + "declaration": true }, "include": [ "sources/**/*" diff --git a/yarn.lock b/yarn.lock index f41144e34c8e..e81365a78962 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2077,6 +2077,7 @@ __metadata: "@types/eslint": "npm:4.16.6" cross-spawn: "npm:^6.0.5" eslint: "npm:^5.16.0" + ts-node: "npm:^7.0.1" typescript: "npm:^3.3.3333" webpack: "npm:^4.28.4" webpack-cli: "npm:^3.2.1" @@ -2089,7 +2090,7 @@ __metadata: typescript: optional: true bin: - pnpify: ./lib/bin.js + pnpify: ./sources/boot-dev.js languageName: unknown linkType: soft