diff --git a/frontend/global.css b/frontend/global.css new file mode 100644 index 00000000..a08ca01c --- /dev/null +++ b/frontend/global.css @@ -0,0 +1,5 @@ +#app { + font-family: 'Roboto', sans-serif; + text-align: center; + +} diff --git a/frontend/index.html b/frontend/index.html index e69de29b..12309e98 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -0,0 +1,13 @@ + + + + + + ping pong + + + +
+ + + diff --git a/frontend/main.js b/frontend/main.js new file mode 100644 index 00000000..9227678e --- /dev/null +++ b/frontend/main.js @@ -0,0 +1,6 @@ +import App from "./src/app.js"; +import { $ } from "./src/utils/querySelector.js"; + +window.addEventListener("DOMContentLoaded", (e) => { + new App($("#app")); +}); diff --git a/frontend/node_modules/.bin/esbuild b/frontend/node_modules/.bin/esbuild new file mode 120000 index 00000000..c83ac070 --- /dev/null +++ b/frontend/node_modules/.bin/esbuild @@ -0,0 +1 @@ +../esbuild/bin/esbuild \ No newline at end of file diff --git a/frontend/node_modules/.bin/nanoid b/frontend/node_modules/.bin/nanoid new file mode 120000 index 00000000..e2be547b --- /dev/null +++ b/frontend/node_modules/.bin/nanoid @@ -0,0 +1 @@ +../nanoid/bin/nanoid.cjs \ No newline at end of file diff --git a/frontend/node_modules/.bin/resolve b/frontend/node_modules/.bin/resolve new file mode 120000 index 00000000..b6afda6c --- /dev/null +++ b/frontend/node_modules/.bin/resolve @@ -0,0 +1 @@ +../resolve/bin/resolve \ No newline at end of file diff --git a/frontend/node_modules/.bin/rollup b/frontend/node_modules/.bin/rollup new file mode 120000 index 00000000..5939621c --- /dev/null +++ b/frontend/node_modules/.bin/rollup @@ -0,0 +1 @@ +../rollup/dist/bin/rollup \ No newline at end of file diff --git a/frontend/node_modules/.bin/vite b/frontend/node_modules/.bin/vite new file mode 120000 index 00000000..6d1e3bea --- /dev/null +++ b/frontend/node_modules/.bin/vite @@ -0,0 +1 @@ +../vite/bin/vite.js \ No newline at end of file diff --git a/frontend/node_modules/.package-lock.json b/frontend/node_modules/.package-lock.json new file mode 100644 index 00000000..348e6dd6 --- /dev/null +++ b/frontend/node_modules/.package-lock.json @@ -0,0 +1,241 @@ +{ + "name": "gogo", + "version": "0.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "node_modules/esbuild": { + "version": "0.14.38", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.14.38.tgz", + "integrity": "sha512-12fzJ0fsm7gVZX1YQ1InkOE5f9Tl7cgf6JPYXRJtPIoE0zkWAbHdPHVPPaLi9tYAcEBqheGzqLn/3RdTOyBfcA==", + "dev": true, + "hasInstallScript": true, + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=12" + }, + "optionalDependencies": { + "esbuild-android-64": "0.14.38", + "esbuild-android-arm64": "0.14.38", + "esbuild-darwin-64": "0.14.38", + "esbuild-darwin-arm64": "0.14.38", + "esbuild-freebsd-64": "0.14.38", + "esbuild-freebsd-arm64": "0.14.38", + "esbuild-linux-32": "0.14.38", + "esbuild-linux-64": "0.14.38", + "esbuild-linux-arm": "0.14.38", + "esbuild-linux-arm64": "0.14.38", + "esbuild-linux-mips64le": "0.14.38", + "esbuild-linux-ppc64le": "0.14.38", + "esbuild-linux-riscv64": "0.14.38", + "esbuild-linux-s390x": "0.14.38", + "esbuild-netbsd-64": "0.14.38", + "esbuild-openbsd-64": "0.14.38", + "esbuild-sunos-64": "0.14.38", + "esbuild-windows-32": "0.14.38", + "esbuild-windows-64": "0.14.38", + "esbuild-windows-arm64": "0.14.38" + } + }, + "node_modules/esbuild-darwin-arm64": { + "version": "0.14.38", + "resolved": "https://registry.npmjs.org/esbuild-darwin-arm64/-/esbuild-darwin-arm64-0.14.38.tgz", + "integrity": "sha512-eqF+OejMI3mC5Dlo9Kdq/Ilbki9sQBw3QlHW3wjLmsLh+quNfHmGMp3Ly1eWm981iGBMdbtSS9+LRvR2T8B3eQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=12" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/is-core-module": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.9.0.tgz", + "integrity": "sha512-+5FPy5PnwmO3lvfMb0AsoPaBG+5KHUI0wYFXOtYPnVVVspTFUuMZNfNaNVRt3FZadstu2c8x23vykRW/NBoU6A==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/nanoid": { + "version": "3.3.4", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", + "integrity": "sha512-MqBkQh/OHTS2egovRtLk45wEyNXwF+cokD+1YPf9u5VfJiRdAiRwB2froX5Co9Rh20xs4siNPm8naNotSD6RBw==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/postcss": { + "version": "8.4.13", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.13.tgz", + "integrity": "sha512-jtL6eTBrza5MPzy8oJLFuUscHDXTV5KcLlqAWHl5q5WYRfnNRGSmOZmOZ1T6Gy7A99mOZfqungmZMpMmCVJ8ZA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + } + ], + "dependencies": { + "nanoid": "^3.3.3", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/resolve": { + "version": "1.22.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", + "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "dev": true, + "dependencies": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/rollup": { + "version": "2.72.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.72.1.tgz", + "integrity": "sha512-NTc5UGy/NWFGpSqF1lFY8z9Adri6uhyMLI6LvPAXdBKoPRFhIIiBUpt+Qg2awixqO3xvzSijjhnb4+QEZwJmxA==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/source-map-js": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.2.tgz", + "integrity": "sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/vite": { + "version": "2.9.16", + "resolved": "https://registry.npmjs.org/vite/-/vite-2.9.16.tgz", + "integrity": "sha512-X+6q8KPyeuBvTQV8AVSnKDvXoBMnTx8zxh54sOwmmuOdxkjMmEJXH2UEchA+vTMps1xw9vL64uwJOWryULg7nA==", + "dev": true, + "dependencies": { + "esbuild": "^0.14.27", + "postcss": "^8.4.13", + "resolve": "^1.22.0", + "rollup": ">=2.59.0 <2.78.0" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": ">=12.2.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + }, + "peerDependencies": { + "less": "*", + "sass": "*", + "stylus": "*" + }, + "peerDependenciesMeta": { + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "stylus": { + "optional": true + } + } + } + } +} diff --git a/frontend/node_modules/.vite/deps/package.json b/frontend/node_modules/.vite/deps/package.json new file mode 100644 index 00000000..7c34deb5 --- /dev/null +++ b/frontend/node_modules/.vite/deps/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/frontend/node_modules/esbuild-darwin-arm64/README.md b/frontend/node_modules/esbuild-darwin-arm64/README.md new file mode 100644 index 00000000..c2c0398d --- /dev/null +++ b/frontend/node_modules/esbuild-darwin-arm64/README.md @@ -0,0 +1,3 @@ +# esbuild + +This is the macOS ARM 64-bit binary for esbuild, a JavaScript bundler and minifier. See https://github.com/evanw/esbuild for details. diff --git a/frontend/node_modules/esbuild-darwin-arm64/bin/esbuild b/frontend/node_modules/esbuild-darwin-arm64/bin/esbuild new file mode 100755 index 00000000..b5fe6ce4 Binary files /dev/null and b/frontend/node_modules/esbuild-darwin-arm64/bin/esbuild differ diff --git a/frontend/node_modules/esbuild-darwin-arm64/package.json b/frontend/node_modules/esbuild-darwin-arm64/package.json new file mode 100644 index 00000000..fb6455ea --- /dev/null +++ b/frontend/node_modules/esbuild-darwin-arm64/package.json @@ -0,0 +1,17 @@ +{ + "name": "esbuild-darwin-arm64", + "version": "0.14.38", + "description": "The macOS ARM 64-bit binary for esbuild, a JavaScript bundler.", + "repository": "https://github.com/evanw/esbuild", + "license": "MIT", + "preferUnplugged": false, + "engines": { + "node": ">=12" + }, + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ] +} diff --git a/frontend/node_modules/esbuild/README.md b/frontend/node_modules/esbuild/README.md new file mode 100644 index 00000000..93863d19 --- /dev/null +++ b/frontend/node_modules/esbuild/README.md @@ -0,0 +1,3 @@ +# esbuild + +This is a JavaScript bundler and minifier. See https://github.com/evanw/esbuild and the [JavaScript API documentation](https://esbuild.github.io/api/) for details. diff --git a/frontend/node_modules/esbuild/bin/esbuild b/frontend/node_modules/esbuild/bin/esbuild new file mode 100755 index 00000000..b5fe6ce4 Binary files /dev/null and b/frontend/node_modules/esbuild/bin/esbuild differ diff --git a/frontend/node_modules/esbuild/install.js b/frontend/node_modules/esbuild/install.js new file mode 100644 index 00000000..c3ca3c23 --- /dev/null +++ b/frontend/node_modules/esbuild/install.js @@ -0,0 +1,253 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __defProps = Object.defineProperties; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropDescs = Object.getOwnPropertyDescriptors; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + } + return a; +}; +var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); + +// lib/npm/node-platform.ts +var fs = require("fs"); +var os = require("os"); +var path = require("path"); +var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; +var knownWindowsPackages = { + "win32 arm64 LE": "esbuild-windows-arm64", + "win32 ia32 LE": "esbuild-windows-32", + "win32 x64 LE": "esbuild-windows-64" +}; +var knownUnixlikePackages = { + "android arm64 LE": "esbuild-android-arm64", + "darwin arm64 LE": "esbuild-darwin-arm64", + "darwin x64 LE": "esbuild-darwin-64", + "freebsd arm64 LE": "esbuild-freebsd-arm64", + "freebsd x64 LE": "esbuild-freebsd-64", + "linux arm LE": "esbuild-linux-arm", + "linux arm64 LE": "esbuild-linux-arm64", + "linux ia32 LE": "esbuild-linux-32", + "linux mips64el LE": "esbuild-linux-mips64le", + "linux ppc64 LE": "esbuild-linux-ppc64le", + "linux riscv64 LE": "esbuild-linux-riscv64", + "linux s390x BE": "esbuild-linux-s390x", + "linux x64 LE": "esbuild-linux-64", + "netbsd x64 LE": "esbuild-netbsd-64", + "openbsd x64 LE": "esbuild-openbsd-64", + "sunos x64 LE": "esbuild-sunos-64" +}; +var knownWebAssemblyFallbackPackages = { + "android x64 LE": "esbuild-android-64" +}; +function pkgAndSubpathForCurrentPlatform() { + let pkg; + let subpath; + let isWASM = false; + let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; + if (platformKey in knownWindowsPackages) { + pkg = knownWindowsPackages[platformKey]; + subpath = "esbuild.exe"; + } else if (platformKey in knownUnixlikePackages) { + pkg = knownUnixlikePackages[platformKey]; + subpath = "bin/esbuild"; + } else if (platformKey in knownWebAssemblyFallbackPackages) { + pkg = knownWebAssemblyFallbackPackages[platformKey]; + subpath = "bin/esbuild"; + isWASM = true; + } else { + throw new Error(`Unsupported platform: ${platformKey}`); + } + return { pkg, subpath, isWASM }; +} +function downloadedBinPath(pkg, subpath) { + const esbuildLibDir = path.dirname(require.resolve("esbuild")); + return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`); +} + +// lib/npm/node-install.ts +var fs2 = require("fs"); +var os2 = require("os"); +var path2 = require("path"); +var zlib = require("zlib"); +var https = require("https"); +var child_process = require("child_process"); +var toPath = path2.join(__dirname, "bin", "esbuild"); +var isToPathJS = true; +function validateBinaryVersion(...command) { + command.push("--version"); + const stdout = child_process.execFileSync(command.shift(), command, { + stdio: "pipe" + }).toString().trim(); + if (stdout !== "0.14.38") { + throw new Error(`Expected ${JSON.stringify("0.14.38")} but got ${JSON.stringify(stdout)}`); + } +} +function isYarn() { + const { npm_config_user_agent } = process.env; + if (npm_config_user_agent) { + return /\byarn\//.test(npm_config_user_agent); + } + return false; +} +function fetch(url) { + return new Promise((resolve, reject) => { + https.get(url, (res) => { + if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location) + return fetch(res.headers.location).then(resolve, reject); + if (res.statusCode !== 200) + return reject(new Error(`Server responded with ${res.statusCode}`)); + let chunks = []; + res.on("data", (chunk) => chunks.push(chunk)); + res.on("end", () => resolve(Buffer.concat(chunks))); + }).on("error", reject); + }); +} +function extractFileFromTarGzip(buffer, subpath) { + try { + buffer = zlib.unzipSync(buffer); + } catch (err) { + throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`); + } + let str = (i, n) => String.fromCharCode(...buffer.subarray(i, i + n)).replace(/\0.*$/, ""); + let offset = 0; + subpath = `package/${subpath}`; + while (offset < buffer.length) { + let name = str(offset, 100); + let size = parseInt(str(offset + 124, 12), 8); + offset += 512; + if (!isNaN(size)) { + if (name === subpath) + return buffer.subarray(offset, offset + size); + offset += size + 511 & ~511; + } + } + throw new Error(`Could not find ${JSON.stringify(subpath)} in archive`); +} +function installUsingNPM(pkg, subpath, binPath) { + const env = __spreadProps(__spreadValues({}, process.env), { npm_config_global: void 0 }); + const esbuildLibDir = path2.dirname(require.resolve("esbuild")); + const installDir = path2.join(esbuildLibDir, "npm-install"); + fs2.mkdirSync(installDir); + try { + fs2.writeFileSync(path2.join(installDir, "package.json"), "{}"); + child_process.execSync(`npm install --loglevel=error --prefer-offline --no-audit --progress=false ${pkg}@${"0.14.38"}`, { cwd: installDir, stdio: "pipe", env }); + const installedBinPath = path2.join(installDir, "node_modules", pkg, subpath); + fs2.renameSync(installedBinPath, binPath); + } finally { + try { + removeRecursive(installDir); + } catch { + } + } +} +function removeRecursive(dir) { + for (const entry of fs2.readdirSync(dir)) { + const entryPath = path2.join(dir, entry); + let stats; + try { + stats = fs2.lstatSync(entryPath); + } catch { + continue; + } + if (stats.isDirectory()) + removeRecursive(entryPath); + else + fs2.unlinkSync(entryPath); + } + fs2.rmdirSync(dir); +} +function applyManualBinaryPathOverride(overridePath) { + const pathString = JSON.stringify(overridePath); + fs2.writeFileSync(toPath, `#!/usr/bin/env node +require('child_process').execFileSync(${pathString}, process.argv.slice(2), { stdio: 'inherit' }); +`); + const libMain = path2.join(__dirname, "lib", "main.js"); + const code = fs2.readFileSync(libMain, "utf8"); + fs2.writeFileSync(libMain, `var ESBUILD_BINARY_PATH = ${pathString}; +${code}`); +} +function maybeOptimizePackage(binPath) { + if (os2.platform() !== "win32" && !isYarn()) { + const tempPath = path2.join(__dirname, "bin-esbuild"); + try { + fs2.linkSync(binPath, tempPath); + fs2.renameSync(tempPath, toPath); + isToPathJS = false; + fs2.unlinkSync(tempPath); + } catch { + } + } +} +async function downloadDirectlyFromNPM(pkg, subpath, binPath) { + const url = `https://registry.npmjs.org/${pkg}/-/${pkg}-${"0.14.38"}.tgz`; + console.error(`[esbuild] Trying to download ${JSON.stringify(url)}`); + try { + fs2.writeFileSync(binPath, extractFileFromTarGzip(await fetch(url), subpath)); + fs2.chmodSync(binPath, 493); + } catch (e) { + console.error(`[esbuild] Failed to download ${JSON.stringify(url)}: ${e && e.message || e}`); + throw e; + } +} +async function checkAndPreparePackage() { + if (ESBUILD_BINARY_PATH) { + applyManualBinaryPathOverride(ESBUILD_BINARY_PATH); + return; + } + const { pkg, subpath } = pkgAndSubpathForCurrentPlatform(); + let binPath; + try { + binPath = require.resolve(`${pkg}/${subpath}`); + } catch (e) { + console.error(`[esbuild] Failed to find package "${pkg}" on the file system + +This can happen if you use the "--no-optional" flag. The "optionalDependencies" +package.json feature is used by esbuild to install the correct binary executable +for your current platform. This install script will now attempt to work around +this. If that fails, you need to remove the "--no-optional" flag to use esbuild. +`); + binPath = downloadedBinPath(pkg, subpath); + try { + console.error(`[esbuild] Trying to install package "${pkg}" using npm`); + installUsingNPM(pkg, subpath, binPath); + } catch (e2) { + console.error(`[esbuild] Failed to install package "${pkg}" using npm: ${e2 && e2.message || e2}`); + try { + await downloadDirectlyFromNPM(pkg, subpath, binPath); + } catch (e3) { + throw new Error(`Failed to install package "${pkg}"`); + } + } + } + maybeOptimizePackage(binPath); +} +checkAndPreparePackage().then(() => { + if (isToPathJS) { + validateBinaryVersion("node", toPath); + } else { + validateBinaryVersion(toPath); + } +}); diff --git a/frontend/node_modules/esbuild/lib/main.d.ts b/frontend/node_modules/esbuild/lib/main.d.ts new file mode 100644 index 00000000..1ee892b5 --- /dev/null +++ b/frontend/node_modules/esbuild/lib/main.d.ts @@ -0,0 +1,592 @@ +export type Platform = 'browser' | 'node' | 'neutral'; +export type Format = 'iife' | 'cjs' | 'esm'; +export type Loader = 'js' | 'jsx' | 'ts' | 'tsx' | 'css' | 'json' | 'text' | 'base64' | 'file' | 'dataurl' | 'binary' | 'default'; +export type LogLevel = 'verbose' | 'debug' | 'info' | 'warning' | 'error' | 'silent'; +export type Charset = 'ascii' | 'utf8'; +export type Drop = 'console' | 'debugger'; + +interface CommonOptions { + /** Documentation: https://esbuild.github.io/api/#sourcemap */ + sourcemap?: boolean | 'linked' | 'inline' | 'external' | 'both'; + /** Documentation: https://esbuild.github.io/api/#legal-comments */ + legalComments?: 'none' | 'inline' | 'eof' | 'linked' | 'external'; + /** Documentation: https://esbuild.github.io/api/#source-root */ + sourceRoot?: string; + /** Documentation: https://esbuild.github.io/api/#sources-content */ + sourcesContent?: boolean; + + /** Documentation: https://esbuild.github.io/api/#format */ + format?: Format; + /** Documentation: https://esbuild.github.io/api/#globalName */ + globalName?: string; + /** Documentation: https://esbuild.github.io/api/#target */ + target?: string | string[]; + + /** Documentation: https://esbuild.github.io/api/#mangle-props */ + mangleProps?: RegExp; + /** Documentation: https://esbuild.github.io/api/#mangle-props */ + reserveProps?: RegExp; + /** Documentation: https://esbuild.github.io/api/#mangle-props */ + mangleQuoted?: boolean; + /** Documentation: https://esbuild.github.io/api/#mangle-props */ + mangleCache?: Record; + /** Documentation: https://esbuild.github.io/api/#drop */ + drop?: Drop[]; + /** Documentation: https://esbuild.github.io/api/#minify */ + minify?: boolean; + /** Documentation: https://esbuild.github.io/api/#minify */ + minifyWhitespace?: boolean; + /** Documentation: https://esbuild.github.io/api/#minify */ + minifyIdentifiers?: boolean; + /** Documentation: https://esbuild.github.io/api/#minify */ + minifySyntax?: boolean; + /** Documentation: https://esbuild.github.io/api/#charset */ + charset?: Charset; + /** Documentation: https://esbuild.github.io/api/#tree-shaking */ + treeShaking?: boolean; + /** Documentation: https://esbuild.github.io/api/#ignore-annotations */ + ignoreAnnotations?: boolean; + + /** Documentation: https://esbuild.github.io/api/#jsx */ + jsx?: 'transform' | 'preserve'; + /** Documentation: https://esbuild.github.io/api/#jsx-factory */ + jsxFactory?: string; + /** Documentation: https://esbuild.github.io/api/#jsx-fragment */ + jsxFragment?: string; + + /** Documentation: https://esbuild.github.io/api/#define */ + define?: { [key: string]: string }; + /** Documentation: https://esbuild.github.io/api/#pure */ + pure?: string[]; + /** Documentation: https://esbuild.github.io/api/#keep-names */ + keepNames?: boolean; + + /** Documentation: https://esbuild.github.io/api/#color */ + color?: boolean; + /** Documentation: https://esbuild.github.io/api/#log-level */ + logLevel?: LogLevel; + /** Documentation: https://esbuild.github.io/api/#log-limit */ + logLimit?: number; +} + +export interface BuildOptions extends CommonOptions { + /** Documentation: https://esbuild.github.io/api/#bundle */ + bundle?: boolean; + /** Documentation: https://esbuild.github.io/api/#splitting */ + splitting?: boolean; + /** Documentation: https://esbuild.github.io/api/#preserve-symlinks */ + preserveSymlinks?: boolean; + /** Documentation: https://esbuild.github.io/api/#outfile */ + outfile?: string; + /** Documentation: https://esbuild.github.io/api/#metafile */ + metafile?: boolean; + /** Documentation: https://esbuild.github.io/api/#outdir */ + outdir?: string; + /** Documentation: https://esbuild.github.io/api/#outbase */ + outbase?: string; + /** Documentation: https://esbuild.github.io/api/#platform */ + platform?: Platform; + /** Documentation: https://esbuild.github.io/api/#external */ + external?: string[]; + /** Documentation: https://esbuild.github.io/api/#loader */ + loader?: { [ext: string]: Loader }; + /** Documentation: https://esbuild.github.io/api/#resolve-extensions */ + resolveExtensions?: string[]; + /** Documentation: https://esbuild.github.io/api/#mainFields */ + mainFields?: string[]; + /** Documentation: https://esbuild.github.io/api/#conditions */ + conditions?: string[]; + /** Documentation: https://esbuild.github.io/api/#write */ + write?: boolean; + /** Documentation: https://esbuild.github.io/api/#allow-overwrite */ + allowOverwrite?: boolean; + /** Documentation: https://esbuild.github.io/api/#tsconfig */ + tsconfig?: string; + /** Documentation: https://esbuild.github.io/api/#out-extension */ + outExtension?: { [ext: string]: string }; + /** Documentation: https://esbuild.github.io/api/#public-path */ + publicPath?: string; + /** Documentation: https://esbuild.github.io/api/#entry-names */ + entryNames?: string; + /** Documentation: https://esbuild.github.io/api/#chunk-names */ + chunkNames?: string; + /** Documentation: https://esbuild.github.io/api/#asset-names */ + assetNames?: string; + /** Documentation: https://esbuild.github.io/api/#inject */ + inject?: string[]; + /** Documentation: https://esbuild.github.io/api/#banner */ + banner?: { [type: string]: string }; + /** Documentation: https://esbuild.github.io/api/#footer */ + footer?: { [type: string]: string }; + /** Documentation: https://esbuild.github.io/api/#incremental */ + incremental?: boolean; + /** Documentation: https://esbuild.github.io/api/#entry-points */ + entryPoints?: string[] | Record; + /** Documentation: https://esbuild.github.io/api/#stdin */ + stdin?: StdinOptions; + /** Documentation: https://esbuild.github.io/plugins/ */ + plugins?: Plugin[]; + /** Documentation: https://esbuild.github.io/api/#working-directory */ + absWorkingDir?: string; + /** Documentation: https://esbuild.github.io/api/#node-paths */ + nodePaths?: string[]; // The "NODE_PATH" variable from Node.js + /** Documentation: https://esbuild.github.io/api/#watch */ + watch?: boolean | WatchMode; +} + +export interface WatchMode { + onRebuild?: (error: BuildFailure | null, result: BuildResult | null) => void; +} + +export interface StdinOptions { + contents: string; + resolveDir?: string; + sourcefile?: string; + loader?: Loader; +} + +export interface Message { + pluginName: string; + text: string; + location: Location | null; + notes: Note[]; + + /** + * Optional user-specified data that is passed through unmodified. You can + * use this to stash the original error, for example. + */ + detail: any; +} + +export interface Note { + text: string; + location: Location | null; +} + +export interface Location { + file: string; + namespace: string; + /** 1-based */ + line: number; + /** 0-based, in bytes */ + column: number; + /** in bytes */ + length: number; + lineText: string; + suggestion: string; +} + +export interface OutputFile { + path: string; + /** "text" as bytes */ + contents: Uint8Array; + /** "contents" as text */ + text: string; +} + +export interface BuildInvalidate { + (): Promise; + dispose(): void; +} + +export interface BuildIncremental extends BuildResult { + rebuild: BuildInvalidate; +} + +export interface BuildResult { + errors: Message[]; + warnings: Message[]; + /** Only when "write: false" */ + outputFiles?: OutputFile[]; + /** Only when "incremental: true" */ + rebuild?: BuildInvalidate; + /** Only when "watch: true" */ + stop?: () => void; + /** Only when "metafile: true" */ + metafile?: Metafile; + /** Only when "mangleCache" is present */ + mangleCache?: Record; +} + +export interface BuildFailure extends Error { + errors: Message[]; + warnings: Message[]; +} + +/** Documentation: https://esbuild.github.io/api/#serve-arguments */ +export interface ServeOptions { + port?: number; + host?: string; + servedir?: string; + onRequest?: (args: ServeOnRequestArgs) => void; +} + +export interface ServeOnRequestArgs { + remoteAddress: string; + method: string; + path: string; + status: number; + /** The time to generate the response, not to send it */ + timeInMS: number; +} + +/** Documentation: https://esbuild.github.io/api/#serve-return-values */ +export interface ServeResult { + port: number; + host: string; + wait: Promise; + stop: () => void; +} + +export interface TransformOptions extends CommonOptions { + tsconfigRaw?: string | { + compilerOptions?: { + jsxFactory?: string, + jsxFragmentFactory?: string, + useDefineForClassFields?: boolean, + importsNotUsedAsValues?: 'remove' | 'preserve' | 'error', + preserveValueImports?: boolean, + }, + }; + + sourcefile?: string; + loader?: Loader; + banner?: string; + footer?: string; +} + +export interface TransformResult { + code: string; + map: string; + warnings: Message[]; + /** Only when "mangleCache" is present */ + mangleCache?: Record; +} + +export interface TransformFailure extends Error { + errors: Message[]; + warnings: Message[]; +} + +export interface Plugin { + name: string; + setup: (build: PluginBuild) => (void | Promise); +} + +export interface PluginBuild { + initialOptions: BuildOptions; + resolve(path: string, options?: ResolveOptions): Promise; + + onStart(callback: () => + (OnStartResult | null | void | Promise)): void; + onEnd(callback: (result: BuildResult) => + (void | Promise)): void; + onResolve(options: OnResolveOptions, callback: (args: OnResolveArgs) => + (OnResolveResult | null | undefined | Promise)): void; + onLoad(options: OnLoadOptions, callback: (args: OnLoadArgs) => + (OnLoadResult | null | undefined | Promise)): void; + + // This is a full copy of the esbuild library in case you need it + esbuild: { + serve: typeof serve, + build: typeof build, + buildSync: typeof buildSync, + transform: typeof transform, + transformSync: typeof transformSync, + formatMessages: typeof formatMessages, + formatMessagesSync: typeof formatMessagesSync, + analyzeMetafile: typeof analyzeMetafile, + analyzeMetafileSync: typeof analyzeMetafileSync, + initialize: typeof initialize, + version: typeof version, + }; +} + +export interface ResolveOptions { + pluginName?: string; + importer?: string; + namespace?: string; + resolveDir?: string; + kind?: ImportKind; + pluginData?: any; +} + +export interface ResolveResult { + errors: Message[]; + warnings: Message[]; + + path: string; + external: boolean; + sideEffects: boolean; + namespace: string; + suffix: string; + pluginData: any; +} + +export interface OnStartResult { + errors?: PartialMessage[]; + warnings?: PartialMessage[]; +} + +export interface OnResolveOptions { + filter: RegExp; + namespace?: string; +} + +export interface OnResolveArgs { + path: string; + importer: string; + namespace: string; + resolveDir: string; + kind: ImportKind; + pluginData: any; +} + +export type ImportKind = + | 'entry-point' + + // JS + | 'import-statement' + | 'require-call' + | 'dynamic-import' + | 'require-resolve' + + // CSS + | 'import-rule' + | 'url-token' + +export interface OnResolveResult { + pluginName?: string; + + errors?: PartialMessage[]; + warnings?: PartialMessage[]; + + path?: string; + external?: boolean; + sideEffects?: boolean; + namespace?: string; + suffix?: string; + pluginData?: any; + + watchFiles?: string[]; + watchDirs?: string[]; +} + +export interface OnLoadOptions { + filter: RegExp; + namespace?: string; +} + +export interface OnLoadArgs { + path: string; + namespace: string; + suffix: string; + pluginData: any; +} + +export interface OnLoadResult { + pluginName?: string; + + errors?: PartialMessage[]; + warnings?: PartialMessage[]; + + contents?: string | Uint8Array; + resolveDir?: string; + loader?: Loader; + pluginData?: any; + + watchFiles?: string[]; + watchDirs?: string[]; +} + +export interface PartialMessage { + pluginName?: string; + text?: string; + location?: Partial | null; + notes?: PartialNote[]; + detail?: any; +} + +export interface PartialNote { + text?: string; + location?: Partial | null; +} + +export interface Metafile { + inputs: { + [path: string]: { + bytes: number + imports: { + path: string + kind: ImportKind + }[] + } + } + outputs: { + [path: string]: { + bytes: number + inputs: { + [path: string]: { + bytesInOutput: number + } + } + imports: { + path: string + kind: ImportKind + }[] + exports: string[] + entryPoint?: string + } + } +} + +export interface FormatMessagesOptions { + kind: 'error' | 'warning'; + color?: boolean; + terminalWidth?: number; +} + +export interface AnalyzeMetafileOptions { + color?: boolean; + verbose?: boolean; +} + +/** + * This function invokes the "esbuild" command-line tool for you. It returns a + * promise that either resolves with a "BuildResult" object or rejects with a + * "BuildFailure" object. + * + * - Works in node: yes + * - Works in browser: yes + * + * Documentation: https://esbuild.github.io/api/#build-api + */ +export declare function build(options: BuildOptions & { write: false }): Promise; +export declare function build(options: BuildOptions & { incremental: true, metafile: true }): Promise; +export declare function build(options: BuildOptions & { incremental: true }): Promise; +export declare function build(options: BuildOptions & { metafile: true }): Promise; +export declare function build(options: BuildOptions): Promise; + +/** + * This function is similar to "build" but it serves the resulting files over + * HTTP on a localhost address with the specified port. + * + * - Works in node: yes + * - Works in browser: no + * + * Documentation: https://esbuild.github.io/api/#serve + */ +export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOptions): Promise; + +/** + * This function transforms a single JavaScript file. It can be used to minify + * JavaScript, convert TypeScript/JSX to JavaScript, or convert newer JavaScript + * to older JavaScript. It returns a promise that is either resolved with a + * "TransformResult" object or rejected with a "TransformFailure" object. + * + * - Works in node: yes + * - Works in browser: yes + * + * Documentation: https://esbuild.github.io/api/#transform-api + */ +export declare function transform(input: string, options?: TransformOptions): Promise; + +/** + * Converts log messages to formatted message strings suitable for printing in + * the terminal. This allows you to reuse the built-in behavior of esbuild's + * log message formatter. This is a batch-oriented API for efficiency. + * + * - Works in node: yes + * - Works in browser: yes + */ +export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise; + +/** + * Pretty-prints an analysis of the metafile JSON to a string. This is just for + * convenience to be able to match esbuild's pretty-printing exactly. If you want + * to customize it, you can just inspect the data in the metafile yourself. + * + * - Works in node: yes + * - Works in browser: yes + * + * Documentation: https://esbuild.github.io/api/#analyze + */ +export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise; + +/** + * A synchronous version of "build". + * + * - Works in node: yes + * - Works in browser: no + * + * Documentation: https://esbuild.github.io/api/#build-api + */ +export declare function buildSync(options: BuildOptions & { write: false }): BuildResult & { outputFiles: OutputFile[] }; +export declare function buildSync(options: BuildOptions): BuildResult; + +/** + * A synchronous version of "transform". + * + * - Works in node: yes + * - Works in browser: no + * + * Documentation: https://esbuild.github.io/api/#transform-api + */ +export declare function transformSync(input: string, options?: TransformOptions): TransformResult; + +/** + * A synchronous version of "formatMessages". + * + * - Works in node: yes + * - Works in browser: no + */ +export declare function formatMessagesSync(messages: PartialMessage[], options: FormatMessagesOptions): string[]; + +/** + * A synchronous version of "analyzeMetafile". + * + * - Works in node: yes + * - Works in browser: no + * + * Documentation: https://esbuild.github.io/api/#analyze + */ +export declare function analyzeMetafileSync(metafile: Metafile | string, options?: AnalyzeMetafileOptions): string; + +/** + * This configures the browser-based version of esbuild. It is necessary to + * call this first and wait for the returned promise to be resolved before + * making other API calls when using esbuild in the browser. + * + * - Works in node: yes + * - Works in browser: yes ("options" is required) + * + * Documentation: https://esbuild.github.io/api/#running-in-the-browser + */ +export declare function initialize(options: InitializeOptions): Promise; + +export interface InitializeOptions { + /** + * The URL of the "esbuild.wasm" file. This must be provided when running + * esbuild in the browser. + */ + wasmURL?: string + + /** + * The result of calling "new WebAssembly.Module(buffer)" where "buffer" + * is a typed array or ArrayBuffer containing the binary code of the + * "esbuild.wasm" file. + * + * You can use this as an alternative to "wasmURL" for environments where it's + * not possible to download the WebAssembly module. + */ + wasmModule?: WebAssembly.Module + + /** + * By default esbuild runs the WebAssembly-based browser API in a web worker + * to avoid blocking the UI thread. This can be disabled by setting "worker" + * to false. + */ + worker?: boolean +} + +export let version: string; diff --git a/frontend/node_modules/esbuild/lib/main.js b/frontend/node_modules/esbuild/lib/main.js new file mode 100644 index 00000000..094cde7e --- /dev/null +++ b/frontend/node_modules/esbuild/lib/main.js @@ -0,0 +1,2294 @@ +var __create = Object.create; +var __defProp = Object.defineProperty; +var __defProps = Object.defineProperties; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropDescs = Object.getOwnPropertyDescriptors; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __getOwnPropSymbols = Object.getOwnPropertySymbols; +var __getProtoOf = Object.getPrototypeOf; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __propIsEnum = Object.prototype.propertyIsEnumerable; +var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; +var __spreadValues = (a, b) => { + for (var prop in b || (b = {})) + if (__hasOwnProp.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + if (__getOwnPropSymbols) + for (var prop of __getOwnPropSymbols(b)) { + if (__propIsEnum.call(b, prop)) + __defNormalProp(a, prop, b[prop]); + } + return a; +}; +var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod)); +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// lib/npm/node.ts +var node_exports = {}; +__export(node_exports, { + analyzeMetafile: () => analyzeMetafile, + analyzeMetafileSync: () => analyzeMetafileSync, + build: () => build, + buildSync: () => buildSync, + default: () => node_default, + formatMessages: () => formatMessages, + formatMessagesSync: () => formatMessagesSync, + initialize: () => initialize, + serve: () => serve, + transform: () => transform, + transformSync: () => transformSync, + version: () => version +}); +module.exports = __toCommonJS(node_exports); + +// lib/shared/stdio_protocol.ts +function encodePacket(packet) { + let visit = (value) => { + if (value === null) { + bb.write8(0); + } else if (typeof value === "boolean") { + bb.write8(1); + bb.write8(+value); + } else if (typeof value === "number") { + bb.write8(2); + bb.write32(value | 0); + } else if (typeof value === "string") { + bb.write8(3); + bb.write(encodeUTF8(value)); + } else if (value instanceof Uint8Array) { + bb.write8(4); + bb.write(value); + } else if (value instanceof Array) { + bb.write8(5); + bb.write32(value.length); + for (let item of value) { + visit(item); + } + } else { + let keys = Object.keys(value); + bb.write8(6); + bb.write32(keys.length); + for (let key of keys) { + bb.write(encodeUTF8(key)); + visit(value[key]); + } + } + }; + let bb = new ByteBuffer(); + bb.write32(0); + bb.write32(packet.id << 1 | +!packet.isRequest); + visit(packet.value); + writeUInt32LE(bb.buf, bb.len - 4, 0); + return bb.buf.subarray(0, bb.len); +} +function decodePacket(bytes) { + let visit = () => { + switch (bb.read8()) { + case 0: + return null; + case 1: + return !!bb.read8(); + case 2: + return bb.read32(); + case 3: + return decodeUTF8(bb.read()); + case 4: + return bb.read(); + case 5: { + let count = bb.read32(); + let value2 = []; + for (let i = 0; i < count; i++) { + value2.push(visit()); + } + return value2; + } + case 6: { + let count = bb.read32(); + let value2 = {}; + for (let i = 0; i < count; i++) { + value2[decodeUTF8(bb.read())] = visit(); + } + return value2; + } + default: + throw new Error("Invalid packet"); + } + }; + let bb = new ByteBuffer(bytes); + let id = bb.read32(); + let isRequest = (id & 1) === 0; + id >>>= 1; + let value = visit(); + if (bb.ptr !== bytes.length) { + throw new Error("Invalid packet"); + } + return { id, isRequest, value }; +} +var ByteBuffer = class { + constructor(buf = new Uint8Array(1024)) { + this.buf = buf; + this.len = 0; + this.ptr = 0; + } + _write(delta) { + if (this.len + delta > this.buf.length) { + let clone = new Uint8Array((this.len + delta) * 2); + clone.set(this.buf); + this.buf = clone; + } + this.len += delta; + return this.len - delta; + } + write8(value) { + let offset = this._write(1); + this.buf[offset] = value; + } + write32(value) { + let offset = this._write(4); + writeUInt32LE(this.buf, value, offset); + } + write(bytes) { + let offset = this._write(4 + bytes.length); + writeUInt32LE(this.buf, bytes.length, offset); + this.buf.set(bytes, offset + 4); + } + _read(delta) { + if (this.ptr + delta > this.buf.length) { + throw new Error("Invalid packet"); + } + this.ptr += delta; + return this.ptr - delta; + } + read8() { + return this.buf[this._read(1)]; + } + read32() { + return readUInt32LE(this.buf, this._read(4)); + } + read() { + let length = this.read32(); + let bytes = new Uint8Array(length); + let ptr = this._read(bytes.length); + bytes.set(this.buf.subarray(ptr, ptr + length)); + return bytes; + } +}; +var encodeUTF8; +var decodeUTF8; +if (typeof TextEncoder !== "undefined" && typeof TextDecoder !== "undefined") { + let encoder = new TextEncoder(); + let decoder = new TextDecoder(); + encodeUTF8 = (text) => encoder.encode(text); + decodeUTF8 = (bytes) => decoder.decode(bytes); +} else if (typeof Buffer !== "undefined") { + encodeUTF8 = (text) => { + let buffer = Buffer.from(text); + if (!(buffer instanceof Uint8Array)) { + buffer = new Uint8Array(buffer); + } + return buffer; + }; + decodeUTF8 = (bytes) => { + let { buffer, byteOffset, byteLength } = bytes; + return Buffer.from(buffer, byteOffset, byteLength).toString(); + }; +} else { + throw new Error("No UTF-8 codec found"); +} +function readUInt32LE(buffer, offset) { + return buffer[offset++] | buffer[offset++] << 8 | buffer[offset++] << 16 | buffer[offset++] << 24; +} +function writeUInt32LE(buffer, value, offset) { + buffer[offset++] = value; + buffer[offset++] = value >> 8; + buffer[offset++] = value >> 16; + buffer[offset++] = value >> 24; +} + +// lib/shared/common.ts +function validateTarget(target) { + target += ""; + if (target.indexOf(",") >= 0) + throw new Error(`Invalid target: ${target}`); + return target; +} +var canBeAnything = () => null; +var mustBeBoolean = (value) => typeof value === "boolean" ? null : "a boolean"; +var mustBeBooleanOrObject = (value) => typeof value === "boolean" || typeof value === "object" && !Array.isArray(value) ? null : "a boolean or an object"; +var mustBeString = (value) => typeof value === "string" ? null : "a string"; +var mustBeRegExp = (value) => value instanceof RegExp ? null : "a RegExp object"; +var mustBeInteger = (value) => typeof value === "number" && value === (value | 0) ? null : "an integer"; +var mustBeFunction = (value) => typeof value === "function" ? null : "a function"; +var mustBeArray = (value) => Array.isArray(value) ? null : "an array"; +var mustBeObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value) ? null : "an object"; +var mustBeWebAssemblyModule = (value) => value instanceof WebAssembly.Module ? null : "a WebAssembly.Module"; +var mustBeArrayOrRecord = (value) => typeof value === "object" && value !== null ? null : "an array or an object"; +var mustBeObjectOrNull = (value) => typeof value === "object" && !Array.isArray(value) ? null : "an object or null"; +var mustBeStringOrBoolean = (value) => typeof value === "string" || typeof value === "boolean" ? null : "a string or a boolean"; +var mustBeStringOrObject = (value) => typeof value === "string" || typeof value === "object" && value !== null && !Array.isArray(value) ? null : "a string or an object"; +var mustBeStringOrArray = (value) => typeof value === "string" || Array.isArray(value) ? null : "a string or an array"; +var mustBeStringOrUint8Array = (value) => typeof value === "string" || value instanceof Uint8Array ? null : "a string or a Uint8Array"; +function getFlag(object, keys, key, mustBeFn) { + let value = object[key]; + keys[key + ""] = true; + if (value === void 0) + return void 0; + let mustBe = mustBeFn(value); + if (mustBe !== null) + throw new Error(`"${key}" must be ${mustBe}`); + return value; +} +function checkForInvalidFlags(object, keys, where) { + for (let key in object) { + if (!(key in keys)) { + throw new Error(`Invalid option ${where}: "${key}"`); + } + } +} +function validateInitializeOptions(options) { + let keys = /* @__PURE__ */ Object.create(null); + let wasmURL = getFlag(options, keys, "wasmURL", mustBeString); + let wasmModule = getFlag(options, keys, "wasmModule", mustBeWebAssemblyModule); + let worker = getFlag(options, keys, "worker", mustBeBoolean); + checkForInvalidFlags(options, keys, "in initialize() call"); + return { + wasmURL, + wasmModule, + worker + }; +} +function validateMangleCache(mangleCache) { + let validated; + if (mangleCache !== void 0) { + validated = /* @__PURE__ */ Object.create(null); + for (let key of Object.keys(mangleCache)) { + let value = mangleCache[key]; + if (typeof value === "string" || value === false) { + validated[key] = value; + } else { + throw new Error(`Expected ${JSON.stringify(key)} in mangle cache to map to either a string or false`); + } + } + } + return validated; +} +function pushLogFlags(flags, options, keys, isTTY2, logLevelDefault) { + let color = getFlag(options, keys, "color", mustBeBoolean); + let logLevel = getFlag(options, keys, "logLevel", mustBeString); + let logLimit = getFlag(options, keys, "logLimit", mustBeInteger); + if (color !== void 0) + flags.push(`--color=${color}`); + else if (isTTY2) + flags.push(`--color=true`); + flags.push(`--log-level=${logLevel || logLevelDefault}`); + flags.push(`--log-limit=${logLimit || 0}`); +} +function pushCommonFlags(flags, options, keys) { + let legalComments = getFlag(options, keys, "legalComments", mustBeString); + let sourceRoot = getFlag(options, keys, "sourceRoot", mustBeString); + let sourcesContent = getFlag(options, keys, "sourcesContent", mustBeBoolean); + let target = getFlag(options, keys, "target", mustBeStringOrArray); + let format = getFlag(options, keys, "format", mustBeString); + let globalName = getFlag(options, keys, "globalName", mustBeString); + let mangleProps = getFlag(options, keys, "mangleProps", mustBeRegExp); + let reserveProps = getFlag(options, keys, "reserveProps", mustBeRegExp); + let mangleQuoted = getFlag(options, keys, "mangleQuoted", mustBeBoolean); + let minify = getFlag(options, keys, "minify", mustBeBoolean); + let minifySyntax = getFlag(options, keys, "minifySyntax", mustBeBoolean); + let minifyWhitespace = getFlag(options, keys, "minifyWhitespace", mustBeBoolean); + let minifyIdentifiers = getFlag(options, keys, "minifyIdentifiers", mustBeBoolean); + let drop = getFlag(options, keys, "drop", mustBeArray); + let charset = getFlag(options, keys, "charset", mustBeString); + let treeShaking = getFlag(options, keys, "treeShaking", mustBeBoolean); + let ignoreAnnotations = getFlag(options, keys, "ignoreAnnotations", mustBeBoolean); + let jsx = getFlag(options, keys, "jsx", mustBeString); + let jsxFactory = getFlag(options, keys, "jsxFactory", mustBeString); + let jsxFragment = getFlag(options, keys, "jsxFragment", mustBeString); + let define = getFlag(options, keys, "define", mustBeObject); + let pure = getFlag(options, keys, "pure", mustBeArray); + let keepNames = getFlag(options, keys, "keepNames", mustBeBoolean); + if (legalComments) + flags.push(`--legal-comments=${legalComments}`); + if (sourceRoot !== void 0) + flags.push(`--source-root=${sourceRoot}`); + if (sourcesContent !== void 0) + flags.push(`--sources-content=${sourcesContent}`); + if (target) { + if (Array.isArray(target)) + flags.push(`--target=${Array.from(target).map(validateTarget).join(",")}`); + else + flags.push(`--target=${validateTarget(target)}`); + } + if (format) + flags.push(`--format=${format}`); + if (globalName) + flags.push(`--global-name=${globalName}`); + if (minify) + flags.push("--minify"); + if (minifySyntax) + flags.push("--minify-syntax"); + if (minifyWhitespace) + flags.push("--minify-whitespace"); + if (minifyIdentifiers) + flags.push("--minify-identifiers"); + if (charset) + flags.push(`--charset=${charset}`); + if (treeShaking !== void 0) + flags.push(`--tree-shaking=${treeShaking}`); + if (ignoreAnnotations) + flags.push(`--ignore-annotations`); + if (drop) + for (let what of drop) + flags.push(`--drop:${what}`); + if (mangleProps) + flags.push(`--mangle-props=${mangleProps.source}`); + if (reserveProps) + flags.push(`--reserve-props=${reserveProps.source}`); + if (mangleQuoted !== void 0) + flags.push(`--mangle-quoted=${mangleQuoted}`); + if (jsx) + flags.push(`--jsx=${jsx}`); + if (jsxFactory) + flags.push(`--jsx-factory=${jsxFactory}`); + if (jsxFragment) + flags.push(`--jsx-fragment=${jsxFragment}`); + if (define) { + for (let key in define) { + if (key.indexOf("=") >= 0) + throw new Error(`Invalid define: ${key}`); + flags.push(`--define:${key}=${define[key]}`); + } + } + if (pure) + for (let fn of pure) + flags.push(`--pure:${fn}`); + if (keepNames) + flags.push(`--keep-names`); +} +function flagsForBuildOptions(callName, options, isTTY2, logLevelDefault, writeDefault) { + var _a2; + let flags = []; + let entries = []; + let keys = /* @__PURE__ */ Object.create(null); + let stdinContents = null; + let stdinResolveDir = null; + let watchMode = null; + pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); + pushCommonFlags(flags, options, keys); + let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); + let bundle = getFlag(options, keys, "bundle", mustBeBoolean); + let watch = getFlag(options, keys, "watch", mustBeBooleanOrObject); + let splitting = getFlag(options, keys, "splitting", mustBeBoolean); + let preserveSymlinks = getFlag(options, keys, "preserveSymlinks", mustBeBoolean); + let metafile = getFlag(options, keys, "metafile", mustBeBoolean); + let outfile = getFlag(options, keys, "outfile", mustBeString); + let outdir = getFlag(options, keys, "outdir", mustBeString); + let outbase = getFlag(options, keys, "outbase", mustBeString); + let platform = getFlag(options, keys, "platform", mustBeString); + let tsconfig = getFlag(options, keys, "tsconfig", mustBeString); + let resolveExtensions = getFlag(options, keys, "resolveExtensions", mustBeArray); + let nodePathsInput = getFlag(options, keys, "nodePaths", mustBeArray); + let mainFields = getFlag(options, keys, "mainFields", mustBeArray); + let conditions = getFlag(options, keys, "conditions", mustBeArray); + let external = getFlag(options, keys, "external", mustBeArray); + let loader = getFlag(options, keys, "loader", mustBeObject); + let outExtension = getFlag(options, keys, "outExtension", mustBeObject); + let publicPath = getFlag(options, keys, "publicPath", mustBeString); + let entryNames = getFlag(options, keys, "entryNames", mustBeString); + let chunkNames = getFlag(options, keys, "chunkNames", mustBeString); + let assetNames = getFlag(options, keys, "assetNames", mustBeString); + let inject = getFlag(options, keys, "inject", mustBeArray); + let banner = getFlag(options, keys, "banner", mustBeObject); + let footer = getFlag(options, keys, "footer", mustBeObject); + let entryPoints = getFlag(options, keys, "entryPoints", mustBeArrayOrRecord); + let absWorkingDir = getFlag(options, keys, "absWorkingDir", mustBeString); + let stdin = getFlag(options, keys, "stdin", mustBeObject); + let write = (_a2 = getFlag(options, keys, "write", mustBeBoolean)) != null ? _a2 : writeDefault; + let allowOverwrite = getFlag(options, keys, "allowOverwrite", mustBeBoolean); + let incremental = getFlag(options, keys, "incremental", mustBeBoolean) === true; + let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); + keys.plugins = true; + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (sourcemap) + flags.push(`--sourcemap${sourcemap === true ? "" : `=${sourcemap}`}`); + if (bundle) + flags.push("--bundle"); + if (allowOverwrite) + flags.push("--allow-overwrite"); + if (watch) { + flags.push("--watch"); + if (typeof watch === "boolean") { + watchMode = {}; + } else { + let watchKeys = /* @__PURE__ */ Object.create(null); + let onRebuild = getFlag(watch, watchKeys, "onRebuild", mustBeFunction); + checkForInvalidFlags(watch, watchKeys, `on "watch" in ${callName}() call`); + watchMode = { onRebuild }; + } + } + if (splitting) + flags.push("--splitting"); + if (preserveSymlinks) + flags.push("--preserve-symlinks"); + if (metafile) + flags.push(`--metafile`); + if (outfile) + flags.push(`--outfile=${outfile}`); + if (outdir) + flags.push(`--outdir=${outdir}`); + if (outbase) + flags.push(`--outbase=${outbase}`); + if (platform) + flags.push(`--platform=${platform}`); + if (tsconfig) + flags.push(`--tsconfig=${tsconfig}`); + if (resolveExtensions) { + let values = []; + for (let value of resolveExtensions) { + value += ""; + if (value.indexOf(",") >= 0) + throw new Error(`Invalid resolve extension: ${value}`); + values.push(value); + } + flags.push(`--resolve-extensions=${values.join(",")}`); + } + if (publicPath) + flags.push(`--public-path=${publicPath}`); + if (entryNames) + flags.push(`--entry-names=${entryNames}`); + if (chunkNames) + flags.push(`--chunk-names=${chunkNames}`); + if (assetNames) + flags.push(`--asset-names=${assetNames}`); + if (mainFields) { + let values = []; + for (let value of mainFields) { + value += ""; + if (value.indexOf(",") >= 0) + throw new Error(`Invalid main field: ${value}`); + values.push(value); + } + flags.push(`--main-fields=${values.join(",")}`); + } + if (conditions) { + let values = []; + for (let value of conditions) { + value += ""; + if (value.indexOf(",") >= 0) + throw new Error(`Invalid condition: ${value}`); + values.push(value); + } + flags.push(`--conditions=${values.join(",")}`); + } + if (external) + for (let name of external) + flags.push(`--external:${name}`); + if (banner) { + for (let type in banner) { + if (type.indexOf("=") >= 0) + throw new Error(`Invalid banner file type: ${type}`); + flags.push(`--banner:${type}=${banner[type]}`); + } + } + if (footer) { + for (let type in footer) { + if (type.indexOf("=") >= 0) + throw new Error(`Invalid footer file type: ${type}`); + flags.push(`--footer:${type}=${footer[type]}`); + } + } + if (inject) + for (let path3 of inject) + flags.push(`--inject:${path3}`); + if (loader) { + for (let ext in loader) { + if (ext.indexOf("=") >= 0) + throw new Error(`Invalid loader extension: ${ext}`); + flags.push(`--loader:${ext}=${loader[ext]}`); + } + } + if (outExtension) { + for (let ext in outExtension) { + if (ext.indexOf("=") >= 0) + throw new Error(`Invalid out extension: ${ext}`); + flags.push(`--out-extension:${ext}=${outExtension[ext]}`); + } + } + if (entryPoints) { + if (Array.isArray(entryPoints)) { + for (let entryPoint of entryPoints) { + entries.push(["", entryPoint + ""]); + } + } else { + for (let [key, value] of Object.entries(entryPoints)) { + entries.push([key + "", value + ""]); + } + } + } + if (stdin) { + let stdinKeys = /* @__PURE__ */ Object.create(null); + let contents = getFlag(stdin, stdinKeys, "contents", mustBeString); + let resolveDir = getFlag(stdin, stdinKeys, "resolveDir", mustBeString); + let sourcefile = getFlag(stdin, stdinKeys, "sourcefile", mustBeString); + let loader2 = getFlag(stdin, stdinKeys, "loader", mustBeString); + checkForInvalidFlags(stdin, stdinKeys, 'in "stdin" object'); + if (sourcefile) + flags.push(`--sourcefile=${sourcefile}`); + if (loader2) + flags.push(`--loader=${loader2}`); + if (resolveDir) + stdinResolveDir = resolveDir + ""; + stdinContents = contents ? contents + "" : ""; + } + let nodePaths = []; + if (nodePathsInput) { + for (let value of nodePathsInput) { + value += ""; + nodePaths.push(value); + } + } + return { + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir, + incremental, + nodePaths, + watch: watchMode, + mangleCache: validateMangleCache(mangleCache) + }; +} +function flagsForTransformOptions(callName, options, isTTY2, logLevelDefault) { + let flags = []; + let keys = /* @__PURE__ */ Object.create(null); + pushLogFlags(flags, options, keys, isTTY2, logLevelDefault); + pushCommonFlags(flags, options, keys); + let sourcemap = getFlag(options, keys, "sourcemap", mustBeStringOrBoolean); + let tsconfigRaw = getFlag(options, keys, "tsconfigRaw", mustBeStringOrObject); + let sourcefile = getFlag(options, keys, "sourcefile", mustBeString); + let loader = getFlag(options, keys, "loader", mustBeString); + let banner = getFlag(options, keys, "banner", mustBeString); + let footer = getFlag(options, keys, "footer", mustBeString); + let mangleCache = getFlag(options, keys, "mangleCache", mustBeObject); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (sourcemap) + flags.push(`--sourcemap=${sourcemap === true ? "external" : sourcemap}`); + if (tsconfigRaw) + flags.push(`--tsconfig-raw=${typeof tsconfigRaw === "string" ? tsconfigRaw : JSON.stringify(tsconfigRaw)}`); + if (sourcefile) + flags.push(`--sourcefile=${sourcefile}`); + if (loader) + flags.push(`--loader=${loader}`); + if (banner) + flags.push(`--banner=${banner}`); + if (footer) + flags.push(`--footer=${footer}`); + return { + flags, + mangleCache: validateMangleCache(mangleCache) + }; +} +function createChannel(streamIn) { + let responseCallbacks = /* @__PURE__ */ new Map(); + let pluginCallbacks = /* @__PURE__ */ new Map(); + let watchCallbacks = /* @__PURE__ */ new Map(); + let serveCallbacks = /* @__PURE__ */ new Map(); + let closeData = null; + let nextRequestID = 0; + let nextBuildKey = 0; + let stdout = new Uint8Array(16 * 1024); + let stdoutUsed = 0; + let readFromStdout = (chunk) => { + let limit = stdoutUsed + chunk.length; + if (limit > stdout.length) { + let swap = new Uint8Array(limit * 2); + swap.set(stdout); + stdout = swap; + } + stdout.set(chunk, stdoutUsed); + stdoutUsed += chunk.length; + let offset = 0; + while (offset + 4 <= stdoutUsed) { + let length = readUInt32LE(stdout, offset); + if (offset + 4 + length > stdoutUsed) { + break; + } + offset += 4; + handleIncomingPacket(stdout.subarray(offset, offset + length)); + offset += length; + } + if (offset > 0) { + stdout.copyWithin(0, offset, stdoutUsed); + stdoutUsed -= offset; + } + }; + let afterClose = (error) => { + closeData = { reason: error ? ": " + (error.message || error) : "" }; + const text = "The service was stopped" + closeData.reason; + for (let callback of responseCallbacks.values()) { + callback(text, null); + } + responseCallbacks.clear(); + for (let callbacks of serveCallbacks.values()) { + callbacks.onWait(text); + } + serveCallbacks.clear(); + for (let callback of watchCallbacks.values()) { + try { + callback(new Error(text), null); + } catch (e) { + console.error(e); + } + } + watchCallbacks.clear(); + }; + let sendRequest = (refs, value, callback) => { + if (closeData) + return callback("The service is no longer running" + closeData.reason, null); + let id = nextRequestID++; + responseCallbacks.set(id, (error, response) => { + try { + callback(error, response); + } finally { + if (refs) + refs.unref(); + } + }); + if (refs) + refs.ref(); + streamIn.writeToStdin(encodePacket({ id, isRequest: true, value })); + }; + let sendResponse = (id, value) => { + if (closeData) + throw new Error("The service is no longer running" + closeData.reason); + streamIn.writeToStdin(encodePacket({ id, isRequest: false, value })); + }; + let handleRequest = async (id, request) => { + try { + switch (request.command) { + case "ping": { + sendResponse(id, {}); + break; + } + case "on-start": { + let callback = pluginCallbacks.get(request.key); + if (!callback) + sendResponse(id, {}); + else + sendResponse(id, await callback(request)); + break; + } + case "on-resolve": { + let callback = pluginCallbacks.get(request.key); + if (!callback) + sendResponse(id, {}); + else + sendResponse(id, await callback(request)); + break; + } + case "on-load": { + let callback = pluginCallbacks.get(request.key); + if (!callback) + sendResponse(id, {}); + else + sendResponse(id, await callback(request)); + break; + } + case "serve-request": { + let callbacks = serveCallbacks.get(request.key); + if (callbacks && callbacks.onRequest) + callbacks.onRequest(request.args); + sendResponse(id, {}); + break; + } + case "serve-wait": { + let callbacks = serveCallbacks.get(request.key); + if (callbacks) + callbacks.onWait(request.error); + sendResponse(id, {}); + break; + } + case "watch-rebuild": { + let callback = watchCallbacks.get(request.key); + try { + if (callback) + callback(null, request.args); + } catch (err) { + console.error(err); + } + sendResponse(id, {}); + break; + } + default: + throw new Error(`Invalid command: ` + request.command); + } + } catch (e) { + sendResponse(id, { errors: [extractErrorMessageV8(e, streamIn, null, void 0, "")] }); + } + }; + let isFirstPacket = true; + let handleIncomingPacket = (bytes) => { + if (isFirstPacket) { + isFirstPacket = false; + let binaryVersion = String.fromCharCode(...bytes); + if (binaryVersion !== "0.14.38") { + throw new Error(`Cannot start service: Host version "${"0.14.38"}" does not match binary version ${JSON.stringify(binaryVersion)}`); + } + return; + } + let packet = decodePacket(bytes); + if (packet.isRequest) { + handleRequest(packet.id, packet.value); + } else { + let callback = responseCallbacks.get(packet.id); + responseCallbacks.delete(packet.id); + if (packet.value.error) + callback(packet.value.error, {}); + else + callback(null, packet.value); + } + }; + let handlePlugins = async (initialOptions, plugins, buildKey, stash, refs) => { + let onStartCallbacks = []; + let onEndCallbacks = []; + let onResolveCallbacks = {}; + let onLoadCallbacks = {}; + let nextCallbackID = 0; + let i = 0; + let requestPlugins = []; + let isSetupDone = false; + plugins = [...plugins]; + for (let item of plugins) { + let keys = {}; + if (typeof item !== "object") + throw new Error(`Plugin at index ${i} must be an object`); + const name = getFlag(item, keys, "name", mustBeString); + if (typeof name !== "string" || name === "") + throw new Error(`Plugin at index ${i} is missing a name`); + try { + let setup = getFlag(item, keys, "setup", mustBeFunction); + if (typeof setup !== "function") + throw new Error(`Plugin is missing a setup function`); + checkForInvalidFlags(item, keys, `on plugin ${JSON.stringify(name)}`); + let plugin = { + name, + onResolve: [], + onLoad: [] + }; + i++; + let resolve = (path3, options = {}) => { + if (!isSetupDone) + throw new Error('Cannot call "resolve" before plugin setup has completed'); + if (typeof path3 !== "string") + throw new Error(`The path to resolve must be a string`); + let keys2 = /* @__PURE__ */ Object.create(null); + let pluginName = getFlag(options, keys2, "pluginName", mustBeString); + let importer = getFlag(options, keys2, "importer", mustBeString); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + let resolveDir = getFlag(options, keys2, "resolveDir", mustBeString); + let kind = getFlag(options, keys2, "kind", mustBeString); + let pluginData = getFlag(options, keys2, "pluginData", canBeAnything); + checkForInvalidFlags(options, keys2, "in resolve() call"); + return new Promise((resolve2, reject) => { + const request = { + command: "resolve", + path: path3, + key: buildKey, + pluginName: name + }; + if (pluginName != null) + request.pluginName = pluginName; + if (importer != null) + request.importer = importer; + if (namespace != null) + request.namespace = namespace; + if (resolveDir != null) + request.resolveDir = resolveDir; + if (kind != null) + request.kind = kind; + if (pluginData != null) + request.pluginData = stash.store(pluginData); + sendRequest(refs, request, (error, response) => { + if (error !== null) + reject(new Error(error)); + else + resolve2({ + errors: replaceDetailsInMessages(response.errors, stash), + warnings: replaceDetailsInMessages(response.warnings, stash), + path: response.path, + external: response.external, + sideEffects: response.sideEffects, + namespace: response.namespace, + suffix: response.suffix, + pluginData: stash.load(response.pluginData) + }); + }); + }); + }; + let promise = setup({ + initialOptions, + resolve, + onStart(callback2) { + let registeredText = `This error came from the "onStart" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onStart"); + onStartCallbacks.push({ name, callback: callback2, note: registeredNote }); + }, + onEnd(callback2) { + let registeredText = `This error came from the "onEnd" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onEnd"); + onEndCallbacks.push({ name, callback: callback2, note: registeredNote }); + }, + onResolve(options, callback2) { + let registeredText = `This error came from the "onResolve" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onResolve"); + let keys2 = {}; + let filter = getFlag(options, keys2, "filter", mustBeRegExp); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + checkForInvalidFlags(options, keys2, `in onResolve() call for plugin ${JSON.stringify(name)}`); + if (filter == null) + throw new Error(`onResolve() call is missing a filter`); + let id = nextCallbackID++; + onResolveCallbacks[id] = { name, callback: callback2, note: registeredNote }; + plugin.onResolve.push({ id, filter: filter.source, namespace: namespace || "" }); + }, + onLoad(options, callback2) { + let registeredText = `This error came from the "onLoad" callback registered here:`; + let registeredNote = extractCallerV8(new Error(registeredText), streamIn, "onLoad"); + let keys2 = {}; + let filter = getFlag(options, keys2, "filter", mustBeRegExp); + let namespace = getFlag(options, keys2, "namespace", mustBeString); + checkForInvalidFlags(options, keys2, `in onLoad() call for plugin ${JSON.stringify(name)}`); + if (filter == null) + throw new Error(`onLoad() call is missing a filter`); + let id = nextCallbackID++; + onLoadCallbacks[id] = { name, callback: callback2, note: registeredNote }; + plugin.onLoad.push({ id, filter: filter.source, namespace: namespace || "" }); + }, + esbuild: streamIn.esbuild + }); + if (promise) + await promise; + requestPlugins.push(plugin); + } catch (e) { + return { ok: false, error: e, pluginName: name }; + } + } + const callback = async (request) => { + switch (request.command) { + case "on-start": { + let response = { errors: [], warnings: [] }; + await Promise.all(onStartCallbacks.map(async ({ name, callback: callback2, note }) => { + try { + let result = await callback2(); + if (result != null) { + if (typeof result !== "object") + throw new Error(`Expected onStart() callback in plugin ${JSON.stringify(name)} to return an object`); + let keys = {}; + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + checkForInvalidFlags(result, keys, `from onStart() callback in plugin ${JSON.stringify(name)}`); + if (errors != null) + response.errors.push(...sanitizeMessages(errors, "errors", stash, name)); + if (warnings != null) + response.warnings.push(...sanitizeMessages(warnings, "warnings", stash, name)); + } + } catch (e) { + response.errors.push(extractErrorMessageV8(e, streamIn, stash, note && note(), name)); + } + })); + return response; + } + case "on-resolve": { + let response = {}, name = "", callback2, note; + for (let id of request.ids) { + try { + ({ name, callback: callback2, note } = onResolveCallbacks[id]); + let result = await callback2({ + path: request.path, + importer: request.importer, + namespace: request.namespace, + resolveDir: request.resolveDir, + kind: request.kind, + pluginData: stash.load(request.pluginData) + }); + if (result != null) { + if (typeof result !== "object") + throw new Error(`Expected onResolve() callback in plugin ${JSON.stringify(name)} to return an object`); + let keys = {}; + let pluginName = getFlag(result, keys, "pluginName", mustBeString); + let path3 = getFlag(result, keys, "path", mustBeString); + let namespace = getFlag(result, keys, "namespace", mustBeString); + let suffix = getFlag(result, keys, "suffix", mustBeString); + let external = getFlag(result, keys, "external", mustBeBoolean); + let sideEffects = getFlag(result, keys, "sideEffects", mustBeBoolean); + let pluginData = getFlag(result, keys, "pluginData", canBeAnything); + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + let watchFiles = getFlag(result, keys, "watchFiles", mustBeArray); + let watchDirs = getFlag(result, keys, "watchDirs", mustBeArray); + checkForInvalidFlags(result, keys, `from onResolve() callback in plugin ${JSON.stringify(name)}`); + response.id = id; + if (pluginName != null) + response.pluginName = pluginName; + if (path3 != null) + response.path = path3; + if (namespace != null) + response.namespace = namespace; + if (suffix != null) + response.suffix = suffix; + if (external != null) + response.external = external; + if (sideEffects != null) + response.sideEffects = sideEffects; + if (pluginData != null) + response.pluginData = stash.store(pluginData); + if (errors != null) + response.errors = sanitizeMessages(errors, "errors", stash, name); + if (warnings != null) + response.warnings = sanitizeMessages(warnings, "warnings", stash, name); + if (watchFiles != null) + response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); + if (watchDirs != null) + response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); + break; + } + } catch (e) { + return { id, errors: [extractErrorMessageV8(e, streamIn, stash, note && note(), name)] }; + } + } + return response; + } + case "on-load": { + let response = {}, name = "", callback2, note; + for (let id of request.ids) { + try { + ({ name, callback: callback2, note } = onLoadCallbacks[id]); + let result = await callback2({ + path: request.path, + namespace: request.namespace, + suffix: request.suffix, + pluginData: stash.load(request.pluginData) + }); + if (result != null) { + if (typeof result !== "object") + throw new Error(`Expected onLoad() callback in plugin ${JSON.stringify(name)} to return an object`); + let keys = {}; + let pluginName = getFlag(result, keys, "pluginName", mustBeString); + let contents = getFlag(result, keys, "contents", mustBeStringOrUint8Array); + let resolveDir = getFlag(result, keys, "resolveDir", mustBeString); + let pluginData = getFlag(result, keys, "pluginData", canBeAnything); + let loader = getFlag(result, keys, "loader", mustBeString); + let errors = getFlag(result, keys, "errors", mustBeArray); + let warnings = getFlag(result, keys, "warnings", mustBeArray); + let watchFiles = getFlag(result, keys, "watchFiles", mustBeArray); + let watchDirs = getFlag(result, keys, "watchDirs", mustBeArray); + checkForInvalidFlags(result, keys, `from onLoad() callback in plugin ${JSON.stringify(name)}`); + response.id = id; + if (pluginName != null) + response.pluginName = pluginName; + if (contents instanceof Uint8Array) + response.contents = contents; + else if (contents != null) + response.contents = encodeUTF8(contents); + if (resolveDir != null) + response.resolveDir = resolveDir; + if (pluginData != null) + response.pluginData = stash.store(pluginData); + if (loader != null) + response.loader = loader; + if (errors != null) + response.errors = sanitizeMessages(errors, "errors", stash, name); + if (warnings != null) + response.warnings = sanitizeMessages(warnings, "warnings", stash, name); + if (watchFiles != null) + response.watchFiles = sanitizeStringArray(watchFiles, "watchFiles"); + if (watchDirs != null) + response.watchDirs = sanitizeStringArray(watchDirs, "watchDirs"); + break; + } + } catch (e) { + return { id, errors: [extractErrorMessageV8(e, streamIn, stash, note && note(), name)] }; + } + } + return response; + } + default: + throw new Error(`Invalid command: ` + request.command); + } + }; + let runOnEndCallbacks = (result, logPluginError, done) => done(); + if (onEndCallbacks.length > 0) { + runOnEndCallbacks = (result, logPluginError, done) => { + (async () => { + for (const { name, callback: callback2, note } of onEndCallbacks) { + try { + await callback2(result); + } catch (e) { + result.errors.push(await new Promise((resolve) => logPluginError(e, name, note && note(), resolve))); + } + } + })().then(done); + }; + } + isSetupDone = true; + let refCount = 0; + return { + ok: true, + requestPlugins, + runOnEndCallbacks, + pluginRefs: { + ref() { + if (++refCount === 1) + pluginCallbacks.set(buildKey, callback); + }, + unref() { + if (--refCount === 0) + pluginCallbacks.delete(buildKey); + } + } + }; + }; + let buildServeData = (refs, options, request, key) => { + let keys = {}; + let port = getFlag(options, keys, "port", mustBeInteger); + let host = getFlag(options, keys, "host", mustBeString); + let servedir = getFlag(options, keys, "servedir", mustBeString); + let onRequest = getFlag(options, keys, "onRequest", mustBeFunction); + let onWait; + let wait = new Promise((resolve, reject) => { + onWait = (error) => { + serveCallbacks.delete(key); + if (error !== null) + reject(new Error(error)); + else + resolve(); + }; + }); + request.serve = {}; + checkForInvalidFlags(options, keys, `in serve() call`); + if (port !== void 0) + request.serve.port = port; + if (host !== void 0) + request.serve.host = host; + if (servedir !== void 0) + request.serve.servedir = servedir; + serveCallbacks.set(key, { + onRequest, + onWait + }); + return { + wait, + stop() { + sendRequest(refs, { command: "serve-stop", key }, () => { + }); + } + }; + }; + const buildLogLevelDefault = "warning"; + const transformLogLevelDefault = "silent"; + let buildOrServe = (args) => { + let key = nextBuildKey++; + const details = createObjectStash(); + let plugins; + let { refs, options, isTTY: isTTY2, callback } = args; + if (typeof options === "object") { + let value = options.plugins; + if (value !== void 0) { + if (!Array.isArray(value)) + throw new Error(`"plugins" must be an array`); + plugins = value; + } + } + let logPluginError = (e, pluginName, note, done) => { + let flags = []; + try { + pushLogFlags(flags, options, {}, isTTY2, buildLogLevelDefault); + } catch { + } + const message = extractErrorMessageV8(e, streamIn, details, note, pluginName); + sendRequest(refs, { command: "error", flags, error: message }, () => { + message.detail = details.load(message.detail); + done(message); + }); + }; + let handleError = (e, pluginName) => { + logPluginError(e, pluginName, void 0, (error) => { + callback(failureErrorWithLog("Build failed", [error], []), null); + }); + }; + if (plugins && plugins.length > 0) { + if (streamIn.isSync) + return handleError(new Error("Cannot use plugins in synchronous API calls"), ""); + handlePlugins(options, plugins, key, details, refs).then((result) => { + if (!result.ok) { + handleError(result.error, result.pluginName); + } else { + try { + buildOrServeContinue(__spreadProps(__spreadValues({}, args), { + key, + details, + logPluginError, + requestPlugins: result.requestPlugins, + runOnEndCallbacks: result.runOnEndCallbacks, + pluginRefs: result.pluginRefs + })); + } catch (e) { + handleError(e, ""); + } + } + }, (e) => handleError(e, "")); + } else { + try { + buildOrServeContinue(__spreadProps(__spreadValues({}, args), { + key, + details, + logPluginError, + requestPlugins: null, + runOnEndCallbacks: (result, logPluginError2, done) => done(), + pluginRefs: null + })); + } catch (e) { + handleError(e, ""); + } + } + }; + let buildOrServeContinue = ({ + callName, + refs: callerRefs, + serveOptions, + options, + isTTY: isTTY2, + defaultWD: defaultWD2, + callback, + key, + details, + logPluginError, + requestPlugins, + runOnEndCallbacks, + pluginRefs + }) => { + const refs = { + ref() { + if (pluginRefs) + pluginRefs.ref(); + if (callerRefs) + callerRefs.ref(); + }, + unref() { + if (pluginRefs) + pluginRefs.unref(); + if (callerRefs) + callerRefs.unref(); + } + }; + let writeDefault = !streamIn.isBrowser; + let { + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir, + incremental, + nodePaths, + watch, + mangleCache + } = flagsForBuildOptions(callName, options, isTTY2, buildLogLevelDefault, writeDefault); + let request = { + command: "build", + key, + entries, + flags, + write, + stdinContents, + stdinResolveDir, + absWorkingDir: absWorkingDir || defaultWD2, + incremental, + nodePaths + }; + if (requestPlugins) + request.plugins = requestPlugins; + if (mangleCache) + request.mangleCache = mangleCache; + let serve2 = serveOptions && buildServeData(refs, serveOptions, request, key); + let rebuild; + let stop; + let copyResponseToResult = (response, result) => { + if (response.outputFiles) + result.outputFiles = response.outputFiles.map(convertOutputFiles); + if (response.metafile) + result.metafile = JSON.parse(response.metafile); + if (response.mangleCache) + result.mangleCache = response.mangleCache; + if (response.writeToStdout !== void 0) + console.log(decodeUTF8(response.writeToStdout).replace(/\n$/, "")); + }; + let buildResponseToResult = (response, callback2) => { + let result = { + errors: replaceDetailsInMessages(response.errors, details), + warnings: replaceDetailsInMessages(response.warnings, details) + }; + copyResponseToResult(response, result); + runOnEndCallbacks(result, logPluginError, () => { + if (result.errors.length > 0) { + return callback2(failureErrorWithLog("Build failed", result.errors, result.warnings), null); + } + if (response.rebuild) { + if (!rebuild) { + let isDisposed = false; + rebuild = () => new Promise((resolve, reject) => { + if (isDisposed || closeData) + throw new Error("Cannot rebuild"); + sendRequest(refs, { command: "rebuild", key }, (error2, response2) => { + if (error2) { + const message = { pluginName: "", text: error2, location: null, notes: [], detail: void 0 }; + return callback2(failureErrorWithLog("Build failed", [message], []), null); + } + buildResponseToResult(response2, (error3, result3) => { + if (error3) + reject(error3); + else + resolve(result3); + }); + }); + }); + refs.ref(); + rebuild.dispose = () => { + if (isDisposed) + return; + isDisposed = true; + sendRequest(refs, { command: "rebuild-dispose", key }, () => { + }); + refs.unref(); + }; + } + result.rebuild = rebuild; + } + if (response.watch) { + if (!stop) { + let isStopped = false; + refs.ref(); + stop = () => { + if (isStopped) + return; + isStopped = true; + watchCallbacks.delete(key); + sendRequest(refs, { command: "watch-stop", key }, () => { + }); + refs.unref(); + }; + if (watch) { + watchCallbacks.set(key, (serviceStopError, watchResponse) => { + if (serviceStopError) { + if (watch.onRebuild) + watch.onRebuild(serviceStopError, null); + return; + } + let result2 = { + errors: replaceDetailsInMessages(watchResponse.errors, details), + warnings: replaceDetailsInMessages(watchResponse.warnings, details) + }; + copyResponseToResult(watchResponse, result2); + runOnEndCallbacks(result2, logPluginError, () => { + if (result2.errors.length > 0) { + if (watch.onRebuild) + watch.onRebuild(failureErrorWithLog("Build failed", result2.errors, result2.warnings), null); + return; + } + if (watchResponse.rebuildID !== void 0) + result2.rebuild = rebuild; + result2.stop = stop; + if (watch.onRebuild) + watch.onRebuild(null, result2); + }); + }); + } + } + result.stop = stop; + } + callback2(null, result); + }); + }; + if (write && streamIn.isBrowser) + throw new Error(`Cannot enable "write" in the browser`); + if (incremental && streamIn.isSync) + throw new Error(`Cannot use "incremental" with a synchronous build`); + if (watch && streamIn.isSync) + throw new Error(`Cannot use "watch" with a synchronous build`); + sendRequest(refs, request, (error, response) => { + if (error) + return callback(new Error(error), null); + if (serve2) { + let serveResponse = response; + let isStopped = false; + refs.ref(); + let result = { + port: serveResponse.port, + host: serveResponse.host, + wait: serve2.wait, + stop() { + if (isStopped) + return; + isStopped = true; + serve2.stop(); + refs.unref(); + } + }; + refs.ref(); + serve2.wait.then(refs.unref, refs.unref); + return callback(null, result); + } + return buildResponseToResult(response, callback); + }); + }; + let transform2 = ({ callName, refs, input, options, isTTY: isTTY2, fs: fs3, callback }) => { + const details = createObjectStash(); + let start = (inputPath) => { + try { + if (typeof input !== "string") + throw new Error('The input to "transform" must be a string'); + let { + flags, + mangleCache + } = flagsForTransformOptions(callName, options, isTTY2, transformLogLevelDefault); + let request = { + command: "transform", + flags, + inputFS: inputPath !== null, + input: inputPath !== null ? inputPath : input + }; + if (mangleCache) + request.mangleCache = mangleCache; + sendRequest(refs, request, (error, response) => { + if (error) + return callback(new Error(error), null); + let errors = replaceDetailsInMessages(response.errors, details); + let warnings = replaceDetailsInMessages(response.warnings, details); + let outstanding = 1; + let next = () => { + if (--outstanding === 0) { + let result = { warnings, code: response.code, map: response.map }; + if (response.mangleCache) + result.mangleCache = response == null ? void 0 : response.mangleCache; + callback(null, result); + } + }; + if (errors.length > 0) + return callback(failureErrorWithLog("Transform failed", errors, warnings), null); + if (response.codeFS) { + outstanding++; + fs3.readFile(response.code, (err, contents) => { + if (err !== null) { + callback(err, null); + } else { + response.code = contents; + next(); + } + }); + } + if (response.mapFS) { + outstanding++; + fs3.readFile(response.map, (err, contents) => { + if (err !== null) { + callback(err, null); + } else { + response.map = contents; + next(); + } + }); + } + next(); + }); + } catch (e) { + let flags = []; + try { + pushLogFlags(flags, options, {}, isTTY2, transformLogLevelDefault); + } catch { + } + const error = extractErrorMessageV8(e, streamIn, details, void 0, ""); + sendRequest(refs, { command: "error", flags, error }, () => { + error.detail = details.load(error.detail); + callback(failureErrorWithLog("Transform failed", [error], []), null); + }); + } + }; + if (typeof input === "string" && input.length > 1024 * 1024) { + let next = start; + start = () => fs3.writeFile(input, next); + } + start(null); + }; + let formatMessages2 = ({ callName, refs, messages, options, callback }) => { + let result = sanitizeMessages(messages, "messages", null, ""); + if (!options) + throw new Error(`Missing second argument in ${callName}() call`); + let keys = {}; + let kind = getFlag(options, keys, "kind", mustBeString); + let color = getFlag(options, keys, "color", mustBeBoolean); + let terminalWidth = getFlag(options, keys, "terminalWidth", mustBeInteger); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + if (kind === void 0) + throw new Error(`Missing "kind" in ${callName}() call`); + if (kind !== "error" && kind !== "warning") + throw new Error(`Expected "kind" to be "error" or "warning" in ${callName}() call`); + let request = { + command: "format-msgs", + messages: result, + isWarning: kind === "warning" + }; + if (color !== void 0) + request.color = color; + if (terminalWidth !== void 0) + request.terminalWidth = terminalWidth; + sendRequest(refs, request, (error, response) => { + if (error) + return callback(new Error(error), null); + callback(null, response.messages); + }); + }; + let analyzeMetafile2 = ({ callName, refs, metafile, options, callback }) => { + if (options === void 0) + options = {}; + let keys = {}; + let color = getFlag(options, keys, "color", mustBeBoolean); + let verbose = getFlag(options, keys, "verbose", mustBeBoolean); + checkForInvalidFlags(options, keys, `in ${callName}() call`); + let request = { + command: "analyze-metafile", + metafile + }; + if (color !== void 0) + request.color = color; + if (verbose !== void 0) + request.verbose = verbose; + sendRequest(refs, request, (error, response) => { + if (error) + return callback(new Error(error), null); + callback(null, response.result); + }); + }; + return { + readFromStdout, + afterClose, + service: { + buildOrServe, + transform: transform2, + formatMessages: formatMessages2, + analyzeMetafile: analyzeMetafile2 + } + }; +} +function createObjectStash() { + const map = /* @__PURE__ */ new Map(); + let nextID = 0; + return { + load(id) { + return map.get(id); + }, + store(value) { + if (value === void 0) + return -1; + const id = nextID++; + map.set(id, value); + return id; + } + }; +} +function extractCallerV8(e, streamIn, ident) { + let note; + let tried = false; + return () => { + if (tried) + return note; + tried = true; + try { + let lines = (e.stack + "").split("\n"); + lines.splice(1, 1); + let location = parseStackLinesV8(streamIn, lines, ident); + if (location) { + note = { text: e.message, location }; + return note; + } + } catch { + } + }; +} +function extractErrorMessageV8(e, streamIn, stash, note, pluginName) { + let text = "Internal error"; + let location = null; + try { + text = (e && e.message || e) + ""; + } catch { + } + try { + location = parseStackLinesV8(streamIn, (e.stack + "").split("\n"), ""); + } catch { + } + return { pluginName, text, location, notes: note ? [note] : [], detail: stash ? stash.store(e) : -1 }; +} +function parseStackLinesV8(streamIn, lines, ident) { + let at = " at "; + if (streamIn.readFileSync && !lines[0].startsWith(at) && lines[1].startsWith(at)) { + for (let i = 1; i < lines.length; i++) { + let line = lines[i]; + if (!line.startsWith(at)) + continue; + line = line.slice(at.length); + while (true) { + let match = /^(?:new |async )?\S+ \((.*)\)$/.exec(line); + if (match) { + line = match[1]; + continue; + } + match = /^eval at \S+ \((.*)\)(?:, \S+:\d+:\d+)?$/.exec(line); + if (match) { + line = match[1]; + continue; + } + match = /^(\S+):(\d+):(\d+)$/.exec(line); + if (match) { + let contents; + try { + contents = streamIn.readFileSync(match[1], "utf8"); + } catch { + break; + } + let lineText = contents.split(/\r\n|\r|\n|\u2028|\u2029/)[+match[2] - 1] || ""; + let column = +match[3] - 1; + let length = lineText.slice(column, column + ident.length) === ident ? ident.length : 0; + return { + file: match[1], + namespace: "file", + line: +match[2], + column: encodeUTF8(lineText.slice(0, column)).length, + length: encodeUTF8(lineText.slice(column, column + length)).length, + lineText: lineText + "\n" + lines.slice(1).join("\n"), + suggestion: "" + }; + } + break; + } + } + } + return null; +} +function failureErrorWithLog(text, errors, warnings) { + let limit = 5; + let summary = errors.length < 1 ? "" : ` with ${errors.length} error${errors.length < 2 ? "" : "s"}:` + errors.slice(0, limit + 1).map((e, i) => { + if (i === limit) + return "\n..."; + if (!e.location) + return ` +error: ${e.text}`; + let { file, line, column } = e.location; + let pluginText = e.pluginName ? `[plugin: ${e.pluginName}] ` : ""; + return ` +${file}:${line}:${column}: ERROR: ${pluginText}${e.text}`; + }).join(""); + let error = new Error(`${text}${summary}`); + error.errors = errors; + error.warnings = warnings; + return error; +} +function replaceDetailsInMessages(messages, stash) { + for (const message of messages) { + message.detail = stash.load(message.detail); + } + return messages; +} +function sanitizeLocation(location, where) { + if (location == null) + return null; + let keys = {}; + let file = getFlag(location, keys, "file", mustBeString); + let namespace = getFlag(location, keys, "namespace", mustBeString); + let line = getFlag(location, keys, "line", mustBeInteger); + let column = getFlag(location, keys, "column", mustBeInteger); + let length = getFlag(location, keys, "length", mustBeInteger); + let lineText = getFlag(location, keys, "lineText", mustBeString); + let suggestion = getFlag(location, keys, "suggestion", mustBeString); + checkForInvalidFlags(location, keys, where); + return { + file: file || "", + namespace: namespace || "", + line: line || 0, + column: column || 0, + length: length || 0, + lineText: lineText || "", + suggestion: suggestion || "" + }; +} +function sanitizeMessages(messages, property, stash, fallbackPluginName) { + let messagesClone = []; + let index = 0; + for (const message of messages) { + let keys = {}; + let pluginName = getFlag(message, keys, "pluginName", mustBeString); + let text = getFlag(message, keys, "text", mustBeString); + let location = getFlag(message, keys, "location", mustBeObjectOrNull); + let notes = getFlag(message, keys, "notes", mustBeArray); + let detail = getFlag(message, keys, "detail", canBeAnything); + let where = `in element ${index} of "${property}"`; + checkForInvalidFlags(message, keys, where); + let notesClone = []; + if (notes) { + for (const note of notes) { + let noteKeys = {}; + let noteText = getFlag(note, noteKeys, "text", mustBeString); + let noteLocation = getFlag(note, noteKeys, "location", mustBeObjectOrNull); + checkForInvalidFlags(note, noteKeys, where); + notesClone.push({ + text: noteText || "", + location: sanitizeLocation(noteLocation, where) + }); + } + } + messagesClone.push({ + pluginName: pluginName || fallbackPluginName, + text: text || "", + location: sanitizeLocation(location, where), + notes: notesClone, + detail: stash ? stash.store(detail) : -1 + }); + index++; + } + return messagesClone; +} +function sanitizeStringArray(values, property) { + const result = []; + for (const value of values) { + if (typeof value !== "string") + throw new Error(`${JSON.stringify(property)} must be an array of strings`); + result.push(value); + } + return result; +} +function convertOutputFiles({ path: path3, contents }) { + let text = null; + return { + path: path3, + contents, + get text() { + if (text === null) + text = decodeUTF8(contents); + return text; + } + }; +} + +// lib/npm/node-platform.ts +var fs = require("fs"); +var os = require("os"); +var path = require("path"); +var ESBUILD_BINARY_PATH = process.env.ESBUILD_BINARY_PATH || ESBUILD_BINARY_PATH; +var knownWindowsPackages = { + "win32 arm64 LE": "esbuild-windows-arm64", + "win32 ia32 LE": "esbuild-windows-32", + "win32 x64 LE": "esbuild-windows-64" +}; +var knownUnixlikePackages = { + "android arm64 LE": "esbuild-android-arm64", + "darwin arm64 LE": "esbuild-darwin-arm64", + "darwin x64 LE": "esbuild-darwin-64", + "freebsd arm64 LE": "esbuild-freebsd-arm64", + "freebsd x64 LE": "esbuild-freebsd-64", + "linux arm LE": "esbuild-linux-arm", + "linux arm64 LE": "esbuild-linux-arm64", + "linux ia32 LE": "esbuild-linux-32", + "linux mips64el LE": "esbuild-linux-mips64le", + "linux ppc64 LE": "esbuild-linux-ppc64le", + "linux riscv64 LE": "esbuild-linux-riscv64", + "linux s390x BE": "esbuild-linux-s390x", + "linux x64 LE": "esbuild-linux-64", + "netbsd x64 LE": "esbuild-netbsd-64", + "openbsd x64 LE": "esbuild-openbsd-64", + "sunos x64 LE": "esbuild-sunos-64" +}; +var knownWebAssemblyFallbackPackages = { + "android x64 LE": "esbuild-android-64" +}; +function pkgAndSubpathForCurrentPlatform() { + let pkg; + let subpath; + let isWASM = false; + let platformKey = `${process.platform} ${os.arch()} ${os.endianness()}`; + if (platformKey in knownWindowsPackages) { + pkg = knownWindowsPackages[platformKey]; + subpath = "esbuild.exe"; + } else if (platformKey in knownUnixlikePackages) { + pkg = knownUnixlikePackages[platformKey]; + subpath = "bin/esbuild"; + } else if (platformKey in knownWebAssemblyFallbackPackages) { + pkg = knownWebAssemblyFallbackPackages[platformKey]; + subpath = "bin/esbuild"; + isWASM = true; + } else { + throw new Error(`Unsupported platform: ${platformKey}`); + } + return { pkg, subpath, isWASM }; +} +function pkgForSomeOtherPlatform() { + const libMainJS = require.resolve("esbuild"); + const nodeModulesDirectory = path.dirname(path.dirname(path.dirname(libMainJS))); + if (path.basename(nodeModulesDirectory) === "node_modules") { + for (const unixKey in knownUnixlikePackages) { + try { + const pkg = knownUnixlikePackages[unixKey]; + if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) + return pkg; + } catch { + } + } + for (const windowsKey in knownWindowsPackages) { + try { + const pkg = knownWindowsPackages[windowsKey]; + if (fs.existsSync(path.join(nodeModulesDirectory, pkg))) + return pkg; + } catch { + } + } + } + return null; +} +function downloadedBinPath(pkg, subpath) { + const esbuildLibDir = path.dirname(require.resolve("esbuild")); + return path.join(esbuildLibDir, `downloaded-${pkg}-${path.basename(subpath)}`); +} +function generateBinPath() { + if (ESBUILD_BINARY_PATH) { + return { binPath: ESBUILD_BINARY_PATH, isWASM: false }; + } + const { pkg, subpath, isWASM } = pkgAndSubpathForCurrentPlatform(); + let binPath; + try { + binPath = require.resolve(`${pkg}/${subpath}`); + } catch (e) { + binPath = downloadedBinPath(pkg, subpath); + if (!fs.existsSync(binPath)) { + try { + require.resolve(pkg); + } catch { + const otherPkg = pkgForSomeOtherPlatform(); + if (otherPkg) { + throw new Error(` +You installed esbuild on another platform than the one you're currently using. +This won't work because esbuild is written with native code and needs to +install a platform-specific binary executable. + +Specifically the "${otherPkg}" package is present but this platform +needs the "${pkg}" package instead. People often get into this +situation by installing esbuild on Windows or macOS and copying "node_modules" +into a Docker image that runs Linux, or by copying "node_modules" between +Windows and WSL environments. + +If you are installing with npm, you can try not copying the "node_modules" +directory when you copy the files over, and running "npm ci" or "npm install" +on the destination platform after the copy. Or you could consider using yarn +instead which has built-in support for installing a package on multiple +platforms simultaneously. + +If you are installing with yarn, you can try listing both this platform and the +other platform in your ".yarnrc.yml" file using the "supportedArchitectures" +feature: https://yarnpkg.com/configuration/yarnrc/#supportedArchitectures +Keep in mind that this means multiple copies of esbuild will be present. + +Another alternative is to use the "esbuild-wasm" package instead, which works +the same way on all platforms. But it comes with a heavy performance cost and +can sometimes be 10x slower than the "esbuild" package, so you may also not +want to do that. +`); + } + throw new Error(`The package "${pkg}" could not be found, and is needed by esbuild. + +If you are installing esbuild with npm, make sure that you don't specify the +"--no-optional" flag. The "optionalDependencies" package.json feature is used +by esbuild to install the correct binary executable for your current platform.`); + } + throw e; + } + } + let isYarnPnP = false; + try { + require("pnpapi"); + isYarnPnP = true; + } catch (e) { + } + if (isYarnPnP) { + const esbuildLibDir = path.dirname(require.resolve("esbuild")); + const binTargetPath = path.join(esbuildLibDir, `pnpapi-${pkg}-${path.basename(subpath)}`); + if (!fs.existsSync(binTargetPath)) { + fs.copyFileSync(binPath, binTargetPath); + fs.chmodSync(binTargetPath, 493); + } + return { binPath: binTargetPath, isWASM }; + } + return { binPath, isWASM }; +} + +// lib/npm/node.ts +var child_process = require("child_process"); +var crypto = require("crypto"); +var path2 = require("path"); +var fs2 = require("fs"); +var os2 = require("os"); +var tty = require("tty"); +var worker_threads; +if (process.env.ESBUILD_WORKER_THREADS !== "0") { + try { + worker_threads = require("worker_threads"); + } catch { + } + let [major, minor] = process.versions.node.split("."); + if (+major < 12 || +major === 12 && +minor < 17 || +major === 13 && +minor < 13) { + worker_threads = void 0; + } +} +var _a; +var isInternalWorkerThread = ((_a = worker_threads == null ? void 0 : worker_threads.workerData) == null ? void 0 : _a.esbuildVersion) === "0.14.38"; +var esbuildCommandAndArgs = () => { + if ((!ESBUILD_BINARY_PATH || false) && (path2.basename(__filename) !== "main.js" || path2.basename(__dirname) !== "lib")) { + throw new Error(`The esbuild JavaScript API cannot be bundled. Please mark the "esbuild" package as external so it's not included in the bundle. + +More information: The file containing the code for esbuild's JavaScript API (${__filename}) does not appear to be inside the esbuild package on the file system, which usually means that the esbuild package was bundled into another file. This is problematic because the API needs to run a binary executable inside the esbuild package which is located using a relative path from the API code to the executable. If the esbuild package is bundled, the relative path will be incorrect and the executable won't be found.`); + } + if (false) { + return ["node", [path2.join(__dirname, "..", "bin", "esbuild")]]; + } + const { binPath, isWASM } = generateBinPath(); + if (isWASM) { + return ["node", [binPath]]; + } else { + return [binPath, []]; + } +}; +var isTTY = () => tty.isatty(2); +var fsSync = { + readFile(tempFile, callback) { + try { + let contents = fs2.readFileSync(tempFile, "utf8"); + try { + fs2.unlinkSync(tempFile); + } catch { + } + callback(null, contents); + } catch (err) { + callback(err, null); + } + }, + writeFile(contents, callback) { + try { + let tempFile = randomFileName(); + fs2.writeFileSync(tempFile, contents); + callback(tempFile); + } catch { + callback(null); + } + } +}; +var fsAsync = { + readFile(tempFile, callback) { + try { + fs2.readFile(tempFile, "utf8", (err, contents) => { + try { + fs2.unlink(tempFile, () => callback(err, contents)); + } catch { + callback(err, contents); + } + }); + } catch (err) { + callback(err, null); + } + }, + writeFile(contents, callback) { + try { + let tempFile = randomFileName(); + fs2.writeFile(tempFile, contents, (err) => err !== null ? callback(null) : callback(tempFile)); + } catch { + callback(null); + } + } +}; +var version = "0.14.38"; +var build = (options) => ensureServiceIsRunning().build(options); +var serve = (serveOptions, buildOptions) => ensureServiceIsRunning().serve(serveOptions, buildOptions); +var transform = (input, options) => ensureServiceIsRunning().transform(input, options); +var formatMessages = (messages, options) => ensureServiceIsRunning().formatMessages(messages, options); +var analyzeMetafile = (messages, options) => ensureServiceIsRunning().analyzeMetafile(messages, options); +var buildSync = (options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) + workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.buildSync(options); + } + let result; + runServiceSync((service) => service.buildOrServe({ + callName: "buildSync", + refs: null, + serveOptions: null, + options, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => { + if (err) + throw err; + result = res; + } + })); + return result; +}; +var transformSync = (input, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) + workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.transformSync(input, options); + } + let result; + runServiceSync((service) => service.transform({ + callName: "transformSync", + refs: null, + input, + options: options || {}, + isTTY: isTTY(), + fs: fsSync, + callback: (err, res) => { + if (err) + throw err; + result = res; + } + })); + return result; +}; +var formatMessagesSync = (messages, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) + workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.formatMessagesSync(messages, options); + } + let result; + runServiceSync((service) => service.formatMessages({ + callName: "formatMessagesSync", + refs: null, + messages, + options, + callback: (err, res) => { + if (err) + throw err; + result = res; + } + })); + return result; +}; +var analyzeMetafileSync = (metafile, options) => { + if (worker_threads && !isInternalWorkerThread) { + if (!workerThreadService) + workerThreadService = startWorkerThreadService(worker_threads); + return workerThreadService.analyzeMetafileSync(metafile, options); + } + let result; + runServiceSync((service) => service.analyzeMetafile({ + callName: "analyzeMetafileSync", + refs: null, + metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), + options, + callback: (err, res) => { + if (err) + throw err; + result = res; + } + })); + return result; +}; +var initializeWasCalled = false; +var initialize = (options) => { + options = validateInitializeOptions(options || {}); + if (options.wasmURL) + throw new Error(`The "wasmURL" option only works in the browser`); + if (options.worker) + throw new Error(`The "worker" option only works in the browser`); + if (initializeWasCalled) + throw new Error('Cannot call "initialize" more than once'); + ensureServiceIsRunning(); + initializeWasCalled = true; + return Promise.resolve(); +}; +var defaultWD = process.cwd(); +var longLivedService; +var ensureServiceIsRunning = () => { + if (longLivedService) + return longLivedService; + let [command, args] = esbuildCommandAndArgs(); + let child = child_process.spawn(command, args.concat(`--service=${"0.14.38"}`, "--ping"), { + windowsHide: true, + stdio: ["pipe", "pipe", "inherit"], + cwd: defaultWD + }); + let { readFromStdout, afterClose, service } = createChannel({ + writeToStdin(bytes) { + child.stdin.write(bytes, (err) => { + if (err) + afterClose(err); + }); + }, + readFileSync: fs2.readFileSync, + isSync: false, + isBrowser: false, + esbuild: node_exports + }); + child.stdin.on("error", afterClose); + child.on("error", afterClose); + const stdin = child.stdin; + const stdout = child.stdout; + stdout.on("data", readFromStdout); + stdout.on("end", afterClose); + let refCount = 0; + child.unref(); + if (stdin.unref) { + stdin.unref(); + } + if (stdout.unref) { + stdout.unref(); + } + const refs = { + ref() { + if (++refCount === 1) + child.ref(); + }, + unref() { + if (--refCount === 0) + child.unref(); + } + }; + longLivedService = { + build: (options) => { + return new Promise((resolve, reject) => { + service.buildOrServe({ + callName: "build", + refs, + serveOptions: null, + options, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => err ? reject(err) : resolve(res) + }); + }); + }, + serve: (serveOptions, buildOptions) => { + if (serveOptions === null || typeof serveOptions !== "object") + throw new Error("The first argument must be an object"); + return new Promise((resolve, reject) => service.buildOrServe({ + callName: "serve", + refs, + serveOptions, + options: buildOptions, + isTTY: isTTY(), + defaultWD, + callback: (err, res) => err ? reject(err) : resolve(res) + })); + }, + transform: (input, options) => { + return new Promise((resolve, reject) => service.transform({ + callName: "transform", + refs, + input, + options: options || {}, + isTTY: isTTY(), + fs: fsAsync, + callback: (err, res) => err ? reject(err) : resolve(res) + })); + }, + formatMessages: (messages, options) => { + return new Promise((resolve, reject) => service.formatMessages({ + callName: "formatMessages", + refs, + messages, + options, + callback: (err, res) => err ? reject(err) : resolve(res) + })); + }, + analyzeMetafile: (metafile, options) => { + return new Promise((resolve, reject) => service.analyzeMetafile({ + callName: "analyzeMetafile", + refs, + metafile: typeof metafile === "string" ? metafile : JSON.stringify(metafile), + options, + callback: (err, res) => err ? reject(err) : resolve(res) + })); + } + }; + return longLivedService; +}; +var runServiceSync = (callback) => { + let [command, args] = esbuildCommandAndArgs(); + let stdin = new Uint8Array(); + let { readFromStdout, afterClose, service } = createChannel({ + writeToStdin(bytes) { + if (stdin.length !== 0) + throw new Error("Must run at most one command"); + stdin = bytes; + }, + isSync: true, + isBrowser: false, + esbuild: node_exports + }); + callback(service); + let stdout = child_process.execFileSync(command, args.concat(`--service=${"0.14.38"}`), { + cwd: defaultWD, + windowsHide: true, + input: stdin, + maxBuffer: +process.env.ESBUILD_MAX_BUFFER || 16 * 1024 * 1024 + }); + readFromStdout(stdout); + afterClose(null); +}; +var randomFileName = () => { + return path2.join(os2.tmpdir(), `esbuild-${crypto.randomBytes(32).toString("hex")}`); +}; +var workerThreadService = null; +var startWorkerThreadService = (worker_threads2) => { + let { port1: mainPort, port2: workerPort } = new worker_threads2.MessageChannel(); + let worker = new worker_threads2.Worker(__filename, { + workerData: { workerPort, defaultWD, esbuildVersion: "0.14.38" }, + transferList: [workerPort], + execArgv: [] + }); + let nextID = 0; + let wasStopped = false; + let fakeBuildError = (text) => { + let error = new Error(`Build failed with 1 error: +error: ${text}`); + let errors = [{ pluginName: "", text, location: null, notes: [], detail: void 0 }]; + error.errors = errors; + error.warnings = []; + return error; + }; + let validateBuildSyncOptions = (options) => { + if (!options) + return; + let plugins = options.plugins; + let incremental = options.incremental; + let watch = options.watch; + if (plugins && plugins.length > 0) + throw fakeBuildError(`Cannot use plugins in synchronous API calls`); + if (incremental) + throw fakeBuildError(`Cannot use "incremental" with a synchronous build`); + if (watch) + throw fakeBuildError(`Cannot use "watch" with a synchronous build`); + }; + let applyProperties = (object, properties) => { + for (let key in properties) { + object[key] = properties[key]; + } + }; + let runCallSync = (command, args) => { + if (wasStopped) + throw new Error("The service was stopped"); + let id = nextID++; + let sharedBuffer = new SharedArrayBuffer(8); + let sharedBufferView = new Int32Array(sharedBuffer); + let msg = { sharedBuffer, id, command, args }; + worker.postMessage(msg); + let status = Atomics.wait(sharedBufferView, 0, 0); + if (status !== "ok" && status !== "not-equal") + throw new Error("Internal error: Atomics.wait() failed: " + status); + let { message: { id: id2, resolve, reject, properties } } = worker_threads2.receiveMessageOnPort(mainPort); + if (id !== id2) + throw new Error(`Internal error: Expected id ${id} but got id ${id2}`); + if (reject) { + applyProperties(reject, properties); + throw reject; + } + return resolve; + }; + worker.unref(); + return { + buildSync(options) { + validateBuildSyncOptions(options); + return runCallSync("build", [options]); + }, + transformSync(input, options) { + return runCallSync("transform", [input, options]); + }, + formatMessagesSync(messages, options) { + return runCallSync("formatMessages", [messages, options]); + }, + analyzeMetafileSync(metafile, options) { + return runCallSync("analyzeMetafile", [metafile, options]); + } + }; +}; +var startSyncServiceWorker = () => { + let workerPort = worker_threads.workerData.workerPort; + let parentPort = worker_threads.parentPort; + let service = ensureServiceIsRunning(); + defaultWD = worker_threads.workerData.defaultWD; + let extractProperties = (object) => { + let properties = {}; + if (object && typeof object === "object") { + for (let key in object) { + properties[key] = object[key]; + } + } + return properties; + }; + parentPort.on("message", (msg) => { + (async () => { + let { sharedBuffer, id, command, args } = msg; + let sharedBufferView = new Int32Array(sharedBuffer); + try { + switch (command) { + case "build": + workerPort.postMessage({ id, resolve: await service.build(args[0]) }); + break; + case "transform": + workerPort.postMessage({ id, resolve: await service.transform(args[0], args[1]) }); + break; + case "formatMessages": + workerPort.postMessage({ id, resolve: await service.formatMessages(args[0], args[1]) }); + break; + case "analyzeMetafile": + workerPort.postMessage({ id, resolve: await service.analyzeMetafile(args[0], args[1]) }); + break; + default: + throw new Error(`Invalid command: ${command}`); + } + } catch (reject) { + workerPort.postMessage({ id, reject, properties: extractProperties(reject) }); + } + Atomics.add(sharedBufferView, 0, 1); + Atomics.notify(sharedBufferView, 0, Infinity); + })(); + }); +}; +if (isInternalWorkerThread) { + startSyncServiceWorker(); +} +var node_default = node_exports; +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + analyzeMetafile, + analyzeMetafileSync, + build, + buildSync, + formatMessages, + formatMessagesSync, + initialize, + serve, + transform, + transformSync, + version +}); diff --git a/frontend/node_modules/esbuild/package.json b/frontend/node_modules/esbuild/package.json new file mode 100644 index 00000000..b8811fcd --- /dev/null +++ b/frontend/node_modules/esbuild/package.json @@ -0,0 +1,40 @@ +{ + "name": "esbuild", + "version": "0.14.38", + "description": "An extremely fast JavaScript and CSS bundler and minifier.", + "repository": "https://github.com/evanw/esbuild", + "scripts": { + "postinstall": "node install.js" + }, + "main": "lib/main.js", + "types": "lib/main.d.ts", + "engines": { + "node": ">=12" + }, + "bin": { + "esbuild": "bin/esbuild" + }, + "optionalDependencies": { + "esbuild-android-64": "0.14.38", + "esbuild-android-arm64": "0.14.38", + "esbuild-darwin-64": "0.14.38", + "esbuild-darwin-arm64": "0.14.38", + "esbuild-freebsd-64": "0.14.38", + "esbuild-freebsd-arm64": "0.14.38", + "esbuild-linux-32": "0.14.38", + "esbuild-linux-64": "0.14.38", + "esbuild-linux-arm": "0.14.38", + "esbuild-linux-arm64": "0.14.38", + "esbuild-linux-mips64le": "0.14.38", + "esbuild-linux-ppc64le": "0.14.38", + "esbuild-linux-riscv64": "0.14.38", + "esbuild-linux-s390x": "0.14.38", + "esbuild-netbsd-64": "0.14.38", + "esbuild-openbsd-64": "0.14.38", + "esbuild-sunos-64": "0.14.38", + "esbuild-windows-32": "0.14.38", + "esbuild-windows-64": "0.14.38", + "esbuild-windows-arm64": "0.14.38" + }, + "license": "MIT" +} diff --git a/frontend/node_modules/fsevents/LICENSE b/frontend/node_modules/fsevents/LICENSE new file mode 100644 index 00000000..5d70441c --- /dev/null +++ b/frontend/node_modules/fsevents/LICENSE @@ -0,0 +1,22 @@ +MIT License +----------- + +Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/frontend/node_modules/fsevents/README.md b/frontend/node_modules/fsevents/README.md new file mode 100644 index 00000000..025c9a13 --- /dev/null +++ b/frontend/node_modules/fsevents/README.md @@ -0,0 +1,83 @@ +# fsevents [![NPM](https://nodei.co/npm/fsevents.png)](https://nodei.co/npm/fsevents/) + +Native access to MacOS FSEvents in [Node.js](https://nodejs.org/) + +The FSEvents API in MacOS allows applications to register for notifications of +changes to a given directory tree. It is a very fast and lightweight alternative +to kqueue. + +This is a low-level library. For a cross-platform file watching module that +uses fsevents, check out [Chokidar](https://github.com/paulmillr/chokidar). + +## Installation + +Supports only **Node.js v8.16 and higher**. + +```sh +npm install fsevents +``` + +## Usage + +```js +const fsevents = require('fsevents'); +const stop = fsevents.watch(__dirname, (path, flags, id) => { + const info = fsevents.getInfo(path, flags, id); +}); // To start observation +stop(); // To end observation +``` + +The callback passed as the second parameter to `.watch` get's called whenever the operating system detects a +a change in the file system. It takes three arguments: + +###### `fsevents.watch(dirname: string, (path: string, flags: number, id: string) => void): () => Promise` + + * `path: string` - the item in the filesystem that have been changed + * `flags: number` - a numeric value describing what the change was + * `id: string` - an unique-id identifying this specific event + + Returns closer callback which when called returns a Promise resolving when the watcher process has been shut down. + +###### `fsevents.getInfo(path: string, flags: number, id: string): FsEventInfo` + +The `getInfo` function takes the `path`, `flags` and `id` arguments and converts those parameters into a structure +that is easier to digest to determine what the change was. + +The `FsEventsInfo` has the following shape: + +```js +/** + * @typedef {'created'|'modified'|'deleted'|'moved'|'root-changed'|'cloned'|'unknown'} FsEventsEvent + * @typedef {'file'|'directory'|'symlink'} FsEventsType + */ +{ + "event": "created", // {FsEventsEvent} + "path": "file.txt", + "type": "file", // {FsEventsType} + "changes": { + "inode": true, // Had iNode Meta-Information changed + "finder": false, // Had Finder Meta-Data changed + "access": false, // Had access permissions changed + "xattrs": false // Had xAttributes changed + }, + "flags": 0x100000000 +} +``` + +## Changelog + +- v2.3 supports Apple Silicon ARM CPUs +- v2 supports node 8.16+ and reduces package size massively +- v1.2.8 supports node 6+ +- v1.2.7 supports node 4+ + +## Troubleshooting + +- I'm getting `EBADPLATFORM` `Unsupported platform for fsevents` error. +- It's fine, nothing is broken. fsevents is macos-only. Other platforms are skipped. If you want to hide this warning, report a bug to NPM bugtracker asking them to hide ebadplatform warnings by default. + +## License + +The MIT License Copyright (C) 2010-2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller — see LICENSE file. + +Visit our [GitHub page](https://github.com/fsevents/fsevents) and [NPM Page](https://npmjs.org/package/fsevents) diff --git a/frontend/node_modules/fsevents/fsevents.d.ts b/frontend/node_modules/fsevents/fsevents.d.ts new file mode 100644 index 00000000..2723c048 --- /dev/null +++ b/frontend/node_modules/fsevents/fsevents.d.ts @@ -0,0 +1,46 @@ +declare type Event = "created" | "cloned" | "modified" | "deleted" | "moved" | "root-changed" | "unknown"; +declare type Type = "file" | "directory" | "symlink"; +declare type FileChanges = { + inode: boolean; + finder: boolean; + access: boolean; + xattrs: boolean; +}; +declare type Info = { + event: Event; + path: string; + type: Type; + changes: FileChanges; + flags: number; +}; +declare type WatchHandler = (path: string, flags: number, id: string) => void; +export declare function watch(path: string, handler: WatchHandler): () => Promise; +export declare function watch(path: string, since: number, handler: WatchHandler): () => Promise; +export declare function getInfo(path: string, flags: number): Info; +export declare const constants: { + None: 0x00000000; + MustScanSubDirs: 0x00000001; + UserDropped: 0x00000002; + KernelDropped: 0x00000004; + EventIdsWrapped: 0x00000008; + HistoryDone: 0x00000010; + RootChanged: 0x00000020; + Mount: 0x00000040; + Unmount: 0x00000080; + ItemCreated: 0x00000100; + ItemRemoved: 0x00000200; + ItemInodeMetaMod: 0x00000400; + ItemRenamed: 0x00000800; + ItemModified: 0x00001000; + ItemFinderInfoMod: 0x00002000; + ItemChangeOwner: 0x00004000; + ItemXattrMod: 0x00008000; + ItemIsFile: 0x00010000; + ItemIsDir: 0x00020000; + ItemIsSymlink: 0x00040000; + ItemIsHardlink: 0x00100000; + ItemIsLastHardlink: 0x00200000; + OwnEvent: 0x00080000; + ItemCloned: 0x00400000; +}; +export {}; diff --git a/frontend/node_modules/fsevents/fsevents.js b/frontend/node_modules/fsevents/fsevents.js new file mode 100644 index 00000000..f1b31c95 --- /dev/null +++ b/frontend/node_modules/fsevents/fsevents.js @@ -0,0 +1,82 @@ +/* + ** © 2020 by Philipp Dunkel, Ben Noordhuis, Elan Shankar, Paul Miller + ** Licensed under MIT License. + */ + +/* jshint node:true */ +"use strict"; + +if (process.platform !== "darwin") { + throw new Error(`Module 'fsevents' is not compatible with platform '${process.platform}'`); +} + +const Native = require("./fsevents.node"); +const events = Native.constants; + +function watch(path, since, handler) { + if (typeof path !== "string") { + throw new TypeError(`fsevents argument 1 must be a string and not a ${typeof path}`); + } + if ("function" === typeof since && "undefined" === typeof handler) { + handler = since; + since = Native.flags.SinceNow; + } + if (typeof since !== "number") { + throw new TypeError(`fsevents argument 2 must be a number and not a ${typeof since}`); + } + if (typeof handler !== "function") { + throw new TypeError(`fsevents argument 3 must be a function and not a ${typeof handler}`); + } + + let instance = Native.start(Native.global, path, since, handler); + if (!instance) throw new Error(`could not watch: ${path}`); + return () => { + const result = instance ? Promise.resolve(instance).then(Native.stop) : Promise.resolve(undefined); + instance = undefined; + return result; + }; +} + +function getInfo(path, flags) { + return { + path, + flags, + event: getEventType(flags), + type: getFileType(flags), + changes: getFileChanges(flags), + }; +} + +function getFileType(flags) { + if (events.ItemIsFile & flags) return "file"; + if (events.ItemIsDir & flags) return "directory"; + if (events.ItemIsSymlink & flags) return "symlink"; +} +function anyIsTrue(obj) { + for (let key in obj) { + if (obj[key]) return true; + } + return false; +} +function getEventType(flags) { + if (events.ItemRemoved & flags) return "deleted"; + if (events.ItemRenamed & flags) return "moved"; + if (events.ItemCreated & flags) return "created"; + if (events.ItemModified & flags) return "modified"; + if (events.RootChanged & flags) return "root-changed"; + if (events.ItemCloned & flags) return "cloned"; + if (anyIsTrue(flags)) return "modified"; + return "unknown"; +} +function getFileChanges(flags) { + return { + inode: !!(events.ItemInodeMetaMod & flags), + finder: !!(events.ItemFinderInfoMod & flags), + access: !!(events.ItemChangeOwner & flags), + xattrs: !!(events.ItemXattrMod & flags), + }; +} + +exports.watch = watch; +exports.getInfo = getInfo; +exports.constants = events; diff --git a/frontend/node_modules/fsevents/fsevents.node b/frontend/node_modules/fsevents/fsevents.node new file mode 100755 index 00000000..00fac7e8 Binary files /dev/null and b/frontend/node_modules/fsevents/fsevents.node differ diff --git a/frontend/node_modules/fsevents/package.json b/frontend/node_modules/fsevents/package.json new file mode 100644 index 00000000..af6da84a --- /dev/null +++ b/frontend/node_modules/fsevents/package.json @@ -0,0 +1,62 @@ +{ + "name": "fsevents", + "version": "2.3.2", + "description": "Native Access to MacOS FSEvents", + "main": "fsevents.js", + "types": "fsevents.d.ts", + "os": [ + "darwin" + ], + "files": [ + "fsevents.d.ts", + "fsevents.js", + "fsevents.node" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + }, + "scripts": { + "clean": "node-gyp clean && rm -f fsevents.node", + "build": "node-gyp clean && rm -f fsevents.node && node-gyp rebuild && node-gyp clean", + "test": "/bin/bash ./test.sh 2>/dev/null", + "prepublishOnly": "npm run build" + }, + "repository": { + "type": "git", + "url": "https://github.com/fsevents/fsevents.git" + }, + "keywords": [ + "fsevents", + "mac" + ], + "contributors": [ + { + "name": "Philipp Dunkel", + "email": "pip@pipobscure.com" + }, + { + "name": "Ben Noordhuis", + "email": "info@bnoordhuis.nl" + }, + { + "name": "Elan Shankar", + "email": "elan.shanker@gmail.com" + }, + { + "name": "Miroslav Bajtoš", + "email": "mbajtoss@gmail.com" + }, + { + "name": "Paul Miller", + "url": "https://paulmillr.com" + } + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/fsevents/fsevents/issues" + }, + "homepage": "https://github.com/fsevents/fsevents", + "devDependencies": { + "node-gyp": "^6.1.0" + } +} diff --git a/frontend/node_modules/function-bind/.editorconfig b/frontend/node_modules/function-bind/.editorconfig new file mode 100644 index 00000000..ac29adef --- /dev/null +++ b/frontend/node_modules/function-bind/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +indent_style = tab +indent_size = 4 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 120 + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[*.json] +max_line_length = off + +[Makefile] +max_line_length = off diff --git a/frontend/node_modules/function-bind/.eslintrc b/frontend/node_modules/function-bind/.eslintrc new file mode 100644 index 00000000..9b33d8ed --- /dev/null +++ b/frontend/node_modules/function-bind/.eslintrc @@ -0,0 +1,15 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "func-name-matching": 0, + "indent": [2, 4], + "max-nested-callbacks": [2, 3], + "max-params": [2, 3], + "max-statements": [2, 20], + "no-new-func": [1], + "strict": [0] + } +} diff --git a/frontend/node_modules/function-bind/.jscs.json b/frontend/node_modules/function-bind/.jscs.json new file mode 100644 index 00000000..8c447948 --- /dev/null +++ b/frontend/node_modules/function-bind/.jscs.json @@ -0,0 +1,176 @@ +{ + "es3": true, + + "additionalRules": [], + + "requireSemicolons": true, + + "disallowMultipleSpaces": true, + + "disallowIdentifierNames": [], + + "requireCurlyBraces": { + "allExcept": [], + "keywords": ["if", "else", "for", "while", "do", "try", "catch"] + }, + + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], + + "disallowSpaceAfterKeywords": [], + + "disallowSpaceBeforeComma": true, + "disallowSpaceAfterComma": false, + "disallowSpaceBeforeSemicolon": true, + + "disallowNodeTypes": [ + "DebuggerStatement", + "ForInStatement", + "LabeledStatement", + "SwitchCase", + "SwitchStatement", + "WithStatement" + ], + + "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, + + "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, + "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, + "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, + "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, + + "requireSpaceBetweenArguments": true, + + "disallowSpacesInsideParentheses": true, + + "disallowSpacesInsideArrayBrackets": true, + + "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, + + "disallowSpaceAfterObjectKeys": true, + + "requireCommaBeforeLineBreak": true, + + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "requireSpaceAfterPrefixUnaryOperators": [], + + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforePostfixUnaryOperators": [], + + "disallowSpaceBeforeBinaryOperators": [], + "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + + "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], + "disallowSpaceAfterBinaryOperators": [], + + "disallowImplicitTypeConversion": ["binary", "string"], + + "disallowKeywords": ["with", "eval"], + + "requireKeywordsOnNewLine": [], + "disallowKeywordsOnNewLine": ["else"], + + "requireLineFeedAtFileEnd": true, + + "disallowTrailingWhitespace": true, + + "disallowTrailingComma": true, + + "excludeFiles": ["node_modules/**", "vendor/**"], + + "disallowMultipleLineStrings": true, + + "requireDotNotation": { "allExcept": ["keywords"] }, + + "requireParenthesesAroundIIFE": true, + + "validateLineBreaks": "LF", + + "validateQuoteMarks": { + "escape": true, + "mark": "'" + }, + + "disallowOperatorBeforeLineBreak": [], + + "requireSpaceBeforeKeywords": [ + "do", + "for", + "if", + "else", + "switch", + "case", + "try", + "catch", + "finally", + "while", + "with", + "return" + ], + + "validateAlignedFunctionParameters": { + "lineBreakAfterOpeningBraces": true, + "lineBreakBeforeClosingBraces": true + }, + + "requirePaddingNewLinesBeforeExport": true, + + "validateNewlineAfterArrayElements": { + "maximum": 8 + }, + + "requirePaddingNewLinesAfterUseStrict": true, + + "disallowArrowFunctions": true, + + "disallowMultiLineTernary": true, + + "validateOrderInObjectKeys": "asc-insensitive", + + "disallowIdenticalDestructuringNames": true, + + "disallowNestedTernaries": { "maxLevel": 1 }, + + "requireSpaceAfterComma": { "allExcept": ["trailing"] }, + "requireAlignedMultilineParams": false, + + "requireSpacesInGenerator": { + "afterStar": true + }, + + "disallowSpacesInGenerator": { + "beforeStar": true + }, + + "disallowVar": false, + + "requireArrayDestructuring": false, + + "requireEnhancedObjectLiterals": false, + + "requireObjectDestructuring": false, + + "requireEarlyReturn": false, + + "requireCapitalizedConstructorsNew": { + "allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] + }, + + "requireImportAlphabetized": false, + + "requireSpaceBeforeObjectValues": true, + "requireSpaceBeforeDestructuredValues": true, + + "disallowSpacesInsideTemplateStringPlaceholders": true, + + "disallowArrayDestructuringReturn": false, + + "requireNewlineBeforeSingleStatementsInIf": false, + + "disallowUnusedVariables": true, + + "requireSpacesInsideImportedObjectBraces": true, + + "requireUseStrict": true +} + diff --git a/frontend/node_modules/function-bind/.npmignore b/frontend/node_modules/function-bind/.npmignore new file mode 100644 index 00000000..dbb555fd --- /dev/null +++ b/frontend/node_modules/function-bind/.npmignore @@ -0,0 +1,22 @@ +# gitignore +.DS_Store +.monitor +.*.swp +.nodemonignore +releases +*.log +*.err +fleet.json +public/browserify +bin/*.json +.bin +build +compile +.lock-wscript +coverage +node_modules + +# Only apps should have lockfiles +npm-shrinkwrap.json +package-lock.json +yarn.lock diff --git a/frontend/node_modules/function-bind/.travis.yml b/frontend/node_modules/function-bind/.travis.yml new file mode 100644 index 00000000..85f70d24 --- /dev/null +++ b/frontend/node_modules/function-bind/.travis.yml @@ -0,0 +1,168 @@ +language: node_js +os: + - linux +node_js: + - "8.4" + - "7.10" + - "6.11" + - "5.12" + - "4.8" + - "iojs-v3.3" + - "iojs-v2.5" + - "iojs-v1.8" + - "0.12" + - "0.10" + - "0.8" +before_install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then npm install -g npm@1.3 ; elif [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' + - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then if [ "${TRAVIS_NODE_VERSION%${TRAVIS_NODE_VERSION#[0-9]}}" = "0" ] || [ "${TRAVIS_NODE_VERSION:0:4}" = "iojs" ]; then npm install -g npm@4.5 ; else npm install -g npm; fi; fi' +install: + - 'if [ "${TRAVIS_NODE_VERSION}" = "0.6" ]; then nvm install 0.8 && npm install -g npm@1.3 && npm install -g npm@1.4.28 && npm install -g npm@2 && npm install && nvm use "${TRAVIS_NODE_VERSION}"; else npm install; fi;' +script: + - 'if [ -n "${PRETEST-}" ]; then npm run pretest ; fi' + - 'if [ -n "${POSTTEST-}" ]; then npm run posttest ; fi' + - 'if [ -n "${COVERAGE-}" ]; then npm run coverage ; fi' + - 'if [ -n "${TEST-}" ]; then npm run tests-only ; fi' +sudo: false +env: + - TEST=true +matrix: + fast_finish: true + include: + - node_js: "node" + env: PRETEST=true + - node_js: "4" + env: COVERAGE=true + - node_js: "8.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "8.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "7.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "6.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.10" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.8" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "5.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "4.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v3.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v2.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.7" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.5" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.4" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.3" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.2" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.1" + env: TEST=true ALLOW_FAILURE=true + - node_js: "iojs-v1.0" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.11" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.9" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.6" + env: TEST=true ALLOW_FAILURE=true + - node_js: "0.4" + env: TEST=true ALLOW_FAILURE=true + allow_failures: + - os: osx + - env: TEST=true ALLOW_FAILURE=true diff --git a/frontend/node_modules/function-bind/LICENSE b/frontend/node_modules/function-bind/LICENSE new file mode 100644 index 00000000..62d6d237 --- /dev/null +++ b/frontend/node_modules/function-bind/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/frontend/node_modules/function-bind/README.md b/frontend/node_modules/function-bind/README.md new file mode 100644 index 00000000..81862a02 --- /dev/null +++ b/frontend/node_modules/function-bind/README.md @@ -0,0 +1,48 @@ +# function-bind + + + + + +Implementation of function.prototype.bind + +## Example + +I mainly do this for unit tests I run on phantomjs. +PhantomJS does not have Function.prototype.bind :( + +```js +Function.prototype.bind = require("function-bind") +``` + +## Installation + +`npm install function-bind` + +## Contributors + + - Raynos + +## MIT Licenced + + [travis-svg]: https://travis-ci.org/Raynos/function-bind.svg + [travis-url]: https://travis-ci.org/Raynos/function-bind + [npm-badge-svg]: https://badge.fury.io/js/function-bind.svg + [npm-url]: https://npmjs.org/package/function-bind + [5]: https://coveralls.io/repos/Raynos/function-bind/badge.png + [6]: https://coveralls.io/r/Raynos/function-bind + [7]: https://gemnasium.com/Raynos/function-bind.png + [8]: https://gemnasium.com/Raynos/function-bind + [deps-svg]: https://david-dm.org/Raynos/function-bind.svg + [deps-url]: https://david-dm.org/Raynos/function-bind + [dev-deps-svg]: https://david-dm.org/Raynos/function-bind/dev-status.svg + [dev-deps-url]: https://david-dm.org/Raynos/function-bind#info=devDependencies + [11]: https://ci.testling.com/Raynos/function-bind.png + [12]: https://ci.testling.com/Raynos/function-bind diff --git a/frontend/node_modules/function-bind/implementation.js b/frontend/node_modules/function-bind/implementation.js new file mode 100644 index 00000000..cc4daec1 --- /dev/null +++ b/frontend/node_modules/function-bind/implementation.js @@ -0,0 +1,52 @@ +'use strict'; + +/* eslint no-invalid-this: 1 */ + +var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; +var slice = Array.prototype.slice; +var toStr = Object.prototype.toString; +var funcType = '[object Function]'; + +module.exports = function bind(that) { + var target = this; + if (typeof target !== 'function' || toStr.call(target) !== funcType) { + throw new TypeError(ERROR_MESSAGE + target); + } + var args = slice.call(arguments, 1); + + var bound; + var binder = function () { + if (this instanceof bound) { + var result = target.apply( + this, + args.concat(slice.call(arguments)) + ); + if (Object(result) === result) { + return result; + } + return this; + } else { + return target.apply( + that, + args.concat(slice.call(arguments)) + ); + } + }; + + var boundLength = Math.max(0, target.length - args.length); + var boundArgs = []; + for (var i = 0; i < boundLength; i++) { + boundArgs.push('$' + i); + } + + bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); + + if (target.prototype) { + var Empty = function Empty() {}; + Empty.prototype = target.prototype; + bound.prototype = new Empty(); + Empty.prototype = null; + } + + return bound; +}; diff --git a/frontend/node_modules/function-bind/index.js b/frontend/node_modules/function-bind/index.js new file mode 100644 index 00000000..3bb6b960 --- /dev/null +++ b/frontend/node_modules/function-bind/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var implementation = require('./implementation'); + +module.exports = Function.prototype.bind || implementation; diff --git a/frontend/node_modules/function-bind/package.json b/frontend/node_modules/function-bind/package.json new file mode 100644 index 00000000..20a1727c --- /dev/null +++ b/frontend/node_modules/function-bind/package.json @@ -0,0 +1,63 @@ +{ + "name": "function-bind", + "version": "1.1.1", + "description": "Implementation of Function.prototype.bind", + "keywords": [ + "function", + "bind", + "shim", + "es5" + ], + "author": "Raynos ", + "repository": "git://github.com/Raynos/function-bind.git", + "main": "index", + "homepage": "https://github.com/Raynos/function-bind", + "contributors": [ + { + "name": "Raynos" + }, + { + "name": "Jordan Harband", + "url": "https://github.com/ljharb" + } + ], + "bugs": { + "url": "https://github.com/Raynos/function-bind/issues", + "email": "raynos2@gmail.com" + }, + "dependencies": {}, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "covert": "^1.1.0", + "eslint": "^4.5.0", + "jscs": "^3.0.7", + "tape": "^4.8.0" + }, + "license": "MIT", + "scripts": { + "pretest": "npm run lint", + "test": "npm run tests-only", + "posttest": "npm run coverage -- --quiet", + "tests-only": "node test", + "coverage": "covert test/*.js", + "lint": "npm run jscs && npm run eslint", + "jscs": "jscs *.js */*.js", + "eslint": "eslint *.js */*.js" + }, + "testling": { + "files": "test/index.js", + "browsers": [ + "ie/8..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest", + "android-browser/4.2..latest" + ] + } +} diff --git a/frontend/node_modules/function-bind/test/.eslintrc b/frontend/node_modules/function-bind/test/.eslintrc new file mode 100644 index 00000000..8a56d5b7 --- /dev/null +++ b/frontend/node_modules/function-bind/test/.eslintrc @@ -0,0 +1,9 @@ +{ + "rules": { + "array-bracket-newline": 0, + "array-element-newline": 0, + "max-statements-per-line": [2, { "max": 2 }], + "no-invalid-this": 0, + "no-magic-numbers": 0, + } +} diff --git a/frontend/node_modules/function-bind/test/index.js b/frontend/node_modules/function-bind/test/index.js new file mode 100644 index 00000000..2edecce2 --- /dev/null +++ b/frontend/node_modules/function-bind/test/index.js @@ -0,0 +1,252 @@ +// jscs:disable requireUseStrict + +var test = require('tape'); + +var functionBind = require('../implementation'); +var getCurrentContext = function () { return this; }; + +test('functionBind is a function', function (t) { + t.equal(typeof functionBind, 'function'); + t.end(); +}); + +test('non-functions', function (t) { + var nonFunctions = [true, false, [], {}, 42, 'foo', NaN, /a/g]; + t.plan(nonFunctions.length); + for (var i = 0; i < nonFunctions.length; ++i) { + try { functionBind.call(nonFunctions[i]); } catch (ex) { + t.ok(ex instanceof TypeError, 'throws when given ' + String(nonFunctions[i])); + } + } + t.end(); +}); + +test('without a context', function (t) { + t.test('binds properly', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }) + }; + namespace.func(1, 2, 3); + st.deepEqual(args, [1, 2, 3]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('binds properly, and still supplies bound arguments', function (st) { + var args, context; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, undefined, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.deepEqual(args, [1, 2, 3, 4, 5, 6]); + st.equal(context, getCurrentContext.call()); + st.end(); + }); + + t.test('returns properly', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, null, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, getCurrentContext.call(), 'returned context is namespaced context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('called as a constructor', function (st) { + var thunkify = function (value) { + return function () { return value; }; + }; + st.test('returns object value', function (sst) { + var expectedReturnValue = [1, 2, 3]; + var Constructor = functionBind.call(thunkify(expectedReturnValue), null); + var result = new Constructor(); + sst.equal(result, expectedReturnValue); + sst.end(); + }); + + st.test('does not return primitive value', function (sst) { + var Constructor = functionBind.call(thunkify(42), null); + var result = new Constructor(); + sst.notEqual(result, 42); + sst.end(); + }); + + st.test('object from bound constructor is instance of original and bound constructor', function (sst) { + var A = function (x) { + this.name = x || 'A'; + }; + var B = functionBind.call(A, null, 'B'); + + var result = new B(); + sst.ok(result instanceof B, 'result is instance of bound constructor'); + sst.ok(result instanceof A, 'result is instance of original constructor'); + sst.end(); + }); + + st.end(); + }); + + t.end(); +}); + +test('with a context', function (t) { + t.test('with no bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext) + }; + namespace.func(1, 2, 3); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3], 'supplies passed arguments'); + st.end(); + }); + + t.test('with bound arguments', function (st) { + var args, context; + var boundContext = {}; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + context = this; + }, boundContext, 1, 2, 3) + }; + namespace.func(4, 5, 6); + st.equal(context, boundContext, 'binds a context properly'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'supplies bound and passed arguments'); + st.end(); + }); + + t.test('returns properly', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext) + }; + var context = namespace.func(1, 2, 3); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3], 'passed arguments are correct'); + st.end(); + }); + + t.test('returns properly with bound arguments', function (st) { + var boundContext = {}; + var args; + var namespace = { + func: functionBind.call(function () { + args = Array.prototype.slice.call(arguments); + return this; + }, boundContext, 1, 2, 3) + }; + var context = namespace.func(4, 5, 6); + st.equal(context, boundContext, 'returned context is bound context'); + st.notEqual(context, getCurrentContext.call(), 'returned context is not lexical context'); + st.deepEqual(args, [1, 2, 3, 4, 5, 6], 'passed arguments are correct'); + st.end(); + }); + + t.test('passes the correct arguments when called as a constructor', function (st) { + var expected = { name: 'Correct' }; + var namespace = { + Func: functionBind.call(function (arg) { + return arg; + }, { name: 'Incorrect' }) + }; + var returned = new namespace.Func(expected); + st.equal(returned, expected, 'returns the right arg when called as a constructor'); + st.end(); + }); + + t.test('has the new instance\'s context when called as a constructor', function (st) { + var actualContext; + var expectedContext = { foo: 'bar' }; + var namespace = { + Func: functionBind.call(function () { + actualContext = this; + }, expectedContext) + }; + var result = new namespace.Func(); + st.equal(result instanceof namespace.Func, true); + st.notEqual(actualContext, expectedContext); + st.end(); + }); + + t.end(); +}); + +test('bound function length', function (t) { + t.test('sets a correct length without thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}); + st.equal(subject.length, 3); + st.equal(subject(1, 2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and first argument', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1); + st.equal(subject.length, 2); + st.equal(subject(2, 3), 6); + st.end(); + }); + + t.test('sets a correct length without thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, undefined, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); + + t.test('sets a correct length with thisArg and too many arguments', function (st) { + var subject = functionBind.call(function (a, b, c) { return a + b + c; }, {}, 1, 2, 3, 4); + st.equal(subject.length, 0); + st.equal(subject(), 6); + st.end(); + }); +}); diff --git a/frontend/node_modules/has/LICENSE-MIT b/frontend/node_modules/has/LICENSE-MIT new file mode 100644 index 00000000..ae7014d3 --- /dev/null +++ b/frontend/node_modules/has/LICENSE-MIT @@ -0,0 +1,22 @@ +Copyright (c) 2013 Thiago de Arruda + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/frontend/node_modules/has/README.md b/frontend/node_modules/has/README.md new file mode 100644 index 00000000..635e3a4b --- /dev/null +++ b/frontend/node_modules/has/README.md @@ -0,0 +1,18 @@ +# has + +> Object.prototype.hasOwnProperty.call shortcut + +## Installation + +```sh +npm install --save has +``` + +## Usage + +```js +var has = require('has'); + +has({}, 'hasOwnProperty'); // false +has(Object.prototype, 'hasOwnProperty'); // true +``` diff --git a/frontend/node_modules/has/package.json b/frontend/node_modules/has/package.json new file mode 100644 index 00000000..7c4592f1 --- /dev/null +++ b/frontend/node_modules/has/package.json @@ -0,0 +1,48 @@ +{ + "name": "has", + "description": "Object.prototype.hasOwnProperty.call shortcut", + "version": "1.0.3", + "homepage": "https://github.com/tarruda/has", + "author": { + "name": "Thiago de Arruda", + "email": "tpadilha84@gmail.com" + }, + "contributors": [ + { + "name": "Jordan Harband", + "email": "ljharb@gmail.com", + "url": "http://ljharb.codes" + } + ], + "repository": { + "type": "git", + "url": "git://github.com/tarruda/has.git" + }, + "bugs": { + "url": "https://github.com/tarruda/has/issues" + }, + "license": "MIT", + "licenses": [ + { + "type": "MIT", + "url": "https://github.com/tarruda/has/blob/master/LICENSE-MIT" + } + ], + "main": "./src", + "dependencies": { + "function-bind": "^1.1.1" + }, + "devDependencies": { + "@ljharb/eslint-config": "^12.2.1", + "eslint": "^4.19.1", + "tape": "^4.9.0" + }, + "engines": { + "node": ">= 0.4.0" + }, + "scripts": { + "lint": "eslint .", + "pretest": "npm run lint", + "test": "tape test" + } +} diff --git a/frontend/node_modules/has/src/index.js b/frontend/node_modules/has/src/index.js new file mode 100644 index 00000000..dd92dd90 --- /dev/null +++ b/frontend/node_modules/has/src/index.js @@ -0,0 +1,5 @@ +'use strict'; + +var bind = require('function-bind'); + +module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty); diff --git a/frontend/node_modules/has/test/index.js b/frontend/node_modules/has/test/index.js new file mode 100644 index 00000000..43d480b2 --- /dev/null +++ b/frontend/node_modules/has/test/index.js @@ -0,0 +1,10 @@ +'use strict'; + +var test = require('tape'); +var has = require('../'); + +test('has', function (t) { + t.equal(has({}, 'hasOwnProperty'), false, 'object literal does not have own property "hasOwnProperty"'); + t.equal(has(Object.prototype, 'hasOwnProperty'), true, 'Object.prototype has own property "hasOwnProperty"'); + t.end(); +}); diff --git a/frontend/node_modules/is-core-module/.eslintrc b/frontend/node_modules/is-core-module/.eslintrc new file mode 100644 index 00000000..f2e07268 --- /dev/null +++ b/frontend/node_modules/is-core-module/.eslintrc @@ -0,0 +1,18 @@ +{ + "extends": "@ljharb", + "root": true, + "rules": { + "func-style": 1, + }, + "overrides": [ + { + "files": "test/**", + "rules": { + "global-require": 0, + "max-depth": 0, + "max-lines-per-function": 0, + "no-negated-condition": 0, + }, + }, + ], +} diff --git a/frontend/node_modules/is-core-module/.nycrc b/frontend/node_modules/is-core-module/.nycrc new file mode 100644 index 00000000..bdd626ce --- /dev/null +++ b/frontend/node_modules/is-core-module/.nycrc @@ -0,0 +1,9 @@ +{ + "all": true, + "check-coverage": false, + "reporter": ["text-summary", "text", "html", "json"], + "exclude": [ + "coverage", + "test" + ] +} diff --git a/frontend/node_modules/is-core-module/CHANGELOG.md b/frontend/node_modules/is-core-module/CHANGELOG.md new file mode 100644 index 00000000..1f4d1d6a --- /dev/null +++ b/frontend/node_modules/is-core-module/CHANGELOG.md @@ -0,0 +1,136 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.9.0](https://github.com/inspect-js/is-core-module/compare/v2.8.1...v2.9.0) - 2022-04-19 + +### Commits + +- [New] add `node:test`, in node 18+ [`f853eca`](https://github.com/inspect-js/is-core-module/commit/f853eca801d0a7d4e1dbb670f1b6d9837d9533c5) +- [Tests] use `mock-property` [`03b3644`](https://github.com/inspect-js/is-core-module/commit/03b3644dff4417f4ba5a7d0aa0138f5f6b3e5c46) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`7c0e2d0`](https://github.com/inspect-js/is-core-module/commit/7c0e2d06ed2a89acf53abe2ab34d703ed5b03455) +- [meta] simplify "exports" [`d6ed201`](https://github.com/inspect-js/is-core-module/commit/d6ed201eba7fbba0e59814a9050fc49a6e9878c8) + +## [v2.8.1](https://github.com/inspect-js/is-core-module/compare/v2.8.0...v2.8.1) - 2022-01-05 + +### Commits + +- [actions] reuse common workflows [`cd2cf9b`](https://github.com/inspect-js/is-core-module/commit/cd2cf9b3b66c8d328f65610efe41e9325db7716d) +- [Fix] update node 0.4 results [`062195d`](https://github.com/inspect-js/is-core-module/commit/062195d89f0876a88b95d378b43f7fcc1205bc5b) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`0790b62`](https://github.com/inspect-js/is-core-module/commit/0790b6222848c6167132f9f73acc3520fa8d1298) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape` [`7d139a6`](https://github.com/inspect-js/is-core-module/commit/7d139a6d767709eabf0a0251e074ec1fb230c06e) +- [Tests] run `nyc` in `tests-only`, not `test` [`780e8a0`](https://github.com/inspect-js/is-core-module/commit/780e8a049951c71cf78b1707f0871c48a28bde14) + +## [v2.8.0](https://github.com/inspect-js/is-core-module/compare/v2.7.0...v2.8.0) - 2021-10-14 + +### Commits + +- [actions] update codecov uploader [`0cfe94e`](https://github.com/inspect-js/is-core-module/commit/0cfe94e106a7d005ea03e008c0a21dec13a77904) +- [New] add `readline/promises` to node v17+ [`4f78c30`](https://github.com/inspect-js/is-core-module/commit/4f78c3008b1b58b4db6dc91d99610b1bc859da7e) +- [Tests] node ^14.18 supports `node:` prefixes for CJS [`43e2f17`](https://github.com/inspect-js/is-core-module/commit/43e2f177452cea2f0eaf34f61b5407217bbdb6f4) + +## [v2.7.0](https://github.com/inspect-js/is-core-module/compare/v2.6.0...v2.7.0) - 2021-09-27 + +### Commits + +- [New] node `v14.18` added `node:`-prefixed core modules to `require` [`6d943ab`](https://github.com/inspect-js/is-core-module/commit/6d943abe81382b9bbe344384d80fbfebe1cc0526) +- [Tests] add coverage for Object.prototype pollution [`c6baf5f`](https://github.com/inspect-js/is-core-module/commit/c6baf5f942311a1945c1af41167bb80b84df2af7) +- [Dev Deps] update `@ljharb/eslint-config` [`6717f00`](https://github.com/inspect-js/is-core-module/commit/6717f000d063ea57beb772bded36c2f056ac404c) +- [eslint] fix linter warning [`594c10b`](https://github.com/inspect-js/is-core-module/commit/594c10bb7d39d7eb00925c90924199ff596184b2) +- [meta] add `sideEffects` flag [`c32cfa5`](https://github.com/inspect-js/is-core-module/commit/c32cfa5195632944c4dd4284a142b8476e75be13) + +## [v2.6.0](https://github.com/inspect-js/is-core-module/compare/v2.5.0...v2.6.0) - 2021-08-17 + +### Commits + +- [Dev Deps] update `eslint`, `tape` [`6cc928f`](https://github.com/inspect-js/is-core-module/commit/6cc928f8a4bba66aeeccc4f6beeac736d4bd3081) +- [New] add `stream/consumers` to node `>= 16.7` [`a1a423e`](https://github.com/inspect-js/is-core-module/commit/a1a423e467e4cc27df180234fad5bab45943e67d) +- [Refactor] Remove duplicated `&&` operand [`86faea7`](https://github.com/inspect-js/is-core-module/commit/86faea738213a2433c62d1098488dc9314dca832) +- [Tests] include prereleases [`a4da7a6`](https://github.com/inspect-js/is-core-module/commit/a4da7a6abf7568e2aa4fd98e69452179f1850963) + +## [v2.5.0](https://github.com/inspect-js/is-core-module/compare/v2.4.0...v2.5.0) - 2021-07-12 + +### Commits + +- [Dev Deps] update `auto-changelog`, `eslint` [`6334cc9`](https://github.com/inspect-js/is-core-module/commit/6334cc94f3af7469685bd8f236740991baaf2705) +- [New] add `stream/web` to node v16.5+ [`17ac59b`](https://github.com/inspect-js/is-core-module/commit/17ac59b662d63e220a2e5728625f005c24f177b2) + +## [v2.4.0](https://github.com/inspect-js/is-core-module/compare/v2.3.0...v2.4.0) - 2021-05-09 + +### Commits + +- [readme] add actions and codecov badges [`82b7faa`](https://github.com/inspect-js/is-core-module/commit/82b7faa12b56dbe47fbea67e1a5b9e447027ba40) +- [Dev Deps] update `@ljharb/eslint-config`, `aud` [`8096868`](https://github.com/inspect-js/is-core-module/commit/8096868c024a161ccd4d44110b136763e92eace8) +- [Dev Deps] update `eslint` [`6726824`](https://github.com/inspect-js/is-core-module/commit/67268249b88230018c510f6532a8046d7326346f) +- [New] add `diagnostics_channel` to node `^14.17` [`86c6563`](https://github.com/inspect-js/is-core-module/commit/86c65634201b8ff9b3e48a9a782594579c7f5c3c) +- [meta] fix prepublish script [`697a01e`](https://github.com/inspect-js/is-core-module/commit/697a01e3c9c0be074066520954f30fb28532ec57) + +## [v2.3.0](https://github.com/inspect-js/is-core-module/compare/v2.2.0...v2.3.0) - 2021-04-24 + +### Commits + +- [meta] do not publish github action workflow files [`060d4bb`](https://github.com/inspect-js/is-core-module/commit/060d4bb971a29451c19ff336eb56bee27f9fa95a) +- [New] add support for `node:` prefix, in node 16+ [`7341223`](https://github.com/inspect-js/is-core-module/commit/73412230a769f6e81c05eea50b6520cebf54ed2f) +- [actions] use `node/install` instead of `node/run`; use `codecov` action [`016269a`](https://github.com/inspect-js/is-core-module/commit/016269abae9f6657a5254adfbb813f09a05067f9) +- [patch] remove unneeded `.0` in version ranges [`cb466a6`](https://github.com/inspect-js/is-core-module/commit/cb466a6d89e52b8389e5c12715efcd550c41cea3) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`c9f9c39`](https://github.com/inspect-js/is-core-module/commit/c9f9c396ace60ef81906f98059c064e6452473ed) +- [actions] update workflows [`3ee4a89`](https://github.com/inspect-js/is-core-module/commit/3ee4a89fd5a02fccd43882d905448ea6a98e9a3c) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`dee4fed`](https://github.com/inspect-js/is-core-module/commit/dee4fed79690c1d43a22f7fa9426abebdc6d727f) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`7d046ba`](https://github.com/inspect-js/is-core-module/commit/7d046ba07ae8c9292e43652694ca808d7b309de8) +- [meta] use `prepublishOnly` script for npm 7+ [`149e677`](https://github.com/inspect-js/is-core-module/commit/149e6771a5ede6d097e71785b467a9c4b4977cc7) +- [readme] remove travis badge [`903b51d`](https://github.com/inspect-js/is-core-module/commit/903b51d6b69b98abeabfbc3695c345b02646f19c) + +## [v2.2.0](https://github.com/inspect-js/is-core-module/compare/v2.1.0...v2.2.0) - 2020-11-26 + +### Commits + +- [Tests] migrate tests to Github Actions [`c919f57`](https://github.com/inspect-js/is-core-module/commit/c919f573c0a92d10a0acad0b650b5aecb033d426) +- [patch] `core.json`: %s/ /\t/g [`db3f685`](https://github.com/inspect-js/is-core-module/commit/db3f68581f53e73cc09cd675955eb1bdd6a5a39b) +- [Tests] run `nyc` on all tests [`b2f925f`](https://github.com/inspect-js/is-core-module/commit/b2f925f8866f210ef441f39fcc8cc42692ab89b1) +- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`; add `safe-publish-latest` [`89f02a2`](https://github.com/inspect-js/is-core-module/commit/89f02a2b4162246dea303a6ee31bb9a550b05c72) +- [New] add `path/posix`, `path/win32`, `util/types` [`77f94f1`](https://github.com/inspect-js/is-core-module/commit/77f94f1e90ffd7c0be2a3f1aa8574ebf7fd981b3) + +## [v2.1.0](https://github.com/inspect-js/is-core-module/compare/v2.0.0...v2.1.0) - 2020-11-04 + +### Commits + +- [Dev Deps] update `eslint` [`5e0034e`](https://github.com/inspect-js/is-core-module/commit/5e0034eae57c09c8f1bd769f502486a00f56c6e4) +- [New] Add `diagnostics_channel` [`c2d83d0`](https://github.com/inspect-js/is-core-module/commit/c2d83d0a0225a1a658945d9bab7036ea347d29ec) + +## [v2.0.0](https://github.com/inspect-js/is-core-module/compare/v1.0.2...v2.0.0) - 2020-09-29 + +### Commits + +- v2 implementation [`865aeb5`](https://github.com/inspect-js/is-core-module/commit/865aeb5ca0e90248a3dfff5d7622e4751fdeb9cd) +- Only apps should have lockfiles [`5a5e660`](https://github.com/inspect-js/is-core-module/commit/5a5e660d568e37eb44e17fb1ebb12a105205fc2b) +- Initial commit for v2 [`5a51524`](https://github.com/inspect-js/is-core-module/commit/5a51524e06f92adece5fbb138c69b7b9748a2348) +- Tests [`116eae4`](https://github.com/inspect-js/is-core-module/commit/116eae4fccd01bc72c1fd3cc4b7561c387afc496) +- [meta] add `auto-changelog` [`c24388b`](https://github.com/inspect-js/is-core-module/commit/c24388bee828d223040519d1f5b226ca35beee63) +- [actions] add "Automatic Rebase" and "require allow edits" actions [`34292db`](https://github.com/inspect-js/is-core-module/commit/34292dbcbadae0868aff03c22dbd8b7b8a11558a) +- [Tests] add `npm run lint` [`4f9eeee`](https://github.com/inspect-js/is-core-module/commit/4f9eeee7ddff10698bbf528620f4dc8d4fa3e697) +- [readme] fix travis badges, https all URLs [`e516a73`](https://github.com/inspect-js/is-core-module/commit/e516a73b0dccce20938c432b1ba512eae8eff9e9) +- [meta] create FUNDING.yml [`1aabebc`](https://github.com/inspect-js/is-core-module/commit/1aabebca98d01f8a04e46bc2e2520fa93cf21ac6) +- [Fix] `domain`: domain landed sometime > v0.7.7 and <= v0.7.12 [`2df7d37`](https://github.com/inspect-js/is-core-module/commit/2df7d37595d41b15eeada732b706b926c2771655) +- [Fix] `sys`: worked in 0.6, not 0.7, and 0.8+ [`a75c134`](https://github.com/inspect-js/is-core-module/commit/a75c134229e1e9441801f6b73f6a52489346eb65) + +## [v1.0.2](https://github.com/inspect-js/is-core-module/compare/v1.0.1...v1.0.2) - 2014-09-28 + +### Commits + +- simpler [`66fe90f`](https://github.com/inspect-js/is-core-module/commit/66fe90f9771581b9adc0c3900baa52c21b5baea2) + +## [v1.0.1](https://github.com/inspect-js/is-core-module/compare/v1.0.0...v1.0.1) - 2014-09-28 + +### Commits + +- remove stupid [`f21f906`](https://github.com/inspect-js/is-core-module/commit/f21f906f882c2bd656a5fc5ed6fbe48ddaffb2ac) +- update readme [`1eff0ec`](https://github.com/inspect-js/is-core-module/commit/1eff0ec69798d1ec65771552d1562911e90a8027) + +## v1.0.0 - 2014-09-28 + +### Commits + +- init [`48e5e76`](https://github.com/inspect-js/is-core-module/commit/48e5e76cac378fddb8c1f7d4055b8dfc943d6b96) diff --git a/frontend/node_modules/is-core-module/LICENSE b/frontend/node_modules/is-core-module/LICENSE new file mode 100644 index 00000000..2e502872 --- /dev/null +++ b/frontend/node_modules/is-core-module/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Dave Justice + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/frontend/node_modules/is-core-module/README.md b/frontend/node_modules/is-core-module/README.md new file mode 100644 index 00000000..062d9068 --- /dev/null +++ b/frontend/node_modules/is-core-module/README.md @@ -0,0 +1,40 @@ +# is-core-module [![Version Badge][2]][1] + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +Is this specifier a node.js core module? Optionally provide a node version to check; defaults to the current node version. + +## Example + +```js +var isCore = require('is-core-module'); +var assert = require('assert'); +assert(isCore('fs')); +assert(!isCore('butts')); +``` + +## Tests +Clone the repo, `npm install`, and run `npm test` + +[1]: https://npmjs.org/package/is-core-module +[2]: https://versionbadg.es/inspect-js/is-core-module.svg +[5]: https://david-dm.org/inspect-js/is-core-module.svg +[6]: https://david-dm.org/inspect-js/is-core-module +[7]: https://david-dm.org/inspect-js/is-core-module/dev-status.svg +[8]: https://david-dm.org/inspect-js/is-core-module#info=devDependencies +[11]: https://nodei.co/npm/is-core-module.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/is-core-module.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/is-core-module.svg +[downloads-url]: https://npm-stat.com/charts.html?package=is-core-module +[codecov-image]: https://codecov.io/gh/inspect-js/is-core-module/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/inspect-js/is-core-module/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/is-core-module +[actions-url]: https://github.com/inspect-js/is-core-module/actions diff --git a/frontend/node_modules/is-core-module/core.json b/frontend/node_modules/is-core-module/core.json new file mode 100644 index 00000000..058584b7 --- /dev/null +++ b/frontend/node_modules/is-core-module/core.json @@ -0,0 +1,153 @@ +{ + "assert": true, + "node:assert": [">= 14.18 && < 15", ">= 16"], + "assert/strict": ">= 15", + "node:assert/strict": ">= 16", + "async_hooks": ">= 8", + "node:async_hooks": [">= 14.18 && < 15", ">= 16"], + "buffer_ieee754": ">= 0.5 && < 0.9.7", + "buffer": true, + "node:buffer": [">= 14.18 && < 15", ">= 16"], + "child_process": true, + "node:child_process": [">= 14.18 && < 15", ">= 16"], + "cluster": ">= 0.5", + "node:cluster": [">= 14.18 && < 15", ">= 16"], + "console": true, + "node:console": [">= 14.18 && < 15", ">= 16"], + "constants": true, + "node:constants": [">= 14.18 && < 15", ">= 16"], + "crypto": true, + "node:crypto": [">= 14.18 && < 15", ">= 16"], + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "node:dgram": [">= 14.18 && < 15", ">= 16"], + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], + "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"], + "dns": true, + "node:dns": [">= 14.18 && < 15", ">= 16"], + "dns/promises": ">= 15", + "node:dns/promises": ">= 16", + "domain": ">= 0.7.12", + "node:domain": [">= 14.18 && < 15", ">= 16"], + "events": true, + "node:events": [">= 14.18 && < 15", ">= 16"], + "freelist": "< 6", + "fs": true, + "node:fs": [">= 14.18 && < 15", ">= 16"], + "fs/promises": [">= 10 && < 10.1", ">= 14"], + "node:fs/promises": [">= 14.18 && < 15", ">= 16"], + "_http_agent": ">= 0.11.1", + "node:_http_agent": [">= 14.18 && < 15", ">= 16"], + "_http_client": ">= 0.11.1", + "node:_http_client": [">= 14.18 && < 15", ">= 16"], + "_http_common": ">= 0.11.1", + "node:_http_common": [">= 14.18 && < 15", ">= 16"], + "_http_incoming": ">= 0.11.1", + "node:_http_incoming": [">= 14.18 && < 15", ">= 16"], + "_http_outgoing": ">= 0.11.1", + "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"], + "_http_server": ">= 0.11.1", + "node:_http_server": [">= 14.18 && < 15", ">= 16"], + "http": true, + "node:http": [">= 14.18 && < 15", ">= 16"], + "http2": ">= 8.8", + "node:http2": [">= 14.18 && < 15", ">= 16"], + "https": true, + "node:https": [">= 14.18 && < 15", ">= 16"], + "inspector": ">= 8", + "node:inspector": [">= 14.18 && < 15", ">= 16"], + "_linklist": "< 8", + "module": true, + "node:module": [">= 14.18 && < 15", ">= 16"], + "net": true, + "node:net": [">= 14.18 && < 15", ">= 16"], + "node-inspect/lib/_inspect": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", + "os": true, + "node:os": [">= 14.18 && < 15", ">= 16"], + "path": true, + "node:path": [">= 14.18 && < 15", ">= 16"], + "path/posix": ">= 15.3", + "node:path/posix": ">= 16", + "path/win32": ">= 15.3", + "node:path/win32": ">= 16", + "perf_hooks": ">= 8.5", + "node:perf_hooks": [">= 14.18 && < 15", ">= 16"], + "process": ">= 1", + "node:process": [">= 14.18 && < 15", ">= 16"], + "punycode": ">= 0.5", + "node:punycode": [">= 14.18 && < 15", ">= 16"], + "querystring": true, + "node:querystring": [">= 14.18 && < 15", ">= 16"], + "readline": true, + "node:readline": [">= 14.18 && < 15", ">= 16"], + "readline/promises": ">= 17", + "node:readline/promises": ">= 17", + "repl": true, + "node:repl": [">= 14.18 && < 15", ">= 16"], + "smalloc": ">= 0.11.5 && < 3", + "_stream_duplex": ">= 0.9.4", + "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"], + "_stream_transform": ">= 0.9.4", + "node:_stream_transform": [">= 14.18 && < 15", ">= 16"], + "_stream_wrap": ">= 1.4.1", + "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"], + "_stream_passthrough": ">= 0.9.4", + "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"], + "_stream_readable": ">= 0.9.4", + "node:_stream_readable": [">= 14.18 && < 15", ">= 16"], + "_stream_writable": ">= 0.9.4", + "node:_stream_writable": [">= 14.18 && < 15", ">= 16"], + "stream": true, + "node:stream": [">= 14.18 && < 15", ">= 16"], + "stream/consumers": ">= 16.7", + "node:stream/consumers": ">= 16.7", + "stream/promises": ">= 15", + "node:stream/promises": ">= 16", + "stream/web": ">= 16.5", + "node:stream/web": ">= 16.5", + "string_decoder": true, + "node:string_decoder": [">= 14.18 && < 15", ">= 16"], + "sys": [">= 0.4 && < 0.7", ">= 0.8"], + "node:sys": [">= 14.18 && < 15", ">= 16"], + "node:test": ">= 18", + "timers": true, + "node:timers": [">= 14.18 && < 15", ">= 16"], + "timers/promises": ">= 15", + "node:timers/promises": ">= 16", + "_tls_common": ">= 0.11.13", + "node:_tls_common": [">= 14.18 && < 15", ">= 16"], + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"], + "tls": true, + "node:tls": [">= 14.18 && < 15", ">= 16"], + "trace_events": ">= 10", + "node:trace_events": [">= 14.18 && < 15", ">= 16"], + "tty": true, + "node:tty": [">= 14.18 && < 15", ">= 16"], + "url": true, + "node:url": [">= 14.18 && < 15", ">= 16"], + "util": true, + "node:util": [">= 14.18 && < 15", ">= 16"], + "util/types": ">= 15.3", + "node:util/types": ">= 16", + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8": ">= 1", + "node:v8": [">= 14.18 && < 15", ">= 16"], + "vm": true, + "node:vm": [">= 14.18 && < 15", ">= 16"], + "wasi": ">= 13.4 && < 13.5", + "worker_threads": ">= 11.7", + "node:worker_threads": [">= 14.18 && < 15", ">= 16"], + "zlib": ">= 0.5", + "node:zlib": [">= 14.18 && < 15", ">= 16"] +} diff --git a/frontend/node_modules/is-core-module/index.js b/frontend/node_modules/is-core-module/index.js new file mode 100644 index 00000000..f9637e0e --- /dev/null +++ b/frontend/node_modules/is-core-module/index.js @@ -0,0 +1,69 @@ +'use strict'; + +var has = require('has'); + +function specifierIncluded(current, specifier) { + var nodeParts = current.split('.'); + var parts = specifier.split(' '); + var op = parts.length > 1 ? parts[0] : '='; + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); + + for (var i = 0; i < 3; ++i) { + var cur = parseInt(nodeParts[i] || 0, 10); + var ver = parseInt(versionParts[i] || 0, 10); + if (cur === ver) { + continue; // eslint-disable-line no-restricted-syntax, no-continue + } + if (op === '<') { + return cur < ver; + } + if (op === '>=') { + return cur >= ver; + } + return false; + } + return op === '>='; +} + +function matchesRange(current, range) { + var specifiers = range.split(/ ?&& ?/); + if (specifiers.length === 0) { + return false; + } + for (var i = 0; i < specifiers.length; ++i) { + if (!specifierIncluded(current, specifiers[i])) { + return false; + } + } + return true; +} + +function versionIncluded(nodeVersion, specifierValue) { + if (typeof specifierValue === 'boolean') { + return specifierValue; + } + + var current = typeof nodeVersion === 'undefined' + ? process.versions && process.versions.node + : nodeVersion; + + if (typeof current !== 'string') { + throw new TypeError(typeof nodeVersion === 'undefined' ? 'Unable to determine current node version' : 'If provided, a valid node version is required'); + } + + if (specifierValue && typeof specifierValue === 'object') { + for (var i = 0; i < specifierValue.length; ++i) { + if (matchesRange(current, specifierValue[i])) { + return true; + } + } + return false; + } + return matchesRange(current, specifierValue); +} + +var data = require('./core.json'); + +module.exports = function isCore(x, nodeVersion) { + return has(data, x) && versionIncluded(nodeVersion, data[x]); +}; diff --git a/frontend/node_modules/is-core-module/package.json b/frontend/node_modules/is-core-module/package.json new file mode 100644 index 00000000..80ce9f5b --- /dev/null +++ b/frontend/node_modules/is-core-module/package.json @@ -0,0 +1,65 @@ +{ + "name": "is-core-module", + "version": "2.9.0", + "description": "Is this specifier a node.js core module?", + "main": "index.js", + "sideEffects": false, + "exports": { + ".": "./index.js", + "./package.json": "./package.json" + }, + "scripts": { + "prepublish": "not-in-publish || npm run prepublishOnly", + "prepublishOnly": "safe-publish-latest", + "lint": "eslint .", + "pretest": "npm run lint", + "tests-only": "nyc tape 'test/**/*.js'", + "test": "npm run tests-only", + "posttest": "aud --production", + "version": "auto-changelog && git add CHANGELOG.md", + "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/inspect-js/is-core-module.git" + }, + "keywords": [ + "core", + "modules", + "module", + "npm", + "node", + "dependencies" + ], + "author": "Jordan Harband ", + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/inspect-js/is-core-module/issues" + }, + "homepage": "https://github.com/inspect-js/is-core-module", + "dependencies": { + "has": "^1.0.3" + }, + "devDependencies": { + "@ljharb/eslint-config": "^21.0.0", + "aud": "^2.0.0", + "auto-changelog": "^2.4.0", + "eslint": "=8.8.0", + "mock-property": "^1.0.0", + "nyc": "^10.3.2", + "safe-publish-latest": "^2.0.0", + "semver": "^6.3.0", + "tape": "^5.5.3" + }, + "auto-changelog": { + "output": "CHANGELOG.md", + "template": "keepachangelog", + "unreleased": false, + "commitLimit": false, + "backfillLimit": false, + "hideCredit": true + } +} diff --git a/frontend/node_modules/is-core-module/test/index.js b/frontend/node_modules/is-core-module/test/index.js new file mode 100644 index 00000000..4385b20e --- /dev/null +++ b/frontend/node_modules/is-core-module/test/index.js @@ -0,0 +1,133 @@ +'use strict'; + +var test = require('tape'); +var keys = require('object-keys'); +var semver = require('semver'); +var mockProperty = require('mock-property'); + +var isCore = require('../'); +var data = require('../core.json'); + +var supportsNodePrefix = semver.satisfies(process.versions.node, '^14.18 || >= 16', { includePrerelease: true }); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(isCore('fs')); + st.ok(isCore('net')); + st.ok(isCore('http')); + + st.ok(!isCore('seq')); + st.ok(!isCore('../')); + + st.ok(!isCore('toString')); + + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(data); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + if (isCore(mod)) { + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); + } else { + st['throws'](requireFunc, mod + ' not supported; requiring throws'); + } + } + + st.end(); + }); + + t.test('core via repl module', { skip: !data.repl }, function (st) { + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle + if (!libs) { + st.skip('module.builtinModules does not exist'); + } else { + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + st.ok(data[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + if (mod.slice(0, 5) !== 'node:') { + if (supportsNodePrefix) { + st.doesNotThrow( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' does not throw' + ); + } else { + st['throws']( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' throws' + ); + } + } + } + } + st.end(); + }); + + t.test('core via builtinModules list', { skip: !data.module }, function (st) { + var libs = require('module').builtinModules; + if (!libs) { + st.skip('module.builtinModules does not exist'); + } else { + var excludeList = [ + '_debug_agent', + 'v8/tools/tickprocessor-driver', + 'v8/tools/SourceMap', + 'v8/tools/tickprocessor', + 'v8/tools/profile' + ]; + // see https://github.com/nodejs/node/issues/42785 + if (semver.satisfies(process.version, '>= 18')) { + libs = libs.concat('node:test'); + } + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + if (excludeList.indexOf(mod) === -1) { + st.ok(data[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + if (mod.slice(0, 5) !== 'node:') { + if (supportsNodePrefix) { + st.doesNotThrow( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' does not throw' + ); + } else { + st['throws']( + function () { require('node:' + mod); }, // eslint-disable-line no-loop-func + 'requiring node:' + mod + ' throws' + ); + } + } + } + } + } + st.end(); + }); + + t.test('Object.prototype pollution', function (st) { + var nonKey = 'not a core module'; + st.teardown(mockProperty(Object.prototype, 'fs', { value: false })); + st.teardown(mockProperty(Object.prototype, 'path', { value: '>= 999999999' })); + st.teardown(mockProperty(Object.prototype, 'http', { value: data.http })); + st.teardown(mockProperty(Object.prototype, nonKey, { value: true })); + + st.equal(isCore('fs'), true, 'fs is a core module even if Object.prototype lies'); + st.equal(isCore('path'), true, 'path is a core module even if Object.prototype lies'); + st.equal(isCore('http'), true, 'path is a core module even if Object.prototype matches data'); + st.equal(isCore(nonKey), false, '"' + nonKey + '" is not a core module even if Object.prototype lies'); + + st.end(); + }); + + t.end(); +}); diff --git a/frontend/node_modules/nanoid/LICENSE b/frontend/node_modules/nanoid/LICENSE new file mode 100644 index 00000000..37f56aa4 --- /dev/null +++ b/frontend/node_modules/nanoid/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2017 Andrey Sitnik + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/frontend/node_modules/nanoid/README.md b/frontend/node_modules/nanoid/README.md new file mode 100644 index 00000000..a4abd920 --- /dev/null +++ b/frontend/node_modules/nanoid/README.md @@ -0,0 +1,39 @@ +# Nano ID + +Nano ID logo by Anton Lovchikov + +**English** | [Русский](./README.ru.md) | [简体中文](./README.zh-CN.md) | [Bahasa Indonesia](./README.id-ID.md) + +A tiny, secure, URL-friendly, unique string ID generator for JavaScript. + +> “An amazing level of senseless perfectionism, +> which is simply impossible not to respect.” + +* **Small.** 130 bytes (minified and gzipped). No dependencies. + [Size Limit] controls the size. +* **Fast.** It is 2 times faster than UUID. +* **Safe.** It uses hardware random generator. Can be used in clusters. +* **Short IDs.** It uses a larger alphabet than UUID (`A-Za-z0-9_-`). + So ID size was reduced from 36 to 21 symbols. +* **Portable.** Nano ID was ported + to [20 programming languages](#other-programming-languages). + +```js +import { nanoid } from 'nanoid' +model.id = nanoid() //=> "V1StGXR8_Z5jdHi6B-myT" +``` + +Supports modern browsers, IE [with Babel], Node.js and React Native. + +[online tool]: https://gitpod.io/#https://github.com/ai/nanoid/ +[with Babel]: https://developer.epages.com/blog/coding/how-to-transpile-node-modules-with-babel-and-webpack-in-a-monorepo/ +[Size Limit]: https://github.com/ai/size-limit + + + Sponsored by Evil Martians + + +## Docs +Read **[full docs](https://github.com/ai/nanoid#readme)** on GitHub. diff --git a/frontend/node_modules/nanoid/async/index.browser.cjs b/frontend/node_modules/nanoid/async/index.browser.cjs new file mode 100644 index 00000000..7e5bba83 --- /dev/null +++ b/frontend/node_modules/nanoid/async/index.browser.cjs @@ -0,0 +1,34 @@ +let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes)) +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + return async (size = defaultSize) => { + let id = '' + while (true) { + let bytes = crypto.getRandomValues(new Uint8Array(step)) + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} +let nanoid = async (size = 21) => { + let id = '' + let bytes = crypto.getRandomValues(new Uint8Array(size)) + while (size--) { + let byte = bytes[size] & 63 + if (byte < 36) { + id += byte.toString(36) + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase() + } else if (byte < 63) { + id += '_' + } else { + id += '-' + } + } + return id +} +module.exports = { nanoid, customAlphabet, random } diff --git a/frontend/node_modules/nanoid/async/index.browser.js b/frontend/node_modules/nanoid/async/index.browser.js new file mode 100644 index 00000000..5ece04d6 --- /dev/null +++ b/frontend/node_modules/nanoid/async/index.browser.js @@ -0,0 +1,34 @@ +let random = async bytes => crypto.getRandomValues(new Uint8Array(bytes)) +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + return async (size = defaultSize) => { + let id = '' + while (true) { + let bytes = crypto.getRandomValues(new Uint8Array(step)) + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} +let nanoid = async (size = 21) => { + let id = '' + let bytes = crypto.getRandomValues(new Uint8Array(size)) + while (size--) { + let byte = bytes[size] & 63 + if (byte < 36) { + id += byte.toString(36) + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase() + } else if (byte < 63) { + id += '_' + } else { + id += '-' + } + } + return id +} +export { nanoid, customAlphabet, random } diff --git a/frontend/node_modules/nanoid/async/index.cjs b/frontend/node_modules/nanoid/async/index.cjs new file mode 100644 index 00000000..50db1057 --- /dev/null +++ b/frontend/node_modules/nanoid/async/index.cjs @@ -0,0 +1,35 @@ +let crypto = require('crypto') +let { urlAlphabet } = require('../url-alphabet/index.cjs') +let random = bytes => + new Promise((resolve, reject) => { + crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => { + if (err) { + reject(err) + } else { + resolve(buf) + } + }) + }) +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + return tick(id, size) + }) + return size => tick('', size) +} +let nanoid = (size = 21) => + random(size).then(bytes => { + let id = '' + while (size--) { + id += urlAlphabet[bytes[size] & 63] + } + return id + }) +module.exports = { nanoid, customAlphabet, random } diff --git a/frontend/node_modules/nanoid/async/index.d.ts b/frontend/node_modules/nanoid/async/index.d.ts new file mode 100644 index 00000000..9e919658 --- /dev/null +++ b/frontend/node_modules/nanoid/async/index.d.ts @@ -0,0 +1,56 @@ +/** + * Generate secure URL-friendly unique ID. The non-blocking version. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid/async' + * nanoid().then(id => { + * model.id = id + * }) + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A promise with a random string. + */ +export function nanoid(size?: number): Promise + +/** + * A low-level function. + * Generate secure unique ID with custom alphabet. The non-blocking version. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A function that returns a promise with a random string. + * + * ```js + * import { customAlphabet } from 'nanoid/async' + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * nanoid().then(id => { + * model.id = id //=> "8ё56а" + * }) + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => Promise + +/** + * Generate an array of random bytes collected from hardware noise. + * + * ```js + * import { random } from 'nanoid/async' + * random(5).then(bytes => { + * bytes //=> [10, 67, 212, 67, 89] + * }) + * ``` + * + * @param bytes Size of the array. + * @returns A promise with a random bytes array. + */ +export function random(bytes: number): Promise diff --git a/frontend/node_modules/nanoid/async/index.js b/frontend/node_modules/nanoid/async/index.js new file mode 100644 index 00000000..803fad6f --- /dev/null +++ b/frontend/node_modules/nanoid/async/index.js @@ -0,0 +1,35 @@ +import crypto from 'crypto' +import { urlAlphabet } from '../url-alphabet/index.js' +let random = bytes => + new Promise((resolve, reject) => { + crypto.randomFill(Buffer.allocUnsafe(bytes), (err, buf) => { + if (err) { + reject(err) + } else { + resolve(buf) + } + }) + }) +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + return tick(id, size) + }) + return size => tick('', size) +} +let nanoid = (size = 21) => + random(size).then(bytes => { + let id = '' + while (size--) { + id += urlAlphabet[bytes[size] & 63] + } + return id + }) +export { nanoid, customAlphabet, random } diff --git a/frontend/node_modules/nanoid/async/index.native.js b/frontend/node_modules/nanoid/async/index.native.js new file mode 100644 index 00000000..5cb3d57a --- /dev/null +++ b/frontend/node_modules/nanoid/async/index.native.js @@ -0,0 +1,26 @@ +import { getRandomBytesAsync } from 'expo-random' +import { urlAlphabet } from '../url-alphabet/index.js' +let random = getRandomBytesAsync +let customAlphabet = (alphabet, defaultSize = 21) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + let tick = (id, size = defaultSize) => + random(step).then(bytes => { + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + return tick(id, size) + }) + return size => tick('', size) +} +let nanoid = (size = 21) => + random(size).then(bytes => { + let id = '' + while (size--) { + id += urlAlphabet[bytes[size] & 63] + } + return id + }) +export { nanoid, customAlphabet, random } diff --git a/frontend/node_modules/nanoid/async/package.json b/frontend/node_modules/nanoid/async/package.json new file mode 100644 index 00000000..578cdb4c --- /dev/null +++ b/frontend/node_modules/nanoid/async/package.json @@ -0,0 +1,12 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": { + "./index.js": "./index.native.js" + }, + "browser": { + "./index.js": "./index.browser.js", + "./index.cjs": "./index.browser.cjs" + } +} \ No newline at end of file diff --git a/frontend/node_modules/nanoid/bin/nanoid.cjs b/frontend/node_modules/nanoid/bin/nanoid.cjs new file mode 100755 index 00000000..c76db0fa --- /dev/null +++ b/frontend/node_modules/nanoid/bin/nanoid.cjs @@ -0,0 +1,55 @@ +#!/usr/bin/env node + +let { nanoid, customAlphabet } = require('..') + +function print(msg) { + process.stdout.write(msg + '\n') +} + +function error(msg) { + process.stderr.write(msg + '\n') + process.exit(1) +} + +if (process.argv.includes('--help') || process.argv.includes('-h')) { + print(` + Usage + $ nanoid [options] + + Options + -s, --size Generated ID size + -a, --alphabet Alphabet to use + -h, --help Show this help + + Examples + $ nanoid --s 15 + S9sBF77U6sDB8Yg + + $ nanoid --size 10 --alphabet abc + bcabababca`) + process.exit() +} + +let alphabet, size +for (let i = 2; i < process.argv.length; i++) { + let arg = process.argv[i] + if (arg === '--size' || arg === '-s') { + size = Number(process.argv[i + 1]) + i += 1 + if (Number.isNaN(size) || size <= 0) { + error('Size must be positive integer') + } + } else if (arg === '--alphabet' || arg === '-a') { + alphabet = process.argv[i + 1] + i += 1 + } else { + error('Unknown argument ' + arg) + } +} + +if (alphabet) { + let customNanoid = customAlphabet(alphabet, size) + print(customNanoid()) +} else { + print(nanoid(size)) +} diff --git a/frontend/node_modules/nanoid/index.browser.cjs b/frontend/node_modules/nanoid/index.browser.cjs new file mode 100644 index 00000000..f800d6f4 --- /dev/null +++ b/frontend/node_modules/nanoid/index.browser.cjs @@ -0,0 +1,34 @@ +let { urlAlphabet } = require('./url-alphabet/index.cjs') +let random = bytes => crypto.getRandomValues(new Uint8Array(bytes)) +let customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + return (size = defaultSize) => { + let id = '' + while (true) { + let bytes = getRandom(step) + let j = step + while (j--) { + id += alphabet[bytes[j] & mask] || '' + if (id.length === size) return id + } + } + } +} +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) +let nanoid = (size = 21) => + crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { + byte &= 63 + if (byte < 36) { + id += byte.toString(36) + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase() + } else if (byte > 62) { + id += '-' + } else { + id += '_' + } + return id + }, '') +module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/frontend/node_modules/nanoid/index.browser.js b/frontend/node_modules/nanoid/index.browser.js new file mode 100644 index 00000000..8b3139b0 --- /dev/null +++ b/frontend/node_modules/nanoid/index.browser.js @@ -0,0 +1,34 @@ +import { urlAlphabet } from './url-alphabet/index.js' +let random = bytes => crypto.getRandomValues(new Uint8Array(bytes)) +let customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << (Math.log(alphabet.length - 1) / Math.LN2)) - 1 + let step = -~((1.6 * mask * defaultSize) / alphabet.length) + return (size = defaultSize) => { + let id = '' + while (true) { + let bytes = getRandom(step) + let j = step + while (j--) { + id += alphabet[bytes[j] & mask] || '' + if (id.length === size) return id + } + } + } +} +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) +let nanoid = (size = 21) => + crypto.getRandomValues(new Uint8Array(size)).reduce((id, byte) => { + byte &= 63 + if (byte < 36) { + id += byte.toString(36) + } else if (byte < 62) { + id += (byte - 26).toString(36).toUpperCase() + } else if (byte > 62) { + id += '-' + } else { + id += '_' + } + return id + }, '') +export { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/frontend/node_modules/nanoid/index.cjs b/frontend/node_modules/nanoid/index.cjs new file mode 100644 index 00000000..0fa85e9d --- /dev/null +++ b/frontend/node_modules/nanoid/index.cjs @@ -0,0 +1,45 @@ +let crypto = require('crypto') +let { urlAlphabet } = require('./url-alphabet/index.cjs') +const POOL_SIZE_MULTIPLIER = 128 +let pool, poolOffset +let fillPool = bytes => { + if (!pool || pool.length < bytes) { + pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) + crypto.randomFillSync(pool) + poolOffset = 0 + } else if (poolOffset + bytes > pool.length) { + crypto.randomFillSync(pool) + poolOffset = 0 + } + poolOffset += bytes +} +let random = bytes => { + fillPool((bytes -= 0)) + return pool.subarray(poolOffset - bytes, poolOffset) +} +let customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + return (size = defaultSize) => { + let id = '' + while (true) { + let bytes = getRandom(step) + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) +let nanoid = (size = 21) => { + fillPool((size -= 0)) + let id = '' + for (let i = poolOffset - size; i < poolOffset; i++) { + id += urlAlphabet[pool[i] & 63] + } + return id +} +module.exports = { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/frontend/node_modules/nanoid/index.d.ts b/frontend/node_modules/nanoid/index.d.ts new file mode 100644 index 00000000..3e111a39 --- /dev/null +++ b/frontend/node_modules/nanoid/index.d.ts @@ -0,0 +1,91 @@ +/** + * Generate secure URL-friendly unique ID. + * + * By default, the ID will have 21 symbols to have a collision probability + * similar to UUID v4. + * + * ```js + * import { nanoid } from 'nanoid' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ +export function nanoid(size?: number): string + +/** + * Generate secure unique ID with custom alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A random string generator. + * + * ```js + * const { customAlphabet } = require('nanoid') + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * nanoid() //=> "8ё56а" + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => string + +/** + * Generate unique ID with custom random generator and alphabet. + * + * Alphabet must contain 256 symbols or less. Otherwise, the generator + * will not be secure. + * + * ```js + * import { customRandom } from 'nanoid/format' + * + * const nanoid = customRandom('abcdef', 5, size => { + * const random = [] + * for (let i = 0; i < size; i++) { + * random.push(randomByte()) + * } + * return random + * }) + * + * nanoid() //=> "fbaef" + * ``` + * + * @param alphabet Alphabet used to generate a random string. + * @param size Size of the random string. + * @param random A random bytes generator. + * @returns A random string generator. + */ +export function customRandom( + alphabet: string, + size: number, + random: (bytes: number) => Uint8Array +): () => string + +/** + * URL safe symbols. + * + * ```js + * import { urlAlphabet } from 'nanoid' + * const nanoid = customAlphabet(urlAlphabet, 10) + * nanoid() //=> "Uakgb_J5m9" + * ``` + */ +export const urlAlphabet: string + +/** + * Generate an array of random bytes collected from hardware noise. + * + * ```js + * import { customRandom, random } from 'nanoid' + * const nanoid = customRandom("abcdef", 5, random) + * ``` + * + * @param bytes Size of the array. + * @returns An array of random bytes. + */ +export function random(bytes: number): Uint8Array diff --git a/frontend/node_modules/nanoid/index.js b/frontend/node_modules/nanoid/index.js new file mode 100644 index 00000000..21e155fc --- /dev/null +++ b/frontend/node_modules/nanoid/index.js @@ -0,0 +1,45 @@ +import crypto from 'crypto' +import { urlAlphabet } from './url-alphabet/index.js' +const POOL_SIZE_MULTIPLIER = 128 +let pool, poolOffset +let fillPool = bytes => { + if (!pool || pool.length < bytes) { + pool = Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) + crypto.randomFillSync(pool) + poolOffset = 0 + } else if (poolOffset + bytes > pool.length) { + crypto.randomFillSync(pool) + poolOffset = 0 + } + poolOffset += bytes +} +let random = bytes => { + fillPool((bytes -= 0)) + return pool.subarray(poolOffset - bytes, poolOffset) +} +let customRandom = (alphabet, defaultSize, getRandom) => { + let mask = (2 << (31 - Math.clz32((alphabet.length - 1) | 1))) - 1 + let step = Math.ceil((1.6 * mask * defaultSize) / alphabet.length) + return (size = defaultSize) => { + let id = '' + while (true) { + let bytes = getRandom(step) + let i = step + while (i--) { + id += alphabet[bytes[i] & mask] || '' + if (id.length === size) return id + } + } + } +} +let customAlphabet = (alphabet, size = 21) => + customRandom(alphabet, size, random) +let nanoid = (size = 21) => { + fillPool((size -= 0)) + let id = '' + for (let i = poolOffset - size; i < poolOffset; i++) { + id += urlAlphabet[pool[i] & 63] + } + return id +} +export { nanoid, customAlphabet, customRandom, urlAlphabet, random } diff --git a/frontend/node_modules/nanoid/nanoid.js b/frontend/node_modules/nanoid/nanoid.js new file mode 100644 index 00000000..ec242ead --- /dev/null +++ b/frontend/node_modules/nanoid/nanoid.js @@ -0,0 +1 @@ +export let nanoid=(t=21)=>crypto.getRandomValues(new Uint8Array(t)).reduce(((t,e)=>t+=(e&=63)<36?e.toString(36):e<62?(e-26).toString(36).toUpperCase():e<63?"_":"-"),""); \ No newline at end of file diff --git a/frontend/node_modules/nanoid/non-secure/index.cjs b/frontend/node_modules/nanoid/non-secure/index.cjs new file mode 100644 index 00000000..09d57cdc --- /dev/null +++ b/frontend/node_modules/nanoid/non-secure/index.cjs @@ -0,0 +1,21 @@ +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' +let customAlphabet = (alphabet, defaultSize = 21) => { + return (size = defaultSize) => { + let id = '' + let i = size + while (i--) { + id += alphabet[(Math.random() * alphabet.length) | 0] + } + return id + } +} +let nanoid = (size = 21) => { + let id = '' + let i = size + while (i--) { + id += urlAlphabet[(Math.random() * 64) | 0] + } + return id +} +module.exports = { nanoid, customAlphabet } diff --git a/frontend/node_modules/nanoid/non-secure/index.d.ts b/frontend/node_modules/nanoid/non-secure/index.d.ts new file mode 100644 index 00000000..4965322d --- /dev/null +++ b/frontend/node_modules/nanoid/non-secure/index.d.ts @@ -0,0 +1,33 @@ +/** + * Generate URL-friendly unique ID. This method uses the non-secure + * predictable random generator with bigger collision probability. + * + * ```js + * import { nanoid } from 'nanoid/non-secure' + * model.id = nanoid() //=> "Uakgb_J5m9g-0JDMbcJqL" + * ``` + * + * @param size Size of the ID. The default size is 21. + * @returns A random string. + */ +export function nanoid(size?: number): string + +/** + * Generate a unique ID based on a custom alphabet. + * This method uses the non-secure predictable random generator + * with bigger collision probability. + * + * @param alphabet Alphabet used to generate the ID. + * @param defaultSize Size of the ID. The default size is 21. + * @returns A random string generator. + * + * ```js + * import { customAlphabet } from 'nanoid/non-secure' + * const nanoid = customAlphabet('0123456789абвгдеё', 5) + * model.id = //=> "8ё56а" + * ``` + */ +export function customAlphabet( + alphabet: string, + defaultSize?: number +): (size?: number) => string diff --git a/frontend/node_modules/nanoid/non-secure/index.js b/frontend/node_modules/nanoid/non-secure/index.js new file mode 100644 index 00000000..e7e19adf --- /dev/null +++ b/frontend/node_modules/nanoid/non-secure/index.js @@ -0,0 +1,21 @@ +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' +let customAlphabet = (alphabet, defaultSize = 21) => { + return (size = defaultSize) => { + let id = '' + let i = size + while (i--) { + id += alphabet[(Math.random() * alphabet.length) | 0] + } + return id + } +} +let nanoid = (size = 21) => { + let id = '' + let i = size + while (i--) { + id += urlAlphabet[(Math.random() * 64) | 0] + } + return id +} +export { nanoid, customAlphabet } diff --git a/frontend/node_modules/nanoid/non-secure/package.json b/frontend/node_modules/nanoid/non-secure/package.json new file mode 100644 index 00000000..9930d6ad --- /dev/null +++ b/frontend/node_modules/nanoid/non-secure/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": "index.js" +} \ No newline at end of file diff --git a/frontend/node_modules/nanoid/package.json b/frontend/node_modules/nanoid/package.json new file mode 100644 index 00000000..0812f80b --- /dev/null +++ b/frontend/node_modules/nanoid/package.json @@ -0,0 +1,60 @@ +{ + "name": "nanoid", + "version": "3.3.4", + "description": "A tiny (116 bytes), secure URL-friendly unique string ID generator", + "keywords": [ + "uuid", + "random", + "id", + "url" + ], + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + }, + "author": "Andrey Sitnik ", + "license": "MIT", + "repository": "ai/nanoid", + "browser": { + "./index.js": "./index.browser.js", + "./async/index.js": "./async/index.browser.js", + "./async/index.cjs": "./async/index.browser.cjs", + "./index.cjs": "./index.browser.cjs" + }, + "react-native": "index.js", + "bin": "./bin/nanoid.cjs", + "sideEffects": false, + "types": "./index.d.ts", + "type": "module", + "main": "index.cjs", + "module": "index.js", + "exports": { + ".": { + "types": "./index.d.ts", + "browser": "./index.browser.js", + "require": "./index.cjs", + "import": "./index.js", + "default": "./index.js" + }, + "./index.d.ts": "./index.d.ts", + "./package.json": "./package.json", + "./async/package.json": "./async/package.json", + "./async": { + "browser": "./async/index.browser.js", + "require": "./async/index.cjs", + "import": "./async/index.js", + "default": "./async/index.js" + }, + "./non-secure/package.json": "./non-secure/package.json", + "./non-secure": { + "require": "./non-secure/index.cjs", + "import": "./non-secure/index.js", + "default": "./non-secure/index.js" + }, + "./url-alphabet/package.json": "./url-alphabet/package.json", + "./url-alphabet": { + "require": "./url-alphabet/index.cjs", + "import": "./url-alphabet/index.js", + "default": "./url-alphabet/index.js" + } + } +} \ No newline at end of file diff --git a/frontend/node_modules/nanoid/url-alphabet/index.cjs b/frontend/node_modules/nanoid/url-alphabet/index.cjs new file mode 100644 index 00000000..757b709c --- /dev/null +++ b/frontend/node_modules/nanoid/url-alphabet/index.cjs @@ -0,0 +1,3 @@ +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' +module.exports = { urlAlphabet } diff --git a/frontend/node_modules/nanoid/url-alphabet/index.js b/frontend/node_modules/nanoid/url-alphabet/index.js new file mode 100644 index 00000000..c2782e59 --- /dev/null +++ b/frontend/node_modules/nanoid/url-alphabet/index.js @@ -0,0 +1,3 @@ +let urlAlphabet = + 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict' +export { urlAlphabet } diff --git a/frontend/node_modules/nanoid/url-alphabet/package.json b/frontend/node_modules/nanoid/url-alphabet/package.json new file mode 100644 index 00000000..9930d6ad --- /dev/null +++ b/frontend/node_modules/nanoid/url-alphabet/package.json @@ -0,0 +1,6 @@ +{ + "type": "module", + "main": "index.cjs", + "module": "index.js", + "react-native": "index.js" +} \ No newline at end of file diff --git a/frontend/node_modules/path-parse/LICENSE b/frontend/node_modules/path-parse/LICENSE new file mode 100644 index 00000000..810f3dbe --- /dev/null +++ b/frontend/node_modules/path-parse/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2015 Javier Blanco + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/frontend/node_modules/path-parse/README.md b/frontend/node_modules/path-parse/README.md new file mode 100644 index 00000000..05097f86 --- /dev/null +++ b/frontend/node_modules/path-parse/README.md @@ -0,0 +1,42 @@ +# path-parse [![Build Status](https://travis-ci.org/jbgutierrez/path-parse.svg?branch=master)](https://travis-ci.org/jbgutierrez/path-parse) + +> Node.js [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) [ponyfill](https://ponyfill.com). + +## Install + +``` +$ npm install --save path-parse +``` + +## Usage + +```js +var pathParse = require('path-parse'); + +pathParse('/home/user/dir/file.txt'); +//=> { +// root : "/", +// dir : "/home/user/dir", +// base : "file.txt", +// ext : ".txt", +// name : "file" +// } +``` + +## API + +See [`path.parse(pathString)`](https://nodejs.org/api/path.html#path_path_parse_pathstring) docs. + +### pathParse(path) + +### pathParse.posix(path) + +The Posix specific version. + +### pathParse.win32(path) + +The Windows specific version. + +## License + +MIT © [Javier Blanco](http://jbgutierrez.info) diff --git a/frontend/node_modules/path-parse/index.js b/frontend/node_modules/path-parse/index.js new file mode 100644 index 00000000..f062d0a2 --- /dev/null +++ b/frontend/node_modules/path-parse/index.js @@ -0,0 +1,75 @@ +'use strict'; + +var isWindows = process.platform === 'win32'; + +// Regex to split a windows path into into [dir, root, basename, name, ext] +var splitWindowsRe = + /^(((?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?[\\\/]?)(?:[^\\\/]*[\\\/])*)((\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))[\\\/]*$/; + +var win32 = {}; + +function win32SplitPath(filename) { + return splitWindowsRe.exec(filename).slice(1); +} + +win32.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = win32SplitPath(pathString); + if (!allParts || allParts.length !== 5) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + return { + root: allParts[1], + dir: allParts[0] === allParts[1] ? allParts[0] : allParts[0].slice(0, -1), + base: allParts[2], + ext: allParts[4], + name: allParts[3] + }; +}; + + + +// Split a filename into [dir, root, basename, name, ext], unix version +// 'root' is just a slash, or nothing. +var splitPathRe = + /^((\/?)(?:[^\/]*\/)*)((\.{1,2}|[^\/]+?|)(\.[^.\/]*|))[\/]*$/; +var posix = {}; + + +function posixSplitPath(filename) { + return splitPathRe.exec(filename).slice(1); +} + + +posix.parse = function(pathString) { + if (typeof pathString !== 'string') { + throw new TypeError( + "Parameter 'pathString' must be a string, not " + typeof pathString + ); + } + var allParts = posixSplitPath(pathString); + if (!allParts || allParts.length !== 5) { + throw new TypeError("Invalid path '" + pathString + "'"); + } + + return { + root: allParts[1], + dir: allParts[0].slice(0, -1), + base: allParts[2], + ext: allParts[4], + name: allParts[3], + }; +}; + + +if (isWindows) + module.exports = win32.parse; +else /* posix */ + module.exports = posix.parse; + +module.exports.posix = posix.parse; +module.exports.win32 = win32.parse; diff --git a/frontend/node_modules/path-parse/package.json b/frontend/node_modules/path-parse/package.json new file mode 100644 index 00000000..36c23f84 --- /dev/null +++ b/frontend/node_modules/path-parse/package.json @@ -0,0 +1,33 @@ +{ + "name": "path-parse", + "version": "1.0.7", + "description": "Node.js path.parse() ponyfill", + "main": "index.js", + "scripts": { + "test": "node test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/jbgutierrez/path-parse.git" + }, + "keywords": [ + "path", + "paths", + "file", + "dir", + "parse", + "built-in", + "util", + "utils", + "core", + "ponyfill", + "polyfill", + "shim" + ], + "author": "Javier Blanco ", + "license": "MIT", + "bugs": { + "url": "https://github.com/jbgutierrez/path-parse/issues" + }, + "homepage": "https://github.com/jbgutierrez/path-parse#readme" +} diff --git a/frontend/node_modules/picocolors/LICENSE b/frontend/node_modules/picocolors/LICENSE new file mode 100644 index 00000000..496098c6 --- /dev/null +++ b/frontend/node_modules/picocolors/LICENSE @@ -0,0 +1,15 @@ +ISC License + +Copyright (c) 2021 Alexey Raspopov, Kostiantyn Denysov, Anton Verinov + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/frontend/node_modules/picocolors/README.md b/frontend/node_modules/picocolors/README.md new file mode 100644 index 00000000..8e47aa8e --- /dev/null +++ b/frontend/node_modules/picocolors/README.md @@ -0,0 +1,21 @@ +# picocolors + +The tiniest and the fastest library for terminal output formatting with ANSI colors. + +```javascript +import pc from "picocolors" + +console.log( + pc.green(`How are ${pc.italic(`you`)} doing?`) +) +``` + +- **No dependencies.** +- **14 times** smaller and **2 times** faster than chalk. +- Used by popular tools like PostCSS, SVGO, Stylelint, and Browserslist. +- Node.js v6+ & browsers support. Support for both CJS and ESM projects. +- TypeScript type declarations included. +- [`NO_COLOR`](https://no-color.org/) friendly. + +## Docs +Read **[full docs](https://github.com/alexeyraspopov/picocolors#readme)** on GitHub. diff --git a/frontend/node_modules/picocolors/package.json b/frontend/node_modules/picocolors/package.json new file mode 100644 index 00000000..85a12d52 --- /dev/null +++ b/frontend/node_modules/picocolors/package.json @@ -0,0 +1,25 @@ +{ + "name": "picocolors", + "version": "1.0.0", + "main": "./picocolors.js", + "types": "./picocolors.d.ts", + "browser": { + "./picocolors.js": "./picocolors.browser.js" + }, + "sideEffects": false, + "description": "The tiniest and the fastest library for terminal output formatting with ANSI colors", + "files": [ + "picocolors.*", + "types.ts" + ], + "keywords": [ + "terminal", + "colors", + "formatting", + "cli", + "console" + ], + "author": "Alexey Raspopov", + "repository": "alexeyraspopov/picocolors", + "license": "ISC" +} diff --git a/frontend/node_modules/picocolors/picocolors.browser.js b/frontend/node_modules/picocolors/picocolors.browser.js new file mode 100644 index 00000000..5eb9fbe8 --- /dev/null +++ b/frontend/node_modules/picocolors/picocolors.browser.js @@ -0,0 +1,4 @@ +var x=String; +var create=function() {return {isColorSupported:false,reset:x,bold:x,dim:x,italic:x,underline:x,inverse:x,hidden:x,strikethrough:x,black:x,red:x,green:x,yellow:x,blue:x,magenta:x,cyan:x,white:x,gray:x,bgBlack:x,bgRed:x,bgGreen:x,bgYellow:x,bgBlue:x,bgMagenta:x,bgCyan:x,bgWhite:x}}; +module.exports=create(); +module.exports.createColors = create; diff --git a/frontend/node_modules/picocolors/picocolors.d.ts b/frontend/node_modules/picocolors/picocolors.d.ts new file mode 100644 index 00000000..94e146a8 --- /dev/null +++ b/frontend/node_modules/picocolors/picocolors.d.ts @@ -0,0 +1,5 @@ +import { Colors } from "./types" + +declare const picocolors: Colors & { createColors: (enabled?: boolean) => Colors } + +export = picocolors diff --git a/frontend/node_modules/picocolors/picocolors.js b/frontend/node_modules/picocolors/picocolors.js new file mode 100644 index 00000000..fdb63045 --- /dev/null +++ b/frontend/node_modules/picocolors/picocolors.js @@ -0,0 +1,58 @@ +let tty = require("tty") + +let isColorSupported = + !("NO_COLOR" in process.env || process.argv.includes("--no-color")) && + ("FORCE_COLOR" in process.env || + process.argv.includes("--color") || + process.platform === "win32" || + (tty.isatty(1) && process.env.TERM !== "dumb") || + "CI" in process.env) + +let formatter = + (open, close, replace = open) => + input => { + let string = "" + input + let index = string.indexOf(close, open.length) + return ~index + ? open + replaceClose(string, close, replace, index) + close + : open + string + close + } + +let replaceClose = (string, close, replace, index) => { + let start = string.substring(0, index) + replace + let end = string.substring(index + close.length) + let nextIndex = end.indexOf(close) + return ~nextIndex ? start + replaceClose(end, close, replace, nextIndex) : start + end +} + +let createColors = (enabled = isColorSupported) => ({ + isColorSupported: enabled, + reset: enabled ? s => `\x1b[0m${s}\x1b[0m` : String, + bold: enabled ? formatter("\x1b[1m", "\x1b[22m", "\x1b[22m\x1b[1m") : String, + dim: enabled ? formatter("\x1b[2m", "\x1b[22m", "\x1b[22m\x1b[2m") : String, + italic: enabled ? formatter("\x1b[3m", "\x1b[23m") : String, + underline: enabled ? formatter("\x1b[4m", "\x1b[24m") : String, + inverse: enabled ? formatter("\x1b[7m", "\x1b[27m") : String, + hidden: enabled ? formatter("\x1b[8m", "\x1b[28m") : String, + strikethrough: enabled ? formatter("\x1b[9m", "\x1b[29m") : String, + black: enabled ? formatter("\x1b[30m", "\x1b[39m") : String, + red: enabled ? formatter("\x1b[31m", "\x1b[39m") : String, + green: enabled ? formatter("\x1b[32m", "\x1b[39m") : String, + yellow: enabled ? formatter("\x1b[33m", "\x1b[39m") : String, + blue: enabled ? formatter("\x1b[34m", "\x1b[39m") : String, + magenta: enabled ? formatter("\x1b[35m", "\x1b[39m") : String, + cyan: enabled ? formatter("\x1b[36m", "\x1b[39m") : String, + white: enabled ? formatter("\x1b[37m", "\x1b[39m") : String, + gray: enabled ? formatter("\x1b[90m", "\x1b[39m") : String, + bgBlack: enabled ? formatter("\x1b[40m", "\x1b[49m") : String, + bgRed: enabled ? formatter("\x1b[41m", "\x1b[49m") : String, + bgGreen: enabled ? formatter("\x1b[42m", "\x1b[49m") : String, + bgYellow: enabled ? formatter("\x1b[43m", "\x1b[49m") : String, + bgBlue: enabled ? formatter("\x1b[44m", "\x1b[49m") : String, + bgMagenta: enabled ? formatter("\x1b[45m", "\x1b[49m") : String, + bgCyan: enabled ? formatter("\x1b[46m", "\x1b[49m") : String, + bgWhite: enabled ? formatter("\x1b[47m", "\x1b[49m") : String, +}) + +module.exports = createColors() +module.exports.createColors = createColors diff --git a/frontend/node_modules/picocolors/types.ts b/frontend/node_modules/picocolors/types.ts new file mode 100644 index 00000000..b4bacee4 --- /dev/null +++ b/frontend/node_modules/picocolors/types.ts @@ -0,0 +1,30 @@ +export type Formatter = (input: string | number | null | undefined) => string + +export interface Colors { + isColorSupported: boolean + reset: Formatter + bold: Formatter + dim: Formatter + italic: Formatter + underline: Formatter + inverse: Formatter + hidden: Formatter + strikethrough: Formatter + black: Formatter + red: Formatter + green: Formatter + yellow: Formatter + blue: Formatter + magenta: Formatter + cyan: Formatter + white: Formatter + gray: Formatter + bgBlack: Formatter + bgRed: Formatter + bgGreen: Formatter + bgYellow: Formatter + bgBlue: Formatter + bgMagenta: Formatter + bgCyan: Formatter + bgWhite: Formatter +} diff --git a/frontend/node_modules/postcss/LICENSE b/frontend/node_modules/postcss/LICENSE new file mode 100644 index 00000000..da057b45 --- /dev/null +++ b/frontend/node_modules/postcss/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright 2013 Andrey Sitnik + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/frontend/node_modules/postcss/README.md b/frontend/node_modules/postcss/README.md new file mode 100644 index 00000000..50e5841a --- /dev/null +++ b/frontend/node_modules/postcss/README.md @@ -0,0 +1,44 @@ +# PostCSS [![Gitter][chat-img]][chat] + +Philosopher’s stone, logo of PostCSS + +[chat-img]: https://img.shields.io/badge/Gitter-Join_the_PostCSS_chat-brightgreen.svg +[chat]: https://gitter.im/postcss/postcss + +PostCSS is a tool for transforming styles with JS plugins. +These plugins can lint your CSS, support variables and mixins, +transpile future CSS syntax, inline images, and more. + +PostCSS is used by industry leaders including Wikipedia, Twitter, Alibaba, +and JetBrains. The [Autoprefixer] PostCSS plugin is one of the most popular +CSS processors. + +PostCSS takes a CSS file and provides an API to analyze and modify its rules +(by transforming them into an [Abstract Syntax Tree]). +This API can then be used by [plugins] to do a lot of useful things, +e.g., to find errors automatically, or to insert vendor prefixes. + +**Support / Discussion:** [Gitter](https://gitter.im/postcss/postcss)
+**Twitter account:** [@postcss](https://twitter.com/postcss)
+**VK.com page:** [postcss](https://vk.com/postcss)
+**中文翻译**: [`docs/README-cn.md`](./docs/README-cn.md) + +For PostCSS commercial support (consulting, improving the front-end culture +of your company, PostCSS plugins), contact [Evil Martians] +at . + +[Abstract Syntax Tree]: https://en.wikipedia.org/wiki/Abstract_syntax_tree +[Evil Martians]: https://evilmartians.com/?utm_source=postcss +[Autoprefixer]: https://github.com/postcss/autoprefixer +[plugins]: https://github.com/postcss/postcss#plugins + + + Sponsored by Evil Martians + + + +## Docs +Read **[full docs](https://github.com/postcss/postcss#readme)** on GitHub. diff --git a/frontend/node_modules/postcss/lib/at-rule.d.ts b/frontend/node_modules/postcss/lib/at-rule.d.ts new file mode 100644 index 00000000..7a39b2f9 --- /dev/null +++ b/frontend/node_modules/postcss/lib/at-rule.d.ts @@ -0,0 +1,106 @@ +import Container, { ContainerProps } from './container.js' + +interface AtRuleRaws extends Record { + /** + * The space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + */ + before?: string + + /** + * The space symbols after the last child of the node to the end of the node. + */ + after?: string + + /** + * The space between the at-rule name and its parameters. + */ + afterName?: string + + /** + * The symbols between the last parameter and `{` for rules. + */ + between?: string + + /** + * Contains `true` if the last child has an (optional) semicolon. + */ + semicolon?: boolean + + /** + * The rule’s selector with comments. + */ + params?: { + value: string + raw: string + } +} + +export interface AtRuleProps extends ContainerProps { + /** Name of the at-rule. */ + name: string + /** Parameters following the name of the at-rule. */ + params?: string | number + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: AtRuleRaws +} + +/** + * Represents an at-rule. + * + * ```js + * Once (root, { AtRule }) { + * let media = new AtRule({ name: 'media', params: 'print' }) + * media.append(…) + * root.append(media) + * } + * ``` + * + * If it’s followed in the CSS by a {} block, this node will have + * a nodes property representing its children. + * + * ```js + * const root = postcss.parse('@charset "UTF-8"; @media print {}') + * + * const charset = root.first + * charset.type //=> 'atrule' + * charset.nodes //=> undefined + * + * const media = root.last + * media.nodes //=> [] + * ``` + */ +export default class AtRule extends Container { + type: 'atrule' + parent: Container | undefined + raws: AtRuleRaws + + /** + * The at-rule’s name immediately follows the `@`. + * + * ```js + * const root = postcss.parse('@media print {}') + * media.name //=> 'media' + * const media = root.first + * ``` + */ + name: string + + /** + * The at-rule’s parameters, the values that follow the at-rule’s name + * but precede any {} block. + * + * ```js + * const root = postcss.parse('@media print, screen {}') + * const media = root.first + * media.params //=> 'print, screen' + * ``` + */ + params: string + + constructor(defaults?: AtRuleProps) + assign(overrides: object | AtRuleProps): this + clone(overrides?: Partial): this + cloneBefore(overrides?: Partial): this + cloneAfter(overrides?: Partial): this +} diff --git a/frontend/node_modules/postcss/lib/at-rule.js b/frontend/node_modules/postcss/lib/at-rule.js new file mode 100644 index 00000000..9486447b --- /dev/null +++ b/frontend/node_modules/postcss/lib/at-rule.js @@ -0,0 +1,25 @@ +'use strict' + +let Container = require('./container') + +class AtRule extends Container { + constructor(defaults) { + super(defaults) + this.type = 'atrule' + } + + append(...children) { + if (!this.proxyOf.nodes) this.nodes = [] + return super.append(...children) + } + + prepend(...children) { + if (!this.proxyOf.nodes) this.nodes = [] + return super.prepend(...children) + } +} + +module.exports = AtRule +AtRule.default = AtRule + +Container.registerAtRule(AtRule) diff --git a/frontend/node_modules/postcss/lib/comment.d.ts b/frontend/node_modules/postcss/lib/comment.d.ts new file mode 100644 index 00000000..8eaf3a23 --- /dev/null +++ b/frontend/node_modules/postcss/lib/comment.d.ts @@ -0,0 +1,56 @@ +import Container from './container.js' +import Node, { NodeProps } from './node.js' + +interface CommentRaws extends Record { + /** + * The space symbols before the node. + */ + before?: string + + /** + * The space symbols between `/*` and the comment’s text. + */ + left?: string + + /** + * The space symbols between the comment’s text. + */ + right?: string +} + +export interface CommentProps extends NodeProps { + /** Content of the comment. */ + text: string + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: CommentRaws +} + +/** + * Represents a comment between declarations or statements (rule and at-rules). + * + * ```js + * Once (root, { Comment }) { + * let note = new Comment({ text: 'Note: …' }) + * root.append(note) + * } + * ``` + * + * Comments inside selectors, at-rule parameters, or declaration values + * will be stored in the `raws` properties explained above. + */ +export default class Comment extends Node { + type: 'comment' + parent: Container | undefined + raws: CommentRaws + + /** + * The comment's text. + */ + text: string + + constructor(defaults?: CommentProps) + assign(overrides: object | CommentProps): this + clone(overrides?: Partial): this + cloneBefore(overrides?: Partial): this + cloneAfter(overrides?: Partial): this +} diff --git a/frontend/node_modules/postcss/lib/comment.js b/frontend/node_modules/postcss/lib/comment.js new file mode 100644 index 00000000..c5665064 --- /dev/null +++ b/frontend/node_modules/postcss/lib/comment.js @@ -0,0 +1,13 @@ +'use strict' + +let Node = require('./node') + +class Comment extends Node { + constructor(defaults) { + super(defaults) + this.type = 'comment' + } +} + +module.exports = Comment +Comment.default = Comment diff --git a/frontend/node_modules/postcss/lib/container.d.ts b/frontend/node_modules/postcss/lib/container.d.ts new file mode 100644 index 00000000..2b75e372 --- /dev/null +++ b/frontend/node_modules/postcss/lib/container.d.ts @@ -0,0 +1,442 @@ +import Node, { ChildNode, NodeProps, ChildProps } from './node.js' +import Declaration from './declaration.js' +import Comment from './comment.js' +import AtRule from './at-rule.js' +import Rule from './rule.js' + +interface ValueOptions { + /** + * An array of property names. + */ + props?: string[] + + /** + * String that’s used to narrow down values and speed up the regexp search. + */ + fast?: string +} + +export interface ContainerProps extends NodeProps { + nodes?: (ChildNode | ChildProps)[] +} + +/** + * The `Root`, `AtRule`, and `Rule` container nodes + * inherit some common methods to help work with their children. + * + * Note that all containers can store any content. If you write a rule inside + * a rule, PostCSS will parse it. + */ +export default abstract class Container< + Child extends Node = ChildNode +> extends Node { + /** + * An array containing the container’s children. + * + * ```js + * const root = postcss.parse('a { color: black }') + * root.nodes.length //=> 1 + * root.nodes[0].selector //=> 'a' + * root.nodes[0].nodes[0].prop //=> 'color' + * ``` + */ + nodes: Child[] + + /** + * The container’s first child. + * + * ```js + * rule.first === rules.nodes[0] + * ``` + */ + get first(): Child | undefined + + /** + * The container’s last child. + * + * ```js + * rule.last === rule.nodes[rule.nodes.length - 1] + * ``` + */ + get last(): Child | undefined + + /** + * Iterates through the container’s immediate children, + * calling `callback` for each child. + * + * Returning `false` in the callback will break iteration. + * + * This method only iterates through the container’s immediate children. + * If you need to recursively iterate through all the container’s descendant + * nodes, use `Container#walk`. + * + * Unlike the for `{}`-cycle or `Array#forEach` this iterator is safe + * if you are mutating the array of child nodes during iteration. + * PostCSS will adjust the current index to match the mutations. + * + * ```js + * const root = postcss.parse('a { color: black; z-index: 1 }') + * const rule = root.first + * + * for (const decl of rule.nodes) { + * decl.cloneBefore({ prop: '-webkit-' + decl.prop }) + * // Cycle will be infinite, because cloneBefore moves the current node + * // to the next index + * } + * + * rule.each(decl => { + * decl.cloneBefore({ prop: '-webkit-' + decl.prop }) + * // Will be executed only for color and z-index + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + each( + callback: (node: Child, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each node. + * + * Like container.each(), this method is safe to use + * if you are mutating arrays during iteration. + * + * If you only need to iterate through the container’s immediate children, + * use `Container#each`. + * + * ```js + * root.walk(node => { + * // Traverses all descendant nodes. + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walk( + callback: (node: ChildNode, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each declaration node. + * + * If you pass a filter, iteration will only happen over declarations + * with matching properties. + * + * ```js + * root.walkDecls(decl => { + * checkPropertySupport(decl.prop) + * }) + * + * root.walkDecls('border-radius', decl => { + * decl.remove() + * }) + * + * root.walkDecls(/^background/, decl => { + * decl.value = takeFirstColorFromGradient(decl.value) + * }) + * ``` + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * @param prop String or regular expression to filter declarations + * by property name. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkDecls( + propFilter: string | RegExp, + callback: (decl: Declaration, index: number) => false | void + ): false | undefined + walkDecls( + callback: (decl: Declaration, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each rule node. + * + * If you pass a filter, iteration will only happen over rules + * with matching selectors. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * const selectors = [] + * root.walkRules(rule => { + * selectors.push(rule.selector) + * }) + * console.log(`Your CSS uses ${ selectors.length } selectors`) + * ``` + * + * @param selector String or regular expression to filter rules by selector. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkRules( + selectorFilter: string | RegExp, + callback: (rule: Rule, index: number) => false | void + ): false | undefined + walkRules( + callback: (rule: Rule, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each at-rule node. + * + * If you pass a filter, iteration will only happen over at-rules + * that have matching names. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * root.walkAtRules(rule => { + * if (isOld(rule.name)) rule.remove() + * }) + * + * let first = false + * root.walkAtRules('charset', rule => { + * if (!first) { + * first = true + * } else { + * rule.remove() + * } + * }) + * ``` + * + * @param name String or regular expression to filter at-rules by name. + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + walkAtRules( + nameFilter: string | RegExp, + callback: (atRule: AtRule, index: number) => false | void + ): false | undefined + walkAtRules( + callback: (atRule: AtRule, index: number) => false | void + ): false | undefined + + /** + * Traverses the container’s descendant nodes, calling callback + * for each comment node. + * + * Like `Container#each`, this method is safe + * to use if you are mutating arrays during iteration. + * + * ```js + * root.walkComments(comment => { + * comment.remove() + * }) + * ``` + * + * @param callback Iterator receives each node and index. + * @return Returns `false` if iteration was broke. + */ + + walkComments( + callback: (comment: Comment, indexed: number) => false | void + ): false | undefined + walkComments( + callback: (comment: Comment, indexed: number) => false | void + ): false | undefined + + /** + * Inserts new nodes to the end of the container. + * + * ```js + * const decl1 = new Declaration({ prop: 'color', value: 'black' }) + * const decl2 = new Declaration({ prop: 'background-color', value: 'white' }) + * rule.append(decl1, decl2) + * + * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule + * root.append({ selector: 'a' }) // rule + * rule.append({ prop: 'color', value: 'black' }) // declaration + * rule.append({ text: 'Comment' }) // comment + * + * root.append('a {}') + * root.first.append('color: black; z-index: 1') + * ``` + * + * @param nodes New nodes. + * @return This node for methods chain. + */ + append( + ...nodes: (Node | Node[] | ChildProps | ChildProps[] | string | string[])[] + ): this + + /** + * Inserts new nodes to the start of the container. + * + * ```js + * const decl1 = new Declaration({ prop: 'color', value: 'black' }) + * const decl2 = new Declaration({ prop: 'background-color', value: 'white' }) + * rule.prepend(decl1, decl2) + * + * root.append({ name: 'charset', params: '"UTF-8"' }) // at-rule + * root.append({ selector: 'a' }) // rule + * rule.append({ prop: 'color', value: 'black' }) // declaration + * rule.append({ text: 'Comment' }) // comment + * + * root.append('a {}') + * root.first.append('color: black; z-index: 1') + * ``` + * + * @param nodes New nodes. + * @return This node for methods chain. + */ + prepend( + ...nodes: (Node | Node[] | ChildProps | ChildProps[] | string | string[])[] + ): this + + /** + * Add child to the end of the node. + * + * ```js + * rule.push(new Declaration({ prop: 'color', value: 'black' })) + * ``` + * + * @param child New node. + * @return This node for methods chain. + */ + push(child: Child): this + + /** + * Insert new node before old node within the container. + * + * ```js + * rule.insertBefore(decl, decl.clone({ prop: '-webkit-' + decl.prop })) + * ``` + * + * @param oldNode Child or child’s index. + * @param newNode New node. + * @return This node for methods chain. + */ + insertBefore( + oldNode: Child | number, + newNode: Child | ChildProps | string | Child[] | ChildProps[] | string[] + ): this + + /** + * Insert new node after old node within the container. + * + * @param oldNode Child or child’s index. + * @param newNode New node. + * @return This node for methods chain. + */ + insertAfter( + oldNode: Child | number, + newNode: Child | ChildProps | string | Child[] | ChildProps[] | string[] + ): this + + /** + * Removes node from the container and cleans the parent properties + * from the node and its children. + * + * ```js + * rule.nodes.length //=> 5 + * rule.removeChild(decl) + * rule.nodes.length //=> 4 + * decl.parent //=> undefined + * ``` + * + * @param child Child or child’s index. + * @return This node for methods chain. + */ + removeChild(child: Child | number): this + + /** + * Removes all children from the container + * and cleans their parent properties. + * + * ```js + * rule.removeAll() + * rule.nodes.length //=> 0 + * ``` + * + * @return This node for methods chain. + */ + removeAll(): this + + /** + * Passes all declaration values within the container that match pattern + * through callback, replacing those values with the returned result + * of callback. + * + * This method is useful if you are using a custom unit or function + * and need to iterate through all values. + * + * ```js + * root.replaceValues(/\d+rem/, { fast: 'rem' }, string => { + * return 15 * parseInt(string) + 'px' + * }) + * ``` + * + * @param pattern Replace pattern. + * @param {object} opts Options to speed up the search. + * @param callback String to replace pattern or callback + * that returns a new value. The callback + * will receive the same arguments + * as those passed to a function parameter + * of `String#replace`. + * @return This node for methods chain. + */ + replaceValues( + pattern: string | RegExp, + options: ValueOptions, + replaced: string | { (substring: string, ...args: any[]): string } + ): this + replaceValues( + pattern: string | RegExp, + replaced: string | { (substring: string, ...args: any[]): string } + ): this + + /** + * Returns `true` if callback returns `true` + * for all of the container’s children. + * + * ```js + * const noPrefixes = rule.every(i => i.prop[0] !== '-') + * ``` + * + * @param condition Iterator returns true or false. + * @return Is every child pass condition. + */ + every( + condition: (node: Child, index: number, nodes: Child[]) => boolean + ): boolean + + /** + * Returns `true` if callback returns `true` for (at least) one + * of the container’s children. + * + * ```js + * const hasPrefix = rule.some(i => i.prop[0] === '-') + * ``` + * + * @param condition Iterator returns true or false. + * @return Is some child pass condition. + */ + some( + condition: (node: Child, index: number, nodes: Child[]) => boolean + ): boolean + + /** + * Returns a `child`’s index within the `Container#nodes` array. + * + * ```js + * rule.index( rule.nodes[2] ) //=> 2 + * ``` + * + * @param child Child of the current container. + * @return Child index. + */ + index(child: Child | number): number +} diff --git a/frontend/node_modules/postcss/lib/container.js b/frontend/node_modules/postcss/lib/container.js new file mode 100644 index 00000000..328779d1 --- /dev/null +++ b/frontend/node_modules/postcss/lib/container.js @@ -0,0 +1,433 @@ +'use strict' + +let { isClean, my } = require('./symbols') +let Declaration = require('./declaration') +let Comment = require('./comment') +let Node = require('./node') + +let parse, Rule, AtRule + +function cleanSource(nodes) { + return nodes.map(i => { + if (i.nodes) i.nodes = cleanSource(i.nodes) + delete i.source + return i + }) +} + +function markDirtyUp(node) { + node[isClean] = false + if (node.proxyOf.nodes) { + for (let i of node.proxyOf.nodes) { + markDirtyUp(i) + } + } +} + +class Container extends Node { + push(child) { + child.parent = this + this.proxyOf.nodes.push(child) + return this + } + + each(callback) { + if (!this.proxyOf.nodes) return undefined + let iterator = this.getIterator() + + let index, result + while (this.indexes[iterator] < this.proxyOf.nodes.length) { + index = this.indexes[iterator] + result = callback(this.proxyOf.nodes[index], index) + if (result === false) break + + this.indexes[iterator] += 1 + } + + delete this.indexes[iterator] + return result + } + + walk(callback) { + return this.each((child, i) => { + let result + try { + result = callback(child, i) + } catch (e) { + throw child.addToError(e) + } + if (result !== false && child.walk) { + result = child.walk(callback) + } + + return result + }) + } + + walkDecls(prop, callback) { + if (!callback) { + callback = prop + return this.walk((child, i) => { + if (child.type === 'decl') { + return callback(child, i) + } + }) + } + if (prop instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'decl' && prop.test(child.prop)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'decl' && child.prop === prop) { + return callback(child, i) + } + }) + } + + walkRules(selector, callback) { + if (!callback) { + callback = selector + + return this.walk((child, i) => { + if (child.type === 'rule') { + return callback(child, i) + } + }) + } + if (selector instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'rule' && selector.test(child.selector)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'rule' && child.selector === selector) { + return callback(child, i) + } + }) + } + + walkAtRules(name, callback) { + if (!callback) { + callback = name + return this.walk((child, i) => { + if (child.type === 'atrule') { + return callback(child, i) + } + }) + } + if (name instanceof RegExp) { + return this.walk((child, i) => { + if (child.type === 'atrule' && name.test(child.name)) { + return callback(child, i) + } + }) + } + return this.walk((child, i) => { + if (child.type === 'atrule' && child.name === name) { + return callback(child, i) + } + }) + } + + walkComments(callback) { + return this.walk((child, i) => { + if (child.type === 'comment') { + return callback(child, i) + } + }) + } + + append(...children) { + for (let child of children) { + let nodes = this.normalize(child, this.last) + for (let node of nodes) this.proxyOf.nodes.push(node) + } + + this.markDirty() + + return this + } + + prepend(...children) { + children = children.reverse() + for (let child of children) { + let nodes = this.normalize(child, this.first, 'prepend').reverse() + for (let node of nodes) this.proxyOf.nodes.unshift(node) + for (let id in this.indexes) { + this.indexes[id] = this.indexes[id] + nodes.length + } + } + + this.markDirty() + + return this + } + + cleanRaws(keepBetween) { + super.cleanRaws(keepBetween) + if (this.nodes) { + for (let node of this.nodes) node.cleanRaws(keepBetween) + } + } + + insertBefore(exist, add) { + exist = this.index(exist) + + let type = exist === 0 ? 'prepend' : false + let nodes = this.normalize(add, this.proxyOf.nodes[exist], type).reverse() + for (let node of nodes) this.proxyOf.nodes.splice(exist, 0, node) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (exist <= index) { + this.indexes[id] = index + nodes.length + } + } + + this.markDirty() + + return this + } + + insertAfter(exist, add) { + exist = this.index(exist) + + let nodes = this.normalize(add, this.proxyOf.nodes[exist]).reverse() + for (let node of nodes) this.proxyOf.nodes.splice(exist + 1, 0, node) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (exist < index) { + this.indexes[id] = index + nodes.length + } + } + + this.markDirty() + + return this + } + + removeChild(child) { + child = this.index(child) + this.proxyOf.nodes[child].parent = undefined + this.proxyOf.nodes.splice(child, 1) + + let index + for (let id in this.indexes) { + index = this.indexes[id] + if (index >= child) { + this.indexes[id] = index - 1 + } + } + + this.markDirty() + + return this + } + + removeAll() { + for (let node of this.proxyOf.nodes) node.parent = undefined + this.proxyOf.nodes = [] + + this.markDirty() + + return this + } + + replaceValues(pattern, opts, callback) { + if (!callback) { + callback = opts + opts = {} + } + + this.walkDecls(decl => { + if (opts.props && !opts.props.includes(decl.prop)) return + if (opts.fast && !decl.value.includes(opts.fast)) return + + decl.value = decl.value.replace(pattern, callback) + }) + + this.markDirty() + + return this + } + + every(condition) { + return this.nodes.every(condition) + } + + some(condition) { + return this.nodes.some(condition) + } + + index(child) { + if (typeof child === 'number') return child + if (child.proxyOf) child = child.proxyOf + return this.proxyOf.nodes.indexOf(child) + } + + get first() { + if (!this.proxyOf.nodes) return undefined + return this.proxyOf.nodes[0] + } + + get last() { + if (!this.proxyOf.nodes) return undefined + return this.proxyOf.nodes[this.proxyOf.nodes.length - 1] + } + + normalize(nodes, sample) { + if (typeof nodes === 'string') { + nodes = cleanSource(parse(nodes).nodes) + } else if (Array.isArray(nodes)) { + nodes = nodes.slice(0) + for (let i of nodes) { + if (i.parent) i.parent.removeChild(i, 'ignore') + } + } else if (nodes.type === 'root' && this.type !== 'document') { + nodes = nodes.nodes.slice(0) + for (let i of nodes) { + if (i.parent) i.parent.removeChild(i, 'ignore') + } + } else if (nodes.type) { + nodes = [nodes] + } else if (nodes.prop) { + if (typeof nodes.value === 'undefined') { + throw new Error('Value field is missed in node creation') + } else if (typeof nodes.value !== 'string') { + nodes.value = String(nodes.value) + } + nodes = [new Declaration(nodes)] + } else if (nodes.selector) { + nodes = [new Rule(nodes)] + } else if (nodes.name) { + nodes = [new AtRule(nodes)] + } else if (nodes.text) { + nodes = [new Comment(nodes)] + } else { + throw new Error('Unknown node type in node creation') + } + + let processed = nodes.map(i => { + /* c8 ignore next */ + if (!i[my]) Container.rebuild(i) + i = i.proxyOf + if (i.parent) i.parent.removeChild(i) + if (i[isClean]) markDirtyUp(i) + if (typeof i.raws.before === 'undefined') { + if (sample && typeof sample.raws.before !== 'undefined') { + i.raws.before = sample.raws.before.replace(/\S/g, '') + } + } + i.parent = this.proxyOf + return i + }) + + return processed + } + + getProxyProcessor() { + return { + set(node, prop, value) { + if (node[prop] === value) return true + node[prop] = value + if (prop === 'name' || prop === 'params' || prop === 'selector') { + node.markDirty() + } + return true + }, + + get(node, prop) { + if (prop === 'proxyOf') { + return node + } else if (!node[prop]) { + return node[prop] + } else if ( + prop === 'each' || + (typeof prop === 'string' && prop.startsWith('walk')) + ) { + return (...args) => { + return node[prop]( + ...args.map(i => { + if (typeof i === 'function') { + return (child, index) => i(child.toProxy(), index) + } else { + return i + } + }) + ) + } + } else if (prop === 'every' || prop === 'some') { + return cb => { + return node[prop]((child, ...other) => + cb(child.toProxy(), ...other) + ) + } + } else if (prop === 'root') { + return () => node.root().toProxy() + } else if (prop === 'nodes') { + return node.nodes.map(i => i.toProxy()) + } else if (prop === 'first' || prop === 'last') { + return node[prop].toProxy() + } else { + return node[prop] + } + } + } + } + + getIterator() { + if (!this.lastEach) this.lastEach = 0 + if (!this.indexes) this.indexes = {} + + this.lastEach += 1 + let iterator = this.lastEach + this.indexes[iterator] = 0 + + return iterator + } +} + +Container.registerParse = dependant => { + parse = dependant +} + +Container.registerRule = dependant => { + Rule = dependant +} + +Container.registerAtRule = dependant => { + AtRule = dependant +} + +module.exports = Container +Container.default = Container + +/* c8 ignore start */ +Container.rebuild = node => { + if (node.type === 'atrule') { + Object.setPrototypeOf(node, AtRule.prototype) + } else if (node.type === 'rule') { + Object.setPrototypeOf(node, Rule.prototype) + } else if (node.type === 'decl') { + Object.setPrototypeOf(node, Declaration.prototype) + } else if (node.type === 'comment') { + Object.setPrototypeOf(node, Comment.prototype) + } + + node[my] = true + + if (node.nodes) { + node.nodes.forEach(child => { + Container.rebuild(child) + }) + } +} +/* c8 ignore stop */ diff --git a/frontend/node_modules/postcss/lib/css-syntax-error.d.ts b/frontend/node_modules/postcss/lib/css-syntax-error.d.ts new file mode 100644 index 00000000..3fd05552 --- /dev/null +++ b/frontend/node_modules/postcss/lib/css-syntax-error.d.ts @@ -0,0 +1,239 @@ +import { FilePosition } from './input.js' + +/** + * A position that is part of a range. + */ +export interface RangePosition { + /** + * The line number in the input. + */ + line: number + + /** + * The column number in the input. + */ + column: number +} + +/** + * The CSS parser throws this error for broken CSS. + * + * Custom parsers can throw this error for broken custom syntax using + * the `Node#error` method. + * + * PostCSS will use the input source map to detect the original error location. + * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS, + * PostCSS will show the original position in the Sass file. + * + * If you need the position in the PostCSS input + * (e.g., to debug the previous compiler), use `error.input.file`. + * + * ```js + * // Raising error from plugin + * throw node.error('Unknown variable', { plugin: 'postcss-vars' }) + * ``` + * + * ```js + * // Catching and checking syntax error + * try { + * postcss.parse('a{') + * } catch (error) { + * if (error.name === 'CssSyntaxError') { + * error //=> CssSyntaxError + * } + * } + * ``` + */ +export default class CssSyntaxError { + /** + * Instantiates a CSS syntax error. Can be instantiated for a single position + * or for a range. + * @param message Error message. + * @param lineOrStartPos If for a single position, the line number, or if for + * a range, the inclusive start position of the error. + * @param columnOrEndPos If for a single position, the column number, or if for + * a range, the exclusive end position of the error. + * @param source Source code of the broken file. + * @param file Absolute path to the broken file. + * @param plugin PostCSS plugin name, if error came from plugin. + */ + constructor( + message: string, + lineOrStartPos?: number | RangePosition, + columnOrEndPos?: number | RangePosition, + source?: string, + file?: string, + plugin?: string + ) + + stack: string + + /** + * Always equal to `'CssSyntaxError'`. You should always check error type + * by `error.name === 'CssSyntaxError'` + * instead of `error instanceof CssSyntaxError`, + * because npm could have several PostCSS versions. + * + * ```js + * if (error.name === 'CssSyntaxError') { + * error //=> CssSyntaxError + * } + * ``` + */ + name: 'CssSyntaxError' + + /** + * Error message. + * + * ```js + * error.message //=> 'Unclosed block' + * ``` + */ + reason: string + + /** + * Full error text in the GNU error format + * with plugin, file, line and column. + * + * ```js + * error.message //=> 'a.css:1:1: Unclosed block' + * ``` + */ + message: string + + /** + * Absolute path to the broken file. + * + * ```js + * error.file //=> 'a.sass' + * error.input.file //=> 'a.css' + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.file`. + */ + file?: string + + /** + * Source line of the error. + * + * ```js + * error.line //=> 2 + * error.input.line //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.line`. + */ + line?: number + + /** + * Source column of the error. + * + * ```js + * error.column //=> 1 + * error.input.column //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.column`. + */ + column?: number + + /** + * Source line of the error's end, exclusive. Provided if the error pertains + * to a range. + * + * ```js + * error.endLine //=> 3 + * error.input.endLine //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.endLine`. + */ + endLine?: number + + /** + * Source column of the error's end, exclusive. Provided if the error pertains + * to a range. + * + * ```js + * error.endColumn //=> 1 + * error.input.endColumn //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.endColumn`. + */ + endColumn?: number + + /** + * Source code of the broken file. + * + * ```js + * error.source //=> 'a { b {} }' + * error.input.source //=> 'a b { }' + * ``` + */ + source?: string + + /** + * Plugin name, if error came from plugin. + * + * ```js + * error.plugin //=> 'postcss-vars' + * ``` + */ + plugin?: string + + /** + * Input object with PostCSS internal information + * about input file. If input has source map + * from previous tool, PostCSS will use origin + * (for example, Sass) source. You can use this + * object to get PostCSS input source. + * + * ```js + * error.input.file //=> 'a.css' + * error.file //=> 'a.sass' + * ``` + */ + input?: FilePosition + + /** + * Returns error position, message and source code of the broken part. + * + * ```js + * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block + * // > 1 | a { + * // | ^" + * ``` + * + * @return Error position, message and source code. + */ + toString(): string + + /** + * Returns a few lines of CSS source that caused the error. + * + * If the CSS has an input source map without `sourceContent`, + * this method will return an empty string. + * + * ```js + * error.showSourceCode() //=> " 4 | } + * // 5 | a { + * // > 6 | bad + * // | ^ + * // 7 | } + * // 8 | b {" + * ``` + * + * @param color Whether arrow will be colored red by terminal + * color codes. By default, PostCSS will detect + * color support by `process.stdout.isTTY` + * and `process.env.NODE_DISABLE_COLORS`. + * @return Few lines of CSS source that caused the error. + */ + showSourceCode(color?: boolean): string +} diff --git a/frontend/node_modules/postcss/lib/css-syntax-error.js b/frontend/node_modules/postcss/lib/css-syntax-error.js new file mode 100644 index 00000000..d6b369b8 --- /dev/null +++ b/frontend/node_modules/postcss/lib/css-syntax-error.js @@ -0,0 +1,100 @@ +'use strict' + +let pico = require('picocolors') + +let terminalHighlight = require('./terminal-highlight') + +class CssSyntaxError extends Error { + constructor(message, line, column, source, file, plugin) { + super(message) + this.name = 'CssSyntaxError' + this.reason = message + + if (file) { + this.file = file + } + if (source) { + this.source = source + } + if (plugin) { + this.plugin = plugin + } + if (typeof line !== 'undefined' && typeof column !== 'undefined') { + if (typeof line === 'number') { + this.line = line + this.column = column + } else { + this.line = line.line + this.column = line.column + this.endLine = column.line + this.endColumn = column.column + } + } + + this.setMessage() + + if (Error.captureStackTrace) { + Error.captureStackTrace(this, CssSyntaxError) + } + } + + setMessage() { + this.message = this.plugin ? this.plugin + ': ' : '' + this.message += this.file ? this.file : '' + if (typeof this.line !== 'undefined') { + this.message += ':' + this.line + ':' + this.column + } + this.message += ': ' + this.reason + } + + showSourceCode(color) { + if (!this.source) return '' + + let css = this.source + if (color == null) color = pico.isColorSupported + if (terminalHighlight) { + if (color) css = terminalHighlight(css) + } + + let lines = css.split(/\r?\n/) + let start = Math.max(this.line - 3, 0) + let end = Math.min(this.line + 2, lines.length) + + let maxWidth = String(end).length + + let mark, aside + if (color) { + let { bold, red, gray } = pico.createColors(true) + mark = text => bold(red(text)) + aside = text => gray(text) + } else { + mark = aside = str => str + } + + return lines + .slice(start, end) + .map((line, index) => { + let number = start + 1 + index + let gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ' + if (number === this.line) { + let spacing = + aside(gutter.replace(/\d/g, ' ')) + + line.slice(0, this.column - 1).replace(/[^\t]/g, ' ') + return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^') + } + return ' ' + aside(gutter) + line + }) + .join('\n') + } + + toString() { + let code = this.showSourceCode() + if (code) { + code = '\n\n' + code + '\n' + } + return this.name + ': ' + this.message + code + } +} + +module.exports = CssSyntaxError +CssSyntaxError.default = CssSyntaxError diff --git a/frontend/node_modules/postcss/lib/declaration.d.ts b/frontend/node_modules/postcss/lib/declaration.d.ts new file mode 100644 index 00000000..4a1fb1ec --- /dev/null +++ b/frontend/node_modules/postcss/lib/declaration.d.ts @@ -0,0 +1,124 @@ +import Container from './container.js' +import Node from './node.js' + +interface DeclarationRaws extends Record { + /** + * The space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + */ + before?: string + + /** + * The symbols between the property and value for declarations. + */ + between?: string + + /** + * The content of the important statement, if it is not just `!important`. + */ + important?: string + + /** + * Declaration value with comments. + */ + value?: { + value: string + raw: string + } +} + +export interface DeclarationProps { + /** Name of the declaration. */ + prop: string + /** Value of the declaration. */ + value: string + /** Whether the declaration has an `!important` annotation. */ + important?: boolean + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: DeclarationRaws +} + +/** + * Represents a CSS declaration. + * + * ```js + * Once (root, { Declaration }) { + * let color = new Declaration({ prop: 'color', value: 'black' }) + * root.append(color) + * } + * ``` + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first.first + * decl.type //=> 'decl' + * decl.toString() //=> ' color: black' + * ``` + */ +export default class Declaration extends Node { + type: 'decl' + parent: Container | undefined + raws: DeclarationRaws + + /** + * The declaration's property name. + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first.first + * decl.prop //=> 'color' + * ``` + */ + prop: string + + /** + * The declaration’s value. + * + * This value will be cleaned of comments. If the source value contained + * comments, those comments will be available in the `raws` property. + * If you have not changed the value, the result of `decl.toString()` + * will include the original raws value (comments and all). + * + * ```js + * const root = postcss.parse('a { color: black }') + * const decl = root.first.first + * decl.value //=> 'black' + * ``` + */ + value: string + + /** + * `true` if the declaration has an `!important` annotation. + * + * ```js + * const root = postcss.parse('a { color: black !important; color: red }') + * root.first.first.important //=> true + * root.first.last.important //=> undefined + * ``` + */ + important: boolean + + /** + * `true` if declaration is declaration of CSS Custom Property + * or Sass variable. + * + * ```js + * const root = postcss.parse(':root { --one: 1 }') + * let one = root.first.first + * one.variable //=> true + * ``` + * + * ```js + * const root = postcss.parse('$one: 1') + * let one = root.first + * one.variable //=> true + * ``` + */ + variable: boolean + + constructor(defaults?: DeclarationProps) + assign(overrides: object | DeclarationProps): this + clone(overrides?: Partial): this + cloneBefore(overrides?: Partial): this + cloneAfter(overrides?: Partial): this +} diff --git a/frontend/node_modules/postcss/lib/declaration.js b/frontend/node_modules/postcss/lib/declaration.js new file mode 100644 index 00000000..a04bdec3 --- /dev/null +++ b/frontend/node_modules/postcss/lib/declaration.js @@ -0,0 +1,24 @@ +'use strict' + +let Node = require('./node') + +class Declaration extends Node { + constructor(defaults) { + if ( + defaults && + typeof defaults.value !== 'undefined' && + typeof defaults.value !== 'string' + ) { + defaults = { ...defaults, value: String(defaults.value) } + } + super(defaults) + this.type = 'decl' + } + + get variable() { + return this.prop.startsWith('--') || this.prop[0] === '$' + } +} + +module.exports = Declaration +Declaration.default = Declaration diff --git a/frontend/node_modules/postcss/lib/document.d.ts b/frontend/node_modules/postcss/lib/document.d.ts new file mode 100644 index 00000000..28a599ca --- /dev/null +++ b/frontend/node_modules/postcss/lib/document.d.ts @@ -0,0 +1,57 @@ +import Container, { ContainerProps } from './container.js' +import { ProcessOptions } from './postcss.js' +import Result from './result.js' +import Root, { RootProps } from './root.js' + +export interface DocumentProps extends ContainerProps { + nodes?: Root[] + + /** + * Information to generate byte-to-byte equal node string as it was + * in the origin input. + * + * Every parser saves its own properties. + */ + raws?: Record +} + +type ChildNode = Root +type ChildProps = RootProps + +/** + * Represents a file and contains all its parsed nodes. + * + * **Experimental:** some aspects of this node could change within minor + * or patch version releases. + * + * ```js + * const document = htmlParser( + * '' + * ) + * document.type //=> 'document' + * document.nodes.length //=> 2 + * ``` + */ +export default class Document extends Container { + type: 'document' + parent: undefined + + constructor(defaults?: DocumentProps) + + /** + * Returns a `Result` instance representing the document’s CSS roots. + * + * ```js + * const root1 = postcss.parse(css1, { from: 'a.css' }) + * const root2 = postcss.parse(css2, { from: 'b.css' }) + * const document = postcss.document() + * document.append(root1) + * document.append(root2) + * const result = document.toResult({ to: 'all.css', map: true }) + * ``` + * + * @param opts Options. + * @return Result with current document’s CSS. + */ + toResult(options?: ProcessOptions): Result +} diff --git a/frontend/node_modules/postcss/lib/document.js b/frontend/node_modules/postcss/lib/document.js new file mode 100644 index 00000000..44689917 --- /dev/null +++ b/frontend/node_modules/postcss/lib/document.js @@ -0,0 +1,33 @@ +'use strict' + +let Container = require('./container') + +let LazyResult, Processor + +class Document extends Container { + constructor(defaults) { + // type needs to be passed to super, otherwise child roots won't be normalized correctly + super({ type: 'document', ...defaults }) + + if (!this.nodes) { + this.nodes = [] + } + } + + toResult(opts = {}) { + let lazy = new LazyResult(new Processor(), this, opts) + + return lazy.stringify() + } +} + +Document.registerLazyResult = dependant => { + LazyResult = dependant +} + +Document.registerProcessor = dependant => { + Processor = dependant +} + +module.exports = Document +Document.default = Document diff --git a/frontend/node_modules/postcss/lib/fromJSON.d.ts b/frontend/node_modules/postcss/lib/fromJSON.d.ts new file mode 100644 index 00000000..13b169c6 --- /dev/null +++ b/frontend/node_modules/postcss/lib/fromJSON.d.ts @@ -0,0 +1,5 @@ +import { JSONHydrator } from './postcss.js' + +declare const fromJSON: JSONHydrator + +export default fromJSON diff --git a/frontend/node_modules/postcss/lib/fromJSON.js b/frontend/node_modules/postcss/lib/fromJSON.js new file mode 100644 index 00000000..09f2b89a --- /dev/null +++ b/frontend/node_modules/postcss/lib/fromJSON.js @@ -0,0 +1,54 @@ +'use strict' + +let Declaration = require('./declaration') +let PreviousMap = require('./previous-map') +let Comment = require('./comment') +let AtRule = require('./at-rule') +let Input = require('./input') +let Root = require('./root') +let Rule = require('./rule') + +function fromJSON(json, inputs) { + if (Array.isArray(json)) return json.map(n => fromJSON(n)) + + let { inputs: ownInputs, ...defaults } = json + if (ownInputs) { + inputs = [] + for (let input of ownInputs) { + let inputHydrated = { ...input, __proto__: Input.prototype } + if (inputHydrated.map) { + inputHydrated.map = { + ...inputHydrated.map, + __proto__: PreviousMap.prototype + } + } + inputs.push(inputHydrated) + } + } + if (defaults.nodes) { + defaults.nodes = json.nodes.map(n => fromJSON(n, inputs)) + } + if (defaults.source) { + let { inputId, ...source } = defaults.source + defaults.source = source + if (inputId != null) { + defaults.source.input = inputs[inputId] + } + } + if (defaults.type === 'root') { + return new Root(defaults) + } else if (defaults.type === 'decl') { + return new Declaration(defaults) + } else if (defaults.type === 'rule') { + return new Rule(defaults) + } else if (defaults.type === 'comment') { + return new Comment(defaults) + } else if (defaults.type === 'atrule') { + return new AtRule(defaults) + } else { + throw new Error('Unknown node type: ' + json.type) + } +} + +module.exports = fromJSON +fromJSON.default = fromJSON diff --git a/frontend/node_modules/postcss/lib/input.d.ts b/frontend/node_modules/postcss/lib/input.d.ts new file mode 100644 index 00000000..357910bd --- /dev/null +++ b/frontend/node_modules/postcss/lib/input.d.ts @@ -0,0 +1,150 @@ +import { ProcessOptions } from './postcss.js' +import PreviousMap from './previous-map.js' + +export interface FilePosition { + /** + * URL for the source file. + */ + url: string + + /** + * Absolute path to the source file. + */ + file?: string + + /** + * Line of inclusive start position in source file. + */ + line: number + + /** + * Column of inclusive start position in source file. + */ + column: number + + /** + * Line of exclusive end position in source file. + */ + endLine?: number + + /** + * Column of exclusive end position in source file. + */ + endColumn?: number + + /** + * Source code. + */ + source?: string +} + +/** + * Represents the source CSS. + * + * ```js + * const root = postcss.parse(css, { from: file }) + * const input = root.source.input + * ``` + */ +export default class Input { + /** + * Input CSS source. + * + * ```js + * const input = postcss.parse('a{}', { from: file }).input + * input.css //=> "a{}" + * ``` + */ + css: string + + /** + * The input source map passed from a compilation step before PostCSS + * (for example, from Sass compiler). + * + * ```js + * root.source.input.map.consumer().sources //=> ['a.sass'] + * ``` + */ + map: PreviousMap + + /** + * The absolute path to the CSS source file defined + * with the `from` option. + * + * ```js + * const root = postcss.parse(css, { from: 'a.css' }) + * root.source.input.file //=> '/home/ai/a.css' + * ``` + */ + file?: string + + /** + * The unique ID of the CSS source. It will be created if `from` option + * is not provided (because PostCSS does not know the file path). + * + * ```js + * const root = postcss.parse(css) + * root.source.input.file //=> undefined + * root.source.input.id //=> "" + * ``` + */ + id?: string + + /** + * The flag to indicate whether or not the source code has Unicode BOM. + */ + hasBOM: boolean + + /** + * @param css Input CSS source. + * @param opts Process options. + */ + constructor(css: string, opts?: ProcessOptions) + + /** + * The CSS source identifier. Contains `Input#file` if the user + * set the `from` option, or `Input#id` if they did not. + * + * ```js + * const root = postcss.parse(css, { from: 'a.css' }) + * root.source.input.from //=> "/home/ai/a.css" + * + * const root = postcss.parse(css) + * root.source.input.from //=> "" + * ``` + */ + get from(): string + + /** + * Reads the input source map and returns a symbol position + * in the input source (e.g., in a Sass file that was compiled + * to CSS before being passed to PostCSS). Optionally takes an + * end position, exclusive. + * + * ```js + * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 } + * root.source.input.origin(1, 1, 1, 4) + * //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 } + * ``` + * + * @param line Line for inclusive start position in input CSS. + * @param column Column for inclusive start position in input CSS. + * @param endLine Line for exclusive end position in input CSS. + * @param endColumn Column for exclusive end position in input CSS. + * + * @return Position in input source. + */ + origin( + line: number, + column: number, + endLine?: number, + endColumn?: number + ): FilePosition | false + + /** + * Converts source offset to line and column. + * + * @param offset Source offset. + */ + fromOffset(offset: number): { line: number; col: number } | null +} diff --git a/frontend/node_modules/postcss/lib/input.js b/frontend/node_modules/postcss/lib/input.js new file mode 100644 index 00000000..0415b593 --- /dev/null +++ b/frontend/node_modules/postcss/lib/input.js @@ -0,0 +1,248 @@ +'use strict' + +let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') +let { fileURLToPath, pathToFileURL } = require('url') +let { resolve, isAbsolute } = require('path') +let { nanoid } = require('nanoid/non-secure') + +let terminalHighlight = require('./terminal-highlight') +let CssSyntaxError = require('./css-syntax-error') +let PreviousMap = require('./previous-map') + +let fromOffsetCache = Symbol('fromOffsetCache') + +let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) +let pathAvailable = Boolean(resolve && isAbsolute) + +class Input { + constructor(css, opts = {}) { + if ( + css === null || + typeof css === 'undefined' || + (typeof css === 'object' && !css.toString) + ) { + throw new Error(`PostCSS received ${css} instead of CSS string`) + } + + this.css = css.toString() + + if (this.css[0] === '\uFEFF' || this.css[0] === '\uFFFE') { + this.hasBOM = true + this.css = this.css.slice(1) + } else { + this.hasBOM = false + } + + if (opts.from) { + if ( + !pathAvailable || + /^\w+:\/\//.test(opts.from) || + isAbsolute(opts.from) + ) { + this.file = opts.from + } else { + this.file = resolve(opts.from) + } + } + + if (pathAvailable && sourceMapAvailable) { + let map = new PreviousMap(this.css, opts) + if (map.text) { + this.map = map + let file = map.consumer().file + if (!this.file && file) this.file = this.mapResolve(file) + } + } + + if (!this.file) { + this.id = '' + } + if (this.map) this.map.file = this.from + } + + fromOffset(offset) { + let lastLine, lineToIndex + if (!this[fromOffsetCache]) { + let lines = this.css.split('\n') + lineToIndex = new Array(lines.length) + let prevIndex = 0 + + for (let i = 0, l = lines.length; i < l; i++) { + lineToIndex[i] = prevIndex + prevIndex += lines[i].length + 1 + } + + this[fromOffsetCache] = lineToIndex + } else { + lineToIndex = this[fromOffsetCache] + } + lastLine = lineToIndex[lineToIndex.length - 1] + + let min = 0 + if (offset >= lastLine) { + min = lineToIndex.length - 1 + } else { + let max = lineToIndex.length - 2 + let mid + while (min < max) { + mid = min + ((max - min) >> 1) + if (offset < lineToIndex[mid]) { + max = mid - 1 + } else if (offset >= lineToIndex[mid + 1]) { + min = mid + 1 + } else { + min = mid + break + } + } + } + return { + line: min + 1, + col: offset - lineToIndex[min] + 1 + } + } + + error(message, line, column, opts = {}) { + let result, endLine, endColumn + + if (line && typeof line === 'object') { + let start = line + let end = column + if (typeof line.offset === 'number') { + let pos = this.fromOffset(start.offset) + line = pos.line + column = pos.col + } else { + line = start.line + column = start.column + } + if (typeof end.offset === 'number') { + let pos = this.fromOffset(end.offset) + endLine = pos.line + endColumn = pos.col + } else { + endLine = end.line + endColumn = end.column + } + } else if (!column) { + let pos = this.fromOffset(line) + line = pos.line + column = pos.col + } + + let origin = this.origin(line, column, endLine, endColumn) + if (origin) { + result = new CssSyntaxError( + message, + origin.endLine === undefined + ? origin.line + : { line: origin.line, column: origin.column }, + origin.endLine === undefined + ? origin.column + : { line: origin.endLine, column: origin.endColumn }, + origin.source, + origin.file, + opts.plugin + ) + } else { + result = new CssSyntaxError( + message, + endLine === undefined ? line : { line, column }, + endLine === undefined ? column : { line: endLine, column: endColumn }, + this.css, + this.file, + opts.plugin + ) + } + + result.input = { line, column, endLine, endColumn, source: this.css } + if (this.file) { + if (pathToFileURL) { + result.input.url = pathToFileURL(this.file).toString() + } + result.input.file = this.file + } + + return result + } + + origin(line, column, endLine, endColumn) { + if (!this.map) return false + let consumer = this.map.consumer() + + let from = consumer.originalPositionFor({ line, column }) + if (!from.source) return false + + let to + if (typeof endLine === 'number') { + to = consumer.originalPositionFor({ line: endLine, column: endColumn }) + } + + let fromUrl + + if (isAbsolute(from.source)) { + fromUrl = pathToFileURL(from.source) + } else { + fromUrl = new URL( + from.source, + this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile) + ) + } + + let result = { + url: fromUrl.toString(), + line: from.line, + column: from.column, + endLine: to && to.line, + endColumn: to && to.column + } + + if (fromUrl.protocol === 'file:') { + if (fileURLToPath) { + result.file = fileURLToPath(fromUrl) + } else { + /* c8 ignore next 2 */ + throw new Error(`file: protocol is not available in this PostCSS build`) + } + } + + let source = consumer.sourceContentFor(from.source) + if (source) result.source = source + + return result + } + + mapResolve(file) { + if (/^\w+:\/\//.test(file)) { + return file + } + return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file) + } + + get from() { + return this.file || this.id + } + + toJSON() { + let json = {} + for (let name of ['hasBOM', 'css', 'file', 'id']) { + if (this[name] != null) { + json[name] = this[name] + } + } + if (this.map) { + json.map = { ...this.map } + if (json.map.consumerCache) { + json.map.consumerCache = undefined + } + } + return json + } +} + +module.exports = Input +Input.default = Input + +if (terminalHighlight && terminalHighlight.registerInput) { + terminalHighlight.registerInput(Input) +} diff --git a/frontend/node_modules/postcss/lib/lazy-result.d.ts b/frontend/node_modules/postcss/lib/lazy-result.d.ts new file mode 100644 index 00000000..a5142345 --- /dev/null +++ b/frontend/node_modules/postcss/lib/lazy-result.d.ts @@ -0,0 +1,176 @@ +import Result, { Message, ResultOptions } from './result.js' +import { SourceMap } from './postcss.js' +import Processor from './processor.js' +import Warning from './warning.js' +import Root from './root.js' + +/** + * A Promise proxy for the result of PostCSS transformations. + * + * A `LazyResult` instance is returned by `Processor#process`. + * + * ```js + * const lazy = postcss([autoprefixer]).process(css) + * ``` + */ +export default class LazyResult implements PromiseLike { + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls `onFulfilled` with a Result instance. If a plugin throws + * an error, the `onRejected` callback will be executed. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css, { from: cssPath }).then(result => { + * console.log(result.css) + * }) + * ``` + */ + then: Promise['then'] + + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls onRejected for each error thrown in any plugin. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css).then(result => { + * console.log(result.css) + * }).catch(error => { + * console.error(error) + * }) + * ``` + */ + catch: Promise['catch'] + + /** + * Processes input CSS through synchronous and asynchronous plugins + * and calls onFinally on any error or when all plugins will finish work. + * + * It implements standard Promise API. + * + * ```js + * postcss([autoprefixer]).process(css).finally(() => { + * console.log('processing ended') + * }) + * ``` + */ + finally: Promise['finally'] + + /** + * @param processor Processor used for this transformation. + * @param css CSS to parse and transform. + * @param opts Options from the `Processor#process` or `Root#toResult`. + */ + constructor(processor: Processor, css: string, opts: ResultOptions) + + /** + * Returns the default string description of an object. + * Required to implement the Promise interface. + */ + get [Symbol.toStringTag](): string + + /** + * Returns a `Processor` instance, which will be used + * for CSS transformations. + */ + get processor(): Processor + + /** + * Options from the `Processor#process` call. + */ + get opts(): ResultOptions + + /** + * Processes input CSS through synchronous plugins, converts `Root` + * to a CSS string and returns `Result#css`. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get css(): string + + /** + * An alias for the `css` property. Use it with syntaxes + * that generate non-CSS output. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get content(): string + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#map`. + * + * This property will only work with synchronous plugins. + * If the processor contains any asynchronous plugins + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get map(): SourceMap + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#root`. + * + * This property will only work with synchronous plugins. If the processor + * contains any asynchronous plugins it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get root(): Root + + /** + * Processes input CSS through synchronous plugins + * and returns `Result#messages`. + * + * This property will only work with synchronous plugins. If the processor + * contains any asynchronous plugins it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. + */ + get messages(): Message[] + + /** + * Processes input CSS through synchronous plugins + * and calls `Result#warnings`. + * + * @return Warnings from plugins. + */ + warnings(): Warning[] + + /** + * Alias for the `LazyResult#css` property. + * + * ```js + * lazy + '' === lazy.css + * ``` + * + * @return Output CSS. + */ + toString(): string + + /** + * Run plugin in sync way and return `Result`. + * + * @return Result with output content. + */ + sync(): Result + + /** + * Run plugin in async way and return `Result`. + * + * @return Result with output content. + */ + async(): Promise +} diff --git a/frontend/node_modules/postcss/lib/lazy-result.js b/frontend/node_modules/postcss/lib/lazy-result.js new file mode 100644 index 00000000..584a95dc --- /dev/null +++ b/frontend/node_modules/postcss/lib/lazy-result.js @@ -0,0 +1,550 @@ +'use strict' + +let { isClean, my } = require('./symbols') +let MapGenerator = require('./map-generator') +let stringify = require('./stringify') +let Container = require('./container') +let Document = require('./document') +let warnOnce = require('./warn-once') +let Result = require('./result') +let parse = require('./parse') +let Root = require('./root') + +const TYPE_TO_CLASS_NAME = { + document: 'Document', + root: 'Root', + atrule: 'AtRule', + rule: 'Rule', + decl: 'Declaration', + comment: 'Comment' +} + +const PLUGIN_PROPS = { + postcssPlugin: true, + prepare: true, + Once: true, + Document: true, + Root: true, + Declaration: true, + Rule: true, + AtRule: true, + Comment: true, + DeclarationExit: true, + RuleExit: true, + AtRuleExit: true, + CommentExit: true, + RootExit: true, + DocumentExit: true, + OnceExit: true +} + +const NOT_VISITORS = { + postcssPlugin: true, + prepare: true, + Once: true +} + +const CHILDREN = 0 + +function isPromise(obj) { + return typeof obj === 'object' && typeof obj.then === 'function' +} + +function getEvents(node) { + let key = false + let type = TYPE_TO_CLASS_NAME[node.type] + if (node.type === 'decl') { + key = node.prop.toLowerCase() + } else if (node.type === 'atrule') { + key = node.name.toLowerCase() + } + + if (key && node.append) { + return [ + type, + type + '-' + key, + CHILDREN, + type + 'Exit', + type + 'Exit-' + key + ] + } else if (key) { + return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key] + } else if (node.append) { + return [type, CHILDREN, type + 'Exit'] + } else { + return [type, type + 'Exit'] + } +} + +function toStack(node) { + let events + if (node.type === 'document') { + events = ['Document', CHILDREN, 'DocumentExit'] + } else if (node.type === 'root') { + events = ['Root', CHILDREN, 'RootExit'] + } else { + events = getEvents(node) + } + + return { + node, + events, + eventIndex: 0, + visitors: [], + visitorIndex: 0, + iterator: 0 + } +} + +function cleanMarks(node) { + node[isClean] = false + if (node.nodes) node.nodes.forEach(i => cleanMarks(i)) + return node +} + +let postcss = {} + +class LazyResult { + constructor(processor, css, opts) { + this.stringified = false + this.processed = false + + let root + if ( + typeof css === 'object' && + css !== null && + (css.type === 'root' || css.type === 'document') + ) { + root = cleanMarks(css) + } else if (css instanceof LazyResult || css instanceof Result) { + root = cleanMarks(css.root) + if (css.map) { + if (typeof opts.map === 'undefined') opts.map = {} + if (!opts.map.inline) opts.map.inline = false + opts.map.prev = css.map + } + } else { + let parser = parse + if (opts.syntax) parser = opts.syntax.parse + if (opts.parser) parser = opts.parser + if (parser.parse) parser = parser.parse + + try { + root = parser(css, opts) + } catch (error) { + this.processed = true + this.error = error + } + + if (root && !root[my]) { + /* c8 ignore next 2 */ + Container.rebuild(root) + } + } + + this.result = new Result(processor, root, opts) + this.helpers = { ...postcss, result: this.result, postcss } + this.plugins = this.processor.plugins.map(plugin => { + if (typeof plugin === 'object' && plugin.prepare) { + return { ...plugin, ...plugin.prepare(this.result) } + } else { + return plugin + } + }) + } + + get [Symbol.toStringTag]() { + return 'LazyResult' + } + + get processor() { + return this.result.processor + } + + get opts() { + return this.result.opts + } + + get css() { + return this.stringify().css + } + + get content() { + return this.stringify().content + } + + get map() { + return this.stringify().map + } + + get root() { + return this.sync().root + } + + get messages() { + return this.sync().messages + } + + warnings() { + return this.sync().warnings() + } + + toString() { + return this.css + } + + then(onFulfilled, onRejected) { + if (process.env.NODE_ENV !== 'production') { + if (!('from' in this.opts)) { + warnOnce( + 'Without `from` option PostCSS could generate wrong source map ' + + 'and will not find Browserslist config. Set it to CSS file path ' + + 'or to `undefined` to prevent this warning.' + ) + } + } + return this.async().then(onFulfilled, onRejected) + } + + catch(onRejected) { + return this.async().catch(onRejected) + } + + finally(onFinally) { + return this.async().then(onFinally, onFinally) + } + + async() { + if (this.error) return Promise.reject(this.error) + if (this.processed) return Promise.resolve(this.result) + if (!this.processing) { + this.processing = this.runAsync() + } + return this.processing + } + + sync() { + if (this.error) throw this.error + if (this.processed) return this.result + this.processed = true + + if (this.processing) { + throw this.getAsyncError() + } + + for (let plugin of this.plugins) { + let promise = this.runOnRoot(plugin) + if (isPromise(promise)) { + throw this.getAsyncError() + } + } + + this.prepareVisitors() + if (this.hasListener) { + let root = this.result.root + while (!root[isClean]) { + root[isClean] = true + this.walkSync(root) + } + if (this.listeners.OnceExit) { + if (root.type === 'document') { + for (let subRoot of root.nodes) { + this.visitSync(this.listeners.OnceExit, subRoot) + } + } else { + this.visitSync(this.listeners.OnceExit, root) + } + } + } + + return this.result + } + + stringify() { + if (this.error) throw this.error + if (this.stringified) return this.result + this.stringified = true + + this.sync() + + let opts = this.result.opts + let str = stringify + if (opts.syntax) str = opts.syntax.stringify + if (opts.stringifier) str = opts.stringifier + if (str.stringify) str = str.stringify + + let map = new MapGenerator(str, this.result.root, this.result.opts) + let data = map.generate() + this.result.css = data[0] + this.result.map = data[1] + + return this.result + } + + walkSync(node) { + node[isClean] = true + let events = getEvents(node) + for (let event of events) { + if (event === CHILDREN) { + if (node.nodes) { + node.each(child => { + if (!child[isClean]) this.walkSync(child) + }) + } + } else { + let visitors = this.listeners[event] + if (visitors) { + if (this.visitSync(visitors, node.toProxy())) return + } + } + } + } + + visitSync(visitors, node) { + for (let [plugin, visitor] of visitors) { + this.result.lastPlugin = plugin + let promise + try { + promise = visitor(node, this.helpers) + } catch (e) { + throw this.handleError(e, node.proxyOf) + } + if (node.type !== 'root' && node.type !== 'document' && !node.parent) { + return true + } + if (isPromise(promise)) { + throw this.getAsyncError() + } + } + } + + runOnRoot(plugin) { + this.result.lastPlugin = plugin + try { + if (typeof plugin === 'object' && plugin.Once) { + if (this.result.root.type === 'document') { + let roots = this.result.root.nodes.map(root => + plugin.Once(root, this.helpers) + ) + + if (isPromise(roots[0])) { + return Promise.all(roots) + } + + return roots + } + + return plugin.Once(this.result.root, this.helpers) + } else if (typeof plugin === 'function') { + return plugin(this.result.root, this.result) + } + } catch (error) { + throw this.handleError(error) + } + } + + getAsyncError() { + throw new Error('Use process(css).then(cb) to work with async plugins') + } + + handleError(error, node) { + let plugin = this.result.lastPlugin + try { + if (node) node.addToError(error) + this.error = error + if (error.name === 'CssSyntaxError' && !error.plugin) { + error.plugin = plugin.postcssPlugin + error.setMessage() + } else if (plugin.postcssVersion) { + if (process.env.NODE_ENV !== 'production') { + let pluginName = plugin.postcssPlugin + let pluginVer = plugin.postcssVersion + let runtimeVer = this.result.processor.version + let a = pluginVer.split('.') + let b = runtimeVer.split('.') + + if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) { + // eslint-disable-next-line no-console + console.error( + 'Unknown error from PostCSS plugin. Your current PostCSS ' + + 'version is ' + + runtimeVer + + ', but ' + + pluginName + + ' uses ' + + pluginVer + + '. Perhaps this is the source of the error below.' + ) + } + } + } + } catch (err) { + /* c8 ignore next 3 */ + // eslint-disable-next-line no-console + if (console && console.error) console.error(err) + } + return error + } + + async runAsync() { + this.plugin = 0 + for (let i = 0; i < this.plugins.length; i++) { + let plugin = this.plugins[i] + let promise = this.runOnRoot(plugin) + if (isPromise(promise)) { + try { + await promise + } catch (error) { + throw this.handleError(error) + } + } + } + + this.prepareVisitors() + if (this.hasListener) { + let root = this.result.root + while (!root[isClean]) { + root[isClean] = true + let stack = [toStack(root)] + while (stack.length > 0) { + let promise = this.visitTick(stack) + if (isPromise(promise)) { + try { + await promise + } catch (e) { + let node = stack[stack.length - 1].node + throw this.handleError(e, node) + } + } + } + } + + if (this.listeners.OnceExit) { + for (let [plugin, visitor] of this.listeners.OnceExit) { + this.result.lastPlugin = plugin + try { + if (root.type === 'document') { + let roots = root.nodes.map(subRoot => + visitor(subRoot, this.helpers) + ) + + await Promise.all(roots) + } else { + await visitor(root, this.helpers) + } + } catch (e) { + throw this.handleError(e) + } + } + } + } + + this.processed = true + return this.stringify() + } + + prepareVisitors() { + this.listeners = {} + let add = (plugin, type, cb) => { + if (!this.listeners[type]) this.listeners[type] = [] + this.listeners[type].push([plugin, cb]) + } + for (let plugin of this.plugins) { + if (typeof plugin === 'object') { + for (let event in plugin) { + if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) { + throw new Error( + `Unknown event ${event} in ${plugin.postcssPlugin}. ` + + `Try to update PostCSS (${this.processor.version} now).` + ) + } + if (!NOT_VISITORS[event]) { + if (typeof plugin[event] === 'object') { + for (let filter in plugin[event]) { + if (filter === '*') { + add(plugin, event, plugin[event][filter]) + } else { + add( + plugin, + event + '-' + filter.toLowerCase(), + plugin[event][filter] + ) + } + } + } else if (typeof plugin[event] === 'function') { + add(plugin, event, plugin[event]) + } + } + } + } + } + this.hasListener = Object.keys(this.listeners).length > 0 + } + + visitTick(stack) { + let visit = stack[stack.length - 1] + let { node, visitors } = visit + + if (node.type !== 'root' && node.type !== 'document' && !node.parent) { + stack.pop() + return + } + + if (visitors.length > 0 && visit.visitorIndex < visitors.length) { + let [plugin, visitor] = visitors[visit.visitorIndex] + visit.visitorIndex += 1 + if (visit.visitorIndex === visitors.length) { + visit.visitors = [] + visit.visitorIndex = 0 + } + this.result.lastPlugin = plugin + try { + return visitor(node.toProxy(), this.helpers) + } catch (e) { + throw this.handleError(e, node) + } + } + + if (visit.iterator !== 0) { + let iterator = visit.iterator + let child + while ((child = node.nodes[node.indexes[iterator]])) { + node.indexes[iterator] += 1 + if (!child[isClean]) { + child[isClean] = true + stack.push(toStack(child)) + return + } + } + visit.iterator = 0 + delete node.indexes[iterator] + } + + let events = visit.events + while (visit.eventIndex < events.length) { + let event = events[visit.eventIndex] + visit.eventIndex += 1 + if (event === CHILDREN) { + if (node.nodes && node.nodes.length) { + node[isClean] = true + visit.iterator = node.getIterator() + } + return + } else if (this.listeners[event]) { + visit.visitors = this.listeners[event] + return + } + } + stack.pop() + } +} + +LazyResult.registerPostcss = dependant => { + postcss = dependant +} + +module.exports = LazyResult +LazyResult.default = LazyResult + +Root.registerLazyResult(LazyResult) +Document.registerLazyResult(LazyResult) diff --git a/frontend/node_modules/postcss/lib/list.d.ts b/frontend/node_modules/postcss/lib/list.d.ts new file mode 100644 index 00000000..79841ede --- /dev/null +++ b/frontend/node_modules/postcss/lib/list.d.ts @@ -0,0 +1,51 @@ +export type List = { + /** + * Safely splits values. + * + * ```js + * Once (root, { list }) { + * list.split('1px calc(10% + 1px)', [' ', '\n', '\t']) //=> ['1px', 'calc(10% + 1px)'] + * } + * ``` + * + * @param string separated values. + * @param separators array of separators. + * @param last boolean indicator. + * @return Split values. + */ + split(string: string, separators: string[], last: boolean): string[] + /** + * Safely splits space-separated values (such as those for `background`, + * `border-radius`, and other shorthand properties). + * + * ```js + * Once (root, { list }) { + * list.space('1px calc(10% + 1px)') //=> ['1px', 'calc(10% + 1px)'] + * } + * ``` + * + * @param str Space-separated values. + * @return Split values. + */ + space(str: string): string[] + + /** + * Safely splits comma-separated values (such as those for `transition-*` + * and `background` properties). + * + * ```js + * Once (root, { list }) { + * list.comma('black, linear-gradient(white, black)') + * //=> ['black', 'linear-gradient(white, black)'] + * } + * ``` + * + * @param str Comma-separated values. + * @return Split values. + */ + comma(str: string): string[] +} + +declare const list: List + +export default list diff --git a/frontend/node_modules/postcss/lib/list.js b/frontend/node_modules/postcss/lib/list.js new file mode 100644 index 00000000..08e94162 --- /dev/null +++ b/frontend/node_modules/postcss/lib/list.js @@ -0,0 +1,56 @@ +'use strict' + +let list = { + split(string, separators, last) { + let array = [] + let current = '' + let split = false + + let func = 0 + let quote = false + let escape = false + + for (let letter of string) { + if (escape) { + escape = false + } else if (letter === '\\') { + escape = true + } else if (quote) { + if (letter === quote) { + quote = false + } + } else if (letter === '"' || letter === "'") { + quote = letter + } else if (letter === '(') { + func += 1 + } else if (letter === ')') { + if (func > 0) func -= 1 + } else if (func === 0) { + if (separators.includes(letter)) split = true + } + + if (split) { + if (current !== '') array.push(current.trim()) + current = '' + split = false + } else { + current += letter + } + } + + if (last || current !== '') array.push(current.trim()) + return array + }, + + space(string) { + let spaces = [' ', '\n', '\t'] + return list.split(string, spaces) + }, + + comma(string) { + return list.split(string, [','], true) + } +} + +module.exports = list +list.default = list diff --git a/frontend/node_modules/postcss/lib/map-generator.js b/frontend/node_modules/postcss/lib/map-generator.js new file mode 100644 index 00000000..49d638aa --- /dev/null +++ b/frontend/node_modules/postcss/lib/map-generator.js @@ -0,0 +1,331 @@ +'use strict' + +let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') +let { dirname, resolve, relative, sep } = require('path') +let { pathToFileURL } = require('url') + +let Input = require('./input') + +let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) +let pathAvailable = Boolean(dirname && resolve && relative && sep) + +class MapGenerator { + constructor(stringify, root, opts, cssString) { + this.stringify = stringify + this.mapOpts = opts.map || {} + this.root = root + this.opts = opts + this.css = cssString + } + + isMap() { + if (typeof this.opts.map !== 'undefined') { + return !!this.opts.map + } + return this.previous().length > 0 + } + + previous() { + if (!this.previousMaps) { + this.previousMaps = [] + if (this.root) { + this.root.walk(node => { + if (node.source && node.source.input.map) { + let map = node.source.input.map + if (!this.previousMaps.includes(map)) { + this.previousMaps.push(map) + } + } + }) + } else { + let input = new Input(this.css, this.opts) + if (input.map) this.previousMaps.push(input.map) + } + } + + return this.previousMaps + } + + isInline() { + if (typeof this.mapOpts.inline !== 'undefined') { + return this.mapOpts.inline + } + + let annotation = this.mapOpts.annotation + if (typeof annotation !== 'undefined' && annotation !== true) { + return false + } + + if (this.previous().length) { + return this.previous().some(i => i.inline) + } + return true + } + + isSourcesContent() { + if (typeof this.mapOpts.sourcesContent !== 'undefined') { + return this.mapOpts.sourcesContent + } + if (this.previous().length) { + return this.previous().some(i => i.withContent()) + } + return true + } + + clearAnnotation() { + if (this.mapOpts.annotation === false) return + + if (this.root) { + let node + for (let i = this.root.nodes.length - 1; i >= 0; i--) { + node = this.root.nodes[i] + if (node.type !== 'comment') continue + if (node.text.indexOf('# sourceMappingURL=') === 0) { + this.root.removeChild(i) + } + } + } else if (this.css) { + this.css = this.css.replace(/(\n)?\/\*#[\S\s]*?\*\/$/gm, '') + } + } + + setSourcesContent() { + let already = {} + if (this.root) { + this.root.walk(node => { + if (node.source) { + let from = node.source.input.from + if (from && !already[from]) { + already[from] = true + this.map.setSourceContent( + this.toUrl(this.path(from)), + node.source.input.css + ) + } + } + }) + } else if (this.css) { + let from = this.opts.from + ? this.toUrl(this.path(this.opts.from)) + : '' + this.map.setSourceContent(from, this.css) + } + } + + applyPrevMaps() { + for (let prev of this.previous()) { + let from = this.toUrl(this.path(prev.file)) + let root = prev.root || dirname(prev.file) + let map + + if (this.mapOpts.sourcesContent === false) { + map = new SourceMapConsumer(prev.text) + if (map.sourcesContent) { + map.sourcesContent = map.sourcesContent.map(() => null) + } + } else { + map = prev.consumer() + } + + this.map.applySourceMap(map, from, this.toUrl(this.path(root))) + } + } + + isAnnotation() { + if (this.isInline()) { + return true + } + if (typeof this.mapOpts.annotation !== 'undefined') { + return this.mapOpts.annotation + } + if (this.previous().length) { + return this.previous().some(i => i.annotation) + } + return true + } + + toBase64(str) { + if (Buffer) { + return Buffer.from(str).toString('base64') + } else { + return window.btoa(unescape(encodeURIComponent(str))) + } + } + + addAnnotation() { + let content + + if (this.isInline()) { + content = + 'data:application/json;base64,' + this.toBase64(this.map.toString()) + } else if (typeof this.mapOpts.annotation === 'string') { + content = this.mapOpts.annotation + } else if (typeof this.mapOpts.annotation === 'function') { + content = this.mapOpts.annotation(this.opts.to, this.root) + } else { + content = this.outputFile() + '.map' + } + let eol = '\n' + if (this.css.includes('\r\n')) eol = '\r\n' + + this.css += eol + '/*# sourceMappingURL=' + content + ' */' + } + + outputFile() { + if (this.opts.to) { + return this.path(this.opts.to) + } else if (this.opts.from) { + return this.path(this.opts.from) + } else { + return 'to.css' + } + } + + generateMap() { + if (this.root) { + this.generateString() + } else if (this.previous().length === 1) { + let prev = this.previous()[0].consumer() + prev.file = this.outputFile() + this.map = SourceMapGenerator.fromSourceMap(prev) + } else { + this.map = new SourceMapGenerator({ file: this.outputFile() }) + this.map.addMapping({ + source: this.opts.from + ? this.toUrl(this.path(this.opts.from)) + : '', + generated: { line: 1, column: 0 }, + original: { line: 1, column: 0 } + }) + } + + if (this.isSourcesContent()) this.setSourcesContent() + if (this.root && this.previous().length > 0) this.applyPrevMaps() + if (this.isAnnotation()) this.addAnnotation() + + if (this.isInline()) { + return [this.css] + } else { + return [this.css, this.map] + } + } + + path(file) { + if (file.indexOf('<') === 0) return file + if (/^\w+:\/\//.test(file)) return file + if (this.mapOpts.absolute) return file + + let from = this.opts.to ? dirname(this.opts.to) : '.' + + if (typeof this.mapOpts.annotation === 'string') { + from = dirname(resolve(from, this.mapOpts.annotation)) + } + + file = relative(from, file) + return file + } + + toUrl(path) { + if (sep === '\\') { + path = path.replace(/\\/g, '/') + } + return encodeURI(path).replace(/[#?]/g, encodeURIComponent) + } + + sourcePath(node) { + if (this.mapOpts.from) { + return this.toUrl(this.mapOpts.from) + } else if (this.mapOpts.absolute) { + if (pathToFileURL) { + return pathToFileURL(node.source.input.from).toString() + } else { + throw new Error( + '`map.absolute` option is not available in this PostCSS build' + ) + } + } else { + return this.toUrl(this.path(node.source.input.from)) + } + } + + generateString() { + this.css = '' + this.map = new SourceMapGenerator({ file: this.outputFile() }) + + let line = 1 + let column = 1 + + let noSource = '' + let mapping = { + source: '', + generated: { line: 0, column: 0 }, + original: { line: 0, column: 0 } + } + + let lines, last + this.stringify(this.root, (str, node, type) => { + this.css += str + + if (node && type !== 'end') { + mapping.generated.line = line + mapping.generated.column = column - 1 + if (node.source && node.source.start) { + mapping.source = this.sourcePath(node) + mapping.original.line = node.source.start.line + mapping.original.column = node.source.start.column - 1 + this.map.addMapping(mapping) + } else { + mapping.source = noSource + mapping.original.line = 1 + mapping.original.column = 0 + this.map.addMapping(mapping) + } + } + + lines = str.match(/\n/g) + if (lines) { + line += lines.length + last = str.lastIndexOf('\n') + column = str.length - last + } else { + column += str.length + } + + if (node && type !== 'start') { + let p = node.parent || { raws: {} } + if (node.type !== 'decl' || node !== p.last || p.raws.semicolon) { + if (node.source && node.source.end) { + mapping.source = this.sourcePath(node) + mapping.original.line = node.source.end.line + mapping.original.column = node.source.end.column - 1 + mapping.generated.line = line + mapping.generated.column = column - 2 + this.map.addMapping(mapping) + } else { + mapping.source = noSource + mapping.original.line = 1 + mapping.original.column = 0 + mapping.generated.line = line + mapping.generated.column = column - 1 + this.map.addMapping(mapping) + } + } + } + }) + } + + generate() { + this.clearAnnotation() + if (pathAvailable && sourceMapAvailable && this.isMap()) { + return this.generateMap() + } else { + let result = '' + this.stringify(this.root, i => { + result += i + }) + return [result] + } + } +} + +module.exports = MapGenerator diff --git a/frontend/node_modules/postcss/lib/no-work-result.d.ts b/frontend/node_modules/postcss/lib/no-work-result.d.ts new file mode 100644 index 00000000..7ba1462c --- /dev/null +++ b/frontend/node_modules/postcss/lib/no-work-result.d.ts @@ -0,0 +1,37 @@ +import Result, { Message, ResultOptions } from './result.js' +import { SourceMap } from './postcss.js' +import Processor from './processor.js' +import Warning from './warning.js' +import Root from './root.js' +import LazyResult from './lazy-result.js' + +/** + * A Promise proxy for the result of PostCSS transformations. + * This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root` + * are accessed. See the example below for details. + * A `NoWork` instance is returned by `Processor#process` ONLY when no plugins defined. + * + * ```js + * const noWorkResult = postcss().process(css) // No plugins are defined. + * // CSS is not parsed + * let root = noWorkResult.root // now css is parsed because we accessed the root + * ``` + */ +export default class NoWorkResult implements LazyResult { + then: Promise['then'] + catch: Promise['catch'] + finally: Promise['finally'] + constructor(processor: Processor, css: string, opts: ResultOptions) + get [Symbol.toStringTag](): string + get processor(): Processor + get opts(): ResultOptions + get css(): string + get content(): string + get map(): SourceMap + get root(): Root + get messages(): Message[] + warnings(): Warning[] + toString(): string + sync(): Result + async(): Promise +} diff --git a/frontend/node_modules/postcss/lib/no-work-result.js b/frontend/node_modules/postcss/lib/no-work-result.js new file mode 100644 index 00000000..8bab6f5a --- /dev/null +++ b/frontend/node_modules/postcss/lib/no-work-result.js @@ -0,0 +1,135 @@ +'use strict' + +let MapGenerator = require('./map-generator') +let stringify = require('./stringify') +let warnOnce = require('./warn-once') +let parse = require('./parse') +const Result = require('./result') + +class NoWorkResult { + constructor(processor, css, opts) { + css = css.toString() + this.stringified = false + + this._processor = processor + this._css = css + this._opts = opts + this._map = undefined + let root + + let str = stringify + this.result = new Result(this._processor, root, this._opts) + this.result.css = css + + let self = this + Object.defineProperty(this.result, 'root', { + get() { + return self.root + } + }) + + let map = new MapGenerator(str, root, this._opts, css) + if (map.isMap()) { + let [generatedCSS, generatedMap] = map.generate() + if (generatedCSS) { + this.result.css = generatedCSS + } + if (generatedMap) { + this.result.map = generatedMap + } + } + } + + get [Symbol.toStringTag]() { + return 'NoWorkResult' + } + + get processor() { + return this.result.processor + } + + get opts() { + return this.result.opts + } + + get css() { + return this.result.css + } + + get content() { + return this.result.css + } + + get map() { + return this.result.map + } + + get root() { + if (this._root) { + return this._root + } + + let root + let parser = parse + + try { + root = parser(this._css, this._opts) + } catch (error) { + this.error = error + } + + if (this.error) { + throw this.error + } else { + this._root = root + return root + } + } + + get messages() { + return [] + } + + warnings() { + return [] + } + + toString() { + return this._css + } + + then(onFulfilled, onRejected) { + if (process.env.NODE_ENV !== 'production') { + if (!('from' in this._opts)) { + warnOnce( + 'Without `from` option PostCSS could generate wrong source map ' + + 'and will not find Browserslist config. Set it to CSS file path ' + + 'or to `undefined` to prevent this warning.' + ) + } + } + + return this.async().then(onFulfilled, onRejected) + } + + catch(onRejected) { + return this.async().catch(onRejected) + } + + finally(onFinally) { + return this.async().then(onFinally, onFinally) + } + + async() { + if (this.error) return Promise.reject(this.error) + return Promise.resolve(this.result) + } + + sync() { + if (this.error) throw this.error + return this.result + } +} + +module.exports = NoWorkResult +NoWorkResult.default = NoWorkResult diff --git a/frontend/node_modules/postcss/lib/node.d.ts b/frontend/node_modules/postcss/lib/node.d.ts new file mode 100644 index 00000000..a97d43ae --- /dev/null +++ b/frontend/node_modules/postcss/lib/node.d.ts @@ -0,0 +1,478 @@ +import Declaration, { DeclarationProps } from './declaration.js' +import Comment, { CommentProps } from './comment.js' +import { Stringifier, Syntax } from './postcss.js' +import AtRule, { AtRuleProps } from './at-rule.js' +import Rule, { RuleProps } from './rule.js' +import Warning, { WarningOptions } from './warning.js' +import CssSyntaxError from './css-syntax-error.js' +import Result from './result.js' +import Input from './input.js' +import Root from './root.js' +import Document from './document.js' +import Container from './container.js' + +export type ChildNode = AtRule | Rule | Declaration | Comment + +export type AnyNode = AtRule | Rule | Declaration | Comment | Root | Document + +export type ChildProps = + | AtRuleProps + | RuleProps + | DeclarationProps + | CommentProps + +export interface Position { + /** + * Source offset in file. It starts from 0. + */ + offset: number + + /** + * Source line in file. In contrast to `offset` it starts from 1. + */ + column: number + + /** + * Source column in file. + */ + line: number +} + +export interface Range { + /** + * Start position, inclusive. + */ + start: Position + + /** + * End position, exclusive. + */ + end: Position +} + +export interface Source { + /** + * The file source of the node. + */ + input: Input + /** + * The inclusive starting position of the node’s source. + */ + start?: Position + /** + * The inclusive ending position of the node's source. + */ + end?: Position +} + +export interface NodeProps { + source?: Source +} + +interface NodeErrorOptions { + /** + * Plugin name that created this error. PostCSS will set it automatically. + */ + plugin?: string + /** + * A word inside a node's string, that should be highlighted as source + * of error. + */ + word?: string + /** + * An index inside a node's string that should be highlighted as source + * of error. + */ + index?: number + /** + * An ending index inside a node's string that should be highlighted as + * source of error. + */ + endIndex?: number +} + +/** + * All node classes inherit the following common methods. + * + * You should not extend this classes to create AST for selector or value + * parser. + */ +export default abstract class Node { + /** + * tring representing the node’s type. Possible values are `root`, `atrule`, + * `rule`, `decl`, or `comment`. + * + * ```js + * new Declaration({ prop: 'color', value: 'black' }).type //=> 'decl' + * ``` + */ + type: string + + /** + * The node’s parent node. + * + * ```js + * root.nodes[0].parent === root + * ``` + */ + parent: Document | Container | undefined + + /** + * The input source of the node. + * + * The property is used in source map generation. + * + * If you create a node manually (e.g., with `postcss.decl()`), + * that node will not have a `source` property and will be absent + * from the source map. For this reason, the plugin developer should + * consider cloning nodes to create new ones (in which case the new node’s + * source will reference the original, cloned node) or setting + * the `source` property manually. + * + * ```js + * decl.source.input.from //=> '/home/ai/a.sass' + * decl.source.start //=> { line: 10, column: 2 } + * decl.source.end //=> { line: 10, column: 12 } + * ``` + * + * ```js + * // Bad + * const prefixed = postcss.decl({ + * prop: '-moz-' + decl.prop, + * value: decl.value + * }) + * + * // Good + * const prefixed = decl.clone({ prop: '-moz-' + decl.prop }) + * ``` + * + * ```js + * if (atrule.name === 'add-link') { + * const rule = postcss.rule({ selector: 'a', source: atrule.source }) + * atrule.parent.insertBefore(atrule, rule) + * } + * ``` + */ + source?: Source + + /** + * Information to generate byte-to-byte equal node string as it was + * in the origin input. + * + * Every parser saves its own properties, + * but the default CSS parser uses: + * + * * `before`: the space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + * * `after`: the space symbols after the last child of the node + * to the end of the node. + * * `between`: the symbols between the property and value + * for declarations, selector and `{` for rules, or last parameter + * and `{` for at-rules. + * * `semicolon`: contains true if the last child has + * an (optional) semicolon. + * * `afterName`: the space between the at-rule name and its parameters. + * * `left`: the space symbols between `/*` and the comment’s text. + * * `right`: the space symbols between the comment’s text + * and */. + * * `important`: the content of the important statement, + * if it is not just `!important`. + * + * PostCSS cleans selectors, declaration values and at-rule parameters + * from comments and extra spaces, but it stores origin content in raws + * properties. As such, if you don’t change a declaration’s value, + * PostCSS will use the raw value with comments. + * + * ```js + * const root = postcss.parse('a {\n color:black\n}') + * root.first.first.raws //=> { before: '\n ', between: ':' } + * ``` + */ + raws: any + + /** + * @param defaults Value for node properties. + */ + constructor(defaults?: object) + + /** + * Returns a `CssSyntaxError` instance containing the original position + * of the node in the source, showing line and column numbers and also + * a small excerpt to facilitate debugging. + * + * If present, an input source map will be used to get the original position + * of the source, even from a previous compilation step + * (e.g., from Sass compilation). + * + * This method produces very useful error messages. + * + * ```js + * if (!variables[name]) { + * throw decl.error(`Unknown variable ${name}`, { word: name }) + * // CssSyntaxError: postcss-vars:a.sass:4:3: Unknown variable $black + * // color: $black + * // a + * // ^ + * // background: white + * } + * ``` + * + * @param message Error description. + * @param opts Options. + * + * @return Error object to throw it. + */ + error(message: string, options?: NodeErrorOptions): CssSyntaxError + + /** + * This method is provided as a convenience wrapper for `Result#warn`. + * + * ```js + * Declaration: { + * bad: (decl, { result }) => { + * decl.warn(result, 'Deprecated property bad') + * } + * } + * ``` + * + * @param result The `Result` instance that will receive the warning. + * @param text Warning message. + * @param opts Warning Options. + * + * @return Created warning object. + */ + warn(result: Result, text: string, opts?: WarningOptions): Warning + + /** + * Removes the node from its parent and cleans the parent properties + * from the node and its children. + * + * ```js + * if (decl.prop.match(/^-webkit-/)) { + * decl.remove() + * } + * ``` + * + * @return Node to make calls chain. + */ + remove(): this + + /** + * Returns a CSS string representing the node. + * + * ```js + * new Rule({ selector: 'a' }).toString() //=> "a {}" + * ``` + * + * @param stringifier A syntax to use in string generation. + * @return CSS string of this node. + */ + toString(stringifier?: Stringifier | Syntax): string + + /** + * Assigns properties to the current node. + * + * ```js + * decl.assign({ prop: 'word-wrap', value: 'break-word' }) + * ``` + * + * @param overrides New properties to override the node. + * @return Current node to methods chain. + */ + assign(overrides: object): this + + /** + * Returns an exact clone of the node. + * + * The resulting cloned node and its (cloned) children will retain + * code style properties. + * + * ```js + * decl.raws.before //=> "\n " + * const cloned = decl.clone({ prop: '-moz-' + decl.prop }) + * cloned.raws.before //=> "\n " + * cloned.toString() //=> -moz-transform: scale(0) + * ``` + * + * @param overrides New properties to override in the clone. + * @return Clone of the node. + */ + clone(overrides?: object): this + + /** + * Shortcut to clone the node and insert the resulting cloned node + * before the current node. + * + * ```js + * decl.cloneBefore({ prop: '-moz-' + decl.prop }) + * ``` + * + * @param overrides Mew properties to override in the clone. + * + * @return New node + */ + cloneBefore(overrides?: object): this + + /** + * Shortcut to clone the node and insert the resulting cloned node + * after the current node. + * + * @param overrides New properties to override in the clone. + * @return New node. + */ + cloneAfter(overrides?: object): this + + /** + * Inserts node(s) before the current node and removes the current node. + * + * ```js + * AtRule: { + * mixin: atrule => { + * atrule.replaceWith(mixinRules[atrule.params]) + * } + * } + * ``` + * + * @param nodes Mode(s) to replace current one. + * @return Current node to methods chain. + */ + replaceWith( + ...nodes: (ChildNode | ChildProps | ChildNode[] | ChildProps[])[] + ): this + + /** + * Returns the next child of the node’s parent. + * Returns `undefined` if the current node is the last child. + * + * ```js + * if (comment.text === 'delete next') { + * const next = comment.next() + * if (next) { + * next.remove() + * } + * } + * ``` + * + * @return Next node. + */ + next(): ChildNode | undefined + + /** + * Returns the previous child of the node’s parent. + * Returns `undefined` if the current node is the first child. + * + * ```js + * const annotation = decl.prev() + * if (annotation.type === 'comment') { + * readAnnotation(annotation.text) + * } + * ``` + * + * @return Previous node. + */ + prev(): ChildNode | undefined + + /** + * Insert new node before current node to current node’s parent. + * + * Just alias for `node.parent.insertBefore(node, add)`. + * + * ```js + * decl.before('content: ""') + * ``` + * + * @param newNode New node. + * @return This node for methods chain. + */ + before(newNode: Node | ChildProps | string | Node[]): this + + /** + * Insert new node after current node to current node’s parent. + * + * Just alias for `node.parent.insertAfter(node, add)`. + * + * ```js + * decl.after('color: black') + * ``` + * + * @param newNode New node. + * @return This node for methods chain. + */ + after(newNode: Node | ChildProps | string | Node[]): this + + /** + * Finds the Root instance of the node’s tree. + * + * ```js + * root.nodes[0].nodes[0].root() === root + * ``` + * + * @return Root parent. + */ + root(): Root + + /** + * Returns a `Node#raws` value. If the node is missing + * the code style property (because the node was manually built or cloned), + * PostCSS will try to autodetect the code style property by looking + * at other nodes in the tree. + * + * ```js + * const root = postcss.parse('a { background: white }') + * root.nodes[0].append({ prop: 'color', value: 'black' }) + * root.nodes[0].nodes[1].raws.before //=> undefined + * root.nodes[0].nodes[1].raw('before') //=> ' ' + * ``` + * + * @param prop Name of code style property. + * @param defaultType Name of default value, it can be missed + * if the value is the same as prop. + * @return {string} Code style value. + */ + raw(prop: string, defaultType?: string): string + + /** + * Clear the code style properties for the node and its children. + * + * ```js + * node.raws.before //=> ' ' + * node.cleanRaws() + * node.raws.before //=> undefined + * ``` + * + * @param keepBetween Keep the `raws.between` symbols. + */ + cleanRaws(keepBetween?: boolean): void + + /** + * Fix circular links on `JSON.stringify()`. + * + * @return Cleaned object. + */ + toJSON(): object + + /** + * Convert string index to line/column. + * + * @param index The symbol number in the node’s string. + * @return Symbol position in file. + */ + positionInside(index: number): Position + + /** + * Get the position for a word or an index inside the node. + * + * @param opts Options. + * @return Position. + */ + positionBy(opts?: Pick): Position + + /** + * Get the range for a word or start and end index inside the node. + * The start index is inclusive; the end index is exclusive. + * + * @param opts Options. + * @return Range. + */ + rangeBy(opts?: Pick): Range +} diff --git a/frontend/node_modules/postcss/lib/node.js b/frontend/node_modules/postcss/lib/node.js new file mode 100644 index 00000000..bdcbac0e --- /dev/null +++ b/frontend/node_modules/postcss/lib/node.js @@ -0,0 +1,379 @@ +'use strict' + +let { isClean, my } = require('./symbols') +let CssSyntaxError = require('./css-syntax-error') +let Stringifier = require('./stringifier') +let stringify = require('./stringify') + +function cloneNode(obj, parent) { + let cloned = new obj.constructor() + + for (let i in obj) { + if (!Object.prototype.hasOwnProperty.call(obj, i)) { + /* c8 ignore next 2 */ + continue + } + if (i === 'proxyCache') continue + let value = obj[i] + let type = typeof value + + if (i === 'parent' && type === 'object') { + if (parent) cloned[i] = parent + } else if (i === 'source') { + cloned[i] = value + } else if (Array.isArray(value)) { + cloned[i] = value.map(j => cloneNode(j, cloned)) + } else { + if (type === 'object' && value !== null) value = cloneNode(value) + cloned[i] = value + } + } + + return cloned +} + +class Node { + constructor(defaults = {}) { + this.raws = {} + this[isClean] = false + this[my] = true + + for (let name in defaults) { + if (name === 'nodes') { + this.nodes = [] + for (let node of defaults[name]) { + if (typeof node.clone === 'function') { + this.append(node.clone()) + } else { + this.append(node) + } + } + } else { + this[name] = defaults[name] + } + } + } + + error(message, opts = {}) { + if (this.source) { + let { start, end } = this.rangeBy(opts) + return this.source.input.error( + message, + { line: start.line, column: start.column }, + { line: end.line, column: end.column }, + opts + ) + } + return new CssSyntaxError(message) + } + + warn(result, text, opts) { + let data = { node: this } + for (let i in opts) data[i] = opts[i] + return result.warn(text, data) + } + + remove() { + if (this.parent) { + this.parent.removeChild(this) + } + this.parent = undefined + return this + } + + toString(stringifier = stringify) { + if (stringifier.stringify) stringifier = stringifier.stringify + let result = '' + stringifier(this, i => { + result += i + }) + return result + } + + assign(overrides = {}) { + for (let name in overrides) { + this[name] = overrides[name] + } + return this + } + + clone(overrides = {}) { + let cloned = cloneNode(this) + for (let name in overrides) { + cloned[name] = overrides[name] + } + return cloned + } + + cloneBefore(overrides = {}) { + let cloned = this.clone(overrides) + this.parent.insertBefore(this, cloned) + return cloned + } + + cloneAfter(overrides = {}) { + let cloned = this.clone(overrides) + this.parent.insertAfter(this, cloned) + return cloned + } + + replaceWith(...nodes) { + if (this.parent) { + let bookmark = this + let foundSelf = false + for (let node of nodes) { + if (node === this) { + foundSelf = true + } else if (foundSelf) { + this.parent.insertAfter(bookmark, node) + bookmark = node + } else { + this.parent.insertBefore(bookmark, node) + } + } + + if (!foundSelf) { + this.remove() + } + } + + return this + } + + next() { + if (!this.parent) return undefined + let index = this.parent.index(this) + return this.parent.nodes[index + 1] + } + + prev() { + if (!this.parent) return undefined + let index = this.parent.index(this) + return this.parent.nodes[index - 1] + } + + before(add) { + this.parent.insertBefore(this, add) + return this + } + + after(add) { + this.parent.insertAfter(this, add) + return this + } + + root() { + let result = this + while (result.parent && result.parent.type !== 'document') { + result = result.parent + } + return result + } + + raw(prop, defaultType) { + let str = new Stringifier() + return str.raw(this, prop, defaultType) + } + + cleanRaws(keepBetween) { + delete this.raws.before + delete this.raws.after + if (!keepBetween) delete this.raws.between + } + + toJSON(_, inputs) { + let fixed = {} + let emitInputs = inputs == null + inputs = inputs || new Map() + let inputsNextIndex = 0 + + for (let name in this) { + if (!Object.prototype.hasOwnProperty.call(this, name)) { + /* c8 ignore next 2 */ + continue + } + if (name === 'parent' || name === 'proxyCache') continue + let value = this[name] + + if (Array.isArray(value)) { + fixed[name] = value.map(i => { + if (typeof i === 'object' && i.toJSON) { + return i.toJSON(null, inputs) + } else { + return i + } + }) + } else if (typeof value === 'object' && value.toJSON) { + fixed[name] = value.toJSON(null, inputs) + } else if (name === 'source') { + let inputId = inputs.get(value.input) + if (inputId == null) { + inputId = inputsNextIndex + inputs.set(value.input, inputsNextIndex) + inputsNextIndex++ + } + fixed[name] = { + inputId, + start: value.start, + end: value.end + } + } else { + fixed[name] = value + } + } + + if (emitInputs) { + fixed.inputs = [...inputs.keys()].map(input => input.toJSON()) + } + + return fixed + } + + positionInside(index) { + let string = this.toString() + let column = this.source.start.column + let line = this.source.start.line + + for (let i = 0; i < index; i++) { + if (string[i] === '\n') { + column = 1 + line += 1 + } else { + column += 1 + } + } + + return { line, column } + } + + positionBy(opts) { + let pos = this.source.start + if (opts.index) { + pos = this.positionInside(opts.index) + } else if (opts.word) { + let index = this.toString().indexOf(opts.word) + if (index !== -1) pos = this.positionInside(index) + } + return pos + } + + rangeBy(opts) { + let start = { + line: this.source.start.line, + column: this.source.start.column + } + let end = this.source.end + ? { + line: this.source.end.line, + column: this.source.end.column + 1 + } + : { + line: start.line, + column: start.column + 1 + } + + if (opts.word) { + let index = this.toString().indexOf(opts.word) + if (index !== -1) { + start = this.positionInside(index) + end = this.positionInside(index + opts.word.length) + } + } else { + if (opts.start) { + start = { + line: opts.start.line, + column: opts.start.column + } + } else if (opts.index) { + start = this.positionInside(opts.index) + } + + if (opts.end) { + end = { + line: opts.end.line, + column: opts.end.column + } + } else if (opts.endIndex) { + end = this.positionInside(opts.endIndex) + } else if (opts.index) { + end = this.positionInside(opts.index + 1) + } + } + + if ( + end.line < start.line || + (end.line === start.line && end.column <= start.column) + ) { + end = { line: start.line, column: start.column + 1 } + } + + return { start, end } + } + + getProxyProcessor() { + return { + set(node, prop, value) { + if (node[prop] === value) return true + node[prop] = value + if ( + prop === 'prop' || + prop === 'value' || + prop === 'name' || + prop === 'params' || + prop === 'important' || + /* c8 ignore next */ + prop === 'text' + ) { + node.markDirty() + } + return true + }, + + get(node, prop) { + if (prop === 'proxyOf') { + return node + } else if (prop === 'root') { + return () => node.root().toProxy() + } else { + return node[prop] + } + } + } + } + + toProxy() { + if (!this.proxyCache) { + this.proxyCache = new Proxy(this, this.getProxyProcessor()) + } + return this.proxyCache + } + + addToError(error) { + error.postcssNode = this + if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) { + let s = this.source + error.stack = error.stack.replace( + /\n\s{4}at /, + `$&${s.input.from}:${s.start.line}:${s.start.column}$&` + ) + } + return error + } + + markDirty() { + if (this[isClean]) { + this[isClean] = false + let next = this + while ((next = next.parent)) { + next[isClean] = false + } + } + } + + get proxyOf() { + return this + } +} + +module.exports = Node +Node.default = Node diff --git a/frontend/node_modules/postcss/lib/parse.d.ts b/frontend/node_modules/postcss/lib/parse.d.ts new file mode 100644 index 00000000..d6bdee29 --- /dev/null +++ b/frontend/node_modules/postcss/lib/parse.d.ts @@ -0,0 +1,5 @@ +import { Parser } from './postcss.js' + +declare const parse: Parser + +export default parse diff --git a/frontend/node_modules/postcss/lib/parse.js b/frontend/node_modules/postcss/lib/parse.js new file mode 100644 index 00000000..971431f2 --- /dev/null +++ b/frontend/node_modules/postcss/lib/parse.js @@ -0,0 +1,42 @@ +'use strict' + +let Container = require('./container') +let Parser = require('./parser') +let Input = require('./input') + +function parse(css, opts) { + let input = new Input(css, opts) + let parser = new Parser(input) + try { + parser.parse() + } catch (e) { + if (process.env.NODE_ENV !== 'production') { + if (e.name === 'CssSyntaxError' && opts && opts.from) { + if (/\.scss$/i.test(opts.from)) { + e.message += + '\nYou tried to parse SCSS with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-scss parser' + } else if (/\.sass/i.test(opts.from)) { + e.message += + '\nYou tried to parse Sass with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-sass parser' + } else if (/\.less$/i.test(opts.from)) { + e.message += + '\nYou tried to parse Less with ' + + 'the standard CSS parser; ' + + 'try again with the postcss-less parser' + } + } + } + throw e + } + + return parser.root +} + +module.exports = parse +parse.default = parse + +Container.registerParse(parse) diff --git a/frontend/node_modules/postcss/lib/parser.js b/frontend/node_modules/postcss/lib/parser.js new file mode 100644 index 00000000..752d2643 --- /dev/null +++ b/frontend/node_modules/postcss/lib/parser.js @@ -0,0 +1,603 @@ +'use strict' + +let Declaration = require('./declaration') +let tokenizer = require('./tokenize') +let Comment = require('./comment') +let AtRule = require('./at-rule') +let Root = require('./root') +let Rule = require('./rule') + +const SAFE_COMMENT_NEIGHBOR = { + empty: true, + space: true +} + +function findLastWithPosition(tokens) { + for (let i = tokens.length - 1; i >= 0; i--) { + let token = tokens[i] + let pos = token[3] || token[2] + if (pos) return pos + } +} + +class Parser { + constructor(input) { + this.input = input + + this.root = new Root() + this.current = this.root + this.spaces = '' + this.semicolon = false + this.customProperty = false + + this.createTokenizer() + this.root.source = { input, start: { offset: 0, line: 1, column: 1 } } + } + + createTokenizer() { + this.tokenizer = tokenizer(this.input) + } + + parse() { + let token + while (!this.tokenizer.endOfFile()) { + token = this.tokenizer.nextToken() + + switch (token[0]) { + case 'space': + this.spaces += token[1] + break + + case ';': + this.freeSemicolon(token) + break + + case '}': + this.end(token) + break + + case 'comment': + this.comment(token) + break + + case 'at-word': + this.atrule(token) + break + + case '{': + this.emptyRule(token) + break + + default: + this.other(token) + break + } + } + this.endFile() + } + + comment(token) { + let node = new Comment() + this.init(node, token[2]) + node.source.end = this.getPosition(token[3] || token[2]) + + let text = token[1].slice(2, -2) + if (/^\s*$/.test(text)) { + node.text = '' + node.raws.left = text + node.raws.right = '' + } else { + let match = text.match(/^(\s*)([^]*\S)(\s*)$/) + node.text = match[2] + node.raws.left = match[1] + node.raws.right = match[3] + } + } + + emptyRule(token) { + let node = new Rule() + this.init(node, token[2]) + node.selector = '' + node.raws.between = '' + this.current = node + } + + other(start) { + let end = false + let type = null + let colon = false + let bracket = null + let brackets = [] + let customProperty = start[1].startsWith('--') + + let tokens = [] + let token = start + while (token) { + type = token[0] + tokens.push(token) + + if (type === '(' || type === '[') { + if (!bracket) bracket = token + brackets.push(type === '(' ? ')' : ']') + } else if (customProperty && colon && type === '{') { + if (!bracket) bracket = token + brackets.push('}') + } else if (brackets.length === 0) { + if (type === ';') { + if (colon) { + this.decl(tokens, customProperty) + return + } else { + break + } + } else if (type === '{') { + this.rule(tokens) + return + } else if (type === '}') { + this.tokenizer.back(tokens.pop()) + end = true + break + } else if (type === ':') { + colon = true + } + } else if (type === brackets[brackets.length - 1]) { + brackets.pop() + if (brackets.length === 0) bracket = null + } + + token = this.tokenizer.nextToken() + } + + if (this.tokenizer.endOfFile()) end = true + if (brackets.length > 0) this.unclosedBracket(bracket) + + if (end && colon) { + if (!customProperty) { + while (tokens.length) { + token = tokens[tokens.length - 1][0] + if (token !== 'space' && token !== 'comment') break + this.tokenizer.back(tokens.pop()) + } + } + this.decl(tokens, customProperty) + } else { + this.unknownWord(tokens) + } + } + + rule(tokens) { + tokens.pop() + + let node = new Rule() + this.init(node, tokens[0][2]) + + node.raws.between = this.spacesAndCommentsFromEnd(tokens) + this.raw(node, 'selector', tokens) + this.current = node + } + + decl(tokens, customProperty) { + let node = new Declaration() + this.init(node, tokens[0][2]) + + let last = tokens[tokens.length - 1] + if (last[0] === ';') { + this.semicolon = true + tokens.pop() + } + + node.source.end = this.getPosition( + last[3] || last[2] || findLastWithPosition(tokens) + ) + + while (tokens[0][0] !== 'word') { + if (tokens.length === 1) this.unknownWord(tokens) + node.raws.before += tokens.shift()[1] + } + node.source.start = this.getPosition(tokens[0][2]) + + node.prop = '' + while (tokens.length) { + let type = tokens[0][0] + if (type === ':' || type === 'space' || type === 'comment') { + break + } + node.prop += tokens.shift()[1] + } + + node.raws.between = '' + + let token + while (tokens.length) { + token = tokens.shift() + + if (token[0] === ':') { + node.raws.between += token[1] + break + } else { + if (token[0] === 'word' && /\w/.test(token[1])) { + this.unknownWord([token]) + } + node.raws.between += token[1] + } + } + + if (node.prop[0] === '_' || node.prop[0] === '*') { + node.raws.before += node.prop[0] + node.prop = node.prop.slice(1) + } + + let firstSpaces = [] + let next + while (tokens.length) { + next = tokens[0][0] + if (next !== 'space' && next !== 'comment') break + firstSpaces.push(tokens.shift()) + } + + this.precheckMissedSemicolon(tokens) + + for (let i = tokens.length - 1; i >= 0; i--) { + token = tokens[i] + if (token[1].toLowerCase() === '!important') { + node.important = true + let string = this.stringFrom(tokens, i) + string = this.spacesFromEnd(tokens) + string + if (string !== ' !important') node.raws.important = string + break + } else if (token[1].toLowerCase() === 'important') { + let cache = tokens.slice(0) + let str = '' + for (let j = i; j > 0; j--) { + let type = cache[j][0] + if (str.trim().indexOf('!') === 0 && type !== 'space') { + break + } + str = cache.pop()[1] + str + } + if (str.trim().indexOf('!') === 0) { + node.important = true + node.raws.important = str + tokens = cache + } + } + + if (token[0] !== 'space' && token[0] !== 'comment') { + break + } + } + + let hasWord = tokens.some(i => i[0] !== 'space' && i[0] !== 'comment') + + if (hasWord) { + node.raws.between += firstSpaces.map(i => i[1]).join('') + firstSpaces = [] + } + this.raw(node, 'value', firstSpaces.concat(tokens), customProperty) + + if (node.value.includes(':') && !customProperty) { + this.checkMissedSemicolon(tokens) + } + } + + atrule(token) { + let node = new AtRule() + node.name = token[1].slice(1) + if (node.name === '') { + this.unnamedAtrule(node, token) + } + this.init(node, token[2]) + + let type + let prev + let shift + let last = false + let open = false + let params = [] + let brackets = [] + + while (!this.tokenizer.endOfFile()) { + token = this.tokenizer.nextToken() + type = token[0] + + if (type === '(' || type === '[') { + brackets.push(type === '(' ? ')' : ']') + } else if (type === '{' && brackets.length > 0) { + brackets.push('}') + } else if (type === brackets[brackets.length - 1]) { + brackets.pop() + } + + if (brackets.length === 0) { + if (type === ';') { + node.source.end = this.getPosition(token[2]) + this.semicolon = true + break + } else if (type === '{') { + open = true + break + } else if (type === '}') { + if (params.length > 0) { + shift = params.length - 1 + prev = params[shift] + while (prev && prev[0] === 'space') { + prev = params[--shift] + } + if (prev) { + node.source.end = this.getPosition(prev[3] || prev[2]) + } + } + this.end(token) + break + } else { + params.push(token) + } + } else { + params.push(token) + } + + if (this.tokenizer.endOfFile()) { + last = true + break + } + } + + node.raws.between = this.spacesAndCommentsFromEnd(params) + if (params.length) { + node.raws.afterName = this.spacesAndCommentsFromStart(params) + this.raw(node, 'params', params) + if (last) { + token = params[params.length - 1] + node.source.end = this.getPosition(token[3] || token[2]) + this.spaces = node.raws.between + node.raws.between = '' + } + } else { + node.raws.afterName = '' + node.params = '' + } + + if (open) { + node.nodes = [] + this.current = node + } + } + + end(token) { + if (this.current.nodes && this.current.nodes.length) { + this.current.raws.semicolon = this.semicolon + } + this.semicolon = false + + this.current.raws.after = (this.current.raws.after || '') + this.spaces + this.spaces = '' + + if (this.current.parent) { + this.current.source.end = this.getPosition(token[2]) + this.current = this.current.parent + } else { + this.unexpectedClose(token) + } + } + + endFile() { + if (this.current.parent) this.unclosedBlock() + if (this.current.nodes && this.current.nodes.length) { + this.current.raws.semicolon = this.semicolon + } + this.current.raws.after = (this.current.raws.after || '') + this.spaces + } + + freeSemicolon(token) { + this.spaces += token[1] + if (this.current.nodes) { + let prev = this.current.nodes[this.current.nodes.length - 1] + if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) { + prev.raws.ownSemicolon = this.spaces + this.spaces = '' + } + } + } + + // Helpers + + getPosition(offset) { + let pos = this.input.fromOffset(offset) + return { + offset, + line: pos.line, + column: pos.col + } + } + + init(node, offset) { + this.current.push(node) + node.source = { + start: this.getPosition(offset), + input: this.input + } + node.raws.before = this.spaces + this.spaces = '' + if (node.type !== 'comment') this.semicolon = false + } + + raw(node, prop, tokens, customProperty) { + let token, type + let length = tokens.length + let value = '' + let clean = true + let next, prev + + for (let i = 0; i < length; i += 1) { + token = tokens[i] + type = token[0] + if (type === 'space' && i === length - 1 && !customProperty) { + clean = false + } else if (type === 'comment') { + prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty' + next = tokens[i + 1] ? tokens[i + 1][0] : 'empty' + if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) { + if (value.slice(-1) === ',') { + clean = false + } else { + value += token[1] + } + } else { + clean = false + } + } else { + value += token[1] + } + } + if (!clean) { + let raw = tokens.reduce((all, i) => all + i[1], '') + node.raws[prop] = { value, raw } + } + node[prop] = value + } + + spacesAndCommentsFromEnd(tokens) { + let lastTokenType + let spaces = '' + while (tokens.length) { + lastTokenType = tokens[tokens.length - 1][0] + if (lastTokenType !== 'space' && lastTokenType !== 'comment') break + spaces = tokens.pop()[1] + spaces + } + return spaces + } + + spacesAndCommentsFromStart(tokens) { + let next + let spaces = '' + while (tokens.length) { + next = tokens[0][0] + if (next !== 'space' && next !== 'comment') break + spaces += tokens.shift()[1] + } + return spaces + } + + spacesFromEnd(tokens) { + let lastTokenType + let spaces = '' + while (tokens.length) { + lastTokenType = tokens[tokens.length - 1][0] + if (lastTokenType !== 'space') break + spaces = tokens.pop()[1] + spaces + } + return spaces + } + + stringFrom(tokens, from) { + let result = '' + for (let i = from; i < tokens.length; i++) { + result += tokens[i][1] + } + tokens.splice(from, tokens.length - from) + return result + } + + colon(tokens) { + let brackets = 0 + let token, type, prev + for (let [i, element] of tokens.entries()) { + token = element + type = token[0] + + if (type === '(') { + brackets += 1 + } + if (type === ')') { + brackets -= 1 + } + if (brackets === 0 && type === ':') { + if (!prev) { + this.doubleColon(token) + } else if (prev[0] === 'word' && prev[1] === 'progid') { + continue + } else { + return i + } + } + + prev = token + } + return false + } + + // Errors + + unclosedBracket(bracket) { + throw this.input.error( + 'Unclosed bracket', + { offset: bracket[2] }, + { offset: bracket[2] + 1 } + ) + } + + unknownWord(tokens) { + throw this.input.error( + 'Unknown word', + { offset: tokens[0][2] }, + { offset: tokens[0][2] + tokens[0][1].length } + ) + } + + unexpectedClose(token) { + throw this.input.error( + 'Unexpected }', + { offset: token[2] }, + { offset: token[2] + 1 } + ) + } + + unclosedBlock() { + let pos = this.current.source.start + throw this.input.error('Unclosed block', pos.line, pos.column) + } + + doubleColon(token) { + throw this.input.error( + 'Double colon', + { offset: token[2] }, + { offset: token[2] + token[1].length } + ) + } + + unnamedAtrule(node, token) { + throw this.input.error( + 'At-rule without name', + { offset: token[2] }, + { offset: token[2] + token[1].length } + ) + } + + precheckMissedSemicolon(/* tokens */) { + // Hook for Safe Parser + } + + checkMissedSemicolon(tokens) { + let colon = this.colon(tokens) + if (colon === false) return + + let founded = 0 + let token + for (let j = colon - 1; j >= 0; j--) { + token = tokens[j] + if (token[0] !== 'space') { + founded += 1 + if (founded === 2) break + } + } + // If the token is a word, e.g. `!important`, `red` or any other valid property's value. + // Then we need to return the colon after that word token. [3] is the "end" colon of that word. + // And because we need it after that one we do +1 to get the next one. + throw this.input.error( + 'Missed semicolon', + token[0] === 'word' ? token[3] + 1 : token[2] + ) + } +} + +module.exports = Parser diff --git a/frontend/node_modules/postcss/lib/postcss.d.ts b/frontend/node_modules/postcss/lib/postcss.d.ts new file mode 100644 index 00000000..30a0d088 --- /dev/null +++ b/frontend/node_modules/postcss/lib/postcss.d.ts @@ -0,0 +1,473 @@ +import { SourceMapGenerator, RawSourceMap } from 'source-map-js' + +import Node, { + Position, + Source, + ChildNode, + NodeErrorOptions, + NodeProps, + ChildProps, + AnyNode +} from './node.js' +import Declaration, { DeclarationProps } from './declaration.js' +import Container, { ContainerProps } from './container.js' +import Document, { DocumentProps } from './document.js' +import Warning, { WarningOptions } from './warning.js' +import Comment, { CommentProps } from './comment.js' +import AtRule, { AtRuleProps } from './at-rule.js' +import Input, { FilePosition } from './input.js' +import Result, { Message } from './result.js' +import Root, { RootProps } from './root.js' +import Rule, { RuleProps } from './rule.js' +import CssSyntaxError from './css-syntax-error.js' +import list, { List } from './list.js' +import LazyResult from './lazy-result.js' +import Processor from './processor.js' + +export { + NodeErrorOptions, + DeclarationProps, + CssSyntaxError, + ContainerProps, + WarningOptions, + DocumentProps, + FilePosition, + CommentProps, + AtRuleProps, + Declaration, + ChildProps, + LazyResult, + ChildNode, + NodeProps, + Processor, + RuleProps, + RootProps, + Container, + Position, + Document, + AnyNode, + Warning, + Message, + Comment, + Source, + AtRule, + Result, + Input, + Node, + list, + Rule, + Root +} + +export type SourceMap = SourceMapGenerator & { + toJSON(): RawSourceMap +} + +export type Helpers = { result: Result; postcss: Postcss } & Postcss + +type DocumentProcessor = ( + document: Document, + helper: Helpers +) => Promise | void +type RootProcessor = (root: Root, helper: Helpers) => Promise | void +type DeclarationProcessor = ( + decl: Declaration, + helper: Helpers +) => Promise | void +type RuleProcessor = (rule: Rule, helper: Helpers) => Promise | void +type AtRuleProcessor = (atRule: AtRule, helper: Helpers) => Promise | void +type CommentProcessor = ( + comment: Comment, + helper: Helpers +) => Promise | void + +interface Processors { + /** + * Will be called on `Document` node. + * + * Will be called again on children changes. + */ + Document?: DocumentProcessor + + /** + * Will be called on `Document` node, when all children will be processed. + * + * Will be called again on children changes. + */ + DocumentExit?: DocumentProcessor + + /** + * Will be called on `Root` node once. + */ + Once?: RootProcessor + + /** + * Will be called on `Root` node once, when all children will be processed. + */ + OnceExit?: RootProcessor + + /** + * Will be called on `Root` node. + * + * Will be called again on children changes. + */ + Root?: RootProcessor + + /** + * Will be called on `Root` node, when all children will be processed. + * + * Will be called again on children changes. + */ + RootExit?: RootProcessor + + /** + * Will be called on all `Declaration` nodes after listeners + * for `Declaration` event. + * + * Will be called again on node or children changes. + */ + Declaration?: DeclarationProcessor | { [prop: string]: DeclarationProcessor } + + /** + * Will be called on all `Declaration` nodes. + * + * Will be called again on node or children changes. + */ + DeclarationExit?: + | DeclarationProcessor + | { [prop: string]: DeclarationProcessor } + + /** + * Will be called on all `Rule` nodes. + * + * Will be called again on node or children changes. + */ + Rule?: RuleProcessor + + /** + * Will be called on all `Rule` nodes, when all children will be processed. + * + * Will be called again on node or children changes. + */ + RuleExit?: RuleProcessor + + /** + * Will be called on all`AtRule` nodes. + * + * Will be called again on node or children changes. + */ + AtRule?: AtRuleProcessor | { [name: string]: AtRuleProcessor } + + /** + * Will be called on all `AtRule` nodes, when all children will be processed. + * + * Will be called again on node or children changes. + */ + AtRuleExit?: AtRuleProcessor | { [name: string]: AtRuleProcessor } + + /** + * Will be called on all `Comment` nodes. + * + * Will be called again on node or children changes. + */ + Comment?: CommentProcessor + + /** + * Will be called on all `Comment` nodes after listeners + * for `Comment` event. + * + * Will be called again on node or children changes. + */ + CommentExit?: CommentProcessor + + /** + * Will be called when all other listeners processed the document. + * + * This listener will not be called again. + */ + Exit?: RootProcessor +} + +export interface Plugin extends Processors { + postcssPlugin: string + prepare?: (result: Result) => Processors +} + +export interface PluginCreator { + (opts?: PluginOptions): Plugin | Processor + postcss: true +} + +export interface Transformer extends TransformCallback { + postcssPlugin: string + postcssVersion: string +} + +export interface TransformCallback { + (root: Root, result: Result): Promise | void +} + +export interface OldPlugin extends Transformer { + (opts?: T): Transformer + postcss: Transformer +} + +export type AcceptedPlugin = + | Plugin + | PluginCreator + | OldPlugin + | TransformCallback + | { + postcss: TransformCallback | Processor + } + | Processor + +export interface Parser { + ( + css: string | { toString(): string }, + opts?: Pick + ): RootNode +} + +export interface Builder { + (part: string, node?: AnyNode, type?: 'start' | 'end'): void +} + +export interface Stringifier { + (node: AnyNode, builder: Builder): void +} + +export interface JSONHydrator { + (data: object[]): Node[] + (data: object): Node +} + +export interface Syntax { + /** + * Function to generate AST by string. + */ + parse?: Parser + + /** + * Class to generate string by AST. + */ + stringify?: Stringifier +} + +export interface SourceMapOptions { + /** + * Indicates that the source map should be embedded in the output CSS + * as a Base64-encoded comment. By default, it is `true`. + * But if all previous maps are external, not inline, PostCSS will not embed + * the map even if you do not set this option. + * + * If you have an inline source map, the result.map property will be empty, + * as the source map will be contained within the text of `result.css`. + */ + inline?: boolean + + /** + * Source map content from a previous processing step (e.g., Sass). + * + * PostCSS will try to read the previous source map + * automatically (based on comments within the source CSS), but you can use + * this option to identify it manually. + * + * If desired, you can omit the previous map with prev: `false`. + */ + prev?: string | boolean | object | ((file: string) => string) + + /** + * Indicates that PostCSS should set the origin content (e.g., Sass source) + * of the source map. By default, it is true. But if all previous maps do not + * contain sources content, PostCSS will also leave it out even if you + * do not set this option. + */ + sourcesContent?: boolean + + /** + * Indicates that PostCSS should add annotation comments to the CSS. + * By default, PostCSS will always add a comment with a path + * to the source map. PostCSS will not add annotations to CSS files + * that do not contain any comments. + * + * By default, PostCSS presumes that you want to save the source map as + * `opts.to + '.map'` and will use this path in the annotation comment. + * A different path can be set by providing a string value for annotation. + * + * If you have set `inline: true`, annotation cannot be disabled. + */ + annotation?: string | boolean | ((file: string, root: Root) => string) + + /** + * Override `from` in map’s sources. + */ + from?: string + + /** + * Use absolute path in generated source map. + */ + absolute?: boolean +} + +export interface ProcessOptions { + /** + * The path of the CSS source file. You should always set `from`, + * because it is used in source map generation and syntax error messages. + */ + from?: string + + /** + * The path where you'll put the output CSS file. You should always set `to` + * to generate correct source maps. + */ + to?: string + + /** + * Function to generate AST by string. + */ + parser?: Syntax | Parser + + /** + * Class to generate string by AST. + */ + stringifier?: Syntax | Stringifier + + /** + * Object with parse and stringify. + */ + syntax?: Syntax + + /** + * Source map options + */ + map?: SourceMapOptions | boolean +} + +export interface Postcss { + /** + * Create a new `Processor` instance that will apply `plugins` + * as CSS processors. + * + * ```js + * let postcss = require('postcss') + * + * postcss(plugins).process(css, { from, to }).then(result => { + * console.log(result.css) + * }) + * ``` + * + * @param plugins PostCSS plugins. + * @return Processor to process multiple CSS. + */ + (plugins?: AcceptedPlugin[]): Processor + (...plugins: AcceptedPlugin[]): Processor + + /** + * Default function to convert a node tree into a CSS string. + */ + stringify: Stringifier + + /** + * Parses source css and returns a new `Root` or `Document` node, + * which contains the source CSS nodes. + * + * ```js + * // Simple CSS concatenation with source map support + * const root1 = postcss.parse(css1, { from: file1 }) + * const root2 = postcss.parse(css2, { from: file2 }) + * root1.append(root2).toResult().css + * ``` + */ + parse: Parser + + /** + * Rehydrate a JSON AST (from `Node#toJSON`) back into the AST classes. + * + * ```js + * const json = root.toJSON() + * // save to file, send by network, etc + * const root2 = postcss.fromJSON(json) + * ``` + */ + fromJSON: JSONHydrator + + /** + * Contains the `list` module. + */ + list: List + + /** + * Creates a new `Comment` node. + * + * @param defaults Properties for the new node. + * @return New comment node + */ + comment(defaults?: CommentProps): Comment + + /** + * Creates a new `AtRule` node. + * + * @param defaults Properties for the new node. + * @return New at-rule node. + */ + atRule(defaults?: AtRuleProps): AtRule + + /** + * Creates a new `Declaration` node. + * + * @param defaults Properties for the new node. + * @return New declaration node. + */ + decl(defaults?: DeclarationProps): Declaration + + /** + * Creates a new `Rule` node. + * + * @param default Properties for the new node. + * @return New rule node. + */ + rule(defaults?: RuleProps): Rule + + /** + * Creates a new `Root` node. + * + * @param defaults Properties for the new node. + * @return New root node. + */ + root(defaults?: RootProps): Root + + /** + * Creates a new `Document` node. + * + * @param defaults Properties for the new node. + * @return New document node. + */ + document(defaults?: DocumentProps): Document + + CssSyntaxError: typeof CssSyntaxError + Declaration: typeof Declaration + Container: typeof Container + Comment: typeof Comment + Warning: typeof Warning + AtRule: typeof AtRule + Result: typeof Result + Input: typeof Input + Rule: typeof Rule + Root: typeof Root + Node: typeof Node +} + +export const stringify: Stringifier +export const parse: Parser +export const fromJSON: JSONHydrator + +export const comment: Postcss['comment'] +export const atRule: Postcss['atRule'] +export const decl: Postcss['decl'] +export const rule: Postcss['rule'] +export const root: Postcss['root'] + +declare const postcss: Postcss + +export default postcss diff --git a/frontend/node_modules/postcss/lib/postcss.js b/frontend/node_modules/postcss/lib/postcss.js new file mode 100644 index 00000000..d3f640e4 --- /dev/null +++ b/frontend/node_modules/postcss/lib/postcss.js @@ -0,0 +1,99 @@ +'use strict' + +let CssSyntaxError = require('./css-syntax-error') +let Declaration = require('./declaration') +let LazyResult = require('./lazy-result') +let Container = require('./container') +let Processor = require('./processor') +let stringify = require('./stringify') +let fromJSON = require('./fromJSON') +let Document = require('./document') +let Warning = require('./warning') +let Comment = require('./comment') +let AtRule = require('./at-rule') +let Result = require('./result.js') +let Input = require('./input') +let parse = require('./parse') +let list = require('./list') +let Rule = require('./rule') +let Root = require('./root') +let Node = require('./node') + +function postcss(...plugins) { + if (plugins.length === 1 && Array.isArray(plugins[0])) { + plugins = plugins[0] + } + return new Processor(plugins) +} + +postcss.plugin = function plugin(name, initializer) { + // eslint-disable-next-line no-console + if (console && console.warn) { + // eslint-disable-next-line no-console + console.warn( + name + + ': postcss.plugin was deprecated. Migration guide:\n' + + 'https://evilmartians.com/chronicles/postcss-8-plugin-migration' + ) + if (process.env.LANG && process.env.LANG.startsWith('cn')) { + /* c8 ignore next 7 */ + // eslint-disable-next-line no-console + console.warn( + name + + ': 里面 postcss.plugin 被弃用. 迁移指南:\n' + + 'https://www.w3ctech.com/topic/2226' + ) + } + } + function creator(...args) { + let transformer = initializer(...args) + transformer.postcssPlugin = name + transformer.postcssVersion = new Processor().version + return transformer + } + + let cache + Object.defineProperty(creator, 'postcss', { + get() { + if (!cache) cache = creator() + return cache + } + }) + + creator.process = function (css, processOpts, pluginOpts) { + return postcss([creator(pluginOpts)]).process(css, processOpts) + } + + return creator +} + +postcss.stringify = stringify +postcss.parse = parse +postcss.fromJSON = fromJSON +postcss.list = list + +postcss.comment = defaults => new Comment(defaults) +postcss.atRule = defaults => new AtRule(defaults) +postcss.decl = defaults => new Declaration(defaults) +postcss.rule = defaults => new Rule(defaults) +postcss.root = defaults => new Root(defaults) +postcss.document = defaults => new Document(defaults) + +postcss.CssSyntaxError = CssSyntaxError +postcss.Declaration = Declaration +postcss.Container = Container +postcss.Processor = Processor +postcss.Document = Document +postcss.Comment = Comment +postcss.Warning = Warning +postcss.AtRule = AtRule +postcss.Result = Result +postcss.Input = Input +postcss.Rule = Rule +postcss.Root = Root +postcss.Node = Node + +LazyResult.registerPostcss(postcss) + +module.exports = postcss +postcss.default = postcss diff --git a/frontend/node_modules/postcss/lib/postcss.mjs b/frontend/node_modules/postcss/lib/postcss.mjs new file mode 100644 index 00000000..35075988 --- /dev/null +++ b/frontend/node_modules/postcss/lib/postcss.mjs @@ -0,0 +1,30 @@ +import postcss from './postcss.js' + +export default postcss + +export const stringify = postcss.stringify +export const fromJSON = postcss.fromJSON +export const plugin = postcss.plugin +export const parse = postcss.parse +export const list = postcss.list + +export const document = postcss.document +export const comment = postcss.comment +export const atRule = postcss.atRule +export const rule = postcss.rule +export const decl = postcss.decl +export const root = postcss.root + +export const CssSyntaxError = postcss.CssSyntaxError +export const Declaration = postcss.Declaration +export const Container = postcss.Container +export const Processor = postcss.Processor +export const Document = postcss.Document +export const Comment = postcss.Comment +export const Warning = postcss.Warning +export const AtRule = postcss.AtRule +export const Result = postcss.Result +export const Input = postcss.Input +export const Rule = postcss.Rule +export const Root = postcss.Root +export const Node = postcss.Node diff --git a/frontend/node_modules/postcss/lib/previous-map.d.ts b/frontend/node_modules/postcss/lib/previous-map.d.ts new file mode 100644 index 00000000..490d885f --- /dev/null +++ b/frontend/node_modules/postcss/lib/previous-map.d.ts @@ -0,0 +1,72 @@ +import { SourceMapConsumer } from 'source-map-js' + +import { ProcessOptions } from './postcss.js' + +/** + * Source map information from input CSS. + * For example, source map after Sass compiler. + * + * This class will automatically find source map in input CSS or in file system + * near input file (according `from` option). + * + * ```js + * const root = parse(css, { from: 'a.sass.css' }) + * root.input.map //=> PreviousMap + * ``` + */ +export default class PreviousMap { + /** + * Was source map inlined by data-uri to input CSS. + */ + inline: boolean + + /** + * `sourceMappingURL` content. + */ + annotation?: string + + /** + * Source map file content. + */ + text?: string + + /** + * The directory with source map file, if source map is in separated file. + */ + root?: string + + /** + * The CSS source identifier. Contains `Input#file` if the user + * set the `from` option, or `Input#id` if they did not. + */ + file?: string + + /** + * Path to source map file. + */ + mapFile?: string + + /** + * @param css Input CSS source. + * @param opts Process options. + */ + constructor(css: string, opts?: ProcessOptions) + + /** + * Create a instance of `SourceMapGenerator` class + * from the `source-map` library to work with source map information. + * + * It is lazy method, so it will create object only on first call + * and then it will use cache. + * + * @return Object with source map information. + */ + consumer(): SourceMapConsumer + + /** + * Does source map contains `sourcesContent` with input source text. + * + * @return Is `sourcesContent` present. + */ + withContent(): boolean +} diff --git a/frontend/node_modules/postcss/lib/previous-map.js b/frontend/node_modules/postcss/lib/previous-map.js new file mode 100644 index 00000000..d13a93a3 --- /dev/null +++ b/frontend/node_modules/postcss/lib/previous-map.js @@ -0,0 +1,142 @@ +'use strict' + +let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') +let { existsSync, readFileSync } = require('fs') +let { dirname, join } = require('path') + +function fromBase64(str) { + if (Buffer) { + return Buffer.from(str, 'base64').toString() + } else { + /* c8 ignore next 2 */ + return window.atob(str) + } +} + +class PreviousMap { + constructor(css, opts) { + if (opts.map === false) return + this.loadAnnotation(css) + this.inline = this.startWith(this.annotation, 'data:') + + let prev = opts.map ? opts.map.prev : undefined + let text = this.loadMap(opts.from, prev) + if (!this.mapFile && opts.from) { + this.mapFile = opts.from + } + if (this.mapFile) this.root = dirname(this.mapFile) + if (text) this.text = text + } + + consumer() { + if (!this.consumerCache) { + this.consumerCache = new SourceMapConsumer(this.text) + } + return this.consumerCache + } + + withContent() { + return !!( + this.consumer().sourcesContent && + this.consumer().sourcesContent.length > 0 + ) + } + + startWith(string, start) { + if (!string) return false + return string.substr(0, start.length) === start + } + + getAnnotationURL(sourceMapString) { + return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim() + } + + loadAnnotation(css) { + let comments = css.match(/\/\*\s*# sourceMappingURL=/gm) + if (!comments) return + + // sourceMappingURLs from comments, strings, etc. + let start = css.lastIndexOf(comments.pop()) + let end = css.indexOf('*/', start) + + if (start > -1 && end > -1) { + // Locate the last sourceMappingURL to avoid pickin + this.annotation = this.getAnnotationURL(css.substring(start, end)) + } + } + + decodeInline(text) { + let baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/ + let baseUri = /^data:application\/json;base64,/ + let charsetUri = /^data:application\/json;charset=utf-?8,/ + let uri = /^data:application\/json,/ + + if (charsetUri.test(text) || uri.test(text)) { + return decodeURIComponent(text.substr(RegExp.lastMatch.length)) + } + + if (baseCharsetUri.test(text) || baseUri.test(text)) { + return fromBase64(text.substr(RegExp.lastMatch.length)) + } + + let encoding = text.match(/data:application\/json;([^,]+),/)[1] + throw new Error('Unsupported source map encoding ' + encoding) + } + + loadFile(path) { + this.root = dirname(path) + if (existsSync(path)) { + this.mapFile = path + return readFileSync(path, 'utf-8').toString().trim() + } + } + + loadMap(file, prev) { + if (prev === false) return false + + if (prev) { + if (typeof prev === 'string') { + return prev + } else if (typeof prev === 'function') { + let prevPath = prev(file) + if (prevPath) { + let map = this.loadFile(prevPath) + if (!map) { + throw new Error( + 'Unable to load previous source map: ' + prevPath.toString() + ) + } + return map + } + } else if (prev instanceof SourceMapConsumer) { + return SourceMapGenerator.fromSourceMap(prev).toString() + } else if (prev instanceof SourceMapGenerator) { + return prev.toString() + } else if (this.isMap(prev)) { + return JSON.stringify(prev) + } else { + throw new Error( + 'Unsupported previous source map format: ' + prev.toString() + ) + } + } else if (this.inline) { + return this.decodeInline(this.annotation) + } else if (this.annotation) { + let map = this.annotation + if (file) map = join(dirname(file), map) + return this.loadFile(map) + } + } + + isMap(map) { + if (typeof map !== 'object') return false + return ( + typeof map.mappings === 'string' || + typeof map._mappings === 'string' || + Array.isArray(map.sections) + ) + } +} + +module.exports = PreviousMap +PreviousMap.default = PreviousMap diff --git a/frontend/node_modules/postcss/lib/processor.d.ts b/frontend/node_modules/postcss/lib/processor.d.ts new file mode 100644 index 00000000..19a36538 --- /dev/null +++ b/frontend/node_modules/postcss/lib/processor.d.ts @@ -0,0 +1,102 @@ +import { + AcceptedPlugin, + Plugin, + ProcessOptions, + Transformer, + TransformCallback +} from './postcss.js' +import LazyResult from './lazy-result.js' +import Result from './result.js' +import Root from './root.js' +import NoWorkResult from './no-work-result.js' + +/** + * Contains plugins to process CSS. Create one `Processor` instance, + * initialize its plugins, and then use that instance on numerous CSS files. + * + * ```js + * const processor = postcss([autoprefixer, postcssNested]) + * processor.process(css1).then(result => console.log(result.css)) + * processor.process(css2).then(result => console.log(result.css)) + * ``` + */ +export default class Processor { + /** + * Current PostCSS version. + * + * ```js + * if (result.processor.version.split('.')[0] !== '6') { + * throw new Error('This plugin works only with PostCSS 6') + * } + * ``` + */ + version: string + + /** + * Plugins added to this processor. + * + * ```js + * const processor = postcss([autoprefixer, postcssNested]) + * processor.plugins.length //=> 2 + * ``` + */ + plugins: (Plugin | Transformer | TransformCallback)[] + + /** + * @param plugins PostCSS plugins + */ + constructor(plugins?: AcceptedPlugin[]) + + /** + * Adds a plugin to be used as a CSS processor. + * + * PostCSS plugin can be in 4 formats: + * * A plugin in `Plugin` format. + * * A plugin creator function with `pluginCreator.postcss = true`. + * PostCSS will call this function without argument to get plugin. + * * A function. PostCSS will pass the function a @{link Root} + * as the first argument and current `Result` instance + * as the second. + * * Another `Processor` instance. PostCSS will copy plugins + * from that instance into this one. + * + * Plugins can also be added by passing them as arguments when creating + * a `postcss` instance (see [`postcss(plugins)`]). + * + * Asynchronous plugins should return a `Promise` instance. + * + * ```js + * const processor = postcss() + * .use(autoprefixer) + * .use(postcssNested) + * ``` + * + * @param plugin PostCSS plugin or `Processor` with plugins. + * @return Current processor to make methods chain. + */ + use(plugin: AcceptedPlugin): this + + /** + * Parses source CSS and returns a `LazyResult` Promise proxy. + * Because some plugins can be asynchronous it doesn’t make + * any transformations. Transformations will be applied + * in the `LazyResult` methods. + * + * ```js + * processor.process(css, { from: 'a.css', to: 'a.out.css' }) + * .then(result => { + * console.log(result.css) + * }) + * ``` + * + * @param css String with input CSS or any object with a `toString()` method, + * like a Buffer. Optionally, senda `Result` instance + * and the processor will take the `Root` from it. + * @param opts Options. + * @return Promise proxy. + */ + process( + css: string | { toString(): string } | Result | LazyResult | Root, + options?: ProcessOptions + ): LazyResult | NoWorkResult +} diff --git a/frontend/node_modules/postcss/lib/processor.js b/frontend/node_modules/postcss/lib/processor.js new file mode 100644 index 00000000..555a925f --- /dev/null +++ b/frontend/node_modules/postcss/lib/processor.js @@ -0,0 +1,67 @@ +'use strict' + +let NoWorkResult = require('./no-work-result') +let LazyResult = require('./lazy-result') +let Document = require('./document') +let Root = require('./root') + +class Processor { + constructor(plugins = []) { + this.version = '8.4.13' + this.plugins = this.normalize(plugins) + } + + use(plugin) { + this.plugins = this.plugins.concat(this.normalize([plugin])) + return this + } + + process(css, opts = {}) { + if ( + this.plugins.length === 0 && + typeof opts.parser === 'undefined' && + typeof opts.stringifier === 'undefined' && + typeof opts.syntax === 'undefined' + ) { + return new NoWorkResult(this, css, opts) + } else { + return new LazyResult(this, css, opts) + } + } + + normalize(plugins) { + let normalized = [] + for (let i of plugins) { + if (i.postcss === true) { + i = i() + } else if (i.postcss) { + i = i.postcss + } + + if (typeof i === 'object' && Array.isArray(i.plugins)) { + normalized = normalized.concat(i.plugins) + } else if (typeof i === 'object' && i.postcssPlugin) { + normalized.push(i) + } else if (typeof i === 'function') { + normalized.push(i) + } else if (typeof i === 'object' && (i.parse || i.stringify)) { + if (process.env.NODE_ENV !== 'production') { + throw new Error( + 'PostCSS syntaxes cannot be used as plugins. Instead, please use ' + + 'one of the syntax/parser/stringifier options as outlined ' + + 'in your PostCSS runner documentation.' + ) + } + } else { + throw new Error(i + ' is not a PostCSS plugin') + } + } + return normalized + } +} + +module.exports = Processor +Processor.default = Processor + +Root.registerProcessor(Processor) +Document.registerProcessor(Processor) diff --git a/frontend/node_modules/postcss/lib/result.d.ts b/frontend/node_modules/postcss/lib/result.d.ts new file mode 100644 index 00000000..8a582b69 --- /dev/null +++ b/frontend/node_modules/postcss/lib/result.d.ts @@ -0,0 +1,196 @@ +import { + ProcessOptions, + Plugin, + SourceMap, + TransformCallback, + Root, + Document, + Node, + Warning, + WarningOptions +} from './postcss.js' +import Processor from './processor.js' + +export interface Message { + /** + * Message type. + */ + type: string + + /** + * Source PostCSS plugin name. + */ + plugin?: string + + [others: string]: any +} + +export interface ResultOptions extends ProcessOptions { + /** + * The CSS node that was the source of the warning. + */ + node?: Node + + /** + * Name of plugin that created this warning. `Result#warn` will fill it + * automatically with `Plugin#postcssPlugin` value. + */ + plugin?: string +} + +/** + * Provides the result of the PostCSS transformations. + * + * A Result instance is returned by `LazyResult#then` + * or `Root#toResult` methods. + * + * ```js + * postcss([autoprefixer]).process(css).then(result => { + * console.log(result.css) + * }) + * ``` + * + * ```js + * const result2 = postcss.parse(css).toResult() + * ``` + */ +export default class Result { + /** + * The Processor instance used for this transformation. + * + * ```js + * for (const plugin of result.processor.plugins) { + * if (plugin.postcssPlugin === 'postcss-bad') { + * throw 'postcss-good is incompatible with postcss-bad' + * } + * }) + * ``` + */ + processor: Processor + + /** + * Contains messages from plugins (e.g., warnings or custom messages). + * Each message should have type and plugin properties. + * + * ```js + * AtRule: { + * import: (atRule, { result }) { + * const importedFile = parseImport(atRule) + * result.messages.push({ + * type: 'dependency', + * plugin: 'postcss-import', + * file: importedFile, + * parent: result.opts.from + * }) + * } + * } + * ``` + */ + messages: Message[] + + /** + * Root node after all transformations. + * + * ```js + * root.toResult().root === root + * ``` + */ + root: Root | Document + + /** + * Options from the `Processor#process` or `Root#toResult` call + * that produced this Result instance.] + * + * ```js + * root.toResult(opts).opts === opts + * ``` + */ + opts: ResultOptions + + /** + * A CSS string representing of `Result#root`. + * + * ```js + * postcss.parse('a{}').toResult().css //=> "a{}" + * ``` + */ + css: string + + /** + * An instance of `SourceMapGenerator` class from the `source-map` library, + * representing changes to the `Result#root` instance. + * + * ```js + * result.map.toJSON() //=> { version: 3, file: 'a.css', … } + * ``` + * + * ```js + * if (result.map) { + * fs.writeFileSync(result.opts.to + '.map', result.map.toString()) + * } + * ``` + */ + map: SourceMap + + /** + * Last runned PostCSS plugin. + */ + lastPlugin: Plugin | TransformCallback + + /** + * @param processor Processor used for this transformation. + * @param root Root node after all transformations. + * @param opts Options from the `Processor#process` or `Root#toResult`. + */ + constructor(processor: Processor, root: Root | Document, opts: ResultOptions) + + /** + * An alias for the `Result#css` property. + * Use it with syntaxes that generate non-CSS output. + * + * ```js + * result.css === result.content + * ``` + */ + get content(): string + + /** + * Returns for `Result#css` content. + * + * ```js + * result + '' === result.css + * ``` + * + * @return String representing of `Result#root`. + */ + toString(): string + + /** + * Creates an instance of `Warning` and adds it to `Result#messages`. + * + * ```js + * if (decl.important) { + * result.warn('Avoid !important', { node: decl, word: '!important' }) + * } + * ``` + * + * @param text Warning message. + * @param opts Warning options. + * @return Created warning. + */ + warn(message: string, options?: WarningOptions): Warning + + /** + * Returns warnings from plugins. Filters `Warning` instances + * from `Result#messages`. + * + * ```js + * result.warnings().forEach(warn => { + * console.warn(warn.toString()) + * }) + * ``` + * + * @return Warnings from plugins. + */ + warnings(): Warning[] +} diff --git a/frontend/node_modules/postcss/lib/result.js b/frontend/node_modules/postcss/lib/result.js new file mode 100644 index 00000000..a39751de --- /dev/null +++ b/frontend/node_modules/postcss/lib/result.js @@ -0,0 +1,42 @@ +'use strict' + +let Warning = require('./warning') + +class Result { + constructor(processor, root, opts) { + this.processor = processor + this.messages = [] + this.root = root + this.opts = opts + this.css = undefined + this.map = undefined + } + + toString() { + return this.css + } + + warn(text, opts = {}) { + if (!opts.plugin) { + if (this.lastPlugin && this.lastPlugin.postcssPlugin) { + opts.plugin = this.lastPlugin.postcssPlugin + } + } + + let warning = new Warning(text, opts) + this.messages.push(warning) + + return warning + } + + warnings() { + return this.messages.filter(i => i.type === 'warning') + } + + get content() { + return this.css + } +} + +module.exports = Result +Result.default = Result diff --git a/frontend/node_modules/postcss/lib/root.d.ts b/frontend/node_modules/postcss/lib/root.d.ts new file mode 100644 index 00000000..251b92b4 --- /dev/null +++ b/frontend/node_modules/postcss/lib/root.d.ts @@ -0,0 +1,73 @@ +import Container, { ContainerProps } from './container.js' +import Document from './document.js' +import { ProcessOptions } from './postcss.js' +import Result from './result.js' + +interface RootRaws extends Record { + /** + * The space symbols after the last child to the end of file. + */ + after?: string + + /** + * Non-CSS code before `Root`, when `Root` is inside `Document`. + * + * **Experimental:** some aspects of this node could change within minor + * or patch version releases. + */ + codeBefore?: string + + /** + * Non-CSS code after `Root`, when `Root` is inside `Document`. + * + * **Experimental:** some aspects of this node could change within minor + * or patch version releases. + */ + codeAfter?: string + + /** + * Is the last child has an (optional) semicolon. + */ + semicolon?: boolean +} + +export interface RootProps extends ContainerProps { + /** + * Information used to generate byte-to-byte equal node string + * as it was in the origin input. + * */ + raws?: RootRaws +} + +/** + * Represents a CSS file and contains all its parsed nodes. + * + * ```js + * const root = postcss.parse('a{color:black} b{z-index:2}') + * root.type //=> 'root' + * root.nodes.length //=> 2 + * ``` + */ +export default class Root extends Container { + type: 'root' + parent: Document | undefined + raws: RootRaws + + /** + * Returns a `Result` instance representing the root’s CSS. + * + * ```js + * const root1 = postcss.parse(css1, { from: 'a.css' }) + * const root2 = postcss.parse(css2, { from: 'b.css' }) + * root1.append(root2) + * const result = root1.toResult({ to: 'all.css', map: true }) + * ``` + * + * @param opts Options. + * @return Result with current root’s CSS. + */ + toResult(options?: ProcessOptions): Result + + constructor(defaults?: RootProps) + assign(overrides: object | RootProps): this +} diff --git a/frontend/node_modules/postcss/lib/root.js b/frontend/node_modules/postcss/lib/root.js new file mode 100644 index 00000000..18e4ceaf --- /dev/null +++ b/frontend/node_modules/postcss/lib/root.js @@ -0,0 +1,59 @@ +'use strict' + +let Container = require('./container') + +let LazyResult, Processor + +class Root extends Container { + constructor(defaults) { + super(defaults) + this.type = 'root' + if (!this.nodes) this.nodes = [] + } + + removeChild(child, ignore) { + let index = this.index(child) + + if (!ignore && index === 0 && this.nodes.length > 1) { + this.nodes[1].raws.before = this.nodes[index].raws.before + } + + return super.removeChild(child) + } + + normalize(child, sample, type) { + let nodes = super.normalize(child) + + if (sample) { + if (type === 'prepend') { + if (this.nodes.length > 1) { + sample.raws.before = this.nodes[1].raws.before + } else { + delete sample.raws.before + } + } else if (this.first !== sample) { + for (let node of nodes) { + node.raws.before = sample.raws.before + } + } + } + + return nodes + } + + toResult(opts = {}) { + let lazy = new LazyResult(new Processor(), this, opts) + return lazy.stringify() + } +} + +Root.registerLazyResult = dependant => { + LazyResult = dependant +} + +Root.registerProcessor = dependant => { + Processor = dependant +} + +module.exports = Root +Root.default = Root diff --git a/frontend/node_modules/postcss/lib/rule.d.ts b/frontend/node_modules/postcss/lib/rule.d.ts new file mode 100644 index 00000000..ad6abb5f --- /dev/null +++ b/frontend/node_modules/postcss/lib/rule.d.ts @@ -0,0 +1,104 @@ +import Container, { ContainerProps } from './container.js' + +interface RuleRaws extends Record { + /** + * The space symbols before the node. It also stores `*` + * and `_` symbols before the declaration (IE hack). + */ + before?: string + + /** + * The space symbols after the last child of the node to the end of the node. + */ + after?: string + + /** + * The symbols between the selector and `{` for rules. + */ + between?: string + + /** + * Contains `true` if the last child has an (optional) semicolon. + */ + semicolon?: boolean + + /** + * Contains `true` if there is semicolon after rule. + */ + ownSemicolon?: string + + /** + * The rule’s selector with comments. + */ + selector?: { + value: string + raw: string + } +} + +export interface RuleProps extends ContainerProps { + /** Selector or selectors of the rule. */ + selector?: string + /** Selectors of the rule represented as an array of strings. */ + selectors?: string[] + /** Information used to generate byte-to-byte equal node string as it was in the origin input. */ + raws?: RuleRaws +} + +/** + * Represents a CSS rule: a selector followed by a declaration block. + * + * ```js + * Once (root, { Rule }) { + * let a = new Rule({ selector: 'a' }) + * a.append(…) + * root.append(a) + * } + * ``` + * + * ```js + * const root = postcss.parse('a{}') + * const rule = root.first + * rule.type //=> 'rule' + * rule.toString() //=> 'a{}' + * ``` + */ +export default class Rule extends Container { + type: 'rule' + parent: Container | undefined + raws: RuleRaws + + /** + * The rule’s full selector represented as a string. + * + * ```js + * const root = postcss.parse('a, b { }') + * const rule = root.first + * rule.selector //=> 'a, b' + * ``` + */ + selector: string + + /** + * An array containing the rule’s individual selectors. + * Groups of selectors are split at commas. + * + * ```js + * const root = postcss.parse('a, b { }') + * const rule = root.first + * + * rule.selector //=> 'a, b' + * rule.selectors //=> ['a', 'b'] + * + * rule.selectors = ['a', 'strong'] + * rule.selector //=> 'a, strong' + * ``` + */ + selectors: string[] + + constructor(defaults?: RuleProps) + assign(overrides: object | RuleProps): this + clone(overrides?: Partial): this + cloneBefore(overrides?: Partial): this + cloneAfter(overrides?: Partial): this +} diff --git a/frontend/node_modules/postcss/lib/rule.js b/frontend/node_modules/postcss/lib/rule.js new file mode 100644 index 00000000..a93ab25b --- /dev/null +++ b/frontend/node_modules/postcss/lib/rule.js @@ -0,0 +1,27 @@ +'use strict' + +let Container = require('./container') +let list = require('./list') + +class Rule extends Container { + constructor(defaults) { + super(defaults) + this.type = 'rule' + if (!this.nodes) this.nodes = [] + } + + get selectors() { + return list.comma(this.selector) + } + + set selectors(values) { + let match = this.selector ? this.selector.match(/,\s*/) : null + let sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen') + this.selector = values.join(sep) + } +} + +module.exports = Rule +Rule.default = Rule + +Container.registerRule(Rule) diff --git a/frontend/node_modules/postcss/lib/stringifier.d.ts b/frontend/node_modules/postcss/lib/stringifier.d.ts new file mode 100644 index 00000000..23289dfb --- /dev/null +++ b/frontend/node_modules/postcss/lib/stringifier.d.ts @@ -0,0 +1,37 @@ +import { + Document, + Root, + Comment, + Declaration, + Builder, + AnyNode, + Rule, + AtRule, + Container +} from './postcss.js' + +export default class Stringifier { + builder: Builder + constructor(builder: Builder) + stringify(node: AnyNode, semicolon?: boolean): void + document(node: Document): void + root(node: Root): void + comment(node: Comment): void + decl(node: Declaration, semicolon?: boolean): void + rule(node: Rule): void + atrule(node: AtRule, semicolon?: boolean): void + body(node: Container): void + block(node: AnyNode, start: string): void + raw(node: AnyNode, own: string | null, detect?: string): string + rawSemicolon(root: Root): boolean | undefined + rawEmptyBody(root: Root): string | undefined + rawIndent(root: Root): string | undefined + rawBeforeComment(root: Root, node: Comment): string | undefined + rawBeforeDecl(root: Root, node: Declaration): string | undefined + rawBeforeRule(root: Root): string | undefined + rawBeforeClose(root: Root): string | undefined + rawBeforeOpen(root: Root): string | undefined + rawColon(root: Root): string | undefined + beforeAfter(node: AnyNode, detect: 'before' | 'after'): string + rawValue(node: AnyNode, prop: string): string +} diff --git a/frontend/node_modules/postcss/lib/stringifier.js b/frontend/node_modules/postcss/lib/stringifier.js new file mode 100644 index 00000000..4065c475 --- /dev/null +++ b/frontend/node_modules/postcss/lib/stringifier.js @@ -0,0 +1,353 @@ +'use strict' + +const DEFAULT_RAW = { + colon: ': ', + indent: ' ', + beforeDecl: '\n', + beforeRule: '\n', + beforeOpen: ' ', + beforeClose: '\n', + beforeComment: '\n', + after: '\n', + emptyBody: '', + commentLeft: ' ', + commentRight: ' ', + semicolon: false +} + +function capitalize(str) { + return str[0].toUpperCase() + str.slice(1) +} + +class Stringifier { + constructor(builder) { + this.builder = builder + } + + stringify(node, semicolon) { + /* c8 ignore start */ + if (!this[node.type]) { + throw new Error( + 'Unknown AST node type ' + + node.type + + '. ' + + 'Maybe you need to change PostCSS stringifier.' + ) + } + /* c8 ignore stop */ + this[node.type](node, semicolon) + } + + document(node) { + this.body(node) + } + + root(node) { + this.body(node) + if (node.raws.after) this.builder(node.raws.after) + } + + comment(node) { + let left = this.raw(node, 'left', 'commentLeft') + let right = this.raw(node, 'right', 'commentRight') + this.builder('/*' + left + node.text + right + '*/', node) + } + + decl(node, semicolon) { + let between = this.raw(node, 'between', 'colon') + let string = node.prop + between + this.rawValue(node, 'value') + + if (node.important) { + string += node.raws.important || ' !important' + } + + if (semicolon) string += ';' + this.builder(string, node) + } + + rule(node) { + this.block(node, this.rawValue(node, 'selector')) + if (node.raws.ownSemicolon) { + this.builder(node.raws.ownSemicolon, node, 'end') + } + } + + atrule(node, semicolon) { + let name = '@' + node.name + let params = node.params ? this.rawValue(node, 'params') : '' + + if (typeof node.raws.afterName !== 'undefined') { + name += node.raws.afterName + } else if (params) { + name += ' ' + } + + if (node.nodes) { + this.block(node, name + params) + } else { + let end = (node.raws.between || '') + (semicolon ? ';' : '') + this.builder(name + params + end, node) + } + } + + body(node) { + let last = node.nodes.length - 1 + while (last > 0) { + if (node.nodes[last].type !== 'comment') break + last -= 1 + } + + let semicolon = this.raw(node, 'semicolon') + for (let i = 0; i < node.nodes.length; i++) { + let child = node.nodes[i] + let before = this.raw(child, 'before') + if (before) this.builder(before) + this.stringify(child, last !== i || semicolon) + } + } + + block(node, start) { + let between = this.raw(node, 'between', 'beforeOpen') + this.builder(start + between + '{', node, 'start') + + let after + if (node.nodes && node.nodes.length) { + this.body(node) + after = this.raw(node, 'after') + } else { + after = this.raw(node, 'after', 'emptyBody') + } + + if (after) this.builder(after) + this.builder('}', node, 'end') + } + + raw(node, own, detect) { + let value + if (!detect) detect = own + + // Already had + if (own) { + value = node.raws[own] + if (typeof value !== 'undefined') return value + } + + let parent = node.parent + + if (detect === 'before') { + // Hack for first rule in CSS + if (!parent || (parent.type === 'root' && parent.first === node)) { + return '' + } + + // `root` nodes in `document` should use only their own raws + if (parent && parent.type === 'document') { + return '' + } + } + + // Floating child without parent + if (!parent) return DEFAULT_RAW[detect] + + // Detect style by other nodes + let root = node.root() + if (!root.rawCache) root.rawCache = {} + if (typeof root.rawCache[detect] !== 'undefined') { + return root.rawCache[detect] + } + + if (detect === 'before' || detect === 'after') { + return this.beforeAfter(node, detect) + } else { + let method = 'raw' + capitalize(detect) + if (this[method]) { + value = this[method](root, node) + } else { + root.walk(i => { + value = i.raws[own] + if (typeof value !== 'undefined') return false + }) + } + } + + if (typeof value === 'undefined') value = DEFAULT_RAW[detect] + + root.rawCache[detect] = value + return value + } + + rawSemicolon(root) { + let value + root.walk(i => { + if (i.nodes && i.nodes.length && i.last.type === 'decl') { + value = i.raws.semicolon + if (typeof value !== 'undefined') return false + } + }) + return value + } + + rawEmptyBody(root) { + let value + root.walk(i => { + if (i.nodes && i.nodes.length === 0) { + value = i.raws.after + if (typeof value !== 'undefined') return false + } + }) + return value + } + + rawIndent(root) { + if (root.raws.indent) return root.raws.indent + let value + root.walk(i => { + let p = i.parent + if (p && p !== root && p.parent && p.parent === root) { + if (typeof i.raws.before !== 'undefined') { + let parts = i.raws.before.split('\n') + value = parts[parts.length - 1] + value = value.replace(/\S/g, '') + return false + } + } + }) + return value + } + + rawBeforeComment(root, node) { + let value + root.walkComments(i => { + if (typeof i.raws.before !== 'undefined') { + value = i.raws.before + if (value.includes('\n')) { + value = value.replace(/[^\n]+$/, '') + } + return false + } + }) + if (typeof value === 'undefined') { + value = this.raw(node, null, 'beforeDecl') + } else if (value) { + value = value.replace(/\S/g, '') + } + return value + } + + rawBeforeDecl(root, node) { + let value + root.walkDecls(i => { + if (typeof i.raws.before !== 'undefined') { + value = i.raws.before + if (value.includes('\n')) { + value = value.replace(/[^\n]+$/, '') + } + return false + } + }) + if (typeof value === 'undefined') { + value = this.raw(node, null, 'beforeRule') + } else if (value) { + value = value.replace(/\S/g, '') + } + return value + } + + rawBeforeRule(root) { + let value + root.walk(i => { + if (i.nodes && (i.parent !== root || root.first !== i)) { + if (typeof i.raws.before !== 'undefined') { + value = i.raws.before + if (value.includes('\n')) { + value = value.replace(/[^\n]+$/, '') + } + return false + } + } + }) + if (value) value = value.replace(/\S/g, '') + return value + } + + rawBeforeClose(root) { + let value + root.walk(i => { + if (i.nodes && i.nodes.length > 0) { + if (typeof i.raws.after !== 'undefined') { + value = i.raws.after + if (value.includes('\n')) { + value = value.replace(/[^\n]+$/, '') + } + return false + } + } + }) + if (value) value = value.replace(/\S/g, '') + return value + } + + rawBeforeOpen(root) { + let value + root.walk(i => { + if (i.type !== 'decl') { + value = i.raws.between + if (typeof value !== 'undefined') return false + } + }) + return value + } + + rawColon(root) { + let value + root.walkDecls(i => { + if (typeof i.raws.between !== 'undefined') { + value = i.raws.between.replace(/[^\s:]/g, '') + return false + } + }) + return value + } + + beforeAfter(node, detect) { + let value + if (node.type === 'decl') { + value = this.raw(node, null, 'beforeDecl') + } else if (node.type === 'comment') { + value = this.raw(node, null, 'beforeComment') + } else if (detect === 'before') { + value = this.raw(node, null, 'beforeRule') + } else { + value = this.raw(node, null, 'beforeClose') + } + + let buf = node.parent + let depth = 0 + while (buf && buf.type !== 'root') { + depth += 1 + buf = buf.parent + } + + if (value.includes('\n')) { + let indent = this.raw(node, null, 'indent') + if (indent.length) { + for (let step = 0; step < depth; step++) value += indent + } + } + + return value + } + + rawValue(node, prop) { + let value = node[prop] + let raw = node.raws[prop] + if (raw && raw.value === value) { + return raw.raw + } + + return value + } +} + +module.exports = Stringifier +Stringifier.default = Stringifier diff --git a/frontend/node_modules/postcss/lib/stringify.d.ts b/frontend/node_modules/postcss/lib/stringify.d.ts new file mode 100644 index 00000000..363682ff --- /dev/null +++ b/frontend/node_modules/postcss/lib/stringify.d.ts @@ -0,0 +1,5 @@ +import { Stringifier } from './postcss.js' + +declare const stringify: Stringifier + +export default stringify diff --git a/frontend/node_modules/postcss/lib/stringify.js b/frontend/node_modules/postcss/lib/stringify.js new file mode 100644 index 00000000..77bd0178 --- /dev/null +++ b/frontend/node_modules/postcss/lib/stringify.js @@ -0,0 +1,11 @@ +'use strict' + +let Stringifier = require('./stringifier') + +function stringify(node, builder) { + let str = new Stringifier(builder) + str.stringify(node) +} + +module.exports = stringify +stringify.default = stringify diff --git a/frontend/node_modules/postcss/lib/symbols.js b/frontend/node_modules/postcss/lib/symbols.js new file mode 100644 index 00000000..a142c268 --- /dev/null +++ b/frontend/node_modules/postcss/lib/symbols.js @@ -0,0 +1,5 @@ +'use strict' + +module.exports.isClean = Symbol('isClean') + +module.exports.my = Symbol('my') diff --git a/frontend/node_modules/postcss/lib/terminal-highlight.js b/frontend/node_modules/postcss/lib/terminal-highlight.js new file mode 100644 index 00000000..1f9f19e7 --- /dev/null +++ b/frontend/node_modules/postcss/lib/terminal-highlight.js @@ -0,0 +1,70 @@ +'use strict' + +let pico = require('picocolors') + +let tokenizer = require('./tokenize') + +let Input + +function registerInput(dependant) { + Input = dependant +} + +const HIGHLIGHT_THEME = { + 'brackets': pico.cyan, + 'at-word': pico.cyan, + 'comment': pico.gray, + 'string': pico.green, + 'class': pico.yellow, + 'hash': pico.magenta, + 'call': pico.cyan, + '(': pico.cyan, + ')': pico.cyan, + '{': pico.yellow, + '}': pico.yellow, + '[': pico.yellow, + ']': pico.yellow, + ':': pico.yellow, + ';': pico.yellow +} + +function getTokenType([type, value], processor) { + if (type === 'word') { + if (value[0] === '.') { + return 'class' + } + if (value[0] === '#') { + return 'hash' + } + } + + if (!processor.endOfFile()) { + let next = processor.nextToken() + processor.back(next) + if (next[0] === 'brackets' || next[0] === '(') return 'call' + } + + return type +} + +function terminalHighlight(css) { + let processor = tokenizer(new Input(css), { ignoreErrors: true }) + let result = '' + while (!processor.endOfFile()) { + let token = processor.nextToken() + let color = HIGHLIGHT_THEME[getTokenType(token, processor)] + if (color) { + result += token[1] + .split(/\r?\n/) + .map(i => color(i)) + .join('\n') + } else { + result += token[1] + } + } + return result +} + +terminalHighlight.registerInput = registerInput + +module.exports = terminalHighlight diff --git a/frontend/node_modules/postcss/lib/tokenize.js b/frontend/node_modules/postcss/lib/tokenize.js new file mode 100644 index 00000000..8dac706f --- /dev/null +++ b/frontend/node_modules/postcss/lib/tokenize.js @@ -0,0 +1,266 @@ +'use strict' + +const SINGLE_QUOTE = "'".charCodeAt(0) +const DOUBLE_QUOTE = '"'.charCodeAt(0) +const BACKSLASH = '\\'.charCodeAt(0) +const SLASH = '/'.charCodeAt(0) +const NEWLINE = '\n'.charCodeAt(0) +const SPACE = ' '.charCodeAt(0) +const FEED = '\f'.charCodeAt(0) +const TAB = '\t'.charCodeAt(0) +const CR = '\r'.charCodeAt(0) +const OPEN_SQUARE = '['.charCodeAt(0) +const CLOSE_SQUARE = ']'.charCodeAt(0) +const OPEN_PARENTHESES = '('.charCodeAt(0) +const CLOSE_PARENTHESES = ')'.charCodeAt(0) +const OPEN_CURLY = '{'.charCodeAt(0) +const CLOSE_CURLY = '}'.charCodeAt(0) +const SEMICOLON = ';'.charCodeAt(0) +const ASTERISK = '*'.charCodeAt(0) +const COLON = ':'.charCodeAt(0) +const AT = '@'.charCodeAt(0) + +const RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g +const RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g +const RE_BAD_BRACKET = /.[\n"'(/\\]/ +const RE_HEX_ESCAPE = /[\da-f]/i + +module.exports = function tokenizer(input, options = {}) { + let css = input.css.valueOf() + let ignore = options.ignoreErrors + + let code, next, quote, content, escape + let escaped, escapePos, prev, n, currentToken + + let length = css.length + let pos = 0 + let buffer = [] + let returned = [] + + function position() { + return pos + } + + function unclosed(what) { + throw input.error('Unclosed ' + what, pos) + } + + function endOfFile() { + return returned.length === 0 && pos >= length + } + + function nextToken(opts) { + if (returned.length) return returned.pop() + if (pos >= length) return + + let ignoreUnclosed = opts ? opts.ignoreUnclosed : false + + code = css.charCodeAt(pos) + + switch (code) { + case NEWLINE: + case SPACE: + case TAB: + case CR: + case FEED: { + next = pos + do { + next += 1 + code = css.charCodeAt(next) + } while ( + code === SPACE || + code === NEWLINE || + code === TAB || + code === CR || + code === FEED + ) + + currentToken = ['space', css.slice(pos, next)] + pos = next - 1 + break + } + + case OPEN_SQUARE: + case CLOSE_SQUARE: + case OPEN_CURLY: + case CLOSE_CURLY: + case COLON: + case SEMICOLON: + case CLOSE_PARENTHESES: { + let controlChar = String.fromCharCode(code) + currentToken = [controlChar, controlChar, pos] + break + } + + case OPEN_PARENTHESES: { + prev = buffer.length ? buffer.pop()[1] : '' + n = css.charCodeAt(pos + 1) + if ( + prev === 'url' && + n !== SINGLE_QUOTE && + n !== DOUBLE_QUOTE && + n !== SPACE && + n !== NEWLINE && + n !== TAB && + n !== FEED && + n !== CR + ) { + next = pos + do { + escaped = false + next = css.indexOf(')', next + 1) + if (next === -1) { + if (ignore || ignoreUnclosed) { + next = pos + break + } else { + unclosed('bracket') + } + } + escapePos = next + while (css.charCodeAt(escapePos - 1) === BACKSLASH) { + escapePos -= 1 + escaped = !escaped + } + } while (escaped) + + currentToken = ['brackets', css.slice(pos, next + 1), pos, next] + + pos = next + } else { + next = css.indexOf(')', pos + 1) + content = css.slice(pos, next + 1) + + if (next === -1 || RE_BAD_BRACKET.test(content)) { + currentToken = ['(', '(', pos] + } else { + currentToken = ['brackets', content, pos, next] + pos = next + } + } + + break + } + + case SINGLE_QUOTE: + case DOUBLE_QUOTE: { + quote = code === SINGLE_QUOTE ? "'" : '"' + next = pos + do { + escaped = false + next = css.indexOf(quote, next + 1) + if (next === -1) { + if (ignore || ignoreUnclosed) { + next = pos + 1 + break + } else { + unclosed('string') + } + } + escapePos = next + while (css.charCodeAt(escapePos - 1) === BACKSLASH) { + escapePos -= 1 + escaped = !escaped + } + } while (escaped) + + currentToken = ['string', css.slice(pos, next + 1), pos, next] + pos = next + break + } + + case AT: { + RE_AT_END.lastIndex = pos + 1 + RE_AT_END.test(css) + if (RE_AT_END.lastIndex === 0) { + next = css.length - 1 + } else { + next = RE_AT_END.lastIndex - 2 + } + + currentToken = ['at-word', css.slice(pos, next + 1), pos, next] + + pos = next + break + } + + case BACKSLASH: { + next = pos + escape = true + while (css.charCodeAt(next + 1) === BACKSLASH) { + next += 1 + escape = !escape + } + code = css.charCodeAt(next + 1) + if ( + escape && + code !== SLASH && + code !== SPACE && + code !== NEWLINE && + code !== TAB && + code !== CR && + code !== FEED + ) { + next += 1 + if (RE_HEX_ESCAPE.test(css.charAt(next))) { + while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) { + next += 1 + } + if (css.charCodeAt(next + 1) === SPACE) { + next += 1 + } + } + } + + currentToken = ['word', css.slice(pos, next + 1), pos, next] + + pos = next + break + } + + default: { + if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) { + next = css.indexOf('*/', pos + 2) + 1 + if (next === 0) { + if (ignore || ignoreUnclosed) { + next = css.length + } else { + unclosed('comment') + } + } + + currentToken = ['comment', css.slice(pos, next + 1), pos, next] + pos = next + } else { + RE_WORD_END.lastIndex = pos + 1 + RE_WORD_END.test(css) + if (RE_WORD_END.lastIndex === 0) { + next = css.length - 1 + } else { + next = RE_WORD_END.lastIndex - 2 + } + + currentToken = ['word', css.slice(pos, next + 1), pos, next] + buffer.push(currentToken) + pos = next + } + + break + } + } + + pos++ + return currentToken + } + + function back(token) { + returned.push(token) + } + + return { + back, + nextToken, + endOfFile, + position + } +} diff --git a/frontend/node_modules/postcss/lib/warn-once.js b/frontend/node_modules/postcss/lib/warn-once.js new file mode 100644 index 00000000..316e1cf4 --- /dev/null +++ b/frontend/node_modules/postcss/lib/warn-once.js @@ -0,0 +1,13 @@ +/* eslint-disable no-console */ +'use strict' + +let printed = {} + +module.exports = function warnOnce(message) { + if (printed[message]) return + printed[message] = true + + if (typeof console !== 'undefined' && console.warn) { + console.warn(message) + } +} diff --git a/frontend/node_modules/postcss/lib/warning.d.ts b/frontend/node_modules/postcss/lib/warning.d.ts new file mode 100644 index 00000000..838bef18 --- /dev/null +++ b/frontend/node_modules/postcss/lib/warning.d.ts @@ -0,0 +1,138 @@ +import { RangePosition } from './css-syntax-error.js' +import Node from './node.js' + +export interface WarningOptions { + /** + * CSS node that caused the warning. + */ + node?: Node + + /** + * Word in CSS source that caused the warning. + */ + word?: string + + /** + * Start index, inclusive, in CSS node string that caused the warning. + */ + index?: number + + /** + * End index, exclusive, in CSS node string that caused the warning. + */ + endIndex?: number + + /** + * Start position, inclusive, in CSS node string that caused the warning. + */ + start?: RangePosition + + /** + * End position, exclusive, in CSS node string that caused the warning. + */ + end?: RangePosition + + /** + * Name of the plugin that created this warning. `Result#warn` fills + * this property automatically. + */ + plugin?: string +} + +/** + * Represents a plugin’s warning. It can be created using `Node#warn`. + * + * ```js + * if (decl.important) { + * decl.warn(result, 'Avoid !important', { word: '!important' }) + * } + * ``` + */ +export default class Warning { + /** + * Type to filter warnings from `Result#messages`. + * Always equal to `"warning"`. + */ + type: 'warning' + + /** + * The warning message. + * + * ```js + * warning.text //=> 'Try to avoid !important' + * ``` + */ + text: string + + /** + * The name of the plugin that created this warning. + * When you call `Node#warn` it will fill this property automatically. + * + * ```js + * warning.plugin //=> 'postcss-important' + * ``` + */ + plugin: string + + /** + * Contains the CSS node that caused the warning. + * + * ```js + * warning.node.toString() //=> 'color: white !important' + * ``` + */ + node: Node + + /** + * Line for inclusive start position in the input file with this warning’s source. + * + * ```js + * warning.line //=> 5 + * ``` + */ + line: number + + /** + * Column for inclusive start position in the input file with this warning’s source. + * + * ```js + * warning.column //=> 6 + * ``` + */ + column: number + + /** + * Line for exclusive end position in the input file with this warning’s source. + * + * ```js + * warning.endLine //=> 6 + * ``` + */ + endLine?: number + + /** + * Column for exclusive end position in the input file with this warning’s source. + * + * ```js + * warning.endColumn //=> 4 + * ``` + */ + endColumn?: number + + /** + * @param text Warning message. + * @param opts Warning options. + */ + constructor(text: string, opts?: WarningOptions) + + /** + * Returns a warning position and message. + * + * ```js + * warning.toString() //=> 'postcss-lint:a.css:10:14: Avoid !important' + * ``` + * + * @return Warning position and message. + */ + toString(): string +} diff --git a/frontend/node_modules/postcss/lib/warning.js b/frontend/node_modules/postcss/lib/warning.js new file mode 100644 index 00000000..65aa5252 --- /dev/null +++ b/frontend/node_modules/postcss/lib/warning.js @@ -0,0 +1,37 @@ +'use strict' + +class Warning { + constructor(text, opts = {}) { + this.type = 'warning' + this.text = text + + if (opts.node && opts.node.source) { + let range = opts.node.rangeBy(opts) + this.line = range.start.line + this.column = range.start.column + this.endLine = range.end.line + this.endColumn = range.end.column + } + + for (let opt in opts) this[opt] = opts[opt] + } + + toString() { + if (this.node) { + return this.node.error(this.text, { + plugin: this.plugin, + index: this.index, + word: this.word + }).message + } + + if (this.plugin) { + return this.plugin + ': ' + this.text + } + + return this.text + } +} + +module.exports = Warning +Warning.default = Warning diff --git a/frontend/node_modules/postcss/package.json b/frontend/node_modules/postcss/package.json new file mode 100755 index 00000000..13e3e7b1 --- /dev/null +++ b/frontend/node_modules/postcss/package.json @@ -0,0 +1,85 @@ +{ + "name": "postcss", + "version": "8.4.13", + "description": "Tool for transforming styles with JS plugins", + "engines": { + "node": "^10 || ^12 || >=14" + }, + "exports": { + ".": { + "require": "./lib/postcss.js", + "import": "./lib/postcss.mjs", + "types": "./lib/postcss.d.ts" + }, + "./lib/at-rule": "./lib/at-rule.js", + "./lib/comment": "./lib/comment.js", + "./lib/container": "./lib/container.js", + "./lib/css-syntax-error": "./lib/css-syntax-error.js", + "./lib/declaration": "./lib/declaration.js", + "./lib/fromJSON": "./lib/fromJSON.js", + "./lib/input": "./lib/input.js", + "./lib/lazy-result": "./lib/lazy-result.js", + "./lib/no-work-result": "./lib/no-work-result.js", + "./lib/list": "./lib/list.js", + "./lib/map-generator": "./lib/map-generator.js", + "./lib/node": "./lib/node.js", + "./lib/parse": "./lib/parse.js", + "./lib/parser": "./lib/parser.js", + "./lib/postcss": "./lib/postcss.js", + "./lib/previous-map": "./lib/previous-map.js", + "./lib/processor": "./lib/processor.js", + "./lib/result": "./lib/result.js", + "./lib/root": "./lib/root.js", + "./lib/rule": "./lib/rule.js", + "./lib/stringifier": "./lib/stringifier.js", + "./lib/stringify": "./lib/stringify.js", + "./lib/symbols": "./lib/symbols.js", + "./lib/terminal-highlight": "./lib/terminal-highlight.js", + "./lib/tokenize": "./lib/tokenize.js", + "./lib/warn-once": "./lib/warn-once.js", + "./lib/warning": "./lib/warning.js", + "./package.json": "./package.json" + }, + "main": "./lib/postcss.js", + "types": "./lib/postcss.d.ts", + "keywords": [ + "css", + "postcss", + "rework", + "preprocessor", + "parser", + "source map", + "transform", + "manipulation", + "transpiler" + ], + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + } + ], + "author": "Andrey Sitnik ", + "license": "MIT", + "homepage": "https://postcss.org/", + "repository": "postcss/postcss", + "bugs": { + "url": "https://github.com/postcss/postcss/issues" + }, + "dependencies": { + "nanoid": "^3.3.3", + "picocolors": "^1.0.0", + "source-map-js": "^1.0.2" + }, + "browser": { + "./lib/terminal-highlight": false, + "source-map-js": false, + "path": false, + "url": false, + "fs": false + } +} diff --git a/frontend/node_modules/resolve/.editorconfig b/frontend/node_modules/resolve/.editorconfig new file mode 100644 index 00000000..d63f0bb6 --- /dev/null +++ b/frontend/node_modules/resolve/.editorconfig @@ -0,0 +1,37 @@ +root = true + +[*] +indent_style = space +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +max_line_length = 200 + +[*.js] +block_comment_start = /* +block_comment = * +block_comment_end = */ + +[*.yml] +indent_size = 1 + +[package.json] +indent_style = tab + +[lib/core.json] +indent_style = tab + +[CHANGELOG.md] +indent_style = space +indent_size = 2 + +[{*.json,Makefile}] +max_line_length = off + +[test/{dotdot,resolver,module_dir,multirepo,node_path,pathfilter,precedence}/**/*] +indent_style = off +indent_size = off +max_line_length = off +insert_final_newline = off diff --git a/frontend/node_modules/resolve/.eslintrc b/frontend/node_modules/resolve/.eslintrc new file mode 100644 index 00000000..ce1be6ef --- /dev/null +++ b/frontend/node_modules/resolve/.eslintrc @@ -0,0 +1,65 @@ +{ + "root": true, + + "extends": "@ljharb", + + "rules": { + "indent": [2, 4], + "strict": 0, + "complexity": 0, + "consistent-return": 0, + "curly": 0, + "dot-notation": [2, { "allowKeywords": true }], + "func-name-matching": 0, + "func-style": 0, + "global-require": 1, + "id-length": [2, { "min": 1, "max": 30 }], + "max-lines": [2, 350], + "max-lines-per-function": 0, + "max-nested-callbacks": 0, + "max-params": 0, + "max-statements-per-line": [2, { "max": 2 }], + "max-statements": 0, + "no-magic-numbers": 0, + "no-shadow": 0, + "no-use-before-define": 0, + "sort-keys": 0, + }, + "overrides": [ + { + "files": "bin/**", + "rules": { + "no-process-exit": "off", + }, + }, + { + "files": "example/**", + "rules": { + "no-console": 0, + }, + }, + { + "files": "test/resolver/nested_symlinks/mylib/*.js", + "rules": { + "no-throw-literal": 0, + }, + }, + { + "files": "test/**", + "parserOptions": { + "ecmaVersion": 5, + "allowReserved": false, + }, + "rules": { + "dot-notation": [2, { "allowPattern": "throws" }], + "max-lines": 0, + "max-lines-per-function": 0, + "no-unused-vars": [2, { "vars": "all", "args": "none" }], + }, + }, + ], + + "ignorePatterns": [ + "./test/resolver/malformed_package_json/package.json", + ], +} diff --git a/frontend/node_modules/resolve/.github/FUNDING.yml b/frontend/node_modules/resolve/.github/FUNDING.yml new file mode 100644 index 00000000..d9c05955 --- /dev/null +++ b/frontend/node_modules/resolve/.github/FUNDING.yml @@ -0,0 +1,12 @@ +# These are supported funding model platforms + +github: [ljharb] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: npm/resolve +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/frontend/node_modules/resolve/LICENSE b/frontend/node_modules/resolve/LICENSE new file mode 100644 index 00000000..ff4fce28 --- /dev/null +++ b/frontend/node_modules/resolve/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2012 James Halliday + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/frontend/node_modules/resolve/SECURITY.md b/frontend/node_modules/resolve/SECURITY.md new file mode 100644 index 00000000..82e4285a --- /dev/null +++ b/frontend/node_modules/resolve/SECURITY.md @@ -0,0 +1,3 @@ +# Security + +Please email [@ljharb](https://github.com/ljharb) or see https://tidelift.com/security if you have a potential security vulnerability to report. diff --git a/frontend/node_modules/resolve/appveyor.yml b/frontend/node_modules/resolve/appveyor.yml new file mode 100644 index 00000000..f74b7b8a --- /dev/null +++ b/frontend/node_modules/resolve/appveyor.yml @@ -0,0 +1,76 @@ +version: 1.0.{build} +skip_branch_with_pr: true +build: off + +environment: + matrix: + #- nodejs_version: "17" + - nodejs_version: "16" + - nodejs_version: "15" + - nodejs_version: "14" + - nodejs_version: "13" + - nodejs_version: "12" + - nodejs_version: "11" + - nodejs_version: "10" + - nodejs_version: "9" + - nodejs_version: "8" + - nodejs_version: "7" + - nodejs_version: "6" + - nodejs_version: "5" + - nodejs_version: "4" + - nodejs_version: "3" + - nodejs_version: "2" + - nodejs_version: "1" + - nodejs_version: "0.12" + - nodejs_version: "0.10" + - nodejs_version: "0.8" + - nodejs_version: "0.6" +matrix: + # fast_finish: true + allow_failures: + - nodejs_version: "0.8" + # platform: x86 # x64 has started failing on the registry side, around early November 2020 + - nodejs_version: "0.6" + +platform: + - x86 + - x64 + +# Install scripts. (runs after repo cloning) +install: + # Fix symlinks in working copy (see https://github.com/appveyor/ci/issues/650#issuecomment-186592582) / https://github.com/charleskorn/batect/commit/d08986802ec43086902958c4ee7e57ff3e71dbef + - git config core.symlinks true + - git reset --hard + # Get the latest stable version of Node.js or io.js + - ps: if ($env:nodejs_version -ne '0.6') { Install-Product node $env:nodejs_version $env:platform } + - ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:platform + - IF %nodejs_version% EQU 0.6 npm config set strict-ssl false && npm -g install npm@1.3 + - IF %nodejs_version% EQU 0.8 npm config set strict-ssl false && npm -g install npm@1.4.28 && npm install -g npm@4.5 + - IF %nodejs_version% EQU 1 npm -g install npm@2.9 + - IF %nodejs_version% EQU 2 npm -g install npm@4 + - IF %nodejs_version% EQU 3 npm -g install npm@4 + - IF %nodejs_version% EQU 4 npm -g install npm@5.3 + - IF %nodejs_version% EQU 5 npm -g install npm@5.3 + - IF %nodejs_version% EQU 6 npm -g install npm@6.9 + - IF %nodejs_version% EQU 7 npm -g install npm@6 + - IF %nodejs_version% EQU 8 npm -g install npm@6 + - IF %nodejs_version% EQU 9 npm -g install npm@6.9 + - IF %nodejs_version% EQU 10 npm -g install npm@7 + - IF %nodejs_version% EQU 11 npm -g install npm@7 + - IF %nodejs_version% EQU 12 npm -g install npm@7 + - IF %nodejs_version% EQU 13 npm -g install npm@7 + - IF %nodejs_version% EQU 14 npm -g install npm@7 + - IF %nodejs_version% EQU 15 npm -g install npm@7 + - IF %nodejs_version% EQU 16 npm -g install npm@7 + - set PATH=%APPDATA%\npm;%PATH% + #- IF %nodejs_version% NEQ 0.6 AND %nodejs_version% NEQ 0.8 npm -g install npm + # install modules + - npm install + +# Post-install test scripts. +test_script: + # Output useful info for debugging. + - node --version + - npm --version + # run tests + - npm run tests-only diff --git a/frontend/node_modules/resolve/async.js b/frontend/node_modules/resolve/async.js new file mode 100644 index 00000000..f38c5813 --- /dev/null +++ b/frontend/node_modules/resolve/async.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/async'); diff --git a/frontend/node_modules/resolve/bin/resolve b/frontend/node_modules/resolve/bin/resolve new file mode 100755 index 00000000..5ee329af --- /dev/null +++ b/frontend/node_modules/resolve/bin/resolve @@ -0,0 +1,50 @@ +#!/usr/bin/env node + +'use strict'; + +var path = require('path'); +var fs = require('fs'); + +if ( + String(process.env.npm_lifecycle_script).slice(0, 8) !== 'resolve ' + && ( + !process.argv + || process.argv.length < 2 + || (process.argv[1] !== __filename && fs.statSync(process.argv[1]).ino !== fs.statSync(__filename).ino) + || (process.env._ && path.resolve(process.env._) !== __filename) + ) +) { + console.error('Error: `resolve` must be run directly as an executable'); + process.exit(1); +} + +var supportsPreserveSymlinkFlag = require('supports-preserve-symlinks-flag'); + +var preserveSymlinks = false; +for (var i = 2; i < process.argv.length; i += 1) { + if (process.argv[i].slice(0, 2) === '--') { + if (supportsPreserveSymlinkFlag && process.argv[i] === '--preserve-symlinks') { + preserveSymlinks = true; + } else if (process.argv[i].length > 2) { + console.error('Unknown argument ' + process.argv[i].replace(/[=].*$/, '')); + process.exit(2); + } + process.argv.splice(i, 1); + i -= 1; + if (process.argv[i] === '--') { break; } // eslint-disable-line no-restricted-syntax + } +} + +if (process.argv.length < 3) { + console.error('Error: `resolve` expects a specifier'); + process.exit(2); +} + +var resolve = require('../'); + +var result = resolve.sync(process.argv[2], { + basedir: process.cwd(), + preserveSymlinks: preserveSymlinks +}); + +console.log(result); diff --git a/frontend/node_modules/resolve/example/async.js b/frontend/node_modules/resolve/example/async.js new file mode 100644 index 00000000..20e65dc2 --- /dev/null +++ b/frontend/node_modules/resolve/example/async.js @@ -0,0 +1,5 @@ +var resolve = require('../'); +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); diff --git a/frontend/node_modules/resolve/example/sync.js b/frontend/node_modules/resolve/example/sync.js new file mode 100644 index 00000000..54b2cc10 --- /dev/null +++ b/frontend/node_modules/resolve/example/sync.js @@ -0,0 +1,3 @@ +var resolve = require('../'); +var res = resolve.sync('tap', { basedir: __dirname }); +console.log(res); diff --git a/frontend/node_modules/resolve/index.js b/frontend/node_modules/resolve/index.js new file mode 100644 index 00000000..125d8146 --- /dev/null +++ b/frontend/node_modules/resolve/index.js @@ -0,0 +1,6 @@ +var async = require('./lib/async'); +async.core = require('./lib/core'); +async.isCore = require('./lib/is-core'); +async.sync = require('./lib/sync'); + +module.exports = async; diff --git a/frontend/node_modules/resolve/lib/async.js b/frontend/node_modules/resolve/lib/async.js new file mode 100644 index 00000000..2b0f0f3d --- /dev/null +++ b/frontend/node_modules/resolve/lib/async.js @@ -0,0 +1,329 @@ +var fs = require('fs'); +var getHomedir = require('./homedir'); +var path = require('path'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); +var isCore = require('is-core-module'); + +var realpathFS = fs.realpath && typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultIsDir = function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); +}; + +var defaultRealpath = function realpath(x, cb) { + realpathFS(x, function (realpathErr, realPath) { + if (realpathErr && realpathErr.code !== 'ENOENT') cb(realpathErr); + else cb(null, realpathErr ? x : realPath); + }); +}; + +var maybeRealpath = function maybeRealpath(realpath, x, opts, cb) { + if (opts && opts.preserveSymlinks === false) { + realpath(x, cb); + } else { + cb(null, x); + } +}; + +var defaultReadPackage = function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolve(x, options, callback) { + var cb = callback; + var opts = options; + if (typeof options === 'function') { + cb = opts; + opts = {}; + } + if (typeof x !== 'string') { + var err = new TypeError('Path must be a string.'); + return process.nextTick(function () { + cb(err); + }); + } + + opts = normalizeOptions(x, opts); + + var isFile = opts.isFile || defaultIsFile; + var isDirectory = opts.isDirectory || defaultIsDir; + var readFile = opts.readFile || fs.readFile; + var realpath = opts.realpath || defaultRealpath; + var readPackage = opts.readPackage || defaultReadPackage; + if (opts.readFile && opts.readPackage) { + var conflictErr = new TypeError('`readFile` and `readPackage` are mutually exclusive.'); + return process.nextTick(function () { + cb(conflictErr); + }); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = path.resolve(basedir); + + maybeRealpath( + realpath, + absoluteStart, + opts, + function (err, realStart) { + if (err) cb(err); + else init(realStart); + } + ); + + var res; + function init(basedir) { + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + res = path.resolve(basedir, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + if ((/\/$/).test(x) && res === basedir) { + loadAsDirectory(res, opts.package, onfile); + } else loadAsFile(res, opts.package, onfile); + } else if (includeCoreModules && isCore(x)) { + return cb(null, x); + } else loadNodeModules(x, basedir, function (err, n, pkg) { + if (err) cb(err); + else if (n) { + return maybeRealpath(realpath, n, opts, function (err, realN) { + if (err) { + cb(err); + } else { + cb(null, realN, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function onfile(err, m, pkg) { + if (err) cb(err); + else if (m) cb(null, m, pkg); + else loadAsDirectory(res, function (err, d, pkg) { + if (err) cb(err); + else if (d) { + maybeRealpath(realpath, d, opts, function (err, realD) { + if (err) { + cb(err); + } else { + cb(null, realD, pkg); + } + }); + } else { + var moduleError = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + moduleError.code = 'MODULE_NOT_FOUND'; + cb(moduleError); + } + }); + } + + function loadAsFile(x, thePackage, callback) { + var loadAsFilePackage = thePackage; + var cb = callback; + if (typeof loadAsFilePackage === 'function') { + cb = loadAsFilePackage; + loadAsFilePackage = undefined; + } + + var exts = [''].concat(extensions); + load(exts, x, loadAsFilePackage); + + function load(exts, x, loadPackage) { + if (exts.length === 0) return cb(null, undefined, loadPackage); + var file = x + exts[0]; + + var pkg = loadPackage; + if (pkg) onpkg(null, pkg); + else loadpkg(path.dirname(file), onpkg); + + function onpkg(err, pkg_, dir) { + pkg = pkg_; + if (err) return cb(err); + if (dir && pkg && opts.pathFilter) { + var rfile = path.relative(dir, file); + var rel = rfile.slice(0, rfile.length - exts[0].length); + var r = opts.pathFilter(pkg, x, rel); + if (r) return load( + [''].concat(extensions.slice()), + path.resolve(dir, r), + pkg + ); + } + isFile(file, onex); + } + function onex(err, ex) { + if (err) return cb(err); + if (ex) return cb(null, file, pkg); + load(exts.slice(1), x, pkg); + } + } + } + + function loadpkg(dir, cb) { + if (dir === '' || dir === '/') return cb(null); + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return cb(null); + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return cb(null); + + maybeRealpath(realpath, dir, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return loadpkg(path.dirname(dir), cb); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + // on err, ex is false + if (!ex) return loadpkg(path.dirname(dir), cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + cb(null, pkg, dir); + }); + }); + }); + } + + function loadAsDirectory(x, loadAsDirectoryPackage, callback) { + var cb = callback; + var fpkg = loadAsDirectoryPackage; + if (typeof fpkg === 'function') { + cb = fpkg; + fpkg = opts.package; + } + + maybeRealpath(realpath, x, opts, function (unwrapErr, pkgdir) { + if (unwrapErr) return cb(unwrapErr); + var pkgfile = path.join(pkgdir, 'package.json'); + isFile(pkgfile, function (err, ex) { + if (err) return cb(err); + if (!ex) return loadAsFile(path.join(x, 'index'), fpkg, cb); + + readPackage(readFile, pkgfile, function (err, pkgParam) { + if (err) return cb(err); + + var pkg = pkgParam; + + if (pkg && opts.packageFilter) { + pkg = opts.packageFilter(pkg, pkgfile); + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + return cb(mainError); + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + loadAsFile(path.resolve(x, pkg.main), pkg, function (err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + if (!pkg) return loadAsFile(path.join(x, 'index'), pkg, cb); + + var dir = path.resolve(x, pkg.main); + loadAsDirectory(dir, pkg, function (err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + loadAsFile(path.join(x, 'index'), pkg, cb); + }); + }); + return; + } + + loadAsFile(path.join(x, '/index'), pkg, cb); + }); + }); + }); + } + + function processDirs(cb, dirs) { + if (dirs.length === 0) return cb(null, undefined); + var dir = dirs[0]; + + isDirectory(path.dirname(dir), isdir); + + function isdir(err, isdir) { + if (err) return cb(err); + if (!isdir) return processDirs(cb, dirs.slice(1)); + loadAsFile(dir, opts.package, onfile); + } + + function onfile(err, m, pkg) { + if (err) return cb(err); + if (m) return cb(null, m, pkg); + loadAsDirectory(dir, opts.package, ondir); + } + + function ondir(err, n, pkg) { + if (err) return cb(err); + if (n) return cb(null, n, pkg); + processDirs(cb, dirs.slice(1)); + } + } + function loadNodeModules(x, start, cb) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + processDirs( + cb, + packageIterator ? packageIterator(x, start, thunk, opts) : thunk() + ); + } +}; diff --git a/frontend/node_modules/resolve/lib/caller.js b/frontend/node_modules/resolve/lib/caller.js new file mode 100644 index 00000000..b14a2804 --- /dev/null +++ b/frontend/node_modules/resolve/lib/caller.js @@ -0,0 +1,8 @@ +module.exports = function () { + // see https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi + var origPrepareStackTrace = Error.prepareStackTrace; + Error.prepareStackTrace = function (_, stack) { return stack; }; + var stack = (new Error()).stack; + Error.prepareStackTrace = origPrepareStackTrace; + return stack[2].getFileName(); +}; diff --git a/frontend/node_modules/resolve/lib/core.js b/frontend/node_modules/resolve/lib/core.js new file mode 100644 index 00000000..ecc5b2e9 --- /dev/null +++ b/frontend/node_modules/resolve/lib/core.js @@ -0,0 +1,52 @@ +var current = (process.versions && process.versions.node && process.versions.node.split('.')) || []; + +function specifierIncluded(specifier) { + var parts = specifier.split(' '); + var op = parts.length > 1 ? parts[0] : '='; + var versionParts = (parts.length > 1 ? parts[1] : parts[0]).split('.'); + + for (var i = 0; i < 3; ++i) { + var cur = parseInt(current[i] || 0, 10); + var ver = parseInt(versionParts[i] || 0, 10); + if (cur === ver) { + continue; // eslint-disable-line no-restricted-syntax, no-continue + } + if (op === '<') { + return cur < ver; + } else if (op === '>=') { + return cur >= ver; + } + return false; + } + return op === '>='; +} + +function matchesRange(range) { + var specifiers = range.split(/ ?&& ?/); + if (specifiers.length === 0) { return false; } + for (var i = 0; i < specifiers.length; ++i) { + if (!specifierIncluded(specifiers[i])) { return false; } + } + return true; +} + +function versionIncluded(specifierValue) { + if (typeof specifierValue === 'boolean') { return specifierValue; } + if (specifierValue && typeof specifierValue === 'object') { + for (var i = 0; i < specifierValue.length; ++i) { + if (matchesRange(specifierValue[i])) { return true; } + } + return false; + } + return matchesRange(specifierValue); +} + +var data = require('./core.json'); + +var core = {}; +for (var mod in data) { // eslint-disable-line no-restricted-syntax + if (Object.prototype.hasOwnProperty.call(data, mod)) { + core[mod] = versionIncluded(data[mod]); + } +} +module.exports = core; diff --git a/frontend/node_modules/resolve/lib/core.json b/frontend/node_modules/resolve/lib/core.json new file mode 100644 index 00000000..d2752948 --- /dev/null +++ b/frontend/node_modules/resolve/lib/core.json @@ -0,0 +1,152 @@ +{ + "assert": true, + "node:assert": [">= 14.18 && < 15", ">= 16"], + "assert/strict": ">= 15", + "node:assert/strict": ">= 16", + "async_hooks": ">= 8", + "node:async_hooks": [">= 14.18 && < 15", ">= 16"], + "buffer_ieee754": ">= 0.5 && < 0.9.7", + "buffer": true, + "node:buffer": [">= 14.18 && < 15", ">= 16"], + "child_process": true, + "node:child_process": [">= 14.18 && < 15", ">= 16"], + "cluster": ">= 0.5", + "node:cluster": [">= 14.18 && < 15", ">= 16"], + "console": true, + "node:console": [">= 14.18 && < 15", ">= 16"], + "constants": true, + "node:constants": [">= 14.18 && < 15", ">= 16"], + "crypto": true, + "node:crypto": [">= 14.18 && < 15", ">= 16"], + "_debug_agent": ">= 1 && < 8", + "_debugger": "< 8", + "dgram": true, + "node:dgram": [">= 14.18 && < 15", ">= 16"], + "diagnostics_channel": [">= 14.17 && < 15", ">= 15.1"], + "node:diagnostics_channel": [">= 14.18 && < 15", ">= 16"], + "dns": true, + "node:dns": [">= 14.18 && < 15", ">= 16"], + "dns/promises": ">= 15", + "node:dns/promises": ">= 16", + "domain": ">= 0.7.12", + "node:domain": [">= 14.18 && < 15", ">= 16"], + "events": true, + "node:events": [">= 14.18 && < 15", ">= 16"], + "freelist": "< 6", + "fs": true, + "node:fs": [">= 14.18 && < 15", ">= 16"], + "fs/promises": [">= 10 && < 10.1", ">= 14"], + "node:fs/promises": [">= 14.18 && < 15", ">= 16"], + "_http_agent": ">= 0.11.1", + "node:_http_agent": [">= 14.18 && < 15", ">= 16"], + "_http_client": ">= 0.11.1", + "node:_http_client": [">= 14.18 && < 15", ">= 16"], + "_http_common": ">= 0.11.1", + "node:_http_common": [">= 14.18 && < 15", ">= 16"], + "_http_incoming": ">= 0.11.1", + "node:_http_incoming": [">= 14.18 && < 15", ">= 16"], + "_http_outgoing": ">= 0.11.1", + "node:_http_outgoing": [">= 14.18 && < 15", ">= 16"], + "_http_server": ">= 0.11.1", + "node:_http_server": [">= 14.18 && < 15", ">= 16"], + "http": true, + "node:http": [">= 14.18 && < 15", ">= 16"], + "http2": ">= 8.8", + "node:http2": [">= 14.18 && < 15", ">= 16"], + "https": true, + "node:https": [">= 14.18 && < 15", ">= 16"], + "inspector": ">= 8", + "node:inspector": [">= 14.18 && < 15", ">= 16"], + "_linklist": "< 8", + "module": true, + "node:module": [">= 14.18 && < 15", ">= 16"], + "net": true, + "node:net": [">= 14.18 && < 15", ">= 16"], + "node-inspect/lib/_inspect": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_client": ">= 7.6 && < 12", + "node-inspect/lib/internal/inspect_repl": ">= 7.6 && < 12", + "os": true, + "node:os": [">= 14.18 && < 15", ">= 16"], + "path": true, + "node:path": [">= 14.18 && < 15", ">= 16"], + "path/posix": ">= 15.3", + "node:path/posix": ">= 16", + "path/win32": ">= 15.3", + "node:path/win32": ">= 16", + "perf_hooks": ">= 8.5", + "node:perf_hooks": [">= 14.18 && < 15", ">= 16"], + "process": ">= 1", + "node:process": [">= 14.18 && < 15", ">= 16"], + "punycode": ">= 0.5", + "node:punycode": [">= 14.18 && < 15", ">= 16"], + "querystring": true, + "node:querystring": [">= 14.18 && < 15", ">= 16"], + "readline": true, + "node:readline": [">= 14.18 && < 15", ">= 16"], + "readline/promises": ">= 17", + "node:readline/promises": ">= 17", + "repl": true, + "node:repl": [">= 14.18 && < 15", ">= 16"], + "smalloc": ">= 0.11.5 && < 3", + "_stream_duplex": ">= 0.9.4", + "node:_stream_duplex": [">= 14.18 && < 15", ">= 16"], + "_stream_transform": ">= 0.9.4", + "node:_stream_transform": [">= 14.18 && < 15", ">= 16"], + "_stream_wrap": ">= 1.4.1", + "node:_stream_wrap": [">= 14.18 && < 15", ">= 16"], + "_stream_passthrough": ">= 0.9.4", + "node:_stream_passthrough": [">= 14.18 && < 15", ">= 16"], + "_stream_readable": ">= 0.9.4", + "node:_stream_readable": [">= 14.18 && < 15", ">= 16"], + "_stream_writable": ">= 0.9.4", + "node:_stream_writable": [">= 14.18 && < 15", ">= 16"], + "stream": true, + "node:stream": [">= 14.18 && < 15", ">= 16"], + "stream/consumers": ">= 16.7", + "node:stream/consumers": ">= 16.7", + "stream/promises": ">= 15", + "node:stream/promises": ">= 16", + "stream/web": ">= 16.5", + "node:stream/web": ">= 16.5", + "string_decoder": true, + "node:string_decoder": [">= 14.18 && < 15", ">= 16"], + "sys": [">= 0.4 && < 0.7", ">= 0.8"], + "node:sys": [">= 14.18 && < 15", ">= 16"], + "timers": true, + "node:timers": [">= 14.18 && < 15", ">= 16"], + "timers/promises": ">= 15", + "node:timers/promises": ">= 16", + "_tls_common": ">= 0.11.13", + "node:_tls_common": [">= 14.18 && < 15", ">= 16"], + "_tls_legacy": ">= 0.11.3 && < 10", + "_tls_wrap": ">= 0.11.3", + "node:_tls_wrap": [">= 14.18 && < 15", ">= 16"], + "tls": true, + "node:tls": [">= 14.18 && < 15", ">= 16"], + "trace_events": ">= 10", + "node:trace_events": [">= 14.18 && < 15", ">= 16"], + "tty": true, + "node:tty": [">= 14.18 && < 15", ">= 16"], + "url": true, + "node:url": [">= 14.18 && < 15", ">= 16"], + "util": true, + "node:util": [">= 14.18 && < 15", ">= 16"], + "util/types": ">= 15.3", + "node:util/types": ">= 16", + "v8/tools/arguments": ">= 10 && < 12", + "v8/tools/codemap": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/consarray": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/csvparser": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/logreader": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/profile_view": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8/tools/splaytree": [">= 4.4 && < 5", ">= 5.2 && < 12"], + "v8": ">= 1", + "node:v8": [">= 14.18 && < 15", ">= 16"], + "vm": true, + "node:vm": [">= 14.18 && < 15", ">= 16"], + "wasi": ">= 13.4 && < 13.5", + "worker_threads": ">= 11.7", + "node:worker_threads": [">= 14.18 && < 15", ">= 16"], + "zlib": ">= 0.5", + "node:zlib": [">= 14.18 && < 15", ">= 16"] +} diff --git a/frontend/node_modules/resolve/lib/homedir.js b/frontend/node_modules/resolve/lib/homedir.js new file mode 100644 index 00000000..5ffdf73b --- /dev/null +++ b/frontend/node_modules/resolve/lib/homedir.js @@ -0,0 +1,24 @@ +'use strict'; + +var os = require('os'); + +// adapted from https://github.com/sindresorhus/os-homedir/blob/11e089f4754db38bb535e5a8416320c4446e8cfd/index.js + +module.exports = os.homedir || function homedir() { + var home = process.env.HOME; + var user = process.env.LOGNAME || process.env.USER || process.env.LNAME || process.env.USERNAME; + + if (process.platform === 'win32') { + return process.env.USERPROFILE || process.env.HOMEDRIVE + process.env.HOMEPATH || home || null; + } + + if (process.platform === 'darwin') { + return home || (user ? '/Users/' + user : null); + } + + if (process.platform === 'linux') { + return home || (process.getuid() === 0 ? '/root' : (user ? '/home/' + user : null)); // eslint-disable-line no-extra-parens + } + + return home || null; +}; diff --git a/frontend/node_modules/resolve/lib/is-core.js b/frontend/node_modules/resolve/lib/is-core.js new file mode 100644 index 00000000..537f5c78 --- /dev/null +++ b/frontend/node_modules/resolve/lib/is-core.js @@ -0,0 +1,5 @@ +var isCoreModule = require('is-core-module'); + +module.exports = function isCore(x) { + return isCoreModule(x); +}; diff --git a/frontend/node_modules/resolve/lib/node-modules-paths.js b/frontend/node_modules/resolve/lib/node-modules-paths.js new file mode 100644 index 00000000..1cff0107 --- /dev/null +++ b/frontend/node_modules/resolve/lib/node-modules-paths.js @@ -0,0 +1,42 @@ +var path = require('path'); +var parse = path.parse || require('path-parse'); // eslint-disable-line global-require + +var getNodeModulesDirs = function getNodeModulesDirs(absoluteStart, modules) { + var prefix = '/'; + if ((/^([A-Za-z]:)/).test(absoluteStart)) { + prefix = ''; + } else if ((/^\\\\/).test(absoluteStart)) { + prefix = '\\\\'; + } + + var paths = [absoluteStart]; + var parsed = parse(absoluteStart); + while (parsed.dir !== paths[paths.length - 1]) { + paths.push(parsed.dir); + parsed = parse(parsed.dir); + } + + return paths.reduce(function (dirs, aPath) { + return dirs.concat(modules.map(function (moduleDir) { + return path.resolve(prefix, aPath, moduleDir); + })); + }, []); +}; + +module.exports = function nodeModulesPaths(start, opts, request) { + var modules = opts && opts.moduleDirectory + ? [].concat(opts.moduleDirectory) + : ['node_modules']; + + if (opts && typeof opts.paths === 'function') { + return opts.paths( + request, + start, + function () { return getNodeModulesDirs(start, modules); }, + opts + ); + } + + var dirs = getNodeModulesDirs(start, modules); + return opts && opts.paths ? dirs.concat(opts.paths) : dirs; +}; diff --git a/frontend/node_modules/resolve/lib/normalize-options.js b/frontend/node_modules/resolve/lib/normalize-options.js new file mode 100644 index 00000000..4b56904e --- /dev/null +++ b/frontend/node_modules/resolve/lib/normalize-options.js @@ -0,0 +1,10 @@ +module.exports = function (x, opts) { + /** + * This file is purposefully a passthrough. It's expected that third-party + * environments will override it at runtime in order to inject special logic + * into `resolve` (by manipulating the options). One such example is the PnP + * code path in Yarn. + */ + + return opts || {}; +}; diff --git a/frontend/node_modules/resolve/lib/sync.js b/frontend/node_modules/resolve/lib/sync.js new file mode 100644 index 00000000..32469899 --- /dev/null +++ b/frontend/node_modules/resolve/lib/sync.js @@ -0,0 +1,208 @@ +var isCore = require('is-core-module'); +var fs = require('fs'); +var path = require('path'); +var getHomedir = require('./homedir'); +var caller = require('./caller'); +var nodeModulesPaths = require('./node-modules-paths'); +var normalizeOptions = require('./normalize-options'); + +var realpathFS = fs.realpathSync && typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + +var homedir = getHomedir(); +var defaultPaths = function () { + return [ + path.join(homedir, '.node_modules'), + path.join(homedir, '.node_libraries') + ]; +}; + +var defaultIsFile = function isFile(file) { + try { + var stat = fs.statSync(file, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && (stat.isFile() || stat.isFIFO()); +}; + +var defaultIsDir = function isDirectory(dir) { + try { + var stat = fs.statSync(dir, { throwIfNoEntry: false }); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return !!stat && stat.isDirectory(); +}; + +var defaultRealpathSync = function realpathSync(x) { + try { + return realpathFS(x); + } catch (realpathErr) { + if (realpathErr.code !== 'ENOENT') { + throw realpathErr; + } + } + return x; +}; + +var maybeRealpathSync = function maybeRealpathSync(realpathSync, x, opts) { + if (opts && opts.preserveSymlinks === false) { + return realpathSync(x); + } + return x; +}; + +var defaultReadPackageSync = function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} +}; + +var getPackageCandidates = function getPackageCandidates(x, start, opts) { + var dirs = nodeModulesPaths(start, opts, x); + for (var i = 0; i < dirs.length; i++) { + dirs[i] = path.join(dirs[i], x); + } + return dirs; +}; + +module.exports = function resolveSync(x, options) { + if (typeof x !== 'string') { + throw new TypeError('Path must be a string.'); + } + var opts = normalizeOptions(x, options); + + var isFile = opts.isFile || defaultIsFile; + var readFileSync = opts.readFileSync || fs.readFileSync; + var isDirectory = opts.isDirectory || defaultIsDir; + var realpathSync = opts.realpathSync || defaultRealpathSync; + var readPackageSync = opts.readPackageSync || defaultReadPackageSync; + if (opts.readFileSync && opts.readPackageSync) { + throw new TypeError('`readFileSync` and `readPackageSync` are mutually exclusive.'); + } + var packageIterator = opts.packageIterator; + + var extensions = opts.extensions || ['.js']; + var includeCoreModules = opts.includeCoreModules !== false; + var basedir = opts.basedir || path.dirname(caller()); + var parent = opts.filename || basedir; + + opts.paths = opts.paths || defaultPaths(); + + // ensure that `basedir` is an absolute path at this point, resolving against the process' current working directory + var absoluteStart = maybeRealpathSync(realpathSync, path.resolve(basedir), opts); + + if ((/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/).test(x)) { + var res = path.resolve(absoluteStart, x); + if (x === '.' || x === '..' || x.slice(-1) === '/') res += '/'; + var m = loadAsFileSync(res) || loadAsDirectorySync(res); + if (m) return maybeRealpathSync(realpathSync, m, opts); + } else if (includeCoreModules && isCore(x)) { + return x; + } else { + var n = loadNodeModulesSync(x, absoluteStart); + if (n) return maybeRealpathSync(realpathSync, n, opts); + } + + var err = new Error("Cannot find module '" + x + "' from '" + parent + "'"); + err.code = 'MODULE_NOT_FOUND'; + throw err; + + function loadAsFileSync(x) { + var pkg = loadpkg(path.dirname(x)); + + if (pkg && pkg.dir && pkg.pkg && opts.pathFilter) { + var rfile = path.relative(pkg.dir, x); + var r = opts.pathFilter(pkg.pkg, x, rfile); + if (r) { + x = path.resolve(pkg.dir, r); // eslint-disable-line no-param-reassign + } + } + + if (isFile(x)) { + return x; + } + + for (var i = 0; i < extensions.length; i++) { + var file = x + extensions[i]; + if (isFile(file)) { + return file; + } + } + } + + function loadpkg(dir) { + if (dir === '' || dir === '/') return; + if (process.platform === 'win32' && (/^\w:[/\\]*$/).test(dir)) { + return; + } + if ((/[/\\]node_modules[/\\]*$/).test(dir)) return; + + var pkgfile = path.join(maybeRealpathSync(realpathSync, dir, opts), 'package.json'); + + if (!isFile(pkgfile)) { + return loadpkg(path.dirname(dir)); + } + + var pkg = readPackageSync(readFileSync, pkgfile); + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ dir); // eslint-disable-line spaced-comment + } + + return { pkg: pkg, dir: dir }; + } + + function loadAsDirectorySync(x) { + var pkgfile = path.join(maybeRealpathSync(realpathSync, x, opts), '/package.json'); + if (isFile(pkgfile)) { + try { + var pkg = readPackageSync(readFileSync, pkgfile); + } catch (e) {} + + if (pkg && opts.packageFilter) { + // v2 will pass pkgfile + pkg = opts.packageFilter(pkg, /*pkgfile,*/ x); // eslint-disable-line spaced-comment + } + + if (pkg && pkg.main) { + if (typeof pkg.main !== 'string') { + var mainError = new TypeError('package “' + pkg.name + '” `main` must be a string'); + mainError.code = 'INVALID_PACKAGE_MAIN'; + throw mainError; + } + if (pkg.main === '.' || pkg.main === './') { + pkg.main = 'index'; + } + try { + var m = loadAsFileSync(path.resolve(x, pkg.main)); + if (m) return m; + var n = loadAsDirectorySync(path.resolve(x, pkg.main)); + if (n) return n; + } catch (e) {} + } + } + + return loadAsFileSync(path.join(x, '/index')); + } + + function loadNodeModulesSync(x, start) { + var thunk = function () { return getPackageCandidates(x, start, opts); }; + var dirs = packageIterator ? packageIterator(x, start, thunk, opts) : thunk(); + + for (var i = 0; i < dirs.length; i++) { + var dir = dirs[i]; + if (isDirectory(path.dirname(dir))) { + var m = loadAsFileSync(dir); + if (m) return m; + var n = loadAsDirectorySync(dir); + if (n) return n; + } + } + } +}; diff --git a/frontend/node_modules/resolve/package.json b/frontend/node_modules/resolve/package.json new file mode 100644 index 00000000..5cad3f3f --- /dev/null +++ b/frontend/node_modules/resolve/package.json @@ -0,0 +1,62 @@ +{ + "name": "resolve", + "description": "resolve like require.resolve() on behalf of files asynchronously and synchronously", + "version": "1.22.0", + "repository": { + "type": "git", + "url": "git://github.com/browserify/resolve.git" + }, + "bin": { + "resolve": "./bin/resolve" + }, + "main": "index.js", + "keywords": [ + "resolve", + "require", + "node", + "module" + ], + "scripts": { + "prepublishOnly": "safe-publish-latest && cp node_modules/is-core-module/core.json ./lib/ ||:", + "prepublish": "not-in-publish || npm run prepublishOnly", + "prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')", + "lint": "eslint --ext=js,mjs --no-eslintrc -c .eslintrc . 'bin/**'", + "pretests-only": "cd ./test/resolver/nested_symlinks && node mylib/sync && node mylib/async", + "tests-only": "tape test/*.js", + "pretest": "npm run lint", + "test": "npm run --silent tests-only", + "posttest": "npm run test:multirepo && aud --production", + "test:multirepo": "cd ./test/resolver/multirepo && npm install && npm test" + }, + "devDependencies": { + "@ljharb/eslint-config": "^20.2.0", + "array.prototype.map": "^1.0.4", + "aud": "^2.0.0", + "copy-dir": "^1.3.0", + "eclint": "^2.8.1", + "eslint": "^8.7.0", + "in-publish": "^2.0.1", + "mkdirp": "^0.5.5", + "mv": "^2.1.1", + "object-keys": "^1.1.1", + "rimraf": "^2.7.1", + "safe-publish-latest": "^2.0.0", + "tap": "0.4.13", + "tape": "^5.4.1", + "tmp": "^0.0.31" + }, + "license": "MIT", + "author": { + "name": "James Halliday", + "email": "mail@substack.net", + "url": "http://substack.net" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + }, + "dependencies": { + "is-core-module": "^2.8.1", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + } +} diff --git a/frontend/node_modules/resolve/readme.markdown b/frontend/node_modules/resolve/readme.markdown new file mode 100644 index 00000000..ad34d60d --- /dev/null +++ b/frontend/node_modules/resolve/readme.markdown @@ -0,0 +1,301 @@ +# resolve [![Version Badge][2]][1] + +implements the [node `require.resolve()` algorithm](https://nodejs.org/api/modules.html#modules_all_together) such that you can `require.resolve()` on behalf of a file asynchronously and synchronously + +[![github actions][actions-image]][actions-url] +[![coverage][codecov-image]][codecov-url] +[![dependency status][5]][6] +[![dev dependency status][7]][8] +[![License][license-image]][license-url] +[![Downloads][downloads-image]][downloads-url] + +[![npm badge][11]][1] + +# example + +asynchronously resolve: + +```js +var resolve = require('resolve/async'); // or, require('resolve') +resolve('tap', { basedir: __dirname }, function (err, res) { + if (err) console.error(err); + else console.log(res); +}); +``` + +``` +$ node example/async.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +synchronously resolve: + +```js +var resolve = require('resolve/sync'); // or, `require('resolve').sync +var res = resolve('tap', { basedir: __dirname }); +console.log(res); +``` + +``` +$ node example/sync.js +/home/substack/projects/node-resolve/node_modules/tap/lib/main.js +``` + +# methods + +```js +var resolve = require('resolve'); +var async = require('resolve/async'); +var sync = require('resolve/sync'); +``` + +For both the synchronous and asynchronous methods, errors may have any of the following `err.code` values: + +- `MODULE_NOT_FOUND`: the given path string (`id`) could not be resolved to a module +- `INVALID_BASEDIR`: the specified `opts.basedir` doesn't exist, or is not a directory +- `INVALID_PACKAGE_MAIN`: a `package.json` was encountered with an invalid `main` property (eg. not a string) + +## resolve(id, opts={}, cb) + +Asynchronously resolve the module path string `id` into `cb(err, res [, pkg])`, where `pkg` (if defined) is the data from `package.json`. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.package - `package.json` data applicable to the module being loaded + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFile - how to read files asynchronously + +* opts.isFile - function to asynchronously test whether a file exists + +* opts.isDirectory - function to asynchronously test whether a file exists and is a directory + +* opts.realpath - function to asynchronously resolve a potential symlink to its real path + +* `opts.readPackage(readFile, pkgfile, cb)` - function to asynchronously read and parse a package.json file + * readFile - the passed `opts.readFile` or `fs.readFile` if not specified + * pkgfile - path to package.json + * cb - callback + +* `opts.packageFilter(pkg, pkgfile, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * pkgfile - path to package.json + * dir - directory that contains package.json + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFile: fs.readFile, + isFile: function isFile(file, cb) { + fs.stat(file, function (err, stat) { + if (!err) { + return cb(null, stat.isFile() || stat.isFIFO()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + isDirectory: function isDirectory(dir, cb) { + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }, + realpath: function realpath(file, cb) { + var realpath = typeof fs.realpath.native === 'function' ? fs.realpath.native : fs.realpath; + realpath(file, function (realPathErr, realPath) { + if (realPathErr && realPathErr.code !== 'ENOENT') cb(realPathErr); + else cb(null, realPathErr ? file : realPath); + }); + }, + readPackage: function defaultReadPackage(readFile, pkgfile, cb) { + readFile(pkgfile, function (readFileErr, body) { + if (readFileErr) cb(readFileErr); + else { + try { + var pkg = JSON.parse(body); + cb(null, pkg); + } catch (jsonErr) { + cb(null); + } + } + }); + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +## resolve.sync(id, opts) + +Synchronously resolve the module path string `id`, returning the result and +throwing an error when `id` can't be resolved. + +options are: + +* opts.basedir - directory to begin resolving from + +* opts.extensions - array of file extensions to search in order + +* opts.includeCoreModules - set to `false` to exclude node core modules (e.g. `fs`) from the search + +* opts.readFileSync - how to read files synchronously + +* opts.isFile - function to synchronously test whether a file exists + +* opts.isDirectory - function to synchronously test whether a file exists and is a directory + +* opts.realpathSync - function to synchronously resolve a potential symlink to its real path + +* `opts.readPackageSync(readFileSync, pkgfile)` - function to synchronously read and parse a package.json file + * readFileSync - the passed `opts.readFileSync` or `fs.readFileSync` if not specified + * pkgfile - path to package.json + +* `opts.packageFilter(pkg, dir)` - transform the parsed package.json contents before looking at the "main" field + * pkg - package data + * dir - directory that contains package.json (Note: the second argument will change to "pkgfile" in v2) + +* `opts.pathFilter(pkg, path, relativePath)` - transform a path within a package + * pkg - package data + * path - the path being resolved + * relativePath - the path relative from the package.json location + * returns - a relative path that will be joined from the package.json location + +* opts.paths - require.paths array to use if nothing is found on the normal `node_modules` recursive walk (probably don't use this) + + For advanced users, `paths` can also be a `opts.paths(request, start, opts)` function + * request - the import specifier being resolved + * start - lookup path + * getNodeModulesDirs - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* `opts.packageIterator(request, start, opts)` - return the list of candidate paths where the packages sources may be found (probably don't use this) + * request - the import specifier being resolved + * start - lookup path + * getPackageCandidates - a thunk (no-argument function) that returns the paths using standard `node_modules` resolution + * opts - the resolution options + +* opts.moduleDirectory - directory (or directories) in which to recursively look for modules. default: `"node_modules"` + +* opts.preserveSymlinks - if true, doesn't resolve `basedir` to real path before resolving. +This is the way Node resolves dependencies when executed with the [--preserve-symlinks](https://nodejs.org/api/all.html#cli_preserve_symlinks) flag. +**Note:** this property is currently `true` by default but it will be changed to +`false` in the next major version because *Node's resolution algorithm does not preserve symlinks by default*. + +default `opts` values: + +```js +{ + paths: [], + basedir: __dirname, + extensions: ['.js'], + includeCoreModules: true, + readFileSync: fs.readFileSync, + isFile: function isFile(file) { + try { + var stat = fs.statSync(file); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isFile() || stat.isFIFO(); + }, + isDirectory: function isDirectory(dir) { + try { + var stat = fs.statSync(dir); + } catch (e) { + if (e && (e.code === 'ENOENT' || e.code === 'ENOTDIR')) return false; + throw e; + } + return stat.isDirectory(); + }, + realpathSync: function realpathSync(file) { + try { + var realpath = typeof fs.realpathSync.native === 'function' ? fs.realpathSync.native : fs.realpathSync; + return realpath(file); + } catch (realPathErr) { + if (realPathErr.code !== 'ENOENT') { + throw realPathErr; + } + } + return file; + }, + readPackageSync: function defaultReadPackageSync(readFileSync, pkgfile) { + var body = readFileSync(pkgfile); + try { + var pkg = JSON.parse(body); + return pkg; + } catch (jsonErr) {} + }, + moduleDirectory: 'node_modules', + preserveSymlinks: true +} +``` + +# install + +With [npm](https://npmjs.org) do: + +```sh +npm install resolve +``` + +# license + +MIT + +[1]: https://npmjs.org/package/resolve +[2]: https://versionbadg.es/browserify/resolve.svg +[5]: https://david-dm.org/browserify/resolve.svg +[6]: https://david-dm.org/browserify/resolve +[7]: https://david-dm.org/browserify/resolve/dev-status.svg +[8]: https://david-dm.org/browserify/resolve#info=devDependencies +[11]: https://nodei.co/npm/resolve.png?downloads=true&stars=true +[license-image]: https://img.shields.io/npm/l/resolve.svg +[license-url]: LICENSE +[downloads-image]: https://img.shields.io/npm/dm/resolve.svg +[downloads-url]: https://npm-stat.com/charts.html?package=resolve +[codecov-image]: https://codecov.io/gh/browserify/resolve/branch/main/graphs/badge.svg +[codecov-url]: https://app.codecov.io/gh/browserify/resolve/ +[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/browserify/resolve +[actions-url]: https://github.com/browserify/resolve/actions diff --git a/frontend/node_modules/resolve/sync.js b/frontend/node_modules/resolve/sync.js new file mode 100644 index 00000000..cd0ee040 --- /dev/null +++ b/frontend/node_modules/resolve/sync.js @@ -0,0 +1,3 @@ +'use strict'; + +module.exports = require('./lib/sync'); diff --git a/frontend/node_modules/resolve/test/core.js b/frontend/node_modules/resolve/test/core.js new file mode 100644 index 00000000..7a3ccb16 --- /dev/null +++ b/frontend/node_modules/resolve/test/core.js @@ -0,0 +1,81 @@ +var test = require('tape'); +var keys = require('object-keys'); +var resolve = require('../'); + +test('core modules', function (t) { + t.test('isCore()', function (st) { + st.ok(resolve.isCore('fs')); + st.ok(resolve.isCore('net')); + st.ok(resolve.isCore('http')); + + st.ok(!resolve.isCore('seq')); + st.ok(!resolve.isCore('../')); + + st.ok(!resolve.isCore('toString')); + + st.end(); + }); + + t.test('core list', function (st) { + var cores = keys(resolve.core); + st.plan(cores.length); + + for (var i = 0; i < cores.length; ++i) { + var mod = cores[i]; + var requireFunc = function () { require(mod); }; // eslint-disable-line no-loop-func + console.log(mod, resolve.core, resolve.core[mod]); + if (resolve.core[mod]) { + st.doesNotThrow(requireFunc, mod + ' supported; requiring does not throw'); + } else { + st.throws(requireFunc, mod + ' not supported; requiring throws'); + } + } + + st.end(); + }); + + t.test('core via repl module', { skip: !resolve.core.repl }, function (st) { + var libs = require('repl')._builtinLibs; // eslint-disable-line no-underscore-dangle + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + st.end(); + }); + + t.test('core via builtinModules list', { skip: !resolve.core.module }, function (st) { + var libs = require('module').builtinModules; + if (!libs) { + st.skip('module.builtinModules does not exist'); + return st.end(); + } + var blacklist = [ + '_debug_agent', + 'v8/tools/tickprocessor-driver', + 'v8/tools/SourceMap', + 'v8/tools/tickprocessor', + 'v8/tools/profile' + ]; + for (var i = 0; i < libs.length; ++i) { + var mod = libs[i]; + if (blacklist.indexOf(mod) === -1) { + st.ok(resolve.core[mod], mod + ' is a core module'); + st.doesNotThrow( + function () { require(mod); }, // eslint-disable-line no-loop-func + 'requiring ' + mod + ' does not throw' + ); + } + } + st.end(); + }); + + t.end(); +}); diff --git a/frontend/node_modules/resolve/test/dotdot.js b/frontend/node_modules/resolve/test/dotdot.js new file mode 100644 index 00000000..30806659 --- /dev/null +++ b/frontend/node_modules/resolve/test/dotdot.js @@ -0,0 +1,29 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('dotdot', function (t) { + t.plan(4); + var dir = path.join(__dirname, '/dotdot/abc'); + + resolve('..', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'dotdot/index.js')); + }); + + resolve('.', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('dotdot sync', function (t) { + t.plan(2); + var dir = path.join(__dirname, '/dotdot/abc'); + + var a = resolve.sync('..', { basedir: dir }); + t.equal(a, path.join(__dirname, 'dotdot/index.js')); + + var b = resolve.sync('.', { basedir: dir }); + t.equal(b, path.join(dir, 'index.js')); +}); diff --git a/frontend/node_modules/resolve/test/dotdot/abc/index.js b/frontend/node_modules/resolve/test/dotdot/abc/index.js new file mode 100644 index 00000000..67f2534e --- /dev/null +++ b/frontend/node_modules/resolve/test/dotdot/abc/index.js @@ -0,0 +1,2 @@ +var x = require('..'); +console.log(x); diff --git a/frontend/node_modules/resolve/test/dotdot/index.js b/frontend/node_modules/resolve/test/dotdot/index.js new file mode 100644 index 00000000..643f9fcc --- /dev/null +++ b/frontend/node_modules/resolve/test/dotdot/index.js @@ -0,0 +1 @@ +module.exports = 'whatever'; diff --git a/frontend/node_modules/resolve/test/faulty_basedir.js b/frontend/node_modules/resolve/test/faulty_basedir.js new file mode 100644 index 00000000..5f2141a6 --- /dev/null +++ b/frontend/node_modules/resolve/test/faulty_basedir.js @@ -0,0 +1,29 @@ +var test = require('tape'); +var path = require('path'); +var resolve = require('../'); + +test('faulty basedir must produce error in windows', { skip: process.platform !== 'win32' }, function (t) { + t.plan(1); + + var resolverDir = 'C:\\a\\b\\c\\d'; + + resolve('tape/lib/test.js', { basedir: resolverDir }, function (err, res, pkg) { + t.equal(!!err, true); + }); +}); + +test('non-existent basedir should not throw when preserveSymlinks is false', function (t) { + t.plan(2); + + var opts = { + basedir: path.join(path.sep, 'unreal', 'path', 'that', 'does', 'not', 'exist'), + preserveSymlinks: false + }; + + var module = './dotdot/abc'; + + resolve(module, opts, function (err, res) { + t.equal(err.code, 'MODULE_NOT_FOUND'); + t.equal(res, undefined); + }); +}); diff --git a/frontend/node_modules/resolve/test/filter.js b/frontend/node_modules/resolve/test/filter.js new file mode 100644 index 00000000..8f8cccdb --- /dev/null +++ b/frontend/node_modules/resolve/test/filter.js @@ -0,0 +1,34 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + resolve('./baz', { + basedir: dir, + packageFilter: function (pkg, pkgfile) { + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = [pkg, pkgfile]; + return pkg; + } + }, function (err, res, pkg) { + if (err) t.fail(err); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(pkg, packageData, 'first packageFilter argument is "pkg"'); + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + var packageFile = packageFilterArgs[1]; + t.equal( + packageFile, + path.join(dir, 'baz/package.json'), + 'second packageFilter argument is "pkgfile"' + ); + + t.end(); + }); +}); diff --git a/frontend/node_modules/resolve/test/filter_sync.js b/frontend/node_modules/resolve/test/filter_sync.js new file mode 100644 index 00000000..8a43b981 --- /dev/null +++ b/frontend/node_modules/resolve/test/filter_sync.js @@ -0,0 +1,33 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('filter', function (t) { + var dir = path.join(__dirname, 'resolver'); + var packageFilterArgs; + var res = resolve.sync('./baz', { + basedir: dir, + // NOTE: in v2.x, this will be `pkg, pkgfile, dir`, but must remain "broken" here in v1.x for compatibility + packageFilter: function (pkg, /*pkgfile,*/ dir) { // eslint-disable-line spaced-comment + pkg.main = 'doom'; // eslint-disable-line no-param-reassign + packageFilterArgs = 'is 1.x' ? [pkg, dir] : [pkg, pkgfile, dir]; // eslint-disable-line no-constant-condition, no-undef + return pkg; + } + }); + + t.equal(res, path.join(dir, 'baz/doom.js'), 'changing the package "main" works'); + + var packageData = packageFilterArgs[0]; + t.equal(packageData.main, 'doom', 'package "main" was altered'); + + if (!'is 1.x') { // eslint-disable-line no-constant-condition + var packageFile = packageFilterArgs[1]; + t.equal(packageFile, path.join(dir, 'baz', 'package.json'), 'package.json path is correct'); + } + + var packageDir = packageFilterArgs['is 1.x' ? 1 : 2]; // eslint-disable-line no-constant-condition + // eslint-disable-next-line no-constant-condition + t.equal(packageDir, path.join(dir, 'baz'), ('is 1.x' ? 'second' : 'third') + ' packageFilter argument is "dir"'); + + t.end(); +}); diff --git a/frontend/node_modules/resolve/test/home_paths.js b/frontend/node_modules/resolve/test/home_paths.js new file mode 100644 index 00000000..3b8c9b32 --- /dev/null +++ b/frontend/node_modules/resolve/test/home_paths.js @@ -0,0 +1,127 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../async'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazPkg = { name: 'baz', main: 'quux.js' }; + var dotMainPkg = { main: 'index' }; + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + var dotSlashMainPkg = { main: 'index' }; + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('dot_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_main`'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + s2t.deepEqual(pkg, dotMainPkg); + }); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(3); + + resolve('dot_slash_main', function (err, res, pkg) { + s2t.error(err, 'no error resolving `dot_slash_main`'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + s2t.deepEqual(pkg, dotSlashMainPkg); + }); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(3); + + resolve('baz', function (err, res, pkg) { + s2t.error(err, 'no error resolving `baz`'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + s2t.deepEqual(pkg, bazPkg); + }); + }); + }); + }); + }); +}); diff --git a/frontend/node_modules/resolve/test/home_paths_sync.js b/frontend/node_modules/resolve/test/home_paths_sync.js new file mode 100644 index 00000000..5d2c56fd --- /dev/null +++ b/frontend/node_modules/resolve/test/home_paths_sync.js @@ -0,0 +1,114 @@ +'use strict'; + +var fs = require('fs'); +var homedir = require('../lib/homedir'); +var path = require('path'); + +var test = require('tape'); +var mkdirp = require('mkdirp'); +var rimraf = require('rimraf'); +var mv = require('mv'); +var copyDir = require('copy-dir'); +var tmp = require('tmp'); + +var HOME = homedir(); + +var hnm = path.join(HOME, '.node_modules'); +var hnl = path.join(HOME, '.node_libraries'); + +var resolve = require('../sync'); + +function makeDir(t, dir, cb) { + mkdirp(dir, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function cleanup() { + rimraf.sync(dir); + }); + cb(); + } + }); +} + +function makeTempDir(t, dir, cb) { + if (fs.existsSync(dir)) { + var tmpResult = tmp.dirSync(); + t.teardown(tmpResult.removeCallback); + var backup = path.join(tmpResult.name, path.basename(dir)); + mv(dir, backup, function (err) { + if (err) { + cb(err); + } else { + t.teardown(function () { + mv(backup, dir, cb); + }); + makeDir(t, dir, cb); + } + }); + } else { + makeDir(t, dir, cb); + } +} + +test('homedir module paths', function (t) { + t.plan(7); + + makeTempDir(t, hnm, function (err) { + t.error(err, 'no error with HNM temp dir'); + if (err) { + return t.end(); + } + + var bazHNMDir = path.join(hnm, 'baz'); + var dotMainDir = path.join(hnm, 'dot_main'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNMDir); + copyDir.sync(path.join(__dirname, 'resolver/dot_main'), dotMainDir); + + var bazHNMmain = path.join(bazHNMDir, 'quux.js'); + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + var dotMainMain = path.join(dotMainDir, 'index.js'); + t.equal(require.resolve('dot_main'), dotMainMain, 'sanity check: require.resolve finds `dot_main`'); + + makeTempDir(t, hnl, function (err) { + t.error(err, 'no error with HNL temp dir'); + if (err) { + return t.end(); + } + var bazHNLDir = path.join(hnl, 'baz'); + copyDir.sync(path.join(__dirname, 'resolver/baz'), bazHNLDir); + + var dotSlashMainDir = path.join(hnl, 'dot_slash_main'); + var dotSlashMainMain = path.join(dotSlashMainDir, 'index.js'); + copyDir.sync(path.join(__dirname, 'resolver/dot_slash_main'), dotSlashMainDir); + + t.equal(require.resolve('baz'), bazHNMmain, 'sanity check: require.resolve finds HNM `baz`'); + t.equal(require.resolve('dot_slash_main'), dotSlashMainMain, 'sanity check: require.resolve finds HNL `dot_slash_main`'); + + t.test('with temp dirs', function (st) { + st.plan(3); + + st.test('just in `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_main'); + s2t.equal(res, dotMainMain, '`dot_main` resolves in `$HOME/.node_modules`'); + }); + + st.test('just in `$HOME/.node_libraries`', function (s2t) { + s2t.plan(1); + + var res = resolve('dot_slash_main'); + s2t.equal(res, dotSlashMainMain, '`dot_slash_main` resolves in `$HOME/.node_libraries`'); + }); + + st.test('in `$HOME/.node_libraries` and `$HOME/.node_modules`', function (s2t) { + s2t.plan(1); + + var res = resolve('baz'); + s2t.equal(res, bazHNMmain, '`baz` resolves in `$HOME/.node_modules` when in both'); + }); + }); + }); + }); +}); diff --git a/frontend/node_modules/resolve/test/mock.js b/frontend/node_modules/resolve/test/mock.js new file mode 100644 index 00000000..61162754 --- /dev/null +++ b/frontend/node_modules/resolve/test/mock.js @@ -0,0 +1,315 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock from package', function (t) { + t.plan(8); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, file)); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[file]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/baz.js')); + t.equal(pkg && pkg.main, 'bar'); + }); + + resolve('baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module 'baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('../baz', opts('/foo/bar'), function (err, res) { + t.equal(err.message, "Cannot find module '../baz' from '" + path.resolve('/foo/bar') + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('mock package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('mock package from package', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + resolve('bar', opts('/foo'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + t.equal(pkg && pkg.main, './baz.js'); + }); +}); + +test('symlinked', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + cb(null, resolved); + return; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + cb(null, path.join(dir, 'symlinked', base)); + } else { + cb(null, path.join(resolved, 'symlinked')); + } + } + }; + } + + resolve('./baz', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); + + resolve('./baz.js', opts('/foo/bar'), function (err, res, pkg) { + if (err) return t.fail(err); + t.equal(res, path.resolve('/foo/bar/symlinked/baz.js')); + t.equal(pkg, undefined); + }); +}); + +test('readPackage', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file, cb) { + cb(null, Object.prototype.hasOwnProperty.call(files, path.resolve(file))); + }, + isDirectory: function (dir, cb) { + cb(null, !!dirs[path.resolve(dir)]); + }, + 'package': { main: 'bar' }, + readFile: function (file, cb) { + cb(null, files[path.resolve(file)]); + }, + realpath: function (file, cb) { + cb(null, file); + } + }; + } + + t.test('with readFile', function (st) { + st.plan(3); + + resolve('bar', opts('/foo'), function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/baz.js')); + st.equal(pkg && pkg.main, './baz.js'); + }); + }); + + var readPackage = function (readFile, file, cb) { + var barPackage = path.join('bar', 'package.json'); + if (file.slice(-barPackage.length) === barPackage) { + cb(null, { main: './something-else.js' }); + } else { + cb(null, JSON.parse(files[path.resolve(file)])); + } + }; + + t.test('with readPackage', function (st) { + st.plan(3); + + var options = opts('/foo'); + delete options.readFile; + options.readPackage = readPackage; + resolve('bar', options, function (err, res, pkg) { + st.error(err); + st.equal(res, path.resolve('/foo/node_modules/bar/something-else.js')); + st.equal(pkg && pkg.main, './something-else.js'); + }); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackage = readPackage; + resolve('bar', options, function (err) { + st.throws(function () { throw err; }, TypeError, 'errors when both readFile and readPackage are provided'); + }); + }); +}); diff --git a/frontend/node_modules/resolve/test/mock_sync.js b/frontend/node_modules/resolve/test/mock_sync.js new file mode 100644 index 00000000..c5a7e2a9 --- /dev/null +++ b/frontend/node_modules/resolve/test/mock_sync.js @@ -0,0 +1,214 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('mock', function (t) { + t.plan(4); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/baz.js') + ); + + t.throws(function () { + resolve.sync('baz', opts('/foo/bar')); + }); + + t.throws(function () { + resolve.sync('../baz', opts('/foo/bar')); + }); +}); + +test('mock package', function (t) { + t.plan(1); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + + t.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); +}); + +test('symlinked', function (t) { + t.plan(2); + + var files = {}; + files[path.resolve('/foo/bar/baz.js')] = 'beep'; + files[path.resolve('/foo/bar/symlinked/baz.js')] = 'beep'; + + var dirs = {}; + dirs[path.resolve('/foo/bar')] = true; + dirs[path.resolve('/foo/bar/symlinked')] = true; + + function opts(basedir) { + return { + preserveSymlinks: false, + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + var resolved = path.resolve(file); + + if (resolved.indexOf('symlinked') >= 0) { + return resolved; + } + + var ext = path.extname(resolved); + + if (ext) { + var dir = path.dirname(resolved); + var base = path.basename(resolved); + return path.join(dir, 'symlinked', base); + } + return path.join(resolved, 'symlinked'); + } + }; + } + + t.equal( + resolve.sync('./baz', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); + + t.equal( + resolve.sync('./baz.js', opts('/foo/bar')), + path.resolve('/foo/bar/symlinked/baz.js') + ); +}); + +test('readPackageSync', function (t) { + t.plan(3); + + var files = {}; + files[path.resolve('/foo/node_modules/bar/something-else.js')] = 'beep'; + files[path.resolve('/foo/node_modules/bar/package.json')] = JSON.stringify({ + main: './baz.js' + }); + files[path.resolve('/foo/node_modules/bar/baz.js')] = 'boop'; + + var dirs = {}; + dirs[path.resolve('/foo')] = true; + dirs[path.resolve('/foo/node_modules')] = true; + + function opts(basedir, useReadPackage) { + return { + basedir: path.resolve(basedir), + isFile: function (file) { + return Object.prototype.hasOwnProperty.call(files, path.resolve(file)); + }, + isDirectory: function (dir) { + return !!dirs[path.resolve(dir)]; + }, + readFileSync: useReadPackage ? null : function (file) { + return files[path.resolve(file)]; + }, + realpathSync: function (file) { + return file; + } + }; + } + t.test('with readFile', function (st) { + st.plan(1); + + st.equal( + resolve.sync('bar', opts('/foo')), + path.resolve('/foo/node_modules/bar/baz.js') + ); + }); + + var readPackageSync = function (readFileSync, file) { + if (file.indexOf(path.join('bar', 'package.json')) >= 0) { + return { main: './something-else.js' }; + } + return JSON.parse(files[path.resolve(file)]); + }; + + t.test('with readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + delete options.readFileSync; + options.readPackageSync = readPackageSync; + + st.equal( + resolve.sync('bar', options), + path.resolve('/foo/node_modules/bar/something-else.js') + ); + }); + + t.test('with readFile and readPackage', function (st) { + st.plan(1); + + var options = opts('/foo'); + options.readPackageSync = readPackageSync; + st.throws( + function () { resolve.sync('bar', options); }, + TypeError, + 'errors when both readFile and readPackage are provided' + ); + }); +}); + diff --git a/frontend/node_modules/resolve/test/module_dir.js b/frontend/node_modules/resolve/test/module_dir.js new file mode 100644 index 00000000..b50e5bb1 --- /dev/null +++ b/frontend/node_modules/resolve/test/module_dir.js @@ -0,0 +1,56 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('moduleDirectory strings', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'module_dir'); + var xopts = { + basedir: dir, + moduleDirectory: 'xmodules' + }; + resolve('aaa', xopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var yopts = { + basedir: dir, + moduleDirectory: 'ymodules' + }; + resolve('aaa', yopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); +}); + +test('moduleDirectory array', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'module_dir'); + var aopts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('aaa', aopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/xmodules/aaa/index.js')); + }); + + var bopts = { + basedir: dir, + moduleDirectory: ['zmodules', 'ymodules', 'xmodules'] + }; + resolve('aaa', bopts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/ymodules/aaa/index.js')); + }); + + var copts = { + basedir: dir, + moduleDirectory: ['xmodules', 'ymodules', 'zmodules'] + }; + resolve('bbb', copts, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, '/zmodules/bbb/main.js')); + }); +}); diff --git a/frontend/node_modules/resolve/test/module_dir/xmodules/aaa/index.js b/frontend/node_modules/resolve/test/module_dir/xmodules/aaa/index.js new file mode 100644 index 00000000..dd7cf7b2 --- /dev/null +++ b/frontend/node_modules/resolve/test/module_dir/xmodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x * 100; }; diff --git a/frontend/node_modules/resolve/test/module_dir/ymodules/aaa/index.js b/frontend/node_modules/resolve/test/module_dir/ymodules/aaa/index.js new file mode 100644 index 00000000..ef2d4d4b --- /dev/null +++ b/frontend/node_modules/resolve/test/module_dir/ymodules/aaa/index.js @@ -0,0 +1 @@ +module.exports = function (x) { return x + 100; }; diff --git a/frontend/node_modules/resolve/test/module_dir/zmodules/bbb/main.js b/frontend/node_modules/resolve/test/module_dir/zmodules/bbb/main.js new file mode 100644 index 00000000..e8ba6299 --- /dev/null +++ b/frontend/node_modules/resolve/test/module_dir/zmodules/bbb/main.js @@ -0,0 +1 @@ +module.exports = function (n) { return n * 111; }; diff --git a/frontend/node_modules/resolve/test/module_dir/zmodules/bbb/package.json b/frontend/node_modules/resolve/test/module_dir/zmodules/bbb/package.json new file mode 100644 index 00000000..c13b8cf6 --- /dev/null +++ b/frontend/node_modules/resolve/test/module_dir/zmodules/bbb/package.json @@ -0,0 +1,3 @@ +{ + "main": "main.js" +} diff --git a/frontend/node_modules/resolve/test/node-modules-paths.js b/frontend/node_modules/resolve/test/node-modules-paths.js new file mode 100644 index 00000000..675441db --- /dev/null +++ b/frontend/node_modules/resolve/test/node-modules-paths.js @@ -0,0 +1,143 @@ +var test = require('tape'); +var path = require('path'); +var parse = path.parse || require('path-parse'); +var keys = require('object-keys'); + +var nodeModulesPaths = require('../lib/node-modules-paths'); + +var verifyDirs = function verifyDirs(t, start, dirs, moduleDirectories, paths) { + var moduleDirs = [].concat(moduleDirectories || 'node_modules'); + if (paths) { + for (var k = 0; k < paths.length; ++k) { + moduleDirs.push(path.basename(paths[k])); + } + } + + var foundModuleDirs = {}; + var uniqueDirs = {}; + var parsedDirs = {}; + for (var i = 0; i < dirs.length; ++i) { + var parsed = parse(dirs[i]); + if (!foundModuleDirs[parsed.base]) { foundModuleDirs[parsed.base] = 0; } + foundModuleDirs[parsed.base] += 1; + parsedDirs[parsed.dir] = true; + uniqueDirs[dirs[i]] = true; + } + t.equal(keys(parsedDirs).length >= start.split(path.sep).length, true, 'there are >= dirs than "start" has'); + var foundModuleDirNames = keys(foundModuleDirs); + t.deepEqual(foundModuleDirNames, moduleDirs, 'all desired module dirs were found'); + t.equal(keys(uniqueDirs).length, dirs.length, 'all dirs provided were unique'); + + var counts = {}; + for (var j = 0; j < foundModuleDirNames.length; ++j) { + counts[foundModuleDirs[j]] = true; + } + t.equal(keys(counts).length, 1, 'all found module directories had the same count'); +}; + +test('node-modules-paths', function (t) { + t.test('no options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('empty options', function (t) { + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, {}); + + verifyDirs(t, start, dirs); + + t.end(); + }); + + t.test('with paths=array option', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var dirs = nodeModulesPaths(start, { paths: paths }); + + verifyDirs(t, start, dirs, null, paths); + + t.end(); + }); + + t.test('with paths=function option', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return getNodeModulesDirs().concat(path.join(absoluteStart, 'not node modules', request)); + }; + + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }, 'pkg'); + + verifyDirs(t, start, dirs, null, [path.join(start, 'not node modules', 'pkg')]); + + t.end(); + }); + + t.test('with paths=function skipping node modules resolution', function (t) { + var paths = function paths(request, absoluteStart, getNodeModulesDirs, opts) { + return []; + }; + var start = path.join(__dirname, 'resolver'); + var dirs = nodeModulesPaths(start, { paths: paths }); + t.deepEqual(dirs, [], 'no node_modules was computed'); + t.end(); + }); + + t.test('with moduleDirectory option', function (t) { + var start = path.join(__dirname, 'resolver'); + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory); + + t.end(); + }); + + t.test('with 1 moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectory = 'not node modules'; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectory }); + + verifyDirs(t, start, dirs, moduleDirectory, paths); + + t.end(); + }); + + t.test('with 1+ moduleDirectory and paths options', function (t) { + var start = path.join(__dirname, 'resolver'); + var paths = ['a', 'b']; + var moduleDirectories = ['not node modules', 'other modules']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + verifyDirs(t, start, dirs, moduleDirectories, paths); + + t.end(); + }); + + t.test('combine paths correctly on Windows', function (t) { + var start = 'C:\\Users\\username\\myProject\\src'; + var paths = []; + var moduleDirectories = ['node_modules', start]; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); + + t.test('combine paths correctly on non-Windows', { skip: process.platform === 'win32' }, function (t) { + var start = '/Users/username/git/myProject/src'; + var paths = []; + var moduleDirectories = ['node_modules', '/Users/username/git/myProject/src']; + var dirs = nodeModulesPaths(start, { paths: paths, moduleDirectory: moduleDirectories }); + + t.equal(dirs.indexOf(path.resolve(start)) > -1, true, 'should contain start dir'); + + t.end(); + }); +}); diff --git a/frontend/node_modules/resolve/test/node_path.js b/frontend/node_modules/resolve/test/node_path.js new file mode 100644 index 00000000..e463d6c8 --- /dev/null +++ b/frontend/node_modules/resolve/test/node_path.js @@ -0,0 +1,70 @@ +var fs = require('fs'); +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('$NODE_PATH', function (t) { + t.plan(8); + + var isDir = function (dir, cb) { + if (dir === '/node_path' || dir === 'node_path/x') { + return cb(null, true); + } + fs.stat(dir, function (err, stat) { + if (!err) { + return cb(null, stat.isDirectory()); + } + if (err.code === 'ENOENT' || err.code === 'ENOTDIR') return cb(null, false); + return cb(err); + }); + }; + + resolve('aaa', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves'); + }); + + resolve('bbb', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves'); + }); + + resolve('ccc', { + paths: [ + path.join(__dirname, '/node_path/x'), + path.join(__dirname, '/node_path/y') + ], + basedir: __dirname, + isDirectory: isDir + }, function (err, res) { + t.error(err); + t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves'); + }); + + // ensure that relative paths still resolve against the regular `node_modules` correctly + resolve('tap', { + paths: [ + 'node_path' + ], + basedir: path.join(__dirname, 'node_path/x'), + isDirectory: isDir + }, function (err, res) { + var root = require('tap/package.json').main; // eslint-disable-line global-require + t.error(err); + t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves'); + }); +}); diff --git a/frontend/node_modules/resolve/test/node_path/x/aaa/index.js b/frontend/node_modules/resolve/test/node_path/x/aaa/index.js new file mode 100644 index 00000000..ad70d0bb --- /dev/null +++ b/frontend/node_modules/resolve/test/node_path/x/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'A'; diff --git a/frontend/node_modules/resolve/test/node_path/x/ccc/index.js b/frontend/node_modules/resolve/test/node_path/x/ccc/index.js new file mode 100644 index 00000000..a64132e4 --- /dev/null +++ b/frontend/node_modules/resolve/test/node_path/x/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'C'; diff --git a/frontend/node_modules/resolve/test/node_path/y/bbb/index.js b/frontend/node_modules/resolve/test/node_path/y/bbb/index.js new file mode 100644 index 00000000..4d0f32e2 --- /dev/null +++ b/frontend/node_modules/resolve/test/node_path/y/bbb/index.js @@ -0,0 +1 @@ +module.exports = 'B'; diff --git a/frontend/node_modules/resolve/test/node_path/y/ccc/index.js b/frontend/node_modules/resolve/test/node_path/y/ccc/index.js new file mode 100644 index 00000000..793315e8 --- /dev/null +++ b/frontend/node_modules/resolve/test/node_path/y/ccc/index.js @@ -0,0 +1 @@ +module.exports = 'CY'; diff --git a/frontend/node_modules/resolve/test/nonstring.js b/frontend/node_modules/resolve/test/nonstring.js new file mode 100644 index 00000000..ef63c40f --- /dev/null +++ b/frontend/node_modules/resolve/test/nonstring.js @@ -0,0 +1,9 @@ +var test = require('tape'); +var resolve = require('../'); + +test('nonstring', function (t) { + t.plan(1); + resolve(555, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/frontend/node_modules/resolve/test/pathfilter.js b/frontend/node_modules/resolve/test/pathfilter.js new file mode 100644 index 00000000..16519aea --- /dev/null +++ b/frontend/node_modules/resolve/test/pathfilter.js @@ -0,0 +1,75 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +var resolverDir = path.join(__dirname, '/pathfilter/deep_ref'); + +var pathFilterFactory = function (t) { + return function (pkg, x, remainder) { + t.equal(pkg.version, '1.2.3'); + t.equal(x, path.join(resolverDir, 'node_modules/deep/ref')); + t.equal(remainder, 'ref'); + return 'alt'; + }; +}; + +test('#62: deep module references and the pathFilter', function (t) { + t.test('deep/ref.js', function (st) { + st.plan(3); + + resolve('deep/ref', { basedir: resolverDir }, function (err, res, pkg) { + if (err) st.fail(err); + + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + var res = resolve.sync('deep/ref', { basedir: resolverDir }); + st.equal(res, path.join(resolverDir, 'node_modules/deep/ref.js')); + }); + + t.test('deep/deeper/ref', function (st) { + st.plan(4); + + resolve( + 'deep/deeper/ref', + { basedir: resolverDir }, + function (err, res, pkg) { + if (err) t.fail(err); + st.notEqual(pkg, undefined); + st.equal(pkg.version, '1.2.3'); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + } + ); + + var res = resolve.sync( + 'deep/deeper/ref', + { basedir: resolverDir } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/deeper/ref.js')); + }); + + t.test('deep/ref alt', function (st) { + st.plan(8); + + var pathFilter = pathFilterFactory(st); + + var res = resolve.sync( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter } + ); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + + resolve( + 'deep/ref', + { basedir: resolverDir, pathFilter: pathFilter }, + function (err, res, pkg) { + if (err) st.fail(err); + st.equal(res, path.join(resolverDir, 'node_modules/deep/alt.js')); + st.end(); + } + ); + }); + + t.end(); +}); diff --git a/frontend/node_modules/resolve/test/pathfilter/deep_ref/main.js b/frontend/node_modules/resolve/test/pathfilter/deep_ref/main.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/precedence.js b/frontend/node_modules/resolve/test/precedence.js new file mode 100644 index 00000000..2febb598 --- /dev/null +++ b/frontend/node_modules/resolve/test/precedence.js @@ -0,0 +1,23 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); + +test('precedence', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'precedence/aaa'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ifError(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg.name, 'resolve'); + }); +}); + +test('./ should not load ${dir}.js', function (t) { // eslint-disable-line no-template-curly-in-string + t.plan(1); + var dir = path.join(__dirname, 'precedence/bbb'); + + resolve('./', { basedir: dir }, function (err, res, pkg) { + t.ok(err); + }); +}); diff --git a/frontend/node_modules/resolve/test/precedence/aaa.js b/frontend/node_modules/resolve/test/precedence/aaa.js new file mode 100644 index 00000000..b83a3e7a --- /dev/null +++ b/frontend/node_modules/resolve/test/precedence/aaa.js @@ -0,0 +1 @@ +module.exports = 'wtf'; diff --git a/frontend/node_modules/resolve/test/precedence/aaa/index.js b/frontend/node_modules/resolve/test/precedence/aaa/index.js new file mode 100644 index 00000000..e0f8f6ab --- /dev/null +++ b/frontend/node_modules/resolve/test/precedence/aaa/index.js @@ -0,0 +1 @@ +module.exports = 'okok'; diff --git a/frontend/node_modules/resolve/test/precedence/aaa/main.js b/frontend/node_modules/resolve/test/precedence/aaa/main.js new file mode 100644 index 00000000..93542a96 --- /dev/null +++ b/frontend/node_modules/resolve/test/precedence/aaa/main.js @@ -0,0 +1 @@ +console.log(require('./')); diff --git a/frontend/node_modules/resolve/test/precedence/bbb.js b/frontend/node_modules/resolve/test/precedence/bbb.js new file mode 100644 index 00000000..2298f47f --- /dev/null +++ b/frontend/node_modules/resolve/test/precedence/bbb.js @@ -0,0 +1 @@ +module.exports = '>_<'; diff --git a/frontend/node_modules/resolve/test/precedence/bbb/main.js b/frontend/node_modules/resolve/test/precedence/bbb/main.js new file mode 100644 index 00000000..716b81d4 --- /dev/null +++ b/frontend/node_modules/resolve/test/precedence/bbb/main.js @@ -0,0 +1 @@ +console.log(require('./')); // should throw diff --git a/frontend/node_modules/resolve/test/resolver.js b/frontend/node_modules/resolve/test/resolver.js new file mode 100644 index 00000000..09da6868 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver.js @@ -0,0 +1,546 @@ +var path = require('path'); +var test = require('tape'); +var resolve = require('../'); +var async = require('../async'); + +test('`./async` entry point', function (t) { + t.equal(resolve, async, '`./async` entry point is the same as `main`'); + t.end(); +}); + +test('async foo', function (t) { + t.plan(12); + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo.js', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.name, 'resolve'); + }); + + resolve('./foo', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg && pkg.main, 'resolver'); + }); + + resolve('./foo.js', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + t.equal(pkg.main, 'resolver'); + }); + + resolve('./foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo.js')); + }); + + resolve('foo', { basedir: dir }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) { + t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'"); + }); +}); + +test('bar', function (t) { + t.plan(6); + var dir = path.join(__dirname, 'resolver'); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg, undefined); + }); + + resolve('foo', { basedir: dir + '/bar', 'package': { main: 'bar' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'bar/node_modules/foo/index.js')); + t.equal(pkg.main, 'bar'); + }); +}); + +test('baz', function (t) { + t.plan(4); + var dir = path.join(__dirname, 'resolver'); + + resolve('./baz', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); + + resolve('./baz', { basedir: dir, 'package': { main: 'resolver' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'baz/quux.js')); + t.equal(pkg.main, 'quux.js'); + }); +}); + +test('biz', function (t) { + t.plan(24); + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + resolve('./grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('./grux', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'biz'); + }); + + resolve('./garply', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('./garply', { basedir: dir, 'package': { main: 'biz' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('tiv', { basedir: dir + '/grux' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/grux', 'package': { main: 'grux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, 'grux'); + }); + + resolve('tiv', { basedir: dir + '/garply' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg, undefined); + }); + + resolve('tiv', { basedir: dir + '/garply', 'package': { main: './lib' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'tiv/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('grux', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg, undefined); + }); + + resolve('grux', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'grux/index.js')); + t.equal(pkg.main, 'tiv'); + }); + + resolve('garply', { basedir: dir + '/tiv' }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); + + resolve('garply', { basedir: dir + '/tiv', 'package': { main: 'tiv' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'garply/lib/index.js')); + t.equal(pkg.main, './lib'); + }); +}); + +test('quux', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/quux'); + + resolve('./foo', { basedir: dir, 'package': { main: 'quux' } }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'foo/index.js')); + t.equal(pkg.main, 'quux'); + }); +}); + +test('normalize', function (t) { + t.plan(2); + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + resolve('../grux', { basedir: dir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + t.equal(pkg, undefined); + }); +}); + +test('cup', function (t) { + t.plan(5); + var dir = path.join(__dirname, 'resolver'); + + resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup.coffee', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'cup.coffee')); + }); + + resolve('./cup', { basedir: dir, extensions: ['.js'] }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + // Test that filename is reported as the "from" value when passed. + resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') }, function (err, res) { + t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'"); + }); +}); + +test('mug', function (t) { + t.plan(3); + var dir = path.join(__dirname, 'resolver'); + + resolve('./mug', { basedir: dir }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'mug.js')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.coffee', '.js'] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(dir, '/mug.coffee')); + }); + + resolve('./mug', { basedir: dir, extensions: ['.js', '.coffee'] }, function (err, res) { + t.equal(res, path.join(dir, '/mug.js')); + }); +}); + +test('other path', function (t) { + t.plan(6); + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + resolve('root', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/root.js')); + }); + + resolve('lib/other-lib', { basedir: dir, paths: [otherDir] }, function (err, res) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'other_path/lib/other-lib.js')); + }); + + resolve('root', { basedir: dir }, function (err, res) { + t.equal(err.message, "Cannot find module 'root' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); + + resolve('zzz', { basedir: dir, paths: [otherDir] }, function (err, res) { + t.equal(err.message, "Cannot find module 'zzz' from '" + path.resolve(dir) + "'"); + t.equal(err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('path iterator', function (t) { + t.plan(2); + + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + resolve('baz', { packageIterator: exactIterator }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(resolverDir, 'baz/quux.js')); + t.equal(pkg && pkg.name, 'baz'); + }); +}); + +test('incorrect main', function (t) { + t.plan(1); + + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + resolve('./incorrect_main', { basedir: resolverDir }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'index.js')); + }); +}); + +test('without basedir', function (t) { + t.plan(1); + + var dir = path.join(__dirname, 'resolver/without_basedir'); + var tester = require(path.join(dir, 'main.js')); // eslint-disable-line global-require + + tester(t, function (err, res, pkg) { + if (err) { + t.fail(err); + } else { + t.equal(res, path.join(dir, 'node_modules/mymodule.js')); + } + }); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./foo', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo.js')); + }); + + resolve('./foo/', { basedir: path.join(dir, 'same_names') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + t.plan(2); + + var dir = path.join(__dirname, 'resolver'); + + resolve('./', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); + + resolve('.', { basedir: path.join(dir, 'same_names/foo') }, function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'same_names/foo/index.js')); + }); +}); + +test('async: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.plan(1); + resolve('./' + testFile, function (err, res, pkg) { + if (err) t.fail(err); + st.equal(res, __filename, 'sanity check'); + }); + }); + + t.test('with a fake directory', function (st) { + st.plan(4); + + resolve('./' + testFile + '/blah', function (err, res, pkg) { + st.ok(err, 'there is an error'); + st.notOk(res, 'no result'); + + st.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + err && err.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + st.end(); + }); + }); + + t.end(); +}); + +test('async dot main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('async dot slash main', function (t) { + var start = new Date(); + t.plan(3); + resolve('./resolver/dot_slash_main', function (err, ret) { + t.notOk(err); + t.equal(ret, path.join(__dirname, 'resolver/dot_slash_main/index.js')); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); + }); +}); + +test('not a directory', function (t) { + t.plan(6); + var path = './foo'; + resolve(path, { basedir: __filename }, function (err, res, pkg) { + t.ok(err, 'a non-directory errors'); + t.equal(arguments.length, 1); + t.equal(res, undefined); + t.equal(pkg, undefined); + + t.equal(err && err.message, 'Cannot find module \'' + path + '\' from \'' + __filename + '\''); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('non-string "main" field in package.json', function (t) { + t.plan(5); + + var dir = path.join(__dirname, 'resolver'); + resolve('./invalid_main', { basedir: dir }, function (err, res, pkg) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + t.equal(res, undefined, 'res is undefined'); + t.equal(pkg, undefined, 'pkg is undefined'); + }); +}); + +test('browser field in package.json', function (t) { + t.plan(3); + + var dir = path.join(__dirname, 'resolver'); + resolve( + './browser_field', + { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }, + function (err, res, pkg) { + if (err) t.fail(err); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.equal(pkg && pkg.main, 'b'); + t.equal(pkg && pkg.browser, undefined); + } + ); +}); + +test('absolute paths', function (t) { + t.plan(4); + + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + resolve(__filename, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file resolves' + ); + }); + resolve(extensionless, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file resolves' + ); + }); + resolve(__filename, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'absolute path to this file with a basedir resolves' + ); + }); + resolve(extensionless, { basedir: process.cwd() }, function (err, res) { + t.equal( + res, + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + }); +}); + +test('malformed package.json', function (t) { + /* eslint operator-linebreak: ["error", "before"], function-paren-newline: "off" */ + t.plan( + (3 * 3) // 3 sets of 3 assertions in the final callback + + 2 // 1 readPackage call with malformed package.json + ); + + var basedir = path.join(__dirname, 'resolver/malformed_package_json'); + var expected = path.join(basedir, 'index.js'); + + resolve('./index.js', { basedir: basedir }, function (err, res, pkg) { + t.error(err, 'no error'); + t.equal(res, expected, 'malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'malformed package.json gives an undefined `pkg` argument'); + }); + + resolve( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + }, + function (err, res, pkg) { + t.error(err, 'with packageFilter: no error'); + t.equal(res, expected, 'with packageFilter: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with packageFilter: malformed package.json gives an undefined `pkg` argument'); + } + ); + + resolve( + './index.js', + { + basedir: basedir, + readPackage: function (readFile, pkgfile, cb) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + readFile(pkgfile, function (err, result) { + try { + cb(null, JSON.parse(result)); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackage: malformed package.json parses as a syntax error'); + cb(null); + } + }); + } + }, + function (err, res, pkg) { + t.error(err, 'with readPackage: no error'); + t.equal(res, expected, 'with readPackage: malformed package.json is silently ignored'); + t.equal(pkg, undefined, 'with readPackage: malformed package.json gives an undefined `pkg` argument'); + } + ); +}); diff --git a/frontend/node_modules/resolve/test/resolver/baz/doom.js b/frontend/node_modules/resolve/test/resolver/baz/doom.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/baz/package.json b/frontend/node_modules/resolve/test/resolver/baz/package.json new file mode 100644 index 00000000..2f77720b --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/baz/package.json @@ -0,0 +1,4 @@ +{ + "name": "baz", + "main": "quux.js" +} diff --git a/frontend/node_modules/resolve/test/resolver/baz/quux.js b/frontend/node_modules/resolve/test/resolver/baz/quux.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/baz/quux.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/frontend/node_modules/resolve/test/resolver/browser_field/a.js b/frontend/node_modules/resolve/test/resolver/browser_field/a.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/browser_field/b.js b/frontend/node_modules/resolve/test/resolver/browser_field/b.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/browser_field/package.json b/frontend/node_modules/resolve/test/resolver/browser_field/package.json new file mode 100644 index 00000000..bf406f08 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/browser_field/package.json @@ -0,0 +1,5 @@ +{ + "name": "browser_field", + "main": "a", + "browser": "b" +} diff --git a/frontend/node_modules/resolve/test/resolver/cup.coffee b/frontend/node_modules/resolve/test/resolver/cup.coffee new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/cup.coffee @@ -0,0 +1 @@ + diff --git a/frontend/node_modules/resolve/test/resolver/dot_main/index.js b/frontend/node_modules/resolve/test/resolver/dot_main/index.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/dot_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/frontend/node_modules/resolve/test/resolver/dot_main/package.json b/frontend/node_modules/resolve/test/resolver/dot_main/package.json new file mode 100644 index 00000000..d7f4fc80 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/dot_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "." +} diff --git a/frontend/node_modules/resolve/test/resolver/dot_slash_main/index.js b/frontend/node_modules/resolve/test/resolver/dot_slash_main/index.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/dot_slash_main/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/frontend/node_modules/resolve/test/resolver/dot_slash_main/package.json b/frontend/node_modules/resolve/test/resolver/dot_slash_main/package.json new file mode 100644 index 00000000..f51287b9 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/dot_slash_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "./" +} diff --git a/frontend/node_modules/resolve/test/resolver/foo.js b/frontend/node_modules/resolve/test/resolver/foo.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/foo.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/frontend/node_modules/resolve/test/resolver/incorrect_main/index.js b/frontend/node_modules/resolve/test/resolver/incorrect_main/index.js new file mode 100644 index 00000000..bc1fb0a6 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/incorrect_main/index.js @@ -0,0 +1,2 @@ +// this is the actual main file 'index.js', not 'wrong.js' like the package.json would indicate +module.exports = 1; diff --git a/frontend/node_modules/resolve/test/resolver/incorrect_main/package.json b/frontend/node_modules/resolve/test/resolver/incorrect_main/package.json new file mode 100644 index 00000000..b7188041 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/incorrect_main/package.json @@ -0,0 +1,3 @@ +{ + "main": "wrong.js" +} diff --git a/frontend/node_modules/resolve/test/resolver/invalid_main/package.json b/frontend/node_modules/resolve/test/resolver/invalid_main/package.json new file mode 100644 index 00000000..05907486 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/invalid_main/package.json @@ -0,0 +1,7 @@ +{ + "name": "invalid_main", + "main": [ + "why is this a thing", + "srsly omg wtf" + ] +} diff --git a/frontend/node_modules/resolve/test/resolver/malformed_package_json/index.js b/frontend/node_modules/resolve/test/resolver/malformed_package_json/index.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/malformed_package_json/package.json b/frontend/node_modules/resolve/test/resolver/malformed_package_json/package.json new file mode 100644 index 00000000..98232c64 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/malformed_package_json/package.json @@ -0,0 +1 @@ +{ diff --git a/frontend/node_modules/resolve/test/resolver/mug.coffee b/frontend/node_modules/resolve/test/resolver/mug.coffee new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/mug.js b/frontend/node_modules/resolve/test/resolver/mug.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/multirepo/lerna.json b/frontend/node_modules/resolve/test/resolver/multirepo/lerna.json new file mode 100644 index 00000000..d6707ca0 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/multirepo/lerna.json @@ -0,0 +1,6 @@ +{ + "packages": [ + "packages/*" + ], + "version": "0.0.0" +} diff --git a/frontend/node_modules/resolve/test/resolver/multirepo/package.json b/frontend/node_modules/resolve/test/resolver/multirepo/package.json new file mode 100644 index 00000000..8508f9d2 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/multirepo/package.json @@ -0,0 +1,20 @@ +{ + "name": "monorepo-symlink-test", + "private": true, + "version": "0.0.0", + "description": "", + "main": "index.js", + "scripts": { + "postinstall": "lerna bootstrap", + "test": "node packages/package-a" + }, + "author": "", + "license": "MIT", + "dependencies": { + "jquery": "^3.3.1", + "resolve": "../../../" + }, + "devDependencies": { + "lerna": "^3.4.3" + } +} diff --git a/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js b/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js new file mode 100644 index 00000000..8875a32d --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-a/index.js @@ -0,0 +1,35 @@ +'use strict'; + +var assert = require('assert'); +var path = require('path'); +var resolve = require('resolve'); + +var basedir = __dirname + '/node_modules/@my-scope/package-b'; + +var expected = path.join(__dirname, '../../node_modules/jquery/dist/jquery.js'); + +/* + * preserveSymlinks === false + * will search NPM package from + * - packages/package-b/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: false }), expected); +assert.equal(resolve.sync('../../node_modules/jquery', { basedir: basedir, preserveSymlinks: false }), expected); + +/* + * preserveSymlinks === true + * will search NPM package from + * - packages/package-a/node_modules/@my-scope/packages/package-b/node_modules + * - packages/package-a/node_modules/@my-scope/packages/node_modules + * - packages/package-a/node_modules/@my-scope/node_modules + * - packages/package-a/node_modules/node_modules + * - packages/package-a/node_modules + * - packages/node_modules + * - node_modules + */ +assert.equal(resolve.sync('jquery', { basedir: basedir, preserveSymlinks: true }), expected); +assert.equal(resolve.sync('../../../../../node_modules/jquery', { basedir: basedir, preserveSymlinks: true }), expected); + +console.log(' * all monorepo paths successfully resolved through symlinks'); diff --git a/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json b/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json new file mode 100644 index 00000000..204de51e --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-a/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-a", + "version": "0.0.0", + "private": true, + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-b": "^0.0.0" + } +} diff --git a/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js b/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-b/index.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json b/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json new file mode 100644 index 00000000..f57c3b5f --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/multirepo/packages/package-b/package.json @@ -0,0 +1,14 @@ +{ + "name": "@my-scope/package-b", + "private": true, + "version": "0.0.0", + "description": "", + "license": "MIT", + "main": "index.js", + "scripts": { + "test": "echo \"Error: run tests from root\" && exit 1" + }, + "dependencies": { + "@my-scope/package-a": "^0.0.0" + } +} diff --git a/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js b/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js new file mode 100644 index 00000000..9b4846a8 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/async.js @@ -0,0 +1,26 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b; +var c; + +var test = function test() { + console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); + console.log(b, ': preserveSymlinks true'); + console.log(c, ': preserveSymlinks false'); + + if (a !== b && a !== c) { + throw 'async: no match'; + } + console.log('async: success! a matched either b or c\n'); +}; + +require('resolve')('buffer/', { preserveSymlinks: true }, function (err, result) { + if (err) { throw err; } + b = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); +require('resolve')('buffer/', { preserveSymlinks: false }, function (err, result) { + if (err) { throw err; } + c = result.replace(process.cwd(), '$CWD'); + if (b && c) { test(); } +}); + diff --git a/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json b/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json new file mode 100644 index 00000000..acfe9e95 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/package.json @@ -0,0 +1,15 @@ +{ + "name": "mylib", + "version": "0.0.0", + "description": "", + "private": true, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "keywords": [], + "author": "", + "license": "ISC", + "dependencies": { + "buffer": "*" + } +} diff --git a/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js b/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js new file mode 100644 index 00000000..3283efc2 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/nested_symlinks/mylib/sync.js @@ -0,0 +1,12 @@ +var a = require.resolve('buffer/').replace(process.cwd(), '$CWD'); +var b = require('resolve').sync('buffer/', { preserveSymlinks: true }).replace(process.cwd(), '$CWD'); +var c = require('resolve').sync('buffer/', { preserveSymlinks: false }).replace(process.cwd(), '$CWD'); + +console.log(a, ': require.resolve, preserveSymlinks ' + (process.execArgv.indexOf('preserve-symlinks') > -1 ? 'true' : 'false')); +console.log(b, ': preserveSymlinks true'); +console.log(c, ': preserveSymlinks false'); + +if (a !== b && a !== c) { + throw 'sync: no match'; +} +console.log('sync: success! a matched either b or c\n'); diff --git a/frontend/node_modules/resolve/test/resolver/other_path/lib/other-lib.js b/frontend/node_modules/resolve/test/resolver/other_path/lib/other-lib.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/other_path/root.js b/frontend/node_modules/resolve/test/resolver/other_path/root.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/quux/foo/index.js b/frontend/node_modules/resolve/test/resolver/quux/foo/index.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/quux/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/frontend/node_modules/resolve/test/resolver/same_names/foo.js b/frontend/node_modules/resolve/test/resolver/same_names/foo.js new file mode 100644 index 00000000..888cae37 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/same_names/foo.js @@ -0,0 +1 @@ +module.exports = 42; diff --git a/frontend/node_modules/resolve/test/resolver/same_names/foo/index.js b/frontend/node_modules/resolve/test/resolver/same_names/foo/index.js new file mode 100644 index 00000000..bd816eab --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/same_names/foo/index.js @@ -0,0 +1 @@ +module.exports = 1; diff --git a/frontend/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js b/frontend/node_modules/resolve/test/resolver/symlinked/_/node_modules/foo.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep b/frontend/node_modules/resolve/test/resolver/symlinked/_/symlink_target/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/resolver/symlinked/package/bar.js b/frontend/node_modules/resolve/test/resolver/symlinked/package/bar.js new file mode 100644 index 00000000..cb1c2c01 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/symlinked/package/bar.js @@ -0,0 +1 @@ +module.exports = 'bar'; diff --git a/frontend/node_modules/resolve/test/resolver/symlinked/package/package.json b/frontend/node_modules/resolve/test/resolver/symlinked/package/package.json new file mode 100644 index 00000000..8e1b5859 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/symlinked/package/package.json @@ -0,0 +1,3 @@ +{ + "main": "bar.js" +} \ No newline at end of file diff --git a/frontend/node_modules/resolve/test/resolver/without_basedir/main.js b/frontend/node_modules/resolve/test/resolver/without_basedir/main.js new file mode 100644 index 00000000..5b31975b --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver/without_basedir/main.js @@ -0,0 +1,5 @@ +var resolve = require('../../../'); + +module.exports = function (t, cb) { + resolve('mymodule', null, cb); +}; diff --git a/frontend/node_modules/resolve/test/resolver_sync.js b/frontend/node_modules/resolve/test/resolver_sync.js new file mode 100644 index 00000000..6e4ae1e6 --- /dev/null +++ b/frontend/node_modules/resolve/test/resolver_sync.js @@ -0,0 +1,645 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); + +var resolve = require('../'); +var sync = require('../sync'); + +var requireResolveSupportsPaths = require.resolve.length > 1 + && (/^12\.[012]\./).test(process.version); // broken in v12.0-12.2, see https://github.com/nodejs/node/issues/27794 + +test('`./sync` entry point', function (t) { + t.equal(resolve.sync, sync, '`./sync` entry point is the same as `.sync` on `main`'); + t.end(); +}); + +test('foo', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./foo', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: dir }), + require.resolve('./foo', { paths: [dir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + path.join(dir, 'foo.js'), + './foo.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo.js', { basedir: dir }), + require.resolve('./foo.js', { paths: [dir] }), + './foo.js: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo.js', { basedir: dir, filename: path.join(dir, 'bar.js') }), + path.join(dir, 'foo.js') + ); + + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }); + + // Test that filename is reported as the "from" value when passed. + t.throws( + function () { + resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') }); + }, + { + name: 'Error', + message: "Cannot find module 'foo' from '" + path.join(dir, 'bar.js') + "'" + } + ); + + t.end(); +}); + +test('bar', function (t) { + var dir = path.join(__dirname, 'resolver'); + + var basedir = path.join(dir, 'bar'); + + t.equal( + resolve.sync('foo', { basedir: basedir }), + path.join(dir, 'bar/node_modules/foo/index.js'), + 'foo in bar' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('foo', { basedir: basedir }), + require.resolve('foo', { paths: [basedir] }), + 'foo in bar: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('baz', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./baz', { basedir: dir }), + path.join(dir, 'baz/quux.js'), + './baz' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./baz', { basedir: dir }), + require.resolve('./baz', { paths: [dir] }), + './baz: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('biz', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules'); + + t.equal( + resolve.sync('./grux', { basedir: dir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./grux', { basedir: dir }), + require.resolve('./grux', { paths: [dir] }), + './grux: resolve.sync === require.resolve' + ); + } + + var tivDir = path.join(dir, 'grux'); + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + path.join(dir, 'tiv/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('tiv', { basedir: tivDir }), + require.resolve('tiv', { paths: [tivDir] }), + 'tiv: resolve.sync === require.resolve' + ); + } + + var gruxDir = path.join(dir, 'tiv'); + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + path.join(dir, 'grux/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('grux', { basedir: gruxDir }), + require.resolve('grux', { paths: [gruxDir] }), + 'grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('normalize', function (t) { + var dir = path.join(__dirname, 'resolver/biz/node_modules/grux'); + + t.equal( + resolve.sync('../grux', { basedir: dir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('../grux', { basedir: dir }), + require.resolve('../grux', { paths: [dir] }), + '../grux: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('cup', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'cup.coffee'), + './cup -> ./cup.coffee' + ); + + t.equal( + resolve.sync('./cup.coffee', { basedir: dir }), + path.join(dir, 'cup.coffee'), + './cup.coffee' + ); + + t.throws(function () { + resolve.sync('./cup', { + basedir: dir, + extensions: ['.js'] + }); + }); + + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./cup.coffee', { basedir: dir, extensions: ['.js', '.coffee'] }), + require.resolve('./cup.coffee', { paths: [dir] }), + './cup.coffee: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('mug', function (t) { + var dir = path.join(__dirname, 'resolver'); + + t.equal( + resolve.sync('./mug', { basedir: dir }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./mug', { basedir: dir }), + require.resolve('./mug', { paths: [dir] }), + './mug: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.coffee', '.js'] + }), + path.join(dir, 'mug.coffee'), + './mug -> ./mug.coffee' + ); + + t.equal( + resolve.sync('./mug', { + basedir: dir, + extensions: ['.js', '.coffee'] + }), + path.join(dir, 'mug.js'), + './mug -> ./mug.js' + ); + + t.end(); +}); + +test('other path', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'bar'); + var otherDir = path.join(resolverDir, 'other_path'); + + t.equal( + resolve.sync('root', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/root.js') + ); + + t.equal( + resolve.sync('lib/other-lib', { + basedir: dir, + paths: [otherDir] + }), + path.join(resolverDir, 'other_path/lib/other-lib.js') + ); + + t.throws(function () { + resolve.sync('root', { basedir: dir }); + }); + + t.throws(function () { + resolve.sync('zzz', { + basedir: dir, + paths: [otherDir] + }); + }); + + t.end(); +}); + +test('path iterator', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + + var exactIterator = function (x, start, getPackageCandidates, opts) { + return [path.join(resolverDir, x)]; + }; + + t.equal( + resolve.sync('baz', { packageIterator: exactIterator }), + path.join(resolverDir, 'baz/quux.js') + ); + + t.end(); +}); + +test('incorrect main', function (t) { + var resolverDir = path.join(__dirname, 'resolver'); + var dir = path.join(resolverDir, 'incorrect_main'); + + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + path.join(dir, 'index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./incorrect_main', { basedir: resolverDir }), + require.resolve('./incorrect_main', { paths: [resolverDir] }), + './incorrect_main: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +var stubStatSync = function stubStatSync(fn) { + var statSync = fs.statSync; + try { + fs.statSync = function () { + throw new EvalError('Unknown Error'); + }; + return fn(); + } finally { + fs.statSync = statSync; + } +}; + +test('#79 - re-throw non ENOENT errors from stat', function (t) { + var dir = path.join(__dirname, 'resolver'); + + stubStatSync(function () { + t.throws(function () { + resolve.sync('foo', { basedir: dir }); + }, /Unknown Error/); + }); + + t.end(); +}); + +test('#52 - incorrectly resolves module-paths like "./someFolder/" when there is a file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names'); + + t.equal( + resolve.sync('./foo', { basedir: basedir }), + path.join(dir, 'same_names/foo.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo', { basedir: basedir }), + require.resolve('./foo', { paths: [basedir] }), + './foo: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js') + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./foo/', { basedir: basedir }), + require.resolve('./foo/', { paths: [basedir] }), + './foo/: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('#211 - incorrectly resolves module-paths like "." when from inside a folder with a sibling file of the same name', function (t) { + var dir = path.join(__dirname, 'resolver'); + var basedir = path.join(dir, 'same_names/foo'); + + t.equal( + resolve.sync('./', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + './' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./', { basedir: basedir }), + require.resolve('./', { paths: [basedir] }), + './: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync('.', { basedir: basedir }), + path.join(dir, 'same_names/foo/index.js'), + '.' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('.', { basedir: basedir }), + require.resolve('.', { paths: [basedir] }), + '.: resolve.sync === require.resolve', + { todo: true } + ); + } + + t.end(); +}); + +test('sync: #121 - treating an existing file as a dir when no basedir', function (t) { + var testFile = path.basename(__filename); + + t.test('sanity check', function (st) { + st.equal( + resolve.sync('./' + testFile), + __filename, + 'sanity check' + ); + st.equal( + resolve.sync('./' + testFile), + require.resolve('./' + testFile), + 'sanity check: resolve.sync === require.resolve' + ); + + st.end(); + }); + + t.test('with a fake directory', function (st) { + function run() { return resolve.sync('./' + testFile + '/blah'); } + + st.throws(run, 'throws an error'); + + try { + run(); + } catch (e) { + st.equal(e.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + st.equal( + e.message, + 'Cannot find module \'./' + testFile + '/blah\' from \'' + __dirname + '\'', + 'can not find nonexistent module' + ); + } + + st.end(); + }); + + t.end(); +}); + +test('sync dot main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_main'), + path.join(__dirname, 'resolver/dot_main/index.js'), + './resolver/dot_main' + ); + t.equal( + resolve.sync('./resolver/dot_main'), + require.resolve('./resolver/dot_main'), + './resolver/dot_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('sync dot slash main', function (t) { + var start = new Date(); + + t.equal( + resolve.sync('./resolver/dot_slash_main'), + path.join(__dirname, 'resolver/dot_slash_main/index.js') + ); + t.equal( + resolve.sync('./resolver/dot_slash_main'), + require.resolve('./resolver/dot_slash_main'), + './resolver/dot_slash_main: resolve.sync === require.resolve' + ); + + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + + t.end(); +}); + +test('not a directory', function (t) { + var path = './foo'; + try { + resolve.sync(path, { basedir: __filename }); + t.fail(); + } catch (err) { + t.ok(err, 'a non-directory errors'); + t.equal(err && err.message, 'Cannot find module \'' + path + "' from '" + __filename + "'"); + t.equal(err && err.code, 'MODULE_NOT_FOUND'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('non-string "main" field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + try { + var result = resolve.sync('./invalid_main', { basedir: dir }); + t.equal(result, undefined, 'result should not exist'); + t.fail('should not get here'); + } catch (err) { + t.ok(err, 'errors on non-string main'); + t.equal(err.message, 'package “invalid_main” `main` must be a string'); + t.equal(err.code, 'INVALID_PACKAGE_MAIN'); + } + t.end(); +}); + +test('browser field in package.json', function (t) { + var dir = path.join(__dirname, 'resolver'); + var res = resolve.sync('./browser_field', { + basedir: dir, + packageFilter: function packageFilter(pkg) { + if (pkg.browser) { + pkg.main = pkg.browser; // eslint-disable-line no-param-reassign + delete pkg.browser; // eslint-disable-line no-param-reassign + } + return pkg; + } + }); + t.equal(res, path.join(dir, 'browser_field', 'b.js')); + t.end(); +}); + +test('absolute paths', function (t) { + var extensionless = __filename.slice(0, -path.extname(__filename).length); + + t.equal( + resolve.sync(__filename), + __filename, + 'absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(extensionless), + __filename, + 'extensionless absolute path to this file resolves' + ); + t.equal( + resolve.sync(__filename), + require.resolve(__filename), + 'absolute path to this file: resolve.sync === require.resolve' + ); + + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + __filename, + 'absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(__filename, { basedir: process.cwd() }), + require.resolve(__filename, { paths: [process.cwd()] }), + 'absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + __filename, + 'extensionless absolute path to this file with a basedir resolves' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync(extensionless, { basedir: process.cwd() }), + require.resolve(extensionless, { paths: [process.cwd()] }), + 'extensionless absolute path to this file + basedir: resolve.sync === require.resolve' + ); + } + + t.end(); +}); + +test('malformed package.json', function (t) { + t.plan(5 + (requireResolveSupportsPaths ? 1 : 0)); + + var basedir = path.join(__dirname, 'resolver/malformed_package_json'); + var expected = path.join(basedir, 'index.js'); + + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + expected, + 'malformed package.json is silently ignored' + ); + if (requireResolveSupportsPaths) { + t.equal( + resolve.sync('./index.js', { basedir: basedir }), + require.resolve('./index.js', { paths: [basedir] }), + 'malformed package.json: resolve.sync === require.resolve' + ); + } + + var res1 = resolve.sync( + './index.js', + { + basedir: basedir, + packageFilter: function (pkg, pkgfile, dir) { + t.fail('should not reach here'); + } + } + ); + + t.equal( + res1, + expected, + 'with packageFilter: malformed package.json is silently ignored' + ); + + var res2 = resolve.sync( + './index.js', + { + basedir: basedir, + readPackageSync: function (readFileSync, pkgfile) { + t.equal(pkgfile, path.join(basedir, 'package.json'), 'readPackageSync: `pkgfile` is package.json path'); + var result = String(readFileSync(pkgfile)); + try { + return JSON.parse(result); + } catch (e) { + t.ok(e instanceof SyntaxError, 'readPackageSync: malformed package.json parses as a syntax error'); + } + } + } + ); + + t.equal( + res2, + expected, + 'with readPackageSync: malformed package.json is silently ignored' + ); +}); diff --git a/frontend/node_modules/resolve/test/shadowed_core.js b/frontend/node_modules/resolve/test/shadowed_core.js new file mode 100644 index 00000000..3a5f4fcf --- /dev/null +++ b/frontend/node_modules/resolve/test/shadowed_core.js @@ -0,0 +1,54 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('shadowed core modules still return core module', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, 'util'); + }); +}); + +test('shadowed core modules still return core module [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, 'util'); +}); + +test('shadowed core modules return shadow when appending `/`', function (t) { + t.plan(2); + + resolve('util/', { basedir: path.join(__dirname, 'shadowed_core') }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow when appending `/` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util/', { basedir: path.join(__dirname, 'shadowed_core') }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false`', function (t) { + t.plan(2); + + resolve('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); + }); +}); + +test('shadowed core modules return shadow with `includeCoreModules: false` [sync]', function (t) { + t.plan(1); + + var res = resolve.sync('util', { basedir: path.join(__dirname, 'shadowed_core'), includeCoreModules: false }); + + t.equal(res, path.join(__dirname, 'shadowed_core/node_modules/util/index.js')); +}); diff --git a/frontend/node_modules/resolve/test/shadowed_core/node_modules/util/index.js b/frontend/node_modules/resolve/test/shadowed_core/node_modules/util/index.js new file mode 100644 index 00000000..e69de29b diff --git a/frontend/node_modules/resolve/test/subdirs.js b/frontend/node_modules/resolve/test/subdirs.js new file mode 100644 index 00000000..b7b8450a --- /dev/null +++ b/frontend/node_modules/resolve/test/subdirs.js @@ -0,0 +1,13 @@ +var test = require('tape'); +var resolve = require('../'); +var path = require('path'); + +test('subdirs', function (t) { + t.plan(2); + + var dir = path.join(__dirname, '/subdirs'); + resolve('a/b/c/x.json', { basedir: dir }, function (err, res) { + t.ifError(err); + t.equal(res, path.join(dir, 'node_modules/a/b/c/x.json')); + }); +}); diff --git a/frontend/node_modules/resolve/test/symlinks.js b/frontend/node_modules/resolve/test/symlinks.js new file mode 100644 index 00000000..35f881af --- /dev/null +++ b/frontend/node_modules/resolve/test/symlinks.js @@ -0,0 +1,176 @@ +var path = require('path'); +var fs = require('fs'); +var test = require('tape'); +var map = require('array.prototype.map'); +var resolve = require('../'); + +var symlinkDir = path.join(__dirname, 'resolver', 'symlinked', 'symlink'); +var packageDir = path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'package'); +var modADir = path.join(__dirname, 'symlinks', 'source', 'node_modules', 'mod-a'); +var symlinkModADir = path.join(__dirname, 'symlinks', 'dest', 'node_modules', 'mod-a'); +try { + fs.unlinkSync(symlinkDir); +} catch (err) {} +try { + fs.unlinkSync(packageDir); +} catch (err) {} +try { + fs.unlinkSync(modADir); +} catch (err) {} +try { + fs.unlinkSync(symlinkModADir); +} catch (err) {} + +try { + fs.symlinkSync('./_/symlink_target', symlinkDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, 'resolver', 'symlinked', '_', 'symlink_target') + '\\', symlinkDir, 'junction'); +} +try { + fs.symlinkSync('../../package', packageDir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'package') + '\\', packageDir, 'junction'); +} +try { + fs.symlinkSync('../../source/node_modules/mod-a', symlinkModADir, 'dir'); +} catch (err) { + // if fails then it is probably on Windows and lets try to create a junction + fs.symlinkSync(path.join(__dirname, '..', '..', 'source', 'node_modules', 'mod-a') + '\\', symlinkModADir, 'junction'); +} + +test('symlink', function (t) { + t.plan(2); + + resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) { + t.error(err); + t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js')); + }); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.plan(4); + + resolve('foo', { basedir: symlinkDir }, function (err, res, pkg) { + t.ok(err, 'there is an error'); + t.notOk(res, 'no result'); + + t.equal(err && err.code, 'MODULE_NOT_FOUND', 'error code matches require.resolve'); + t.equal( + err && err.message, + 'Cannot find module \'foo\' from \'' + symlinkDir + '\'', + 'can not find nonexistent module' + ); + }); +}); + +test('sync symlink', function (t) { + var start = new Date(); + t.doesNotThrow(function () { + t.equal( + resolve.sync('foo', { basedir: symlinkDir, preserveSymlinks: false }), + path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js') + ); + }); + t.ok(new Date() - start < 50, 'resolve.sync timedout'); + t.end(); +}); + +test('sync symlink when preserveSymlinks = true', function (t) { + t.throws(function () { + resolve.sync('foo', { basedir: symlinkDir }); + }, /Cannot find module 'foo'/); + t.end(); +}); + +test('sync symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + var fn = resolve.sync('package', { basedir: basedir, preserveSymlinks: false }); + + t.equal(fn, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + t.end(); +}); + +test('async symlink from node_modules to other dir when preserveSymlinks = false', function (t) { + t.plan(2); + var basedir = path.join(__dirname, 'resolver', 'symlinked', '_'); + resolve('package', { basedir: basedir, preserveSymlinks: false }, function (err, result) { + t.notOk(err, 'no error'); + t.equal(result, path.resolve(__dirname, 'resolver/symlinked/package/bar.js')); + }); +}); + +test('packageFilter', function (t) { + function relative(x) { + return path.relative(__dirname, x); + } + + function testPackageFilter(preserveSymlinks) { + return function (st) { + st.plan('is 1.x' ? 3 : 5); // eslint-disable-line no-constant-condition + + var destMain = 'symlinks/dest/node_modules/mod-a/index.js'; + var destPkg = 'symlinks/dest/node_modules/mod-a/package.json'; + var sourceMain = 'symlinks/source/node_modules/mod-a/index.js'; + var sourcePkg = 'symlinks/source/node_modules/mod-a/package.json'; + var destDir = path.join(__dirname, 'symlinks', 'dest'); + + /* eslint multiline-comment-style: 0 */ + /* v2.x will restore these tests + var packageFilterPath = []; + var actualPath = resolve.sync('mod-a', { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile, dir) { + packageFilterPath.push(pkgfile); + } + }); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'sync: actual path is correct' + ); + st.deepEqual( + map(packageFilterPath, relative), + map(preserveSymlinks ? [destPkg, destPkg] : [sourcePkg, sourcePkg], path.normalize), + 'sync: packageFilter pkgfile arg is correct' + ); + */ + + var asyncPackageFilterPath = []; + resolve( + 'mod-a', + { + basedir: destDir, + preserveSymlinks: preserveSymlinks, + packageFilter: function (pkg, pkgfile) { + asyncPackageFilterPath.push(pkgfile); + } + }, + function (err, actualPath) { + st.error(err, 'no error'); + st.equal( + relative(actualPath), + path.normalize(preserveSymlinks ? destMain : sourceMain), + 'async: actual path is correct' + ); + st.deepEqual( + map(asyncPackageFilterPath, relative), + map( + preserveSymlinks ? [destPkg, destPkg, destPkg] : [sourcePkg, sourcePkg, sourcePkg], + path.normalize + ), + 'async: packageFilter pkgfile arg is correct' + ); + } + ); + }; + } + + t.test('preserveSymlinks: false', testPackageFilter(false)); + + t.test('preserveSymlinks: true', testPackageFilter(true)); + + t.end(); +}); diff --git a/frontend/node_modules/rollup/CHANGELOG.md b/frontend/node_modules/rollup/CHANGELOG.md new file mode 100644 index 00000000..9afcad13 --- /dev/null +++ b/frontend/node_modules/rollup/CHANGELOG.md @@ -0,0 +1,6491 @@ +# rollup changelog + +## 2.72.1 + +_2022-05-07_ + +### Bug Fixes + +- Improve tree-shaking of classes with super classes in certain scenarios (#4489) + +### Pull Requests + +- [#4489](https://github.com/rollup/rollup/pull/4489): Do not deoptimize entire super class when adding a property (@lukastaegert) + +## 2.72.0 + +_2022-05-05_ + +### Features + +- Add CLI hooks to run external commands at certain points in watch mode (#4457) + +### Bug Fixes + +- Fix an issue that could accidentally treat relevant assignments as side effect free (#4486) + +### Pull Requests + +- [#4457](https://github.com/rollup/rollup/pull/4457): feat: CLI event hook flags (@Harris-Miller) +- [#4486](https://github.com/rollup/rollup/pull/4486): Fix reassignment tracking (@lukastaegert) + +## 2.71.1 + +_2022-04-30_ + +### Bug Fixes + +- Allow importing loadConfigFile without extension (#4483) + +### Pull Requests + +- [#4483](https://github.com/rollup/rollup/pull/4483): Add exports exception for loadConfigFile (@lukastaegert) + +## 2.71.0 + +_2022-04-30_ + +## Features + +- Mark `Object.hasOwn` as pure (#4482) + +### Bug Fixes + +- Prevent infinite recursion and display proper warning for recursive reexports (#4472) +- Fix type issue in TypeScript nightly (#4471) + +### Pull Requests + +- [#4467](https://github.com/rollup/rollup/pull/4467): docs: update deprecated option in tools.md (@kimjh96) +- [#4471](https://github.com/rollup/rollup/pull/4471): Fix: tsc did not build (@frank-dspeed) +- [#4472](https://github.com/rollup/rollup/pull/4472): Throw proper error when indirectly reexporting a recursive binding (@lukastaegert) +- [#4475](https://github.com/rollup/rollup/pull/4475): chore: bump deps (#4475) (@dnalborczyk) +- [#4477](https://github.com/rollup/rollup/pull/4477): chore: bump github actions (@dnalborczyk) +- [#4478](https://github.com/rollup/rollup/pull/4478): ci: test with node.js v18, remove v17 (@dnalborczyk) +- [#4479](https://github.com/rollup/rollup/pull/4479): chore(repo): replace `git.io` in the issue template (@SukkaW) +- [#4482](https://github.com/rollup/rollup/pull/4482): feat: add Object.hasOwn as pure function (@dnalborczyk) + +## 2.70.2 + +_2022-04-15_ + +### Bug Fixes + +- Do not enforce undefined return values in TypeScript types (#4463) + +### Pull Requests + +- [#4463](https://github.com/rollup/rollup/pull/4463): use void for options hook instead of undefined (@ycmjason) + +## 2.70.1 + +_2022-03-14_ + +### Bug Fixes + +- Handle unfinished hook action errors as regular errors and avoid console logging (#4434) +- Allow access to "dist" folder in a Node 17 compatible way (#4436) + +### Pull Requests + +- [#4434](https://github.com/rollup/rollup/pull/4434): Track unfinished hook actions as regular errors (@lukastaegert) +- [#4436](https://github.com/rollup/rollup/pull/4436): Update package.json (@frank-dspeed) + +## 2.70.0 + +_2022-03-07_ + +### Features + +- Make the `watchChange` and `closeWatcher` hooks asynchronous and make Rollup wait for these hooks before continuing (#4427) + +### Bug Fixes + +- Do not abort watch mode for errors in `watchChange` but display them properly (#4427) + +### Pull Requests + +- [#4427](https://github.com/rollup/rollup/pull/4427): Do not abort watch mode on errors in watchChange (@lukastaegert) + +## 2.69.2 + +_2022-03-06_ + +### Bug Fixes + +- Mark `Object.entries` and `Object.fromEntries` as pure (#4429) +- Make sure new properties on Array.prototype and Object.prototype are not evaluated as "undefined" (#4428) + +### Pull Requests + +- [#4428](https://github.com/rollup/rollup/pull/4428): Treat unknown prototype props as unknown (@lukastaegert) +- [#4429](https://github.com/rollup/rollup/pull/4429): Treat unknown prototype props as unknown (@869288142) + +## 2.69.1 + +_2022-03-04_ + +### Bug Fixes + +- Approximate source position instead of ignoring it when using a low-resolution source map in a transform hook (#4334) + +### Pull Requests + +- [#4334](https://github.com/rollup/rollup/pull/4334): fix(sourcemap): fall back to low-resolution line mapping (@aleclarson and @lukastaegert) + +## 2.69.0 + +_2022-03-02_ + +### Features + +- Introduce new `output.generatedCode.symbols` to control the usage of Symbols in Rollup-generated code (#4378) +- soft-deprecate `output.namespaceToStringTag` in favor of `output.generatedCode.symbols` (#4378) + +### Bug Fixes + +- Properly handle `./` and `../` as external dependencies (#4419) +- Make generated "Module" namespace toStringTag non-enumerable for correct Object.assign/spread behaviour (#4378) +- Add file name to error when top-level-await is used in disallowed formats (#4421) + +### Pull Requests + +- [#4378](https://github.com/rollup/rollup/pull/4378): Make namespace @@toStringTag "Module" non-enumerable (@dnalborczyk and @lukastaegert) +- [#4413](https://github.com/rollup/rollup/pull/4413): refactor: some code and type fixes (@dnalborczyk) +- [#4418](https://github.com/rollup/rollup/pull/4418): chore: bump deps (@dnalborczyk) +- [#4419](https://github.com/rollup/rollup/pull/4419): Properly handle upper directories as external dependencies (@lukastaegert) +- [#4421](https://github.com/rollup/rollup/pull/4421): Improve the error prompt and output the error file name (@caoxiemeihao) +- [#4423](https://github.com/rollup/rollup/pull/4423): Update 999-big-list-of-options.md (@leoj3n) + +## 2.68.0 + +_2022-02-22_ + +### Features + +- provide information about cached import resolutions in `shouldTransformCachedModule` (#4414) +- Add "types" field to Rollup's package exports (#4416) + +### Pull Requests + +- [#4410](https://github.com/rollup/rollup/pull/4410): refactor: use map for declarations and name suggestions (@dnalborczyk) +- [#4411](https://github.com/rollup/rollup/pull/4411): refactor: use map for namespace reexports by name (@dnalborczyk) +- [#4412](https://github.com/rollup/rollup/pull/4412): refactor: use includes where appropriate (@dnalborczyk) +- [#4414](https://github.com/rollup/rollup/pull/4414): Add resolved sources to shouldTransformCachedModule (@lukastaegert) +- [#4416](https://github.com/rollup/rollup/pull/4416): Add Typescript 4.5 nodenext node12 module resolution support (@frank-dspeed) + +## 2.67.3 + +_2022-02-18_ + +### Bug Fixes + +- Do not swallow other errors when unfinished hook actions are detected (#4409) +- Add additional information to output when there are unfinished hook actions (#4409) + +### Pull Requests + +- [#4399](https://github.com/rollup/rollup/pull/4399): docs: remove const (@TrickyPi) +- [#4401](https://github.com/rollup/rollup/pull/4401): Improve test stability by getting independent of module id ordering in more places (@lukastaegert) +- [#4403](https://github.com/rollup/rollup/pull/4403): fix: remove unnecessary property descriptor spread (@dnalborczyk) +- [#4404](https://github.com/rollup/rollup/pull/4404): refactor: use map for import descriptions + re-export descriptions (@dnalborczyk) +- [#4405](https://github.com/rollup/rollup/pull/4405): refactor: module exports to map (@dnalborczyk) +- [#4406](https://github.com/rollup/rollup/pull/4406): Fix a typo in 'Direct plugin communication' code example (@younesmln) +- [#4407](https://github.com/rollup/rollup/pull/4407): Document how resolveId is cached (@lukastaegert) +- [#4409](https://github.com/rollup/rollup/pull/4409): Print ids for unfinished moduleParsed and shouldTransformCachedModule hooks (@lukastaegert) + +## 2.67.2 + +_2022-02-10_ + +### Bug Fixes + +- Ensure consistent order between manual chunks to fix hashing issues (#4397) + +### Pull Requests + +- [#4390](https://github.com/rollup/rollup/pull/4390): refactor: add @types/estree explicitly, fix dynamic type imports (@dnalborczyk) +- [#4391](https://github.com/rollup/rollup/pull/4391): chore: remove acorn-walk ambient type definitions (@dnalborczyk) +- [#4397](https://github.com/rollup/rollup/pull/4397): Sort manual chunks generated via a function by name (@lukastaegert) + +## 2.67.1 + +_2022-02-07_ + +### Bug Fixes + +- Make chunk file and variable names more deterministic when emitting chunks (#4386) +- Improve default module resolver performance by using non-blocking IO (#4386) + +### Pull Requests + +- [#4373](https://github.com/rollup/rollup/pull/4373): fix: even more types (@dnalborczyk) +- [#4382](https://github.com/rollup/rollup/pull/4382): Update contribution tut link desc (@lemredd) +- [#4383](https://github.com/rollup/rollup/pull/4383): chore: bump deps (@dnalborczyk) +- [#4384](https://github.com/rollup/rollup/pull/4384): chore: move "wait" to utils + re-use (@dnalborczyk) +- [#4385](https://github.com/rollup/rollup/pull/4385): refactor: convert watch tests to async functions (@dnalborczyk) +- [#4386](https://github.com/rollup/rollup/pull/4386): refactor: use fs.promises in resolve id, Part 4 (@dnalborczyk and @lukastaegert) +- [#4389](https://github.com/rollup/rollup/pull/4389): refactor: use fs.promises in generate license file, rollup config, Part 5 (@dnalborczyk) + +## 2.67.0 + +_2022-02-02_ + +### Features + +- Improve side effect detection when using Array.prototype.groupBy/groupByToMap (#4360) +- Allow changing `moduleSideEffects` at any time during the build (#4379) +- Soft-deprecate `ModuleInfo.hasModuleSideEffects` in favour of `ModuleInfo.moduleSideEffects` (#4379) + +### Bug Fixes + +- Do not include queries and hashes in generated file names when preserving modules (#4374) + +### Pull Requests + +- [#4319](https://github.com/rollup/rollup/pull/4319): refactor: use fs, fs-extra, remove sander (@dnalborczyk) +- [#4360](https://github.com/rollup/rollup/pull/4360): feat: add Array.prototype.groupBy/groupByToMap (@dnalborczyk) +- [#4361](https://github.com/rollup/rollup/pull/4361): fix: more types (@dnalborczyk) +- [#4369](https://github.com/rollup/rollup/pull/4369): fix: remove acorn-walk patch (@dnalborczyk) +- [#4371](https://github.com/rollup/rollup/pull/4371): refactor: use fs.promises in cli/run (@dnalborczyk) +- [#4372](https://github.com/rollup/rollup/pull/4372): refactor: use fs.promises in module loader (@dnalborczyk) +- [#4374](https://github.com/rollup/rollup/pull/4374): Ignore queries and hashes in file names when preserving modules (@lukastaegert) +- [#4375](https://github.com/rollup/rollup/pull/4375): Fix typo in \_config.js (@eltociear) +- [#4376](https://github.com/rollup/rollup/pull/4376): refactor: fs.promises, move mkdir to writeoutputfile, Part 3 (@dnalborczyk) +- [#4379](https://github.com/rollup/rollup/pull/4379): Deprecate hasModuleSideEffects in favor of moduleSideEffects and ensure it is mutable on ModuleInfo (@lukastaegert) + +## 2.66.1 + +_2022-01-25_ + +### Bug Fixes + +- Only warn for conflicting names in namespace reexports if it actually causes problems (#4363) +- Only allow explicit exports or reexports as synthetic namespaces and hide them from namespace reexports (#4364) + +### Pull Requests + +- [#4362](https://github.com/rollup/rollup/pull/4362): refactor: convert exportsByName object to map (@dnalborczyk) +- [#4363](https://github.com/rollup/rollup/pull/4363): Do not warn unnecessarily for namespace conflicts (@lukastaegert) +- [#4364](https://github.com/rollup/rollup/pull/4364): Do not expose synthetic namespace export in entries and namespaces (@lukastaegert) + +## 2.66.0 + +_2022-01-22_ + +### Features + +- Note if a module has a default export in ModuleInfo to allow writing better proxy modules (#4356) +- Add option to wait until all imported ids have been resolved when awaiting `this.load` (#4358) + +### Pull Requests + +- [#4356](https://github.com/rollup/rollup/pull/4356): Add hasDefaultExport to ModuleInfo (@lukastaegert) +- [#4358](https://github.com/rollup/rollup/pull/4358): Add "resolveDependencies" option to "this.load" (@lukastaegert) + +## 2.65.0 + +_2022-01-21_ + +### Features + +- Add complete import resolution objects to ModuleInfo for use in `this.load` (#4354) + +### Bug Fixes + +- Use correct context in plugin hooks with `perf: true` (#4357) + +### Pull Requests + +- [#4351](https://github.com/rollup/rollup/pull/4351): refactor: re-use source mapping url (@dnalborczyk) +- [#4352](https://github.com/rollup/rollup/pull/4352): refactor: replace require-relative with built-in require.resolve (@dnalborczyk) +- [#4353](https://github.com/rollup/rollup/pull/4353): chore: bump deps (@dnalborczyk) +- [#4354](https://github.com/rollup/rollup/pull/4354): Add importedIdResolutions to moduleInfo (@lukastaegert) +- [#4355](https://github.com/rollup/rollup/pull/4355): chore: remove external from config (@dnalborczyk) +- [#4357](https://github.com/rollup/rollup/pull/4357): fix: timed plugin context (@dnalborczyk) + +## 2.64.0 + +_2022-01-14_ + +### Features + +- Allow inspecting cached modules and forcing them to be transformed again via shouldTransformCachedModule (#4320) +- Do not wait for the config file to be parsed in watch mode if it is updated before that (#4344) + +### Bug Fixes + +- Do not mutate objects returned as `meta` from the resolveId hook (#4347) + +### Pull Requests + +- [#4326](https://github.com/rollup/rollup/pull/4326): refactor: type fixes (@dnalborczyk) +- [#4339](https://github.com/rollup/rollup/pull/4339): More watch test stabilization (@lukastaegert) +- [#4340](https://github.com/rollup/rollup/pull/4340): refactor: performance timers for node.js and browser (@dnalborczyk) +- [#4341](https://github.com/rollup/rollup/pull/4341): Implement shouldTransformCachedModule hook (@lukastaegert) +- [#4344](https://github.com/rollup/rollup/pull/4344): Directly restart Rollup when config file change is detected in watch mode (@lukastaegert) +- [#4347](https://github.com/rollup/rollup/pull/4347): Create a shallow copy when returning meta from resolveId (@lukastaegert) + +## 2.63.0 + +_2022-01-04_ + +### Features + +- Report a helpful error if rollup exits due to an empty event loop when using `this.load` (#4320) +- Allow directly mutating ModuleInfo.meta for modules and never replace this object (#4328) +- Detect additional side effect free array prototype methods (#4332) + +### Bug Fixes + +- Do not watch if CLI watch options are specified but `--watch` is missing (#4335) + +### Pull Requests + +- [#4320](https://github.com/rollup/rollup/pull/4320): Detect unfulfilled async hook actions and report error on exit (@kzc) +- [#4328](https://github.com/rollup/rollup/pull/4328): Make initial ModuleInfo.meta mutable and maintain object identity (@lukastaegert) +- [#4318](https://github.com/rollup/rollup/pull/4318): Stabilize watch tests (@lukastaegert) +- [#4331](https://github.com/rollup/rollup/pull/4331): Improve JS docs example (@lukastaegert) +- [#4332](https://github.com/rollup/rollup/pull/4332): add support for Array.prototype.findLast,findLastIndex (@dnalborczyk) +- [#4333](https://github.com/rollup/rollup/pull/4333): convert utils.transform to async function (@dnalborczyk) +- [#4335](https://github.com/rollup/rollup/pull/4335): Do not watch unless --watch is specified explicitly (@lukastaegert) +- [#4338](https://github.com/rollup/rollup/pull/4338): Add build delay for plugin event test (@lukastaegert) + +## 2.62.0 + +_2021-12-24_ + +### Features + +- Mark additional string prototype methods as side-effect-free and correct typings of existing ones (#4299) +- Mark additional array prototype methods as side-effect-free and correct typings of existing ones (#4309) +- Expose if a module is included after tree-shaking in its ModuleInfo (#4305) + +### Bug Fixes + +- Fix how fsevents is included to improve watch mode on MacOS (#4312) + +### Pull Requests + +- [#4299](https://github.com/rollup/rollup/pull/4299): Add additional string prototype methods (@dnalborczyk) +- [#4300](https://github.com/rollup/rollup/pull/4300): Bump deps, fix expected test result for core-js (@dnalborczyk) +- [#4302](https://github.com/rollup/rollup/pull/4302): Replace type assertion with type guard (@dnalborczyk) +- [#4304](https://github.com/rollup/rollup/pull/4304): Re-use reserved names set (@dnalborczyk) +- [#4305](https://github.com/rollup/rollup/pull/4305): Expose isIncluded in module info (@william57m) +- [#4306](https://github.com/rollup/rollup/pull/4306): Fix git line breaks on windows (@dnalborczyk) +- [#4307](https://github.com/rollup/rollup/pull/4307): Add macos to pipeline (@dnalborczyk) +- [#4309](https://github.com/rollup/rollup/pull/4309): Add additional array prototype methods (@dnalborczyk) +- [#4311](https://github.com/rollup/rollup/pull/4311): Add Deno instructions to docs (@jespertheend) +- [#4312](https://github.com/rollup/rollup/pull/4312): fsevents integration (@dnalborczyk) +- [#4313](https://github.com/rollup/rollup/pull/4313): Remove non-existing static functions from known globals (@dnalborczyk) + +## 2.61.1 + +_2021-12-11_ + +### Bug Fixes + +- Only resolve this.load once the code of the module is available (#4296) + +### Pull Requests + +- [#4296](https://github.com/rollup/rollup/pull/4296): Make sure this.load waits for modules that are already loading (@lukastaegert) +- [#4298](https://github.com/rollup/rollup/pull/4298): use set for reserved words (@dnalborczyk) + +## 2.61.0 + +_2021-12-09_ + +### Features + +- Support ergonomic brand checks for private fields (#4293) + +### Bug Fixes + +- Improve handling of directory creation on systems with restrictive open files limit (#4288) + +### Pull Requests + +- [#4288](https://github.com/rollup/rollup/pull/4288): modifymkdirpath (@mgrabowski84) +- [#4293](https://github.com/rollup/rollup/pull/4293): bump deps (@dnalborczyk) + +## 2.60.2 + +_2021-11-30_ + +### Bug Fixes + +- Produce correct output when dynamic import paths contain quotes (#4286) + +### Pull Requests + +- [#4286](https://github.com/rollup/rollup/pull/4286): Escape dynamic import paths (@danielroe) + +## 2.60.1 + +_2021-11-22_ + +### Bug Fixes + +- Make sure virtual files have proper file extensions when preserving modules (#4270) + +### Pull Requests + +- [#4270](https://github.com/rollup/rollup/pull/4270): Use entryFileNames when generating filenames for virtual modules (@BPScott) + +## 2.60.0 + +_2021-11-11_ + +### Features + +- Add `this.load` context function to load, transform and parse modules without adding them to the graph (#4234) +- Sanitize non-url-safe characters in generated chunk names by default (#4262) +- Support ESM plugins via command line (#4265) + +### Pull Requests + +- [#4234](https://github.com/rollup/rollup/pull/4234): Plugin context function for pre-loading modules (@lukastaegert) +- [#4262](https://github.com/rollup/rollup/pull/4262): exclude invalid URL chars (@danielroe) +- [#4265](https://github.com/rollup/rollup/pull/4265): support loading ESM plugins from the CLI via --plugin (@kzc) + +## 2.59.0 + +_2021-11-01_ + +### Features + +- Support static class initialization blocks (#4249) + +### Bug Fixes + +- Fix an issue with the CommonJS plugin when module.exports has inherited properties (#4256) + +### Pull Requests + +- [#4236](https://github.com/rollup/rollup/pull/4236): typescript bug class field initialization order (@dnalborczyk) +- [#4249](https://github.com/rollup/rollup/pull/4249): Support for class static initialization block (@dnalborczyk and @lukastaegert) +- [#4256](https://github.com/rollup/rollup/pull/4256): Skip inherited properties in synthetic namespaces (@lukastaegert) + +## 2.58.3 + +_2021-10-25_ + +### Bug Fixes + +- Republish 2.58.1 with npm 6 as files were missing + +## 2.58.2 + +_2021-10-25_ + +### Bug Fixes + +- Republish 2.58.1 as files were missing + +## 2.58.1 + +_2021-10-25_ + +### Bug Fixes + +- Fix an issue with the CommonJS plugin when module.exports is falsy (#4247) + +### Pull Requests + +- [#4247](https://github.com/rollup/rollup/pull/4247): Handle falsy synthetic namespaces (@lukastaegert) + +## 2.58.0 + +_2021-10-01_ + +### Features + +- Add a flag to more reliably identify entry points in the `resolveId` hook (#4230) + +### Pull Requests + +- [#4230](https://github.com/rollup/rollup/pull/4230): Add isEntry flag to resolveId and this.resolve (@lukastaegert) +- [#4233](https://github.com/rollup/rollup/pull/4233): Remove unused rollup-plugin-typescript ambient module types (@dnalborczyk) +- [#4235](https://github.com/rollup/rollup/pull/4235): Update dependencies (@lukastaegert) + +## 2.57.0 + +_2021-09-22_ + +### Features + +- Add `generatedCode` option to allow Rollup to use es2015 features for smaller output and more efficient helpers (#4215) +- Improve AMD and SystemJS parsing performance by wrapping relevant functions in parentheses (#4215) +- Using `preferConst` will now show a warning with `strictDeprecations: true` (#4215) + +### Bug Fixes + +- Improve ES3 syntax compatibility by more consequently quoting reserved words as props in generated code (#4215) +- Do not use `Object.assign` in generated code to ensure ES5 compatibility without the need for polyfills (#4215) +- Support live-bindings in dynamic namespace objects that contain reexported external or synthetic namespaces (#4215) +- Use correct "this" binding in dynamic import expressions for CommonJS and AMD (#4215) +- Properly handle `shimMissingExports` for exports that are only used internally (#4215) +- Prevent unhandled rejection for failed module parsing (#4228) + +### Pull Requests + +- [#4212](https://github.com/rollup/rollup/pull/4212): chore: remove unused ambient types (@dnalborczyk) +- [#4215](https://github.com/rollup/rollup/pull/4215): Use ES2015 features in generated code snippets (@lukastaegert) +- [#4219](https://github.com/rollup/rollup/pull/4219): chore: bump rollup typescript, remove unused micromatch (@dnalborczyk) +- [#4220](https://github.com/rollup/rollup/pull/4220): chore: use forceConsistentCasingInFileNames in ts-config (@dnalborczyk) +- [#4224](https://github.com/rollup/rollup/pull/4224): prepare for useDefineForClassFields (@dnalborczyk) +- [#4228](https://github.com/rollup/rollup/pull/4228): fix: prevent UnhandledPromiseRejectionWarning when module resolution/parsing fails (@kherock) + +## 2.56.3 + +_2021-08-23_ + +### Bug Fixes + +- Make sure moduleInfo contains complete information about imported ids in the moduleParsed hook (#4208) + +### Pull Requests + +- [#4208](https://github.com/rollup/rollup/pull/4208): `ModuleInfo.importedIds` will return null if `resolvedIds[source]` is undefined (@FoxDaxian and @lukastaegert) + +## 2.56.2 + +_2021-08-10_ + +### Bug Fixes + +- Check if after simplification, an object pattern would become an expression statement or arrow function return value (#4204) + +### Pull Requests + +- [#4204](https://github.com/rollup/rollup/pull/4204): Do not create invalid code when simplifying object pattern assignments (@lukastaegert) + +## 2.56.1 + +_2021-08-08_ + +### Bug Fixes + +- Fix rendering of SystemJS export declarations initialized with a simplifiable expression (#4202) + +### Pull Requests + +- [#4202](https://github.com/rollup/rollup/pull/4202): Fix incorrect rendering of export declarations in SystemJS (@lukastaegert) + +## 2.56.0 + +_2021-08-05_ + +### Features + +- Create more efficient code for SystemJS exports (#4199) +- Extend `maxParallelFileReads` option to also throttle plugin load hooks (#4200) + +### Bug Fixes + +- Return correct value for postfix update expressions of exported variables (#4194) + +### Pull Requests + +- [#4199](https://github.com/rollup/rollup/pull/4199): Refine SystemJS export rendering (@lukastaegert) +- [#4200](https://github.com/rollup/rollup/pull/4200): Restrict parallel execution of load hook (@schummar) + +## 2.55.1 + +_2021-07-29_ + +### Bug Fixes + +- Improve CLI warning message for unused external imports (#4194) + +### Pull Requests + +- [#4194](https://github.com/rollup/rollup/pull/4194): Align batch warning for UNUSED_EXTERNAL_IMPORT to individual warning (@benmccann) + +## 2.55.0 + +_2021-07-28_ + +### Features + +- Support default export live-bindings when generating ESM output (#4182) + +### Bug Fixes + +- Always write `["default"]` as computed property when used as named export (#4182) +- Do not mask default export TDZ errors (#4182) + +### Pull Requests + +- [#4182](https://github.com/rollup/rollup/pull/4182): Use mutable bindings for default exports (@lukastaegert) + +## 2.54.0 + +_2021-07-25_ + +### Features + +- Extend UMD import.meta.url polyfill to support web workers (#4186) + +### Bug Fixes + +- Resolve an issue where certain uses of classes could lead to an infinite recursion (#4189) + +### Pull Requests + +- [#4186](https://github.com/rollup/rollup/pull/4186): Fix UMD import.meta.url inside web workers (@ceifa) +- [#4188](https://github.com/rollup/rollup/pull/4188): Fix typo in renderHelpers.ts (@eltociear) +- [#4189](https://github.com/rollup/rollup/pull/4189): Move long path recursion prevention to MemberExpression (@lukastaegert) +- [#4190](https://github.com/rollup/rollup/pull/4190): Stop recommending node-builtins (@curran) + +## 2.53.3 + +_2021-07-21_ + +### Bug Fixes + +- Solve an issue that could lead to severe memory issues and crashes when there are a lot of hoisted variables (#4183) + +### Pull Requests + +- [#4183](https://github.com/rollup/rollup/pull/4183): Avoid memory issues with hoisted variables (@lukastaegert) + +## 2.53.2 + +_2021-07-15_ + +### Bug Fixes + +- Identify additional TDZ situations in functions that are run more than once (#4177) +- Fix a scoping issue when a variable inside a catch scope matches the scope parameter's name (#4178) + +### Pull Requests + +- [#4177](https://github.com/rollup/rollup/pull/4177): Fix additional let/var init bugs (@kzc) +- [#4178](https://github.com/rollup/rollup/pull/4178): Correctly create outside variable when shadowed by catch parameter (@lukastaegert) + +## 2.53.1 + +_2021-07-11_ + +### Bug Fixes + +- Do not omit namespace reexports when `treeshake` is `false` (#4175) + +### Pull Requests + +- [#4175](https://github.com/rollup/rollup/pull/4175): Generate namespace objects when not tree-shaking (@lukastaegert) + +## 2.53.0 + +_2021-07-09_ + +### Features + +- Add `maxParallelFileReads` option to limit read operations with a default of 20 (#4170) + +### Pull Requests + +- [#4170](https://github.com/rollup/rollup/pull/4170): Limit parallel file reads to prevent "EMFILE: too many open files" error (@schummar) + +## 2.52.8 + +_2021-07-07_ + +### Bug Fixes + +- Automatically handle many use `var` before declaration and TDZ access scenarios correctly without the need for `treeshake.correctVarValueBeforeDeclaration` (#4148) + +### Pull Requests + +- [#4148](https://github.com/rollup/rollup/pull/4148): Fix var/const/let variable use before declaration (@kzc and @lukastaegert) + +## 2.52.7 + +_2021-07-02_ + +### Bug Fixes + +- Fix an issue where reassignments where not tracked through async function returns (#4163) + +### Pull Requests + +- [#4163](https://github.com/rollup/rollup/pull/4163): Deoptimize return values of async functions (@lukastaegert) + +## 2.52.6 + +_2021-07-01_ + +### Bug Fixes + +- Fix an issue where reassignments where not tracked through an await expression (#4162) + +### Pull Requests + +- [#4162](https://github.com/rollup/rollup/pull/4162): doptimize awaited expressions (@lukastaegert) + +## 2.52.5 + +_2021-07-01_ + +### Bug Fixes + +- Properly display parser errors not tied to a code location (#4160) + +### Pull Requests + +- [#4160](https://github.com/rollup/rollup/pull/4160): fix: max stack call error is caught on locate (@semoal) + +## 2.52.4 + +_2021-06-30_ + +### Bug Fixes + +- Fix an error when external namespaces are reexported across several files (#4159) + +### Pull Requests + +- [#4159](https://github.com/rollup/rollup/pull/4159): Properly handle double reexports from external namespaces (@lukastaegert) + +## 2.52.3 + +_2021-06-25_ + +### Bug Fixes + +- Fix an issue where code was wrongly removed when using vars in nested scopes (#4149) + +### Pull Requests + +- [#4149](https://github.com/rollup/rollup/pull/4149): Make sure the initializer of hoisted variables is deoptimized (@lukastaegert) + +## 2.52.2 + +_2021-06-21_ + +### Bug Fixes + +- Support falsy plugins in types (#4144) +- Do not require return value in renderChunkHook type (#4144) + +### Pull Requests + +- [#4144](https://github.com/rollup/rollup/pull/4144): Use TypeScript config and improve some types (@lukastaegert) + +## 2.52.1 + +_2021-06-17_ + +### Bug Fixes + +- Fix a memory leak in watch mode (#4142) + +### Pull Requests + +- [#4142](https://github.com/rollup/rollup/pull/4142): Make array and object prototype singletons immutable for now (@lukastaegert) + +## 2.52.0 + +_2021-06-16_ + +### Features + +- Add `--configPlugin` CLI option to apply plugins to the config file for e.g. TypeScript configs (#3835) +- Add "safest" and "smallest" presets to tree-shaking options for easier configuration (#4131) +- Add `treeshake.correctVarValueBeforeDeclaration` option to deoptimize `var` declarations (#4139) + +### Pull Requests + +- [#3835](https://github.com/rollup/rollup/pull/3835): Add typescript config support (@TheRealSyler) +- [#4131](https://github.com/rollup/rollup/pull/4131): Add presets to the tree-shaking options (@lukastaegert) +- [#4139](https://github.com/rollup/rollup/pull/4139): Add option to deoptimize var declarations for tree-shaking (@lukastaegert) +- [#4141](https://github.com/rollup/rollup/pull/4141): Update dependencies (@lukastaegert) + +## 2.51.2 + +_2021-06-11_ + +### Bug Fixes + +- Include modules imported from no-treeshake modules even if they would be empty (#4138) + +### Pull Requests + +- [#4138](https://github.com/rollup/rollup/pull/4138): Include all dependencies from modules with no-treeshake (@lukastaegert) + +## 2.51.1 + +_2021-06-08_ + +### Bug Fixes + +- Fix error when using `defineConfig` (#4134) + +### Pull Requests + +- [#4134](https://github.com/rollup/rollup/pull/4134): export `rollup.defineConfig` at runtime (@mshrtsr) + +## 2.51.0 + +_2021-06-06_ + +### Features + +- Add a helper for IntelliSense support in config files (#4127) + +### Bug Fixes + +- Improve performance when generating source maps (#4122) + +### Pull Requests + +- [#4122](https://github.com/rollup/rollup/pull/4122): User Map to optimize performance (@izevo) +- [#4127](https://github.com/rollup/rollup/pull/4127): Export defineConfig defines the auxiliary function of the configuration (@rxliuli) + +## 2.50.6 + +_2021-06-03_ + +### Bug Fixes + +- Do not consider the object spread operator as side effect when `propertyReadSideEffects` are false (#4119) +- Detect side effects when returning thenables from async arrow functions (#4120) + +### Pull Requests + +- [#4119](https://github.com/rollup/rollup/pull/4119): Respect propertyReadSideEffects in spread elements (@lukastaegert) +- [#4120](https://github.com/rollup/rollup/pull/4120): Detect async arrow thenable side effects (@lukastaegert) + +## 2.50.5 + +_2021-05-30_ + +### Bug Fixes + +- Detect side effects when accessing thenables (#4115) + +### Pull Requests + +- [#4114](https://github.com/rollup/rollup/pull/4114): use `colorette` instead of `turbocolor` (@ryuever) +- [#4115](https://github.com/rollup/rollup/pull/4115): Tracks side effects of thenables (@lukastaegert) + +## 2.50.4 + +_2021-05-29_ + +### Bug Fixes + +- Fix a situation where tree-shaking would stop including nodes prematurely (#4111) +- Track mutations and accessor side effects when using `__proto__` in an object literal (#4112) +- Check for getter effects when spreading an object (#4113) + +### Pull Requests + +- [#4111](https://github.com/rollup/rollup/pull/4111): Always request a new tree-shaking pass when deoptimizations of a node are first included (@lukastaegert) +- [#4112](https://github.com/rollup/rollup/pull/4112): Actually set the prototype when using a **proto** property (@lukastaegert) +- [#4113](https://github.com/rollup/rollup/pull/4113): Track access side effects when using object spread operator (@lukastaegert) + +## 2.50.3 + +_2021-05-28_ + +### Bug Fixes + +- Wrap parentheses around leading elements in simplified sequence expressions if this would otherwise lead to invalid code (#4110) +- Do not associate block soped variables in catch clauses with the clause parameter (#4108) +- Do not associate hoisted variables in catch clauses with outside variables if they match the parameter (#4108) +- Use correct "this" context for tagged template literal member expressions in simplified sequences (#4110) + +### Pull Requests + +- [#4108](https://github.com/rollup/rollup/pull/4108): Correctly handle catch declarations (@lukastaegert) +- [#4110](https://github.com/rollup/rollup/pull/4110): Invalid sequence expression simplification (@lukastaegert) + +## 2.50.2 + +_2021-05-27_ + +### Bug Fixes + +- Avoid unnecessary side effects when using methods like `.filter` and `.map` (#4103) +- Avoid crash when a module with moduleSideEffects no-treeshake imports a tree-shaken module (#4104) + +### Pull Requests + +- [#4103](https://github.com/rollup/rollup/pull/4103): Do not track side-effect-free array methods as side effects (@lukastaegert) +- [#4104](https://github.com/rollup/rollup/pull/4104): Fix crash when using inlineDynamicImports with no-treeshake (@lukastaegert) + +## 2.50.1 + +_2021-05-26_ + +### Bug Fixes + +- Do not associate pure annotations in simplified expressions with wrong elements (#4095) +- Prevent invalid code when simplified conditionals start with an IIFE function expression (#4099) + +### Pull Requests + +- [#4095](https://github.com/rollup/rollup/pull/4095): Correctly associate pure annotations and remove invalid ones (@lukastaegert) +- [#4099](https://github.com/rollup/rollup/pull/4099): Wrap leading function expression iifes in conditionals (@lukastaegert) + +## 2.50.0 + +_2021-05-25_ + +### Features + +- Only include last elements of comma expressions if they are used or have side effects (#4087) + +### Bug Fixes + +- Prevent a crash that could occur when calling object methods (#4091) + +### Pull Requests + +- [#4085](https://github.com/rollup/rollup/pull/4085): Switch to ESLint (@lukastaegert) +- [#4087](https://github.com/rollup/rollup/pull/4087): Drop unused last sequence element (@lukastaegert) +- [#4091](https://github.com/rollup/rollup/pull/4091): Prevent crash for recursive "this" deoptimization (@lukastaegert) + +## 2.49.0 + +_2021-05-23_ + +### Features + +- Detect side-effect-free static class methods and properties (#4018) +- Detect side-effect-free array elements (#4018) +- Do not apply deoptimizations from dead code (#4018) + +### Bug Fixes + +- Handle side effect detection for getters and setters added in untracked code (#4018) +- Track "this" mutations for methods, getters and setters (#4018) + +### Pull Requests + +- [#4018](https://github.com/rollup/rollup/pull/4018): Class method effects (@marijnh and @lukastaegert) + +## 2.48.0 + +_2021-05-15_ + +### Features + +- Add replacement to conditionally insert asset extensions in `entryFileNames` when preserving modules (#4077) + +### Bug Fixes + +- Fix crash when dynamically assigning to namespace members (#4070) +- Do not associate pure annotations in front of a semi-colon or comma with succeeding code (#4068) + +### Pull Requests + +- [#4068](https://github.com/rollup/rollup/pull/4068): ignore invalid trailing pure annotations (@kzc) +- [#4070](https://github.com/rollup/rollup/pull/4070): undefined `deoptimizePath` when the first element is empty string (@si3nloong) +- [#4071](https://github.com/rollup/rollup/pull/4071): add node.js v16 support (@dnalborczyk) +- [#4077](https://github.com/rollup/rollup/pull/4077): Add assetExtname replacement in entryFileNames (@BPScott) +- [#4080](https://github.com/rollup/rollup/pull/4080): Added Rollup logo in README.md (@priyanshurav) +- [#4081](https://github.com/rollup/rollup/pull/4081): fix comment regarding invalid annotation handling (@kzc) + +## 2.47.0 + +_2021-05-04_ + +### Features + +- Warn about ambiguous imports from combined external namespace reexports (#4064) +- In case of combined namespace reexports, always prefer local exports over external namespaces (#4064) +- Treat conflicting names in local namespace reexports as undefined (#4064) + +### Pull Requests + +- [#4064](https://github.com/rollup/rollup/pull/4064): Prefer locally defined exports and reexports over external namespaces (@lukastaegert) + +## 2.46.0 + +_2021-04-29_ + +### Features + +- Add option to disable file name sanitation (#4058) +- Add information about importers to unused external import warning (#4054) + +### Pull Requests + +- [#4042](https://github.com/rollup/rollup/pull/4042): Use Github actions only (@lukastaegert) +- [#4045](https://github.com/rollup/rollup/pull/4045): Fix REPL artefact branch reference (@lukastaegert) +- [#4046](https://github.com/rollup/rollup/pull/4046): Use codecov action for coverage (@lukastaegert) +- [#4054](https://github.com/rollup/rollup/pull/4054): Add to `UNUSED_EXTERNAL_IMPORT` warning information about the origin of the problem (@cawa-93) +- [#4058](https://github.com/rollup/rollup/pull/4058): Add sanitizeFileName option (@guybedford) + +## 2.45.2 + +_2021-04-13_ + +### Bug Fixes + +- Do not user a dynamic entry file name for naming a manual chunk (#4040) + +### Pull Requests + +- [#4040](https://github.com/rollup/rollup/pull/4040): Prioritize manual chunk name over dynamic entry id (@lukastaegert) + +## 2.45.1 + +_2021-04-10_ + +### Bug Fixes + +- Handle falsy return values from async plugin options hooks (#4039) + +### Pull Requests + +- [#4039](https://github.com/rollup/rollup/pull/4039): Do not fail when returning null or undefined from an async options hook (@lukastaegert) + +## 2.45.0 + +_2021-04-09_ + +### Features + +- Support private class instance methods and accessors (#4034) + +### Pull Requests + +- [#4034](https://github.com/rollup/rollup/pull/4034): feat: add support for private class methods (@dnalborczyk) + +## 2.44.0 + +_2021-03-29_ + +### Features + +- Add a new option `makeAbsoluteExternalsRelative` to opt out of renormalizing absolute external ids to relative ids (#4021) +- Extend the `resolveId` plugin hook to allow forcing or preventing renormalization of absolute external ids (#4021) +- Make the rendered code of individual modules available in the generated bundle (#4028) + +### Bug Fixes + +- Handle objects with `__proto__` properties correctly (#4019) + +### Pull Requests + +- [#4019](https://github.com/rollup/rollup/pull/4019): Deoptimize ObjectExpression when a `__proto__` property is present (@marijnh) +- [#4021](https://github.com/rollup/rollup/pull/4021): Improve absolute path handling (@lukastaegert) +- [#4026](https://github.com/rollup/rollup/pull/4026): chore: fix vscode launch config (change tdd to bdd) (@jameslahm) +- [#4027](https://github.com/rollup/rollup/pull/4027): Post comment for PRs from forks (@lukastaegert) +- [#4028](https://github.com/rollup/rollup/pull/4028): Expose rendered module code to generateBundle hook (@btd) + +## 2.43.1 + +_2021-03-28_ + +### Bug Fixes + +- Prevent infinite recursions in certain scenarios when calling object properties (#4025) + +### Pull Requests + +- [#4025](https://github.com/rollup/rollup/pull/4025): Handle recursive this mutation detection (@lukastaegert) + +## 2.43.0 + +_2021-03-27_ + +### Features + +- Track side effects of function properties in objects for better tree-shaking (#4011) + +### Pull Requests + +- [#4011](https://github.com/rollup/rollup/pull/4011): Disable pessimistic object deoptimization for calls when the called function doesn't ref this (@marijnh) +- [#4012](https://github.com/rollup/rollup/pull/4012): fix `sourcemap` reference in docs (@tjenkinson) +- [#4015](https://github.com/rollup/rollup/pull/4015): Use SIGTERM instead of SIGINT to kill test child processes in tests (@marijnh) + +## 2.42.4 + +_2021-03-24_ + +### Bug Fixes + +- Do not discard plugin return values when using perf option (#4010) + +### Pull Requests + +- [#4010](https://github.com/rollup/rollup/pull/4010): Return hook result inside promise with async timer end (@SuperOleg39) + +## 2.42.3 + +_2021-03-22_ + +### Bug Fixes + +- Do not ignore `#__PURE__` comments in front of optional chaining expressions (#4007) + +### Pull Requests + +- [#4007](https://github.com/rollup/rollup/pull/4007): Tree-shake pure call expressions with optional chaining (@lukastaegert) + +## 2.42.2 + +_2021-03-22_ + +### Bug Fixes + +- Use correct import.meta.url in relative imports from transpiled config files (#4005) + +### Pull Requests + +- [#4005](https://github.com/rollup/rollup/pull/4005): Use correct import.meta.url in config files (@lukastaegert) + +## 2.42.1 + +_2021-03-20_ + +### Bug Fixes + +- Do not produce unhandled Promise rejections when plugins throw while using the `perf` option (#4004) + +### Pull Requests + +- [#4004](https://github.com/rollup/rollup/pull/4004): Fixed unhandled promise rejections (@gluck) + +## 2.42.0 + +_2021-03-19_ + +### Features + +- Prevent infinite loops when several plugins are using `this.resolve` in their resolveId hook (#4000) + +### Pull Requests + +- [#4000](https://github.com/rollup/rollup/pull/4000): Break infinite loops in this.resolve (@lukastaegert) + +## 2.41.5 + +_2021-03-18_ + +### Bug Fixes + +- Make sure unused property accesses of external namespaces can be tree-shaken (#4001) + +### Pull Requests + +- [#4001](https://github.com/rollup/rollup/pull/4001): Do not count accessing members of an external namespace as side-effects (@lukastaegert) + +## 2.41.4 + +_2021-03-16_ + +### Bug Fixes + +- Do not replace external namespace imports with individual named imports to avoid changing behaviour with regard to missing exports (#3999) + +### Pull Requests + +- [#3999](https://github.com/rollup/rollup/pull/3999): Allow to safely probe external namespaces (@lukastaegert) + +## 2.41.3 + +_2021-03-16_ + +### Bug Fixes + +- Always retain arguments passed to empty object pattern parameters (#3998) + +### Pull Requests + +- [#3998](https://github.com/rollup/rollup/pull/3998): Do not create invalid code if a function argument is an empty object pattern (@lukastaegert) + +## 2.41.3 + +_2021-03-16_ + +### Bug Fixes + +- Always retain arguments passed to empty object pattern parameters (#3998) + +### Pull Requests + +- [#3998](https://github.com/rollup/rollup/pull/3998): Do not create invalid code if a function argument is an empty object pattern (@lukastaegert) + +## 2.41.2 + +_2021-03-12_ + +### Bug Fixes + +- Also remove sourcemaps comments if plugins return a pre-made ast (#3987) + +### Pull Requests + +- [#3987](https://github.com/rollup/rollup/pull/3987): Change removal of sourcemap comment (@yannayl) + +## 2.41.1 + +_2021-03-11_ + +### Pull Requests + +- [#3990](https://github.com/rollup/rollup/pull/3990): Add browser sourcemap and remove log (@lukastaegert) + +## 2.41.0 + +_2021-03-09_ + +### Features + +- Add option to `treeshake.propertyReadSideEffects` to keep all property accesses (#3985) + +### Bug Fixes + +- Also respect pure comment annotations when a plugin provides an AST in the transform hook provided they use this.parse (#3981) + +### Pull Requests + +- [#3981](https://github.com/rollup/rollup/pull/3981): Move pure comment annotation to Graph.contextParse (@yannayl) +- [#3985](https://github.com/rollup/rollup/pull/3985): implement --treeshake.propertyReadSideEffects=always to handle getters with side effects (@kzc) + +## 2.40.0 + +_2021-02-26_ + +### Features + +- Make sure that entry point variable names take precedence over variable names in dependencies when deconflicting (#3977) + +### Bug Fixes + +- Replace `:` in generated file names to prevent invalid files on Windows (#3972) + +### Pull Requests + +- [#3972](https://github.com/rollup/rollup/pull/3972): Don't allow `:` in file names (@lukastaegert) +- [#3976](https://github.com/rollup/rollup/pull/3976): Add soft breaks to guide to improve mobile experience (@lukastaegert) +- [#3977](https://github.com/rollup/rollup/pull/3977): Reverse module deconflicting order (@lukastaegert) + +## 2.39.1 + +_2021-02-23_ + +### Bug Fixes + +- Make sure local variables named Symbol, Object or Promise do not conflict with code generated by Rollup (#3971) + +### Pull Requests + +- [#3964](https://github.com/rollup/rollup/pull/3964): Remove extra word (@jamonholmgren) +- [#3971](https://github.com/rollup/rollup/pull/3971): Avoid conflicts with local variables named Symbol, Object, Promise (@lukastaegert) + +## 2.39.0 + +_2021-02-12_ + +### Features + +- Add "validate" option to verify generated chunks are valid JavaScript (#3952) + +### Bug Fixes + +- Always add exports properties for uninitialized named exports (#3957) +- Allow using an external namespace reexport together with named exports (#3959) +- Avoid invalid generated code in certain scenarios with SystemJS exports (#3960) + +### Pull Requests + +- [#3952](https://github.com/rollup/rollup/pull/3952): implement `validate` output option and `--validate` CLI option (@kzc) +- [#3956](https://github.com/rollup/rollup/pull/3956): Update dependencies, fix fsevents issue (@lukastaegert) +- [#3957](https://github.com/rollup/rollup/pull/3957): Make sure uninitialised exports turn up via .hasOwnProperty for non-ES formats (@lukastaegert) +- [#3959](https://github.com/rollup/rollup/pull/3959): Allow overriding individual exports of reexported external namespaces (@lukastaegert) +- [#3960](https://github.com/rollup/rollup/pull/3960): Make sure system exports are valid JavaScript (@lukastaegert) + +## 2.38.5 + +_2021-02-05_ + +### Bug Fixes + +- Prevent invalid code when simplifying assignments and delcarations (#3951) +- Prevent behaviour-changing line-breaks when simplifying assignments in return statements (#3951) +- Slightly improve white-space rendering when simplifying certain expressions (#3951) + +### Pull Requests + +- [#3951](https://github.com/rollup/rollup/pull/3951): Wrap simplified assignments if necessary (@lukastaegert) + +## 2.38.4 + +_2021-02-02_ + +### Bug Fixes + +- Do not change logic when tree-shaking declarations in if statements or loops (#3947) + +### Pull Requests + +- [#3947](https://github.com/rollup/rollup/pull/3947): Do not tear apart declarations in loop or if bodies (@lukastaegert) + +## 2.38.3 + +_2021-02-01_ + +### Bug Fixes + +- Prevent an unexpected live-binding when default exporting a synthetic named export (#3946) + +### Pull Requests + +- [#3945](https://github.com/rollup/rollup/pull/3945): Upgrade chokidar and fsevents for Apple M1 compatibility (@threepointone) +- [#3946](https://github.com/rollup/rollup/pull/3946): Make sure default exports snapshot synthetic named exports (@lukastaegert) + +## 2.38.2 + +_2021-01-31_ + +### Bug Fixes + +- Do not generate invalid code for partially tree-shaken declarations in for loops (#3943) +- Always include function bodies of functions in side-effect-free modules (#3944) + +### Pull Requests + +- [#3943](https://github.com/rollup/rollup/pull/3943): Do not partially tree-shake unused declarations in for loops (@lukastaegert) +- [#3944](https://github.com/rollup/rollup/pull/3944): Correctly include functions with side effects from side-effect-free modules (@lukastaegert) + +## 2.38.1 + +_2021-01-28_ + +### Bug Fixes + +- Fix internal error when resolving a missing entry point in the browser build (#3935) + +### Pull Requests + +- [#3935](https://github.com/rollup/rollup/pull/3935): fix: remove isolated resolve() for compat with browser distribution (@cmorten and @lukastaegert) +- [#3936](https://github.com/rollup/rollup/pull/3936): Ensure test after() callback is always executed (@Benjamin-Dobell) +- [#3937](https://github.com/rollup/rollup/pull/3937): Modernize references to other software (@ludofischer) + +## 2.38.0 + +_2021-01-22_ + +### Features + +- Entirely remove declared variables that only have an initializer side effect (#3933) + +### Pull Requests + +- [#3933](https://github.com/rollup/rollup/pull/3933): Tree-shake unused declarations while keeping initializer side-effects (@lukastaegert) + +## 2.37.1 + +_2021-01-20_ + +### Pull Requests + +- [#3929](https://github.com/rollup/rollup/pull/3929): Deduplicate acorn import (@lukastaegert) + +## 2.37.0 + +_2021-01-19_ + +### Features + +- Always check modules for side effects that only indirectly reexport a used variable (#3840) +- Warn if a circular dependency would cause wrong execution order when preserving modules (#3840) + +### Bug Fixes + +- Allow consuming synthetic exports via modules that reexport a namespace (#3894) +- Do not crash for circular default reexports (#3840) +- Do not crash for circular synthetic namespaces (#3840) +- Improve circular dependency execution order in certain scenarios (#3840) + +### Pull Requests + +- [#3840](https://github.com/rollup/rollup/pull/3840): Improve circular dependency execution order (@lukastaegert) +- [#3894](https://github.com/rollup/rollup/pull/3894): Always respect synthetic namespaces in namespace reexport (@lukastaegert) + +## 2.36.2 + +_2021-01-16_ + +### Bug Fixes + +- Fix an issue where invalid code was generated for unused assignments with side effects (#3926) + +### Pull Requests + +- [#3926](https://github.com/rollup/rollup/pull/3926): Correctly simplify assignments with parentheses (@lukastaegert) + +## 2.36.1 + +_2021-01-06_ + +### Bug Fixes + +- Solve issues that result in invalid code when partially removing assignments (#3921) + +### Pull Requests + +- [#3921](https://github.com/rollup/rollup/pull/3921): Prevent invalid code when removing assignment target of side-effectful object expression (@lukastaegert) + +## 2.36.0 + +_2021-01-05_ + +### Features + +- Support partial tree-shaking of chained assignments and unused assignment targets (#3919) + +### Pull Requests + +- [#3919](https://github.com/rollup/rollup/pull/3919): Treeshake chained assignment expressions (@lukastaegert) + +## 2.35.1 + +_2020-12-14_ + +### Bug Fixes + +- Allow closing the bundle when watching in case of generate errors by adding the bundle to the error event (#3909) +- Automatically close all bundles on generate errors when watching and using the CLI (#3909) +- Try to create remaining bundles when watching and one of them throws (#3909) + +### Pull Requests + +- [#3909](https://github.com/rollup/rollup/pull/3909): Forward bundle through watch error events (@lukastaegert) + +## 2.35.0 + +_2020-12-14_ + +### Features + +- Add `closeBundle` hook that is triggered by `bundle.close()` in the JS API (#3883) + +### Pull Requests + +- [#3883](https://github.com/rollup/rollup/pull/3883): Revert pattern to folder export (@intrnl) + +## 2.34.2 + +_2020-12-06_ + +### Bug Fixes + +- Revert pattern export change (#3898) + +### Pull Requests + +- [#3898](https://github.com/rollup/rollup/pull/3898): Revert pattern to folder export (@lukastaegert) + +## 2.34.1 + +_2020-12-03_ + +### Bug Fixes + +- Avoid Node deprecation warning by using a pattern export for nested Rollup files (#3896) + +### Pull Requests + +- [#3887](https://github.com/rollup/rollup/pull/3887): Run memory leak test on all systems (@lukastaegert) +- [#3892](https://github.com/rollup/rollup/pull/3892): Add pull_request to windows github actions (@shellscape) +- [#3893](https://github.com/rollup/rollup/pull/3893): Update dependencies (@lukastaegert) +- [#3896](https://github.com/rollup/rollup/pull/3896): Replace deprecated folder package export with pattern export (@lukastaegert) + +## 2.34.0 + +_2020-11-29_ + +### Features + +- Support RequireJS comaptible AMD ids in code-splitting builds via amd.autoId (#3867) +- Allow adding an AMD id base path (#3867) + +### Bug Fixes + +- Warn when using an constant AMD id in a code-splitting build (#3867) + +### Pull Requests + +- [#3867](https://github.com/rollup/rollup/pull/3867): Implement amd.autoId/amd.basePath options (@tjenkinson) + +## 2.33.3 + +_2020-11-18_ + +### Bug Fixes + +- Do not use `.js` extension when importing AMD files from a UMD bundle (#3872) + +### Pull Requests + +- [#3861](https://github.com/rollup/rollup/pull/3861): Update chat/support links (@shellscape) +- [#3872](https://github.com/rollup/rollup/pull/3872): Also removeExtensionFromRelativeAmdId in UMD finaliser (@tjenkinson) + +## 2.33.2 + +_2020-11-14_ + +### Bug Fixes + +- Fix an issue where statements were ignored after a conditional return in a labeled statement (#3871) + +### Pull Requests + +- [#3871](https://github.com/rollup/rollup/pull/3871): Correctly track label usage in try statements (@Amareis) + +## 2.33.1 + +_2020-11-02_ + +### Bug Fixes + +- Add `syntheticNamedExports` to `this.getModuleInfo` to align with documentation (#3847) + +### Pull Requests + +- [#3847](https://github.com/rollup/rollup/pull/3847): Expose syntheticNamedExports to ModuleInfo (@Amareis) +- [#3852](https://github.com/rollup/rollup/pull/3852): Fix typo on docs (@jpsc) + +## 2.33.0 + +_2020-11-01_ + +### Features + +- Add parameter to "watchChange" hook to denote if a change was an addition, update or deletion (#3841) +- Add "closeWatcher" hook to allow plugins to clean up resources when the watcher is closed (#3841) +- Add "this.getWatchFiles" function to plugin context to get the current set of watched files (#3841) + +### Pull Requests + +- [#3841](https://github.com/rollup/rollup/pull/3841): Improved watcher hooks (@Amareis) +- [#3848](https://github.com/rollup/rollup/pull/3848): Add options hook to asyncpluginhooks (@intrnl) + +## 2.32.1 + +_2020-10-21_ + +### Bug Fixes + +- Print warning location for plugin warnings if only `loc` is supplied (#3824) + +### Pull Requests + +- [#3824](https://github.com/rollup/rollup/pull/3824): plugin warnings not showing warning.loc (@luciotato) + +## 2.32.0 + +_2020-10-16_ + +### Features + +- Extend `preserveEntrySignatures` with a value `"exports-only"` to allow extension only if an entry does not have exports (#3823) + +### Pull Requests + +- [#3823](https://github.com/rollup/rollup/pull/3823): Add "exports-only" option to preserveSignature (@lukastaegert) + +## 2.31.0 + +_2020-10-15_ + +### Features + +- When using the `output.moduleToStringTag` option, also add the tag to entries with exports and simulated external namespaces (#3822) +- Add the `__esModule` interop marker to IIFE global variables unless `output.esModule` is turned off (#3822) + +### Pull Requests + +- [#3822](https://github.com/rollup/rollup/pull/3822): Add module toStringTag to entries and interop namespaces (@lukastaegert) + +## 2.30.0 + +_2020-10-13_ + +### Features + +- Add `moduleParsed` hook that is called for each module once code and AST are available (#3813) +- Include code and AST in `this.getModuleInfo` (#3813) + +### Bug Fixes + +- Provide the original Acorn AST instead of the internal one when resolving dynamic imports that contain non-trivial expressions (#3813) + +### Pull Requests + +- [#3813](https://github.com/rollup/rollup/pull/3813): Add moduleParsed plugin hook (@lukastaegert) +- [#3815](https://github.com/rollup/rollup/pull/3815): Docs: wile => while (@tjenkinson) +- [#3817](https://github.com/rollup/rollup/pull/3817): Docs: fix code snippet (@codefrau) +- [#3818](https://github.com/rollup/rollup/pull/3818): Update documentation on configuring Babel, removing the section on passing '{"modules": false}' as that is no longer needed since Babel 7 (@Robin-Hoodie) + +## 2.29.0 + +_2020-10-08_ + +### Features + +- Allow passing custom options to other plugins via `this.resolve` (#3807) +- Allow attaching custom meta information to modules when resolving, loading or transforming (#3807) +- Do not throw but return `null` when using `this.getModuleInfo` for an unknown id (#3807) + +### Bug Fixes + +- Trigger build in watch mode when files are added to a watched directory (#3812) +- Make `code` optional when transforming modules (#3807) + +### Pull Requests + +- [#3807](https://github.com/rollup/rollup/pull/3807): Implement new APIs for inter-plugin communication (@lukastaegert) +- [#3808](https://github.com/rollup/rollup/pull/3808): Document that the default value of --format is 'es' (@jameshfisher) +- [#3812](https://github.com/rollup/rollup/pull/3812): Watch: listen for new files added to a directory (@dmitrage) + +## 2.28.2 + +_2020-09-24_ + +### Bug Fixes + +- Fix a source of possible variable name conflicts when using preserveModules with SystemJS (#3796) + +### Pull Requests + +- [#3792](https://github.com/rollup/rollup/pull/3792): add documentation for output.PreserveModulesRoot (@davidroeca) +- [#3796](https://github.com/rollup/rollup/pull/3796): Fix SystemJS default variable conflict (@lukastaegert) + +## 2.28.1 + +_2020-09-21_ + +### Bug Fixes + +- Fix a path slash issue when using the preserveModulesRoot option on Windows (#3791) + +### Pull Requests + +- [#3791](https://github.com/rollup/rollup/pull/3791): Fix preserveModulesRoot path on Windows (@lukastaegert) + +## 2.28.0 + +_2020-09-21_ + +### Features + +- Add an option to treat modules at a given path as located at root when preserving modules (#3786) + +### Pull Requests + +- [#3786](https://github.com/rollup/rollup/pull/3786): Add preserveModulesRoot config option (@davidroeca) + +## 2.27.1 + +_2020-09-17_ + +### Bug Fixes + +- Do not fail when using ES module imports in symlinked config files (#3783) + +### Pull Requests + +- [#3783](https://github.com/rollup/rollup/pull/3783): Handle loading symlinked config files (@lukastaegert) + +## 2.27.0 + +_2020-09-16_ + +### Features + +- Support specifying a file extension when reading from stdin (#3775) + +### Bug Fixes + +- Do not break logic if a branch with hoisted variables is tree-shaken in an else-if statement (#3782) + +### Pull Requests + +- [#3770](https://github.com/rollup/rollup/pull/3770): Docs: Exception for babel plugin and commonjs plugin (@jsk7) +- [#3775](https://github.com/rollup/rollup/pull/3775): add ability to specify stdin file extension via --stdin=ext (@kzc) +- [#3782](https://github.com/rollup/rollup/pull/3782): Handle hoisted variables in dead branches of nested if statements (@lukastaegert) + +## 2.26.11 + +_2020-09-08_ + +### Bug Fixes + +- Do not fail for unknown nodes as if statement branches (#3769) + +### Pull Requests + +- [#3769](https://github.com/rollup/rollup/pull/3769): Handle debugger statements as if-statement branches (@lukastaegert) + +## 2.26.10 + +_2020-09-04_ + +### Bug Fixes + +- Do not create invalid code when simplifying expressions in return statements that contain line comments (#3762) + +### Pull Requests + +- [#3757](https://github.com/rollup/rollup/pull/3757): Fix api docs loadconfigfile (@maxwell8888) +- [#3762](https://github.com/rollup/rollup/pull/3762): Handle line-comments when removing line-breaks to prevent ASI (@lukastaegert) + +## 2.26.9 + +_2020-09-01_ + +### Bug Fixes + +- Add regular expression support to watch include/exclude types (#3754) + +### Pull Requests + +- [#3754](https://github.com/rollup/rollup/pull/3754): Add RegExp to the include and exclude fields of the WatcherOptions type (@dagda1) +- [#3756](https://github.com/rollup/rollup/pull/3756): Update FAQ: I think it was meant "external" instead of "other-entry.js" (@madacol) + +## 2.26.8 + +_2020-08-29_ + +### Bug Fixes + +- Make sure that both unresolved and resolved ids are passed to the `external` option in all cases (#3753) + +### Pull Requests + +- [#3753](https://github.com/rollup/rollup/pull/3753): Also pass resolved ids to external if they use the object for (@lukastaegert) + +## 2.26.7 + +_2020-08-28_ + +### Bug Fixes + +- Avoid invalid code when rendering hoisted variable declarations from dead branches (#3752) +- Mark the `options` parameter of `this.parse` as optional for TypeScript plugins (#3750) + +### Pull Requests + +- [#3750](https://github.com/rollup/rollup/pull/3750): Make `options` of `PluginContext#parse` optional (@intrnl) +- [#3752](https://github.com/rollup/rollup/pull/3752): Extract hoisted variables from dead branches (@lukastaegert) + +## 2.26.6 + +_2020-08-27_ + +### Bug Fixes + +- Avoid conflicts between the namespace of synthetic named exports and local variables (#3747) + +### Pull Requests + +- [#3747](https://github.com/rollup/rollup/pull/3747): Properly deconflict synthetic named exports (@lukastaegert) + +## 2.26.5 + +_2020-08-22_ + +### Bug Fixes + +- Use correctly deconflicted variable names for reexported namespaces in ES formats (#3742) + +### Pull Requests + +- [#3742](https://github.com/rollup/rollup/pull/3742): Avoid variable name conflict when reexporting several namespaces from a chunk (@lukastaegert) + +## 2.26.4 + +_2020-08-19_ + +### Bug Fixes + +- Fix a situation where invalid code was rendered when dynamically importing a module with synthetic named exports when preserving modules (#3738) +- Create a proper namespace object when in a non-es format, a namespace is imported from a chunk with `default` export mode (#3738) +- Use the same variable when in a chunk, a namespace is both imported and reexported as a binding (#3738) +- Do not include the synthetic namespace in static entry points unless it is actually used (#3738) +- Make sure the chunking of one output does not interfere with the namespace objects of another output (#3738) + +### Pull Requests + +- [#3738](https://github.com/rollup/rollup/pull/3738): Improve synthetic entry handling (@lukastaegert) + +## 2.26.3 + +_2020-08-16_ + +### Bug Fixes + +- Fix a situation where line-breaks in a nested simplified conditional expression could result in broken code (#3734) + +### Pull Requests + +- [#3734](https://github.com/rollup/rollup/pull/3734): Prevent ASI when simplifying a nested logical expression (@lukastaegert) + +## 2.26.2 + +_2020-08-16_ + +### Bug Fixes + +- Fix a situation where line-breaks in a simplified conditional expression could result in broken code (#3732) + +### Pull Requests + +- [#3732](https://github.com/rollup/rollup/pull/3732): Prevent unintended ASI for nested conditionals (@lukastaegert) + +## 2.26.1 + +_2020-08-16_ + +### Bug Fixes + +- Correctly render external namespace imports when only generating SystemJS output (#3731) + +### Pull Requests + +- [#3731](https://github.com/rollup/rollup/pull/3731): Render system namespace import (@sastan and @lukastaegert) + +## 2.26.0 + +_2020-08-15_ + +### Features + +- Add a new entry `importedBindings` to the bundle information to list bindings per dependency (#3722) + +### Bug Fixes + +- Do not render an invalid UMD wrapper when no bindings are imported from a dependency (#3724) +- Avoid situations where removing the `else` branch from an `if` statement might catch the `else` branch from another one (#3725) + +### Pull Requests + +- [#3722](https://github.com/rollup/rollup/pull/3722): Add import specifiers to bundle information (@lukastaegert) +- [#3724](https://github.com/rollup/rollup/pull/3724): Fix missing variables for UMD and IIFE builds (@lukastaegert) +- [#3725](https://github.com/rollup/rollup/pull/3725): Do not entirely remove else branch if another else branch might accidentally be referenced (@lukastaegert) + +## 2.25.0 + +_2020-08-14_ + +### Features + +- Add `--failAfterWarnings` CLI flag that will complete builds with warnings but return an error at the end (#3712) + +### Pull Requests + +- [#3712](https://github.com/rollup/rollup/pull/3712): Implement `--failAfterWarnings` flag (@tjenkinson) + +## 2.24.0 + +_2020-08-13_ + +### Features + +- Allow defining interop per dependency via a function (#3710) +- Support interop "auto" as a more compatible version of "true" (#3710) +- Support interop "default" and "esModule" to avoid unnecessary interop helpers (#3710) +- Support interop "defaultOnly" for simplified helpers and Node ESM interop compatible output (#3710) +- Respect interop option for external dynamic imports (#3710) +- Support live-bindings for external default imports in non-ES formats unless "externalLiveBindings" is "false" (#3710) +- Use shared default interop helpers for AMD, UMD and IIFE formats (#3710) +- Avoid unnecessarily deconflicted module variables in non-ES formats (#3710) +- Freeze generated interop namespace objects (#3710) +- Always mark interop helpers as pure (#3710) +- Avoid default export interop if there is already an interop namespace object (#3710) +- Sort all `require` statements to the top in CommonJS output for easier back-transpilation to ES modules by other tools (#3710) + +### Bug Fixes + +- Handle accessing `super` in static class fields (#3720) +- Deconflict the names of helper variables introduced for interop (#3710) +- Generate proper namespace objects for static namespace imports in non-ES formats (#3710) +- Do not add unused interop helpers when using the renderDynamicImport hook (#3710) + +### Pull Requests + +- [#3710](https://github.com/rollup/rollup/pull/3710): Rework interop handling (@lukastaegert) +- [#3720](https://github.com/rollup/rollup/pull/3720): Handle super in static class fields (@lukastaegert) + +## 2.23.1 + +_2020-08-07_ + +### Bug Fixes + +- Fix an issue where dynamically importing an entry point could return a malformed namespace for CJS and AMD formats (#3709) + +### Pull Requests + +- [#3709](https://github.com/rollup/rollup/pull/3709): Properly construct namespace when dynamically importing chunks with facades in default export mode (@lukastaegert) + +## 2.23.0 + +_2020-07-23_ + +### Features + +- Handle environments with only globalThis in UMD output (#3691) + +### Pull Requests + +- [#3691](https://github.com/rollup/rollup/pull/3691): Check for globalThis in UMD wrapper (@lukastaegert) + +## 2.22.2 + +_2020-07-21_ + +### Bug Fixes + +- Always generate correct exports when an implicit entry is reexporting from another module (#3688) + +### Pull Requests + +- [#3688](https://github.com/rollup/rollup/pull/3688): Include all relevant modules to generate reexports for implicit dependencies (@lukastaegert) + +## 2.22.1 + +_2020-07-18_ + +### Bug Fixes + +- Remove unused arguments when calling a conditional expression (#3680) + +### Pull Requests + +- [#3680](https://github.com/rollup/rollup/pull/3680): Allow tree-shaking of arguments of functions that are returned by conditional expressions (@lukastaegert) + +## 2.22.0 + +_2020-07-18_ + +### Features + +- Allow resolving synthetic named exports via an arbitrary export name (#3657) +- Display a warning when the user does not explicitly select an export mode and would generate a chunk with default export mode when targeting CommonJS (#3657) + +### Pull Requests + +- [#3657](https://github.com/rollup/rollup/pull/3657): Add basic support for using a non-default export for syntheticNamedExports (@lukastaegert) +- [#3659](https://github.com/rollup/rollup/pull/3659): Warn when implicitly using default export mode (@lukastaegert) + +## 2.21.0 + +_2020-07-07_ + +### Features + +- Allow plugins to disable tree-shaking for individual modules to ensure even empty modules are associated with chunks (#3663) + +### Pull Requests + +- [#3663](https://github.com/rollup/rollup/pull/3663): Disable treeshaking per module (@lukastaegert) + +## 2.20.0 + +_2020-07-06_ + +### Features + +- Support using a function to generate different chunk and asset naming patterns per chunk or asset (#3658) +- Add `referencedFiles` property to the chunk info in generateBundle to list referenced assets (#3661) + +### Pull Requests + +- [#3658](https://github.com/rollup/rollup/pull/3658): Add ability to use a function that returns a pattern string in all places where you could use a pattern string before (@frank-dspeed) +- [#3661](https://github.com/rollup/rollup/pull/3661): Add referenced files to bundle (@lukastaegert) + +## 2.19.0 + +_2020-07-05_ + +### Features + +- Allow plugins to return a Promise in the options hook (#3660) + +### Pull Requests + +- [#3660](https://github.com/rollup/rollup/pull/3660): Make options hooks async (@TomerAberbach) + +## 2.18.2 + +_2020-07-02_ + +### Bug Fixes + +- Do not remove spread element args when the corresponding positional parameter is unused (#3652) + +### Pull Requests + +- [#3652](https://github.com/rollup/rollup/pull/3652): Do not tree-shake arguments that contain a spread element (@lukastaegert) + +## 2.18.1 + +_2020-06-26_ + +### Bug Fixes + +- Make sure synthetic exports are present when a module is imported dynamically (#3648) +- Strip the `rollup-plugin-` prefix off the plugin name when looking for the plugin export in a CLI plugin without a default export (#3647) +- Convert plugin names with dashes to camel case when looking for the plugin export in a CLI plugin without a default export (#3647) + +### Pull Requests + +- [#3647](https://github.com/rollup/rollup/pull/3647): Strip rollup-plugin prefix to find named plugin exports, throw when export cannot be found (@lukastaegert) +- [#3648](https://github.com/rollup/rollup/pull/3648): Always create a dynamic namespace object when a module with synthetic named exports is imported dynamically (@lukastaegert) + +## 2.18.0 + +_2020-06-22_ + +### Features + +- `inlineDynamicImports`, `manualChunks` and `preserveModules` can now be used as output options (#3645) +- Use sourcemaps for certain warnings that reference source code locations (#3645) + +### Bug Fixes + +- `this.getFileName` will now always return the correct file name for chunks when multiple outputs are created (#3645) + +### Pull Requests + +- [#3645](https://github.com/rollup/rollup/pull/3645): Per output chunking (@lukastaegert) + +## 2.17.1 + +_2020-06-19_ + +### Bug Fixes + +- Properly resolve accessing properties of namespace members again (#3643) + +### Pull Requests + +- [#3643](https://github.com/rollup/rollup/pull/3643): Fix accessing nested properties of namespaces (@lukastaegert) + +## 2.17.0 + +_2020-06-17_ + +### Features + +- When importing Rollup via package.exports, always fall back to the browser ESM build for non-Node environments (#3634) +- Create more efficient code when handling namespace mutations (#3637) + +### Bug Fixes + +- Fix a severe performance regression when the same module is imported by a lot of modules (#3641) +- Properly escape special characters in imports (#3638) + +### Pull Requests + +- [#3634](https://github.com/rollup/rollup/pull/3634): Set browser build in exports (@guybedford) +- [#3637](https://github.com/rollup/rollup/pull/3637): Do not include the whole namespace when illegally mutating a namespace (@lukastaegert) +- [#3638](https://github.com/rollup/rollup/pull/3638): Support backslash escaping, retain exact newline escaping (@guybedford) +- [#3641](https://github.com/rollup/rollup/pull/3641): Fix performance regression when a file is imported by many importers (@lukastaegert) + +## 2.16.1 + +_2020-06-13_ + +### Bug Fixes + +- Do not produce invalid code when an external or chunk id contain quotes or line-breaks (#3632) +- Do not fail but emit a warning when mutating a namespace object (#3633) + +### Pull Requests + +- [#3632](https://github.com/rollup/rollup/pull/3632): Handle single quote escaping in ids (@guybedford) +- [#3633](https://github.com/rollup/rollup/pull/3633): Turn namespace assignment error into a warning (@guybedford) + +## 2.16.0 + +_2020-06-12_ + +### Features + +- Add support for numeric separators (#3626) +- Switch to finalized ESTree optional chaining AST (#3628) + +### Pull Requests + +- [#3626](https://github.com/rollup/rollup/pull/3626): Support numeric separator (@TrySound) +- [#3628](https://github.com/rollup/rollup/pull/3628): Acorn 7.3.0 upgrade (@guybedford) +- [#3631](https://github.com/rollup/rollup/pull/3631): Improve discoverability of `manualChunks` for code splitting (@zlamma) + +## 2.15.0 + +_2020-06-08_ + +### Features + +- Allow to skip watching some configs via `watch: false` (#3620) +- Provide the resolved sourcemap path to `sourcemapPathTransform` (#3617) + +### Pull Requests + +- [#3617](https://github.com/rollup/rollup/pull/3617): Update sourcemapPathTransform to also take the path to the sourcemap file as a second argument (@dgoldstein0) +- [#3620](https://github.com/rollup/rollup/pull/3620): Rollup watch only one config in exported array (@luwol03) + +## 2.14.0 + +_2020-06-07_ + +### Features + +- Make `this.meta.watchMode` available for plugins to detect watch mode (#3616) + +### Bug Fixes + +- Handle exporting the same binding with different names in SystemJS (#3575) + +### Pull Requests + +- [#3575](https://github.com/rollup/rollup/pull/3575): Handle some cases of duplicate export bindings (@joeljeske) +- [#3616](https://github.com/rollup/rollup/pull/3616): Make watch mode available in plugins (@lukastaegert) + +## 2.13.1 + +_2020-06-04_ + +### Bug Fixes + +- Prevent conflicts in SystemJS when `module` is used as a top-level variable (#3614) + +### Pull Requests + +- [#3614](https://github.com/rollup/rollup/pull/3614): Handle system reserved identifier dedupes (@guybedford) + +## 2.13.0 + +_2020-06-03_ + +### Features + +- Allow to specify that an emitted chunk is only loaded after a given module has loaded to improve chunking (#3606) + +### Pull Requests + +- [#3606](https://github.com/rollup/rollup/pull/3606): Enable specifying implicit dependencies when emitting chunks (@lukastaegert) + +## 2.12.1 + +_2020-06-02_ + +### Bug Fixes + +- Render valid imports when chunk names correspond to directory names in virtual setups (#3609) + +### Pull Requests + +- [#3609](https://github.com/rollup/rollup/pull/3609): Handle imports from chunks with names that correspond to parent directory names of other chunks (@guybedford) + +## 2.12.0 + +_2020-05-31_ + +### Features + +- Add an option `--waitForBundleInput` to let the build wait until all entry point files are available before starting (#3577) + +### Pull Requests + +- [#3577](https://github.com/rollup/rollup/pull/3577): Wait for bundle input option (@Heerschop) + +## 2.11.2 + +_2020-05-28_ + +### Bug Fixes + +- Include side-effects in the second argument of `Array.from` (#3604) + +### Pull Requests + +- [#3604](https://github.com/rollup/rollup/pull/3604): Mark `Array.from` as side-effectful, use two-argument Array.from when mapping Sets (@lukastaegert) + +## 2.11.1 + +_2020-05-28_ + +### Bug Fixes + +- Also include side-effects in files that are marked as side-effect-free if they contain an included default export that is reexported (#3602) + +### Pull Requests + +- [#3602](https://github.com/rollup/rollup/pull/3602): Handle side-effects next to side-effect-free default exports in case the default export is reexported (@lukastaegert) + +## 2.11.0 + +_2020-05-27_ + +### Features + +- Add basic support for optional chaining (#3582) +- Provide a normalized set of options with proper default values to `buildStart` and `renderStart` (#3597) +- Do not count adding properties to the prototype of an unused class as a side-effect (#3598) +- Support providing `null` for empty setters in SystemJS via option (#3592) + +### Bug Fixes + +- Do not fail when using a `/*#__PURE__*/` annotation inside a class field (#3599) +- Allow using `--watch` and `--treeshake` together with sub-options such as `--watch.clearScreen` on the command line (#3597) + +### Pull Requests + +- [#3582](https://github.com/rollup/rollup/pull/3582): Support optional chaining via acorn fork(@guybedford) +- [#3592](https://github.com/rollup/rollup/pull/3592): System format optional setters(@guybedford) +- [#3597](https://github.com/rollup/rollup/pull/3597): Provide normalized options (@lukastaegert) +- [#3598](https://github.com/rollup/rollup/pull/3598): Treeshake prototype modifications in classes (@lukastaegert) +- [#3599](https://github.com/rollup/rollup/pull/3599): Retain pure annotations in class fields (@lukastaegert) +- [#3601](https://github.com/rollup/rollup/pull/3601): Fix white-space in docs (@tu4mo) + +## 2.10.9 + +_2020-05-24_ + +### Bug Fixes + +- Prevent invalid exports when facades are created (#3590) + +### Pull Requests + +- [#3590](https://github.com/rollup/rollup/pull/3590): Prevent unneeded exports when entry facades are created and ensure all exported variables in facades are imported (@lukastaegert) + +## 2.10.8 + +_2020-05-23_ + +### Bug Fixes + +- Fix issues when synthetic named exports are reexported as default exports (#3586) + +### Pull Requests + +- [#3584](https://github.com/rollup/rollup/pull/3584): Clarify documentation for `output.paths` (@jacksteamdev) +- [#3585](https://github.com/rollup/rollup/pull/3585): Target Node.js v14 instead of v13 in Windows tests (@mangs) +- [#3586](https://github.com/rollup/rollup/pull/3586): Handle default reexports of synthetic named exports over several stages (@lukastaegert) + +## 2.10.7 + +_2020-05-22_ + +### Bug Fixes + +- Handle modules re-exporting namespaces without further own code (#3576) + +### Pull Requests + +- [#3576](https://github.com/rollup/rollup/pull/3576): Fix "cannot read exports of undefined" error (@guybedford) + +## 2.10.6 + +_2020-05-22_ + +### Bug Fixes + +- Fix some issues around class fields (#3580) +- Prevent a maximum call stack error when a called entity references itself in its declaration (#3581) + +### Pull Requests + +- [#3580](https://github.com/rollup/rollup/pull/3580): Update acorn class features (@guybedford) +- [#3581](https://github.com/rollup/rollup/pull/3581): Do not fail when including call arguments of recursively defined variables (@lukastaegert) + +## 2.10.5 + +_2020-05-19_ + +### Bug Fixes + +- Do not remove side-effects that may influence an included default export declaration when side-effects are disabled (#3572) + +### Pull Requests + +- [#3572](https://github.com/rollup/rollup/pull/3572): Observe side-effects in files containing a default export declaration that reexports a variable (@lukastaegert) + +## 2.10.4 + +_2020-05-19_ + +### Bug Fixes + +- Tree-shake unused classes with fields unless there are side-effects in the field declaration (#3569) + +### Pull Requests + +- [#3569](https://github.com/rollup/rollup/pull/3569): Make sure unused classes with fields are tree-shaken if possible (@lukastaegert) + +## 2.10.3 + +_2020-05-18_ + +### Bug Fixes + +- Validate return value of sourcemapPathTransform option (#3561) + +### Pull Requests + +- [#3561](https://github.com/rollup/rollup/pull/3561): Throw error if sourcemapPathTransform-option does not return a string (@Simonwep) + +## 2.10.2 + +_2020-05-15_ + +### Bug Fixes + +- Properly include calls to mutating array methods in certain scenarios (#3559) + +### Pull Requests + +- [#3559](https://github.com/rollup/rollup/pull/3559): Make sure UnknownFooExpressions are included when referenced as return values in a MultiExpression (@lukastaegert) + +## 2.10.1 + +_2020-05-15_ + +### Bug Fixes + +- Do not throw when "undefined" is used as a default export (#3558) + +### Pull Requests + +- [#3558](https://github.com/rollup/rollup/pull/3558): Properly handle default exporting undefined (@lukastaegert) + +## 2.10.0 + +_2020-05-13_ + +### Features + +- Avoid unnecessary empty imports from a facade chunk to the original chunk (#3552) +- Pin facade creation order so that if several user-defined chunks reference the same module, the first always becomes the "actual" chunk while the later ones become facades (#3552) + +### Bug Fixes + +- Do not omit reexports from secondary chunks when creating facades for entry points without hoisting transitive dependencies (#3552) + +### Pull Requests + +- [#3552](https://github.com/rollup/rollup/pull/3552): Avoid unnecessary facade dependency inlining (@guybedford) + +## 2.9.1 + +_2020-05-11_ + +### Bug Fixes + +- Do not create unintended live-bindings or invalid reexports when reexporting global variables (#3550) + +### Pull Requests + +- [#3550](https://github.com/rollup/rollup/pull/3550): Track updates of globals that are exported as default (@lukastaegert) + +## 2.9.0 + +_2020-05-10_ + +### Features + +- Add ids of static and dynamic imports to `this.getModuleInfo` (#3542) +- Provide `getModuleInfo` and `getModuleIds` to `manualChunks` functions (#3542) +- Add nullish coalescing support (#3548) +- Make the rebuild delay in watch mode configurable and set the default to `0` for snappy rebuilds (#3502) +- Add `this.getModuleIds` to the plugin context as future replacement for `this.moduleIds` (#3542) + +### Pull Requests + +- [#3502](https://github.com/rollup/rollup/pull/3502): Configurable build delay (@mattdesl) +- [#3542](https://github.com/rollup/rollup/pull/3542): Extend manualChunks API (@lukastaegert) +- [#3548](https://github.com/rollup/rollup/pull/3548): Support nullish coalescing with tree-shaking (@lukastaegert) + +## 2.8.2 + +_2020-05-07_ + +### Bug Fixes + +- Avoid invalid code when simplifying the body of a shorthand arrow function expression (#3540) + +### Pull Requests + +- [#3540](https://github.com/rollup/rollup/pull/3540): Wrap object expressions in parentheses if they become children of an arrow function expression (@lukastaegert) + +## 2.8.1 + +_2020-05-07_ + +### Bug Fixes + +- Allow using plugins on CLI that are exported as `exports.default` (#3529) +- Do not fail side-effect detection in nested callbacks of builtins (#3539) + +### Pull Requests + +- [#3529](https://github.com/rollup/rollup/pull/3529): Use default named export with plugins (@NotWoods) +- [#3539](https://github.com/rollup/rollup/pull/3539): Track call side-effects both by entity and CallExpression to avoid untracked side-effects in nested calls (@lukastaegert) + +## 2.8.0 + +_2020-05-06_ + +### Features + +- When a dynamically imported chunk contains more exports than the imported module namespace, do not create a facade chunk but an inline namespace (#3535) + +### Bug Fixes + +- Do not execute dynamically imported code before synchronous code in the importing module when generating CommonJS (#3535) + +### Pull Requests + +- [#3535](https://github.com/rollup/rollup/pull/3535): Avoid dynamic facade chunks (@lukastaegert) + +## 2.7.6 + +_2020-04-30_ + +### Bug Fixes + +- Fix a type issue when a default export references a global variable (#3526) + +### Pull Requests + +- [#3526](https://github.com/rollup/rollup/pull/3526): Handles default exporting global variables (@lukastaegert) + +## 2.7.5 + +_2020-04-29_ + +### Bug Fixes + +- Prevent infinite loop when default values of function parameters in a default export contain a slash (#3522) + +### Pull Requests + +- [#3522](https://github.com/rollup/rollup/pull/3522): Avoid infinite loop when finding position for id insertion in default export (@lukastaegert) + +## 2.7.4 + +_2020-04-29_ + +### Bug Fixes + +- Fix an issue where wrong variable names were used when preserving modules (#3521) + +### Pull Requests + +- [#3521](https://github.com/rollup/rollup/pull/3521): Fix and improve default export alias logic (@lukastaegert) + +## 2.7.3 + +_2020-04-27_ + +### Bug Fixes + +- Do not access `__proto__` when running Rollup (#3518) + +### Pull Requests + +- [#3518](https://github.com/rollup/rollup/pull/3518): use acorn-class-fields and acorn-static-class-features from npm (@nitsky) + +## 2.7.2 + +_2020-04-22_ + +### Bug Fixes + +- Prevent an infinite loop when creating separate manual chunks with circular dependencies (#3510) +- Do not fail if "super" is used in the definition of a class field (#3511) +- Throw if a plugin tries to emit a file with an absolute Windows path (#3509) + +### Pull Requests + +- [#3509](https://github.com/rollup/rollup/pull/3509): Ban emitFile via absolute paths on Windows OS (@SASUKE40) +- [#3510](https://github.com/rollup/rollup/pull/3510): Do not fail for circular imports between manual chunks (@lukastaegert) +- [#3511](https://github.com/rollup/rollup/pull/3511): Support "super" in class fields (@lukastaegert) + +## 2.7.1 + +_2020-04-21_ + +### Bug Fixes + +- Use correct path for dynamic imports if `output.paths` is used (#3508) + +### Pull Requests + +- [#3508](https://github.com/rollup/rollup/pull/3508): Respect output.paths in dynamic imports (@lukastaegert) + +## 2.7.0 + +_2020-04-21_ + +### Features + +- Add `preserveEntrySignatures` option to control how exports of entry points are handled (#3498) +- Add `preserveSignature` flag to `this.emitFile` to control exports of emitted chunks (#3498) +- Add `output.minifyInternalExports` option to control if internal exports are minified (#3498) + +### Pull Requests + +- [#3498](https://github.com/rollup/rollup/pull/3498): Add option to configure if entry signatures are preserved (@lukastaegert) + +## 2.6.1 + +_2020-04-12_ + +### Bug Fixes + +- Close watch mode when stdin closes in a non-TTY environment (#3493) + +### Pull Requests + +- [#3493](https://github.com/rollup/rollup/pull/3493): Ensure --watch mode exits correctly when stdin is closed (@jakesgordon) + +## 2.6.0 + +_2020-04-10_ + +### Features + +- Allow regular expressions to declare external modules (#3482) + +### Pull Requests + +- [#3482](https://github.com/rollup/rollup/pull/3482): Allow regular expressions in config.external (@johannes-z) + +## 2.5.0 + +This version is identical to 2.4.0 + +## 2.4.0 + +_2020-04-09_ + +### Features + +- Add support for most private and public class field features (#3488) + +### Bug Fixes + +- Do not replace `this` with `undefined` in class field definitions (#3488) + +### Pull Requests + +- [#3488](https://github.com/rollup/rollup/pull/3488): Rollup class fields support (@guybedford and @lukastaegert) + +## 2.3.5 + +_2020-04-09_ + +### Bug Fixes + +- Never remove labels when tree-shaking is disabled (#3492) + +### Pull Requests + +- [#3492](https://github.com/rollup/rollup/pull/3492): Always use a new inclusion context when including declarations of variables, always inlcude labels when not treeshaking (@lukastaegert) + +## 2.3.4 + +_2020-04-07_ + +### Bug Fixes + +- Handle re-exporting synthetic exports from entry-points (#3319) +- Fix cross-chunk imports of synthetic exports (#3319) +- Handle namespace objects that contain re-exported synthetic namespaces (#3319) + +### Pull Requests + +- [#3319](https://github.com/rollup/rollup/pull/3319): Handle re-exports of synthetic named exports (@manucorporat and @lukastaegert) + +## 2.3.3 + +_2020-04-04_ + +### Bug Fixes + +- Add external namespaces to dynamic namespace objects (#3474) + +### Pull Requests + +- [#3474](https://github.com/rollup/rollup/pull/3474): Support external star exports on namespace objects (@guybedford) + +## 2.3.2 + +_2020-03-31_ + +### Bug Fixes + +- Only warn but do not fail build when a namespace is called as a function (#3475) +- Make sure pre-existing sourcemap comments are also removed when rebuilding using the cache (#3476) + +### Pull Requests + +- [#3475](https://github.com/rollup/rollup/pull/3475): Call namespace error as a warning (@guybedford) +- [#3476](https://github.com/rollup/rollup/pull/3476): Store locations for removed comments in cache (@lukastaegert) + +## 2.3.1 + +_2020-03-30_ + +### Bug Fixes + +- Do not fail if the config file returns an function returning a Promise (#3472) + +### Pull Requests + +- [#3472](https://github.com/rollup/rollup/pull/3472): Fix support for async functions as config (@lukastaegert) + +## 2.3.0 + +_2020-03-29_ + +### Features + +- Do not transpile config files with `.mjs` extension in Node 13+ or `.cjs` extension in any Node version and load them appropriately (#3445) +- Extract helper to load a config file the way rollup does it via `rollup/dist/loadConfigFile` (#3445) + +### Bug Fixes + +- Keep watching the config file if an error occurs during initial load in watch node (#3445) +- Add a helpful error message when using a transpiled config in a repository with "type": "module" (#3445) + +### Pull Requests + +- [#3445](https://github.com/rollup/rollup/pull/3445): Support native ESM configs in Node 13, support untranspiled configs (@lukastaegert) +- [#3468](https://github.com/rollup/rollup/pull/3468): Don't use esm output format alias in the documentation (@vsn4ik) + +## 2.2.0 + +_2020-03-24_ + +### Features + +- Add `renderDynamicImport` hook to rewrite dynamic import expressions (#3449) +- Add information about dynamically imported modules to `this.getModuleInfo` (#3449) + +### Bug Fixes + +- Make file emission work with Uin8Array sources when using Rollup in the browser (#3452) +- Fix types to allow watch to accept an array of configs (#3453) +- Do not strip `.js` extensions from AMD imports when the import is a user-supplied replacement for a non-resolvable dynamic import target (#3453) + +### Pull Requests + +- [#3449](https://github.com/rollup/rollup/pull/3449): Add hook to rewrite dynamic import expressions (@lukastaegert) +- [#3452](https://github.com/rollup/rollup/pull/3452): Avoid the assumption of Buffer in browser envs (@JoviDeCroock) +- [#3453](https://github.com/rollup/rollup/pull/3453): fix types since watch accepts single or array config (@lukeed) +- [#3456](https://github.com/rollup/rollup/pull/3456): fix SystemJS url in tutorial (@guybedford) + +## 2.1.0 + +_2020-03-18_ + +### Features + +- Allow specifying an importer when emitting files to resolve relative ids (#3442) + +### Pull Requests + +- [#3442](https://github.com/rollup/rollup/pull/3442): Add optional `importer` parameter to `this.emitFile` (@lukastaegert) + +## 2.0.6 + +_2020-03-13_ + +### Bug Fixes + +- Do not use file names from different outputs when generating sourcemaps using the `dir` option (#3440) + +### Pull Requests + +- [#3440](https://github.com/rollup/rollup/pull/3440): Use correct file names when writing sourcemaps for multiple outputs (@lukastaegert) + +## 2.0.5 + +_2020-03-12_ + +### Bug Fixes + +- Fix an issue where conditional statements would assume they have the wrong test value (#3438) + +### Pull Requests + +- [#3438](https://github.com/rollup/rollup/pull/3438): Make sure logical expressions always check the left argument for side-effects (@lukastaegert) + +## 2.0.4 + +_2020-03-12_ + +### Bug Fixes + +- Avoid conflicts between namespace imports when preserving modules (#3435) + +### Pull Requests + +- [#3435](https://github.com/rollup/rollup/pull/3435): Deconflict multiple `index` imports for ES format using nested export star statements (@kamranayub) + +## 2.0.3 + +_2020-03-10_ + +### Bug Fixes + +- Add type for this.getCombinedSourcemap to transform context (#3431) + +### Pull Requests + +- [#3377](https://github.com/rollup/rollup/pull/3377): Switch to yargs-parser lib (@jamesgeorge007) +- [#3426](https://github.com/rollup/rollup/pull/3426): Use strict types with PluginDriver (@NotWoods) +- [#3431](https://github.com/rollup/rollup/pull/3431): Add missing type declaration for getCombinedSourcemap (@Anidetrix) +- [#3432](https://github.com/rollup/rollup/pull/3432): Detail how return values from `augmentChunkHash` are used (@jakearchibald) + +## 2.0.2 + +_2020-03-07_ + +### Bug Fixes + +- Make sure the ESM import still works (#3430) + +### Pull Requests + +- [#3430](https://github.com/rollup/rollup/pull/3430): Fix conditional exports again (@lukastaegert) + +## 2.0.1 + +_2020-03-07_ + +### Bug Fixes + +- Reenable importing rollup in Node 13.0 - 13.7 (#3428) + +### Pull Requests + +- [#3428](https://github.com/rollup/rollup/pull/3428): Fix conditional exports in Node 13.0 - 13.7 (@lukastaegert) + +## 2.0.0 + +_2020-03-06_ + +### Breaking Changes + +- Rollup now requires at least Node 10 to run, or a sufficiently modern browser (#3346) +- The file structure of Rollup's ESM builds has changed: + + - The main ESM entry point is now at `rollup/dist/es/rollup.js` instead of `rollup/dist/rollup.es.js` + - The ESM browser build is at `rollup/dist/es/rollup.browser.js` instead of `rollup/dist/rollup.browser.es.js` + + In general, the ESM builds now follow the same naming scheme as the CJS builds but are located in the `rollup/dist/es` subfolder instead of `rollup/dist` (#3391) + +- The "watch.chokidar" option no longer accepts a `boolean` value but only an object of parameters that is passed to the bundled Chokidar instance. Chokidar installations by the user will be ignored in favour of the bundled instance (#3331) +- Modules that are completely tree-shaken will no longer be listed as part of any chunks in `generateBundle` +- The `experimentalOptimizeChunks` and `chunkGroupingSize` options have been removed +- [acorn](https://github.com/acornjs/acorn) plugins can only be used if they accept a passed-in acorn instance instead of importing it themselves. See https://github.com/acornjs/acorn/pull/870#issuecomment-527339830 for what needs to be done to make plugins compatible that do not support this yet (#3391) +- Emitted chunks now have the TypeScript type `Uint8Array` instead of `Buffer`. A `Buffer` can still be used, though (#3395) +- The TypeScript types no longer use ESTree types for AST nodes but a very generic type that does not contain information specific to certain node types (#3395) +- The signature of the `writeBundle` plugin hook has been changed to match `generateBundle`: The bundle object is now passed as second parameter instead of first and the first parameter is the output options (#3361) +- The following plugin hooks have been removed: + - ongenerate: use `generateBundle` instead + - onwrite: use `writeBundle` instead + - transformBundle: use `renderChunk` instead + - transformChunk: use `renderChunk` instead +- You can no longer access `this.watcher` on the plugin context. +- The `transform` hook can no longer return `dependencies`. +- The `treeshake.pureExternalModules` option will now show a deprecation warning when used: use `treeshake.moduleSideEffects: 'no-external'` instead +- Using `import.meta.ROLLUP_ASSET_URL_<..>` and `import.meta.ROLLUP_CHUNK_URL_<..>` in code will now show warnings: use `import.meta.ROLLUP_FILE_URL_<..>` instead +- The `resolveAssetUrl` hook will now show a deprecation warning when used: use `resolveFileUrl` instead +- The following plugin context functions will show warnings when used: + - `this.emitAsset`: use `this.emitFile` + - `this.emitChunk`: use `this.emitFile` + - `this.getAssetFileName`: use `this.getFileName` + - `this.getChunkFileName`: use `this.getFileName` + - `this.isExternal`: use `this.resolve` + - `this.resolveId`: use `this.resolve` +- Directly adding properties to the bundle object in the `generateBundle` is deprecated will show a warning (removing properties is allowed, though): Use `this.emitFile` +- Accessing `chunk.isAsset` on the bundle is deprecated: Use `chunk.type === 'asset'` instead +- The error code for a missing `name` property when targeting UMD has been changed to `MISSING_NAME_OPTION_FOR_IIFE_EXPORT` to emphasize this is needed for the IIFE part of UMD (#3393) + +### Features + +- Rollup now bundles [Chokidar](https://github.com/paulmillr/chokidar) for a better watch experience (#3331) +- Rollup now bundles [acorn](https://github.com/acornjs/acorn) again, removing its only external dependency (#3391) +- Do not consider empty imports from side-effect-free modules for chunking and hoist side-effect imports if necessary (#3369) +- Rollup can now be imported as an ES module in Node via `import {rollup} from 'rollup'`. Note that this relies on Node's experimental [conditional package exports](https://nodejs.org/dist/latest-v13.x/docs/api/esm.html#esm_conditional_exports) feature and is therefore itself experimental (#3391) +- `systemjs` can be used as format alias for `system` (#3381) + +### Bug Fixes + +- Unknown output options now trigger a warning when using the JavaScript API (#3352) +- Rollup will no longer introduce Node types into TypeScript projects that do not use them (#3395) +- Generate correct sourcemaps when tree-shaking occurs in a multi-file bundle (#3423) + +### Pull Requests + +- [#3331](https://github.com/rollup/rollup/pull/3331): Bundle Chokidar (@lukastaegert) +- [#3343](https://github.com/rollup/rollup/pull/3343): Remove experimentalOptimizeChunks (@lukastaegert) +- [#3346](https://github.com/rollup/rollup/pull/3346): Update minimum required Node version to 10 (@lukastaegert) +- [#3352](https://github.com/rollup/rollup/pull/3352): Remove active deprecations (@lukastaegert) +- [#3361](https://github.com/rollup/rollup/pull/3361): Change writeBundle signature to match generateBundle (@lukastaegert) +- [#3369](https://github.com/rollup/rollup/pull/3369): Avoid empty imports from side-effect-free chunks (@lukastaegert) +- [#3381](https://github.com/rollup/rollup/pull/3381): Rename esm to es everywhere, add systemjs alias (@lukastaegert) +- [#3391](https://github.com/rollup/rollup/pull/3391): Bundle acorn, allow importing Rollup as Node ES module, update dependencies (@lukastaegert) +- [#3393](https://github.com/rollup/rollup/pull/3393): Better error code for name-less umd bundle (@rail44) +- [#3395](https://github.com/rollup/rollup/pull/3395): Remove `@types` dependencies (@lukastaegert) +- [#3423](https://github.com/rollup/rollup/pull/3423): Update magic-string and fix sourcemaps (@lukastaegert) + +## 1.32.1 + +_2020-03-06_ + +### Bug Fixes + +- Handle default export detection for AMD and IIFE externals that do not have a prototype (#3420) +- Handle missing whitespace when the else branch of an if-statement is simplified (#3421) +- Mention the importing module when reporting errors for missing named exports (#3401) +- Add code to warning for missing output.name of IIFE bundles (#3372) + +### Pull Requests + +- [#3372](https://github.com/rollup/rollup/pull/3372): Add warning code for missing output.name of IIFE bundle that has export (@rail44) +- [#3401](https://github.com/rollup/rollup/pull/3401): Missing exports errors now print the importing module (@timiyay) +- [#3418](https://github.com/rollup/rollup/pull/3418): Structure lifecycle hooks, add links to build time hooks (@lukastaegert) +- [#3420](https://github.com/rollup/rollup/pull/3420): Update generated code of getInteropBlock() to work with null prototype objects (@jdalton) +- [#3421](https://github.com/rollup/rollup/pull/3421): Avoid invalid code when "else" branch is simplified (@lukastaegert) + +## 1.32.0 + +_2020-02-28_ + +### Features + +- Allow adding plugins on the command line via `--plugin ` (#3379) + +### Pull Requests + +- [#3379](https://github.com/rollup/rollup/pull/3379): introduce CLI --plugin support (@kzc) +- [#3390](https://github.com/rollup/rollup/pull/3390): fix typo: this.addWatchfile (@mistlog) +- [#3392](https://github.com/rollup/rollup/pull/3392): Bump codecov from 3.6.1 to 3.6.5 +- [#3404](https://github.com/rollup/rollup/pull/3404): Update resolveFileUrl docs (@jakearchibald) + +## 1.31.1 + +_2020-02-14_ + +### Bug Fixes + +- Make sure errored files are always re-evaluated in watch mode to avoid an issue in the typescript plugin (#3388) + +### Pull Requests + +- [#3366](https://github.com/rollup/rollup/pull/3366): Correct spelling minifaction to minification (@VictorHom) +- [#3371](https://github.com/rollup/rollup/pull/3371): Adjust bug template to mention REPL.it (@lukastaegert) +- [#3388](https://github.com/rollup/rollup/pull/3388): Run transform hooks again in watch mode on files that errored (@lukastaegert) + +## 1.31.0 + +_2020-01-31_ + +### Features + +- Always disable tree-shaking for asm.js functions to maintain semantics (#3362) + +### Pull Requests + +- [#3362](https://github.com/rollup/rollup/pull/3362): Preserve asm.js code (@lukastaegert) + +## 1.30.1 + +_2020-01-27_ + +### Bug Fixes + +- Do not mistreat static entgry points as dynamic ones when chunking (#3357) +- Resolve a crash when chunking circular dynamic imports (#3357) + +### Pull Requests + +- [#3357](https://github.com/rollup/rollup/pull/3357): Resolve issues with circular dynamic entries (@lukastaegert) + +## 1.30.0 + +_2020-01-27_ + +### Features + +- Do not split chunks when dynamically imported modules import modules that are already loaded by all dynamic importers (#3354) +- Add `hoistTransitiveImports` option to disable hoisting imports of static dependencies into entry chunks (#3353) + +### Bug Fixes + +- Make sure polyfills are always loaded first when each static entry point contains them as first import (#3354) + +### Pull Requests + +- [#3353](https://github.com/rollup/rollup/pull/3353): Add option to avoid hoisting transitive imports (@lukastaegert) +- [#3354](https://github.com/rollup/rollup/pull/3354): Improve chunking algorithm for dynamic imports (@tjenkinson and @lukastaegert) + +## 1.29.1 + +_2020-01-21_ + +### Bug Fixes + +- Avoid crashes for circular reexports when named exports cannot be found (#3350) + +### Pull Requests + +- [#3335](https://github.com/rollup/rollup/pull/3335): Fix typo (@robbinworks) +- [#3342](https://github.com/rollup/rollup/pull/3342): Remove ":" from test file names for Windows and update dependencies (@lukastaegert) +- [#3350](https://github.com/rollup/rollup/pull/3350): Properly handle circular reexports (@lukastaegert) + +## 1.29.0 + +_2020-01-08_ + +### Features + +- Enable top-level await by default (#3089) +- Add typings for watch events (#3302) + +### Bug Fixes + +- Deconflict files that would conflict only on a case-insensitive OS (#3317) +- Do not fail in certain scenarios where a logical expression inside a sequence expression was being directly included (#3327) + +### Pull Requests + +- [#3089](https://github.com/rollup/rollup/pull/3089): Move top-level await out of experimental (@guybedford) +- [#3302](https://github.com/rollup/rollup/pull/3302): Adds type definitions for RollupWatcher events (@NotWoods) +- [#3317](https://github.com/rollup/rollup/pull/3317): Fix module id conflict on a case insensitive OS (@yesmeck) +- [#3327](https://github.com/rollup/rollup/pull/3327): Handle deoptimizations while a node is being included (@lukastaegert) + +## 1.28.0 + +_2020-01-04_ + +### Features + +- Allow piping in stdin via the command line interface (#3312, #3290) +- Allow plugins to mark modules as having syntheticNamedExports for e.g. better CJS interoperability (#3295) +- Ignore variable reassignments in dead code when tree-shaking to remove more unneeded code (#3212) + +### Bug Fixes + +- Properly respect tree-shaken code when generating sourcemaps (#3318) + +### Pull Requests + +- [#3212](https://github.com/rollup/rollup/pull/3212): Handle assignments in dead code (@tjenkinson) +- [#3290](https://github.com/rollup/rollup/pull/3290): Implement stdin input with optional "-" as the file name (@kzc) +- [#3295](https://github.com/rollup/rollup/pull/3295): Add syntheticNamedExports (@manucorporat) +- [#3300](https://github.com/rollup/rollup/pull/3300): Add note about setting `types` in tsconfig file (@tjenkinson) +- [#3303](https://github.com/rollup/rollup/pull/3303): Use ! to assert not-null in TypeScript (@NotWoods) +- [#3312](https://github.com/rollup/rollup/pull/3312): Implement stdin input (@lukastaegert) +- [#3318](https://github.com/rollup/rollup/pull/3318): Update magic-string and other dependencies (@lukastaegert) + +## 1.27.14 + +_2019-12-22_ + +### Bug Fixes + +- Update references to official rollup plugins in error messages (#3297, #3298) + +### Pull Requests + +- [#3286](https://github.com/rollup/rollup/pull/3286): Update link to JavaScript API documentation (@romankaravia) +- [#3294](https://github.com/rollup/rollup/pull/3294): Update deprecated references to the node-resolve plugin in the documentation (@Vlad-Shcherbina) +- [#3297](https://github.com/rollup/rollup/pull/3297): Update references to rollup-plugin-json (@cprecioso) +- [#3298](https://github.com/rollup/rollup/pull/3298): Update references to official rollup plugins (@cprecioso) + +## 1.27.13 + +_2019-12-14_ + +### Bug Fixes + +- Do not truncate environment variable values at the first colon when using the `--environment` option (#3283) + +### Pull Requests + +- [#3283](https://github.com/rollup/rollup/pull/3283): Allow environment variables to contain colons (@tlaverdure) + +## 1.27.12 + +_2019-12-13_ + +### Bug Fixes + +- Prevent invalid AMD or SystemJS code when accessing `import.meta` (#3282) + +### Pull Requests + +- [#3282](https://github.com/rollup/rollup/pull/3282): Always make "module" available for SystemJS and AMD formats if `import.meta` is accessed directly (@lukastaegert) + +## 1.27.11 + +_2019-12-12_ + +### Bug Fixes + +- Resolve a crash due to an infinite loop (#3280) + +### Pull Requests + +- [#3280](https://github.com/rollup/rollup/pull/3280): Prevent infinite deoptimizations (@lukastaegert) + +## 1.27.10 + +_2019-12-11_ + +### Bug Fixes + +- Keep track of function return values in more situations (#3278) + +### Pull Requests + +- [#3278](https://github.com/rollup/rollup/pull/3278): Avoid some unnecessary value tracking deoptimizations (@lukastaegert) + +## 1.27.9 + +_2019-12-07_ + +### Bug Fixes + +- Fix an issue where reexports could be missing when preserving modules (#3273) +- Allow turning of color output via NO_COLOR or FORCE_COLOR=0 environment variables (#3272) + +### Pull Requests + +- [#3272](https://github.com/rollup/rollup/pull/3272): Support either NO_COLOR or FORCE_COLOR=0 to turn off color (@kikonen) +- [#3273](https://github.com/rollup/rollup/pull/3273): Make sure that indirectly reexported modules also become chunk dependencies when preserving modules(@lukastaegert) + +## 1.27.8 + +_2019-12-02_ + +### Bug Fixes + +- Deoptimize objects when a method is called on them to make sure modifications via "this" are observed (#3266) + +### Pull Requests + +- [#3266](https://github.com/rollup/rollup/pull/3266): Workaround for various object literal mutation bugs (@kzc) + +## 1.27.7 + +_2019-12-01_ + +### Bug Fixes + +- Fix a scenario where a reassignments to computed properties were not tracked (#3267) + +### Pull Requests + +- [#3267](https://github.com/rollup/rollup/pull/3267): Fix incomplete computed property deoptimization (@lukastaegert) + +## 1.27.6 + +_2019-11-30_ + +### Bug Fixes + +- Use "auto" export mode by default for all modules when preserving modules (#3265) +- Observe "output.exports" when preserving modules and warn for mixed exports if necessary (#3265) + +### Pull Requests + +- [#3265](https://github.com/rollup/rollup/pull/3265): Use export mode "auto" by default when preserving modules (@lukastaegert) + +## 1.27.5 + +_2019-11-25_ + +### Bug Fixes + +- Make sure namespaces for inlined dynamic imports are treated as variable accesses when deconflicting (#3256) + +### Pull Requests + +- [#3256](https://github.com/rollup/rollup/pull/3256): Avoid name conflicts when inlining dynamic imports nested in functions (@lukastaegert) +- [#3257](https://github.com/rollup/rollup/pull/3257): Update dependencies (@lukastaegert) + +## 1.27.4 + +_2019-11-22_ + +### Bug Fixes + +- Aggregate circular dependency warnings in the CLI (#3249) +- Do not defer non-aggregated handlers in the CLI (#3249) + +### Pull Requests + +- [#3249](https://github.com/rollup/rollup/pull/3249): Fix broken Windows CLI tests (@lukastaegert) +- [#3251](https://github.com/rollup/rollup/pull/3251): Add installation as a separate header (@ashrith-kulai) + +## 1.27.3 + +_2019-11-20_ + +### Bug Fixes + +- Provide better warning when empty chunks are created in a code-splitting scenario (#3244) + +### Pull Requests + +- [#3244](https://github.com/rollup/rollup/pull/3244): Clearer empty chunk warning (@tjenkinson) + +## 1.27.2 + +_2019-11-18_ + +### Bug Fixes + +- Fix an issue where live bindings were not working correctly when using `+=` in SystemJS (#3242) + +### Pull Requests + +- [#3242](https://github.com/rollup/rollup/pull/3242): Export updated assignments when using shorthand update assignment expressions in SystemJS (@lukastaegert) + +## 1.27.1 + +_2019-11-18_ + +### Bug Fixes + +- Fix an issue where code after a switch-statement with removed cases was erroneously not included (#3241) + +### Pull Requests + +- [#3237](https://github.com/rollup/rollup/pull/3237): make `acornOptions` optional in `parse()` in docs (@tjenkinson) +- [#3240](https://github.com/rollup/rollup/pull/3240): Update dependencies and fix vulnerability (@lukastaegert) +- [#3241](https://github.com/rollup/rollup/pull/3241): Do not truncate after switch-statement with removed case (@lukastaegert) + +## 1.27.0 + +_2019-11-12_ + +### Features + +- Add support for output-specific plugins (#3218) +- Reenable parallel output processing when using the CLI (#3218) +- Warn if files are emitted that would overwrite previously emitted files (#3218) + +### Bug Fixes + +- Do not overwrite files emitted in other builds if outputs are generated in parallel (#3218) + +### Pull Requests + +- [#3218](https://github.com/rollup/rollup/pull/3218): Per output plugins (@lukastaegert) + +## 1.26.5 + +_2019-11-11_ + +### Bug Fixes + +- Fix a regression where it was no longer to pass a certain option format to generate (#3223) + +### Pull Requests + +- [#3223](https://github.com/rollup/rollup/pull/3223): Allow passing input options to output (@lukastaegert) + +## 1.26.4 + +_2019-11-09_ + +### Bug Fixes + +- Keep watching known files after a plugin error during the initial build (#3219) + +### Pull Requests + +- [#3216](https://github.com/rollup/rollup/pull/3216): Fix small typo (@kaisermann) +- [#3217](https://github.com/rollup/rollup/pull/3217): Update dependencies and fix security vulnerability (@lukastaegert) +- [#3219](https://github.com/rollup/rollup/pull/3219): Also recover from plugin errors during the initial build (@lukastaegert) + +## 1.26.3 + +_2019-11-02_ + +### Bug Fixes + +- Work around an incompatibility with rollup-plugin-dts (#3211) + +### Pull Requests + +- [#3211](https://github.com/rollup/rollup/pull/3211): Do no fail if the source attribute is `undefined` in an unused named export (@lukastaegert) + +## 1.26.2 + +_2019-10-31_ + +### Bug Fixes + +- Do not create invalid code when using `treeshake: false` and star re-exports (#3209) + +### Pull Requests + +- [#3209](https://github.com/rollup/rollup/pull/3209): Also remove export-all declarations when not tree-shaking (@lukastaegert) + +## 1.26.1 + +_2019-10-31_ + +### Bug Fixes + +- Prevent an issue where outputs would overwrite files emitted by other outputs (#3201) +- Do not throw an error if the config file does not have a .js extension (#3204) + +### Pull Requests + +- [#3201](https://github.com/rollup/rollup/pull/3201): Make the CLI run generate/output in serial (@marijnh) +- [#3204](https://github.com/rollup/rollup/pull/3204): support all config file extensions (.js,.mjs,...) (@arlac77) + +## 1.26.0 + +_2019-10-27_ + +### Features + +- Only warn when no output is provided for an IIFE bundle but still produce valid code (#3181) +- Support reexporting namespaces as a binding (#3193) +- Switch from hash.js to crypto for hashing in the Node build for better performance and support for very large assets (#3194) + +### Bug Fixes + +- Correctly handle chunks reexporting the same namespace as two different bindings (#3193) + +### Pull Requests + +- [#3181](https://github.com/rollup/rollup/pull/3181): Remove the need to provide an output name for IIFE bundles (@bterrier) +- [#3193](https://github.com/rollup/rollup/pull/3193): Add support for "export \* as name from …" (@lukastaegert) +- [#3194](https://github.com/rollup/rollup/pull/3194): Add support for large assets (> 100 MB) (@SebastianNiemann) + +## 1.25.2 + +_2019-10-23_ + +### Bug Fixes + +- Improve performance of bundled UMD code by adding additional parentheses to enforce eager parsing (#3183) +- Improve types to tolerate passing a Rollup config with multiple outputs to `rollup.rollup` (#3184) + +### Pull Requests + +- [#3183](https://github.com/rollup/rollup/pull/3183): Add parentheses to factory function of UMD bundles (@ajihyf) +- [#3184](https://github.com/rollup/rollup/pull/3184): RollupOptions accept output as array (@imcotton) + +## 1.25.1 + +_2019-10-20_ + +### Bug Fixes + +- Handle a situation where code was not included after a switch statement (#3178) +- Handle a situation where code was not included after a do-while loop (#3180) +- Do not fail if different outputs emit the same file (#3175) +- Give access to the original acorn error for parse errors (#3176) + +### Pull Requests + +- [#3175](https://github.com/rollup/rollup/pull/3175): Disable errors for duplicate emitted file names (@marijnh) +- [#3176](https://github.com/rollup/rollup/pull/3176): Add original parser error to rollup error; Update tests (@gribnoysup) +- [#3178](https://github.com/rollup/rollup/pull/3178): Fix switch case not being included correctly (@lukastaegert) +- [#3179](https://github.com/rollup/rollup/pull/3179): Update dependencies (@lukastaegert) +- [#3180](https://github.com/rollup/rollup/pull/3180): Handle conditional breaks in do-while loops with unconditional return (@lukastaegert) + +## 1.25.0 + +_2019-10-18_ + +### Features + +- Remove try-catch if there is no side-effect in the try-block (#3166) +- Omit side-effect-free trailing cases in switch-statements (#3166) +- Remove unused labels (#3170) + +### Bug Fixes + +- Do not remove code after labeled statements that contain a throw or return if the label is used (#3170) +- Prevent invalid code when expressions are simplified that do not follow a white-space character (#3173) +- Do not remove continue statements inside switch statements (#3166) +- Prevent trailing empty lines when tree-shaking inside switch statements (#3166) + +### Pull Requests + +- [#3166](https://github.com/rollup/rollup/pull/3166): Better try statement tree shaking (@lukastaegert) +- [#3170](https://github.com/rollup/rollup/pull/3170): Handle optional control flow in labeled statements, remove unused labels (@lukastaegert) +- [#3173](https://github.com/rollup/rollup/pull/3173): Add missing spaces in certain statements and expressions to avoid invalid code (@lukastaegert) + +## 1.24.0 + +_2019-10-15_ + +### Features + +- Respect `break`, `continue`, `return` and `throw` when tree-shaking to detect dead code (#3153) +- Do treat treat hoisted function declarations as "unknown" when checking for call side-effects (#3153) + +### Bug Fixes + +- Make sure that unknown `import.meta` properties produce valid code in SystemJS (#3152) +- Make sure `treeshake.annotations: false` is respected for class instantiation (#3153) +- Check property access side-effects for class instantiation (#3153) +- Do not suppress break statements inside labeled statements (#3153) + +### Pull Requests + +- [#3152](https://github.com/rollup/rollup/pull/3152): Allow import.meta.\* for systemjs format (@dmail) +- [#3153](https://github.com/rollup/rollup/pull/3153): Get rid of immutable.js and implement tree-shaking for broken control flow (@lukastaegert) + +## 1.23.1 + +_2019-10-05_ + +### Bug Fixes + +- Fix a regression where the node types had a specific minimal version (#3143) + +### Pull Requests + +- [#3143](https://github.com/rollup/rollup/pull/3143): Ensure that types packages have star version ranges (@lukastaegert) + +## 1.23.0 + +_2019-10-03_ + +### Features + +- Add placeholders for extensions when preserving modules (#3116) + +### Pull Requests + +- [#3116](https://github.com/rollup/rollup/pull/3116): Include extensions in preserveModules output filenames for scriptified assets (@Andarist) +- [#3142](https://github.com/rollup/rollup/pull/3142): Fix typo (@tu4mo) + +## 1.22.0 + +_2019-09-29_ + +### Features + +- Add a new "hidden" sourcemap type that generates the map files but omits the sourcemap comment (#3120) +- Generate more efficient code when using `namespaceToStringTag: true` (#3135) +- Make sure namespace objects do not have a prototype (#3136) + +### Bug Fixes + +- Do not ignore side-effectful iterators by always preserving for..of loops for now (#3132) +- Make sure `--context` is observed as a CLI option (#3134) +- Do not require specific versions for @types dependencies (#3131) + +### Pull Requests + +- [#3120](https://github.com/rollup/rollup/pull/3120): Generate sourcemaps but omit the comment (@rohitmohan96) +- [#3131](https://github.com/rollup/rollup/pull/3131): Use asterisk for @types/\* dependencies (@frenzzy) +- [#3132](https://github.com/rollup/rollup/pull/3132): Preserve empty for...of loops (@imatlopez) +- [#3133](https://github.com/rollup/rollup/pull/3133): Update dependencies (@lukastaegert) +- [#3134](https://github.com/rollup/rollup/pull/3134): Wire up --context CLI flag (@tchetwin) +- [#3135](https://github.com/rollup/rollup/pull/3135): Remove Symbol polyfill in module namespaces (@mkubilayk) +- [#3136](https://github.com/rollup/rollup/pull/3136): Set null prototype on namespace objects (@rpamely) + +## 1.21.4 + +_2019-09-16_ + +### Bug Fixes + +- Recognize common browser globals (#3117) +- Do not treat "typeof " as a side-effect (#3117) + +### Pull Requests + +- [#3117](https://github.com/rollup/rollup/pull/3117): Add browser globals to known globals and prevent "typeof" side-effects (@lukastaegert) + +## 1.21.3 + +_2019-09-14_ + +### Bug Fixes + +- Fix a regression where modifying a watched file did not trigger a rebuild (#3112) + +### Pull Requests + +- [#3112](https://github.com/rollup/rollup/pull/3112): Fix .addWatchFile() dependencies failing to invalidate in watch mode (@tivac) + +## 1.21.2 + +_2019-09-09_ + +### Bug Fixes + +- Fix wrong deprecation message to direct to `this.emitFile` instead of `this.emitAsset` + +## 1.21.1 + +_2019-09-09_ + +### Bug Fixes + +- Allow legacy plugins to still add assets directly to the bundle object (#3105) + +### Pull Requests + +- [#3105](https://github.com/rollup/rollup/pull/3105): Allow legacy plugins to still add assets directly to the bundle object (@lukastaegert) + +## 1.21.0 + +_2019-09-08_ + +### Features + +- Respect `output.entryFileNames` when preserving modules (#3088) +- Make accessing unknown globals a side-effect unless this is deactivated via `treeshake.unknownGlobalSideEffects` (#3068) +- Respect global objects when checking for pure global functions (#3068) +- Introduce a `type` to more easily distinguish chunks and assets in the output bundle (#3080) + +### Bug Fixes + +- Recover in watch mode when the initial build fails (#3081) +- Make sure `output.strict` is respected for SystemJS output (#3101) + +### Pull Requests + +- [#3068](https://github.com/rollup/rollup/pull/3068): Make accessing unknown globals a side-effect (@lukastaegert) +- [#3080](https://github.com/rollup/rollup/pull/3080): OutputBundle Tagged union with 'type = chunk|asset' (@askbeka) +- [#3081](https://github.com/rollup/rollup/pull/3081): Watch files onbuild, even if build fails (@mhkeller) +- [#3088](https://github.com/rollup/rollup/pull/3088): Add support for entryFileNames pattern used in combination with preserveModules option (@Andarist) +- [#3101](https://github.com/rollup/rollup/pull/3101): Remove 'use strict'; from systemjs when strict=false (@askbeka) + +## 1.20.3 + +_2019-08-28_ + +### Bug Fixes + +- Make sure file hashes change when a change of the naming pattern leads to a file name change of a dependency (#3083) +- Fix several issues where reexporting an external "default" export could lead to invalid or incorrect code (#3084) + +### Pull Requests + +- [#3078](https://github.com/rollup/rollup/pull/3078): Add github actions workflow config for windows (@shellscape) +- [#3083](https://github.com/rollup/rollup/pull/3083): Properly reflect dependency file names in hash (@lukastaegert) +- [#3084](https://github.com/rollup/rollup/pull/3084): Fix "default" reexport issues in non ESM/System formats (@lukastaegert) + +## 1.20.2 + +_2019-08-25_ + +### Bug Fixes + +- Avoid an issue where circular namespace reexports would crash Rollup (#3074) + +### Pull Requests + +- [#3077](https://github.com/rollup/rollup/pull/3077): Handle namespaces that reexport themselves (@lukastaegert) + +## 1.20.1 + +_2019-08-22_ + +### Bug Fixes + +- Fix an issue where variable names inside dynamic import expressions were not rendered correctly (#3073) +- Fix type definition to allow a single watcher config as well as an array (#3074) + +### Pull Requests + +- [#3073](https://github.com/rollup/rollup/pull/3073): Fix wrong variable name in import expression (@lukastaegert) +- [#3074](https://github.com/rollup/rollup/pull/3074): Fixes type definition on watch and Watcher constructor (@MicahZoltu) + +## 1.20.0 + +_2019-08-21_ + +### Features + +- Add augmentChunkHash plugin hook to be able to reflect changes in renderChunk in the chunk hash (#2921) + +### Bug Fixes + +- Do not mutate the acorn options object (#3051) +- Make sure the order of emitted chunks always reflects the order in which they were emitted (#3055) +- Do not hang when there are strings containing comment-like syntax in some scenarios (#3069) + +### Pull Requests + +- [#2921](https://github.com/rollup/rollup/pull/2921): Add augmentChunkHash plugin hook (@isidrok) +- [#2995](https://github.com/rollup/rollup/pull/2995): Add info on installing locally to docs (@mesqueeb) +- [#3037](https://github.com/rollup/rollup/pull/3037): Refresh pull request labels (@shellscape) +- [#3048](https://github.com/rollup/rollup/pull/3048): Document ROLLUP_WATCH environment variable (@shellscape) +- [#3051](https://github.com/rollup/rollup/pull/3051): Avoid changes to the original options (.acorn) object (@LongTengDao) +- [#3052](https://github.com/rollup/rollup/pull/3052): Minor refactoring: Remove one try-catch (@KSXGitHub) +- [#3053](https://github.com/rollup/rollup/pull/3053): Refactor to use async-await in more places (@KSXGitHub) +- [#3055](https://github.com/rollup/rollup/pull/3055): Provide consistent chunking via a consistent order of entry modules when emitting chunks (@lukastaegert) +- [#3058](https://github.com/rollup/rollup/pull/3058): Remove acorn-bigint and acorn-dynamic-import from bundle (@LongTengDao) +- [#3061](https://github.com/rollup/rollup/pull/3061): Update to acorn@7 (@lukastaegert) +- [#3063](https://github.com/rollup/rollup/pull/3063): Auto-generate license file (@lukastaegert) +- [#3069](https://github.com/rollup/rollup/pull/3069): Prevent infinite loop when scanning for line-breaks and there are comment-like strings (@lukastaegert) + +## 1.19.4 + +_2019-08-07_ + +### Bug Fixes + +- Prevent invalid code when exporting an external namespace (#3034) +- Prevent invalid or non-equivalent code when simplifying expressions in return and throw statements (#3035) + +### Pull Requests + +- [#3034](https://github.com/rollup/rollup/pull/3034): Avoid generating .\* as export (@LongTengDao) +- [#3035](https://github.com/rollup/rollup/pull/3035): Prevent ASI errors for conditional expressions (@lukastaegert) +- [#3036](https://github.com/rollup/rollup/pull/3036): Fix documents to use https, not http (@giraffate) + +## 1.19.3 + +_2019-08-06_ + +### Bug Fixes + +- Fix wrong URLs in error messages (#3033) + +### Pull Requests + +- [#3033](https://github.com/rollup/rollup/pull/3033): Fix wrong URLs in error messages (@giraffate) + +## 1.19.2 + +_2019-08-05_ + +### Bug Fixes + +- Add bin file to package + +## 1.19.1 + +_2019-08-05_ + +### Bug Fixes + +- Remove wrong extension in package.json file (#3031) + +### Pull Requests + +- [#3031](https://github.com/rollup/rollup/pull/3031): Fix wrong extension (@lukastaegert) + +## 1.19.0 + +_2019-08-05_ + +### Features + +- Implement a new unified file emission API for assets and chunks with support for explicit file names (#2999) +- Use the id of the last module in a chunk as base for the chunk name if no better name is available (#3025) +- Use the id of the last module in a chunk as base for the variable name of a chunk in some formats if no better name is available (#2999) + +### Bug Fixes + +- Do not produce invalid variable names if an empty name is chosen for a virtual module (#3026) +- Fix an issue where a module variable name would conflict with a local variable name in some formats (#3020) + +### Pull Requests + +- [#2999](https://github.com/rollup/rollup/pull/2999): Unified file emission api (@lukastaegert) +- [#3020](https://github.com/rollup/rollup/pull/3020): Switch to a code-splitting build and update dependencies (@lukastaegert) +- [#3025](https://github.com/rollup/rollup/pull/3025): Use id of last module in chunk as name base for auto-generated chunks (@lukastaegert) +- [#3026](https://github.com/rollup/rollup/pull/3026): Avoid variable from empty module name be empty (@LongTengDao) + +## 1.18.0 + +_2019-08-01_ + +### Features + +- Add `externalLiveBindings: false` option to optimize code when live bindings are not needed (#3010) + +### Pull Requests + +- [#2997](https://github.com/rollup/rollup/pull/2997): Integrate coverage into CI setup (@lukastaegert) +- [#2998](https://github.com/rollup/rollup/pull/2998): Update readme badges (@lukastaegert) +- [#3010](https://github.com/rollup/rollup/pull/3010): Add option to prevent code for external live bindings (@lukastaegert) + +## 1.17.0 + +_2019-07-15_ + +### Features + +- Allow plugins to access current combined sourcemap in transform hook for coverage instrumentation (#2993) + +### Pull Requests + +- [#2987](https://github.com/rollup/rollup/pull/2987): Fix code fences for link (@johanholmerin) +- [#2989](https://github.com/rollup/rollup/pull/2989): Bump lodash from 4.17.11 to 4.17.14 (@dependabot) +- [#2993](https://github.com/rollup/rollup/pull/2993): Add getCombinedSourceMap in transform plugin context (@billowz) + +## 1.16.7 + +_2019-07-09_ + +### Bug Fixes + +- Fix an issue where exported import.meta properties would lead to invalid code (#2986) + +### Pull Requests + +- [#2985](https://github.com/rollup/rollup/pull/2985): Improve sourcemap types (@jridgewell) +- [#2986](https://github.com/rollup/rollup/pull/2986): Only overwrite content when resolving import.meta properties (@lukastaegert) + +## 1.16.6 + +_2019-07-04_ + +### Bug Fixes + +- Do not pass undefined to resolveDynamicImport for unresolvable template literals (#2984) + +### Pull Requests + +- [#2984](https://github.com/rollup/rollup/pull/2984): Always forward AST nodes for unresolvable dynamic imports (@lukastaegert) + +## 1.16.5 + +_2019-07-04_ + +### Bug Fixes + +- onwarn should still be called when --silent is used (#2982) +- Properly clean up watchers for files that are deleted between builds (#2982) + +### Pull Requests + +- [#2981](https://github.com/rollup/rollup/pull/2981): Do not skip onwarn handler when --silent is used (@lukastaegert) +- [#2982](https://github.com/rollup/rollup/pull/2982): Make tests run on Node 12, fix watcher cleanup issue (@lukastaegert) + +## 1.16.4 + +_2019-07-02_ + +### Bug Fixes + +- Do not show a TypeScript error when providing a location as number to this.warn and this.error (#2974) +- Use the correct TypeScript type for Sourcemap.version (#2976) + +### Pull Requests + +- [#2965](https://github.com/rollup/rollup/pull/2965): Use async readFile in getRollupDefaultPlugin (@kaksmet) +- [#2974](https://github.com/rollup/rollup/pull/2974): Align TS types, docs and implementation for this.warn and this.error (@lukastaegert) +- [#2976](https://github.com/rollup/rollup/pull/2976): Fix sourcemap type and update dependencies (@lukastaegert) + +## 1.16.3 + +_2019-06-29_ + +### Bug Fixes + +- Prevent name conflicts with unused function parameters (#2972) + +### Pull Requests + +- [#2972](https://github.com/rollup/rollup/pull/2972): Deconflict unused parameters (@lukastaegert) + +## 1.16.2 + +_2019-06-22_ + +### Bug Fixes + +- Properly wrap dynamic imports in Promises that can be caught when generating CJS output (#2958) + +### Pull Requests + +- [#2958](https://github.com/rollup/rollup/pull/2958): Make sure errors from dynamic imports can be caught (@lukastaegert) + +## 1.16.1 + +_2019-06-21_ + +### Pull Requests + +- [#2956](https://github.com/rollup/rollup/pull/2956): Add missing CLI docs for strictDeprecations (@lukastaegert) + +## 1.16.0 + +_2019-06-21_ + +### Features + +- Add strictDeprecations option to throw when currently or upcoming deprecated features are used (#2945) +- Keep annotations and comments when simplifying logical and conditional expressions (#2955) + +### Bug Fixes + +- Generate proper namespace objects when dynamically importing external dependencies for AMD or CJS formats (#2954) +- Fix dynamically imported variables not being resolved correctly when importing from an entry chunk with only a default export (#2954) +- Do not reexport default when reexporting a namespace (#2954) + +### Pull Requests + +- [#2945](https://github.com/rollup/rollup/pull/2945): Add option to handle use of features marked for deprecation as errors (@lukastaegert) +- [#2954](https://github.com/rollup/rollup/pull/2954): Improve dynamic import interop (@lukastaegert) +- [#2955](https://github.com/rollup/rollup/pull/2955): Keep annotations and comments when simplifying logical and conditional expressions (@lukastaegert) + +## 1.15.6 + +_2019-06-16_ + +### Bug Fixes + +- No longer use an alternate screen in watch mode to allow scrolling (#2942) +- Prioritize non-external imports over external ones when resolving conflicting namespace re-exports (#2893) + +### Pull Requests + +- [#2893](https://github.com/rollup/rollup/pull/2893): Improve handling of conflicting namespace exports (@aleclarson) +- [#2942](https://github.com/rollup/rollup/pull/2942): Get rid of alternate screen and simplify screen clearing (@lukastaegert) + +## 1.15.5 + +_2019-06-14_ + +### Bug Fixes + +- Do not include any comments for completely tree-shaken files so that `renderedLength === 0` is a reliable check (#2940) +- Do not cause type errors when returning `null` from `resolveId` (#2941) + +### Pull Requests + +- [#2940](https://github.com/rollup/rollup/pull/2940): Completely omit files that do not have any included statements (@lukastaegert) +- [#2941](https://github.com/rollup/rollup/pull/2941): Explicitly allow null as return value for various hooks (@lukastaegert) + +## 1.15.4 + +_2019-06-14_ + +### Bug Fixes + +- Improve how asset and chunk URLs are resolved for UMD, IIFE and CJS output (#2937) + +### Pull Requests + +- [#2937](https://github.com/rollup/rollup/pull/2937): Fix URL resolution to work when the current script contains query parameters (@lukastaegert) + +## 1.15.3 + +_2019-06-13_ + +### Bug Fixes + +- Always reemit assets and chunks from cached transform hooks (#2936) + +### Pull Requests + +- [#2936](https://github.com/rollup/rollup/pull/2936): Fix repeated re-emission of files emitted from a transform hook (@lukastaegert) + +## 1.15.2 + +_2019-06-13_ + +### Bug Fixes + +- Make sure chunks emitted from transform hooks are also emitted for incremental builds in watch mode (#2933) + +### Pull Requests + +- [#2933](https://github.com/rollup/rollup/pull/2933): Reemit chunks emitted from transform hooks (@lukastaegert) + +## 1.15.1 + +_2019-06-11_ + +### Bug Fixes + +- Do not fail when reexporting variables in dynamic entry points from other chunks (#2928) + +### Pull Requests + +- [#2928](https://github.com/rollup/rollup/pull/2928): Handle reexports from dynamic entries across chunk (@lukastaegert) + +## 1.15.0 + +_2019-06-11_ + +### Features + +- Tone down try-catch deoptimization while maintaining polyfill support (#2918) + +### Bug Fixes + +- Handle feature detection with "typeof" for regular expressios (#2916) +- Deoptimize `'' + variable'` type coercion as expression statement for feature detection (#2917) +- Always observe argument side-effects when tree-shaking (#2924) + +### Pull Requests + +- [#2916](https://github.com/rollup/rollup/pull/2916): Deoptimize typeof for regular expression literals to better support es6-shim (@lukastaegert) +- [#2917](https://github.com/rollup/rollup/pull/2917): Support implicit type coercion errors in es5-shim (@lukastaegert) +- [#2918](https://github.com/rollup/rollup/pull/2918): Deoptimize try-catch less radically (@lukastaegert) +- [#2924](https://github.com/rollup/rollup/pull/2924): Do not tree-shake arguments with side-effects (@lukastaegert) + +## 1.14.6 + +_2019-06-10_ + +### Bug Fixes + +- Fix an issue where call arguments were not included in try statements (#2914) + +### Pull Requests + +- [#2914](https://github.com/rollup/rollup/pull/2914): Properly include try statements for each pass when deoptimization is deactivated (@lukastaegert) + +## 1.14.5 + +_2019-06-09_ + +### Bug Fixes + +- Keep external ids unmodified when using the object form of resolveId (#2907) +- Cache dynamic import resolutions when using Rollup cache (#2908) +- Keep all necessary parentheses when tree-shaking call arguments (#2911) + +### Pull Requests + +- [#2906](https://github.com/rollup/rollup/pull/2906): Update dependencies (@lukastaegert) +- [#2907](https://github.com/rollup/rollup/pull/2907): Do not renormalize external ids when using the object form (@lukastaegert) +- [#2908](https://github.com/rollup/rollup/pull/2908): Cache dynamic ids if possible (@lukastaegert) +- [#2911](https://github.com/rollup/rollup/pull/2911): Fix treeshaken parameters around parentheses (@manucorporat) + +## 1.14.4 + +_2019-06-07_ + +### Bug Fixes + +- Do not omit external re-exports for `moduleSideEffects: false` (#2905) + +### Pull Requests + +- [#2905](https://github.com/rollup/rollup/pull/2905): Make sure external re-exports are included for moduleSideEffects: false (@lukastaegert) + +## 1.14.3 + +_2019-06-06_ + +### Bug Fixes + +- Generate correct external imports when importing from a directory that would be above the root of the current working directory (#2902) + +### Pull Requests + +- [#2902](https://github.com/rollup/rollup/pull/2902): Use browser relative path algorithm for chunks (@lukastaegert) + +## 1.14.2 + +_2019-06-05_ + +### Bug Fixes + +- Prevent unnecessary inclusion of external namespace import in certain situations (#2900) + +### Pull Requests + +- [#2900](https://github.com/rollup/rollup/pull/2900): Handle early bind for member expressions (@lukastaegert) + +## 1.14.1 + +_2019-06-05_ + +### Bug Fixes + +- Fix an issue where try-statements were not included properly when a variable declared inside the statement was accessed outside it (#2898) +- Fix an issue where `await` expressions were not included properly (#2899) + +### Pull Requests + +- [#2898](https://github.com/rollup/rollup/pull/2898): Properly include try-catch-statements even if they have already been included in some way (@lukastaegert) +- [#2899](https://github.com/rollup/rollup/pull/2899): Fix unintended early return in await inclusion handling (@lukastaegert) + +## 1.14.0 + +_2019-06-05_ + +### Features + +- Deoptimize code inside and called from try-statements for feature detection (#2892) +- Tree-shake unused call arguments (#2892) + +### Pull Requests + +- [#2892](https://github.com/rollup/rollup/pull/2892): Implement try-statement-deoptimization for feature detection, tree-shake unused arguments (@lukastaegert) + +## 1.13.1 + +_2019-06-01_ + +### Bug Fixes + +- Avoid conflicts between top-level module, require etc. and CommonJS runtimes (#2889) + +### Pull Requests + +- [#2888](https://github.com/rollup/rollup/pull/2888): Enable full TypeScript strict mode (@lukastaegert) +- [#2889](https://github.com/rollup/rollup/pull/2889): Protect all module globals for CJS output from being redefined (@lukastaegert) + +## 1.13.0 + +_2019-05-31_ + +### Features + +- Omit `exports` and `module` from SystemJS wrapper if possible (#2880) +- Try to use the first letters of names when mangling exports (#2885) + +### Bug Fixes + +- Avoid conflicts with local variables when using format specific globals to render dynamic imports and file URLs (#2880) +- Do not produce undefined reexports when reexporting from entry points (#2885) + +### Pull Requests + +- [#2880](https://github.com/rollup/rollup/pull/2880): Deconflict global variables used inside format-specific code (@lukastaegert) +- [#2885](https://github.com/rollup/rollup/pull/2885): Do not produce undefined reexports when reexporting from entry points and refactor chunk linking (@lukastaegert) + +## 1.12.5 + +_2019-05-30_ + +### Pull Requests + +- [#2884](https://github.com/rollup/rollup/pull/2884): Update pluginutils for new micormatch and reduced bundle size (@lukastaegert) + +## 1.12.4 + +_2019-05-27_ + +### Bug Fixes + +- Show correct error stack trace for errors throw in "load" hooks (#2871) + +### Pull Requests + +- [#2875](https://github.com/rollup/rollup/pull/2875): Mention subfolders in docs (@lukastaegert) +- [#2871](https://github.com/rollup/rollup/pull/2871): Reserve error stack information (@LongTengDao) + +## 1.12.3 + +_2019-05-19_ + +### Bug Fixes + +- Prevent duplicate imports when exports are reexported as default exports (#2866) + +### Pull Requests + +- [#2755](https://github.com/rollup/rollup/pull/2755): Enable TypeScript strictNullChecks (@edsrzf) +- [#2866](https://github.com/rollup/rollup/pull/2866): Properly deduplicate reexported default exports (@lukastaegert) + +## 1.12.2 + +_2019-05-17_ + +### Bug Fixes + +- Do not fail when using clearScreen:false in watchMode (#2858) +- Properly resolve star reexports when preserving modules (#2860) + +### Pull Requests + +- [#2858](https://github.com/rollup/rollup/pull/2858): Declare processConfigsErr before use (@humphd) +- [#2860](https://github.com/rollup/rollup/pull/2860): Keep nested exports with preserveModules (@TomCaserta) +- [#2864](https://github.com/rollup/rollup/pull/2864): Cache transitive reexport detection (@lukastaegert) + +## 1.12.1 + +_2019-05-16_ + +### Bug Fixes + +- Extend file name sanitation to also replace "?" and "\*" e.g. when preserving modules with the updated commonjs plugin (#2860) +- Do not ignore module transformer that return an empty string (#2861) + +### Pull Requests + +- [#2860](https://github.com/rollup/rollup/pull/2860): Update to latest plugins and extend file name sanitation (@lukastaegert) +- [#2861](https://github.com/rollup/rollup/pull/2861): Allow transformers to return an empty string (@lukastaegert) + +## 1.12.0 + +_2019-05-15_ + +### Features + +- Add `treeshake.moduleSideEffects` option to allow removing empty imports without a side-effect check (#2844) +- Extend plugin API to allow marking modules as side-effect-free (#2844) +- Extend `this.resolve` plugin context function with an option to skip the `resolveId` hook of the calling plugin (#2844) +- Add `isEntry` flag to `this.getModuleInfo` plugin context function (#2844) +- Distribute Rollup as optimized ES2015 code (#2851) + +### Pull Requests + +- [#2844](https://github.com/rollup/rollup/pull/2844): Add options and hooks to control module side effects (@lukastaegert) +- [#2851](https://github.com/rollup/rollup/pull/2851): Switch to ES2015 output (@lukastaegert) + +## 1.11.3 + +_2019-05-05_ + +### Bug Fixes + +- Quote es3 keywords in namespace objects (#2825) + +### Pull Requests + +- [#2825](https://github.com/rollup/rollup/pull/2825): Add es3 support for namespace object import (@sormy) + +## 1.11.2 + +_2019-05-04_ + +### Bug Fixes + +- Prevent a crash when handling circular namespace exports (#2836) + +### Pull Requests + +- [#2836](https://github.com/rollup/rollup/pull/2836): Make sure circular `export * from X` does not stack overflow (@Swatinem) + +## 1.11.1 + +_2019-05-04_ + +### Bug Fixes + +- Fix an issue where rendered exports were reported as "removed" in the bundle information (#2835) + +### Pull Requests + +- [#2835](https://github.com/rollup/rollup/pull/2835): Fix `removedExports` to correctly track the exported item (@Swatinem) + +## 1.11.0 + +_2019-05-03_ + +### Features + +- Add `emitChunk` plugin context function to emit additional entry chunks that can be referenced from the code (#2809) +- Allow `manualChunks` to be a function (#2831) +- Omit `.js` extensions in AMD imports to make sure an AMD `baseUrl` would work (#2809) +- Automatically use the name of the imported module as a base for dynamically imported chunks (#2809) +- Add `resolveFileUrl` plugin hook to replace `resolveAssetUrl` and handle emitted chunks as well (#2809) +- Add `resolve` plugin hook to replace `resolveId` and `isExternal` that returns an object (#2829) +- Allow `resolveDynamicImport` to return an `{id, external}` object to also resolve unresolvable dynamic imports to a module (#2829) + +### Bug Fixes + +- Do not create invalid code if a dynamic import contains nothing but reexports (#2809) +- Do not fail if modules that define a manual chunk depend on each other (#2809) +- Do not fail if a module that defines a manual chunk is the dependency of a module defining a different manual chunk (#2809) +- No longer fail for unnamed duplicate entry points but combine them (#2809) +- Always return `string | null` from `this.resolveId` even if some `resolveId` hooks return objects (#2829) +- Show proper warnings when `resolveDynamicImport` resolves to a non-external module that does not exist (#2829) + +### Pull Requests + +- [#2809](https://github.com/rollup/rollup/pull/2809): Add hook for dynamic entry chunk emission (@lukastaegert) +- [#2821](https://github.com/rollup/rollup/pull/2821): Fix syntax error in documentation (@FFxSquall) +- [#2829](https://github.com/rollup/rollup/pull/2829): Improve id resolution (@lukastaegert) +- [#2831](https://github.com/rollup/rollup/pull/2831): Allow manualChunks to be a function (@lukastaegert) +- [#2832](https://github.com/rollup/rollup/pull/2832): Improve `generateBundle` documentation (@lukastaegert) +- [#2833](https://github.com/rollup/rollup/pull/2833): Update dependencies (@lukastaegert) + +## 1.10.1 + +_2019-04-19_ + +### Bug Fixes + +- Invalid options.format values will now trigger a helpful error (#2813) + +### Pull Requests + +- [#2812](https://github.com/rollup/rollup/pull/2812): Minor documentation update (@dnalborczyk) +- [#2813](https://github.com/rollup/rollup/pull/2813): Catch invalid options.format values (@marijnh) +- [#2816](https://github.com/rollup/rollup/pull/2816): Update all dependencies to fix security issues (@lukastaegert) + +## 1.10.0 + +_2019-04-11_ + +### Features + +- Improve generated code to polyfill `import.meta.url` (#2785) +- Add plugin hook to configure handling of `import.meta` (#2785) +- Improve generated code when accessing URLs of emitted assets (#2796) +- Add plugin hook to configure the generated code when accessing URLs of emitted assets (#2796) + +### Bug Fixes + +- No longer resolve assets to their parent URL in some cases (#2796) + +### Pull Requests + +- [#2785](https://github.com/rollup/rollup/pull/2785): Refactor handling of import.meta.url and add option to configure behaviour (@lukastaegert) +- [#2796](https://github.com/rollup/rollup/pull/2796): Improve and fix asset emission (@lukastaegert) + +## 1.9.3 + +_2019-04-10_ + +### Bug Fixes + +- Simplify return expressions that are evaluated before the surrounding function is bound (#2803) + +### Pull Requests + +- [#2803](https://github.com/rollup/rollup/pull/2803): Handle out-of-order binding of identifiers to improve tree-shaking (@lukastaegert) + +## 1.9.2 + +_2019-04-10_ + +### Bug Fixes + +- Allowing replacing `output.file` with `output.dir` in the `outputOptions` hook (#2802) + +### Pull Requests + +- [#2802](https://github.com/rollup/rollup/pull/2802): Observe modified output options in bundle.write (@lukastaegert) + +## 1.9.1 + +_2019-04-10_ + +### Bug Fixes + +- Make sure inline comments in dynamic imports are preserved (#2797) + +### Pull Requests + +- [#2797](https://github.com/rollup/rollup/pull/2797): Emit inline comments inside dynamic import (@manucorporat) + +## 1.9.0 + +_2019-04-05_ + +### Features + +- Add built-in support for bigint (#2789) + +### Pull Requests + +- [#2789](https://github.com/rollup/rollup/pull/2789): Ship with bigint support built-in (@danielgindi) +- [#2791](https://github.com/rollup/rollup/pull/2791): Use shared extractAssignedNames from rollup-pluginutils (@lukastaegert) +- [#2792](https://github.com/rollup/rollup/pull/2792): Test that rollup-plugin-commonjs works with preserveModules (@lukastaegert) + +## 1.8.0 + +_2019-04-02_ + +### Features + +- Support `module` as alias for `esm` and `commonjs` for `cjs` to match Node (#2783) + +### Pull Requests + +- [#2782](https://github.com/rollup/rollup/pull/2782): Inline interopDefault in config loading (@guybedford) +- [#2783](https://github.com/rollup/rollup/pull/2783): Support Node-style format aliases (@guybedford) + +## 1.7.4 + +_2019-03-28_ + +### Bug Fixes + +- Improve TypeScript type of the treeshaking options (#2779) + +### Pull Requests + +- [#2779](https://github.com/rollup/rollup/pull/2779): Make all properties in TreeshakingOptions optional (@ndelangen) + +## 1.7.3 + +_2019-03-24_ + +### Bug Fixes + +- Use getters when re-exporting live-bindings (#2765) + +### Pull Requests + +- [#2765](https://github.com/rollup/rollup/pull/2765): Support exporting live-bindings from other chunks or external dependencies (@lukastaegert) + +## 1.7.2 + +_2019-03-24_ + +### Bug Fixes + +- Make sure relative external ids are resolved correctly (#2774) + +### Pull Requests + +- [#2774](https://github.com/rollup/rollup/pull/2774): Resolve relative external ids (@lukastaegert) + +## 1.7.1 + +_2019-03-24_ + +### Bug Fixes + +- Prevent invalid code when exporting several hundred identifiers from a chunk (#2768) +- Do not wrongly deconflict labels (#2776) + +### Pull Requests + +- [#2768](https://github.com/rollup/rollup/pull/2768): Sanitize shortened internal export names (@lukastaegert) +- [#2769](https://github.com/rollup/rollup/pull/2769): Update dependencies and fix security issue (@lukastaegert) +- [#2776](https://github.com/rollup/rollup/pull/2776): Do not treat break labels as identifiers (@lukastaegert) + +## 1.7.0 + +_2019-03-20_ + +### Features + +- Sort chunk exports by name for greater consistency (#2757) + +### Bug Fixes + +- Fix a situation where tree-shakeable code would not be removed in an indeterminate manner (#2757) + +### Pull Requests + +- [#2757](https://github.com/rollup/rollup/pull/2757): Sort modules before binding, sort exports (@lukastaegert) + +## 1.6.1 + +_2019-03-20_ + +### Bug Fixes + +- Avoid name clashes of unused default exports when tree-shaking is false (#2758) +- Do not crash when generating SystemJS bundles containing array patterns with member expressions (#2760) + +### Pull Requests + +- [#2758](https://github.com/rollup/rollup/pull/2758): Make sure unused default exports are deconflicted when tree-shaking is false (@lukastaegert) +- [#2760](https://github.com/rollup/rollup/pull/2760): Handle member expressions in array patterns (@lukastaegert) + +## 1.6.0 + +_2019-03-08_ + +### Features + +- Add plugin hook to modify output options (#2736) + +### Pull Requests + +- [#2736](https://github.com/rollup/rollup/pull/2736): Add hook for modifying OutputOptions (@Comandeer) + +## 1.5.0 + +_2019-03-07_ + +### Features + +- Allow resolving to a different id while marking it as external at the same time (#2734) + +### Pull Requests + +- [#2734](https://github.com/rollup/rollup/pull/2734): Allow resolveId to return an object (@lukastaegert) + +## 1.4.2 + +_2019-03-07_ + +### Bug Fixes + +- Respect variable identity of exports when hashing (#2741) +- Resolve a situations where a variable was imported twice with the same name (#2737) + +### Pull Requests + +- [#2741](https://github.com/rollup/rollup/pull/2741): Fix hashing when different variable are exported using the same name (@lukastaegert) +- [#2737](https://github.com/rollup/rollup/pull/2737): Fix duplicate imports with conflicting names (@lukastaegert) + +## 1.4.1 + +_2019-03-04_ + +### Bug Fixes + +- Do not treat the import target "" as external by default (#2733) + +### Pull Requests + +- [#2733](https://github.com/rollup/rollup/pull/2733): Do not treat the import target "" as external by default (@LongTengDao) + +## 1.4.0 + +_2019-03-01_ + +### Features + +- Add option to change the name of the dynamic import function to allow polyfilling it (#2723) + +### Pull Requests + +- [#2723](https://github.com/rollup/rollup/pull/2723): Add dynamicImportFunction option (@keithamus) + +## 1.3.3 + +_2019-03-01_ + +### Bug Fixes + +- Fix performance regression when handling long chains of calls to property methods (#2732) + +### Pull Requests + +- [#2730](https://github.com/rollup/rollup/pull/2730): Order types, interfaces, classes, and object members (@lukastaegert) +- [#2732](https://github.com/rollup/rollup/pull/2732): Take chunk export mode into account when reexporting default (@lukastaegert) + +## 1.3.2 + +_2019-02-27_ + +### Bug Fixes + +- Allow ids of default exported classes to be exported separately (#2728) + +### Pull Requests + +- [#2728](https://github.com/rollup/rollup/pull/2728): Update dependencies (@lukastaegert) + +## 1.3.1 + +_2019-02-27_ + +### Bug Fixes + +- Correctly reexport the default export from entry chunks (#2727) + +### Pull Requests + +- [#2727](https://github.com/rollup/rollup/pull/2727): Take chunk export mode into account when reexporting default (@lukastaegert) + +## 1.3.0 + +_2019-02-26_ + +### Features + +- Treeshake call expressions prefixed with UglifyJS style `@__PURE__` annotations (#2429) + +### Pull Requests + +- [#2429](https://github.com/rollup/rollup/pull/2429): Add support for /_#**PURE**_/ comments (@conartist6 and @lukastaegert) + +## 1.2.5 + +_2019-02-26_ + +### Bug Fixes + +- Store external ids reported by plugins in watch mode (#2718) + +### Pull Requests + +- [#2718](https://github.com/rollup/rollup/pull/2718): Incremental external (@andreas-karlsson) + +## 1.2.4 + +_2019-02-26_ + +### Bug Fixes + +- Fix an issue where a variable was imported twice under the same name (#2715) + +### Pull Requests + +- [#2715](https://github.com/rollup/rollup/pull/2715): Deduplicate imports referencing default exports and their original variables (@lukastaegert) + +## 1.2.3 + +_2019-02-23_ + +### Bug Fixes + +- Use correct path when rendering dynamic imports where the entry module is empty (#2714) + +### Pull Requests + +- [#2714](https://github.com/rollup/rollup/pull/2714): Properly render dynamic imports when imported module is empty (@lukastaegert) + +## 1.2.2 + +_2019-02-19_ + +### Bug Fixes + +- Fix wrong external imports when using the `paths` options only for some outputs (#2706) + +### Pull Requests + +- [#2706](https://github.com/rollup/rollup/pull/2706): Always recreate paths for external modules (@lukastaegert) + +## 1.2.1 + +_2019-02-17_ + +### Bug Fixes + +- Fix ESM version of Rollup (#2705) + +### Pull Requests + +- [#2705](https://github.com/rollup/rollup/pull/2705): Fix ESM version of Rollup (@lukastaegert) + +## 1.2.0 + +_2019-02-17_ + +### Features + +- Fewer renamed variables due to a completely reimplemented deconflicting logic (#2689) + +### Bug Fixes + +- Respect rendered and tree-shaken exports when determining chunk hashes (#2695) +- Fix an error when dynamic imports end up in the same chunk as one of their importees (#2677) +- Do not generate invalid code when expressions containing IIFEs are simplified (#2696) +- Do not throw an error when more than ten bundles are watched (#2700) +- Treat re-exported globals in a spec-compliant way (#2691) +- Fix issues related to wrongly renamed variables (#2689) +- Do not throw an error if config files contain non-default exports (#2673) +- Improve type of `RollupOutput.output` to guarantee at least one chunk (#2679) + +### Pull Requests + +- [#2673](https://github.com/rollup/rollup/pull/2673): Allow config files to have non-default exports (@swansontec) +- [#2677](https://github.com/rollup/rollup/pull/2677): Prevent final resolution and facade creation for inlined dynamic imports (@Rich-Harris and @lukastaegert) +- [#2679](https://github.com/rollup/rollup/pull/2679): Improve type of `RollupOutput.output` (@MattiasBuelens) +- [#2689](https://github.com/rollup/rollup/pull/2689): Reimplement variable deconflicting logic (@lukastaegert) +- [#2691](https://github.com/rollup/rollup/pull/2691): Fix CI issues and update acorn dependency (@lukastaegert) +- [#2693](https://github.com/rollup/rollup/pull/2693): Fix typo in export-globals test (@MattiasBuelens) +- [#2695](https://github.com/rollup/rollup/pull/2695): Respect rendered exports when generating chunk hashes (@lukastaegert) +- [#2696](https://github.com/rollup/rollup/pull/2696): Correctly render function expression inside simplified expression statements (@lukastaegert) +- [#2700](https://github.com/rollup/rollup/pull/2700): Add a fix for MaxListenersExceededWarning (@luwes) +- [#2703](https://github.com/rollup/rollup/pull/2703): Update rollup-pluginutils (@lukastaegert) + +## 1.1.2 + +_2019-01-21_ + +### Bug Fixes + +- Tree-shaken dynamic imports no longer leave behind `undefined` entries in the bundle information (#2663) +- Dynamic imports in dynamically imported files could lead to crashes and would not always create new chunks (#2664) + +### Pull Requests + +- [#2663](https://github.com/rollup/rollup/pull/2663): Do not include tree-shaken dynamic imports in bundle information (@lukastaegert) +- [#2664](https://github.com/rollup/rollup/pull/2664): Properly handle dynamic imports declared in dynamically imported files (@everdimension) + +## 1.1.1 + +_2019-01-19_ + +### Bug Fixes + +- Make sure object prototype methods are not considered to be falsy when tree-shaking (#2652) + +### Pull Requests + +- [#2652](https://github.com/rollup/rollup/pull/2652): Make sure object prototype methods are not considered to be falsy (@lukastaegert) +- [#2654](https://github.com/rollup/rollup/pull/2654): Use correct signature for `this.setAssetSource` in docs (@everdimension) +- [#2656](https://github.com/rollup/rollup/pull/2656): Swap descriptions for `[extname]` and `[ext]` in docs (@tivac) + +## 1.1.0 + +_2019-01-09_ + +### Features + +- Make `this.meta` available from the `options` plugin hook (#2642) +- Add a new `writeBundle` plugin hook that is called _after_ all files have been written (#2643) + +### Bug Fixes + +- Make sure the `acorn` import of the bundled non-ESM acorn plugins is correctly translated to ESM (#2636) +- Make sure input options are actually passed to the `buildStart` hook (#2642) + +### Pull Requests + +- [#2636](https://github.com/rollup/rollup/pull/2636): Improve how acorn is imported, update dependencies (@lukastaegert) +- [#2642](https://github.com/rollup/rollup/pull/2642): Make this.meta available in options hook, pass input options to buildStart (@lukastaegert) +- [#2643](https://github.com/rollup/rollup/pull/2643): Implement writeBundle hook (@lukastaegert) + +## 1.0.2 + +_2019-01-05_ + +### Bug Fixes + +- Make sure the transform hook is always reevaluated when a file watched by the hook changes (#2633) +- Fix a crash when generating hashes for tree-shaken dynamic imports (#2638) +- Fix a crash and some inconsistencies when using the acorn-bigint plugin (#2640) + +### Pull Requests + +- [#2633](https://github.com/rollup/rollup/pull/2633): Document `this.addWatchFile` and make sure it also declares transform dependencies (@lukastaegert) +- [#2635](https://github.com/rollup/rollup/pull/2635): Make sure `code` is optional in warning type (@lukastaegert) +- [#2638](https://github.com/rollup/rollup/pull/2638): Do not fail when generating hashes for tree-shaken dynamic imports (@lukastaegert) +- [#2640](https://github.com/rollup/rollup/pull/2640): Always treat bigints as unknown (@lukastaegert) +- [#2641](https://github.com/rollup/rollup/pull/2641): Make sure all CLI options are listed in the summary (@lukastaegert) + +## 1.0.1 + +_2019-01-03_ + +### Bug Fixes + +- Properly handle reexporting an external default export for non-ESM targets when using named exports mode (#2620) +- Do not (wrongly) re-declare input options in the merged `RollupOptions` type (#2622) + +### Pull Requests + +- [#2620](https://github.com/rollup/rollup/pull/2620): Fixed issue with reexporting default as default with `{exports: named, interop: true}` options (@Andarist) +- [#2622](https://github.com/rollup/rollup/pull/2622): Simplify RollupOptions (@Kinrany) +- [#2627](https://github.com/rollup/rollup/pull/2627): Show how to skip imports for optional plugins (@chris-morgan) + +## 1.0.0 + +_2018-12-28_ + +### Breaking Changes + +- Several (mostly deprecated) options have been removed or renamed (#2293, #2409): + - banner -> output.banner + - dest -> output.file + - entry -> input + - experimentalCodeSplitting -> now always active + - experimentalDynamicImport -> now always active + - experimentalPreserveModules -> preserveModules + - exports -> output.exports + - extend -> output.extend + - footer -> output.footer + - format -> output.format + - freeze -> output.freeze + - globals -> output.globals + - indent -> output.indent + - interop -> output.interop + - intro -> output.intro + - load -> use plugin API + - moduleName -> output.name + - name -> output.name + - noConflict -> output.noConflict + - output.moduleId -> output.amd.id + - outro -> output.outro + - paths -> output.paths + - preferConst -> output.preferConst + - pureExternalModules -> treeshake.pureExternalModules + - resolveExternal -> use plugin API + - resolveId -> use plugin API + - sourcemap -> output.sourcemap + - sourceMap -> output.sourcemap + - sourceMapFile -> output.sourcemapFile + - strict -> output.strict + - targets -> use output as an array + - transform -> use plugin API + - useStrict -> output.strict +- In general, output options can no longer be used as input options (#2409) +- `bundle.generate` and `bundle.write` now return a new format (#2293) +- Several plugin hooks have become deprecated and will display warnings when used (#2409): + - transformBundle + - transformChunk + - ongenerate + - onwrite +- Plugin transform dependencies are deprecated in favour of using the `this.addWatchFile` plugin context function (#2409) +- Accessing `this.watcher` in plugin hooks is deprecated in favour of the `watchChange` plugin hook and the `this.addWatchFile` plugin context function (#2409) +- Using dynamic import statements will by default create a new chunk unless `inlineDynamicImports` is used (#2293) +- Rollup now uses acorn@6 which means that acorn plugins must be compatible with this version; acorn is now external for non-browser builds to make plugins work (#2293) + +### Features + +- The `--dir` ClI option can now be aliased as `-d` (#2293) +- The `--input` option now supports named entry points via `=` (#2293) + +### Bug Fixes + +- Both the `--input` option as well as the default CLI option now support named inputs (#2293) + +### Pull Requests + +- [#2293](https://github.com/rollup/rollup/pull/2293): Unify code paths for 1.0 relase and update documentation (@guybedford and @lukastaegert) +- [#2409](https://github.com/rollup/rollup/pull/2409): Remove old deprecated features and add new deprecation warnings (@guybedford) +- [#2486](https://github.com/rollup/rollup/pull/2486): Upgrade to acorn 6 (@marijnh) +- [#2611](https://github.com/rollup/rollup/pull/2611): Fix hook's name in test description (@Andarist) +- [#2612](https://github.com/rollup/rollup/pull/2612): Fix a self-contradicting comment in the docs (@LongTengDao) + +## 0.68.2 + +_2018-12-23_ + +### Bug Fixes + +- Do not assume hoisted variables to have been initialized (#2607) + +### Pull Requests + +- [#2607](https://github.com/rollup/rollup/pull/2607): Fix an issues where hoisted variables were assumed to have been initialized (@lye) + +## 0.68.1 + +_2018-12-19_ + +### Bug Fixes + +- Fix an issue with UMD wrappers where a variable is used without being defined (#2600) + +### Pull Requests + +- [#2600](https://github.com/rollup/rollup/pull/2600): Fix UMD and IIFE wrapper issues and add comprehensive functional wrapper tests (@lukastaegert) + +## 0.68.0 + +_2018-12-16_ + +### Breaking Changes + +- `optimizeChunks` is renamed to `experimentalOptimizeChunks` to reflect this feature is not production-ready yet (#2575) + +### Features + +- Plugins can iterate all module ids via `this.moduleIds` (#2565) +- Plugins can get graph information about a module via `this.getModuleInfo(id)` (#2565) +- Plugins and JS API users get more information about the generated chunks: `dynamicImports`, `facadeModuleId`, `isDynamicEntry`, `name` (#2575) +- Tree-shaken dynamic imports will no longer create chunks or influence chunking in any way (#2575) +- Dynamic imports will no longer follow the `entryFileNames` but the `chunkFileNames` property reflecting those are solely internally used (#2575) +- If there are chunk naming conflicts, entry chunks will always take precedence (#2575) +- If an entry facade is created, only the facade chunk is marked as `isEntry` (#2575) +- Dynamic chunks will only be marked as `isEntry` if they are actually entry chunks as well; thus there is now a 1-to-1 correspondence between modules listed in `input` and chunks marked as `isEntry` (#2575) +- Chunks no longer contain imports for variables that are tree-shaken in the chunk but used in other chunks (#2584) +- Chunks will always import re-exported variables directly from the chunk where they are originally exported from (#2584) +- Null characters will be pruned from chunk ids to allow for virtually created chunks and make `rollup-plugin-multi-entry` compatible with code-splitting and thus the upcoming 1.0 version (#2590) +- Simplify the UMD wrapper code as much as possible, especially if there are no exports (#2594) +- The UMD wrapper will now work in strict mode by checking for `self` before `this` when determining the global variable (#2594) + +### Bug Fixes + +- If a facade is created for a dynamic entry point, this facade will be imported instead of the facaded chunk (#2575) +- Manual chunks that include multiple entry points will have proper facades created for all entry points if necessary (#2575) +- If missing exports are shimmed, the shim variable will not be global but created on a per-module basis and is deconflicted with variables having the same name (#2584) +- Missing export shims work properly in SystemJS (#2584) +- `preserveModules` now handles dynamic namespace imports (#2584) +- Fix chunk execution order in certain scenarios (#2584) +- Exports and assignments using destructuring syntax will properly update the exported variables when generating SystemJS output (#2587) +- Hashes in chunk names will now also take dynamic imports into account (#2596) + +### Pull Requests + +- [#2565](https://github.com/rollup/rollup/pull/2565): Provide module graph information on the plugin context (@samccone) +- [#2575](https://github.com/rollup/rollup/pull/2575): Extend bundle information, tree-shake dynamic imports, fix dynamic import facade creation, support manual chunks with multiple entry points, make `optimizeChunks` experimental (@lukastaegert) +- [#2577](https://github.com/rollup/rollup/pull/2577): Update dependencies (@lukastaegert) +- [#2584](https://github.com/rollup/rollup/pull/2584): Prune tree-shaken chunk imports, fix missing export shimming, support dynamic namespaces when preserving modules, improve chunk execution order (@lukastaegert) +- [#2587](https://github.com/rollup/rollup/pull/2587): Support exports using destructuring declarations and assignments in SystemJS (@lukastaegert) +- [#2590](https://github.com/rollup/rollup/pull/2590): Make sure chunk ids do not contain invalid characters to allow for chunks to correspond to virtual modules (@lukastaegert) +- [#2594](https://github.com/rollup/rollup/pull/2594): Simplify UMD wrapper code and make sure it works in strict mode (@lukastaegert) +- [#2596](https://github.com/rollup/rollup/pull/2596): Take both static and dynamic dependencies into account when calculating hashes (@lukastaegert) + +## 0.67.4 + +_2018-12-03_ + +### Bug Fixes + +- Prevent corrupt source maps for files with very long lines (#2571) + +### Pull Requests + +- [#2571](https://github.com/rollup/rollup/pull/2571): Fix an issue with long lines in sourcemaps (@mislav) + +## 0.67.3 + +_2018-11-17_ + +### Bug Fixes + +- Make sure the ESM browser build is actually published to npm (#2560) +- Throw proper error when using `inlineDynamicImports` with `experimentalPreserveModules` (#2560) + +### Pull Requests + +- [#2552](https://github.com/rollup/rollup/pull/2552): Properly include ESM browser build in package (@lukastaegert) +- [#2560](https://github.com/rollup/rollup/pull/2560): Show proper error when using `inlineDynamicImports` with `experimentalPreserveModules` (@clarkdo) + +## 0.67.2 + +_2018-11-17_ + +### Bug Fixes + +- Prevent crash when not returning sourcemaps from `renderChunk` plugin hook (#2558) + +### Pull Requests + +- [#2558](https://github.com/rollup/rollup/pull/2558): Prevent crash when not returning sourcemaps from `renderChunk` (@kyle1320) + +## 0.67.1 + +_2018-11-11_ + +### Bug Fixes + +- Deconflict CLI entry points with same name but on different paths if no explicit naming is used (#2548) + +### Pull Requests + +- [#2548](https://github.com/rollup/rollup/pull/2548): Deconflict CLI entry points with same name but on different paths if no explicit naming is used (@lukastaegert) + +## 0.67.0 + +_2018-11-04_ + +### Breaking Changes + +none + +### Features + +- Do not resolve external dynamic imports via plugins to match the logic for static external imports again (#2505) +- Support virtual modules created by plugins when preserving modules (#2511) +- Add new `output.sourcemapExcludeSources` option to exclude the actual sources from sourcemaps (#2531) + +### Bug Fixes + +- Fix TypeScript type for sourcemaps (#2507) +- Fix order of external and inter-chunk imports to match the proper execution order (#2508) +- Do not tree-shake children of unknown nodes to e.g. properly handle do-expressions via acorn plugin (#2510) +- Prevent memory leak when using the bundle as cache (#2522) +- Fix mis-placed semicolons for certain SystemJS exports (#2529) + +### Pull Requests + +- [#2505](https://github.com/rollup/rollup/pull/2505): Do not resolve external dynamic imports via plugins (@lukastaegert) +- [#2507](https://github.com/rollup/rollup/pull/2507): Fix public sourcemap type (@aMarCruz) +- [#2508](https://github.com/rollup/rollup/pull/2508): Improve execution order of chunks and externals (@lukastaegert) +- [#2510](https://github.com/rollup/rollup/pull/2510): Do not tree-shake children of unknown nodes to e.g. properly handle do-expressions via acorn plugin (@devsnek) +- [#2511](https://github.com/rollup/rollup/pull/2511): Create chunks for virtual modules when preserving modules (@lukastaegert) +- [#2522](https://github.com/rollup/rollup/pull/2522): Prevent memory leak when using the bundle as cache (@kyle1320) +- [#2529](https://github.com/rollup/rollup/pull/2529): Fix mis-placed semicolons for certain SystemJS exports (@kyle1320) +- [#2531](https://github.com/rollup/rollup/pull/2531): add `sourcemapExcludeSources` option to exclude the source content from sourcemaps (@kitsonk) + +## 0.66.6 + +_2018-10-10_ + +- Properly deconflict function and class declaration ids of reassigned default exports ([#2502](https://github.com/rollup/rollup/pull/2502)) + +## 0.66.5 + +_2018-10-09_ + +- Remove cache from memory once no longer needed ([#2496](https://github.com/rollup/rollup/pull/2496)) +- Provide better error message when reexporting external namespace reexports ([#2499](https://github.com/rollup/rollup/pull/2499)) + +## 0.66.4 + +_2018-10-04_ + +- Fix links in warnings and errors ([#2471](https://github.com/rollup/rollup/pull/2471)) + +## 0.66.3 + +_2018-10-03_ + +- Detect side-effects in string.replace function arguments ([#2476](https://github.com/rollup/rollup/pull/2476)) +- Make sure chunk ids are assigned before creating output bundle ([#2483](https://github.com/rollup/rollup/pull/2483)) +- Use proper plugin name in error ([#2470](https://github.com/rollup/rollup/pull/2470)) +- Update TypeScript version and fix type errors ([#2488](https://github.com/rollup/rollup/pull/2488)) + +## 0.66.2 + +_2018-09-21_ + +- Add additional information to parse errors messages in JSON and other non-JS files ([#2466](https://github.com/rollup/rollup/pull/2466)) + +## 0.66.1 + +_2018-09-19_ + +- Ignore falsy plugins ([#2464](https://github.com/rollup/rollup/pull/2464)) +- Switch back to official TypeScript plugin ([#2465](https://github.com/rollup/rollup/pull/2465)) + +## 0.66.0 + +_2018-09-16_ + +- Support ES2019 optional catch bindings ([#2455](https://github.com/rollup/rollup/pull/2455)) +- Add option to transform paths within sourcemaps ([#2430](https://github.com/rollup/rollup/pull/2430)) +- Add renderStart and renderEnd plugin hooks ([#2438](https://github.com/rollup/rollup/pull/2438)) +- Expose ESM browser build and minify browser builds ([#2437](https://github.com/rollup/rollup/pull/2437) +- Associate hoisted variables in function bodys with function parameters ([#2456](https://github.com/rollup/rollup/pull/2456)) +- Fix issue when deconflicting variables used as pattern defaults ([#2446](https://github.com/rollup/rollup/pull/2446)) +- Properly deconflict default exported class and function expressions with ids ([#2458](https://github.com/rollup/rollup/pull/2458)) +- Faster internal test builds ([#2457](https://github.com/rollup/rollup/pull/2457)) +- Switch to rollup-plugin-typescript2 ([#2460](https://github.com/rollup/rollup/pull/2460)) +- Fix internal "perf" script ([#2433](https://github.com/rollup/rollup/pull/2433)) +- Test that errors are passed to the buildEnd hook ([#2450](https://github.com/rollup/rollup/pull/2450)) + +## 0.65.2 + +_2018-09-05_ + +- Prevent watch mode memory leak ([#2441](https://github.com/rollup/rollup/pull/2441)) + +## 0.65.1 + +_2018-09-05_ + +- Prevent globbing when using chokidar ([#2432](https://github.com/rollup/rollup/pull/2432)) + +## 0.65.0 + +_2018-08-25_ + +- Refactor and unify plugin system ([#2382](https://github.com/rollup/rollup/pull/2382)) +- Implement plugin cache API ([#2389](https://github.com/rollup/rollup/pull/2389)) +- Add watchChange plugin hook to watch changed files, deprecate asset dependencies ([#2405](https://github.com/rollup/rollup/pull/2405)) +- Refine asset handling ([#2369](https://github.com/rollup/rollup/pull/2369)) +- Implement `renderChunk` hook to replace `transformChunk` and `transformBundle` hooks ([#2406](https://github.com/rollup/rollup/pull/2406)) +- Add rollup version to plugin context ([#2394](https://github.com/rollup/rollup/pull/2394)) +- Do not resume stdin in watch mode to fix it for Lerna users ([#2410](https://github.com/rollup/rollup/pull/2410)) +- Allow `[format]` placeholder for id generation ([#2387](https://github.com/rollup/rollup/pull/2387)) +- Always log error stacks even when a code frame is given ([#2417](https://github.com/rollup/rollup/pull/2417)) +- Do not test module ids starting with `\0` as external ([#2400](https://github.com/rollup/rollup/pull/2400)) +- Fix tracing of namespace variables ([#2408](https://github.com/rollup/rollup/pull/2408)) +- Fix re-tracing of namespace variables ([#2420](https://github.com/rollup/rollup/pull/2420)) +- Properly wrap comment annotations in SystemJS exports ([#2408](https://github.com/rollup/rollup/pull/2408)) +- Fix renaming of destructured parameters ([#2419](https://github.com/rollup/rollup/pull/2419)) +- Do not display version in watch mode when using `--silent` ([#2392](https://github.com/rollup/rollup/pull/2392)) +- Make `cacheExpiry` an experimental option for now ([#2401](https://github.com/rollup/rollup/pull/2401)) +- Lint test configs on commit ([#2402](https://github.com/rollup/rollup/pull/2402)) +- Add code of conduct ([#2388](https://github.com/rollup/rollup/pull/2388)) +- Move to CircleCI ([#2390](https://github.com/rollup/rollup/pull/2390)) +- Update pull request template ([#2404](https://github.com/rollup/rollup/pull/2404)) + +## 0.64.1 + +_2018-08-07_ + +- Do not render initializers of hoisted variables in dead branches ([#2384](https://github.com/rollup/rollup/pull/2384)) + +## 0.64.0 + +_2018-08-07_ + +- Print memory consumption together with performance timings ([#2370](https://github.com/rollup/rollup/pull/2370)) +- Enable plugins to mark imports as external by returning false for resolveId ([#2351](https://github.com/rollup/rollup/pull/2351)) +- Always retain empty manual chunks ([#2362](https://github.com/rollup/rollup/pull/2362)) +- Ensure CLI warnings are shown on errors and add error for external id collisions ([#2334](https://github.com/rollup/rollup/pull/2334)) +- Remove unnecessary dependency, update dependencies, fix linting of test config ([#2376](https://github.com/rollup/rollup/pull/2376)) +- Add targeted Github issue templates ([#2356](https://github.com/rollup/rollup/pull/2356)) + +## 0.63.5 + +_2018-08-01_ + +- Ensure onwrite plugin hooks execute in sequence ([#2364](https://github.com/rollup/rollup/pull/2364)) +- Always warn when no name is provided for a global module ([#2359](https://github.com/rollup/rollup/pull/2359)) +- Add utility type for user created plugins ([#2355](https://github.com/rollup/rollup/pull/2355)) +- Remove deprecated es6 format from types ([#2349](https://github.com/rollup/rollup/pull/2349)) +- Mark inlineDynamicImports as optional in types ([#2348](https://github.com/rollup/rollup/pull/2348)) + +## 0.63.4 + +_2018-07-20_ + +- Use turbocolor instead of chalk ([#2339](https://github.com/rollup/rollup/pull/2339)) + +## 0.63.3 + +_2018-07-20_ + +- Handle expressions where "in" and "instanceof" are applied to primitive values ([#2344](https://github.com/rollup/rollup/pull/2344)) + +## 0.63.2 + +_2018-07-18_ + +- Fix bind order in for-of loops ([#2338](https://github.com/rollup/rollup/pull/2338)) + +## 0.63.1 + +_2018-07-18_ + +## 0.63.0 + +_2018-07-17_ + +- Fix many tree-shaking related issues ([#2315](https://github.com/rollup/rollup/pull/2315)) +- Add experimental support for top-level await ([#2235](https://github.com/rollup/rollup/pull/2235)) +- Prevent duplicate version printout in watch mode ([#2325](https://github.com/rollup/rollup/pull/2325)) +- Respect error frames provided by plugins ([#2309](https://github.com/rollup/rollup/pull/2309)) +- Add `esm` format alias to types ([#2327](https://github.com/rollup/rollup/pull/2327)) +- Further unify internal test setup ([#2329](https://github.com/rollup/rollup/pull/2329)) + +## 0.62.0 + +_2018-06-27_ + +- Add option to automatically shim missing exports ([#2118](https://github.com/rollup/rollup/pull/2118)) +- Inline dynamic imports that are also imported statically and only used in a single chunk ([#2295](https://github.com/rollup/rollup/pull/2295)) +- Handle caching and invalidation of assets ([#2267](https://github.com/rollup/rollup/pull/2267)) +- Fix plugin related types ([#2299](https://github.com/rollup/rollup/pull/2299)) + +## 0.61.2 + +_2018-06-23_ + +- Improve watcher error handling, only rebuild invalidated outputs ([#2296](https://github.com/rollup/rollup/pull/2296)) +- Update dependencies, make watcher more stable ([#2297](https://github.com/rollup/rollup/pull/2297)) + +## 0.61.1 + +_2018-06-21_ + +- Do not try to deconflict "undefined" ([#2291](https://github.com/rollup/rollup/pull/2291)) +- Properly track values for loop interator declarations and reassigned namespaces, add smoke test ([#2292](https://github.com/rollup/rollup/pull/2292)) + +## 0.61.0 + +_2018-06-20_ + +- Declare file dependencies via transform plugin hooks ([#2259](https://github.com/rollup/rollup/pull/2259)) +- Handle undefined values when evaluating conditionals ([#2264](https://github.com/rollup/rollup/pull/2264)) +- Handle known undefined properties when evaluating conditionals ([#2265](https://github.com/rollup/rollup/pull/2265)) +- Access watch events via the plugin context ([#2261](https://github.com/rollup/rollup/pull/2261)) +- Add option to suppress `__esModule` flag in output ([#2287](https://github.com/rollup/rollup/pull/2287)) +- Fix issue when re-declaring variables, track reassignments in more cases ([#2279](https://github.com/rollup/rollup/pull/2279)) +- Add VSCode debug settings ([#2276](https://github.com/rollup/rollup/pull/2276)) + +## 0.60.7 + +_2018-06-14_ + +- Fix typing issue ([#2269](https://github.com/rollup/rollup/pull/2269)) + +## 0.60.6 + +_2018-06-14_ + +- Track mutations of included virtual arrays ([#2263](https://github.com/rollup/rollup/pull/2263)) +- Update readme ([#2266](https://github.com/rollup/rollup/pull/2266)) + +## 0.60.5 + +_2018-06-14_ + +- Track deep reassignments of global and exported variables and improve performance ([#2254](https://github.com/rollup/rollup/pull/2254)) + +## 0.60.4 + +_2018-06-13_ + +- Properly handle initially uninitialized exports and exports of globals in SystemJS output ([#2258](https://github.com/rollup/rollup/pull/2258)) + +## 0.60.3 + +_2018-06-13_ + +- Fix types to allow watching an array of outputs ([#2262](https://github.com/rollup/rollup/pull/2262)) + +## 0.60.2 + +_2018-06-11_ + +- Permit setting an asset's source in `generateBundle` ([#2256](https://github.com/rollup/rollup/pull/2256)) +- Add automatic linting ([#2242](https://github.com/rollup/rollup/pull/2242)) + +## 0.60.1 + +_2018-06-07_ + +- Fix plugin regressions ([#2246](https://github.com/rollup/rollup/pull/2246)) +- Avoid conflicts for large numbers of variables ([#2244](https://github.com/rollup/rollup/pull/2244)) + +## 0.60.0 + +_2018-06-06_ + +- New plugin hooks: transformChunk, buildStart, buildEnd; extended plugin context with warn, error, resolveId, isExternal, emitAsset, setAssetSource and getAssetFileName available to any hook ([#2208](https://github.com/rollup/rollup/pull/2208)) +- [BREAKING] Deprecate the `legacy` option and thus IE8 support ([#2141](https://github.com/rollup/rollup/pull/2141)) +- Detect more known extensions and load .mjs without extension ([#2211](https://github.com/rollup/rollup/pull/2211)) +- Add compact output mode ([#2151](https://github.com/rollup/rollup/pull/2151)) +- Significantly improve sourcemap generation performance ([#2228](https://github.com/rollup/rollup/pull/2228)) +- Enable naming SystemJS modules ([#2028](https://github.com/rollup/rollup/pull/2028)) +- Do not use alternate screen if clearScreen is set in watch mode ([#2125](https://github.com/rollup/rollup/pull/2125)) +- Allow object input form for code-splitting in watch mode ([#2217](https://github.com/rollup/rollup/pull/2217)) +- Track reassignments of methods of exports from outside ([#2240](https://github.com/rollup/rollup/pull/2240)) +- Preserve id of default exported functions and classes ([#2234](https://github.com/rollup/rollup/pull/2234)) +- Add semicolons after default exports ([#2209](https://github.com/rollup/rollup/pull/2209)) +- Fix build problems on Windows ([#2232](https://github.com/rollup/rollup/pull/2232)) +- Display install size in readme ([#2196](https://github.com/rollup/rollup/pull/2196)) +- Improve preserve modules test ([#2236](https://github.com/rollup/rollup/pull/2236)) + +## 0.59.4 + +_2018-05-28_ + +- Fix performance regression when many return statements are used ([#2218](https://github.com/rollup/rollup/pull/2218)) + +## 0.59.3 + +_2018-05-24_ + +- Fix reassignment tracking for constructor parameters ([#2214](https://github.com/rollup/rollup/pull/2214)) + +## 0.59.2 + +_2018-05-21_ + +- Fix reassignment tracking in for-in loops ([#2205](https://github.com/rollup/rollup/pull/2205)) + +## 0.59.1 + +_2018-05-16_ + +- Fix infinite recursion when determining literal values of circular structures ([#2193](https://github.com/rollup/rollup/pull/2193)) +- Fix invalid code when simplifying expressions without spaces ([#2194](https://github.com/rollup/rollup/pull/2194)) + +## 0.59.0 + +_2018-05-15_ + +- Tree-shake statically analysable dynamic conditionals ([#2167](https://github.com/rollup/rollup/pull/2167)) +- Do not emit empty chunks when code-splitting or empty files when preserving modules ([#2128](https://github.com/rollup/rollup/pull/2128)) +- Support `import.meta.url` ([#2164](https://github.com/rollup/rollup/pull/2164)) +- Add `esm` format alias ([#2102](https://github.com/rollup/rollup/pull/2102)) +- Use alphanumeric base64 characters when deconflicting variables ([#2188](https://github.com/rollup/rollup/pull/2188)) +- Improve handling of external modules imported as both default and named imports ([#2136](https://github.com/rollup/rollup/pull/2136)) +- Properly deconflict named imports from other chunks ([#2177](https://github.com/rollup/rollup/pull/2177)) +- Fix an issue with namespaces containing reexports ([#2157](https://github.com/rollup/rollup/pull/2157)) +- Fix an issue with with incorrectly mapped default exports when code-splitting CJS or AMD modules ([#2178](https://github.com/rollup/rollup/pull/2178)) +- Fix an issue with wrong paths of relative external imports ([#2160](https://github.com/rollup/rollup/pull/2160)) +- Fix an issue when using default exports and `interop: false` ([#2149](https://github.com/rollup/rollup/pull/2149)) +- Fix in issue with invalid syntax in SystemJS output ([#2187](https://github.com/rollup/rollup/pull/2187)) +- Fix an issue when tree-shaking call expressions and reassigned variables ([#2186](https://github.com/rollup/rollup/pull/2186)) +- Fix file paths in source maps ([#2161](https://github.com/rollup/rollup/pull/2161)) +- Fix wrong file name in error message ([#2137](https://github.com/rollup/rollup/pull/2137)) +- Always use npm 5 on CI ([#2185](https://github.com/rollup/rollup/pull/2185)) + +## 0.58.2 + +_2018-04-23_ + +- Fix rendering of certain statically resolvable if statements ([#2146](https://github.com/rollup/rollup/pull/2146)) + +## 0.58.1 + +_2018-04-18_ + +- Fix comment detection ([#2129](https://github.com/rollup/rollup/pull/2129)) + +## 0.58.0 + +_2018-04-16_ + +- Support individual chunk names with optional content hashes ([#2068](https://github.com/rollup/rollup/pull/2068)) +- Support manually created chunks ([#2084](https://github.com/rollup/rollup/pull/2084)) +- Automatically import deep dependencies when code splitting for better performance ([#2073](https://github.com/rollup/rollup/pull/2073)) +- Automatically minify internal export/import names for esm and system output ([#2087](https://github.com/rollup/rollup/pull/2087)) +- Add option to automatically merge small chunks ([#2090](https://github.com/rollup/rollup/pull/2090)) +- Significantly improve tree-shaking performance ([#2119](https://github.com/rollup/rollup/pull/2119)) +- Enable tree-shaking for logical expressions ([#2098](https://github.com/rollup/rollup/pull/2098)) +- Rework external types and reduce type related dependencies ([#2108](https://github.com/rollup/rollup/pull/2108)) +- Support parallel dependency resolution ([#2116](https://github.com/rollup/rollup/pull/2116)) +- Improve deprecation handling ([#2076](https://github.com/rollup/rollup/pull/2076)) +- Enable `--perf` timings in watch mode ([#2065](https://github.com/rollup/rollup/pull/2065)) +- Improve performance timers ([#2111](https://github.com/rollup/rollup/pull/2111)) +- Improve error handling for plugins ([#2100](https://github.com/rollup/rollup/pull/2100)) +- Improve error when using `--dir` in a single file build ([#2123](https://github.com/rollup/rollup/pull/2123)) +- Do not warn for external imports that are unused due to tree-shaking ([#2124](https://github.com/rollup/rollup/pull/2124)) +- Update mixed export warning message ([#2107](https://github.com/rollup/rollup/pull/2107)) +- Remove duplicate badges from readme ([#2083](https://github.com/rollup/rollup/pull/2083)) +- Update readme examples ([#2086](https://github.com/rollup/rollup/pull/2086)) + +## 0.57.1 + +_2018-03-17_ + +- Improve sourcemap generation performance ([#2062](https://github.com/rollup/rollup/pull/2062)) +- Add reserved config option namespace and improve CLI interface ([#2063](https://github.com/rollup/rollup/pull/2063)) +- Fix issue with default exported function and class expressions ([#2059](https://github.com/rollup/rollup/pull/2059)) +- Replace `forEach` with faster `for` loops in some places ([#2064](https://github.com/rollup/rollup/pull/2064)) + +## 0.57.0 + +_2018-03-15_ + +- Add option to preserve the module structure instead of bundling ([#1922](https://github.com/rollup/rollup/pull/1922)) +- Enable watch mode when code-splitting ([#2035](https://github.com/rollup/rollup/pull/2035)) +- Optionally pass CLI commands to config file ([#1926](https://github.com/rollup/rollup/pull/1926)) +- Option to add correct `.toString` tags to namespaces ([#2041](https://github.com/rollup/rollup/pull/2041)) +- Option and scripts to display performance timings ([#2045](https://github.com/rollup/rollup/pull/2045)) +- Fixes for exported or early accessed namespaces + improved namespace indentation ([#2041](https://github.com/rollup/rollup/pull/2041)) +- Include missing TypeScript dependencies ([#1965](https://github.com/rollup/rollup/pull/1965)) +- Add #\_PURE annotation to frozen namespaces ([#2044](https://github.com/rollup/rollup/pull/2044)) +- Improve sourcemap and tree-shaking performance ([#2052](https://github.com/rollup/rollup/pull/2052)) +- Inline sourcemap lookups and make rollup smaller ([#2055](https://github.com/rollup/rollup/pull/2055)) +- Use updated magic-string types ([#2057](https://github.com/rollup/rollup/pull/2057)) +- [BREAKING] Revert class id preservation from #2025 ([#2048](https://github.com/rollup/rollup/pull/2048)) +- [BREAKING] Refactor missing export plugin hook ([#1987](https://github.com/rollup/rollup/pull/1987)) + +## 0.56.5 + +_2018-03-07_ + +- Preserve ids when deconflicting classes ([#2025](https://github.com/rollup/rollup/pull/2025)) +- Fix an issue with re-exported namespace imports ([#2034](https://github.com/rollup/rollup/pull/2034)) +- Prevent an infinite loop when binding member expressions ([#1963](https://github.com/rollup/rollup/pull/1963)) +- Convert code style via prettier ([#2031](https://github.com/rollup/rollup/pull/2031)) +- Fix links in documentation ([#2026](https://github.com/rollup/rollup/pull/2026)) + +## 0.56.4 + +_2018-03-05_ + +- Make rollup builds reproducible ([#2024](https://github.com/rollup/rollup/pull/2024)) +- Improve error handling for source maps ([#2012](https://github.com/rollup/rollup/pull/2012)) +- Properly handle SystemJS default exports without semicolons ([#2019](https://github.com/rollup/rollup/pull/2019)) +- Properly handle importing the same variable several times when code-splitting ([#2020](https://github.com/rollup/rollup/pull/2020)) +- Improve re-export tracing ([#2021](https://github.com/rollup/rollup/pull/2021)) +- Apply "prettier" on commit ([#2017](https://github.com/rollup/rollup/pull/2017)) +- Automatically clean up outdated tests ([#2009](https://github.com/rollup/rollup/pull/2009)) +- Add SystemJS output to form tests ([#2022](https://github.com/rollup/rollup/pull/2022)) +- Improve internal build configuration ([#2016](https://github.com/rollup/rollup/pull/2016)) + +## 0.56.3 + +_2018-02-25_ + +- Fix issues around default exports and module facades ([#2001](https://github.com/rollup/rollup/pull/2001)) +- Improve and fix internal chunk interface ([#1994](https://github.com/rollup/rollup/pull/1994)) +- Fix superfluous semicolons added after declarations ([#1999](https://github.com/rollup/rollup/pull/1999)) +- Improve code-splitting tests ([#1990](https://github.com/rollup/rollup/pull/1990)) + +## 0.56.2 + +_2018-02-19_ + +- Fix handling of reassigned default exports ([#1975](https://github.com/rollup/rollup/pull/1975)) +- Fix handling of renamed exports in entry points ([#1977](https://github.com/rollup/rollup/pull/1977)) +- Update internal TypeScript version ([#1980](https://github.com/rollup/rollup/pull/1980)) +- Omit compiled source files from published types ([#1981](https://github.com/rollup/rollup/pull/1981)) +- Fix example in readme file ([#1984](https://github.com/rollup/rollup/pull/1984)) +- Fix non-replaced dynamic imports in non-ESM output ([#1985](https://github.com/rollup/rollup/pull/1985)) + +## 0.56.1 + +_2018-02-16_ + +- Fix regression when rendering switch statements ([#1971](https://github.com/rollup/rollup/pull/1971)) + +## 0.56.0 + +_2018-02-15_ + +- Update to ECMAScript 2018 ([#1953](https://github.com/rollup/rollup/pull/1953)) +- Rework tree-shaking rendering algorithm ([#1949](https://github.com/rollup/rollup/pull/1949)) +- Tree-shake pure prototype calls on literals ([#1916](https://github.com/rollup/rollup/pull/1916)) +- Expose AST parser to plugins ([#1945](https://github.com/rollup/rollup/pull/1945)) +- Fix namespace re-export deconflicting ([#1960](https://github.com/rollup/rollup/pull/1960)) +- Allow globals to be re-exported ([#1959](https://github.com/rollup/rollup/pull/1959)) +- Fix internal performance timers ([#1966](https://github.com/rollup/rollup/pull/1966)) + +## 0.55.5 + +_2018-02-10_ + +- Remove OpenCollective dependency ([#1915](https://github.com/rollup/rollup/pull/1915)) + +## 0.55.4 + +_2018-02-09_ + +- Improve name deconflicting of external variables ([#1930](https://github.com/rollup/rollup/pull/1930)) +- Improve re-export handling ([#1947](https://github.com/rollup/rollup/pull/1947)) +- Mark preserveSymlinks option as optional ([#1939](https://github.com/rollup/rollup/pull/1939)) +- Enable code-splitting tests to check directory structures ([#1924](https://github.com/rollup/rollup/pull/1924)) +- Improve TypeScript definition test ([#1954](https://github.com/rollup/rollup/pull/1954)) + +## 0.55.3 + +_2018-02-01_ + +- Remove OpenCollective dependency ([#1915](https://github.com/rollup/rollup/pull/1915)) + +## 0.55.2 + +_2018-02-01_ + +- Add option to not follow symlinks ([#1819](https://github.com/rollup/rollup/pull/1819)) +- Fix crash in windows shell ([#1928](https://github.com/rollup/rollup/pull/1928)) +- Fix and test for external TypeScript errors ([#1903](https://github.com/rollup/rollup/pull/1903)) +- Activate OpenCollective ([#1915](https://github.com/rollup/rollup/pull/1915)) +- Optimize CI scripts ([#1921](https://github.com/rollup/rollup/pull/1921)) + +## 0.55.1 + +_2018-01-26_ + +- Improve dynamic import workflow ([#1907](https://github.com/rollup/rollup/pull/1907)) +- Properly handle multiple dynamic imports of the same module ([#1911](https://github.com/rollup/rollup/pull/1911)) +- Fix import specifier deshadowing ([#1912](https://github.com/rollup/rollup/pull/1912)) +- Allow plugin load hook to return an empty string ([#1908](https://github.com/rollup/rollup/pull/1908)) +- Let onwarn handler accept strings ([#1905](https://github.com/rollup/rollup/pull/1905)) + +## 0.55.0 + +_2018-01-23_ + +- Support code splitting ([#1841](https://github.com/rollup/rollup/pull/1841)) +- Support SystemJS as output format ([#1897](https://github.com/rollup/rollup/pull/1897)) +- Allow injecting acorn plugins ([#1857](https://github.com/rollup/rollup/pull/1857)) +- Add `missingExport` plugin hook ([#1845](https://github.com/rollup/rollup/pull/1845)) +- No longer parse config files via bublé ([#1899](https://github.com/rollup/rollup/pull/1899)) +- Use externally maintained dynamic import acorn plugin ([#1891](https://github.com/rollup/rollup/pull/1891)) +- Fix an error message ([#1886](https://github.com/rollup/rollup/pull/1886)) +- Refactor internal rendering options ([#1900](https://github.com/rollup/rollup/pull/1900)) +- Extract internal path resolution ([#1879](https://github.com/rollup/rollup/pull/1879)) +- Extract internal bundle option handling ([#1880](https://github.com/rollup/rollup/pull/1880)) +- Add import description type ([#1884](https://github.com/rollup/rollup/pull/1884)) +- Clean up watch options types ([#1860](https://github.com/rollup/rollup/pull/1860)) +- Clean up some tests ([#1888](https://github.com/rollup/rollup/pull/1888)) + +## 0.54.1 + +_2018-01-17_ + +- Fix TypeScript errors in emitted type definitions ([#1871](https://github.com/rollup/rollup/pull/1871)) + +## 0.54.0 + +_2018-01-12_ + +- Automatically inline locally resolvable dynamic imports ([#1816](https://github.com/rollup/rollup/pull/1816)) +- Preserve directives in function bodies ([#1856](https://github.com/rollup/rollup/pull/1856)) +- Refactor an error notification ([#1846](https://github.com/rollup/rollup/pull/1846)) +- Refactor a wrong import ([#1863](https://github.com/rollup/rollup/pull/1863)) +- Improve emitted TypeScript definitions ([#1864](https://github.com/rollup/rollup/pull/1864)) +- Refactor unused import ([#1866](https://github.com/rollup/rollup/pull/1866)) + +## 0.53.4 + +_2018-01-10_ + +- More type cleanup ([#1858](https://github.com/rollup/rollup/pull/1858)) +- Use chalks internal helper to detect if colors should be used ([#1853](https://github.com/rollup/rollup/pull/1853)) +- Refactor entity handling to use interfaces ([#1840](https://github.com/rollup/rollup/pull/1840)) +- Use immutable.js internal types ([#1844](https://github.com/rollup/rollup/pull/1844)) +- Ship `TypeScript` declaration files ([#1837](https://github.com/rollup/rollup/pull/1837)) + +## 0.53.3 + +_2018-01-02_ + +- Use correct name when re-exporting from external modules ([#1794](https://github.com/rollup/rollup/pull/1794)) +- Disable warnings when `resolveId` returns false ([#1825](https://github.com/rollup/rollup/pull/1825)) + +## 0.53.2 + +_2017-12-30_ + +- Properly handle output arrays in the JavaScript API ([#1827](https://github.com/rollup/rollup/pull/1827)) + +## 0.53.1 + +_2017-12-28_ + +- Properly deprecate more config options ([#1812](https://github.com/rollup/rollup/pull/1812)) +- Pass output options to `transformBundle` plugin hook ([#1813](https://github.com/rollup/rollup/pull/1813)) + +## 0.53.0 + +_2017-12-22_ + +- Experimental dynamic import support ([#1790](https://github.com/rollup/rollup/pull/1790)) +- Unify config validation ([#1805](https://github.com/rollup/rollup/pull/1805)) + +## 0.52.3 + +_2017-12-19_ + +- Properly hoist default exported functions in more situations ([#1799](https://github.com/rollup/rollup/pull/1799)) +- Allow plugin transformations to not overwrite source maps by returning null ([#1797](https://github.com/rollup/rollup/pull/1797)) +- Provide more parameters to "external" handler ([#1792](https://github.com/rollup/rollup/pull/1792)) + +## 0.52.2 + +_2017-12-15_ + +- No longer ignore side-effects in JSON.parse and JSON.stringify ([#1785](https://github.com/rollup/rollup/pull/1785)) +- Updated links in warnings ([#1776](https://github.com/rollup/rollup/pull/1776)) +- No longer prevent self-imports ([#1777](https://github.com/rollup/rollup/pull/1777)) +- Properly hoist default exported functions ([#1787](https://github.com/rollup/rollup/pull/1787)) +- Prevent corruption when re-exporting default exports ([#1765](https://github.com/rollup/rollup/pull/1765)) + +## 0.52.1 + +_2017-12-05_ + +- Improve deprecation warnings ([#1765](https://github.com/rollup/rollup/pull/1765)) +- Properly use stdin ([#1774](https://github.com/rollup/rollup/pull/1774)) +- Let --environment be used multiple times ([#1768](https://github.com/rollup/rollup/pull/1768)) +- Always transpile config files ([#1759](https://github.com/rollup/rollup/pull/1759)) +- Respect globals option in headers of UMD and IIFE files ([#1747](https://github.com/rollup/rollup/pull/1747)) + +## 0.52.0 + +_2017-11-25_ + +- Accept config as promise ([#1731](https://github.com/rollup/rollup/pull/1731)) +- Accept promises for intro/outro/banner/footer ([#1253](https://github.com/rollup/rollup/pull/1253)) +- Option to prevent freezing of namespace imports ([#1696](https://github.com/rollup/rollup/pull/1696)) +- Option to retain all output in watch mode ([#1688](https://github.com/rollup/rollup/pull/1688)) +- Options to fine-tune treeshaking ([#1760](https://github.com/rollup/rollup/pull/1760)) + +## 0.51.8 + +_2017-11-19_ + +- Fix speed problems by simplifying treeshaking reassignment handling ([#1740](https://github.com/rollup/rollup/pull/1740)) +- Update dependencies ([#1742](https://github.com/rollup/rollup/pull/1742)) + +## 0.51.7 + +_2017-11-17_ + +- Keep "this"-context when calling sequence expressions ([#1724](https://github.com/rollup/rollup/pull/1724)) + +## 0.51.6 + +_2017-11-16_ + +- Use sourcemaps to determine error locations ([#1728](https://github.com/rollup/rollup/pull/1728)) + +## 0.51.5 + +_2017-11-11_ + +- Fix regressions with uninitialised conditional expressions ([#1720](https://github.com/rollup/rollup/pull/1720)) + +## 0.51.4 + +_2017-11-11_ + +- Fix regressions preventing builds ([#1725](https://github.com/rollup/rollup/pull/1725)) + +## 0.51.3 + +_2017-11-10_ + +- Fix regression when treeshaking sequence expressions ([#1717](https://github.com/rollup/rollup/pull/1717)) + +## 0.51.2 + +_2017-11-09_ + +- Fix treeshaking regression when labels are used inside functions ([#1712](https://github.com/rollup/rollup/pull/1712)) + +## 0.51.1 + +_2017-11-08_ + +- Fix an issue with empty return statements ([#1704](https://github.com/rollup/rollup/pull/1704)) + +## 0.51.0 + +_2017-11-08_ + +- Massive improvements to the treeshaking algorithm ([#1667](https://github.com/rollup/rollup/pull/1667)) + +## 0.50.1 + +_2017-11-08_ + +- Fix treeshaking regression ([#1695](https://github.com/rollup/rollup/pull/1695)) +- Treeshaking improvements ([#1650](https://github.com/rollup/rollup/pull/1650)) +- Enable installation from Github ([#1670](https://github.com/rollup/rollup/pull/1670)) +- Update documentation ([#1660](https://github.com/rollup/rollup/pull/1660)) + +## 0.50.0 + +_2017-09-16_ + +- Many treeshaking improvements ([#1624](https://github.com/rollup/rollup/pull/1624)) +- Show finish time in watch mode ([#1620](https://github.com/rollup/rollup/pull/1620)) + +## 0.49.3 + +_2017-09-08_ + +- Respect `watch` options ([#1596](https://github.com/rollup/rollup/issues/1596)) +- Fix treeshaking regressions ([#1604](https://github.com/rollup/rollup/pull/1604)) +- Allow `-o` to work with `output.format` ([#1606](https://github.com/rollup/rollup/pull/1606)) + +## 0.49.2 + +_2017-08-29_ + +- Fix treeshaking regressions ([#1591](https://github.com/rollup/rollup/pull/1591)) + +## 0.49.1 + +_2017-08-28_ + +- Fix treeshaking regressions ([#1586](https://github.com/rollup/rollup/pull/1586)) + +## 0.49.0 + +_2017-08-27_ + +- Completely update the treeshaking algorithm ([#1582](https://github.com/rollup/rollup/pull/1582)) +- Only flip screen buffer if appropriate ([#1574](https://github.com/rollup/rollup/pull/1574)) +- Guard against two instances creating the same dir ([#1576](https://github.com/rollup/rollup/pull/1576)) + +## 0.48.2 + +- Paths is an output option ([#1569](https://github.com/rollup/rollup/pull/1569)) + +## 0.48.1 + +- Print deprecation warnings in watch mode, and fix options when watcher restarts ([#1568](https://github.com/rollup/rollup/pull/1568)) + +## 0.48.0 + +- Numerous changes to the `options` object and CLI arguments ([#1479](https://github.com/rollup/rollup/issues/1479)). See [this gist](https://gist.github.com/Rich-Harris/d472c50732dab03efeb37472b08a3f32) for a rundown. + +## 0.47.6 + +- Set `process.env.ROLLUP_WATCH` _before_ loading config file + +## 0.47.5 + +- Fix broken multi-bundle configs with `rollup.watch` ([#1532](https://github.com/rollup/rollup/issues/1532)) + +## 0.47.4 + +- Delete cached config file before reloading in watch mode + +## 0.47.3 + +- Deshadow aliased imports ([#1550](https://github.com/rollup/rollup/issues/1550)) + +## 0.47.2 + +- Rebuild with dependency that npm randomly deleted + +## 0.47.1 + +- Ignore external namespace imports when deshadowing ([#1547](https://github.com/rollup/rollup/issues/1547)) + +## 0.47.0 + +- Watch config file, restart `rollup.watch` on change ([#1535](https://github.com/rollup/rollup/issues/1535)) +- Correctly render `export { foo } from` declarations in `es` output ([#1543](https://github.com/rollup/rollup/pull/1543)) +- Reinstate missing `rollup.VERSION` + +## 0.46.3 + +- init for/for-of loop section head with correct scopes ([#1538](https://github.com/rollup/rollup/issues/1538), [#1539](https://github.com/rollup/rollup/issues/1539)) +- Fix namespace imports and re-exports in `es` output ([#1511](https://github.com/rollup/rollup/issues/1511)) +- Deshadow indirectly imported namespaces ([#1488](https://github.com/rollup/rollup/issues/1488), [#1505](https://github.com/rollup/rollup/issues/1505)) + +## 0.46.2 + +- Pass options to `bundle.write` correctly in `rollup.watch` ([#1533](https://github.com/rollup/rollup/issues/1533)) +- init for-in loop section head with correct scopes ([#1480](https://github.com/rollup/rollup/issues/1480)) +- support `--no-interop` flag ([#1524](https://github.com/rollup/rollup/issues/1524)) + +## 0.46.1 + +- Remove `rollup.watch` from browser build ([#1530](https://github.com/rollup/rollup/issues/1530)) +- Remove `source-map-support` dependency ([#1528](https://github.com/rollup/rollup/issues/1528)) + +## 0.46.0 + +- `options.format` is now required ([#1491](https://github.com/rollup/rollup/pull/1491)) +- if `options.format` is `es6`, it will now throw an error (should be `es`) ([#1491](https://github.com/rollup/rollup/pull/1491)) +- Add experimental `rollup.watch` method, replacing [rollup-watch](https://github.com/rollup/rollup-watch) ([#1491](https://github.com/rollup/rollup/pull/1491)) +- Batch warnings together in CLI output ([#1491](https://github.com/rollup/rollup/pull/1491)) +- Clear screen between rebuilds in `--watch` mode ([#1491](https://github.com/rollup/rollup/pull/1491)) +- `onwarn` function's second argument is the default handler, allowing easier filtering without reimplementing any logic ([#1491](https://github.com/rollup/rollup/pull/1491)) +- Prevent semi-colon removal after variable declaration that is for loop body ([#1275](https://github.com/rollup/rollup/issues/1275)) +- Return `exports` for namespaced but non-extended IIFE bundles ([#1492](https://github.com/rollup/rollup/issues/1492)) +- Fix scoping in switch statements ([#1498](https://github.com/rollup/rollup/pull/1498)) +- Handle side-effects in tagged template expressions ([#1508](https://github.com/rollup/rollup/pull/1508)) +- More descriptive error for missing options.format ([#1510](https://github.com/rollup/rollup/pull/1510)) +- Refactor scope handling ([#1517](https://github.com/rollup/rollup/pull/1517)) +- Handle failure of a config in multi-config build ([#1513](https://github.com/rollup/rollup/issues/1513)) + +## 0.45.2 + +- Fix interop when import is a string ([#1486](https://github.com/rollup/rollup/issues/1486)) +- Separate `resolvedIds` from `resolvedExternalIds` ([#1490](https://github.com/rollup/rollup/pull/1490)) +- Add `--extend` flag to CLI ([#1482](https://github.com/rollup/rollup/pull/1482)) + +## 0.45.1 + +- Remove `weak` from `optionalDependencies` ([#1483](https://github.com/rollup/rollup/issues/1483)) + +## 0.45.0 + +- [BREAKING] `bundle.generate(...)` returns a Promise, so that `transformBundle` plugin hooks can be asynchronous ([#1474](https://github.com/rollup/rollup/issues/1474)) + +## 0.44.0 + +- [BREAKING] Don't extend existing globals, unless `options.extend` is true ([#827](https://github.com/rollup/rollup/issues/827)) +- Fix handling of catch clause parameters ([#1462](https://github.com/rollup/rollup/issues/1462)) + +## 0.43.1 + +- Fix memory leak on incremental rebuilds ([#883](https://github.com/rollup/rollup/issues/883)) +- Allow `this.warn` and `this.error` to accept a `{line, column}` object as an alternative to a character index ([#1265](https://github.com/rollup/rollup/issues/1265)) +- Print more useful error if entry module is 'external' ([#1264](https://github.com/rollup/rollup/issues/1264)) +- Catch errors in `bundle.generate` options ([#1463](https://github.com/rollup/rollup/pull/1463)) +- Fix magic-string deprecation warning ([#1445](https://github.com/rollup/rollup/pull/1445)) + +## 0.43.0 + +- Allow config files to import JSON ([#1426](https://github.com/rollup/rollup/issues/1426)) +- Allow undefined imports in interop block ([#1341](https://github.com/rollup/rollup/issues/1341)) +- Add `process.env.ROLLUP_WATCH = 'true'` in watch mode ([#1429](https://github.com/rollup/rollup/issues/1429)) +- Add `pureExternalModules` option ([#1352](https://github.com/rollup/rollup/issues/1352)) +- Allow plugins to specify `options.entry` ([#1270](https://github.com/rollup/rollup/issues/1270)) +- Update dependencies + +## 0.42.0 + +- Deprecate `options.moduleId` in favour of `options.amd.id` ([#1365](https://github.com/rollup/rollup/pull/1365)) +- Add `options.amd.define` option to specify name of AMD `define` function ([#1365](https://github.com/rollup/rollup/pull/1365)) +- Fix incorrect class removal with `treeshake: false` ([#1375](https://github.com/rollup/rollup/pull/1375)) +- Deconflict module exports imported as namespaces ([#1384](https://github.com/rollup/rollup/issues/1384)) +- Handle bare self-imports ([#1274](https://github.com/rollup/rollup/issues/1274)) +- Allow config file to export an array of multiple configs ([#1389](https://github.com/rollup/rollup/pull/1389)) +- Handle exponentiation operator, and fail gracefully on unknown operators ([#1416](https://github.com/rollup/rollup/issues/1416)) +- Add `watch` option ([#1424](https://github.com/rollup/rollup/pull/1424)) + +## 0.41.6 + +- Preserve `originalSourceMap` on incremental rebuilds for loaders with sourcemaps ([#1336](https://github.com/rollup/rollup/issues/1336)) + +## 0.41.5 + +- Wrap ternary consequent/alternate sequences in parens ([#1273](https://github.com/rollup/rollup/issues/1273)) +- Fix erroneous warning on multiple `export * from` declarations with defaults ([#1278](https://github.com/rollup/rollup/issues/1278)) +- Prevent variable conflicts with `treeshake: false` ([#1268](https://github.com/rollup/rollup/issues/1268)) +- Allow missing `source` when collapsing sourcemaps ([#1254](https://github.com/rollup/rollup/issues/1254)) +- Allow plugins to log with strings ([#1316](https://github.com/rollup/rollup/pull/1316)) + +## 0.41.4 + +- Fix cases of multiple `export * from 'external'` declarations ([#1252](https://github.com/rollup/rollup/issues/1252)) +- Fix 'TODO' error message ([#1257](https://github.com/rollup/rollup/issues/1257)) + +## 0.41.3 + +- Don't treat `this.foo` as possible namespace ([#1258](https://github.com/rollup/rollup/issues/1258)) + +## 0.41.2 + +- Optimize `namespace['foo']` references ([#1240](https://github.com/rollup/rollup/pull/1240)) + +## 0.41.1 + +- Include `new` expressions where callee is a class with side-effects ([#980](https://github.com/rollup/rollup/issues/980) [#1233](https://github.com/rollup/rollup/issues/1233)) + +## 0.41.0 + +- Add `this.warn(...)` and `this.error(...)` methods to plugin `transform` hook contexts ([#1140](https://github.com/rollup/rollup/issues/1140)) +- `throw` always considered to be a side effect ([#1227](https://github.com/rollup/rollup/pull/1227)) + +## 0.40.2 + +- Add `file` property to sourcemaps for bundles with plugins ([#986](https://github.com/rollup/rollup/issues/986)) +- Don't require globals for empty imports ([#1217](https://github.com/rollup/rollup/issues/1217)) + +## 0.40.1 + +- Allow missing space between `export default` and declaration ([#1218](https://github.com/rollup/rollup/pull/1218)) + +## 0.40.0 + +- [BREAKING] Better, more consistent error logging ([#1212](https://github.com/rollup/rollup/pull/1212)) +- Don't use colours and emojis for non-TTY stderr ([#1201](https://github.com/rollup/rollup/issues/1201)) + +## 0.39.2 + +- Prevent mutation of cached ASTs (fixes stack overflow with rollup-watch) ([#1205](https://github.com/rollup/rollup/pull/1205)) + +## 0.39.1 + +- Ignore `var` initialisers in dead branches ([#1198](https://github.com/rollup/rollup/issues/1198)) + +## 0.39.0 + +- [BREAKING] Warnings are objects, rather than strings ([#1194](https://github.com/rollup/rollup/issues/1194)) + +## 0.38.3 + +- More informative warning for implicit external dependencies ([#1051](https://github.com/rollup/rollup/issues/1051)) +- Warn when creating browser bundle with external dependencies on Node built-ins ([#1051](https://github.com/rollup/rollup/issues/1051)) +- Statically analyse LogicalExpression nodes, for better dead code removal ([#1061](https://github.com/rollup/rollup/issues/1061)) + +## 0.38.2 + +- Preserve `var` declarations in dead branches ([#997](https://github.com/rollup/rollup/issues/997)) +- Warn if exporting a call expression that looks like a function declaration ([#1011](https://github.com/rollup/rollup/issues/1011)) +- Wrap function expressions in parentheses if necessary ([#1011](https://github.com/rollup/rollup/issues/1011)) + +## 0.38.1 + +- Fix sourcemap comment removal ([#1104](https://github.com/rollup/rollup/issues/1104)) +- Warn if empty bundle is generated ([#444](https://github.com/rollup/rollup/issues/444)) +- Support ES2017 syntax ([#492](https://github.com/rollup/rollup/issues/492)) +- Remove unused imports from external modules ([#595](https://github.com/rollup/rollup/issues/595)) +- Remove unused function and class declarations inside function bodies ([#1108](https://github.com/rollup/rollup/issues/1108), [#1178](https://github.com/rollup/rollup/issues/1178)) +- Deconflict function expression IDs ([#1176](https://github.com/rollup/rollup/issues/1176)) + +## 0.38.0 + +- [BREAKING] `export { foo as default }` creates live binding ([#1078](https://github.com/rollup/rollup/issues/1078)) +- Prevent sourceMappingURL removal edge case ([#988](https://github.com/rollup/rollup/issues/988)) +- Bind function expression IDs to the correct scope ([#1083](https://github.com/rollup/rollup/issues/1083)) +- Correctly deshadow destructured parameters with assignments ([#1008](https://github.com/rollup/rollup/issues/1008)) + +## 0.37.2 + +- Remove unused `new` expressions without side-effects ([#179](https://github.com/rollup/rollup/issues/179)) +- Only remove valid sourceMappingURL comments ([#1132](https://github.com/rollup/rollup/issues/1132)) +- Ensure blocks containing activated `var` declarations are included in output ([#1113](https://github.com/rollup/rollup/issues/1113)) +- Support plugin outros ([#1116](https://github.com/rollup/rollup/issues/1116)) + +## 0.37.1 + +- Follow symlinks ([#447](https://github.com/rollup/rollup/issues/447)) +- Fix tree-shaking of recursive functions and other cases ([#1120](https://github.com/rollup/rollup/issues/1120), [#1142](https://github.com/rollup/rollup/issues/1142)) +- Support module names that require quotes ([#582](https://github.com/rollup/rollup/issues/582), [#584](https://github.com/rollup/rollup/issues/584)) +- Fix [#957](https://github.com/rollup/rollup/issues/957) + +## 0.37.0 + +- [BREAKING] Default exports are not included in reified namespaces ([#1028](https://github.com/rollup/rollup/issues/1028)) +- Parentheses do not defeat tree-shaking ([#1101](https://github.com/rollup/rollup/issues/1101), [#1128](https://github.com/rollup/rollup/issues/1128)) +- More `legacy` fixes: do not create getters ([#1069](https://github.com/rollup/rollup/pull/1069)), do not include `__esModule` ([#1068](https://github.com/rollup/rollup/pull/1068)), quote reserved property names ([#1057](https://github.com/rollup/rollup/pull/1057)) +- Fix missing namespace member warnings ([#1045](https://github.com/rollup/rollup/issues/1045)) +- Fix TypeError in arrow function without braces returning a function ([#1062](https://github.com/rollup/rollup/pull/1062)) + +## 0.36.4 + +- Only depend on program-level call expressions ([#977](https://github.com/rollup/rollup/issues/977)) + +## 0.36.3 + +- Add `legacy` option for IE8 support ([#989](https://github.com/rollup/rollup/pull/989)) + +## 0.36.2 + +- Insert semicolons where necessary to fix broken code ([#1004](https://github.com/rollup/rollup/issues/1004)) +- Include module ID and location when warning about top-level `this` ([#1012](https://github.com/rollup/rollup/pull/1012)) +- More informative error for missing exports ([#1033](https://github.com/rollup/rollup/issues/1033)) +- `options.moduleContext` for per-module context overrides ([#1023](https://github.com/rollup/rollup/pull/1023)) + +## 0.36.1 + +- Include naked block statements ([#981](https://github.com/rollup/rollup/issues/981)) +- Correctly include falsy alternate statements in optimised if blocks ([#973](https://github.com/rollup/rollup/issues/973)) +- Prevent omission of default exports that are only used by the exporting module ([#967](https://github.com/rollup/rollup/pull/967)) +- Prevent warning on `auto` exports with ES output ([#966](https://github.com/rollup/rollup/pull/966)) + +## 0.36.0 + +- `export { foo as default }` no longer creates a live binding ([#860](https://github.com/rollup/rollup/issues/860)) + +## 0.35.15 + +- Warn on missing unused imports in deshadowing phase ([#928](https://github.com/rollup/rollup/issues/928)) +- Always add a newline to the end of bundles ([#958](https://github.com/rollup/rollup/issues/958)) + +## 0.35.14 + +- Include all parent statements of expression with effects, up to function boundary ([#930](https://github.com/rollup/rollup/issues/930)) + +## 0.35.13 + +- Include superclasses when including their subclasses ([#932](https://github.com/rollup/rollup/issues/932)) + +## 0.35.12 + +- Add `interop: false` option to disable unwrapping of external imports ([#939](https://github.com/rollup/rollup/issues/939)) + +## 0.35.11 + +- Deconflict reified namespaces with other declarations ([#910](https://github.com/rollup/rollup/issues/910)) + +## 0.35.10 + +- Only remove EmptyStatement nodes directly inside blocks ([#913](https://github.com/rollup/rollup/issues/931)) + +## 0.35.9 + +- Support Node 0.12 ([#909](https://github.com/rollup/rollup/issues/909)) + +## 0.35.8 + +- Correctly deshadow re-assigned module functions ([#910](https://github.com/rollup/rollup/issues/910)) + +## 0.35.7 + +- Refactor `flushTime.js` ([#922](https://github.com/rollup/rollup/pull/922)) + +## 0.35.6 + +- Fix browser build + +## 0.35.5 + +- Allow empty for loop heads ([#919](https://github.com/rollup/rollup/issues/919)) + +## 0.35.4 + +- Preserve effects in for-of and for-in loops ([#870](https://github.com/rollup/rollup/issues/870)) +- Remove empty statements ([#918](https://github.com/rollup/rollup/pull/918)) + +## 0.35.3 + +- Render identifiers inside template literals + +## 0.35.2 + +- Fix broken build caused by out of date locally installed dependencies + +## 0.35.1 + +- Rewrite deconflicted class identifiers ([#915](https://github.com/rollup/rollup/pull/915)) +- Include `dependencies` in `bundle.modules` objects ([#903](https://github.com/rollup/rollup/issues/903)) +- Update to Acorn 4 ([#914](https://github.com/rollup/rollup/pull/914)) + +## 0.35.0 + +- Rewrite analysis/tree-shaking code ([#902](https://github.com/rollup/rollup/pull/902)) +- Include conditional mutations of global objects ([#901](https://github.com/rollup/rollup/issues/901)) +- Only reify namespaces if necessary ([#898](https://github.com/rollup/rollup/issues/898)) +- Track mutations of aliased globals ([#893](https://github.com/rollup/rollup/issues/893)) +- Include duplicated var declarations ([#716](https://github.com/rollup/rollup/issues/716)) + +## 0.34.13 + +- Pass `{ format }` through to `transformBundle` ([#867](https://github.com/rollup/rollup/issues/867)) + +## 0.34.12 + +- Fix `rollup --watch` ([#887](https://github.com/rollup/rollup/issues/887)) +- Case-sensitive paths ([#862](https://github.com/rollup/rollup/issues/862)) + +## 0.34.11 + +- Prevent leaky state when `bundle` is reused ([#875](https://github.com/rollup/rollup/issues/875)) +- Ensure `intro` appears before interop block ([#880](https://github.com/rollup/rollup/issues/880)) + +## 0.34.10 + +- Allow custom `options.context` to replace top-level `this` ([#851](https://github.com/rollup/rollup/issues/851)) +- Fix `noConflict` when used via `rollup --config` ([#846](https://github.com/rollup/rollup/issues/846)) +- Place `outro` block _after_ export block ([#852](https://github.com/rollup/rollup/issues/852)) + +## 0.34.9 + +- Disable indentation by default, for faster bundle generation ([#812](https://github.com/rollup/rollup/pull/812)) +- More helpful error on missing entry file ([#802](https://github.com/rollup/rollup/issues/802)) +- Preserve comments before import declarations ([#815](https://github.com/rollup/rollup/pull/815)) + +## 0.34.8 + +- Wrap UMD factory function in parens to avoid lazy parsing ([#774](https://github.com/rollup/rollup/pull/774)) + +## 0.34.7 + +- Leave it up to resolveId to normalize the entry path ([#835](https://github.com/rollup/rollup/pull/835)) +- Cache decoded mappings ([#834](https://github.com/rollup/rollup/pull/834)) + +## 0.34.5 + +- Fix circular export ([#813](https://github.com/rollup/rollup/issues/813)) + +## 0.34.4 + +- Module render performance tweak ([#823](https://github.com/rollup/rollup/pull/823)) + +## 0.34.3 + +- Avoid infinite recursion in `Bundle.sort()` ([#800](https://github.com/rollup/rollup/pull/800)) + +## 0.34.2 + +- resolveId calls are cached now to improve incremental build +- Fixed error message recursion in plugins + +## 0.34.1 + +- Support `paths` config ([#754](https://github.com/rollup/rollup/issues/754)) +- Allow `export *` from external module, internally + +## 0.34.0 + +- Use resolved IDs for relative imports that are also external modules, to allow `options.globals` to work with them ([#763](https://github.com/rollup/rollup/issues/763)) +- Ensure reassigned exports are declared in an ES bundle, and remove empty `exports.foo;` statements ([#755](https://github.com/rollup/rollup/issues/755)) +- Add newline after sourcemap comment ([#756](https://github.com/rollup/rollup/issues/756)) + +## 0.33.2 + +- Add `bundle` as second argument to `ongenerate` and `onwrite` hooks ([#773](https://github.com/rollup/rollup/pull/773)) +- Warn on top-level `this` ([#770](https://github.com/rollup/rollup/issues/770)) + +## 0.33.1 + +- Fix `--no-strict` option ([#751](https://github.com/rollup/rollup/pull/751)) +- Fix Windows edge case with case-sensitive paths ([#760](https://github.com/rollup/rollup/pull/760)) + +## 0.33.0 + +- Downgrade missing transformer sourcemap to a warning, not an error, and print the name of the offending plugin if possible ([#746](https://github.com/rollup/rollup/issues/746)) +- Warn if same name is re-exported from two modules ([#722](https://github.com/rollup/rollup/issues/722)) + +## 0.32.4 + +- Add `ongenerate` and `onwrite` plugin hooks ([#742](https://github.com/rollup/rollup/pull/742)) + +## 0.32.3 + +- Generated correct sourcemaps with reified namespaces ([#668](https://github.com/rollup/rollup/issues/668)) +- Exclude plugin helper modules from sourcemaps ([#747](https://github.com/rollup/rollup/pull/747)) + +## 0.32.2 + +- Allow `--globals` to work with `--external` or `options.external` in whatever configuration ([#743](https://github.com/rollup/rollup/issues/743)) + +## 0.32.1 + +- Preserve side-effects to default exports that coincide with used named exports ([#733](https://github.com/rollup/rollup/issues/733)) +- Support `rollup -c node:pkgname` ([#736](https://github.com/rollup/rollup/issues/736)) + +## 0.32.0 + +- Deprecate `es6` format in favour of `es` ([#468](https://github.com/rollup/rollup/issues/468)) +- Add correct `jsnext:main` build ([#726](https://github.com/rollup/rollup/pull/726)) + +## 0.31.2 + +- Allow `load` plugins to provide sourcemap ([#715](https://github.com/rollup/rollup/pull/715)) +- Allow `sourceMapFile` in config options ([#717](https://github.com/rollup/rollup/issues/717)) + +## 0.31.1 + +- Logging for errors emitted by `rollup-watch` ([#712](https://github.com/rollup/rollup/issues/712)) + +## 0.31.0 + +- Rewrite top-level `this` as `undefined` ([#707](https://github.com/rollup/rollup/pull/707)) +- Pass `options.acorn` to Acorn ([#564](https://github.com/rollup/rollup/issues/564)) + +## 0.30.0 + +- Bundle CLI ([#700](https://github.com/rollup/rollup/issues/700)) +- Ensure absolute paths are normalised ([#704](https://github.com/rollup/rollup/issues/704)) +- Allow `rollup --watch` to work with targets + +## 0.29.1 + +- Merge `target` options with main options ([#701](https://github.com/rollup/rollup/issues/701)) +- Update magic-string ([#690](https://github.com/rollup/rollup/issues/690)) + +## 0.29.0 + +- `rollup --watch` ([#284](https://github.com/rollup/rollup/issues/284)) + +## 0.28.0 + +- Experimental support for incremental rebuilds ([#658](https://github.com/rollup/rollup/pull/658)) + +## 0.27.1 + +- Ensure names exported from a module are not replaced with reserved words ([#696](https://github.com/rollup/rollup/pull/696)) +- Revert ([#692](https://github.com/rollup/rollup/pull/692)) – resolved IDs must be strings + +## 0.27.0 + +- Use native promises instead of `es6-promise` ([#689](https://github.com/rollup/rollup/issues/689)) +- Support multiple targets in config files ([#655](https://github.com/rollup/rollup/issues/655)) +- Allow `resolveId` plugin functions to return non-strings ([#692](https://github.com/rollup/rollup/pull/692)) + +## 0.26.7 + +- Distinguish between default and namespace imports of external module ([#637](https://github.com/rollup/rollup/issues/637)) +- Add `__esModule` property to named exports in AMD, CJS and UMD modes ([#650](https://github.com/rollup/rollup/issues/650)) + +## 0.26.6 + +- Deconflict named imports from external modules in ES bundles ([#659](https://github.com/rollup/rollup/issues/659)) +- Support `options.preferConst` to generate `const` declarations for exports rather than `var` declarations ([#653](https://github.com/rollup/rollup/issues/653)) + +## 0.26.5 + +- Preserve `debugger` statements ([#664](https://github.com/rollup/rollup/issues/664)) +- Allow `options.external` to be a function ([#522](https://github.com/rollup/rollup/issues/522)) + +## 0.26.4 + +- Prevent plugin-provided external IDs being normalised ([#630](https://github.com/rollup/rollup/issues/630), [#633](https://github.com/rollup/rollup/issues/633)) +- Throw if module exports/re-exports the same name twice, or has multiple default exports ([#679](https://github.com/rollup/rollup/issues/679)) +- Warn about `eval` security issue ([#675](<(https://github.com/rollup/rollup/issues/675)>)) + +## 0.26.3 + +- Ensure reference is not incorrectly marked as a reassignment ([#648](https://github.com/rollup/rollup/issues/648)) + +## 0.26.2 + +- Sanity check output of `load` hook ([#607](https://github.com/rollup/rollup/issues/607)) +- Correct scoping for ID class expressions ([#626](https://github.com/rollup/rollup/issues/626)) +- Warn if named and default exports are used together in auto mode ([#587](https://github.com/rollup/rollup/issues/587)) +- Allow variable initialisers to be rewritten if necessary ([#632](https://github.com/rollup/rollup/issues/632)) +- Prevent double `var` with no-treeshake option ([#639](https://github.com/rollup/rollup/pull/639)) + +## 0.26.1 + +- Add `treeshake: false`/`--no-treeshake` option for debugging ([#505](https://github.com/rollup/rollup/issues/505)) +- Update build process to use Bublé ([#620](https://github.com/rollup/rollup/pull/620)) + +## 0.26.0 + +- Add `noConflict`/`--no-conflict` option for UMD builds ([#580](https://github.com/rollup/rollup/pull/580)) +- Normalise relative external paths ([#591](https://github.com/rollup/rollup/pull/591)) +- Report files causing transform errors ([#609](https://github.com/rollup/rollup/pull/609)) +- Handle sourcemap segments with a single member ([#619](https://github.com/rollup/rollup/pull/619)) +- Update dependencies + +## 0.25.8 + +- Unixize entry path ([#586](https://github.com/rollup/rollup/pull/586)) + +## 0.25.7 + +- Expand deshadowed shorthand properties ([#575](https://github.com/rollup/rollup/issues/575)) +- Allow external files to be non-existent ([#532](https://github.com/rollup/rollup/issues/532)) + +## 0.25.6 + +- Fix a regression introduced by #566 ([#569](https://github.com/rollup/rollup/issues/569)) +- Prune dead conditional expressions more carefully ([#567](https://github.com/rollup/rollup/issues/567)) + +## 0.25.5 + +- Make sure shorthand destructuring assignments don't break ([#528](https://github.com/rollup/rollup/issues/528)) +- Allow 'exports' key ([#542](https://github.com/rollup/rollup/issues/542)) +- Ensure `foo. bar` where `foo` is a namespace import is rewritten correctly ([#566](https://github.com/rollup/rollup/issues/566)) +- Fix an edge case for exported globals (e.g. `export { document }`) ([#562](https://github.com/rollup/rollup/issues/562)) + +## 0.25.4 + +- Fix misnamed exports of default imports in ES bundles ([#513](https://github.com/rollup/rollup/issues/513)) +- CLI: warn on missing config ([#515](https://github.com/rollup/rollup/pull/515)) +- Detect side-effects in non-top-level member expression assignment ([#476](https://github.com/rollup/rollup/issues/476)) +- Don't remove computed property class keys ([#504](https://github.com/rollup/rollup/issues/504)) +- Augment existing global object rather than replacing ([#493](https://github.com/rollup/rollup/issues/493)) +- Don't fail on `export {}`, warn instead ([#486](https://github.com/rollup/rollup/issues/486)) + +## 0.25.3 + +- Handle non-objects and `null` in `_interopDefault` ([#474](https://github.com/rollup/rollup/issues/474)) + +## 0.25.2 + +- Skip dead branches of a conditional expression (#[465](https://github.com/rollup/rollup/pull/465)) +- Allow globals to be exported ([#472](https://github.com/rollup/rollup/pull/472)) +- Ensure reassigned exports are exported ([#484](https://github.com/rollup/rollup/issues/484)) + +## 0.25.1 + +- Throw error if namespace is called ([#446](https://github.com/rollup/rollup/issues/446)) +- Prevent shadowing bug in ES6 output ([#441](https://github.com/rollup/rollup/pull/441)) +- Prevent `var exports.foo` ([#426](https://github.com/rollup/rollup/issues/426)) +- Prevent double export of aliased symbols ([#438](https://github.com/rollup/rollup/issues/438)) +- Provide more informative error if Rollup is used in-browser without appropriate `resolveId`/`load` hooks ([#275](https://github.com/rollup/rollup/issues/275)) +- Use `_interopDefault` function to DRY out code with many external dependencies, in CommonJS output ([#458](https://github.com/rollup/rollup/pull/458)) + +## 0.25.0 + +- **breaking** Module order is determined according to spec, rather than in a way designed to prevent runtime errors. Rollup will warn if it detects runtime errors are likely ([#435](https://github.com/rollup/rollup/issues/435)) +- Prevent overly aggressive tree-shaking with complex call expressions ([#440](https://github.com/rollup/rollup/issues/440)) + +## 0.24.1 + +- Handle calls to default exports other that are not function expressions or references to function declarations ([#421](https://github.com/rollup/rollup/issues/421)) +- Ensure namespace blocks are created for chained imports ([#430](https://github.com/rollup/rollup/issues/430)) +- Include references in computed property keys ([#434](https://github.com/rollup/rollup/issues/434)) +- Use CLI `--external` option correctly ([#417](https://github.com/rollup/rollup/pull/417)) +- Allow relative imports to be treated as external, if absolute paths are provided in `options.external` ([#410](https://github.com/rollup/rollup/issues/410)) +- Make IIFE output adhere to Crockford style ([#415](https://github.com/rollup/rollup/pull/415)) + +## 0.24.0 + +- No longer attempts to resolve IDs in `options.external` ([#407](https://github.com/rollup/rollup/issues/407)) +- Fix broken sourcemap resolution in cases where some modules are transformed and others aren't ([#404](https://github.com/rollup/rollup/issues/404)) + +## 0.23.2 + +- Ensure `dest` or `sourceMapFile` is resolved against CWD for purposes of sourcemap generation ([#344](https://github.com/rollup/rollup/issues/344)) +- Support `banner`, `footer`, `intro` and `outro` options via CLI ([#330](https://github.com/rollup/rollup/issues/330)) +- Allow `options.global` to be a function rather than an object, and warn on missing names ([#293](https://github.com/rollup/rollup/issues/293)) +- Ensure side-effects are captured in cyclical call expressions ([#397](https://github.com/rollup/rollup/issues/397)) +- Fix parse error with body-less arrow function expressions ([#403](https://github.com/rollup/rollup/issues/403)) + +## 0.23.1 + +- Reinstate missing fix from ([#392](https://github.com/rollup/rollup/pull/392)) + +## 0.23.0 + +- Add `bundleTransform` plugin hook and option ([#387](https://github.com/rollup/rollup/pull/387)) +- Correctly store names in sourcemaps, regardless of transformers +- Add `--environment` option to CLI ([#388](https://github.com/rollup/rollup/pull/388)) +- Handle destructuring in exports ([#374](https://github.com/rollup/rollup/issues/374)) +- Fix UMD global exports bug introduced in 0.22.1 ([#392](https://github.com/rollup/rollup/pull/392)) + +## 0.22.2 + +- Prevent lost `var` keywords ([#390](https://github.com/rollup/rollup/issues/390)) + +## 0.22.1 + +- Update expected option keys ([#379](https://github.com/rollup/rollup/issues/379)) +- Handle transformers that return stringified sourcemaps ([#377](https://github.com/rollup/rollup/issues/377)) +- Automatically create missing namespaces if `moduleName` contains dots ([#378](https://github.com/rollup/rollup/issues/378)) +- Ignore external dependency warnings coming from config file ([#333](https://github.com/rollup/rollup/issues/333)) +- Update to latest magic-string for performance boost + +## 0.22.0 + +- Duplicate warnings are squelched ([#362](https://github.com/rollup/rollup/issues/362)) +- Plugins can manipulate or override the `options` object ([#371](https://github.com/rollup/rollup/pull/371)) + +## 0.21.3 + +- Validate option keys ([#348](https://github.com/rollup/rollup/pull/348)) +- Allow namespaces imports to sit alongside named imports ([#355](https://github.com/rollup/rollup/issues/355)) +- Count references inside destructured objects ([#364](https://github.com/rollup/rollup/issues/364)) +- Preserve top-level `delete` statements ([#352](https://github.com/rollup/rollup/issues/352)) + +## 0.21.2 + +- Missing relative imports are an error, not a warning ([#321](https://github.com/rollup/rollup/issues/321)) +- Fixed incorrectly renamed default exports in ES6 bundles ([#339](https://github.com/rollup/rollup/issues/339)) +- Fixed infinite recursion bug ([#341](https://github.com/rollup/rollup/issues/341)) + +## 0.21.1 + +- Remove `aggressive: true` (was too aggressive) ([#309](https://github.com/rollup/rollup/pull/309)) +- Handle top-level block statements ([#326](https://github.com/rollup/rollup/issues/326)) +- Optimise namespaces with default exports ([#314](https://github.com/rollup/rollup/issues/314)) + +## 0.21.0 + +- Only include statements whose side-effects are relevant (i.e. contribute to exports or affect global state) ([#253](https://github.com/rollup/rollup/pull/253)) ([#253](https://github.com/rollup/rollup/pull/253)) +- Exclude dead branches from analysis and inclusion ([#249](https://github.com/rollup/rollup/pull/249)) +- Add `aggressive: true` option to eliminate all side-effects outside entry module +- More informative error when re-exporting non-existent binding ([#274](https://github.com/rollup/rollup/issues/274)) +- Fix infinite recursion bug ([#291](https://github.com/rollup/rollup/issues/291)) +- Log errors when using `rollup --config` ([#288](https://github.com/rollup/rollup/pull/288)) +- Return rejected promises on startup instead of throwing error, if options are invalid ([#303](https://github.com/rollup/rollup/pull/303)) + +## 0.20.5 + +- Ensure re-exports don't create a local binding ([#270](https://github.com/rollup/rollup/pull/270)) + +## 0.20.4 + +- Check file exists at resolve time, to allow filenames with non-extension dots in them ([#250](https://github.com/rollup/rollup/pull/250)) +- Import `Promise` where used, for Node 0.10 support ([#254](https://github.com/rollup/rollup/issues/254)) +- Allow asynchronous transformer plugins ([#260](https://github.com/rollup/rollup/issues/260)) +- Don't assume re-exported bindings are globals when deconflicting ([#267](https://github.com/rollup/rollup/issues/267)) + +## 0.20.3 + +- Fix bug where multiple `export *` declarations caused error ([#244](https://github.com/rollup/rollup/pulls/244)) +- Missing namespace exports are a warning, not an error ([#244](https://github.com/rollup/rollup/pulls/244)) +- Plugins can provide `banner` and `footer` options (string, or function that returns a string) ([#235](https://github.com/rollup/rollup/issues/235)) +- Warn on encountering `eval` ([#186](https://github.com/rollup/rollup/issues/186)) + +## 0.20.2 + +- Handle errors in build config file +- More robust deconflicting, in cases where e.g. `foo$1` already exists +- Use Rollup CLI for own build process + +## 0.20.1 + +- Support `--config` file to enable plugins with CLI ([#226](https://github.com/rollup/rollup/pulls/226)) +- Prevent `default` being used as variable name ([#215](https://github.com/rollup/rollup/issues/215)) +- Update deps + +## 0.20.0 + +- Support for [plugins](https://github.com/rollup/rollup/wiki/Plugins) ([#207](https://github.com/rollup/rollup/pulls/207)) +- BREAKING – `options.transform`, `options.load`, `options.resolveId`, `options.resolveExternal` and `options.external` are no longer supported, and should be handled by plugins. [More info](https://github.com/rollup/rollup/wiki/Plugins) +- BREAKING – the .js extension is only added if it looks like there's no extension, allowing e.g. `import data from 'data.json'` (with the appropriate transformer). For safety, always include the file extension – import `./foo.js`, not `./foo` + +## 0.19.2 + +- Fix exporting namespaces to include all of their exports ([#204](https://github.com/rollup/rollup/issues/204)) +- Namespace exotic objects are frozen to ensure that its properties cannot be modified, reconfigured, redefined or deleted ([#203](https://github.com/rollup/rollup/pulls/203)) +- Fix `ReferenceError: Promise is not defined` in node v0.10 ([#189](https://github.com/rollup/rollup/issues/189)) + +## 0.19.1 + +- Fix `module.basename()` when used with custom `resolveId` function +- Use [rollup-babel](https://github.com/rollup/rollup-babel) to build self +- Exposed the version string through the API: `require( 'rollup' ).VERSION` + +## 0.19.0 + +- **breaking** The `transform` option is no longer passed through to custom loaders. Loaders should only concern themselves with providing source code; transformation will _always_ take place +- `options.transform` functions can return a string, or a `{code, map, ast}` object. Where possible, sourcemap chains will be flattened ([#175](https://github.com/rollup/rollup/pull/175)) +- `options.resolveId`, `options.resolveExternal` and `options.load` can each be a function or an array of functions. If an array, the first non-null/undefined return value is used. In both cases, failed resolution/loading will fall back to the defaults, unless an error is thrown. ([#174](https://github.com/rollup/rollup/pull/174)) +- New `intro` and `outro` options – similar to `banner` and `footer` except inserted _inside_ any format-specific wrapper +- Multiple var declarations in an export block (e.g. `export let a = 1, b = 2`) are split up to facilitate tree-shaking ([#171](https://github.com/rollup/rollup/issues/171)) +- More informative error when using a missing namespace property ([#169](https://github.com/rollup/rollup/pull/169)) +- Update various dependencies + +## 0.18.5 + +- Allow namespaces to be assigned to variables ([#168](https://github.com/rollup/rollup/issues/168)) +- Promote `chalk` and `source-map-support` to `dependencies`, as they're used by the CLI ([#167](https://github.com/rollup/rollup/pull/167)) + +## 0.18.4 + +- Make external modules configurable (i.e. `external.config.foo = 'bar'`) without erroring + +## 0.18.3 + +- Crop indent exclusion ranges to exclude enclosing quotes ([#166](https://github.com/rollup/rollup/issues/166)) + +## 0.18.2 + +- Include definitions of namespace members that are exported as defaults + +## 0.18.1 + +- Include `acorn.parse` in bundle, remove `sander` from dependencies, simplify build + +## 0.18.0 + +- Internal rewrite +- Reinstate statically-analysable namespace imports +- Avoid using getters in namespace blocks where possible ([#144](https://github.com/rollup/rollup/issues/144)) +- Track variable aliases ([#96](https://github.com/rollup/rollup/issues/96)) +- Prevent multiline strings being indented ([#164](https://github.com/rollup/rollup/issues/164)) + +## 0.17.4 + +- Allow imports from hidden directories (replay of [#133](https://github.com/rollup/rollup/issues/133)) + +## 0.17.3 + +- Handle parenthesised default exports ([#136](https://github.com/rollup/rollup/issues/136)) + +## 0.17.2 + +- Allow use of scoped npm packages ([#131](https://github.com/rollup/rollup/issues/131)) + +## 0.17.1 + +- Allow namespaces to be passed to a function ([#149](https://github.com/rollup/rollup/issues/149)) + +## 0.17.0 + +- Roll back to 0.15.0 and reapply subsequent fixes pending resolution of ([#132](https://github.com/rollup/rollup/issues/132)) and related issues + +## 0.16.4 + +- Fix import paths with `.` ([#133](https://github.com/rollup/rollup/issues/133)) +- Prevent sourceMappingURL confusion leading to broken sourcemap +- Add code coverage reporting [#130](https://github.com/rollup/rollup/pull/130)) +- Add `modules` property to user-facing `bundle` – an array with `{id}` objects ([#128](https://github.com/rollup/rollup/issues/128)) + +## 0.16.3 + +- Prevent adjacent blocks of multiple var declarations causing magic-string failure ([#105](https://github.com/rollup/rollup/issues/105)) + +## 0.16.2 + +- Top-level function calls and assignments to globals are treated as side-effects, and always included +- Import files from subdirectories of external packages, e.g. `import mod from 'foo/sub/mod'` ([#126](https://github.com/rollup/rollup/issues/126)) + +## 0.16.1 + +- Handle assignment patterns, and destructured/rest parameters, when analysing scopes +- Fix bug preventing project from self-building (make base `Identifier` class markable) + +## 0.16.0 + +- Internal refactoring ([#99](https://github.com/rollup/rollup/pull/99)) +- Optimisation for statically-analysable namespace imports ([#99](https://github.com/rollup/rollup/pull/99)) +- Windows support (theoretically!) ([#117](https://github.com/rollup/rollup/pull/117) / [#119](https://github.com/rollup/rollup/pull/119)) + +## 0.15.0 + +- Load all modules specified by `import` statements, and do tree-shaking synchronously once loading is complete. This results in simpler and faster code, and enables future improvements ([#97](https://github.com/rollup/rollup/pull/97)) +- Only rewrite `foo` as `exports.foo` when it makes sense to ([#92](https://github.com/rollup/rollup/issues/92)) +- Fix bug with shadowed variables that are eventually exported ([#91](https://github.com/rollup/rollup/issues/91)) +- Exclude unused function declarations that happen to modify a used name ([#90](https://github.com/rollup/rollup/pull/90)) +- Simplify internal `Scope` model – scopes always attach to blocks, never function expressions/declarations + +## 0.14.1 + +- `export { name } from './other'` does not create a local binding ([#16](https://github.com/rollup/rollup/issues/16)) +- A single binding can be exported under multiple names ([#18](https://github.com/rollup/rollup/issues/18)) +- `useStrict` option exposed to CLI as `--strict`/`--no-strict` ([#81](https://github.com/rollup/rollup/issues/81)) +- Neater exports from ES6 bundles + +## 0.14.0 + +- Internal refactoring +- Correctly deconflict generated default export names ([#72](https://github.com/rollup/rollup/issues/72)) +- Handle `export { x } from 'y'` declarations ([#74](https://github.com/rollup/rollup/issues/74)) +- Dedupe named imports from external modules in ES6 bundles ([#77](https://github.com/rollup/rollup/issues/77)) + +## 0.13.0 + +- Support `banner` and `footer` options ([#66](https://github.com/rollup/rollup/pull/66)) +- Remove pre-existing sourcemap comments ([#66](https://github.com/rollup/rollup/pull/66)) +- Deconflict external imports ([#66](https://github.com/rollup/rollup/pull/66)) +- Use existing AST, if provided ([#66](https://github.com/rollup/rollup/pull/66)) +- Rename internal namespace exports as appropriate ([#66](https://github.com/rollup/rollup/pull/66)) +- Remove uninitialised var declarations that get exported ([#66](https://github.com/rollup/rollup/pull/66)) +- Rename variables named `exports` to avoid conflicts ([#66](https://github.com/rollup/rollup/pull/66)) + +## 0.12.1 + +- Don't attempt to mark statements belonging to external modules ([#68](https://github.com/rollup/rollup/issues/68)) +- Correctly deshadow variables that conflict with imports ([#68](https://github.com/rollup/rollup/issues/68)) + +## 0.12.0 + +- Internal re-architecting, resulting in more efficient bundling with reduced memory usage +- Shorthand properties are expanded if necessary ([#61](https://github.com/rollup/rollup/issues/61)) +- Fixed various bugs with bundle external dependencies, particularly when generating ES6 bundles ([#59](https://github.com/rollup/rollup/issues/59)) +- Add `--globals` option to CLI ([#60](https://github.com/rollup/rollup/pull/60)) +- Allow imports of external modules for side-effects ([#55](https://github.com/rollup/rollup/pull/55)) +- Prevent Rollup hanging on non-existent external module ([#54](https://github.com/rollup/rollup/pull/54)) + +## 0.11.4 + +- Side-effect preservation applies to internal default exports ([#43](https://github.com/rollup/rollup/issues/43)) + +## 0.11.3 + +- Class methods are not incorrectly renamed ([#42](https://github.com/rollup/rollup/issues/42)) +- External modules are assigned names before canonical names are determined ([#42](https://github.com/rollup/rollup/issues/42)) + +## 0.11.2 + +- Correctly handle computed properties (e.g. `foo[bar]`) when discovering dependencies ([#47](https://github.com/rollup/rollup/pull/47)) + +## 0.11.1 + +- Support for `export * from '..'` ([#46](https://github.com/rollup/rollup/pull/46)) + +## 0.11.0 + +- Experimental browser-friendly build (`dist/rollup.browser.js`) ([#25](https://github.com/rollup/rollup/issues/25)) +- Internal re-architecting to make discovery process simpler and more performant +- Preservation of side-effects that happen in a separate module to the affected definition ([#39](https://github.com/rollup/rollup/issues/39)) + +## 0.10.0 + +- Better sorting algorithm – sorting happens at the module level, rather than the statement level. This avoids certain edge cases +- IIFEs are ignored for the purposes of distinguishing between 'strong' and 'weak' dependencies +- Empty `var` declarations for exported bindings are omitted + +## 0.9.1 + +- Much faster statement insertion (fixes major 0.9.0 performance regression) + +## 0.9.0 + +- BREAKING - `resolvePath` is now `resolveId`. The returned `id` (which by default is a filepath) is passed to the `load` function, which can optionally be overridden, and which is applied to all modules including the entry module. This allows custom resolver and loading logic for integration with third party systems (e.g. JSPM) or, eventually, in-browser usage ([#30](https://github.com/rollup/rollup/issues/30)) +- A statement cannot appear after later statements from the same bundle ([#34](https://github.com/rollup/rollup/issues/34)) +- Tricky cyclical dependencies are handled ([#36](https://github.com/rollup/rollup/issues/36)) +- `sourcemap` option is used by CLI (was omitted previously) + +## 0.8.3 + +- Correctly rename functions that have arguments with the same name ([#32](https://github.com/rollup/rollup/issues/32)) +- Ensure unused default exports are given a legal name ([#33](https://github.com/rollup/rollup/issues/33)) + +## 0.8.2 + +- Support `moduleId` and `moduleName` via CLI ([#24](https://github.com/rollup/rollup/issues/24)) + +## 0.8.1 + +- Anonymous functions that are exported as default are converted to named function declarations for correct hoisting, rather than being bound to functions ([#29](https://github.com/rollup/rollup/issues/29)) +- Automatically-generated default export names are deconflicted with local definitions ([#29](https://github.com/rollup/rollup/issues/29)) + +## 0.8.0 + +- Top-level variable declarations with multiple declarators are split up, to avoid unnecessary code importing and incorrectly-ordered statements ([#26](https://github.com/rollup/rollup/issues/26)) +- `this` at the top level is `undefined` ([#28](https://github.com/rollup/rollup/issues/28)) + +## 0.7.8 + +- Avoid using `path.parse` - unsupported in node 0.10 + +## 0.7.7 + +- Promise `source-map-support` from `devDependencies` to `dependencies` ([#23](https://github.com/rollup/rollup/issues/23)) + +## 0.7.6 + +- Better placement of `export default` statements ([#21](https://github.com/rollup/rollup/issues/21)) +- Prevent function calls and property assignments from being treated as rebinding for sake of unbound default exports +- Add `--external foo,bar,baz` option to CLI (equivalent to `external: ['foo', 'bar', 'baz']`) +- Add CLI tests + +## 0.7.5 + +- Prevent accidental conflicts with the global namespace ([#20](https://github.com/rollup/rollup/issues/20)) + +## 0.7.4 + +- More precise statement re-ordering to satisfy `export default` constraint (fixes bug introduced in 0.7.3) + +## 0.7.3 + +- Default exports are not bound. To enable this, statements within a module are sorted to retain their original order ([#15](https://github.com/rollup/rollup/issues/15)) +- Better positioning of comments ([#14](https://github.com/rollup/rollup/issues/14)) +- Various fixes to get Travis-CI rigged up + +## 0.7.2 + +- Fix sourcemap paths on Windows ([#6](https://github.com/rollup/rollup/pull/6)) + +## 0.7.1 + +- Named functions can be used as default exports from a bundle +- Method calls are assumed to mutate the owner (i.e. `foo.bar()` mutates `foo`) ([#13](https://github.com/rollup/rollup/issues/13)) +- `options.indent` can be used to control indentation of resulting bundle. `options.true` (default) means 'auto', `options.false` means empty string. Alternatively specify whitespace e.g. `' '` or `'\t'` ([#5](https://github.com/rollup/rollup/issues/5)) + +## 0.7.0 + +- Ensure statements are always separated by a newline ([#9](https://github.com/rollup/rollup/pull/9)) +- Use CommonJS `exports` correctly (UMD exports) +- Throw error if `moduleName` is required but missing (UMD exports) +- Attach IIFE global to `this` rather than `window` +- Allow names inside bundle to the the names of `Object.prototype` properties ([#12](https://github.com/rollup/rollup/pull/12)) +- Keep exports live ([#11](https://github.com/rollup/rollup/pull/11)) + +## 0.6.5 + +- Add sourceMappingURL comment to code, as appropriate +- Higher resolution sourcemaps + +## 0.6.4 + +- Fix CJS bundling with default export + +## 0.6.3 + +- Fix exports and external module imports with some output formats +- Fix endless cycle bug on Windows ([#3](https://github.com/rollup/rollup/pull/3)) - thanks @Bobris + +## 0.6.2 + +- Permit assignments to properties of imported bindings + +## 0.6.1 + +- Support for basic transformers + +## 0.6.0 + +- BREAKING - `rollup.rollup` and `bundle.write` both take a single options argument +- BREAKING - external modules must be declared upfront with `options.external: [...]` +- Non-relative module paths will be resolved by looking for `jsnext:main` fields in the appropriate `package.json` files. This behaviour can be overridden by passing an alternative `resolveExternal` function +- Fix sourcemap options +- Include CLI files in npm package (duh) + +## 0.5.0 + +- Command line interface +- Sourcemap generation +- Correct behaviour with `export { x as y } from 'z'` + +## 0.4.1 + +- More import name deconflicting + +## 0.4.0 + +- Self-hosting! `rollup.rollup` now rolls up rollup +- Fix bug with comments inside a statement later being appended to it +- Prevent shadowing of external modules +- Rewrite computed property identifiers where necessary +- Preserve original statement order where possible +- Internal refactoring + +## 0.3.1 + +- Saner deconflicting +- Rename namespace imports from external modules correctly + +## 0.3.0 + +- Basic functionality present, mostly spec-compliant + +## 0.2.1 + +- Include dist files in npm package (duh) + +## 0.2.0 + +- First release capable of doing anything useful +- Still lots of basic functionality missing + +## 0.1.0 + +- Initial experiment diff --git a/frontend/node_modules/rollup/LICENSE.md b/frontend/node_modules/rollup/LICENSE.md new file mode 100644 index 00000000..d5a5c4fb --- /dev/null +++ b/frontend/node_modules/rollup/LICENSE.md @@ -0,0 +1,703 @@ +# Rollup core license +Rollup is released under the MIT license: + +The MIT License (MIT) + +Copyright (c) 2017 [these people](https://github.com/rollup/rollup/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# Licenses of bundled dependencies +The published Rollup artifact additionally contains code with the following licenses: +MIT, ISC + +# Bundled dependencies: +## @rollup/pluginutils +License: MIT +By: Rich Harris +Repository: rollup/plugins + +--------------------------------------- + +## acorn +License: MIT +By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine +Repository: https://github.com/acornjs/acorn.git + +> MIT License +> +> Copyright (C) 2012-2022 by various contributors (see AUTHORS) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## acorn-walk +License: MIT +By: Marijn Haverbeke, Ingvar Stepanyan, Adrian Heine +Repository: https://github.com/acornjs/acorn.git + +> MIT License +> +> Copyright (C) 2012-2020 by various contributors (see AUTHORS) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## anymatch +License: ISC +By: Elan Shanker +Repository: https://github.com/micromatch/anymatch + +> The ISC License +> +> Copyright (c) 2019 Elan Shanker, Paul Miller (https://paulmillr.com) +> +> Permission to use, copy, modify, and/or distribute this software for any +> purpose with or without fee is hereby granted, provided that the above +> copyright notice and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + +## binary-extensions +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/binary-extensions + +> MIT License +> +> Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## braces +License: MIT +By: Jon Schlinkert, Brian Woodward, Elan Shanker, Eugene Sharygin, hemanth.hm +Repository: micromatch/braces + +> The MIT License (MIT) +> +> Copyright (c) 2014-2018, Jon Schlinkert. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## chokidar +License: MIT +By: Paul Miller, Elan Shanker +Repository: git+https://github.com/paulmillr/chokidar.git + +> The MIT License (MIT) +> +> Copyright (c) 2012-2019 Paul Miller (https://paulmillr.com), Elan Shanker +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the “Software”), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## colorette +License: MIT +By: Jorge Bucaran +Repository: jorgebucaran/colorette + +> Copyright © Jorge Bucaran <> +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## date-time +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/date-time + +> MIT License +> +> Copyright (c) Sindre Sorhus (https://sindresorhus.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## fill-range +License: MIT +By: Jon Schlinkert, Edo Rivai, Paul Miller, Rouven Weßling +Repository: jonschlinkert/fill-range + +> The MIT License (MIT) +> +> Copyright (c) 2014-present, Jon Schlinkert. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## glob-parent +License: ISC +By: Gulp Team, Elan Shanker, Blaine Bublitz +Repository: gulpjs/glob-parent + +> The ISC License +> +> Copyright (c) 2015, 2019 Elan Shanker +> +> Permission to use, copy, modify, and/or distribute this software for any +> purpose with or without fee is hereby granted, provided that the above +> copyright notice and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +> MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +> ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +> WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +> ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +> IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + +## hash.js +License: MIT +By: Fedor Indutny +Repository: git@github.com:indutny/hash.js + +--------------------------------------- + +## inherits +License: ISC +Repository: git://github.com/isaacs/inherits + +> The ISC License +> +> Copyright (c) Isaac Z. Schlueter +> +> Permission to use, copy, modify, and/or distribute this software for any +> purpose with or without fee is hereby granted, provided that the above +> copyright notice and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +> OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +> PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + +## is-binary-path +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/is-binary-path + +> MIT License +> +> Copyright (c) 2019 Sindre Sorhus (https://sindresorhus.com), Paul Miller (https://paulmillr.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## is-extglob +License: MIT +By: Jon Schlinkert +Repository: jonschlinkert/is-extglob + +> The MIT License (MIT) +> +> Copyright (c) 2014-2016, Jon Schlinkert +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## is-glob +License: MIT +By: Jon Schlinkert, Brian Woodward, Daniel Perez +Repository: micromatch/is-glob + +> The MIT License (MIT) +> +> Copyright (c) 2014-2017, Jon Schlinkert. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## is-number +License: MIT +By: Jon Schlinkert, Olsten Larck, Rouven Weßling +Repository: jonschlinkert/is-number + +> The MIT License (MIT) +> +> Copyright (c) 2014-present, Jon Schlinkert. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## is-reference +License: MIT +By: Rich Harris +Repository: git+https://github.com/Rich-Harris/is-reference.git + +--------------------------------------- + +## locate-character +License: MIT +By: Rich Harris +Repository: Rich-Harris/locate-character + +--------------------------------------- + +## magic-string +License: MIT +By: Rich Harris +Repository: https://github.com/rich-harris/magic-string + +> Copyright 2018 Rich Harris +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## minimalistic-assert +License: ISC +Repository: https://github.com/calvinmetcalf/minimalistic-assert.git + +> Copyright 2015 Calvin Metcalf +> +> Permission to use, copy, modify, and/or distribute this software for any purpose +> with or without fee is hereby granted, provided that the above copyright notice +> and this permission notice appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +> REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +> FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +> INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +> LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +> OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +> PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + +## normalize-path +License: MIT +By: Jon Schlinkert, Blaine Bublitz +Repository: jonschlinkert/normalize-path + +> The MIT License (MIT) +> +> Copyright (c) 2014-2018, Jon Schlinkert. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## parse-ms +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/parse-ms + +> MIT License +> +> Copyright (c) Sindre Sorhus (sindresorhus.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## picomatch +License: MIT +By: Jon Schlinkert +Repository: micromatch/picomatch + +> The MIT License (MIT) +> +> Copyright (c) 2017-present, Jon Schlinkert. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## pretty-bytes +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/pretty-bytes + +> MIT License +> +> Copyright (c) Sindre Sorhus (https://sindresorhus.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## pretty-ms +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/pretty-ms + +> MIT License +> +> Copyright (c) Sindre Sorhus (sindresorhus.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## readdirp +License: MIT +By: Thorsten Lorenz, Paul Miller +Repository: git://github.com/paulmillr/readdirp.git + +> MIT License +> +> Copyright (c) 2012-2019 Thorsten Lorenz, Paul Miller (https://paulmillr.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all +> copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +> SOFTWARE. + +--------------------------------------- + +## signal-exit +License: ISC +By: Ben Coe +Repository: https://github.com/tapjs/signal-exit.git + +> The ISC License +> +> Copyright (c) 2015, Contributors +> +> Permission to use, copy, modify, and/or distribute this software +> for any purpose with or without fee is hereby granted, provided +> that the above copyright notice and this permission notice +> appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +> OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE +> LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +> OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +> WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +> ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +--------------------------------------- + +## sourcemap-codec +License: MIT +By: Rich Harris +Repository: https://github.com/Rich-Harris/sourcemap-codec + +> The MIT License +> +> Copyright (c) 2015 Rich Harris +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## time-zone +License: MIT +By: Sindre Sorhus +Repository: sindresorhus/time-zone + +> MIT License +> +> Copyright (c) Sindre Sorhus (https://sindresorhus.com) +> +> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +--------------------------------------- + +## to-regex-range +License: MIT +By: Jon Schlinkert, Rouven Weßling +Repository: micromatch/to-regex-range + +> The MIT License (MIT) +> +> Copyright (c) 2015-present, Jon Schlinkert. +> +> Permission is hereby granted, free of charge, to any person obtaining a copy +> of this software and associated documentation files (the "Software"), to deal +> in the Software without restriction, including without limitation the rights +> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +> copies of the Software, and to permit persons to whom the Software is +> furnished to do so, subject to the following conditions: +> +> The above copyright notice and this permission notice shall be included in +> all copies or substantial portions of the Software. +> +> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +> THE SOFTWARE. + +--------------------------------------- + +## yargs-parser +License: ISC +By: Ben Coe +Repository: https://github.com/yargs/yargs-parser.git + +> Copyright (c) 2016, Contributors +> +> Permission to use, copy, modify, and/or distribute this software +> for any purpose with or without fee is hereby granted, provided +> that the above copyright notice and this permission notice +> appear in all copies. +> +> THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +> WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES +> OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE +> LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES +> OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +> WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +> ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/frontend/node_modules/rollup/README.md b/frontend/node_modules/rollup/README.md new file mode 100644 index 00000000..7cf59ffc --- /dev/null +++ b/frontend/node_modules/rollup/README.md @@ -0,0 +1,127 @@ +

+ +

+ +

+ + npm version + + + install size + + + code coverage + + + backers + + + sponsors + + + license + + + dependency status + + + Join the chat at https://is.gd/rollup_chat + +

+ +

Rollup

+ +## Overview + +Rollup is a module bundler for JavaScript which compiles small pieces of code into something larger and more complex, such as a library or application. It uses the standardized ES module format for code, instead of previous idiosyncratic solutions such as CommonJS and AMD. ES modules let you freely and seamlessly combine the most useful individual functions from your favorite libraries. Rollup can optimize ES modules for faster native loading in modern browsers, or output a legacy module format allowing ES module workflows today. + +## Quick Start Guide + +Install with `npm install --global rollup`. Rollup can be used either through a [command line interface](https://rollupjs.org/#command-line-reference) with an optional configuration file, or else through its [JavaScript API](https://rollupjs.org/guide/en/#javascript-api). Run `rollup --help` to see the available options and parameters. The starter project templates, [rollup-starter-lib](https://github.com/rollup/rollup-starter-lib) and [rollup-starter-app](https://github.com/rollup/rollup-starter-app), demonstrate common configuration options, and more detailed instructions are available throughout the [user guide](https://rollupjs.org/). + +### Commands + +These commands assume the entry point to your application is named main.js, and that you'd like all imports compiled into a single file named bundle.js. + +For browsers: + +```bash +# compile to a `, { contentOnly: true }); + }; + await traverseHtml(html, htmlPath, (node) => { + if (node.type !== 1 /* ELEMENT */) { + return; + } + // script tags + if (node.tag === 'script') { + const { src, isModule } = getScriptInfo(node); + if (src) { + processNodeUrl(src, s, config, htmlPath, originalUrl, moduleGraph); + } + else if (isModule && node.children.length) { + addInlineModule(node, 'js'); + } + } + if (node.tag === 'style' && node.children.length) { + const children = node.children[0]; + styleUrl.push({ + start: children.loc.start.offset, + end: children.loc.end.offset, + code: children.content + }); + } + // elements with [href/src] attrs + const assetAttrs = assetAttrsConfig[node.tag]; + if (assetAttrs) { + for (const p of node.props) { + if (p.type === 6 /* ATTRIBUTE */ && + p.value && + assetAttrs.includes(p.name)) { + processNodeUrl(p, s, config, htmlPath, originalUrl); + } + } + } + }); + await Promise.all(styleUrl.map(async ({ start, end, code }, index) => { + const url = `${proxyModulePath}?html-proxy&direct&index=${index}.css`; + // ensure module in graph after successful load + const mod = await moduleGraph.ensureEntryFromUrl(url, false); + ensureWatchedFile(watcher, mod.file, config.root); + const result = await server.pluginContainer.transform(code, mod.id); + s.overwrite(start, end, (result === null || result === void 0 ? void 0 : result.code) || ''); + })); + html = s.toString(); + return { + html, + tags: [ + { + tag: 'script', + attrs: { + type: 'module', + src: path__default.posix.join(base, CLIENT_PUBLIC_PATH) + }, + injectTo: 'head-prepend' + } + ] + }; +}; +function indexHtmlMiddleware(server) { + // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` + return async function viteIndexHtmlMiddleware(req, res, next) { + if (res.writableEnded) { + return next(); + } + const url = req.url && cleanUrl(req.url); + // spa-fallback always redirects to /index.html + if ((url === null || url === void 0 ? void 0 : url.endsWith('.html')) && req.headers['sec-fetch-dest'] !== 'script') { + const filename = getHtmlFilename(url, server); + if (fs__default.existsSync(filename)) { + try { + let html = fs__default.readFileSync(filename, 'utf-8'); + html = await server.transformIndexHtml(url, html, req.originalUrl); + return send(req, res, html, 'html', { + headers: server.config.server.headers + }); + } + catch (e) { + return next(e); + } + } + } + next(); + }; +} + +const logTime = createDebugger('vite:time'); +function timeMiddleware(root) { + // Keep the named function. The name is visible in debug logs via `DEBUG=connect:dispatcher ...` + return function viteTimeMiddleware(req, res, next) { + const start = perf_hooks.performance.now(); + const end = res.end; + res.end = (...args) => { + logTime(`${timeFrom(start)} ${prettifyUrl(req.url, root)}`); + // @ts-ignore + return end.call(res, ...args); + }; + next(); + }; +} + +const debugHmr = createDebugger('vite:hmr'); +const normalizedClientDir = normalizePath$3(CLIENT_DIR); +function getShortName(file, root) { + return file.startsWith(root + '/') ? path__default.posix.relative(root, file) : file; +} +async function handleHMRUpdate(file, server) { + const { ws, config, moduleGraph } = server; + const shortFile = getShortName(file, config.root); + const fileName = path__default.basename(file); + const isConfig = file === config.configFile; + const isConfigDependency = config.configFileDependencies.some((name) => file === name); + const isEnv = config.inlineConfig.envFile !== false && + (fileName === '.env' || fileName.startsWith('.env.')); + if (isConfig || isConfigDependency || isEnv) { + // auto restart server + debugHmr(`[config change] ${colors$1.dim(shortFile)}`); + config.logger.info(colors$1.green(`${path__default.relative(process.cwd(), file)} changed, restarting server...`), { clear: true, timestamp: true }); + try { + await server.restart(); + } + catch (e) { + config.logger.error(colors$1.red(e)); + } + return; + } + debugHmr(`[file change] ${colors$1.dim(shortFile)}`); + // (dev only) the client itself cannot be hot updated. + if (file.startsWith(normalizedClientDir)) { + ws.send({ + type: 'full-reload', + path: '*' + }); + return; + } + const mods = moduleGraph.getModulesByFile(file); + // check if any plugin wants to perform custom HMR handling + const timestamp = Date.now(); + const hmrContext = { + file, + timestamp, + modules: mods ? [...mods] : [], + read: () => readModifiedFile(file), + server + }; + for (const plugin of config.plugins) { + if (plugin.handleHotUpdate) { + const filteredModules = await plugin.handleHotUpdate(hmrContext); + if (filteredModules) { + hmrContext.modules = filteredModules; + } + } + } + if (!hmrContext.modules.length) { + // html file cannot be hot updated + if (file.endsWith('.html')) { + config.logger.info(colors$1.green(`page reload `) + colors$1.dim(shortFile), { + clear: true, + timestamp: true + }); + ws.send({ + type: 'full-reload', + path: config.server.middlewareMode + ? '*' + : '/' + normalizePath$3(path__default.relative(config.root, file)) + }); + } + else { + // loaded but not in the module graph, probably not js + debugHmr(`[no modules matched] ${colors$1.dim(shortFile)}`); + } + return; + } + updateModules(shortFile, hmrContext.modules, timestamp, server); +} +function updateModules(file, modules, timestamp, { config, ws }) { + const updates = []; + const invalidatedModules = new Set(); + let needFullReload = false; + for (const mod of modules) { + invalidate(mod, timestamp, invalidatedModules); + if (needFullReload) { + continue; + } + const boundaries = new Set(); + const hasDeadEnd = propagateUpdate(mod, boundaries); + if (hasDeadEnd) { + needFullReload = true; + continue; + } + updates.push(...[...boundaries].map(({ boundary, acceptedVia }) => ({ + type: `${boundary.type}-update`, + timestamp, + path: boundary.url, + acceptedPath: acceptedVia.url + }))); + } + if (needFullReload) { + config.logger.info(colors$1.green(`page reload `) + colors$1.dim(file), { + clear: true, + timestamp: true + }); + ws.send({ + type: 'full-reload' + }); + } + else { + config.logger.info(updates + .map(({ path }) => colors$1.green(`hmr update `) + colors$1.dim(path)) + .join('\n'), { clear: true, timestamp: true }); + ws.send({ + type: 'update', + updates + }); + } +} +async function handleFileAddUnlink(file, server, isUnlink = false) { + var _a; + const modules = [...((_a = server.moduleGraph.getModulesByFile(file)) !== null && _a !== void 0 ? _a : [])]; + if (isUnlink && file in server._globImporters) { + delete server._globImporters[file]; + } + else { + for (const i in server._globImporters) { + const { module, importGlobs } = server._globImporters[i]; + for (const { base, pattern } of importGlobs) { + if (micromatch_1.isMatch(file, pattern) || + micromatch_1.isMatch(path__default.relative(base, file), pattern)) { + modules.push(module); + // We use `onFileChange` to invalidate `module.file` so that subsequent `ssrLoadModule()` + // calls get fresh glob import results with(out) the newly added(/removed) `file`. + server.moduleGraph.onFileChange(module.file); + break; + } + } + } + } + if (modules.length > 0) { + updateModules(getShortName(file, server.config.root), modules, Date.now(), server); + } +} +function propagateUpdate(node, boundaries, currentChain = [node]) { + // #7561 + // if the imports of `node` have not been analyzed, then `node` has not + // been loaded in the browser and we should stop propagation. + if (node.id && node.isSelfAccepting === undefined) { + return false; + } + if (node.isSelfAccepting) { + boundaries.add({ + boundary: node, + acceptedVia: node + }); + // additionally check for CSS importers, since a PostCSS plugin like + // Tailwind JIT may register any file as a dependency to a CSS file. + for (const importer of node.importers) { + if (isCSSRequest(importer.url) && !currentChain.includes(importer)) { + propagateUpdate(importer, boundaries, currentChain.concat(importer)); + } + } + return false; + } + if (!node.importers.size) { + return true; + } + // #3716, #3913 + // For a non-CSS file, if all of its importers are CSS files (registered via + // PostCSS plugins) it should be considered a dead end and force full reload. + if (!isCSSRequest(node.url) && + [...node.importers].every((i) => isCSSRequest(i.url))) { + return true; + } + for (const importer of node.importers) { + const subChain = currentChain.concat(importer); + if (importer.acceptedHmrDeps.has(node)) { + boundaries.add({ + boundary: importer, + acceptedVia: node + }); + continue; + } + if (currentChain.includes(importer)) { + // circular deps is considered dead end + return true; + } + if (propagateUpdate(importer, boundaries, subChain)) { + return true; + } + } + return false; +} +function invalidate(mod, timestamp, seen) { + if (seen.has(mod)) { + return; + } + seen.add(mod); + mod.lastHMRTimestamp = timestamp; + mod.transformResult = null; + mod.ssrModule = null; + mod.ssrError = null; + mod.ssrTransformResult = null; + mod.importers.forEach((importer) => { + if (!importer.acceptedHmrDeps.has(mod)) { + invalidate(importer, timestamp, seen); + } + }); +} +function handlePrunedModules(mods, { ws }) { + // update the disposed modules' hmr timestamp + // since if it's re-imported, it should re-apply side effects + // and without the timestamp the browser will not re-import it! + const t = Date.now(); + mods.forEach((mod) => { + mod.lastHMRTimestamp = t; + debugHmr(`[dispose] ${colors$1.dim(mod.file)}`); + }); + ws.send({ + type: 'prune', + paths: [...mods].map((m) => m.url) + }); +} +/** + * Lex import.meta.hot.accept() for accepted deps. + * Since hot.accept() can only accept string literals or array of string + * literals, we don't really need a heavy @babel/parse call on the entire source. + * + * @returns selfAccepts + */ +function lexAcceptedHmrDeps(code, start, urls) { + let state = 0 /* inCall */; + // the state can only be 2 levels deep so no need for a stack + let prevState = 0 /* inCall */; + let currentDep = ''; + function addDep(index) { + urls.add({ + url: currentDep, + start: index - currentDep.length - 1, + end: index + 1 + }); + currentDep = ''; + } + for (let i = start; i < code.length; i++) { + const char = code.charAt(i); + switch (state) { + case 0 /* inCall */: + case 4 /* inArray */: + if (char === `'`) { + prevState = state; + state = 1 /* inSingleQuoteString */; + } + else if (char === `"`) { + prevState = state; + state = 2 /* inDoubleQuoteString */; + } + else if (char === '`') { + prevState = state; + state = 3 /* inTemplateString */; + } + else if (/\s/.test(char)) { + continue; + } + else { + if (state === 0 /* inCall */) { + if (char === `[`) { + state = 4 /* inArray */; + } + else { + // reaching here means the first arg is neither a string literal + // nor an Array literal (direct callback) or there is no arg + // in both case this indicates a self-accepting module + return true; // done + } + } + else if (state === 4 /* inArray */) { + if (char === `]`) { + return false; // done + } + else if (char === ',') { + continue; + } + else { + error(i); + } + } + } + break; + case 1 /* inSingleQuoteString */: + if (char === `'`) { + addDep(i); + if (prevState === 0 /* inCall */) { + // accept('foo', ...) + return false; + } + else { + state = prevState; + } + } + else { + currentDep += char; + } + break; + case 2 /* inDoubleQuoteString */: + if (char === `"`) { + addDep(i); + if (prevState === 0 /* inCall */) { + // accept('foo', ...) + return false; + } + else { + state = prevState; + } + } + else { + currentDep += char; + } + break; + case 3 /* inTemplateString */: + if (char === '`') { + addDep(i); + if (prevState === 0 /* inCall */) { + // accept('foo', ...) + return false; + } + else { + state = prevState; + } + } + else if (char === '$' && code.charAt(i + 1) === '{') { + error(i); + } + else { + currentDep += char; + } + break; + default: + throw new Error('unknown import.meta.hot lexer state'); + } + } + return false; +} +function error(pos) { + const err = new Error(`import.meta.accept() can only accept string literals or an ` + + `Array of string literals.`); + err.pos = pos; + throw err; +} +// vitejs/vite#610 when hot-reloading Vue files, we read immediately on file +// change event and sometimes this can be too early and get an empty buffer. +// Poll until the file's modified time has changed before reading again. +async function readModifiedFile(file) { + const content = fs__default.readFileSync(file, 'utf-8'); + if (!content) { + const mtime = fs__default.statSync(file).mtimeMs; + await new Promise((r) => { + let n = 0; + const poll = async () => { + n++; + const newMtime = fs__default.statSync(file).mtimeMs; + if (newMtime !== mtime || n > 10) { + r(0); + } + else { + setTimeout(poll, 10); + } + }; + setTimeout(poll, 10); + }); + return fs__default.readFileSync(file, 'utf-8'); + } + else { + return content; + } +} + +const isDebug = !!process.env.DEBUG; +const debug$1 = createDebugger('vite:import-analysis'); +const clientDir = normalizePath$3(CLIENT_DIR); +const skipRE = /\.(map|json)$/; +const canSkipImportAnalysis = (id) => skipRE.test(id) || isDirectCSSRequest(id); +const optimizedDepChunkRE = /\/chunk-[A-Z0-9]{8}\.js/; +const optimizedDepDynamicRE = /-[A-Z0-9]{8}\.js/; +function isExplicitImportRequired(url) { + return !isJSRequest(cleanUrl(url)) && !isCSSRequest(url); +} +function markExplicitImport(url) { + if (isExplicitImportRequired(url)) { + return injectQuery(url, 'import'); + } + return url; +} +/** + * Server-only plugin that lexes, resolves, rewrites and analyzes url imports. + * + * - Imports are resolved to ensure they exist on disk + * + * - Lexes HMR accept calls and updates import relationships in the module graph + * + * - Bare module imports are resolved (by @rollup-plugin/node-resolve) to + * absolute file paths, e.g. + * + * ```js + * import 'foo' + * ``` + * is rewritten to + * ```js + * import '/@fs//project/node_modules/foo/dist/foo.js' + * ``` + * + * - CSS imports are appended with `.js` since both the js module and the actual + * css (referenced via ) may go through the transform pipeline: + * + * ```js + * import './style.css' + * ``` + * is rewritten to + * ```js + * import './style.css.js' + * ``` + */ +function importAnalysisPlugin(config) { + const { root, base } = config; + const clientPublicPath = path__default.posix.join(base, CLIENT_PUBLIC_PATH); + const resolve = config.createResolver({ + preferRelative: true, + tryIndex: false, + extensions: [] + }); + let server; + return { + name: 'vite:import-analysis', + configureServer(_server) { + server = _server; + }, + async transform(source, importer, options) { + // In a real app `server` is always defined, but it is undefined when + // running src/node/server/__tests__/pluginContainer.spec.ts + if (!server) { + return null; + } + const ssr = (options === null || options === void 0 ? void 0 : options.ssr) === true; + const prettyImporter = prettifyUrl(importer, root); + if (canSkipImportAnalysis(importer)) { + isDebug && debug$1(colors$1.dim(`[skipped] ${prettyImporter}`)); + return null; + } + const start = perf_hooks.performance.now(); + await init; + let imports = []; + // strip UTF-8 BOM + if (source.charCodeAt(0) === 0xfeff) { + source = source.slice(1); + } + try { + imports = parse$e(source)[0]; + } + catch (e) { + const isVue = importer.endsWith('.vue'); + const maybeJSX = !isVue && isJSRequest(importer); + const msg = isVue + ? `Install @vitejs/plugin-vue to handle .vue files.` + : maybeJSX + ? `If you are using JSX, make sure to name the file with the .jsx or .tsx extension.` + : `You may need to install appropriate plugins to handle the ${path__default.extname(importer)} file format.`; + this.error(`Failed to parse source for import analysis because the content ` + + `contains invalid JS syntax. ` + + msg, e.idx); + } + const { moduleGraph } = server; + // since we are already in the transform phase of the importer, it must + // have been loaded so its entry is guaranteed in the module graph. + const importerModule = moduleGraph.getModuleById(importer); + if (!importerModule && isOptimizedDepFile(importer, config)) { + // Ids of optimized deps could be invalidated and removed from the graph + // Return without transforming, this request is no longer valid, a full reload + // is going to request this id again. Throwing an outdated error so we + // properly finish the request with a 504 sent to the browser. + throwOutdatedRequest(importer); + } + if (!imports.length) { + importerModule.isSelfAccepting = false; + isDebug && + debug$1(`${timeFrom(start)} ${colors$1.dim(`[no imports] ${prettyImporter}`)}`); + return source; + } + let hasHMR = false; + let isSelfAccepting = false; + let hasEnv = false; + let needQueryInjectHelper = false; + let s; + const str = () => s || (s = new MagicString(source)); + const importedUrls = new Set(); + const staticImportedUrls = new Set(); + const acceptedUrls = new Set(); + const toAbsoluteUrl = (url) => path__default.posix.resolve(path__default.posix.dirname(importerModule.url), url); + const normalizeUrl = async (url, pos) => { + var _a; + if (base !== '/' && url.startsWith(base)) { + url = url.replace(base, '/'); + } + let importerFile = importer; + if (moduleListContains((_a = config.optimizeDeps) === null || _a === void 0 ? void 0 : _a.exclude, url)) { + const optimizedDeps = server._optimizedDeps; + if (optimizedDeps) { + await optimizedDeps.scanProcessing; + // if the dependency encountered in the optimized file was excluded from the optimization + // the dependency needs to be resolved starting from the original source location of the optimized file + // because starting from node_modules/.vite will not find the dependency if it was not hoisted + // (that is, if it is under node_modules directory in the package source of the optimized file) + for (const optimizedModule of optimizedDeps.metadata.depInfoList) { + if (!optimizedModule.src) + continue; // Ignore chunks + if (optimizedModule.file === importerModule.file) { + importerFile = optimizedModule.src; + } + } + } + } + const resolved = await this.resolve(url, importerFile); + if (!resolved) { + // in ssr, we should let node handle the missing modules + if (ssr) { + return [url, url]; + } + this.error(`Failed to resolve import "${url}" from "${path__default.relative(process.cwd(), importerFile)}". Does the file exist?`, pos); + } + const isRelative = url.startsWith('.'); + const isSelfImport = !isRelative && cleanUrl(url) === cleanUrl(importer); + // normalize all imports into resolved URLs + // e.g. `import 'foo'` -> `import '/@fs/.../node_modules/foo/index.js'` + if (resolved.id.startsWith(root + '/')) { + // in root: infer short absolute path from root + url = resolved.id.slice(root.length); + } + else if (resolved.id.startsWith(getDepsCacheDir(config)) || + fs__default.existsSync(cleanUrl(resolved.id))) { + // an optimized deps may not yet exists in the filesystem, or + // a regular file exists but is out of root: rewrite to absolute /@fs/ paths + url = path__default.posix.join(FS_PREFIX + resolved.id); + } + else { + url = resolved.id; + } + if (isExternalUrl(url)) { + return [url, url]; + } + // if the resolved id is not a valid browser import specifier, + // prefix it to make it valid. We will strip this before feeding it + // back into the transform pipeline + if (!url.startsWith('.') && !url.startsWith('/')) { + url = + VALID_ID_PREFIX + resolved.id.replace('\0', NULL_BYTE_PLACEHOLDER); + } + // make the URL browser-valid if not SSR + if (!ssr) { + // mark non-js/css imports with `?import` + url = markExplicitImport(url); + // If the url isn't a request for a pre-bundled common chunk, + // for relative js/css imports, or self-module virtual imports + // (e.g. vue blocks), inherit importer's version query + // do not do this for unknown type imports, otherwise the appended + // query can break 3rd party plugin's extension checks. + if ((isRelative || isSelfImport) && + !/[\?&]import=?\b/.test(url) && + !url.match(DEP_VERSION_RE)) { + const versionMatch = importer.match(DEP_VERSION_RE); + if (versionMatch) { + url = injectQuery(url, versionMatch[1]); + } + } + // check if the dep has been hmr updated. If yes, we need to attach + // its last updated timestamp to force the browser to fetch the most + // up-to-date version of this module. + try { + const depModule = await moduleGraph.ensureEntryFromUrl(url, ssr); + if (depModule.lastHMRTimestamp > 0) { + url = injectQuery(url, `t=${depModule.lastHMRTimestamp}`); + } + } + catch (e) { + // it's possible that the dep fails to resolve (non-existent import) + // attach location to the missing import + e.pos = pos; + throw e; + } + // prepend base (dev base is guaranteed to have ending slash) + url = base + url.replace(/^\//, ''); + } + return [url, resolved.id]; + }; + // Import rewrites, we do them after all the URLs have been resolved + // to help with the discovery of new dependencies. If we need to wait + // for each dependency there could be one reload per import + const importRewrites = []; + for (let index = 0; index < imports.length; index++) { + const { s: start, e: end, ss: expStart, se: expEnd, d: dynamicIndex, + // #2083 User may use escape path, + // so use imports[index].n to get the unescaped string + // @ts-ignore + n: specifier } = imports[index]; + const rawUrl = source.slice(start, end); + // check import.meta usage + if (rawUrl === 'import.meta') { + const prop = source.slice(end, end + 4); + if (prop === '.hot') { + hasHMR = true; + if (source.slice(end + 4, end + 11) === '.accept') { + // further analyze accepted modules + if (lexAcceptedHmrDeps(source, source.indexOf('(', end + 11) + 1, acceptedUrls)) { + isSelfAccepting = true; + } + } + } + else if (prop === '.env') { + hasEnv = true; + } + else if (prop === '.glo' && source[end + 4] === 'b') { + // transform import.meta.glob() + // e.g. `import.meta.glob('glob:./dir/*.js')` + const { imports, importsString, exp, endIndex, base, pattern, isEager } = await transformImportGlob(source, start, importer, index, root, config.logger, normalizeUrl, resolve); + str().prepend(importsString); + str().overwrite(expStart, endIndex, exp, { contentOnly: true }); + imports.forEach((url) => { + url = url.replace(base, '/'); + importedUrls.add(url); + if (isEager) + staticImportedUrls.add(url); + }); + if (!(importerModule.file in server._globImporters)) { + server._globImporters[importerModule.file] = { + module: importerModule, + importGlobs: [] + }; + } + server._globImporters[importerModule.file].importGlobs.push({ + base, + pattern + }); + } + continue; + } + const isDynamicImport = dynamicIndex > -1; + // static import or valid string in dynamic import + // If resolvable, let's resolve it + if (specifier) { + // skip external / data uri + if (isExternalUrl(specifier) || isDataUrl(specifier)) { + continue; + } + // skip ssr external + if (ssr) { + if (server._ssrExternals && + shouldExternalizeForSSR(specifier, server._ssrExternals)) { + continue; + } + if (isBuiltin(specifier)) { + continue; + } + } + // skip client + if (specifier === clientPublicPath) { + continue; + } + // warn imports to non-asset /public files + if (specifier.startsWith('/') && + !config.assetsInclude(cleanUrl(specifier)) && + !specifier.endsWith('.json') && + checkPublicFile(specifier, config)) { + throw new Error(`Cannot import non-asset file ${specifier} which is inside /public.` + + `JS/CSS files inside /public are copied as-is on build and ` + + `can only be referenced via