From e76cde2a5c211840c93153b86751f3a14eac8135 Mon Sep 17 00:00:00 2001 From: Denis Bardadym Date: Thu, 26 Dec 2024 11:32:23 +0100 Subject: [PATCH] Update deps, remove picomatch browser alias --- .github/workflows/node.js.yml | 1 + CHANGELOG.md | 8 + package-lock.json | 1008 +- package.json | 16 +- rollup.config-dev.js | 4 - rollup.config.js | 4 - test/__snapshots__/e2e-rolldown.test.ts.snap | 67682 +++++++++-------- test/__snapshots__/e2e.test.ts.snap | 67324 ++++++++-------- test/__snapshots__/gh59.test.ts.snap | 67450 ++++++++-------- test/__snapshots__/gh69.test.ts.snap | 67656 ++++++++-------- test/__snapshots__/gh93.test.ts.snap | 67002 ++++++++-------- 11 files changed, 170811 insertions(+), 167344 deletions(-) diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 939ac84..5a0f1b5 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -28,3 +28,4 @@ jobs: - run: npm ci - run: npm run build --if-present - run: npm test + - run: npm lint \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 81271ab..cf4f3e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## Next + +* Update deps +* Switch jest -> vitest +* Switch eslint -> oxlint +* Add test for rolldown +* Make node v18 min required + ## 5.12.0 * Make unique id in generated data to be hash of data diff --git a/package-lock.json b/package-lock.json index 6228ac4..0ff3ba7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "license": "MIT", "dependencies": { "open": "^8.4.0", - "picomatch": "^2.3.1", "source-map": "^0.7.4", "yargs": "^17.5.1" }, @@ -18,11 +17,10 @@ "rollup-plugin-visualizer": "dist/bin/cli.js" }, "devDependencies": { - "@rollup/plugin-alias": "^5.0.0", - "@rollup/plugin-commonjs": "^25.0.1", - "@rollup/plugin-node-resolve": "^15.0.0", + "@rollup/plugin-commonjs": "^28.0.0", + "@rollup/plugin-node-resolve": "^16.0.0", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^11.1.1", + "@rollup/plugin-typescript": "^12.0.0", "@types/bytes": "^3.1.1", "@types/d3-array": "^3.0.3", "@types/d3-color": "^3.1.0", @@ -31,7 +29,7 @@ "@types/d3-scale": "^4.0.2", "@types/d3-shape": "^3.1.0", "@types/node": "^18.8.5", - "@types/picomatch": "^2.3.0", + "@types/picomatch": "^3.0.0", "@types/yargs": "^17.0.10", "bytes": "^3.1.2", "d3-array": "^3.1.6", @@ -40,10 +38,10 @@ "d3-hierarchy": "^3.1.2", "d3-scale": "^4.0.2", "d3-shape": "^3.1.0", - "del-cli": "^5.0.0", + "del-cli": "^6.0.0", "npm-run-all": "^4.1.5", "oxlint": "^0.15.3", - "picomatch-browser": "^2.2.6", + "picomatch": "^4.0.2", "postcss": "^8.4.14", "postcss-url": "^10.1.3", "preact": "^10.7.2", @@ -53,7 +51,7 @@ "rollup-plugin-postcss": "^4.0.2", "sass": "^1.52.1", "tslib": "^2.8.1", - "typescript": "~5.3.2", + "typescript": "~5.7.2", "vitest": "^2.1.8" }, "engines": { @@ -72,29 +70,6 @@ } } }, - "node_modules/@babel/code-frame": { - "version": "7.26.2", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", - "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.25.9", - "js-tokens": "^4.0.0", - "picocolors": "^1.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.25.9", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", - "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, "node_modules/@emnapi/core": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.3.1.tgz", @@ -1158,38 +1133,22 @@ "win32" ] }, - "node_modules/@rollup/plugin-alias": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-alias/-/plugin-alias-5.1.1.tgz", - "integrity": "sha512-PR9zDb+rOzkRb2VD+EuKB7UC41vU5DIwZ5qqCpk0KJudcWAyi8rvYOhS7+L5aZCspw1stTViLgN5v6FF1p5cgQ==", - "dev": true, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" - }, - "peerDependenciesMeta": { - "rollup": { - "optional": true - } - } - }, "node_modules/@rollup/plugin-commonjs": { - "version": "25.0.8", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-25.0.8.tgz", - "integrity": "sha512-ZEZWTK5n6Qde0to4vS9Mr5x/0UZoqCxPVR9KRUjU4kA2sO7GEUn1fop0DAwpO6z0Nw/kJON9bDmSxdWxO/TT1A==", + "version": "28.0.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-28.0.2.tgz", + "integrity": "sha512-BEFI2EDqzl+vA1rl97IDRZ61AIwGH093d9nz8+dThxJNH8oSoB7MjWvPCX3dkaK1/RCJ/1v/R1XB15FuSs0fQw==", "dev": true, "dependencies": { "@rollup/pluginutils": "^5.0.1", "commondir": "^1.0.1", "estree-walker": "^2.0.2", - "glob": "^8.0.3", + "fdir": "^6.2.0", "is-reference": "1.2.1", - "magic-string": "^0.30.3" + "magic-string": "^0.30.3", + "picomatch": "^4.0.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0 || 14 >= 14.17" }, "peerDependencies": { "rollup": "^2.68.0||^3.0.0||^4.0.0" @@ -1200,10 +1159,24 @@ } } }, + "node_modules/@rollup/plugin-commonjs/node_modules/fdir": { + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", + "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", + "dev": true, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, "node_modules/@rollup/plugin-node-resolve": { - "version": "15.3.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-15.3.1.tgz", - "integrity": "sha512-tgg6b91pAybXHJQMAAwW9VuWBO6Thi+q7BCNARLwSqlmsHz0XYURtGvh/AuwSADXSI4h/2uHbs7s4FzlZDGSGA==", + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-16.0.0.tgz", + "integrity": "sha512-0FPvAeVUT/zdWoO0jnb/V5BlBsUSNfkIOtFHzMO4H9MOklrmQFY6FduVHKucNb/aTFxvnGhj4MNj/T1oNdDfNg==", "dev": true, "dependencies": { "@rollup/pluginutils": "^5.0.1", @@ -1247,9 +1220,9 @@ } }, "node_modules/@rollup/plugin-typescript": { - "version": "11.1.6", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-11.1.6.tgz", - "integrity": "sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==", + "version": "12.1.2", + "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-12.1.2.tgz", + "integrity": "sha512-cdtSp154H5sv637uMr1a8OTWB0L1SWDSm1rDGiyfcGcvQ6cuTs4MDk2BVEBGysUWago4OJN4EQZqOTl/QY3Jgg==", "dev": true, "dependencies": { "@rollup/pluginutils": "^5.1.0", @@ -1294,18 +1267,6 @@ } } }, - "node_modules/@rollup/pluginutils/node_modules/picomatch": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", - "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/@rollup/rollup-android-arm-eabi": { "version": "4.29.1", "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.29.1.tgz", @@ -1553,6 +1514,18 @@ "win32" ] }, + "node_modules/@sindresorhus/merge-streams": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", + "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/@trysound/sax": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/@trysound/sax/-/sax-0.2.0.tgz", @@ -1638,12 +1611,6 @@ "integrity": "sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==", "dev": true }, - "node_modules/@types/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/@types/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-hov8bUuiLiyFPGyFPE1lwWhmzYbirOXQNNo40+y3zow8aFVTeyn3VWL0VFFfdNddA8S4Vf0Tc062rzyNr7Paag==", - "dev": true - }, "node_modules/@types/node": { "version": "18.19.68", "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.68.tgz", @@ -1653,16 +1620,10 @@ "undici-types": "~5.26.4" } }, - "node_modules/@types/normalize-package-data": { - "version": "2.4.4", - "resolved": "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.4.tgz", - "integrity": "sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==", - "dev": true - }, "node_modules/@types/picomatch": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/@types/picomatch/-/picomatch-2.3.4.tgz", - "integrity": "sha512-0so8lU8O5zatZS/2Fi4zrwks+vZv7e0dygrgEZXljODXBig97l4cPQD+9LabXfGJOWwoRkTVz6Q4edZvD12UOA==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@types/picomatch/-/picomatch-3.0.1.tgz", + "integrity": "sha512-1MRgzpzY0hOp9pW/kLRxeQhUWwil6gnrUYd3oEpeYBqp/FexhaCPv3F8LsYr47gtUU45fO2cm1dbwkSrHEo8Uw==", "dev": true }, "node_modules/@types/resolve": { @@ -1813,22 +1774,6 @@ "node": ">=0.4.0" } }, - "node_modules/aggregate-error": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/aggregate-error/-/aggregate-error-4.0.1.tgz", - "integrity": "sha512-0poP0T7el6Vq3rstR8Mn4V/IQrpBLO6POkUSrN7RhyY+GF/InCFShQzsQ39T25gkHhLgSLByyAz+Kjb+c2L98w==", - "dev": true, - "dependencies": { - "clean-stack": "^4.0.0", - "indent-string": "^5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -1888,15 +1833,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/arrify": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", - "integrity": "sha512-3CYzex9M9FGQjCGMGyi6/31c8GJbgb0qGyrx5HWxPd0aCwh4cB2YjMb2Xf9UuoogrMrlO9cTqnB5rI5GHZTcUA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/assertion-error": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", @@ -1933,15 +1869,6 @@ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", "dev": true }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/braces": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", @@ -2057,48 +1984,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/camelcase-keys": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-7.0.2.tgz", - "integrity": "sha512-Rjs1H+A9R+Ig+4E/9oyB66UC5Mj9Xq3N//vcLf2WzgdTi/3gUu3Z9KoqmlrEG4VuuLK8wJHofxzdQXz/knhiYg==", - "dev": true, - "dependencies": { - "camelcase": "^6.3.0", - "map-obj": "^4.1.0", - "quick-lru": "^5.1.1", - "type-fest": "^1.2.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase-keys/node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/camelcase-keys/node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/caniuse-api": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/caniuse-api/-/caniuse-api-3.0.0.tgz", @@ -2187,33 +2072,6 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/clean-stack": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/clean-stack/-/clean-stack-4.2.0.tgz", - "integrity": "sha512-LYv6XPxoyODi36Dp976riBtSY27VmFo+MKqEU9QCCWyTrdEPDog+RWA7xQWHi6Vbp61j5c4cdzzX1NidnwtUWg==", - "dev": true, - "dependencies": { - "escape-string-regexp": "5.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/clean-stack/node_modules/escape-string-regexp": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz", - "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/cliui": { "version": "8.0.1", "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", @@ -2677,52 +2535,6 @@ } } }, - "node_modules/decamelize": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-5.0.1.tgz", - "integrity": "sha512-VfxadyCECXgQlkoEAjeghAr5gY3Hf+IKjKb+X8tGVDtveCjN+USwprd2q3QXBR9T1+x2DG0XZF5/w+7HAtSaXA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decamelize-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/decamelize-keys/-/decamelize-keys-1.1.1.tgz", - "integrity": "sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==", - "dev": true, - "dependencies": { - "decamelize": "^1.1.0", - "map-obj": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/decamelize-keys/node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/decamelize-keys/node_modules/map-obj": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-1.0.1.tgz", - "integrity": "sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/deep-eql": { "version": "5.0.2", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", @@ -2784,61 +2596,40 @@ } }, "node_modules/del": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/del/-/del-7.1.0.tgz", - "integrity": "sha512-v2KyNk7efxhlyHpjEvfyxaAihKKK0nWCuf6ZtqZcFFpQRG0bJ12Qsr0RpvsICMjAAZ8DOVCxrlqpxISlMHC4Kg==", + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/del/-/del-8.0.0.tgz", + "integrity": "sha512-R6ep6JJ+eOBZsBr9esiNN1gxFbZE4Q2cULkUSFumGYecAiS6qodDvcPx/sFuWHMNul7DWmrtoEOpYSm7o6tbSA==", "dev": true, "dependencies": { - "globby": "^13.1.2", - "graceful-fs": "^4.2.10", + "globby": "^14.0.2", "is-glob": "^4.0.3", "is-path-cwd": "^3.0.0", "is-path-inside": "^4.0.0", - "p-map": "^5.5.0", - "rimraf": "^3.0.2", - "slash": "^4.0.0" + "p-map": "^7.0.2", + "slash": "^5.1.0" }, "engines": { - "node": ">=14.16" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/del-cli": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/del-cli/-/del-cli-5.1.0.tgz", - "integrity": "sha512-xwMeh2acluWeccsfzE7VLsG3yTr7nWikbfw+xhMnpRrF15pGSkw+3/vJZWlGoE4I86UiLRNHicmKt4tkIX9Jtg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/del-cli/-/del-cli-6.0.0.tgz", + "integrity": "sha512-9nitGV2W6KLFyya4qYt4+9AKQFL+c0Ehj5K7V7IwlxTc6RMCfQUGY9E9pLG6e8TQjtwXpuiWIGGZb3mfVxyZkw==", "dev": true, "dependencies": { - "del": "^7.1.0", - "meow": "^10.1.3" + "del": "^8.0.0", + "meow": "^13.2.0" }, "bin": { "del": "cli.js", "del-cli": "cli.js" }, "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/del/node_modules/globby": { - "version": "13.2.2", - "resolved": "https://registry.npmjs.org/globby/-/globby-13.2.2.tgz", - "integrity": "sha512-Y1zNGV+pzQdh7H39l9zgB4PJqjRNqydvdYCDG4HFXM4XuvSaQQlEc91IU1yALL8gUTDomgBAfz3XJdmUS+oo0w==", - "dev": true, - "dependencies": { - "dir-glob": "^3.0.1", - "fast-glob": "^3.3.0", - "ignore": "^5.2.4", - "merge2": "^1.4.1", - "slash": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -2857,18 +2648,6 @@ "node": ">=0.10" } }, - "node_modules/dir-glob": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", - "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", - "dev": true, - "dependencies": { - "path-type": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/dom-serializer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.4.1.tgz", @@ -3178,18 +2957,6 @@ "node": ">=8.6.0" } }, - "node_modules/fast-glob/node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/fastq": { "version": "1.18.0", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", @@ -3211,22 +2978,6 @@ "node": ">=8" } }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/for-each": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", @@ -3236,12 +2987,6 @@ "is-callable": "^1.1.3" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -3352,36 +3097,16 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob/node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", + "node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", "dev": true, "dependencies": { - "brace-expansion": "^2.0.1" + "is-glob": "^4.0.1" }, "engines": { - "node": ">=10" + "node": ">= 6" } }, "node_modules/globalthis": { @@ -3400,6 +3125,26 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/globby": { + "version": "14.0.2", + "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.2.tgz", + "integrity": "sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==", + "dev": true, + "dependencies": { + "@sindresorhus/merge-streams": "^2.1.0", + "fast-glob": "^3.3.2", + "ignore": "^5.2.4", + "path-type": "^5.0.0", + "slash": "^5.1.0", + "unicorn-magic": "^0.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -3418,15 +3163,6 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, - "node_modules/hard-rejection": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/hard-rejection/-/hard-rejection-2.1.0.tgz", - "integrity": "sha512-VIZB+ibDhx7ObhAe7OVtoEbuP4h/MuOTHJ+J8h/eBXotJYl0fBgR72xDFCKgIh22OJZIOVNxBMWuhAr10r8HdA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/has-bigints": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.1.0.tgz", @@ -3514,46 +3250,16 @@ "node": ">= 0.4" } }, - "node_modules/hosted-git-info": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", - "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", - "dev": true, - "dependencies": { - "lru-cache": "^6.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/hosted-git-info/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dev": true, - "dependencies": { - "yallist": "^4.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/hosted-git-info/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/icss-replace-symbols": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz", - "integrity": "sha512-chIaY3Vh2mh2Q3RGXttaDIzeiPvaVXJ+C4DAh/w3c37SKZ/U6PGMmuicR2EQQp9bKG8zLMCl7I+PtIoOOPp8Gg==", - "dev": true - }, - "node_modules/icss-utils": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", - "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", + "node_modules/icss-replace-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/icss-replace-symbols/-/icss-replace-symbols-1.1.0.tgz", + "integrity": "sha512-chIaY3Vh2mh2Q3RGXttaDIzeiPvaVXJ+C4DAh/w3c37SKZ/U6PGMmuicR2EQQp9bKG8zLMCl7I+PtIoOOPp8Gg==", + "dev": true + }, + "node_modules/icss-utils": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/icss-utils/-/icss-utils-5.1.0.tgz", + "integrity": "sha512-soFhflCVWLfRNOPU3iv5Z9VUdT44xFRbzjLsEzSr5AQmgqPMTHdU3PMT1Cf1ssx8fLNJDA1juftYl+PUcv3MqA==", "dev": true, "engines": { "node": "^10 || ^12 || >= 14" @@ -3610,35 +3316,6 @@ "node": ">=8" } }, - "node_modules/indent-string": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-5.0.0.tgz", - "integrity": "sha512-m6FAo/spmsW2Ab2fU35JTYwtOKa2yAwXSwgjSv1TJzh4Mh7mC3lzAOVLBprb72XsTrgkEIsl7YrFNAiDiRhIGg==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "deprecated": "This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, "node_modules/internal-slot": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.1.0.tgz", @@ -3931,15 +3608,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/is-plain-obj": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", - "integrity": "sha512-yvkRyxmFKEOQ4pNXCmJG5AEQNlXJS5LaONXo5/cLdTZdWvsZ1ioJEonLGAosKlMWE8lwUy/bJzMjcw8az73+Fg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/is-reference": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", @@ -4108,33 +3776,12 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, "node_modules/json-parse-better-errors": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "dev": true }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, - "node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/lilconfig": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", @@ -4144,12 +3791,6 @@ "node": ">=10" } }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, "node_modules/load-json-file": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", @@ -4196,21 +3837,6 @@ "node": ">= 12.13.0" } }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/lodash.camelcase": { "version": "4.3.0", "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", @@ -4244,18 +3870,6 @@ "@jridgewell/sourcemap-codec": "^1.5.0" } }, - "node_modules/map-obj": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/map-obj/-/map-obj-4.3.0.tgz", - "integrity": "sha512-hdN1wVrZbb29eBGiGjJbeP8JbKjq1urkHJ/LIP/NY48MZ1QVXUsQBV1G1zvYFHn1XE06cwjBsOI2K3Ulnj1YXQ==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -4281,38 +3895,12 @@ } }, "node_modules/meow": { - "version": "10.1.5", - "resolved": "https://registry.npmjs.org/meow/-/meow-10.1.5.tgz", - "integrity": "sha512-/d+PQ4GKmGvM9Bee/DPa8z3mXs/pkvJE2KEThngVNOqtmljC6K7NMPxtc2JeZYTmpWb9k/TmxjeL18ez3h7vCw==", - "dev": true, - "dependencies": { - "@types/minimist": "^1.2.2", - "camelcase-keys": "^7.0.0", - "decamelize": "^5.0.0", - "decamelize-keys": "^1.1.0", - "hard-rejection": "^2.1.0", - "minimist-options": "4.1.0", - "normalize-package-data": "^3.0.2", - "read-pkg-up": "^8.0.0", - "redent": "^4.0.0", - "trim-newlines": "^4.0.2", - "type-fest": "^1.2.2", - "yargs-parser": "^20.2.9" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/meow/node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", + "version": "13.2.0", + "resolved": "https://registry.npmjs.org/meow/-/meow-13.2.0.tgz", + "integrity": "sha512-pxQJQzB6djGPXh08dacEloMFopsOqGVRKFPYvPOt9XDZ1HasbgDZA74CJGreSU4G3Ak7EFJGoiH2auq+yXISgA==", "dev": true, "engines": { - "node": ">=10" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4340,6 +3928,18 @@ "node": ">=8.6" } }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/mime": { "version": "2.5.2", "resolved": "https://registry.npmjs.org/mime/-/mime-2.5.2.tgz", @@ -4352,29 +3952,6 @@ "node": ">=4.0.0" } }, - "node_modules/min-indent": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", - "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/minimist-options": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/minimist-options/-/minimist-options-4.1.0.tgz", - "integrity": "sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==", - "dev": true, - "dependencies": { - "arrify": "^1.0.1", - "is-plain-obj": "^1.1.0", - "kind-of": "^6.0.3" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -4418,21 +3995,6 @@ "integrity": "sha512-xxOWJsBKtzAq7DY0J+DTzuz58K8e7sJbdgwkbMWQe8UYB6ekmsQ45q0M/tJDsGaZmbC+l7n57UV8Hl5tHxO9uw==", "dev": true }, - "node_modules/normalize-package-data": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-3.0.3.tgz", - "integrity": "sha512-p2W1sgqij3zMMyRC067Dg16bfzVH+w7hyegmpIvZ4JNjqtGOVAIvLmjBx3yP7YTe9vKJgkoNOPjwQGogDoMXFA==", - "dev": true, - "dependencies": { - "hosted-git-info": "^4.0.1", - "is-core-module": "^2.5.0", - "semver": "^7.3.4", - "validate-npm-package-license": "^3.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/normalize-url": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-6.1.0.tgz", @@ -4683,15 +4245,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, "node_modules/open": { "version": "8.4.2", "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz", @@ -4743,46 +4296,13 @@ "node": ">=4" } }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/p-map": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-5.5.0.tgz", - "integrity": "sha512-VFqfGDHlx87K66yZrNdI4YGtD70IRyd+zSvgks6mzHPRNkoKy+9EKP4SFC77/vTTQYmRmti7dvqC+m5jBrBAcg==", + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz", + "integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==", "dev": true, - "dependencies": { - "aggregate-error": "^4.0.0" - }, "engines": { - "node": ">=12" + "node": ">=18" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -4816,42 +4336,6 @@ "node": ">=8" } }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/path-parse": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", @@ -4859,12 +4343,15 @@ "dev": true }, "node_modules/path-type": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", - "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", + "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true, "engines": { - "node": ">=8" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, "node_modules/pathe": { @@ -4889,23 +4376,12 @@ "dev": true }, "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/picomatch-browser": { - "version": "2.2.6", - "resolved": "https://registry.npmjs.org/picomatch-browser/-/picomatch-browser-2.2.6.tgz", - "integrity": "sha512-0ypsOQt9D4e3hziV8O4elD9uN0z/jtUEfxVRtNaAAtXIyUx9m/SzlO020i8YNL2aL/E6blOvvHQcin6HZlFy/w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", "dev": true, "engines": { - "node": ">=8.6" + "node": ">=12" }, "funding": { "url": "https://github.com/sponsors/jonschlinkert" @@ -5644,18 +5120,6 @@ } ] }, - "node_modules/quick-lru": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-5.1.1.tgz", - "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -5679,53 +5143,6 @@ "node": ">=4" } }, - "node_modules/read-pkg-up": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-8.0.0.tgz", - "integrity": "sha512-snVCqPczksT0HS2EC+SxUndvSzn6LRCwpfSvLrIfR5BKDQQZMaI6jPRC9dYvYFDRAuFEAnkwww8kBBNE/3VvzQ==", - "dev": true, - "dependencies": { - "find-up": "^5.0.0", - "read-pkg": "^6.0.0", - "type-fest": "^1.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/read-pkg": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-6.0.0.tgz", - "integrity": "sha512-X1Fu3dPuk/8ZLsMhEj5f4wFAF0DWoK7qhGJvgaijocXxBmSToKfbFtqbxMO7bVjNA1dmE5huAzjXj/ey86iw9Q==", - "dev": true, - "dependencies": { - "@types/normalize-package-data": "^2.4.0", - "normalize-package-data": "^3.0.2", - "parse-json": "^5.2.0", - "type-fest": "^1.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/read-pkg-up/node_modules/type-fest": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz", - "integrity": "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/read-pkg/node_modules/hosted-git-info": { "version": "2.8.9", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.9.tgz", @@ -5778,22 +5195,6 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/redent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/redent/-/redent-4.0.0.tgz", - "integrity": "sha512-tYkDkVVtYkSVhuQ4zBgfvciymHaeuel+zFKXShfDnFP5SyVEP7qo70Rf1jTOTCx3vGNAbnEi/xFkcfQVMIBWag==", - "dev": true, - "dependencies": { - "indent-string": "^5.0.0", - "strip-indent": "^4.0.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/reflect.getprototypeof": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.9.tgz", @@ -5872,65 +5273,6 @@ "node": ">=0.10.0" } }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "deprecated": "Rimraf versions prior to v4 are no longer supported", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", - "deprecated": "Glob versions prior to v9 are no longer supported", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, "node_modules/rolldown": { "version": "1.0.0-beta.1", "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.0.0-beta.1.tgz", @@ -6162,18 +5504,6 @@ "@parcel/watcher": "^2.4.1" } }, - "node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "dev": true, - "bin": { - "semver": "bin/semver.js" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/serialize-javascript": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", @@ -6306,12 +5636,12 @@ "dev": true }, "node_modules/slash": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-4.0.0.tgz", - "integrity": "sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", + "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", "dev": true, "engines": { - "node": ">=12" + "node": ">=14.16" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -6495,21 +5825,6 @@ "node": ">=8" } }, - "node_modules/strip-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-4.0.0.tgz", - "integrity": "sha512-mnVSV2l+Zv6BLpSD/8V87CW/y9EmmbYzGCIavsnsI6/nwn26DwffM/yztm30Z/I2DY9wdS3vXVCMnHDgZaVNoA==", - "dev": true, - "dependencies": { - "min-indent": "^1.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/style-inject": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/style-inject/-/style-inject-0.3.0.tgz", @@ -6671,18 +5986,6 @@ "node": ">=8.0" } }, - "node_modules/trim-newlines": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/trim-newlines/-/trim-newlines-4.1.1.tgz", - "integrity": "sha512-jRKj0n0jXWo6kh62nA5TEh3+4igKDXLvzBJcPpiizP7oOolUrYIxmVBG9TOtHYFHoddUk6YvAkGeGoSVTXfQXQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -6764,9 +6067,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", + "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -6800,6 +6103,18 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", "dev": true }, + "node_modules/unicorn-magic": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", + "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", + "dev": true, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/update-browserslist-db": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.1.1.tgz", @@ -7108,12 +6423,6 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, "node_modules/xxhashjs": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/xxhashjs/-/xxhashjs-0.2.2.tgz", @@ -7157,15 +6466,6 @@ "node": ">=12" } }, - "node_modules/yargs-parser": { - "version": "20.2.9", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", - "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/yargs/node_modules/yargs-parser": { "version": "21.1.1", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", @@ -7174,18 +6474,6 @@ "node": ">=12" } }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/zod": { "version": "3.24.1", "resolved": "https://registry.npmjs.org/zod/-/zod-3.24.1.tgz", diff --git a/package.json b/package.json index f6318d6..219f39a 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,6 @@ }, "dependencies": { "open": "^8.4.0", - "picomatch": "^2.3.1", "source-map": "^0.7.4", "yargs": "^17.5.1" }, @@ -46,11 +45,10 @@ } }, "devDependencies": { - "@rollup/plugin-alias": "^5.0.0", - "@rollup/plugin-commonjs": "^25.0.1", - "@rollup/plugin-node-resolve": "^15.0.0", + "@rollup/plugin-commonjs": "^28.0.0", + "@rollup/plugin-node-resolve": "^16.0.0", "@rollup/plugin-terser": "^0.4.4", - "@rollup/plugin-typescript": "^11.1.1", + "@rollup/plugin-typescript": "^12.0.0", "@types/bytes": "^3.1.1", "@types/d3-array": "^3.0.3", "@types/d3-color": "^3.1.0", @@ -59,7 +57,7 @@ "@types/d3-scale": "^4.0.2", "@types/d3-shape": "^3.1.0", "@types/node": "^18.8.5", - "@types/picomatch": "^2.3.0", + "@types/picomatch": "^3.0.0", "@types/yargs": "^17.0.10", "bytes": "^3.1.2", "d3-array": "^3.1.6", @@ -68,10 +66,10 @@ "d3-hierarchy": "^3.1.2", "d3-scale": "^4.0.2", "d3-shape": "^3.1.0", - "del-cli": "^5.0.0", + "del-cli": "^6.0.0", "npm-run-all": "^4.1.5", "oxlint": "^0.15.3", - "picomatch-browser": "^2.2.6", + "picomatch": "^4.0.2", "postcss": "^8.4.14", "postcss-url": "^10.1.3", "preact": "^10.7.2", @@ -81,7 +79,7 @@ "rollup-plugin-postcss": "^4.0.2", "sass": "^1.52.1", "tslib": "^2.8.1", - "typescript": "~5.3.2", + "typescript": "~5.7.2", "vitest": "^2.1.8" }, "engines": { diff --git a/rollup.config-dev.js b/rollup.config-dev.js index aa54387..b9effad 100644 --- a/rollup.config-dev.js +++ b/rollup.config-dev.js @@ -1,7 +1,6 @@ const commonJs = require("@rollup/plugin-commonjs"); const resolve = require("@rollup/plugin-node-resolve").default; const typescript = require("@rollup/plugin-typescript"); -const alias = require("@rollup/plugin-alias"); const postcss = require("rollup-plugin-postcss"); const postcssUrl = require("postcss-url"); @@ -26,9 +25,6 @@ module.exports = ALL_TEMPLATE.map((templateType) => ({ plugins: [ [ typescript({ tsconfig: "./src/tsconfig.json", noEmitOnError: true }), - alias({ - entries: [{ find: "picomatch", replacement: "picomatch-browser" }], - }), resolve({ mainFields: ["module", "main"] }), commonJs({ ignoreGlobal: true, diff --git a/rollup.config.js b/rollup.config.js index 7dedc46..f37a15e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,7 +1,6 @@ const commonJs = require("@rollup/plugin-commonjs"); const resolve = require("@rollup/plugin-node-resolve").default; const typescript = require("@rollup/plugin-typescript"); -const alias = require("@rollup/plugin-alias"); const postcss = require("rollup-plugin-postcss"); const postcssUrl = require("postcss-url"); @@ -14,9 +13,6 @@ module.exports = HTML_TEMPLATE.map((templateType) => ({ plugins: [ [ typescript({ tsconfig: "./src/tsconfig.json", noEmitOnError: true }), - alias({ - entries: [{ find: "picomatch", replacement: "picomatch-browser" }], - }), resolve({ mainFields: ["module", "main"] }), commonJs({ ignoreGlobal: true, diff --git a/test/__snapshots__/e2e-rolldown.test.ts.snap b/test/__snapshots__/e2e-rolldown.test.ts.snap index e6731d8..0c4a415 100644 --- a/test/__snapshots__/e2e-rolldown.test.ts.snap +++ b/test/__snapshots__/e2e-rolldown.test.ts.snap @@ -534,6276 +534,6856 @@ var drawChart = (function (exports) { return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; } - var utils$3 = {}; - - const WIN_SLASH = '\\\\\\\\/'; - const WIN_NO_SLASH = \`[^\${WIN_SLASH}]\`; - - /** - * Posix glob regex - */ - - const DOT_LITERAL = '\\\\.'; - const PLUS_LITERAL = '\\\\+'; - const QMARK_LITERAL = '\\\\?'; - const SLASH_LITERAL = '\\\\/'; - const ONE_CHAR = '(?=.)'; - const QMARK = '[^/]'; - const END_ANCHOR = \`(?:\${SLASH_LITERAL}|$)\`; - const START_ANCHOR = \`(?:^|\${SLASH_LITERAL})\`; - const DOTS_SLASH = \`\${DOT_LITERAL}{1,2}\${END_ANCHOR}\`; - const NO_DOT = \`(?!\${DOT_LITERAL})\`; - const NO_DOTS = \`(?!\${START_ANCHOR}\${DOTS_SLASH})\`; - const NO_DOT_SLASH = \`(?!\${DOT_LITERAL}{0,1}\${END_ANCHOR})\`; - const NO_DOTS_SLASH = \`(?!\${DOTS_SLASH})\`; - const QMARK_NO_DOT = \`[^.\${SLASH_LITERAL}]\`; - const STAR = \`\${QMARK}*?\`; - const SEP = '/'; - - const POSIX_CHARS = { - DOT_LITERAL, - PLUS_LITERAL, - QMARK_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - QMARK, - END_ANCHOR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK_NO_DOT, - STAR, - START_ANCHOR, - SEP - }; - - /** - * Windows glob regex - */ - - const WINDOWS_CHARS = { - ...POSIX_CHARS, - - SLASH_LITERAL: \`[\${WIN_SLASH}]\`, - QMARK: WIN_NO_SLASH, - STAR: \`\${WIN_NO_SLASH}*?\`, - DOTS_SLASH: \`\${DOT_LITERAL}{1,2}(?:[\${WIN_SLASH}]|$)\`, - NO_DOT: \`(?!\${DOT_LITERAL})\`, - NO_DOTS: \`(?!(?:^|[\${WIN_SLASH}])\${DOT_LITERAL}{1,2}(?:[\${WIN_SLASH}]|$))\`, - NO_DOT_SLASH: \`(?!\${DOT_LITERAL}{0,1}(?:[\${WIN_SLASH}]|$))\`, - NO_DOTS_SLASH: \`(?!\${DOT_LITERAL}{1,2}(?:[\${WIN_SLASH}]|$))\`, - QMARK_NO_DOT: \`[^.\${WIN_SLASH}]\`, - START_ANCHOR: \`(?:^|[\${WIN_SLASH}])\`, - END_ANCHOR: \`(?:[\${WIN_SLASH}]|$)\`, - SEP: '\\\\' - }; - - /** - * POSIX Bracket Regex - */ - - const POSIX_REGEX_SOURCE$1 = { - alnum: 'a-zA-Z0-9', - alpha: 'a-zA-Z', - ascii: '\\\\x00-\\\\x7F', - blank: ' \\\\t', - cntrl: '\\\\x00-\\\\x1F\\\\x7F', - digit: '0-9', - graph: '\\\\x21-\\\\x7E', - lower: 'a-z', - print: '\\\\x20-\\\\x7E ', - punct: '\\\\-!"#$%&\\'()\\\\*+,./:;<=>?@[\\\\]^_\`{|}~', - space: ' \\\\t\\\\r\\\\n\\\\v\\\\f', - upper: 'A-Z', - word: 'A-Za-z0-9_', - xdigit: 'A-Fa-f0-9' - }; - - var constants$3 = { - MAX_LENGTH: 1024 * 64, - POSIX_REGEX_SOURCE: POSIX_REGEX_SOURCE$1, - - // regular expressions - REGEX_BACKSLASH: /\\\\(?![*+?^\${}(|)[\\]])/g, - REGEX_NON_SPECIAL_CHARS: /^[^@![\\].,$*+?^{}()|\\\\/]+/, - REGEX_SPECIAL_CHARS: /[-*+?.^\${}(|)[\\]]/, - REGEX_SPECIAL_CHARS_BACKREF: /(\\\\?)((\\W)(\\3*))/g, - REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^\${}(|)[\\]])/g, - REGEX_REMOVE_BACKSLASH: /(?:\\[.*?[^\\\\]\\]|\\\\(?=.))/g, - - // Replace globs with equivalent patterns to reduce parsing time. - REPLACEMENTS: { - '***': '*', - '**/**': '**', - '**/**/**': '**' - }, - - // Digits - CHAR_0: 48, /* 0 */ - CHAR_9: 57, /* 9 */ - - // Alphabet chars. - CHAR_UPPERCASE_A: 65, /* A */ - CHAR_LOWERCASE_A: 97, /* a */ - CHAR_UPPERCASE_Z: 90, /* Z */ - CHAR_LOWERCASE_Z: 122, /* z */ - - CHAR_LEFT_PARENTHESES: 40, /* ( */ - CHAR_RIGHT_PARENTHESES: 41, /* ) */ - - CHAR_ASTERISK: 42, /* * */ - - // Non-alphabetic chars. - CHAR_AMPERSAND: 38, /* & */ - CHAR_AT: 64, /* @ */ - CHAR_BACKWARD_SLASH: 92, /* \\ */ - CHAR_CARRIAGE_RETURN: 13, /* \\r */ - CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ - CHAR_COLON: 58, /* : */ - CHAR_COMMA: 44, /* , */ - CHAR_DOT: 46, /* . */ - CHAR_DOUBLE_QUOTE: 34, /* " */ - CHAR_EQUAL: 61, /* = */ - CHAR_EXCLAMATION_MARK: 33, /* ! */ - CHAR_FORM_FEED: 12, /* \\f */ - CHAR_FORWARD_SLASH: 47, /* / */ - CHAR_GRAVE_ACCENT: 96, /* \` */ - CHAR_HASH: 35, /* # */ - CHAR_HYPHEN_MINUS: 45, /* - */ - CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ - CHAR_LEFT_CURLY_BRACE: 123, /* { */ - CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ - CHAR_LINE_FEED: 10, /* \\n */ - CHAR_NO_BREAK_SPACE: 160, /* \\u00A0 */ - CHAR_PERCENT: 37, /* % */ - CHAR_PLUS: 43, /* + */ - CHAR_QUESTION_MARK: 63, /* ? */ - CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ - CHAR_RIGHT_CURLY_BRACE: 125, /* } */ - CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ - CHAR_SEMICOLON: 59, /* ; */ - CHAR_SINGLE_QUOTE: 39, /* ' */ - CHAR_SPACE: 32, /* */ - CHAR_TAB: 9, /* \\t */ - CHAR_UNDERSCORE: 95, /* _ */ - CHAR_VERTICAL_LINE: 124, /* | */ - CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \\uFEFF */ - - /** - * Create EXTGLOB_CHARS - */ - - extglobChars(chars) { - return { - '!': { type: 'negate', open: '(?:(?!(?:', close: \`))\${chars.STAR})\` }, - '?': { type: 'qmark', open: '(?:', close: ')?' }, - '+': { type: 'plus', open: '(?:', close: ')+' }, - '*': { type: 'star', open: '(?:', close: ')*' }, - '@': { type: 'at', open: '(?:', close: ')' } - }; - }, - - /** - * Create GLOB_CHARS - */ - - globChars(win32) { - return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; - } - }; - - (function (exports) { - - const { - REGEX_BACKSLASH, - REGEX_REMOVE_BACKSLASH, - REGEX_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_GLOBAL - } = constants$3; - - exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); - exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); - exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); - exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\\\$1'); - exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); - - exports.removeBackslashes = str => { - return str.replace(REGEX_REMOVE_BACKSLASH, match => { - return match === '\\\\' ? '' : match; - }); + var utils = {}; + + var constants$1; + var hasRequiredConstants; + + function requireConstants () { + if (hasRequiredConstants) return constants$1; + hasRequiredConstants = 1; + + const WIN_SLASH = '\\\\\\\\/'; + const WIN_NO_SLASH = \`[^\${WIN_SLASH}]\`; + + /** + * Posix glob regex + */ + + const DOT_LITERAL = '\\\\.'; + const PLUS_LITERAL = '\\\\+'; + const QMARK_LITERAL = '\\\\?'; + const SLASH_LITERAL = '\\\\/'; + const ONE_CHAR = '(?=.)'; + const QMARK = '[^/]'; + const END_ANCHOR = \`(?:\${SLASH_LITERAL}|$)\`; + const START_ANCHOR = \`(?:^|\${SLASH_LITERAL})\`; + const DOTS_SLASH = \`\${DOT_LITERAL}{1,2}\${END_ANCHOR}\`; + const NO_DOT = \`(?!\${DOT_LITERAL})\`; + const NO_DOTS = \`(?!\${START_ANCHOR}\${DOTS_SLASH})\`; + const NO_DOT_SLASH = \`(?!\${DOT_LITERAL}{0,1}\${END_ANCHOR})\`; + const NO_DOTS_SLASH = \`(?!\${DOTS_SLASH})\`; + const QMARK_NO_DOT = \`[^.\${SLASH_LITERAL}]\`; + const STAR = \`\${QMARK}*?\`; + const SEP = '/'; + + const POSIX_CHARS = { + DOT_LITERAL, + PLUS_LITERAL, + QMARK_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + QMARK, + END_ANCHOR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK_NO_DOT, + STAR, + START_ANCHOR, + SEP }; - exports.supportsLookbehinds = () => { - const segs = process.version.slice(1).split('.').map(Number); - if (segs.length === 3 && segs[0] >= 9 || (segs[0] === 8 && segs[1] >= 10)) { - return true; - } - return false; + /** + * Windows glob regex + */ + + const WINDOWS_CHARS = { + ...POSIX_CHARS, + + SLASH_LITERAL: \`[\${WIN_SLASH}]\`, + QMARK: WIN_NO_SLASH, + STAR: \`\${WIN_NO_SLASH}*?\`, + DOTS_SLASH: \`\${DOT_LITERAL}{1,2}(?:[\${WIN_SLASH}]|$)\`, + NO_DOT: \`(?!\${DOT_LITERAL})\`, + NO_DOTS: \`(?!(?:^|[\${WIN_SLASH}])\${DOT_LITERAL}{1,2}(?:[\${WIN_SLASH}]|$))\`, + NO_DOT_SLASH: \`(?!\${DOT_LITERAL}{0,1}(?:[\${WIN_SLASH}]|$))\`, + NO_DOTS_SLASH: \`(?!\${DOT_LITERAL}{1,2}(?:[\${WIN_SLASH}]|$))\`, + QMARK_NO_DOT: \`[^.\${WIN_SLASH}]\`, + START_ANCHOR: \`(?:^|[\${WIN_SLASH}])\`, + END_ANCHOR: \`(?:[\${WIN_SLASH}]|$)\`, + SEP: '\\\\' }; - exports.escapeLast = (input, char, lastIdx) => { - const idx = input.lastIndexOf(char, lastIdx); - if (idx === -1) return input; - if (input[idx - 1] === '\\\\') return exports.escapeLast(input, char, idx - 1); - return \`\${input.slice(0, idx)}\\\\\${input.slice(idx)}\`; + /** + * POSIX Bracket Regex + */ + + const POSIX_REGEX_SOURCE = { + alnum: 'a-zA-Z0-9', + alpha: 'a-zA-Z', + ascii: '\\\\x00-\\\\x7F', + blank: ' \\\\t', + cntrl: '\\\\x00-\\\\x1F\\\\x7F', + digit: '0-9', + graph: '\\\\x21-\\\\x7E', + lower: 'a-z', + print: '\\\\x20-\\\\x7E ', + punct: '\\\\-!"#$%&\\'()\\\\*+,./:;<=>?@[\\\\]^_\`{|}~', + space: ' \\\\t\\\\r\\\\n\\\\v\\\\f', + upper: 'A-Z', + word: 'A-Za-z0-9_', + xdigit: 'A-Fa-f0-9' }; - exports.removePrefix = (input, state = {}) => { - let output = input; - if (output.startsWith('./')) { - output = output.slice(2); - state.prefix = './'; + constants$1 = { + MAX_LENGTH: 1024 * 64, + POSIX_REGEX_SOURCE, + + // regular expressions + REGEX_BACKSLASH: /\\\\(?![*+?^\${}(|)[\\]])/g, + REGEX_NON_SPECIAL_CHARS: /^[^@![\\].,$*+?^{}()|\\\\/]+/, + REGEX_SPECIAL_CHARS: /[-*+?.^\${}(|)[\\]]/, + REGEX_SPECIAL_CHARS_BACKREF: /(\\\\?)((\\W)(\\3*))/g, + REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^\${}(|)[\\]])/g, + REGEX_REMOVE_BACKSLASH: /(?:\\[.*?[^\\\\]\\]|\\\\(?=.))/g, + + // Replace globs with equivalent patterns to reduce parsing time. + REPLACEMENTS: { + '***': '*', + '**/**': '**', + '**/**/**': '**' + }, + + // Digits + CHAR_0: 48, /* 0 */ + CHAR_9: 57, /* 9 */ + + // Alphabet chars. + CHAR_UPPERCASE_A: 65, /* A */ + CHAR_LOWERCASE_A: 97, /* a */ + CHAR_UPPERCASE_Z: 90, /* Z */ + CHAR_LOWERCASE_Z: 122, /* z */ + + CHAR_LEFT_PARENTHESES: 40, /* ( */ + CHAR_RIGHT_PARENTHESES: 41, /* ) */ + + CHAR_ASTERISK: 42, /* * */ + + // Non-alphabetic chars. + CHAR_AMPERSAND: 38, /* & */ + CHAR_AT: 64, /* @ */ + CHAR_BACKWARD_SLASH: 92, /* \\ */ + CHAR_CARRIAGE_RETURN: 13, /* \\r */ + CHAR_CIRCUMFLEX_ACCENT: 94, /* ^ */ + CHAR_COLON: 58, /* : */ + CHAR_COMMA: 44, /* , */ + CHAR_DOT: 46, /* . */ + CHAR_DOUBLE_QUOTE: 34, /* " */ + CHAR_EQUAL: 61, /* = */ + CHAR_EXCLAMATION_MARK: 33, /* ! */ + CHAR_FORM_FEED: 12, /* \\f */ + CHAR_FORWARD_SLASH: 47, /* / */ + CHAR_GRAVE_ACCENT: 96, /* \` */ + CHAR_HASH: 35, /* # */ + CHAR_HYPHEN_MINUS: 45, /* - */ + CHAR_LEFT_ANGLE_BRACKET: 60, /* < */ + CHAR_LEFT_CURLY_BRACE: 123, /* { */ + CHAR_LEFT_SQUARE_BRACKET: 91, /* [ */ + CHAR_LINE_FEED: 10, /* \\n */ + CHAR_NO_BREAK_SPACE: 160, /* \\u00A0 */ + CHAR_PERCENT: 37, /* % */ + CHAR_PLUS: 43, /* + */ + CHAR_QUESTION_MARK: 63, /* ? */ + CHAR_RIGHT_ANGLE_BRACKET: 62, /* > */ + CHAR_RIGHT_CURLY_BRACE: 125, /* } */ + CHAR_RIGHT_SQUARE_BRACKET: 93, /* ] */ + CHAR_SEMICOLON: 59, /* ; */ + CHAR_SINGLE_QUOTE: 39, /* ' */ + CHAR_SPACE: 32, /* */ + CHAR_TAB: 9, /* \\t */ + CHAR_UNDERSCORE: 95, /* _ */ + CHAR_VERTICAL_LINE: 124, /* | */ + CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279, /* \\uFEFF */ + + /** + * Create EXTGLOB_CHARS + */ + + extglobChars(chars) { + return { + '!': { type: 'negate', open: '(?:(?!(?:', close: \`))\${chars.STAR})\` }, + '?': { type: 'qmark', open: '(?:', close: ')?' }, + '+': { type: 'plus', open: '(?:', close: ')+' }, + '*': { type: 'star', open: '(?:', close: ')*' }, + '@': { type: 'at', open: '(?:', close: ')' } + }; + }, + + /** + * Create GLOB_CHARS + */ + + globChars(win32) { + return win32 === true ? WINDOWS_CHARS : POSIX_CHARS; } - return output; + }; + return constants$1; + } + + /*global navigator*/ + + var hasRequiredUtils; + + function requireUtils () { + if (hasRequiredUtils) return utils; + hasRequiredUtils = 1; + (function (exports) { + + const { + REGEX_BACKSLASH, + REGEX_REMOVE_BACKSLASH, + REGEX_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_GLOBAL + } = /*@__PURE__*/ requireConstants(); + + exports.isObject = val => val !== null && typeof val === 'object' && !Array.isArray(val); + exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str); + exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str); + exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\\\$1'); + exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/'); + + exports.isWindows = () => { + if (typeof navigator !== 'undefined' && navigator.platform) { + const platform = navigator.platform.toLowerCase(); + return platform === 'win32' || platform === 'windows'; + } + + if (typeof process !== 'undefined' && process.platform) { + return process.platform === 'win32'; + } + + return false; + }; + + exports.removeBackslashes = str => { + return str.replace(REGEX_REMOVE_BACKSLASH, match => { + return match === '\\\\' ? '' : match; + }); + }; + + exports.escapeLast = (input, char, lastIdx) => { + const idx = input.lastIndexOf(char, lastIdx); + if (idx === -1) return input; + if (input[idx - 1] === '\\\\') return exports.escapeLast(input, char, idx - 1); + return \`\${input.slice(0, idx)}\\\\\${input.slice(idx)}\`; + }; + + exports.removePrefix = (input, state = {}) => { + let output = input; + if (output.startsWith('./')) { + output = output.slice(2); + state.prefix = './'; + } + return output; + }; + + exports.wrapOutput = (input, state = {}, options = {}) => { + const prepend = options.contains ? '' : '^'; + const append = options.contains ? '' : '$'; + + let output = \`\${prepend}(?:\${input})\${append}\`; + if (state.negated === true) { + output = \`(?:^(?!\${output}).*$)\`; + } + return output; + }; + + exports.basename = (path, { windows } = {}) => { + const segs = path.split(windows ? /[\\\\/]/ : '/'); + const last = segs[segs.length - 1]; + + if (last === '') { + return segs[segs.length - 2]; + } + + return last; + }; + } (utils)); + return utils; + } + + var scan_1; + var hasRequiredScan; + + function requireScan () { + if (hasRequiredScan) return scan_1; + hasRequiredScan = 1; + + const utils = /*@__PURE__*/ requireUtils(); + const { + CHAR_ASTERISK, /* * */ + CHAR_AT, /* @ */ + CHAR_BACKWARD_SLASH, /* \\ */ + CHAR_COMMA, /* , */ + CHAR_DOT, /* . */ + CHAR_EXCLAMATION_MARK, /* ! */ + CHAR_FORWARD_SLASH, /* / */ + CHAR_LEFT_CURLY_BRACE, /* { */ + CHAR_LEFT_PARENTHESES, /* ( */ + CHAR_LEFT_SQUARE_BRACKET, /* [ */ + CHAR_PLUS, /* + */ + CHAR_QUESTION_MARK, /* ? */ + CHAR_RIGHT_CURLY_BRACE, /* } */ + CHAR_RIGHT_PARENTHESES, /* ) */ + CHAR_RIGHT_SQUARE_BRACKET /* ] */ + } = /*@__PURE__*/ requireConstants(); + + const isPathSeparator = code => { + return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; }; - exports.wrapOutput = (input, state = {}, options = {}) => { - const prepend = options.contains ? '' : '^'; - const append = options.contains ? '' : '$'; - - let output = \`\${prepend}(?:\${input})\${append}\`; - if (state.negated === true) { - output = \`(?:^(?!\${output}).*$)\`; + const depth = token => { + if (token.isPrefix !== true) { + token.depth = token.isGlobstar ? Infinity : 1; } - return output; }; - exports.basename = (path, { windows } = {}) => { - if (windows) { - return path.replace(/[\\\\/]$/, '').replace(/.*[\\\\/]/, ''); - } else { - return path.replace(/\\/$/, '').replace(/.*\\//, ''); - } - }; - } (utils$3)); - - const utils$2 = utils$3; - const { - CHAR_ASTERISK, /* * */ - CHAR_AT, /* @ */ - CHAR_BACKWARD_SLASH, /* \\ */ - CHAR_COMMA, /* , */ - CHAR_DOT, /* . */ - CHAR_EXCLAMATION_MARK, /* ! */ - CHAR_FORWARD_SLASH, /* / */ - CHAR_LEFT_CURLY_BRACE, /* { */ - CHAR_LEFT_PARENTHESES, /* ( */ - CHAR_LEFT_SQUARE_BRACKET, /* [ */ - CHAR_PLUS, /* + */ - CHAR_QUESTION_MARK, /* ? */ - CHAR_RIGHT_CURLY_BRACE, /* } */ - CHAR_RIGHT_PARENTHESES, /* ) */ - CHAR_RIGHT_SQUARE_BRACKET /* ] */ - } = constants$3; - - const isPathSeparator = code => { - return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH; - }; - - const depth = token => { - if (token.isPrefix !== true) { - token.depth = token.isGlobstar ? Infinity : 1; - } - }; - - /** - * Quickly scans a glob pattern and returns an object with a handful of - * useful properties, like \`isGlob\`, \`path\` (the leading non-glob, if it exists), - * \`glob\` (the actual pattern), and \`negated\` (true if the path starts with \`!\`). - * - * \`\`\`js - * const pm = require('picomatch'); - * console.log(pm.scan('foo/bar/*.js')); - * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } - * \`\`\` - * @param {String} \`str\` - * @param {Object} \`options\` - * @return {Object} Returns an object with tokens and regex source string. - * @api public - */ - - const scan$1 = (input, options) => { - const opts = options || {}; - - const length = input.length - 1; - const scanToEnd = opts.parts === true || opts.scanToEnd === true; - const slashes = []; - const tokens = []; - const parts = []; - - let str = input; - let index = -1; - let start = 0; - let lastIndex = 0; - let isBrace = false; - let isBracket = false; - let isGlob = false; - let isExtglob = false; - let isGlobstar = false; - let braceEscaped = false; - let backslashes = false; - let negated = false; - let finished = false; - let braces = 0; - let prev; - let code; - let token = { value: '', depth: 0, isGlob: false }; - - const eos = () => index >= length; - const peek = () => str.charCodeAt(index + 1); - const advance = () => { - prev = code; - return str.charCodeAt(++index); - }; - - while (index < length) { - code = advance(); - let next; - - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - - if (code === CHAR_LEFT_CURLY_BRACE) { - braceEscaped = true; - } - continue; - } - - if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { - braces++; - - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } - - if (code === CHAR_LEFT_CURLY_BRACE) { - braces++; - continue; - } - - if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; - - if (scanToEnd === true) { - continue; - } - - break; - } - - if (braceEscaped !== true && code === CHAR_COMMA) { - isBrace = token.isBrace = true; - isGlob = token.isGlob = true; - finished = true; + /** + * Quickly scans a glob pattern and returns an object with a handful of + * useful properties, like \`isGlob\`, \`path\` (the leading non-glob, if it exists), + * \`glob\` (the actual pattern), \`negated\` (true if the path starts with \`!\` but not + * with \`!(\`) and \`negatedExtglob\` (true if the path starts with \`!(\`). + * + * \`\`\`js + * const pm = require('picomatch'); + * console.log(pm.scan('foo/bar/*.js')); + * { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' } + * \`\`\` + * @param {String} \`str\` + * @param {Object} \`options\` + * @return {Object} Returns an object with tokens and regex source string. + * @api public + */ + + const scan = (input, options) => { + const opts = options || {}; + + const length = input.length - 1; + const scanToEnd = opts.parts === true || opts.scanToEnd === true; + const slashes = []; + const tokens = []; + const parts = []; + + let str = input; + let index = -1; + let start = 0; + let lastIndex = 0; + let isBrace = false; + let isBracket = false; + let isGlob = false; + let isExtglob = false; + let isGlobstar = false; + let braceEscaped = false; + let backslashes = false; + let negated = false; + let negatedExtglob = false; + let finished = false; + let braces = 0; + let prev; + let code; + let token = { value: '', depth: 0, isGlob: false }; + + const eos = () => index >= length; + const peek = () => str.charCodeAt(index + 1); + const advance = () => { + prev = code; + return str.charCodeAt(++index); + }; + + while (index < length) { + code = advance(); + let next; + + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + + if (code === CHAR_LEFT_CURLY_BRACE) { + braceEscaped = true; + } + continue; + } + + if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) { + braces++; + + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (code === CHAR_LEFT_CURLY_BRACE) { + braces++; + continue; + } + + if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (braceEscaped !== true && code === CHAR_COMMA) { + isBrace = token.isBrace = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_RIGHT_CURLY_BRACE) { + braces--; + + if (braces === 0) { + braceEscaped = false; + isBrace = token.isBrace = true; + finished = true; + break; + } + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (code === CHAR_FORWARD_SLASH) { + slashes.push(index); + tokens.push(token); + token = { value: '', depth: 0, isGlob: false }; + + if (finished === true) continue; + if (prev === CHAR_DOT && index === (start + 1)) { + start += 2; + continue; + } + + lastIndex = index + 1; + continue; + } + + if (opts.noext !== true) { + const isExtglobChar = code === CHAR_PLUS + || code === CHAR_AT + || code === CHAR_ASTERISK + || code === CHAR_QUESTION_MARK + || code === CHAR_EXCLAMATION_MARK; + + if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + isExtglob = token.isExtglob = true; + finished = true; + if (code === CHAR_EXCLAMATION_MARK && index === start) { + negatedExtglob = true; + } + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + isGlob = token.isGlob = true; + finished = true; + break; + } + } + continue; + } + break; + } + } + + if (code === CHAR_ASTERISK) { + if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_QUESTION_MARK) { + isGlob = token.isGlob = true; + finished = true; + + if (scanToEnd === true) { + continue; + } + break; + } + + if (code === CHAR_LEFT_SQUARE_BRACKET) { + while (eos() !== true && (next = advance())) { + if (next === CHAR_BACKWARD_SLASH) { + backslashes = token.backslashes = true; + advance(); + continue; + } + + if (next === CHAR_RIGHT_SQUARE_BRACKET) { + isBracket = token.isBracket = true; + isGlob = token.isGlob = true; + finished = true; + break; + } + } + + if (scanToEnd === true) { + continue; + } + + break; + } + + if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { + negated = token.negated = true; + start++; + continue; + } + + if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { + isGlob = token.isGlob = true; + + if (scanToEnd === true) { + while (eos() !== true && (code = advance())) { + if (code === CHAR_LEFT_PARENTHESES) { + backslashes = token.backslashes = true; + code = advance(); + continue; + } + + if (code === CHAR_RIGHT_PARENTHESES) { + finished = true; + break; + } + } + continue; + } + break; + } + + if (isGlob === true) { + finished = true; + + if (scanToEnd === true) { + continue; + } + + break; + } + } - if (scanToEnd === true) { - continue; - } + if (opts.noext === true) { + isExtglob = false; + isGlob = false; + } - break; - } + let base = str; + let prefix = ''; + let glob = ''; - if (code === CHAR_RIGHT_CURLY_BRACE) { - braces--; + if (start > 0) { + prefix = str.slice(0, start); + str = str.slice(start); + lastIndex -= start; + } - if (braces === 0) { - braceEscaped = false; - isBrace = token.isBrace = true; - finished = true; - break; - } - } - } + if (base && isGlob === true && lastIndex > 0) { + base = str.slice(0, lastIndex); + glob = str.slice(lastIndex); + } else if (isGlob === true) { + base = ''; + glob = str; + } else { + base = str; + } - if (scanToEnd === true) { - continue; - } + if (base && base !== '' && base !== '/' && base !== str) { + if (isPathSeparator(base.charCodeAt(base.length - 1))) { + base = base.slice(0, -1); + } + } - break; - } + if (opts.unescape === true) { + if (glob) glob = utils.removeBackslashes(glob); - if (code === CHAR_FORWARD_SLASH) { - slashes.push(index); - tokens.push(token); - token = { value: '', depth: 0, isGlob: false }; + if (base && backslashes === true) { + base = utils.removeBackslashes(base); + } + } - if (finished === true) continue; - if (prev === CHAR_DOT && index === (start + 1)) { - start += 2; - continue; - } + const state = { + prefix, + input, + start, + base, + glob, + isBrace, + isBracket, + isGlob, + isExtglob, + isGlobstar, + negated, + negatedExtglob + }; + + if (opts.tokens === true) { + state.maxDepth = 0; + if (!isPathSeparator(code)) { + tokens.push(token); + } + state.tokens = tokens; + } - lastIndex = index + 1; - continue; - } + if (opts.parts === true || opts.tokens === true) { + let prevIndex; + + for (let idx = 0; idx < slashes.length; idx++) { + const n = prevIndex ? prevIndex + 1 : start; + const i = slashes[idx]; + const value = input.slice(n, i); + if (opts.tokens) { + if (idx === 0 && start !== 0) { + tokens[idx].isPrefix = true; + tokens[idx].value = prefix; + } else { + tokens[idx].value = value; + } + depth(tokens[idx]); + state.maxDepth += tokens[idx].depth; + } + if (idx !== 0 || value !== '') { + parts.push(value); + } + prevIndex = i; + } + + if (prevIndex && prevIndex + 1 < input.length) { + const value = input.slice(prevIndex + 1); + parts.push(value); + + if (opts.tokens) { + tokens[tokens.length - 1].value = value; + depth(tokens[tokens.length - 1]); + state.maxDepth += tokens[tokens.length - 1].depth; + } + } + + state.slashes = slashes; + state.parts = parts; + } - if (opts.noext !== true) { - const isExtglobChar = code === CHAR_PLUS - || code === CHAR_AT - || code === CHAR_ASTERISK - || code === CHAR_QUESTION_MARK - || code === CHAR_EXCLAMATION_MARK; + return state; + }; - if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; - isExtglob = token.isExtglob = true; - finished = true; + scan_1 = scan; + return scan_1; + } - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } + var parse_1; + var hasRequiredParse; - if (code === CHAR_RIGHT_PARENTHESES) { - isGlob = token.isGlob = true; - finished = true; - break; - } - } - continue; - } - break; - } - } + function requireParse () { + if (hasRequiredParse) return parse_1; + hasRequiredParse = 1; - if (code === CHAR_ASTERISK) { - if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true; - isGlob = token.isGlob = true; - finished = true; + const constants = /*@__PURE__*/ requireConstants(); + const utils = /*@__PURE__*/ requireUtils(); - if (scanToEnd === true) { - continue; - } - break; - } + /** + * Constants + */ - if (code === CHAR_QUESTION_MARK) { - isGlob = token.isGlob = true; - finished = true; + const { + MAX_LENGTH, + POSIX_REGEX_SOURCE, + REGEX_NON_SPECIAL_CHARS, + REGEX_SPECIAL_CHARS_BACKREF, + REPLACEMENTS + } = constants; + + /** + * Helpers + */ + + const expandRange = (args, options) => { + if (typeof options.expandRange === 'function') { + return options.expandRange(...args, options); + } - if (scanToEnd === true) { - continue; - } - break; - } + args.sort(); + const value = \`[\${args.join('-')}]\`; - if (code === CHAR_LEFT_SQUARE_BRACKET) { - while (eos() !== true && (next = advance())) { - if (next === CHAR_BACKWARD_SLASH) { - backslashes = token.backslashes = true; - advance(); - continue; - } + try { + /* eslint-disable-next-line no-new */ + new RegExp(value); + } catch (ex) { + return args.map(v => utils.escapeRegex(v)).join('..'); + } - if (next === CHAR_RIGHT_SQUARE_BRACKET) { - isBracket = token.isBracket = true; - isGlob = token.isGlob = true; - finished = true; + return value; + }; - if (scanToEnd === true) { - continue; - } - break; - } - } - } + /** + * Create the message for a syntax error + */ - if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) { - negated = token.negated = true; - start++; - continue; - } + const syntaxError = (type, char) => { + return \`Missing \${type}: "\${char}" - use "\\\\\\\\\${char}" to match literal characters\`; + }; - if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) { - isGlob = token.isGlob = true; + /** + * Parse the given input string. + * @param {String} input + * @param {Object} options + * @return {Object} + */ - if (scanToEnd === true) { - while (eos() !== true && (code = advance())) { - if (code === CHAR_LEFT_PARENTHESES) { - backslashes = token.backslashes = true; - code = advance(); - continue; - } + const parse = (input, options) => { + if (typeof input !== 'string') { + throw new TypeError('Expected a string'); + } - if (code === CHAR_RIGHT_PARENTHESES) { - finished = true; - break; - } - } - continue; - } - break; - } + input = REPLACEMENTS[input] || input; - if (isGlob === true) { - finished = true; + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - if (scanToEnd === true) { - continue; - } + let len = input.length; + if (len > max) { + throw new SyntaxError(\`Input length: \${len}, exceeds maximum allowed length: \${max}\`); + } - break; - } - } + const bos = { type: 'bos', value: '', output: opts.prepend || '' }; + const tokens = [bos]; + + const capture = opts.capture ? '' : '?:'; + + // create constants based on platform, for windows or posix + const PLATFORM_CHARS = constants.globChars(opts.windows); + const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS); + + const { + DOT_LITERAL, + PLUS_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOT_SLASH, + NO_DOTS_SLASH, + QMARK, + QMARK_NO_DOT, + STAR, + START_ANCHOR + } = PLATFORM_CHARS; + + const globstar = opts => { + return \`(\${capture}(?:(?!\${START_ANCHOR}\${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)\`; + }; + + const nodot = opts.dot ? '' : NO_DOT; + const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; + let star = opts.bash === true ? globstar(opts) : STAR; + + if (opts.capture) { + star = \`(\${star})\`; + } - if (opts.noext === true) { - isExtglob = false; - isGlob = false; - } + // minimatch options support + if (typeof opts.noext === 'boolean') { + opts.noextglob = opts.noext; + } - let base = str; - let prefix = ''; - let glob = ''; + const state = { + input, + index: -1, + start: 0, + dot: opts.dot === true, + consumed: '', + output: '', + prefix: '', + backtrack: false, + negated: false, + brackets: 0, + braces: 0, + parens: 0, + quotes: 0, + globstar: false, + tokens + }; + + input = utils.removePrefix(input, state); + len = input.length; + + const extglobs = []; + const braces = []; + const stack = []; + let prev = bos; + let value; + + /** + * Tokenizing helpers + */ + + const eos = () => state.index === len - 1; + const peek = state.peek = (n = 1) => input[state.index + n]; + const advance = state.advance = () => input[++state.index] || ''; + const remaining = () => input.slice(state.index + 1); + const consume = (value = '', num = 0) => { + state.consumed += value; + state.index += num; + }; + + const append = token => { + state.output += token.output != null ? token.output : token.value; + consume(token.value); + }; + + const negate = () => { + let count = 1; + + while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { + advance(); + state.start++; + count++; + } + + if (count % 2 === 0) { + return false; + } + + state.negated = true; + state.start++; + return true; + }; + + const increment = type => { + state[type]++; + stack.push(type); + }; + + const decrement = type => { + state[type]--; + stack.pop(); + }; + + /** + * Push tokens onto the tokens array. This helper speeds up + * tokenizing by 1) helping us avoid backtracking as much as possible, + * and 2) helping us avoid creating extra tokens when consecutive + * characters are plain text. This improves performance and simplifies + * lookbehinds. + */ + + const push = tok => { + if (prev.type === 'globstar') { + const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); + const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); + + if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { + state.output = state.output.slice(0, -prev.output.length); + prev.type = 'star'; + prev.value = '*'; + prev.output = star; + state.output += prev.output; + } + } + + if (extglobs.length && tok.type !== 'paren') { + extglobs[extglobs.length - 1].inner += tok.value; + } + + if (tok.value || tok.output) append(tok); + if (prev && prev.type === 'text' && tok.type === 'text') { + prev.output = (prev.output || prev.value) + tok.value; + prev.value += tok.value; + return; + } + + tok.prev = prev; + tokens.push(tok); + prev = tok; + }; + + const extglobOpen = (type, value) => { + const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; + + token.prev = prev; + token.parens = state.parens; + token.output = state.output; + const output = (opts.capture ? '(' : '') + token.open; + + increment('parens'); + push({ type, value, output: state.output ? '' : ONE_CHAR }); + push({ type: 'paren', extglob: true, value: advance(), output }); + extglobs.push(token); + }; + + const extglobClose = token => { + let output = token.close + (opts.capture ? ')' : ''); + let rest; + + if (token.type === 'negate') { + let extglobStar = star; + + if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { + extglobStar = globstar(opts); + } + + if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) { + output = token.close = \`)$))\${extglobStar}\`; + } + + if (token.inner.includes('*') && (rest = remaining()) && /^\\.[^\\\\/.]+$/.test(rest)) { + // Any non-magical string (\`.ts\`) or even nested expression (\`.{ts,tsx}\`) can follow after the closing parenthesis. + // In this case, we need to parse the string and use it in the output of the original pattern. + // Suitable patterns: \`/!(*.d).ts\`, \`/!(*.d).{ts,tsx}\`, \`**/!(*-dbg).@(js)\`. + // + // Disabling the \`fastpaths\` option due to a problem with parsing strings as \`.ts\` in the pattern like \`**/!(*.d).ts\`. + const expression = parse(rest, { ...options, fastpaths: false }).output; + + output = token.close = \`)\${expression})\${extglobStar})\`; + } + + if (token.prev.type === 'bos') { + state.negatedExtglob = true; + } + } + + push({ type: 'paren', extglob: true, value, output }); + decrement('parens'); + }; + + /** + * Fast paths + */ + + if (opts.fastpaths !== false && !/(^[*!]|[/()[\\]{}"])/.test(input)) { + let backslashes = false; + + let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { + if (first === '\\\\') { + backslashes = true; + return m; + } + + if (first === '?') { + if (esc) { + return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + } + if (index === 0) { + return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + } + return QMARK.repeat(chars.length); + } + + if (first === '.') { + return DOT_LITERAL.repeat(chars.length); + } + + if (first === '*') { + if (esc) { + return esc + first + (rest ? star : ''); + } + return star; + } + return esc ? m : \`\\\\\${m}\`; + }); + + if (backslashes === true) { + if (opts.unescape === true) { + output = output.replace(/\\\\/g, ''); + } else { + output = output.replace(/\\\\+/g, m => { + return m.length % 2 === 0 ? '\\\\\\\\' : (m ? '\\\\' : ''); + }); + } + } + + if (output === input && opts.contains === true) { + state.output = input; + return state; + } + + state.output = utils.wrapOutput(output, state, options); + return state; + } - if (start > 0) { - prefix = str.slice(0, start); - str = str.slice(start); - lastIndex -= start; - } + /** + * Tokenize input until we reach end-of-string + */ + + while (!eos()) { + value = advance(); + + if (value === '\\u0000') { + continue; + } + + /** + * Escaped characters + */ + + if (value === '\\\\') { + const next = peek(); + + if (next === '/' && opts.bash !== true) { + continue; + } + + if (next === '.' || next === ';') { + continue; + } + + if (!next) { + value += '\\\\'; + push({ type: 'text', value }); + continue; + } + + // collapse slashes to reduce potential for exploits + const match = /^\\\\+/.exec(remaining()); + let slashes = 0; + + if (match && match[0].length > 2) { + slashes = match[0].length; + state.index += slashes; + if (slashes % 2 !== 0) { + value += '\\\\'; + } + } + + if (opts.unescape === true) { + value = advance(); + } else { + value += advance(); + } + + if (state.brackets === 0) { + push({ type: 'text', value }); + continue; + } + } + + /** + * If we're inside a regex character class, continue + * until we reach the closing bracket. + */ + + if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { + if (opts.posix !== false && value === ':') { + const inner = prev.value.slice(1); + if (inner.includes('[')) { + prev.posix = true; + + if (inner.includes(':')) { + const idx = prev.value.lastIndexOf('['); + const pre = prev.value.slice(0, idx); + const rest = prev.value.slice(idx + 2); + const posix = POSIX_REGEX_SOURCE[rest]; + if (posix) { + prev.value = pre + posix; + state.backtrack = true; + advance(); + + if (!bos.output && tokens.indexOf(prev) === 1) { + bos.output = ONE_CHAR; + } + continue; + } + } + } + } + + if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { + value = \`\\\\\${value}\`; + } + + if (value === ']' && (prev.value === '[' || prev.value === '[^')) { + value = \`\\\\\${value}\`; + } + + if (opts.posix === true && value === '!' && prev.value === '[') { + value = '^'; + } + + prev.value += value; + append({ value }); + continue; + } + + /** + * If we're inside a quoted string, continue + * until we reach the closing double quote. + */ + + if (state.quotes === 1 && value !== '"') { + value = utils.escapeRegex(value); + prev.value += value; + append({ value }); + continue; + } + + /** + * Double quotes + */ + + if (value === '"') { + state.quotes = state.quotes === 1 ? 0 : 1; + if (opts.keepQuotes === true) { + push({ type: 'text', value }); + } + continue; + } + + /** + * Parentheses + */ + + if (value === '(') { + increment('parens'); + push({ type: 'paren', value }); + continue; + } + + if (value === ')') { + if (state.parens === 0 && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '(')); + } + + const extglob = extglobs[extglobs.length - 1]; + if (extglob && state.parens === extglob.parens + 1) { + extglobClose(extglobs.pop()); + continue; + } + + push({ type: 'paren', value, output: state.parens ? ')' : '\\\\)' }); + decrement('parens'); + continue; + } + + /** + * Square brackets + */ + + if (value === '[') { + if (opts.nobracket === true || !remaining().includes(']')) { + if (opts.nobracket !== true && opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('closing', ']')); + } + + value = \`\\\\\${value}\`; + } else { + increment('brackets'); + } + + push({ type: 'bracket', value }); + continue; + } + + if (value === ']') { + if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { + push({ type: 'text', value, output: \`\\\\\${value}\` }); + continue; + } + + if (state.brackets === 0) { + if (opts.strictBrackets === true) { + throw new SyntaxError(syntaxError('opening', '[')); + } + + push({ type: 'text', value, output: \`\\\\\${value}\` }); + continue; + } + + decrement('brackets'); + + const prevValue = prev.value.slice(1); + if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { + value = \`/\${value}\`; + } + + prev.value += value; + append({ value }); + + // when literal brackets are explicitly disabled + // assume we should match with a regex character class + if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) { + continue; + } + + const escaped = utils.escapeRegex(prev.value); + state.output = state.output.slice(0, -prev.value.length); + + // when literal brackets are explicitly enabled + // assume we should escape the brackets to match literal characters + if (opts.literalBrackets === true) { + state.output += escaped; + prev.value = escaped; + continue; + } + + // when the user specifies nothing, try to match both + prev.value = \`(\${capture}\${escaped}|\${prev.value})\`; + state.output += prev.value; + continue; + } + + /** + * Braces + */ + + if (value === '{' && opts.nobrace !== true) { + increment('braces'); + + const open = { + type: 'brace', + value, + output: '(', + outputIndex: state.output.length, + tokensIndex: state.tokens.length + }; + + braces.push(open); + push(open); + continue; + } + + if (value === '}') { + const brace = braces[braces.length - 1]; + + if (opts.nobrace === true || !brace) { + push({ type: 'text', value, output: value }); + continue; + } + + let output = ')'; + + if (brace.dots === true) { + const arr = tokens.slice(); + const range = []; + + for (let i = arr.length - 1; i >= 0; i--) { + tokens.pop(); + if (arr[i].type === 'brace') { + break; + } + if (arr[i].type !== 'dots') { + range.unshift(arr[i].value); + } + } + + output = expandRange(range, opts); + state.backtrack = true; + } + + if (brace.comma !== true && brace.dots !== true) { + const out = state.output.slice(0, brace.outputIndex); + const toks = state.tokens.slice(brace.tokensIndex); + brace.value = brace.output = '\\\\{'; + value = output = '\\\\}'; + state.output = out; + for (const t of toks) { + state.output += (t.output || t.value); + } + } + + push({ type: 'brace', value, output }); + decrement('braces'); + braces.pop(); + continue; + } + + /** + * Pipes + */ + + if (value === '|') { + if (extglobs.length > 0) { + extglobs[extglobs.length - 1].conditions++; + } + push({ type: 'text', value }); + continue; + } + + /** + * Commas + */ + + if (value === ',') { + let output = value; + + const brace = braces[braces.length - 1]; + if (brace && stack[stack.length - 1] === 'braces') { + brace.comma = true; + output = '|'; + } + + push({ type: 'comma', value, output }); + continue; + } + + /** + * Slashes + */ + + if (value === '/') { + // if the beginning of the glob is "./", advance the start + // to the current index, and don't add the "./" characters + // to the state. This greatly simplifies lookbehinds when + // checking for BOS characters like "!" and "." (not "./") + if (prev.type === 'dot' && state.index === state.start + 1) { + state.start = state.index + 1; + state.consumed = ''; + state.output = ''; + tokens.pop(); + prev = bos; // reset "prev" to the first token + continue; + } + + push({ type: 'slash', value, output: SLASH_LITERAL }); + continue; + } + + /** + * Dots + */ + + if (value === '.') { + if (state.braces > 0 && prev.type === 'dot') { + if (prev.value === '.') prev.output = DOT_LITERAL; + const brace = braces[braces.length - 1]; + prev.type = 'dots'; + prev.output += value; + prev.value += value; + brace.dots = true; + continue; + } + + if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { + push({ type: 'text', value, output: DOT_LITERAL }); + continue; + } + + push({ type: 'dot', value, output: DOT_LITERAL }); + continue; + } + + /** + * Question marks + */ + + if (value === '?') { + const isGroup = prev && prev.value === '('; + if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('qmark', value); + continue; + } + + if (prev && prev.type === 'paren') { + const next = peek(); + let output = value; + + if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\\w+>)/.test(remaining()))) { + output = \`\\\\\${value}\`; + } + + push({ type: 'text', value, output }); + continue; + } + + if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { + push({ type: 'qmark', value, output: QMARK_NO_DOT }); + continue; + } + + push({ type: 'qmark', value, output: QMARK }); + continue; + } + + /** + * Exclamation + */ + + if (value === '!') { + if (opts.noextglob !== true && peek() === '(') { + if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { + extglobOpen('negate', value); + continue; + } + } + + if (opts.nonegate !== true && state.index === 0) { + negate(); + continue; + } + } + + /** + * Plus + */ + + if (value === '+') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + extglobOpen('plus', value); + continue; + } + + if ((prev && prev.value === '(') || opts.regex === false) { + push({ type: 'plus', value, output: PLUS_LITERAL }); + continue; + } + + if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { + push({ type: 'plus', value }); + continue; + } + + push({ type: 'plus', value: PLUS_LITERAL }); + continue; + } + + /** + * Plain text + */ + + if (value === '@') { + if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { + push({ type: 'at', extglob: true, value, output: '' }); + continue; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Plain text + */ + + if (value !== '*') { + if (value === '$' || value === '^') { + value = \`\\\\\${value}\`; + } + + const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); + if (match) { + value += match[0]; + state.index += match[0].length; + } + + push({ type: 'text', value }); + continue; + } + + /** + * Stars + */ + + if (prev && (prev.type === 'globstar' || prev.star === true)) { + prev.type = 'star'; + prev.star = true; + prev.value += value; + prev.output = star; + state.backtrack = true; + state.globstar = true; + consume(value); + continue; + } + + let rest = remaining(); + if (opts.noextglob !== true && /^\\([^?]/.test(rest)) { + extglobOpen('star', value); + continue; + } + + if (prev.type === 'star') { + if (opts.noglobstar === true) { + consume(value); + continue; + } + + const prior = prev.prev; + const before = prior.prev; + const isStart = prior.type === 'slash' || prior.type === 'bos'; + const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + + if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { + push({ type: 'star', value, output: '' }); + continue; + } + + const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); + const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); + if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { + push({ type: 'star', value, output: '' }); + continue; + } + + // strip consecutive \`/**/\` + while (rest.slice(0, 3) === '/**') { + const after = input[state.index + 4]; + if (after && after !== '/') { + break; + } + rest = rest.slice(3); + consume('/**', 3); + } + + if (prior.type === 'bos' && eos()) { + prev.type = 'globstar'; + prev.value += value; + prev.output = globstar(opts); + state.output = prev.output; + state.globstar = true; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = \`(?:\${prior.output}\`; + + prev.type = 'globstar'; + prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); + prev.value += value; + state.globstar = true; + state.output += prior.output + prev.output; + consume(value); + continue; + } + + if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { + const end = rest[1] !== void 0 ? '|$' : ''; + + state.output = state.output.slice(0, -(prior.output + prev.output).length); + prior.output = \`(?:\${prior.output}\`; + + prev.type = 'globstar'; + prev.output = \`\${globstar(opts)}\${SLASH_LITERAL}|\${SLASH_LITERAL}\${end})\`; + prev.value += value; + + state.output += prior.output + prev.output; + state.globstar = true; + + consume(value + advance()); + + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + if (prior.type === 'bos' && rest[0] === '/') { + prev.type = 'globstar'; + prev.value += value; + prev.output = \`(?:^|\${SLASH_LITERAL}|\${globstar(opts)}\${SLASH_LITERAL})\`; + state.output = prev.output; + state.globstar = true; + consume(value + advance()); + push({ type: 'slash', value: '/', output: '' }); + continue; + } + + // remove single star from output + state.output = state.output.slice(0, -prev.output.length); + + // reset previous token to globstar + prev.type = 'globstar'; + prev.output = globstar(opts); + prev.value += value; + + // reset output with globstar + state.output += prev.output; + state.globstar = true; + consume(value); + continue; + } + + const token = { type: 'star', value, output: star }; + + if (opts.bash === true) { + token.output = '.*?'; + if (prev.type === 'bos' || prev.type === 'slash') { + token.output = nodot + token.output; + } + push(token); + continue; + } + + if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { + token.output = value; + push(token); + continue; + } + + if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { + if (prev.type === 'dot') { + state.output += NO_DOT_SLASH; + prev.output += NO_DOT_SLASH; + + } else if (opts.dot === true) { + state.output += NO_DOTS_SLASH; + prev.output += NO_DOTS_SLASH; + + } else { + state.output += nodot; + prev.output += nodot; + } + + if (peek() !== '*') { + state.output += ONE_CHAR; + prev.output += ONE_CHAR; + } + } + + push(token); + } - if (base && isGlob === true && lastIndex > 0) { - base = str.slice(0, lastIndex); - glob = str.slice(lastIndex); - } else if (isGlob === true) { - base = ''; - glob = str; - } else { - base = str; - } + while (state.brackets > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); + state.output = utils.escapeLast(state.output, '['); + decrement('brackets'); + } - if (base && base !== '' && base !== '/' && base !== str) { - if (isPathSeparator(base.charCodeAt(base.length - 1))) { - base = base.slice(0, -1); - } - } + while (state.parens > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); + state.output = utils.escapeLast(state.output, '('); + decrement('parens'); + } - if (opts.unescape === true) { - if (glob) glob = utils$2.removeBackslashes(glob); + while (state.braces > 0) { + if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); + state.output = utils.escapeLast(state.output, '{'); + decrement('braces'); + } - if (base && backslashes === true) { - base = utils$2.removeBackslashes(base); - } - } + if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { + push({ type: 'maybe_slash', value: '', output: \`\${SLASH_LITERAL}?\` }); + } - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated - }; + // rebuild the output if we had to backtrack at any point + if (state.backtrack === true) { + state.output = ''; - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); - } - state.tokens = tokens; - } + for (const token of state.tokens) { + state.output += token.output != null ? token.output : token.value; - if (opts.parts === true || opts.tokens === true) { - let prevIndex; + if (token.suffix) { + state.output += token.suffix; + } + } + } - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; - } - if (idx !== 0 || value !== '') { - parts.push(value); - } - prevIndex = i; - } + return state; + }; - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); + /** + * Fast paths for creating regular expressions for common glob patterns. + * This can significantly speed up processing and has very little downside + * impact when none of the fast paths match. + */ + + parse.fastpaths = (input, options) => { + const opts = { ...options }; + const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const len = input.length; + if (len > max) { + throw new SyntaxError(\`Input length: \${len}, exceeds maximum allowed length: \${max}\`); + } - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; - } - } + input = REPLACEMENTS[input] || input; + + // create constants based on platform, for windows or posix + const { + DOT_LITERAL, + SLASH_LITERAL, + ONE_CHAR, + DOTS_SLASH, + NO_DOT, + NO_DOTS, + NO_DOTS_SLASH, + STAR, + START_ANCHOR + } = constants.globChars(opts.windows); + + const nodot = opts.dot ? NO_DOTS : NO_DOT; + const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; + const capture = opts.capture ? '' : '?:'; + const state = { negated: false, prefix: '' }; + let star = opts.bash === true ? '.*?' : STAR; + + if (opts.capture) { + star = \`(\${star})\`; + } - state.slashes = slashes; - state.parts = parts; - } + const globstar = opts => { + if (opts.noglobstar === true) return star; + return \`(\${capture}(?:(?!\${START_ANCHOR}\${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)\`; + }; - return state; - }; + const create = str => { + switch (str) { + case '*': + return \`\${nodot}\${ONE_CHAR}\${star}\`; - var scan_1 = scan$1; + case '.*': + return \`\${DOT_LITERAL}\${ONE_CHAR}\${star}\`; - const constants$2 = constants$3; - const utils$1 = utils$3; + case '*.*': + return \`\${nodot}\${star}\${DOT_LITERAL}\${ONE_CHAR}\${star}\`; - /** - * Constants - */ + case '*/*': + return \`\${nodot}\${star}\${SLASH_LITERAL}\${ONE_CHAR}\${slashDot}\${star}\`; - const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS - } = constants$2; + case '**': + return nodot + globstar(opts); - /** - * Helpers - */ + case '**/*': + return \`(?:\${nodot}\${globstar(opts)}\${SLASH_LITERAL})?\${slashDot}\${ONE_CHAR}\${star}\`; - const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } + case '**/*.*': + return \`(?:\${nodot}\${globstar(opts)}\${SLASH_LITERAL})?\${slashDot}\${star}\${DOT_LITERAL}\${ONE_CHAR}\${star}\`; - args.sort(); - const value = \`[\${args.join('-')}]\`; + case '**/.*': + return \`(?:\${nodot}\${globstar(opts)}\${SLASH_LITERAL})?\${DOT_LITERAL}\${ONE_CHAR}\${star}\`; - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils$1.escapeRegex(v)).join('..'); - } + default: { + const match = /^(.*?)\\.(\\w+)$/.exec(str); + if (!match) return; - return value; - }; + const source = create(match[1]); + if (!source) return; - /** - * Create the message for a syntax error - */ + return source + DOT_LITERAL + match[2]; + } + } + }; - const syntaxError = (type, char) => { - return \`Missing \${type}: "\${char}" - use "\\\\\\\\\${char}" to match literal characters\`; - }; + const output = utils.removePrefix(input, state); + let source = create(output); - /** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ + if (source && opts.strictSlashes !== true) { + source += \`\${SLASH_LITERAL}?\`; + } - const parse$2 = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } + return source; + }; - input = REPLACEMENTS[input] || input; + parse_1 = parse; + return parse_1; + } + + var picomatch_1$1; + var hasRequiredPicomatch$1; + + function requirePicomatch$1 () { + if (hasRequiredPicomatch$1) return picomatch_1$1; + hasRequiredPicomatch$1 = 1; + + const scan = /*@__PURE__*/ requireScan(); + const parse = /*@__PURE__*/ requireParse(); + const utils = /*@__PURE__*/ requireUtils(); + const constants = /*@__PURE__*/ requireConstants(); + const isObject = val => val && typeof val === 'object' && !Array.isArray(val); + + /** + * Creates a matcher function from one or more glob patterns. The + * returned function takes a string to match as its first argument, + * and returns true if the string is a match. The returned matcher + * function also takes a boolean as the second argument that, when true, + * returns an object with additional information. + * + * \`\`\`js + * const picomatch = require('picomatch'); + * // picomatch(glob[, options]); + * + * const isMatch = picomatch('*.!(*a)'); + * console.log(isMatch('a.a')); //=> false + * console.log(isMatch('a.b')); //=> true + * \`\`\` + * @name picomatch + * @param {String|Array} \`globs\` One or more glob patterns. + * @param {Object=} \`options\` + * @return {Function=} Returns a matcher function. + * @api public + */ + + const picomatch = (glob, options, returnState = false) => { + if (Array.isArray(glob)) { + const fns = glob.map(input => picomatch(input, options, returnState)); + const arrayMatcher = str => { + for (const isMatch of fns) { + const state = isMatch(str); + if (state) return state; + } + return false; + }; + return arrayMatcher; + } - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; + const isState = isObject(glob) && glob.tokens && glob.input; - let len = input.length; - if (len > max) { - throw new SyntaxError(\`Input length: \${len}, exceeds maximum allowed length: \${max}\`); - } + if (glob === '' || (typeof glob !== 'string' && !isState)) { + throw new TypeError('Expected pattern to be a non-empty string'); + } - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; + const opts = options || {}; + const posix = opts.windows; + const regex = isState + ? picomatch.compileRe(glob, options) + : picomatch.makeRe(glob, options, false, true); - const capture = opts.capture ? '' : '?:'; + const state = regex.state; + delete regex.state; - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants$2.globChars(opts.windows); - const EXTGLOB_CHARS = constants$2.extglobChars(PLATFORM_CHARS); + let isIgnored = () => false; + if (opts.ignore) { + const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; + isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + } - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; + const matcher = (input, returnObject = false) => { + const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); + const result = { glob, state, regex, posix, input, output, match, isMatch }; + + if (typeof opts.onResult === 'function') { + opts.onResult(result); + } + + if (isMatch === false) { + result.isMatch = false; + return returnObject ? result : false; + } + + if (isIgnored(input)) { + if (typeof opts.onIgnore === 'function') { + opts.onIgnore(result); + } + result.isMatch = false; + return returnObject ? result : false; + } + + if (typeof opts.onMatch === 'function') { + opts.onMatch(result); + } + return returnObject ? result : true; + }; + + if (returnState) { + matcher.state = state; + } - const globstar = (opts) => { - return \`(\${capture}(?:(?!\${START_ANCHOR}\${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)\`; - }; + return matcher; + }; - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; + /** + * Test \`input\` with the given \`regex\`. This is used by the main + * \`picomatch()\` function to test the input string. + * + * \`\`\`js + * const picomatch = require('picomatch'); + * // picomatch.test(input, regex[, options]); + * + * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\\/([^/]*?))$/)); + * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } + * \`\`\` + * @param {String} \`input\` String to test. + * @param {RegExp} \`regex\` + * @return {Object} Returns an object with matching info. + * @api public + */ + + picomatch.test = (input, regex, options, { glob, posix } = {}) => { + if (typeof input !== 'string') { + throw new TypeError('Expected input to be a string'); + } - if (opts.capture) { - star = \`(\${star})\`; - } + if (input === '') { + return { isMatch: false, output: '' }; + } - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; - } + const opts = options || {}; + const format = opts.format || (posix ? utils.toPosixSlashes : null); + let match = input === glob; + let output = (match && format) ? format(input) : input; - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; + if (match === false) { + output = format ? format(input) : input; + match = output === glob; + } - input = utils$1.removePrefix(input, state); - len = input.length; + if (match === false || opts.capture === true) { + if (opts.matchBase === true || opts.basename === true) { + match = picomatch.matchBase(input, regex, options, posix); + } else { + match = regex.exec(output); + } + } - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; + return { isMatch: Boolean(match), match, output }; + }; - /** - * Tokenizing helpers - */ + /** + * Match the basename of a filepath. + * + * \`\`\`js + * const picomatch = require('picomatch'); + * // picomatch.matchBase(input, glob[, options]); + * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true + * \`\`\` + * @param {String} \`input\` String to test. + * @param {RegExp|String} \`glob\` Glob pattern or regex created by [.makeRe](#makeRe). + * @return {Boolean} + * @api public + */ + + picomatch.matchBase = (input, glob, options) => { + const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); + return regex.test(utils.basename(input)); + }; - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index]; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; + /** + * Returns true if **any** of the given glob \`patterns\` match the specified \`string\`. + * + * \`\`\`js + * const picomatch = require('picomatch'); + * // picomatch.isMatch(string, patterns[, options]); + * + * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true + * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false + * \`\`\` + * @param {String|Array} str The string to test. + * @param {String|Array} patterns One or more glob patterns to use for matching. + * @param {Object} [options] See available [options](#options). + * @return {Boolean} Returns true if any patterns match \`str\` + * @api public + */ + + picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); + + /** + * Parse a glob pattern to create the source string for a regular + * expression. + * + * \`\`\`js + * const picomatch = require('picomatch'); + * const result = picomatch.parse(pattern[, options]); + * \`\`\` + * @param {String} \`pattern\` + * @param {Object} \`options\` + * @return {Object} Returns an object with useful properties and output to be used as a regex source string. + * @api public + */ + + picomatch.parse = (pattern, options) => { + if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); + return parse(pattern, { ...options, fastpaths: false }); + }; - const negate = () => { - let count = 1; + /** + * Scan a glob pattern to separate the pattern into segments. + * + * \`\`\`js + * const picomatch = require('picomatch'); + * // picomatch.scan(input[, options]); + * + * const result = picomatch.scan('!./foo/*.js'); + * console.log(result); + * { prefix: '!./', + * input: '!./foo/*.js', + * start: 3, + * base: 'foo', + * glob: '*.js', + * isBrace: false, + * isBracket: false, + * isGlob: true, + * isExtglob: false, + * isGlobstar: false, + * negated: true } + * \`\`\` + * @param {String} \`input\` Glob pattern to scan. + * @param {Object} \`options\` + * @return {Object} Returns an object with + * @api public + */ + + picomatch.scan = (input, options) => scan(input, options); + + /** + * Compile a regular expression from the \`state\` object returned by the + * [parse()](#parse) method. + * + * @param {Object} \`state\` + * @param {Object} \`options\` + * @param {Boolean} \`returnOutput\` Intended for implementors, this argument allows you to return the raw output from the parser. + * @param {Boolean} \`returnState\` Adds the state to a \`state\` property on the returned regex. Useful for implementors and debugging. + * @return {RegExp} + * @api public + */ + + picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => { + if (returnOutput === true) { + return state.output; + } - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } + const opts = options || {}; + const prepend = opts.contains ? '' : '^'; + const append = opts.contains ? '' : '$'; - if (count % 2 === 0) { - return false; - } + let source = \`\${prepend}(?:\${state.output})\${append}\`; + if (state && state.negated === true) { + source = \`^(?!\${source}).*$\`; + } - state.negated = true; - state.start++; - return true; - }; + const regex = picomatch.toRegex(source, options); + if (returnState === true) { + regex.state = state; + } - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ + return regex; + }; - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); + /** + * Create a regular expression from a parsed glob pattern. + * + * \`\`\`js + * const picomatch = require('picomatch'); + * const state = picomatch.parse('*.js'); + * // picomatch.compileRe(state[, options]); + * + * console.log(picomatch.compileRe(state)); + * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/ + * \`\`\` + * @param {String} \`state\` The object returned from the \`.parse\` method. + * @param {Object} \`options\` + * @param {Boolean} \`returnOutput\` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result. + * @param {Boolean} \`returnState\` Implementors may use this argument to return the state from the parsed glob with the returned regular expression. + * @return {RegExp} Returns a regex created from the given pattern. + * @api public + */ + + picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => { + if (!input || typeof input !== 'string') { + throw new TypeError('Expected a non-empty string'); + } - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } + let parsed = { negated: false, fastpaths: true }; - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; - } + if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { + parsed.output = parse.fastpaths(input, options); + } - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } + if (!parsed.output) { + parsed = parse(input, options); + } - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; + return picomatch.compileRe(parsed, options, returnOutput, returnState); + }; - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; + /** + * Create a regular expression from the given regex source string. + * + * \`\`\`js + * const picomatch = require('picomatch'); + * // picomatch.toRegex(source[, options]); + * + * const { output } = picomatch.parse('*.js'); + * console.log(picomatch.toRegex(output)); + * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/ + * \`\`\` + * @param {String} \`source\` Regular expression source string. + * @param {Object} \`options\` + * @return {RegExp} + * @api public + */ + + picomatch.toRegex = (source, options) => { + try { + const opts = options || {}; + return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); + } catch (err) { + if (options && options.debug === true) throw err; + return /$^/; + } + }; - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; + /** + * Picomatch constants. + * @return {Object} + */ - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; + picomatch.constants = constants; - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); + /** + * Expose "picomatch" + */ - if (token.type === 'negate') { - let extglobStar = star; + picomatch_1$1 = picomatch; + return picomatch_1$1; + } - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } + var picomatch_1; + var hasRequiredPicomatch; - if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) { - output = token.close = \`)$))\${extglobStar}\`; - } + function requirePicomatch () { + if (hasRequiredPicomatch) return picomatch_1; + hasRequiredPicomatch = 1; - if (token.prev.type === 'bos' && eos()) { - state.negatedExtglob = true; - } - } + const pico = /*@__PURE__*/ requirePicomatch$1(); + const utils = /*@__PURE__*/ requireUtils(); - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; + function picomatch(glob, options, returnState = false) { + // default to os.platform() + if (options && (options.windows === null || options.windows === undefined)) { + // don't mutate the original options object + options = { ...options, windows: utils.isWindows() }; + } - /** - * Fast paths - */ + return pico(glob, options, returnState); + } - if (opts.fastpaths !== false && !/(^[*!]|[/()[\\]{}"])/.test(input)) { - let backslashes = false; + Object.assign(picomatch, pico); + picomatch_1 = picomatch; + return picomatch_1; + } - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\\\') { - backslashes = true; - return m; - } + var picomatchExports = /*@__PURE__*/ requirePicomatch(); + var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports); - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); + function isArray(arg) { + return Array.isArray(arg); + } + function ensureArray(thing) { + if (isArray(thing)) + return thing; + if (thing == null) + return []; + return [thing]; + } + const globToTest = (glob) => { + const pattern = glob; + const fn = pm(pattern, { dot: true }); + return { + test: (what) => { + const result = fn(what); + return result; + }, + }; + }; + const testTrue = { + test: () => true, + }; + const getMatcher = (filter) => { + const bundleTest = "bundle" in filter && filter.bundle != null ? globToTest(filter.bundle) : testTrue; + const fileTest = "file" in filter && filter.file != null ? globToTest(filter.file) : testTrue; + return { bundleTest, fileTest }; + }; + const createFilter = (include, exclude) => { + const includeMatchers = ensureArray(include).map(getMatcher); + const excludeMatchers = ensureArray(exclude).map(getMatcher); + return (bundleId, id) => { + for (let i = 0; i < excludeMatchers.length; ++i) { + const { bundleTest, fileTest } = excludeMatchers[i]; + if (bundleTest.test(bundleId) && fileTest.test(id)) + return false; } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); + for (let i = 0; i < includeMatchers.length; ++i) { + const { bundleTest, fileTest } = includeMatchers[i]; + if (bundleTest.test(bundleId) && fileTest.test(id)) + return true; } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } + return !includeMatchers.length; + }; + }; - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : \`\\\\\${m}\`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\\\/g, ''); - } else { - output = output.replace(/\\\\+/g, m => { - return m.length % 2 === 0 ? '\\\\\\\\' : (m ? '\\\\' : ''); - }); - } - } - - if (output === input && opts.contains === true) { - state.output = input; - return state; - } - - state.output = utils$1.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\\u0000') { - continue; - } - - /** - * Escaped characters - */ - - if (value === '\\\\') { - const next = peek(); - - if (next === '/' && opts.bash !== true) { - continue; - } - - if (next === '.' || next === ';') { - continue; - } - - if (!next) { - value += '\\\\'; - push({ type: 'text', value }); - continue; - } - - // collapse slashes to reduce potential for exploits - const match = /^\\\\+/.exec(remaining()); - let slashes = 0; - - if (match && match[0].length > 2) { - slashes = match[0].length; - state.index += slashes; - if (slashes % 2 !== 0) { - value += '\\\\'; + const throttleFilter = (callback, limit) => { + let waiting = false; + return (val) => { + if (!waiting) { + callback(val); + waiting = true; + setTimeout(() => { + waiting = false; + }, limit); } - } - - if (opts.unescape === true) { - value = advance() || ''; - } else { - value += advance() || ''; - } - - if (state.brackets === 0) { - push({ type: 'text', value }); - continue; - } - } - - /** - * If we're inside a regex character class, continue - * until we reach the closing bracket. - */ - - if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) { - if (opts.posix !== false && value === ':') { - const inner = prev.value.slice(1); - if (inner.includes('[')) { - prev.posix = true; - - if (inner.includes(':')) { - const idx = prev.value.lastIndexOf('['); - const pre = prev.value.slice(0, idx); - const rest = prev.value.slice(idx + 2); - const posix = POSIX_REGEX_SOURCE[rest]; - if (posix) { - prev.value = pre + posix; - state.backtrack = true; - advance(); - - if (!bos.output && tokens.indexOf(prev) === 1) { - bos.output = ONE_CHAR; - } - continue; - } - } + }; + }; + const prepareFilter = (filt) => { + if (filt === "") + return []; + return (filt + .split(",") + // remove spaces before and after + .map((entry) => entry.trim()) + // unquote " + .map((entry) => entry.startsWith('"') && entry.endsWith('"') ? entry.substring(1, entry.length - 1) : entry) + // unquote ' + .map((entry) => entry.startsWith("'") && entry.endsWith("'") ? entry.substring(1, entry.length - 1) : entry) + // remove empty strings + .filter((entry) => entry) + // parse bundle:file + .map((entry) => entry.split(":")) + // normalize entry just in case + .flatMap((entry) => { + if (entry.length === 0) + return []; + let bundle = null; + let file = null; + if (entry.length === 1 && entry[0]) { + file = entry[0]; + return [{ file, bundle }]; } - } - - if ((value === '[' && peek() !== ':') || (value === '-' && peek() === ']')) { - value = \`\\\\\${value}\`; - } - - if (value === ']' && (prev.value === '[' || prev.value === '[^')) { - value = \`\\\\\${value}\`; - } - - if (opts.posix === true && value === '!' && prev.value === '[') { - value = '^'; - } - - prev.value += value; - append({ value }); - continue; - } - - /** - * If we're inside a quoted string, continue - * until we reach the closing double quote. - */ - - if (state.quotes === 1 && value !== '"') { - value = utils$1.escapeRegex(value); - prev.value += value; - append({ value }); - continue; - } - - /** - * Double quotes - */ - - if (value === '"') { - state.quotes = state.quotes === 1 ? 0 : 1; - if (opts.keepQuotes === true) { - push({ type: 'text', value }); - } - continue; - } + bundle = entry[0] || null; + file = entry.slice(1).join(":") || null; + return [{ bundle, file }]; + })); + }; + const useFilter = () => { + const [includeFilter, setIncludeFilter] = h(""); + const [excludeFilter, setExcludeFilter] = h(""); + const setIncludeFilterTrottled = T(() => throttleFilter(setIncludeFilter, 200), []); + const setExcludeFilterTrottled = T(() => throttleFilter(setExcludeFilter, 200), []); + const isIncluded = T(() => createFilter(prepareFilter(includeFilter), prepareFilter(excludeFilter)), [includeFilter, excludeFilter]); + const getModuleFilterMultiplier = q((bundleId, data) => { + return isIncluded(bundleId, data.id) ? 1 : 0; + }, [isIncluded]); + return { + getModuleFilterMultiplier, + includeFilter, + excludeFilter, + setExcludeFilter: setExcludeFilterTrottled, + setIncludeFilter: setIncludeFilterTrottled, + }; + }; - /** - * Parentheses - */ + const TOP_PADDING = 20; + const PADDING = 2; - if (value === '(') { - increment('parens'); - push({ type: 'paren', value }); - continue; + const Node = ({ node, onMouseOver, onClick, selected }) => { + const { getModuleColor } = x(StaticContext); + const { backgroundColor, fontColor } = getModuleColor(node); + const { x0, x1, y1, y0, data, children = null } = node; + const textRef = A(null); + const textRectRef = A(); + const width = x1 - x0; + const height = y1 - y0; + const textProps = { + "font-size": "0.7em", + "dominant-baseline": "middle", + "text-anchor": "middle", + x: width / 2, + }; + if (children != null) { + textProps.y = (TOP_PADDING + PADDING) / 2; } - - if (value === ')') { - if (state.parens === 0 && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '(')); - } - - const extglob = extglobs[extglobs.length - 1]; - if (extglob && state.parens === extglob.parens + 1) { - extglobClose(extglobs.pop()); - continue; - } - - push({ type: 'paren', value, output: state.parens ? ')' : '\\\\)' }); - decrement('parens'); - continue; + else { + textProps.y = height / 2; } - - /** - * Square brackets - */ - - if (value === '[') { - if (opts.nobracket === true || !remaining().includes(']')) { - if (opts.nobracket !== true && opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('closing', ']')); + _(() => { + if (width == 0 || height == 0 || !textRef.current) { + return; } - - value = \`\\\\\${value}\`; - } else { - increment('brackets'); - } - - push({ type: 'bracket', value }); - continue; - } - - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: \`\\\\\${value}\` }); - continue; - } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); + if (textRectRef.current == null) { + textRectRef.current = textRef.current.getBoundingClientRect(); } - - push({ type: 'text', value, output: \`\\\\\${value}\` }); - continue; - } - - decrement('brackets'); - - const prevValue = prev.value.slice(1); - if (prev.posix !== true && prevValue[0] === '^' && !prevValue.includes('/')) { - value = \`/\${value}\`; - } - - prev.value += value; - append({ value }); - - // when literal brackets are explicitly disabled - // assume we should match with a regex character class - if (opts.literalBrackets === false || utils$1.hasRegexChars(prevValue)) { - continue; - } - - const escaped = utils$1.escapeRegex(prev.value); - state.output = state.output.slice(0, -prev.value.length); - - // when literal brackets are explicitly enabled - // assume we should escape the brackets to match literal characters - if (opts.literalBrackets === true) { - state.output += escaped; - prev.value = escaped; - continue; - } - - // when the user specifies nothing, try to match both - prev.value = \`(\${capture}\${escaped}|\${prev.value})\`; - state.output += prev.value; - continue; + let scale = 1; + scale = Math.min((width * 0.9) / textRectRef.current.width, (height * 0.9) / textRectRef.current.height); + scale = Math.min(1, scale); + textRef.current.setAttribute("y", String(height / 2 / scale)); + textRef.current.setAttribute("x", String(width / 2 / scale)); + textRef.current.setAttribute("transform", \`scale(\${scale.toFixed(2)})\`); + }, [children, height, width]); + if (width == 0 || height == 0) { + return null; } + return (u$1("g", { className: "node", transform: \`translate(\${x0},\${y0})\`, onClick: (event) => { + event.stopPropagation(); + onClick(node); + }, onMouseOver: (event) => { + event.stopPropagation(); + onMouseOver(node); + }, children: [u$1("rect", { fill: backgroundColor, rx: 2, ry: 2, width: x1 - x0, height: y1 - y0, stroke: selected ? "#fff" : undefined, "stroke-width": selected ? 2 : undefined }), u$1("text", Object.assign({ ref: textRef, fill: fontColor, onClick: (event) => { + var _a; + if (((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) !== "") { + event.stopPropagation(); + } + } }, textProps, { children: data.name }))] })); + }; - /** - * Braces - */ - - if (value === '{' && opts.nobrace !== true) { - increment('braces'); - - const open = { - type: 'brace', - value, - output: '(', - outputIndex: state.output.length, - tokensIndex: state.tokens.length - }; + const FlameGraph = ({ root, onNodeHover, selectedNode, onNodeClick, }) => { + const { width, height, getModuleIds } = x(StaticContext); + return (u$1("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: \`0 0 \${width} \${height}\`, children: root.descendants().map((node) => { + return (u$1(Node, { node: node, onMouseOver: onNodeHover, selected: selectedNode === node, onClick: onNodeClick }, getModuleIds(node.data).nodeUid.id)); + }) })); + }; - braces.push(open); - push(open); - continue; - } + var bytes = {exports: {}}; - if (value === '}') { - const brace = braces[braces.length - 1]; + /*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */ - if (opts.nobrace === true || !brace) { - push({ type: 'text', value, output: value }); - continue; - } + var hasRequiredBytes; - let output = ')'; + function requireBytes () { + if (hasRequiredBytes) return bytes.exports; + hasRequiredBytes = 1; - if (brace.dots === true) { - const arr = tokens.slice(); - const range = []; + /** + * Module exports. + * @public + */ - for (let i = arr.length - 1; i >= 0; i--) { - tokens.pop(); - if (arr[i].type === 'brace') { - break; - } - if (arr[i].type !== 'dots') { - range.unshift(arr[i].value); - } - } + bytes.exports = bytes$1; + bytes.exports.format = format; + bytes.exports.parse = parse; - output = expandRange(range, opts); - state.backtrack = true; - } + /** + * Module variables. + * @private + */ - if (brace.comma !== true && brace.dots !== true) { - const out = state.output.slice(0, brace.outputIndex); - const toks = state.tokens.slice(brace.tokensIndex); - brace.value = brace.output = '\\\\{'; - value = output = '\\\\}'; - state.output = out; - for (const t of toks) { - state.output += (t.output || t.value); - } - } + var formatThousandsRegExp = /\\B(?=(\\d{3})+(?!\\d))/g; - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } + var formatDecimalsRegExp = /(?:\\.0*|(\\.[^0]+)0+)$/; - /** - * Pipes - */ + var map = { + b: 1, + kb: 1 << 10, + mb: 1 << 20, + gb: 1 << 30, + tb: Math.pow(1024, 4), + pb: Math.pow(1024, 5), + }; - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } + var parseRegExp = /^((-|\\+)?(\\d+(?:\\.\\d+)?)) *(kb|mb|gb|tb|pb)$/i; + + /** + * Convert the given value in bytes into a string or parse to string to an integer in bytes. + * + * @param {string|number} value + * @param {{ + * case: [string], + * decimalPlaces: [number] + * fixedDecimals: [boolean] + * thousandsSeparator: [string] + * unitSeparator: [string] + * }} [options] bytes options. + * + * @returns {string|number|null} + */ + + function bytes$1(value, options) { + if (typeof value === 'string') { + return parse(value); + } - /** - * Commas - */ + if (typeof value === 'number') { + return format(value, options); + } - if (value === ',') { - let output = value; + return null; + } + + /** + * Format the given value in bytes into a string. + * + * If the value is negative, it is kept as such. If it is a float, + * it is rounded. + * + * @param {number} value + * @param {object} [options] + * @param {number} [options.decimalPlaces=2] + * @param {number} [options.fixedDecimals=false] + * @param {string} [options.thousandsSeparator=] + * @param {string} [options.unit=] + * @param {string} [options.unitSeparator=] + * + * @returns {string|null} + * @public + */ + + function format(value, options) { + if (!Number.isFinite(value)) { + return null; + } - const brace = braces[braces.length - 1]; - if (brace && stack[stack.length - 1] === 'braces') { - brace.comma = true; - output = '|'; - } + var mag = Math.abs(value); + var thousandsSeparator = (options && options.thousandsSeparator) || ''; + var unitSeparator = (options && options.unitSeparator) || ''; + var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; + var fixedDecimals = Boolean(options && options.fixedDecimals); + var unit = (options && options.unit) || ''; + + if (!unit || !map[unit.toLowerCase()]) { + if (mag >= map.pb) { + unit = 'PB'; + } else if (mag >= map.tb) { + unit = 'TB'; + } else if (mag >= map.gb) { + unit = 'GB'; + } else if (mag >= map.mb) { + unit = 'MB'; + } else if (mag >= map.kb) { + unit = 'KB'; + } else { + unit = 'B'; + } + } - push({ type: 'comma', value, output }); - continue; - } - - /** - * Slashes - */ - - if (value === '/') { - // if the beginning of the glob is "./", advance the start - // to the current index, and don't add the "./" characters - // to the state. This greatly simplifies lookbehinds when - // checking for BOS characters like "!" and "." (not "./") - if (prev.type === 'dot' && state.index === state.start + 1) { - state.start = state.index + 1; - state.consumed = ''; - state.output = ''; - tokens.pop(); - prev = bos; // reset "prev" to the first token - continue; - } + var val = value / map[unit.toLowerCase()]; + var str = val.toFixed(decimalPlaces); - push({ type: 'slash', value, output: SLASH_LITERAL }); - continue; - } + if (!fixedDecimals) { + str = str.replace(formatDecimalsRegExp, '$1'); + } - /** - * Dots - */ + if (thousandsSeparator) { + str = str.split('.').map(function (s, i) { + return i === 0 + ? s.replace(formatThousandsRegExp, thousandsSeparator) + : s + }).join('.'); + } - if (value === '.') { - if (state.braces > 0 && prev.type === 'dot') { - if (prev.value === '.') prev.output = DOT_LITERAL; - const brace = braces[braces.length - 1]; - prev.type = 'dots'; - prev.output += value; - prev.value += value; - brace.dots = true; - continue; - } + return str + unitSeparator + unit; + } + + /** + * Parse the string value into an integer in bytes. + * + * If no unit is given, it is assumed the value is in bytes. + * + * @param {number|string} val + * + * @returns {number|null} + * @public + */ + + function parse(val) { + if (typeof val === 'number' && !isNaN(val)) { + return val; + } - if ((state.braces + state.parens) === 0 && prev.type !== 'bos' && prev.type !== 'slash') { - push({ type: 'text', value, output: DOT_LITERAL }); - continue; - } + if (typeof val !== 'string') { + return null; + } - push({ type: 'dot', value, output: DOT_LITERAL }); - continue; - } + // Test if the string passed is valid + var results = parseRegExp.exec(val); + var floatValue; + var unit = 'b'; - /** - * Question marks - */ + if (!results) { + // Nothing could be extracted from the given string + floatValue = parseInt(val, 10); + unit = 'b'; + } else { + // Retrieve the value and the unit + floatValue = parseFloat(results[1]); + unit = results[4].toLowerCase(); + } - if (value === '?') { - const isGroup = prev && prev.value === '('; - if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('qmark', value); - continue; - } + if (isNaN(floatValue)) { + return null; + } - if (prev && prev.type === 'paren') { - const next = peek(); - let output = value; + return Math.floor(map[unit] * floatValue); + } + return bytes.exports; + } - if (next === '<' && !utils$1.supportsLookbehinds()) { - throw new Error('Node.js v10 or higher is required for regex lookbehinds'); - } + var bytesExports = requireBytes(); - if ((prev.value === '(' && !/[!=<:]/.test(next)) || (next === '<' && !/<([!=]|\\w+>)/.test(remaining()))) { - output = \`\\\\\${value}\`; + const Tooltip_marginX = 10; + const Tooltip_marginY = 30; + const SOURCEMAP_RENDERED = (u$1("span", { children: [" ", u$1("b", { children: LABELS.renderedLength }), " is a number of characters in the file after individual and ", u$1("br", {}), " ", "whole bundle transformations according to sourcemap."] })); + const RENDRED = (u$1("span", { children: [u$1("b", { children: LABELS.renderedLength }), " is a byte size of individual file after transformations and treeshake."] })); + const COMPRESSED = (u$1("span", { children: [u$1("b", { children: LABELS.gzipLength }), " and ", u$1("b", { children: LABELS.brotliLength }), " is a byte size of individual file after individual transformations,", u$1("br", {}), " treeshake and compression."] })); + const Tooltip = ({ node, visible, root, sizeProperty, }) => { + const { availableSizeProperties, getModuleSize, data } = x(StaticContext); + const ref = A(null); + const [style, setStyle] = h({}); + const content = T(() => { + if (!node) + return null; + const mainSize = getModuleSize(node.data, sizeProperty); + const percentageNum = (100 * mainSize) / getModuleSize(root.data, sizeProperty); + const percentage = percentageNum.toFixed(2); + const percentageString = percentage + "%"; + const path = node + .ancestors() + .reverse() + .map((d) => d.data.name) + .join("/"); + let dataNode = null; + if (!isModuleTree(node.data)) { + const mainUid = data.nodeParts[node.data.uid].metaUid; + dataNode = data.nodeMetas[mainUid]; } + return (u$1(k$1, { children: [u$1("div", { children: path }), availableSizeProperties.map((sizeProp) => { + if (sizeProp === sizeProperty) { + return (u$1("div", { children: [u$1("b", { children: [LABELS[sizeProp], ": ", bytesExports.format(mainSize)] }), " ", "(", percentageString, ")"] }, sizeProp)); + } + else { + return (u$1("div", { children: [LABELS[sizeProp], ": ", bytesExports.format(getModuleSize(node.data, sizeProp))] }, sizeProp)); + } + }), u$1("br", {}), dataNode && dataNode.importedBy.length > 0 && (u$1("div", { children: [u$1("div", { children: [u$1("b", { children: "Imported By" }), ":"] }), dataNode.importedBy.map(({ uid }) => { + const id = data.nodeMetas[uid].id; + return u$1("div", { children: id }, id); + })] })), u$1("br", {}), u$1("small", { children: data.options.sourcemap ? SOURCEMAP_RENDERED : RENDRED }), (data.options.gzip || data.options.brotli) && (u$1(k$1, { children: [u$1("br", {}), u$1("small", { children: COMPRESSED })] }))] })); + }, [availableSizeProperties, data, getModuleSize, node, root.data, sizeProperty]); + const updatePosition = (mouseCoords) => { + if (!ref.current) + return; + const pos = { + left: mouseCoords.x + Tooltip_marginX, + top: mouseCoords.y + Tooltip_marginY, + }; + const boundingRect = ref.current.getBoundingClientRect(); + if (pos.left + boundingRect.width > window.innerWidth) { + // Shifting horizontally + pos.left = window.innerWidth - boundingRect.width; + } + if (pos.top + boundingRect.height > window.innerHeight) { + // Flipping vertically + pos.top = mouseCoords.y - Tooltip_marginY - boundingRect.height; + } + setStyle(pos); + }; + y(() => { + const handleMouseMove = (event) => { + updatePosition({ + x: event.pageX, + y: event.pageY, + }); + }; + document.addEventListener("mousemove", handleMouseMove, true); + return () => { + document.removeEventListener("mousemove", handleMouseMove, true); + }; + }, []); + return (u$1("div", { className: \`tooltip \${visible ? "" : "tooltip-hidden"}\`, ref: ref, style: style, children: content })); + }; - push({ type: 'text', value, output }); - continue; - } - - if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) { - push({ type: 'qmark', value, output: QMARK_NO_DOT }); - continue; - } - - push({ type: 'qmark', value, output: QMARK }); - continue; - } - - /** - * Exclamation - */ + const Chart = ({ root, sizeProperty, selectedNode, setSelectedNode, }) => { + const [showTooltip, setShowTooltip] = h(false); + const [tooltipNode, setTooltipNode] = h(undefined); + y(() => { + const handleMouseOut = () => { + setShowTooltip(false); + }; + document.addEventListener("mouseover", handleMouseOut); + return () => { + document.removeEventListener("mouseover", handleMouseOut); + }; + }, []); + return (u$1(k$1, { children: [u$1(FlameGraph, { root: root, onNodeHover: (node) => { + setTooltipNode(node); + setShowTooltip(true); + }, selectedNode: selectedNode, onNodeClick: (node) => { + setSelectedNode(selectedNode === node ? undefined : node); + } }), u$1(Tooltip, { visible: showTooltip, node: tooltipNode, root: root, sizeProperty: sizeProperty })] })); + }; - if (value === '!') { - if (opts.noextglob !== true && peek() === '(') { - if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) { - extglobOpen('negate', value); - continue; + const Main = () => { + const { availableSizeProperties, rawHierarchy, getModuleSize, layout, data } = x(StaticContext); + const [sizeProperty, setSizeProperty] = h(availableSizeProperties[0]); + const [selectedNode, setSelectedNode] = h(undefined); + const { getModuleFilterMultiplier, setExcludeFilter, setIncludeFilter } = useFilter(); + console.time("getNodeSizeMultiplier"); + const getNodeSizeMultiplier = T(() => { + const selectedMultiplier = 1; // selectedSize < rootSize * increaseFactor ? (rootSize * increaseFactor) / selectedSize : rootSize / selectedSize; + const nonSelectedMultiplier = 0; // 1 / selectedMultiplier + if (selectedNode === undefined) { + return () => 1; } - } - - if (opts.nonegate !== true && state.index === 0) { - negate(); - continue; - } - } + else if (isModuleTree(selectedNode.data)) { + const leaves = new Set(selectedNode.leaves().map((d) => d.data)); + return (node) => { + if (leaves.has(node)) { + return selectedMultiplier; + } + return nonSelectedMultiplier; + }; + } + else { + return (node) => { + if (node === selectedNode.data) { + return selectedMultiplier; + } + return nonSelectedMultiplier; + }; + } + }, [getModuleSize, rawHierarchy.data, selectedNode, sizeProperty]); + console.timeEnd("getNodeSizeMultiplier"); + console.time("root hierarchy compute"); + // root here always be the same as rawHierarchy even after layouting + const root = T(() => { + const rootWithSizesAndSorted = rawHierarchy + .sum((node) => { + var _a; + if (isModuleTree(node)) + return 0; + const meta = data.nodeMetas[data.nodeParts[node.uid].metaUid]; + /* eslint-disable typescript/no-non-null-asserted-optional-chain typescript/no-extra-non-null-assertion */ + const bundleId = (_a = Object.entries(meta.moduleParts).find(([, uid]) => uid == node.uid)) === null || _a === void 0 ? void 0 : _a[0]; + const ownSize = getModuleSize(node, sizeProperty); + const zoomMultiplier = getNodeSizeMultiplier(node); + const filterMultiplier = getModuleFilterMultiplier(bundleId, meta); + return ownSize * zoomMultiplier * filterMultiplier; + }) + .sort((a, b) => getModuleSize(a.data, sizeProperty) - getModuleSize(b.data, sizeProperty)); + return layout(rootWithSizesAndSorted); + }, [ + data, + getModuleFilterMultiplier, + getModuleSize, + getNodeSizeMultiplier, + layout, + rawHierarchy, + sizeProperty, + ]); + console.timeEnd("root hierarchy compute"); + return (u$1(k$1, { children: [u$1(SideBar, { sizeProperty: sizeProperty, availableSizeProperties: availableSizeProperties, setSizeProperty: setSizeProperty, onExcludeChange: setExcludeFilter, onIncludeChange: setIncludeFilter }), u$1(Chart, { root: root, sizeProperty: sizeProperty, selectedNode: selectedNode, setSelectedNode: setSelectedNode })] })); + }; - /** - * Plus - */ + function ascending(a, b) { + return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + } - if (value === '+') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - extglobOpen('plus', value); - continue; - } + function descending(a, b) { + return a == null || b == null ? NaN + : b < a ? -1 + : b > a ? 1 + : b >= a ? 0 + : NaN; + } - if ((prev && prev.value === '(') || opts.regex === false) { - push({ type: 'plus', value, output: PLUS_LITERAL }); - continue; - } + function bisector(f) { + let compare1, compare2, delta; - if ((prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace')) || state.parens > 0) { - push({ type: 'plus', value }); - continue; - } + // If an accessor is specified, promote it to a comparator. In this case we + // can test whether the search value is (self-) comparable. We can’t do this + // for a comparator (except for specific, known comparators) because we can’t + // tell if the comparator is symmetric, and an asymmetric comparator can’t be + // used to test whether a single value is comparable. + if (f.length !== 2) { + compare1 = ascending; + compare2 = (d, x) => ascending(f(d), x); + delta = (d, x) => f(d) - x; + } else { + compare1 = f === ascending || f === descending ? f : zero$1; + compare2 = f; + delta = f; + } - push({ type: 'plus', value: PLUS_LITERAL }); - continue; + function left(a, x, lo = 0, hi = a.length) { + if (lo < hi) { + if (compare1(x, x) !== 0) return hi; + do { + const mid = (lo + hi) >>> 1; + if (compare2(a[mid], x) < 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); } + return lo; + } - /** - * Plain text - */ - - if (value === '@') { - if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') { - push({ type: 'at', extglob: true, value, output: '' }); - continue; - } - - push({ type: 'text', value }); - continue; + function right(a, x, lo = 0, hi = a.length) { + if (lo < hi) { + if (compare1(x, x) !== 0) return hi; + do { + const mid = (lo + hi) >>> 1; + if (compare2(a[mid], x) <= 0) lo = mid + 1; + else hi = mid; + } while (lo < hi); } + return lo; + } - /** - * Plain text - */ - - if (value !== '*') { - if (value === '$' || value === '^') { - value = \`\\\\\${value}\`; - } + function center(a, x, lo = 0, hi = a.length) { + const i = left(a, x, lo, hi - 1); + return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; + } - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } + return {left, center, right}; + } - push({ type: 'text', value }); - continue; - } + function zero$1() { + return 0; + } - /** - * Stars - */ + function number$1(x) { + return x === null ? NaN : +x; + } - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } + const ascendingBisect = bisector(ascending); + const bisectRight = ascendingBisect.right; + bisector(number$1).center; - let rest = remaining(); - if (opts.noextglob !== true && /^\\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } + const e10 = Math.sqrt(50), + e5 = Math.sqrt(10), + e2 = Math.sqrt(2); - if (prev.type === 'star') { - if (opts.noglobstar === true) { - consume(value); - continue; - } + function tickSpec(start, stop, count) { + const step = (stop - start) / Math.max(0, count), + power = Math.floor(Math.log10(step)), + error = step / Math.pow(10, power), + factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; + let i1, i2, inc; + if (power < 0) { + inc = Math.pow(10, -power) / factor; + i1 = Math.round(start * inc); + i2 = Math.round(stop * inc); + if (i1 / inc < start) ++i1; + if (i2 / inc > stop) --i2; + inc = -inc; + } else { + inc = Math.pow(10, power) * factor; + i1 = Math.round(start / inc); + i2 = Math.round(stop / inc); + if (i1 * inc < start) ++i1; + if (i2 * inc > stop) --i2; + } + if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2); + return [i1, i2, inc]; + } - const prior = prev.prev; - const before = prior.prev; - const isStart = prior.type === 'slash' || prior.type === 'bos'; - const afterStar = before && (before.type === 'star' || before.type === 'globstar'); + function ticks(start, stop, count) { + stop = +stop, start = +start, count = +count; + if (!(count > 0)) return []; + if (start === stop) return [start]; + const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count); + if (!(i2 >= i1)) return []; + const n = i2 - i1 + 1, ticks = new Array(n); + if (reverse) { + if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc; + else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc; + } else { + if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc; + else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc; + } + return ticks; + } - if (opts.bash === true && (!isStart || (rest[0] && rest[0] !== '/'))) { - push({ type: 'star', value, output: '' }); - continue; - } + function tickIncrement(start, stop, count) { + stop = +stop, start = +start, count = +count; + return tickSpec(start, stop, count)[2]; + } - const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace'); - const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren'); - if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) { - push({ type: 'star', value, output: '' }); - continue; - } + function tickStep(start, stop, count) { + stop = +stop, start = +start, count = +count; + const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count); + return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); + } - // strip consecutive \`/**/\` - while (rest.slice(0, 3) === '/**') { - const after = input[state.index + 4]; - if (after && after !== '/') { - break; - } - rest = rest.slice(3); - consume('/**', 3); - } - - if (prior.type === 'bos' && eos()) { - prev.type = 'globstar'; - prev.value += value; - prev.output = globstar(opts); - state.output = prev.output; - state.globstar = true; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) { - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = \`(?:\${prior.output}\`; - - prev.type = 'globstar'; - prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)'); - prev.value += value; - state.globstar = true; - state.output += prior.output + prev.output; - consume(value); - continue; - } - - if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') { - const end = rest[1] !== void 0 ? '|$' : ''; - - state.output = state.output.slice(0, -(prior.output + prev.output).length); - prior.output = \`(?:\${prior.output}\`; - - prev.type = 'globstar'; - prev.output = \`\${globstar(opts)}\${SLASH_LITERAL}|\${SLASH_LITERAL}\${end})\`; - prev.value += value; - - state.output += prior.output + prev.output; - state.globstar = true; - - consume(value + advance()); - - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - if (prior.type === 'bos' && rest[0] === '/') { - prev.type = 'globstar'; - prev.value += value; - prev.output = \`(?:^|\${SLASH_LITERAL}|\${globstar(opts)}\${SLASH_LITERAL})\`; - state.output = prev.output; - state.globstar = true; - consume(value + advance()); - push({ type: 'slash', value: '/', output: '' }); - continue; - } - - // remove single star from output - state.output = state.output.slice(0, -prev.output.length); - - // reset previous token to globstar - prev.type = 'globstar'; - prev.output = globstar(opts); - prev.value += value; - - // reset output with globstar - state.output += prev.output; - state.globstar = true; - consume(value); - continue; - } - - const token = { type: 'star', value, output: star }; - - if (opts.bash === true) { - token.output = '.*?'; - if (prev.type === 'bos' || prev.type === 'slash') { - token.output = nodot + token.output; - } - push(token); - continue; - } + function initRange(domain, range) { + switch (arguments.length) { + case 0: break; + case 1: this.range(domain); break; + default: this.range(range).domain(domain); break; + } + return this; + } - if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) { - token.output = value; - push(token); - continue; + function initInterpolator(domain, interpolator) { + switch (arguments.length) { + case 0: break; + case 1: { + if (typeof domain === "function") this.interpolator(domain); + else this.range(domain); + break; } - - if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') { - if (prev.type === 'dot') { - state.output += NO_DOT_SLASH; - prev.output += NO_DOT_SLASH; - - } else if (opts.dot === true) { - state.output += NO_DOTS_SLASH; - prev.output += NO_DOTS_SLASH; - - } else { - state.output += nodot; - prev.output += nodot; - } - - if (peek() !== '*') { - state.output += ONE_CHAR; - prev.output += ONE_CHAR; - } + default: { + this.domain(domain); + if (typeof interpolator === "function") this.interpolator(interpolator); + else this.range(interpolator); + break; } - - push(token); - } - - while (state.brackets > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']')); - state.output = utils$1.escapeLast(state.output, '['); - decrement('brackets'); - } - - while (state.parens > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')')); - state.output = utils$1.escapeLast(state.output, '('); - decrement('parens'); } + return this; + } - while (state.braces > 0) { - if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}')); - state.output = utils$1.escapeLast(state.output, '{'); - decrement('braces'); - } + function define(constructor, factory, prototype) { + constructor.prototype = factory.prototype = prototype; + prototype.constructor = constructor; + } - if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) { - push({ type: 'maybe_slash', value: '', output: \`\${SLASH_LITERAL}?\` }); - } + function extend(parent, definition) { + var prototype = Object.create(parent.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; + } - // rebuild the output if we had to backtrack at any point - if (state.backtrack === true) { - state.output = ''; + function Color() {} - for (const token of state.tokens) { - state.output += token.output != null ? token.output : token.value; + var darker = 0.7; + var brighter = 1 / darker; - if (token.suffix) { - state.output += token.suffix; - } - } - } + var reI = "\\\\s*([+-]?\\\\d+)\\\\s*", + reN = "\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*", + reP = "\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*", + reHex = /^#([0-9a-f]{3,8})$/, + reRgbInteger = new RegExp(\`^rgb\\\\(\${reI},\${reI},\${reI}\\\\)$\`), + reRgbPercent = new RegExp(\`^rgb\\\\(\${reP},\${reP},\${reP}\\\\)$\`), + reRgbaInteger = new RegExp(\`^rgba\\\\(\${reI},\${reI},\${reI},\${reN}\\\\)$\`), + reRgbaPercent = new RegExp(\`^rgba\\\\(\${reP},\${reP},\${reP},\${reN}\\\\)$\`), + reHslPercent = new RegExp(\`^hsl\\\\(\${reN},\${reP},\${reP}\\\\)$\`), + reHslaPercent = new RegExp(\`^hsla\\\\(\${reN},\${reP},\${reP},\${reN}\\\\)$\`); - return state; + var named = { + aliceblue: 0xf0f8ff, + antiquewhite: 0xfaebd7, + aqua: 0x00ffff, + aquamarine: 0x7fffd4, + azure: 0xf0ffff, + beige: 0xf5f5dc, + bisque: 0xffe4c4, + black: 0x000000, + blanchedalmond: 0xffebcd, + blue: 0x0000ff, + blueviolet: 0x8a2be2, + brown: 0xa52a2a, + burlywood: 0xdeb887, + cadetblue: 0x5f9ea0, + chartreuse: 0x7fff00, + chocolate: 0xd2691e, + coral: 0xff7f50, + cornflowerblue: 0x6495ed, + cornsilk: 0xfff8dc, + crimson: 0xdc143c, + cyan: 0x00ffff, + darkblue: 0x00008b, + darkcyan: 0x008b8b, + darkgoldenrod: 0xb8860b, + darkgray: 0xa9a9a9, + darkgreen: 0x006400, + darkgrey: 0xa9a9a9, + darkkhaki: 0xbdb76b, + darkmagenta: 0x8b008b, + darkolivegreen: 0x556b2f, + darkorange: 0xff8c00, + darkorchid: 0x9932cc, + darkred: 0x8b0000, + darksalmon: 0xe9967a, + darkseagreen: 0x8fbc8f, + darkslateblue: 0x483d8b, + darkslategray: 0x2f4f4f, + darkslategrey: 0x2f4f4f, + darkturquoise: 0x00ced1, + darkviolet: 0x9400d3, + deeppink: 0xff1493, + deepskyblue: 0x00bfff, + dimgray: 0x696969, + dimgrey: 0x696969, + dodgerblue: 0x1e90ff, + firebrick: 0xb22222, + floralwhite: 0xfffaf0, + forestgreen: 0x228b22, + fuchsia: 0xff00ff, + gainsboro: 0xdcdcdc, + ghostwhite: 0xf8f8ff, + gold: 0xffd700, + goldenrod: 0xdaa520, + gray: 0x808080, + green: 0x008000, + greenyellow: 0xadff2f, + grey: 0x808080, + honeydew: 0xf0fff0, + hotpink: 0xff69b4, + indianred: 0xcd5c5c, + indigo: 0x4b0082, + ivory: 0xfffff0, + khaki: 0xf0e68c, + lavender: 0xe6e6fa, + lavenderblush: 0xfff0f5, + lawngreen: 0x7cfc00, + lemonchiffon: 0xfffacd, + lightblue: 0xadd8e6, + lightcoral: 0xf08080, + lightcyan: 0xe0ffff, + lightgoldenrodyellow: 0xfafad2, + lightgray: 0xd3d3d3, + lightgreen: 0x90ee90, + lightgrey: 0xd3d3d3, + lightpink: 0xffb6c1, + lightsalmon: 0xffa07a, + lightseagreen: 0x20b2aa, + lightskyblue: 0x87cefa, + lightslategray: 0x778899, + lightslategrey: 0x778899, + lightsteelblue: 0xb0c4de, + lightyellow: 0xffffe0, + lime: 0x00ff00, + limegreen: 0x32cd32, + linen: 0xfaf0e6, + magenta: 0xff00ff, + maroon: 0x800000, + mediumaquamarine: 0x66cdaa, + mediumblue: 0x0000cd, + mediumorchid: 0xba55d3, + mediumpurple: 0x9370db, + mediumseagreen: 0x3cb371, + mediumslateblue: 0x7b68ee, + mediumspringgreen: 0x00fa9a, + mediumturquoise: 0x48d1cc, + mediumvioletred: 0xc71585, + midnightblue: 0x191970, + mintcream: 0xf5fffa, + mistyrose: 0xffe4e1, + moccasin: 0xffe4b5, + navajowhite: 0xffdead, + navy: 0x000080, + oldlace: 0xfdf5e6, + olive: 0x808000, + olivedrab: 0x6b8e23, + orange: 0xffa500, + orangered: 0xff4500, + orchid: 0xda70d6, + palegoldenrod: 0xeee8aa, + palegreen: 0x98fb98, + paleturquoise: 0xafeeee, + palevioletred: 0xdb7093, + papayawhip: 0xffefd5, + peachpuff: 0xffdab9, + peru: 0xcd853f, + pink: 0xffc0cb, + plum: 0xdda0dd, + powderblue: 0xb0e0e6, + purple: 0x800080, + rebeccapurple: 0x663399, + red: 0xff0000, + rosybrown: 0xbc8f8f, + royalblue: 0x4169e1, + saddlebrown: 0x8b4513, + salmon: 0xfa8072, + sandybrown: 0xf4a460, + seagreen: 0x2e8b57, + seashell: 0xfff5ee, + sienna: 0xa0522d, + silver: 0xc0c0c0, + skyblue: 0x87ceeb, + slateblue: 0x6a5acd, + slategray: 0x708090, + slategrey: 0x708090, + snow: 0xfffafa, + springgreen: 0x00ff7f, + steelblue: 0x4682b4, + tan: 0xd2b48c, + teal: 0x008080, + thistle: 0xd8bfd8, + tomato: 0xff6347, + turquoise: 0x40e0d0, + violet: 0xee82ee, + wheat: 0xf5deb3, + white: 0xffffff, + whitesmoke: 0xf5f5f5, + yellow: 0xffff00, + yellowgreen: 0x9acd32 }; - /** - * Fast paths for creating regular expressions for common glob patterns. - * This can significantly speed up processing and has very little downside - * impact when none of the fast paths match. - */ + define(Color, color, { + copy(channels) { + return Object.assign(new this.constructor, this, channels); + }, + displayable() { + return this.rgb().displayable(); + }, + hex: color_formatHex, // Deprecated! Use color.formatHex. + formatHex: color_formatHex, + formatHex8: color_formatHex8, + formatHsl: color_formatHsl, + formatRgb: color_formatRgb, + toString: color_formatRgb + }); - parse$2.fastpaths = (input, options) => { - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - const len = input.length; - if (len > max) { - throw new SyntaxError(\`Input length: \${len}, exceeds maximum allowed length: \${max}\`); - } + function color_formatHex() { + return this.rgb().formatHex(); + } - input = REPLACEMENTS[input] || input; + function color_formatHex8() { + return this.rgb().formatHex8(); + } - // create constants based on platform, for windows or posix - const { - DOT_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOTS, - NO_DOTS_SLASH, - STAR, - START_ANCHOR - } = constants$2.globChars(opts.windows); - - const nodot = opts.dot ? NO_DOTS : NO_DOT; - const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT; - const capture = opts.capture ? '' : '?:'; - const state = { negated: false, prefix: '' }; - let star = opts.bash === true ? '.*?' : STAR; - - if (opts.capture) { - star = \`(\${star})\`; - } - - const globstar = (opts) => { - if (opts.noglobstar === true) return star; - return \`(\${capture}(?:(?!\${START_ANCHOR}\${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)\`; - }; - - const create = str => { - switch (str) { - case '*': - return \`\${nodot}\${ONE_CHAR}\${star}\`; - - case '.*': - return \`\${DOT_LITERAL}\${ONE_CHAR}\${star}\`; + function color_formatHsl() { + return hslConvert(this).formatHsl(); + } - case '*.*': - return \`\${nodot}\${star}\${DOT_LITERAL}\${ONE_CHAR}\${star}\`; + function color_formatRgb() { + return this.rgb().formatRgb(); + } - case '*/*': - return \`\${nodot}\${star}\${SLASH_LITERAL}\${ONE_CHAR}\${slashDot}\${star}\`; + function color(format) { + var m, l; + format = (format + "").trim().toLowerCase(); + return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 + : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 + : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 + : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 + : null) // invalid hex + : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) + : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) + : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) + : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) + : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) + : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) + : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins + : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) + : null; + } - case '**': - return nodot + globstar(opts); + function rgbn(n) { + return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); + } - case '**/*': - return \`(?:\${nodot}\${globstar(opts)}\${SLASH_LITERAL})?\${slashDot}\${ONE_CHAR}\${star}\`; + function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); + } - case '**/*.*': - return \`(?:\${nodot}\${globstar(opts)}\${SLASH_LITERAL})?\${slashDot}\${star}\${DOT_LITERAL}\${ONE_CHAR}\${star}\`; + function rgbConvert(o) { + if (!(o instanceof Color)) o = color(o); + if (!o) return new Rgb; + o = o.rgb(); + return new Rgb(o.r, o.g, o.b, o.opacity); + } - case '**/.*': - return \`(?:\${nodot}\${globstar(opts)}\${SLASH_LITERAL})?\${DOT_LITERAL}\${ONE_CHAR}\${star}\`; + function rgb$1(r, g, b, opacity) { + return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); + } - default: { - const match = /^(.*?)\\.(\\w+)$/.exec(str); - if (!match) return; + function Rgb(r, g, b, opacity) { + this.r = +r; + this.g = +g; + this.b = +b; + this.opacity = +opacity; + } - const source = create(match[1]); - if (!source) return; + define(Rgb, rgb$1, extend(Color, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); + }, + rgb() { + return this; + }, + clamp() { + return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); + }, + displayable() { + return (-0.5 <= this.r && this.r < 255.5) + && (-0.5 <= this.g && this.g < 255.5) + && (-0.5 <= this.b && this.b < 255.5) + && (0 <= this.opacity && this.opacity <= 1); + }, + hex: rgb_formatHex, // Deprecated! Use color.formatHex. + formatHex: rgb_formatHex, + formatHex8: rgb_formatHex8, + formatRgb: rgb_formatRgb, + toString: rgb_formatRgb + })); - return source + DOT_LITERAL + match[2]; - } - } - }; + function rgb_formatHex() { + return \`#\${hex(this.r)}\${hex(this.g)}\${hex(this.b)}\`; + } - const output = utils$1.removePrefix(input, state); - let source = create(output); + function rgb_formatHex8() { + return \`#\${hex(this.r)}\${hex(this.g)}\${hex(this.b)}\${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}\`; + } - if (source && opts.strictSlashes !== true) { - source += \`\${SLASH_LITERAL}?\`; - } + function rgb_formatRgb() { + const a = clampa(this.opacity); + return \`\${a === 1 ? "rgb(" : "rgba("}\${clampi(this.r)}, \${clampi(this.g)}, \${clampi(this.b)}\${a === 1 ? ")" : \`, \${a})\`}\`; + } - return source; - }; + function clampa(opacity) { + return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); + } - var parse_1 = parse$2; - - const scan = scan_1; - const parse$1 = parse_1; - const utils = utils$3; - const constants$1 = constants$3; - const isObject = val => val && typeof val === 'object' && !Array.isArray(val); - - /** - * Creates a matcher function from one or more glob patterns. The - * returned function takes a string to match as its first argument, - * and returns true if the string is a match. The returned matcher - * function also takes a boolean as the second argument that, when true, - * returns an object with additional information. - * - * \`\`\`js - * const picomatch = require('picomatch'); - * // picomatch(glob[, options]); - * - * const isMatch = picomatch('*.!(*a)'); - * console.log(isMatch('a.a')); //=> false - * console.log(isMatch('a.b')); //=> true - * \`\`\` - * @name picomatch - * @param {String|Array} \`globs\` One or more glob patterns. - * @param {Object=} \`options\` - * @return {Function=} Returns a matcher function. - * @api public - */ + function clampi(value) { + return Math.max(0, Math.min(255, Math.round(value) || 0)); + } - const picomatch = (glob, options, returnState = false) => { - if (Array.isArray(glob)) { - const fns = glob.map(input => picomatch(input, options, returnState)); - const arrayMatcher = str => { - for (const isMatch of fns) { - const state = isMatch(str); - if (state) return state; - } - return false; - }; - return arrayMatcher; - } + function hex(value) { + value = clampi(value); + return (value < 16 ? "0" : "") + value.toString(16); + } - const isState = isObject(glob) && glob.tokens && glob.input; + function hsla(h, s, l, a) { + if (a <= 0) h = s = l = NaN; + else if (l <= 0 || l >= 1) h = s = NaN; + else if (s <= 0) h = NaN; + return new Hsl(h, s, l, a); + } - if (glob === '' || (typeof glob !== 'string' && !isState)) { - throw new TypeError('Expected pattern to be a non-empty string'); + function hslConvert(o) { + if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); + if (!(o instanceof Color)) o = color(o); + if (!o) return new Hsl; + if (o instanceof Hsl) return o; + o = o.rgb(); + var r = o.r / 255, + g = o.g / 255, + b = o.b / 255, + min = Math.min(r, g, b), + max = Math.max(r, g, b), + h = NaN, + s = max - min, + l = (max + min) / 2; + if (s) { + if (r === max) h = (g - b) / s + (g < b) * 6; + else if (g === max) h = (b - r) / s + 2; + else h = (r - g) / s + 4; + s /= l < 0.5 ? max + min : 2 - max - min; + h *= 60; + } else { + s = l > 0 && l < 1 ? 0 : h; } + return new Hsl(h, s, l, o.opacity); + } - const opts = options || {}; - const posix = opts.windows; - const regex = isState - ? picomatch.compileRe(glob, options) - : picomatch.makeRe(glob, options, false, true); + function hsl(h, s, l, opacity) { + return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); + } - const state = regex.state; - delete regex.state; + function Hsl(h, s, l, opacity) { + this.h = +h; + this.s = +s; + this.l = +l; + this.opacity = +opacity; + } - let isIgnored = () => false; - if (opts.ignore) { - const ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null }; - isIgnored = picomatch(opts.ignore, ignoreOpts, returnState); + define(Hsl, hsl, extend(Color, { + brighter(k) { + k = k == null ? brighter : Math.pow(brighter, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + darker(k) { + k = k == null ? darker : Math.pow(darker, k); + return new Hsl(this.h, this.s, this.l * k, this.opacity); + }, + rgb() { + var h = this.h % 360 + (this.h < 0) * 360, + s = isNaN(h) || isNaN(this.s) ? 0 : this.s, + l = this.l, + m2 = l + (l < 0.5 ? l : 1 - l) * s, + m1 = 2 * l - m2; + return new Rgb( + hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), + hsl2rgb(h, m1, m2), + hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), + this.opacity + ); + }, + clamp() { + return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); + }, + displayable() { + return (0 <= this.s && this.s <= 1 || isNaN(this.s)) + && (0 <= this.l && this.l <= 1) + && (0 <= this.opacity && this.opacity <= 1); + }, + formatHsl() { + const a = clampa(this.opacity); + return \`\${a === 1 ? "hsl(" : "hsla("}\${clamph(this.h)}, \${clampt(this.s) * 100}%, \${clampt(this.l) * 100}%\${a === 1 ? ")" : \`, \${a})\`}\`; } + })); - const matcher = (input, returnObject = false) => { - const { isMatch, match, output } = picomatch.test(input, regex, options, { glob, posix }); - const result = { glob, state, regex, posix, input, output, match, isMatch }; + function clamph(value) { + value = (value || 0) % 360; + return value < 0 ? value + 360 : value; + } - if (typeof opts.onResult === 'function') { - opts.onResult(result); - } + function clampt(value) { + return Math.max(0, Math.min(1, value || 0)); + } - if (isMatch === false) { - result.isMatch = false; - return returnObject ? result : false; - } + /* From FvD 13.37, CSS Color Module Level 3 */ + function hsl2rgb(h, m1, m2) { + return (h < 60 ? m1 + (m2 - m1) * h / 60 + : h < 180 ? m2 + : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 + : m1) * 255; + } - if (isIgnored(input)) { - if (typeof opts.onIgnore === 'function') { - opts.onIgnore(result); - } - result.isMatch = false; - return returnObject ? result : false; - } + var constant = x => () => x; - if (typeof opts.onMatch === 'function') { - opts.onMatch(result); - } - return returnObject ? result : true; + function linear$1(a, d) { + return function(t) { + return a + t * d; }; + } - if (returnState) { - matcher.state = state; - } + function exponential(a, b, y) { + return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { + return Math.pow(a + t * b, y); + }; + } - return matcher; - }; + function gamma(y) { + return (y = +y) === 1 ? nogamma : function(a, b) { + return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); + }; + } - /** - * Test \`input\` with the given \`regex\`. This is used by the main - * \`picomatch()\` function to test the input string. - * - * \`\`\`js - * const picomatch = require('picomatch'); - * // picomatch.test(input, regex[, options]); - * - * console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\\/([^/]*?))$/)); - * // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' } - * \`\`\` - * @param {String} \`input\` String to test. - * @param {RegExp} \`regex\` - * @return {Object} Returns an object with matching info. - * @api public - */ + function nogamma(a, b) { + var d = b - a; + return d ? linear$1(a, d) : constant(isNaN(a) ? b : a); + } - picomatch.test = (input, regex, options, { glob, posix } = {}) => { - if (typeof input !== 'string') { - throw new TypeError('Expected input to be a string'); - } + var rgb = (function rgbGamma(y) { + var color = gamma(y); - if (input === '') { - return { isMatch: false, output: '' }; + function rgb(start, end) { + var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r), + g = color(start.g, end.g), + b = color(start.b, end.b), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; } - const opts = options || {}; - const format = opts.format || (posix ? utils.toPosixSlashes : null); - let match = input === glob; - let output = (match && format) ? format(input) : input; + rgb.gamma = rgbGamma; - if (match === false) { - output = format ? format(input) : input; - match = output === glob; - } + return rgb; + })(1); - if (match === false || opts.capture === true) { - if (opts.matchBase === true || opts.basename === true) { - match = picomatch.matchBase(input, regex, options, posix); - } else { - match = regex.exec(output); - } - } + function numberArray(a, b) { + if (!b) b = []; + var n = a ? Math.min(b.length, a.length) : 0, + c = b.slice(), + i; + return function(t) { + for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; + return c; + }; + } - return { isMatch: Boolean(match), match, output }; - }; + function isNumberArray(x) { + return ArrayBuffer.isView(x) && !(x instanceof DataView); + } - /** - * Match the basename of a filepath. - * - * \`\`\`js - * const picomatch = require('picomatch'); - * // picomatch.matchBase(input, glob[, options]); - * console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true - * \`\`\` - * @param {String} \`input\` String to test. - * @param {RegExp|String} \`glob\` Glob pattern or regex created by [.makeRe](#makeRe). - * @return {Boolean} - * @api public - */ + function genericArray(a, b) { + var nb = b ? b.length : 0, + na = a ? Math.min(nb, a.length) : 0, + x = new Array(na), + c = new Array(nb), + i; - picomatch.matchBase = (input, glob, options) => { - const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options); - return regex.test(utils.basename(input)); - }; + for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]); + for (; i < nb; ++i) c[i] = b[i]; - /** - * Returns true if **any** of the given glob \`patterns\` match the specified \`string\`. - * - * \`\`\`js - * const picomatch = require('picomatch'); - * // picomatch.isMatch(string, patterns[, options]); - * - * console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true - * console.log(picomatch.isMatch('a.a', 'b.*')); //=> false - * \`\`\` - * @param {String|Array} str The string to test. - * @param {String|Array} patterns One or more glob patterns to use for matching. - * @param {Object} [options] See available [options](#options). - * @return {Boolean} Returns true if any patterns match \`str\` - * @api public - */ + return function(t) { + for (i = 0; i < na; ++i) c[i] = x[i](t); + return c; + }; + } - picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str); - - /** - * Parse a glob pattern to create the source string for a regular - * expression. - * - * \`\`\`js - * const picomatch = require('picomatch'); - * const result = picomatch.parse(pattern[, options]); - * \`\`\` - * @param {String} \`pattern\` - * @param {Object} \`options\` - * @return {Object} Returns an object with useful properties and output to be used as a regex source string. - * @api public - */ + function date(a, b) { + var d = new Date; + return a = +a, b = +b, function(t) { + return d.setTime(a * (1 - t) + b * t), d; + }; + } - picomatch.parse = (pattern, options) => { - if (Array.isArray(pattern)) return pattern.map(p => picomatch.parse(p, options)); - return parse$1(pattern, { ...options, fastpaths: false }); - }; + function interpolateNumber(a, b) { + return a = +a, b = +b, function(t) { + return a * (1 - t) + b * t; + }; + } - /** - * Scan a glob pattern to separate the pattern into segments. - * - * \`\`\`js - * const picomatch = require('picomatch'); - * // picomatch.scan(input[, options]); - * - * const result = picomatch.scan('!./foo/*.js'); - * console.log(result); - * { prefix: '!./', - * input: '!./foo/*.js', - * start: 3, - * base: 'foo', - * glob: '*.js', - * isBrace: false, - * isBracket: false, - * isGlob: true, - * isExtglob: false, - * isGlobstar: false, - * negated: true } - * \`\`\` - * @param {String} \`input\` Glob pattern to scan. - * @param {Object} \`options\` - * @return {Object} Returns an object with - * @api public - */ + function object(a, b) { + var i = {}, + c = {}, + k; - picomatch.scan = (input, options) => scan(input, options); - - /** - * Create a regular expression from a parsed glob pattern. - * - * \`\`\`js - * const picomatch = require('picomatch'); - * const state = picomatch.parse('*.js'); - * // picomatch.compileRe(state[, options]); - * - * console.log(picomatch.compileRe(state)); - * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/ - * \`\`\` - * @param {String} \`state\` The object returned from the \`.parse\` method. - * @param {Object} \`options\` - * @return {RegExp} Returns a regex created from the given pattern. - * @api public - */ + if (a === null || typeof a !== "object") a = {}; + if (b === null || typeof b !== "object") b = {}; - picomatch.compileRe = (parsed, options, returnOutput = false, returnState = false) => { - if (returnOutput === true) { - return parsed.output; + for (k in b) { + if (k in a) { + i[k] = interpolate(a[k], b[k]); + } else { + c[k] = b[k]; + } } - const opts = options || {}; - const prepend = opts.contains ? '' : '^'; - const append = opts.contains ? '' : '$'; + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; + } + + var reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g, + reB = new RegExp(reA.source, "g"); + + function zero(b) { + return function() { + return b; + }; + } + + function one(b) { + return function(t) { + return b(t) + ""; + }; + } + + function string(a, b) { + var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b + am, // current match in a + bm, // current match in b + bs, // string preceding current number in b, if any + i = -1, // index in s + s = [], // string constants and placeholders + q = []; // number interpolators + + // Coerce inputs to strings. + a = a + "", b = b + ""; - let source = \`\${prepend}(?:\${parsed.output})\${append}\`; - if (parsed && parsed.negated === true) { - source = \`^(?!\${source}).*$\`; + // Interpolate pairs of numbers in a & b. + while ((am = reA.exec(a)) + && (bm = reB.exec(b))) { + if ((bs = bm.index) > bi) { // a string precedes the next number in b + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; + } + if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match + if (s[i]) s[i] += bm; // coalesce with previous string + else s[++i] = bm; + } else { // interpolate non-matching numbers + s[++i] = null; + q.push({i: i, x: interpolateNumber(am, bm)}); + } + bi = reB.lastIndex; } - const regex = picomatch.toRegex(source, options); - if (returnState === true) { - regex.state = parsed; + // Add remains of b. + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; } - return regex; - }; + // Special optimization for only a single match. + // Otherwise, interpolate each of the numbers and rejoin the string. + return s.length < 2 ? (q[0] + ? one(q[0].x) + : zero(b)) + : (b = q.length, function(t) { + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); + } - picomatch.makeRe = (input, options, returnOutput = false, returnState = false) => { - if (!input || typeof input !== 'string') { - throw new TypeError('Expected a non-empty string'); - } + function interpolate(a, b) { + var t = typeof b, c; + return b == null || t === "boolean" ? constant(b) + : (t === "number" ? interpolateNumber + : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string) + : b instanceof color ? rgb + : b instanceof Date ? date + : isNumberArray(b) ? numberArray + : Array.isArray(b) ? genericArray + : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object + : interpolateNumber)(a, b); + } + + function interpolateRound(a, b) { + return a = +a, b = +b, function(t) { + return Math.round(a * (1 - t) + b * t); + }; + } - const opts = options || {}; - let parsed = { negated: false, fastpaths: true }; - let prefix = ''; - let output; + function constants(x) { + return function() { + return x; + }; + } - if (input.startsWith('./')) { - input = input.slice(2); - prefix = parsed.prefix = './'; - } + function number(x) { + return +x; + } + + var unit = [0, 1]; + + function identity$1(x) { + return x; + } + + function normalize(a, b) { + return (b -= (a = +a)) + ? function(x) { return (x - a) / b; } + : constants(isNaN(b) ? NaN : 0.5); + } + + function clamper(a, b) { + var t; + if (a > b) t = a, a = b, b = t; + return function(x) { return Math.max(a, Math.min(b, x)); }; + } + + // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. + // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. + function bimap(domain, range, interpolate) { + var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; + if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); + else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); + return function(x) { return r0(d0(x)); }; + } + + function polymap(domain, range, interpolate) { + var j = Math.min(domain.length, range.length) - 1, + d = new Array(j), + r = new Array(j), + i = -1; - if (opts.fastpaths !== false && (input[0] === '.' || input[0] === '*')) { - output = parse$1.fastpaths(input, options); + // Reverse descending domains. + if (domain[j] < domain[0]) { + domain = domain.slice().reverse(); + range = range.slice().reverse(); } - if (output === undefined) { - parsed = parse$1(input, options); - parsed.prefix = prefix + (parsed.prefix || ''); - } else { - parsed.output = output; + while (++i < j) { + d[i] = normalize(domain[i], domain[i + 1]); + r[i] = interpolate(range[i], range[i + 1]); } - return picomatch.compileRe(parsed, options, returnOutput, returnState); - }; + return function(x) { + var i = bisectRight(domain, x, 1, j) - 1; + return r[i](d[i](x)); + }; + } - /** - * Create a regular expression from the given regex source string. - * - * \`\`\`js - * const picomatch = require('picomatch'); - * // picomatch.toRegex(source[, options]); - * - * const { output } = picomatch.parse('*.js'); - * console.log(picomatch.toRegex(output)); - * //=> /^(?:(?!\\.)(?=.)[^/]*?\\.js)$/ - * \`\`\` - * @param {String} \`source\` Regular expression source string. - * @param {Object} \`options\` - * @return {RegExp} - * @api public - */ + function copy$1(source, target) { + return target + .domain(source.domain()) + .range(source.range()) + .interpolate(source.interpolate()) + .clamp(source.clamp()) + .unknown(source.unknown()); + } + + function transformer$1() { + var domain = unit, + range = unit, + interpolate$1 = interpolate, + transform, + untransform, + unknown, + clamp = identity$1, + piecewise, + output, + input; - picomatch.toRegex = (source, options) => { - try { - const opts = options || {}; - return new RegExp(source, opts.flags || (opts.nocase ? 'i' : '')); - } catch (err) { - if (options && options.debug === true) throw err; - return /$^/; + function rescale() { + var n = Math.min(domain.length, range.length); + if (clamp !== identity$1) clamp = clamper(domain[0], domain[n - 1]); + piecewise = n > 2 ? polymap : bimap; + output = input = null; + return scale; } - }; - /** - * Picomatch constants. - * @return {Object} - */ + function scale(x) { + return x == null || isNaN(x = +x) ? unknown : (output || (output = piecewise(domain.map(transform), range, interpolate$1)))(transform(clamp(x))); + } - picomatch.constants = constants$1; + scale.invert = function(y) { + return clamp(untransform((input || (input = piecewise(range, domain.map(transform), interpolateNumber)))(y))); + }; - /** - * Expose "picomatch" - */ + scale.domain = function(_) { + return arguments.length ? (domain = Array.from(_, number), rescale()) : domain.slice(); + }; - var picomatch_1 = picomatch; + scale.range = function(_) { + return arguments.length ? (range = Array.from(_), rescale()) : range.slice(); + }; - var picomatchBrowser = picomatch_1; + scale.rangeRound = function(_) { + return range = Array.from(_), interpolate$1 = interpolateRound, rescale(); + }; - var pm = /*@__PURE__*/getDefaultExportFromCjs(picomatchBrowser); + scale.clamp = function(_) { + return arguments.length ? (clamp = _ ? true : identity$1, rescale()) : clamp !== identity$1; + }; - function isArray(arg) { - return Array.isArray(arg); - } - function ensureArray(thing) { - if (isArray(thing)) - return thing; - if (thing == null) - return []; - return [thing]; + scale.interpolate = function(_) { + return arguments.length ? (interpolate$1 = _, rescale()) : interpolate$1; + }; + + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; + + return function(t, u) { + transform = t, untransform = u; + return rescale(); + }; } - const globToTest = (glob) => { - const pattern = glob; - const fn = pm(pattern, { dot: true }); - return { - test: (what) => { - const result = fn(what); - return result; - }, - }; - }; - const testTrue = { - test: () => true, - }; - const getMatcher = (filter) => { - const bundleTest = "bundle" in filter && filter.bundle != null ? globToTest(filter.bundle) : testTrue; - const fileTest = "file" in filter && filter.file != null ? globToTest(filter.file) : testTrue; - return { bundleTest, fileTest }; - }; - const createFilter = (include, exclude) => { - const includeMatchers = ensureArray(include).map(getMatcher); - const excludeMatchers = ensureArray(exclude).map(getMatcher); - return (bundleId, id) => { - for (let i = 0; i < excludeMatchers.length; ++i) { - const { bundleTest, fileTest } = excludeMatchers[i]; - if (bundleTest.test(bundleId) && fileTest.test(id)) - return false; - } - for (let i = 0; i < includeMatchers.length; ++i) { - const { bundleTest, fileTest } = includeMatchers[i]; - if (bundleTest.test(bundleId) && fileTest.test(id)) - return true; - } - return !includeMatchers.length; - }; - }; - - const throttleFilter = (callback, limit) => { - let waiting = false; - return (val) => { - if (!waiting) { - callback(val); - waiting = true; - setTimeout(() => { - waiting = false; - }, limit); - } - }; - }; - const prepareFilter = (filt) => { - if (filt === "") - return []; - return (filt - .split(",") - // remove spaces before and after - .map((entry) => entry.trim()) - // unquote " - .map((entry) => entry.startsWith('"') && entry.endsWith('"') ? entry.substring(1, entry.length - 1) : entry) - // unquote ' - .map((entry) => entry.startsWith("'") && entry.endsWith("'") ? entry.substring(1, entry.length - 1) : entry) - // remove empty strings - .filter((entry) => entry) - // parse bundle:file - .map((entry) => entry.split(":")) - // normalize entry just in case - .flatMap((entry) => { - if (entry.length === 0) - return []; - let bundle = null; - let file = null; - if (entry.length === 1 && entry[0]) { - file = entry[0]; - return [{ file, bundle }]; - } - bundle = entry[0] || null; - file = entry.slice(1).join(":") || null; - return [{ bundle, file }]; - })); - }; - const useFilter = () => { - const [includeFilter, setIncludeFilter] = h(""); - const [excludeFilter, setExcludeFilter] = h(""); - const setIncludeFilterTrottled = T(() => throttleFilter(setIncludeFilter, 200), []); - const setExcludeFilterTrottled = T(() => throttleFilter(setExcludeFilter, 200), []); - const isIncluded = T(() => createFilter(prepareFilter(includeFilter), prepareFilter(excludeFilter)), [includeFilter, excludeFilter]); - const getModuleFilterMultiplier = q((bundleId, data) => { - return isIncluded(bundleId, data.id) ? 1 : 0; - }, [isIncluded]); - return { - getModuleFilterMultiplier, - includeFilter, - excludeFilter, - setExcludeFilter: setExcludeFilterTrottled, - setIncludeFilter: setIncludeFilterTrottled, - }; - }; - - const TOP_PADDING = 20; - const PADDING = 2; - - const Node = ({ node, onMouseOver, onClick, selected }) => { - const { getModuleColor } = x(StaticContext); - const { backgroundColor, fontColor } = getModuleColor(node); - const { x0, x1, y1, y0, data, children = null } = node; - const textRef = A(null); - const textRectRef = A(); - const width = x1 - x0; - const height = y1 - y0; - const textProps = { - "font-size": "0.7em", - "dominant-baseline": "middle", - "text-anchor": "middle", - x: width / 2, - }; - if (children != null) { - textProps.y = (TOP_PADDING + PADDING) / 2; - } - else { - textProps.y = height / 2; - } - _(() => { - if (width == 0 || height == 0 || !textRef.current) { - return; - } - if (textRectRef.current == null) { - textRectRef.current = textRef.current.getBoundingClientRect(); - } - let scale = 1; - scale = Math.min((width * 0.9) / textRectRef.current.width, (height * 0.9) / textRectRef.current.height); - scale = Math.min(1, scale); - textRef.current.setAttribute("y", String(height / 2 / scale)); - textRef.current.setAttribute("x", String(width / 2 / scale)); - textRef.current.setAttribute("transform", \`scale(\${scale.toFixed(2)})\`); - }, [children, height, width]); - if (width == 0 || height == 0) { - return null; - } - return (u$1("g", { className: "node", transform: \`translate(\${x0},\${y0})\`, onClick: (event) => { - event.stopPropagation(); - onClick(node); - }, onMouseOver: (event) => { - event.stopPropagation(); - onMouseOver(node); - }, children: [u$1("rect", { fill: backgroundColor, rx: 2, ry: 2, width: x1 - x0, height: y1 - y0, stroke: selected ? "#fff" : undefined, "stroke-width": selected ? 2 : undefined }), u$1("text", Object.assign({ ref: textRef, fill: fontColor, onClick: (event) => { - var _a; - if (((_a = window.getSelection()) === null || _a === void 0 ? void 0 : _a.toString()) !== "") { - event.stopPropagation(); - } - } }, textProps, { children: data.name }))] })); - }; - - const FlameGraph = ({ root, onNodeHover, selectedNode, onNodeClick, }) => { - const { width, height, getModuleIds } = x(StaticContext); - return (u$1("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: \`0 0 \${width} \${height}\`, children: root.descendants().map((node) => { - return (u$1(Node, { node: node, onMouseOver: onNodeHover, selected: selectedNode === node, onClick: onNodeClick }, getModuleIds(node.data).nodeUid.id)); - }) })); - }; - - var bytes$1 = {exports: {}}; - - /*! - * bytes - * Copyright(c) 2012-2014 TJ Holowaychuk - * Copyright(c) 2015 Jed Watson - * MIT Licensed - */ - - /** - * Module exports. - * @public - */ - - bytes$1.exports = bytes; - var format_1 = bytes$1.exports.format = format$1; - bytes$1.exports.parse = parse; - - /** - * Module variables. - * @private - */ - var formatThousandsRegExp = /\\B(?=(\\d{3})+(?!\\d))/g; - - var formatDecimalsRegExp = /(?:\\.0*|(\\.[^0]+)0+)$/; - - var map$1 = { - b: 1, - kb: 1 << 10, - mb: 1 << 20, - gb: 1 << 30, - tb: Math.pow(1024, 4), - pb: Math.pow(1024, 5), - }; + function continuous() { + return transformer$1()(identity$1, identity$1); + } - var parseRegExp = /^((-|\\+)?(\\d+(?:\\.\\d+)?)) *(kb|mb|gb|tb|pb)$/i; - - /** - * Convert the given value in bytes into a string or parse to string to an integer in bytes. - * - * @param {string|number} value - * @param {{ - * case: [string], - * decimalPlaces: [number] - * fixedDecimals: [boolean] - * thousandsSeparator: [string] - * unitSeparator: [string] - * }} [options] bytes options. - * - * @returns {string|number|null} - */ + function formatDecimal(x) { + return Math.abs(x = Math.round(x)) >= 1e21 + ? x.toLocaleString("en").replace(/,/g, "") + : x.toString(10); + } - function bytes(value, options) { - if (typeof value === 'string') { - return parse(value); - } + // Computes the decimal coefficient and exponent of the specified number x with + // significant digits p, where x is positive and p is in [1, 21] or undefined. + // For example, formatDecimalParts(1.23) returns ["123", 0]. + function formatDecimalParts(x, p) { + if ((i = (x = p ? x.toExponential(p - 1) : x.toExponential()).indexOf("e")) < 0) return null; // NaN, ±Infinity + var i, coefficient = x.slice(0, i); - if (typeof value === 'number') { - return format$1(value, options); - } + // The string returned by toExponential either has the form \\d\\.\\d+e[-+]\\d+ + // (e.g., 1.2e+3) or the form \\de[-+]\\d+ (e.g., 1e+3). + return [ + coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, + +x.slice(i + 1) + ]; + } - return null; + function exponent(x) { + return x = formatDecimalParts(Math.abs(x)), x ? x[1] : NaN; } - /** - * Format the given value in bytes into a string. - * - * If the value is negative, it is kept as such. If it is a float, - * it is rounded. - * - * @param {number} value - * @param {object} [options] - * @param {number} [options.decimalPlaces=2] - * @param {number} [options.fixedDecimals=false] - * @param {string} [options.thousandsSeparator=] - * @param {string} [options.unit=] - * @param {string} [options.unitSeparator=] - * - * @returns {string|null} - * @public - */ + function formatGroup(grouping, thousands) { + return function(value, width) { + var i = value.length, + t = [], + j = 0, + g = grouping[0], + length = 0; - function format$1(value, options) { - if (!Number.isFinite(value)) { - return null; - } - - var mag = Math.abs(value); - var thousandsSeparator = (options && options.thousandsSeparator) || ''; - var unitSeparator = (options && options.unitSeparator) || ''; - var decimalPlaces = (options && options.decimalPlaces !== undefined) ? options.decimalPlaces : 2; - var fixedDecimals = Boolean(options && options.fixedDecimals); - var unit = (options && options.unit) || ''; - - if (!unit || !map$1[unit.toLowerCase()]) { - if (mag >= map$1.pb) { - unit = 'PB'; - } else if (mag >= map$1.tb) { - unit = 'TB'; - } else if (mag >= map$1.gb) { - unit = 'GB'; - } else if (mag >= map$1.mb) { - unit = 'MB'; - } else if (mag >= map$1.kb) { - unit = 'KB'; - } else { - unit = 'B'; + while (i > 0 && g > 0) { + if (length + g + 1 > width) g = Math.max(1, width - length); + t.push(value.substring(i -= g, i + g)); + if ((length += g + 1) > width) break; + g = grouping[j = (j + 1) % grouping.length]; } - } - var val = value / map$1[unit.toLowerCase()]; - var str = val.toFixed(decimalPlaces); + return t.reverse().join(thousands); + }; + } - if (!fixedDecimals) { - str = str.replace(formatDecimalsRegExp, '$1'); - } + function formatNumerals(numerals) { + return function(value) { + return value.replace(/[0-9]/g, function(i) { + return numerals[+i]; + }); + }; + } - if (thousandsSeparator) { - str = str.split('.').map(function (s, i) { - return i === 0 - ? s.replace(formatThousandsRegExp, thousandsSeparator) - : s - }).join('.'); - } + // [[fill]align][sign][symbol][0][width][,][.precision][~][type] + var re = /^(?:(.)?([<>=^]))?([+\\-( ])?([$#])?(0)?(\\d+)?(,)?(\\.\\d+)?(~)?([a-z%])?$/i; - return str + unitSeparator + unit; + function formatSpecifier(specifier) { + if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); + var match; + return new FormatSpecifier({ + fill: match[1], + align: match[2], + sign: match[3], + symbol: match[4], + zero: match[5], + width: match[6], + comma: match[7], + precision: match[8] && match[8].slice(1), + trim: match[9], + type: match[10] + }); } - /** - * Parse the string value into an integer in bytes. - * - * If no unit is given, it is assumed the value is in bytes. - * - * @param {number|string} val - * - * @returns {number|null} - * @public - */ + formatSpecifier.prototype = FormatSpecifier.prototype; // instanceof - function parse(val) { - if (typeof val === 'number' && !isNaN(val)) { - return val; - } + function FormatSpecifier(specifier) { + this.fill = specifier.fill === undefined ? " " : specifier.fill + ""; + this.align = specifier.align === undefined ? ">" : specifier.align + ""; + this.sign = specifier.sign === undefined ? "-" : specifier.sign + ""; + this.symbol = specifier.symbol === undefined ? "" : specifier.symbol + ""; + this.zero = !!specifier.zero; + this.width = specifier.width === undefined ? undefined : +specifier.width; + this.comma = !!specifier.comma; + this.precision = specifier.precision === undefined ? undefined : +specifier.precision; + this.trim = !!specifier.trim; + this.type = specifier.type === undefined ? "" : specifier.type + ""; + } - if (typeof val !== 'string') { - return null; - } - - // Test if the string passed is valid - var results = parseRegExp.exec(val); - var floatValue; - var unit = 'b'; + FormatSpecifier.prototype.toString = function() { + return this.fill + + this.align + + this.sign + + this.symbol + + (this.zero ? "0" : "") + + (this.width === undefined ? "" : Math.max(1, this.width | 0)) + + (this.comma ? "," : "") + + (this.precision === undefined ? "" : "." + Math.max(0, this.precision | 0)) + + (this.trim ? "~" : "") + + this.type; + }; - if (!results) { - // Nothing could be extracted from the given string - floatValue = parseInt(val, 10); - unit = 'b'; - } else { - // Retrieve the value and the unit - floatValue = parseFloat(results[1]); - unit = results[4].toLowerCase(); + // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. + function formatTrim(s) { + out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (s[i]) { + case ".": i0 = i1 = i; break; + case "0": if (i0 === 0) i0 = i; i1 = i; break; + default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break; + } } + return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; + } - if (isNaN(floatValue)) { - return null; - } + var prefixExponent; - return Math.floor(map$1[unit] * floatValue); + function formatPrefixAuto(x, p) { + var d = formatDecimalParts(x, p); + if (!d) return x + ""; + var coefficient = d[0], + exponent = d[1], + i = exponent - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent / 3))) * 3) + 1, + n = coefficient.length; + return i === n ? coefficient + : i > n ? coefficient + new Array(i - n + 1).join("0") + : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) + : "0." + new Array(1 - i).join("0") + formatDecimalParts(x, Math.max(0, p + i - 1))[0]; // less than 1y! } - const Tooltip_marginX = 10; - const Tooltip_marginY = 30; - const SOURCEMAP_RENDERED = (u$1("span", { children: [" ", u$1("b", { children: LABELS.renderedLength }), " is a number of characters in the file after individual and ", u$1("br", {}), " ", "whole bundle transformations according to sourcemap."] })); - const RENDRED = (u$1("span", { children: [u$1("b", { children: LABELS.renderedLength }), " is a byte size of individual file after transformations and treeshake."] })); - const COMPRESSED = (u$1("span", { children: [u$1("b", { children: LABELS.gzipLength }), " and ", u$1("b", { children: LABELS.brotliLength }), " is a byte size of individual file after individual transformations,", u$1("br", {}), " treeshake and compression."] })); - const Tooltip = ({ node, visible, root, sizeProperty, }) => { - const { availableSizeProperties, getModuleSize, data } = x(StaticContext); - const ref = A(null); - const [style, setStyle] = h({}); - const content = T(() => { - if (!node) - return null; - const mainSize = getModuleSize(node.data, sizeProperty); - const percentageNum = (100 * mainSize) / getModuleSize(root.data, sizeProperty); - const percentage = percentageNum.toFixed(2); - const percentageString = percentage + "%"; - const path = node - .ancestors() - .reverse() - .map((d) => d.data.name) - .join("/"); - let dataNode = null; - if (!isModuleTree(node.data)) { - const mainUid = data.nodeParts[node.data.uid].metaUid; - dataNode = data.nodeMetas[mainUid]; - } - return (u$1(k$1, { children: [u$1("div", { children: path }), availableSizeProperties.map((sizeProp) => { - if (sizeProp === sizeProperty) { - return (u$1("div", { children: [u$1("b", { children: [LABELS[sizeProp], ": ", format_1(mainSize)] }), " ", "(", percentageString, ")"] }, sizeProp)); - } - else { - return (u$1("div", { children: [LABELS[sizeProp], ": ", format_1(getModuleSize(node.data, sizeProp))] }, sizeProp)); - } - }), u$1("br", {}), dataNode && dataNode.importedBy.length > 0 && (u$1("div", { children: [u$1("div", { children: [u$1("b", { children: "Imported By" }), ":"] }), dataNode.importedBy.map(({ uid }) => { - const id = data.nodeMetas[uid].id; - return u$1("div", { children: id }, id); - })] })), u$1("br", {}), u$1("small", { children: data.options.sourcemap ? SOURCEMAP_RENDERED : RENDRED }), (data.options.gzip || data.options.brotli) && (u$1(k$1, { children: [u$1("br", {}), u$1("small", { children: COMPRESSED })] }))] })); - }, [availableSizeProperties, data, getModuleSize, node, root.data, sizeProperty]); - const updatePosition = (mouseCoords) => { - if (!ref.current) - return; - const pos = { - left: mouseCoords.x + Tooltip_marginX, - top: mouseCoords.y + Tooltip_marginY, - }; - const boundingRect = ref.current.getBoundingClientRect(); - if (pos.left + boundingRect.width > window.innerWidth) { - // Shifting horizontally - pos.left = window.innerWidth - boundingRect.width; - } - if (pos.top + boundingRect.height > window.innerHeight) { - // Flipping vertically - pos.top = mouseCoords.y - Tooltip_marginY - boundingRect.height; - } - setStyle(pos); - }; - y(() => { - const handleMouseMove = (event) => { - updatePosition({ - x: event.pageX, - y: event.pageY, - }); - }; - document.addEventListener("mousemove", handleMouseMove, true); - return () => { - document.removeEventListener("mousemove", handleMouseMove, true); - }; - }, []); - return (u$1("div", { className: \`tooltip \${visible ? "" : "tooltip-hidden"}\`, ref: ref, style: style, children: content })); - }; - - const Chart = ({ root, sizeProperty, selectedNode, setSelectedNode, }) => { - const [showTooltip, setShowTooltip] = h(false); - const [tooltipNode, setTooltipNode] = h(undefined); - y(() => { - const handleMouseOut = () => { - setShowTooltip(false); - }; - document.addEventListener("mouseover", handleMouseOut); - return () => { - document.removeEventListener("mouseover", handleMouseOut); - }; - }, []); - return (u$1(k$1, { children: [u$1(FlameGraph, { root: root, onNodeHover: (node) => { - setTooltipNode(node); - setShowTooltip(true); - }, selectedNode: selectedNode, onNodeClick: (node) => { - setSelectedNode(selectedNode === node ? undefined : node); - } }), u$1(Tooltip, { visible: showTooltip, node: tooltipNode, root: root, sizeProperty: sizeProperty })] })); - }; + function formatRounded(x, p) { + var d = formatDecimalParts(x, p); + if (!d) return x + ""; + var coefficient = d[0], + exponent = d[1]; + return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient + : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) + : coefficient + new Array(exponent - coefficient.length + 2).join("0"); + } - const Main = () => { - const { availableSizeProperties, rawHierarchy, getModuleSize, layout, data } = x(StaticContext); - const [sizeProperty, setSizeProperty] = h(availableSizeProperties[0]); - const [selectedNode, setSelectedNode] = h(undefined); - const { getModuleFilterMultiplier, setExcludeFilter, setIncludeFilter } = useFilter(); - console.time("getNodeSizeMultiplier"); - const getNodeSizeMultiplier = T(() => { - const selectedMultiplier = 1; // selectedSize < rootSize * increaseFactor ? (rootSize * increaseFactor) / selectedSize : rootSize / selectedSize; - const nonSelectedMultiplier = 0; // 1 / selectedMultiplier - if (selectedNode === undefined) { - return () => 1; - } - else if (isModuleTree(selectedNode.data)) { - const leaves = new Set(selectedNode.leaves().map((d) => d.data)); - return (node) => { - if (leaves.has(node)) { - return selectedMultiplier; - } - return nonSelectedMultiplier; - }; - } - else { - return (node) => { - if (node === selectedNode.data) { - return selectedMultiplier; - } - return nonSelectedMultiplier; - }; - } - }, [getModuleSize, rawHierarchy.data, selectedNode, sizeProperty]); - console.timeEnd("getNodeSizeMultiplier"); - console.time("root hierarchy compute"); - // root here always be the same as rawHierarchy even after layouting - const root = T(() => { - const rootWithSizesAndSorted = rawHierarchy - .sum((node) => { - var _a; - if (isModuleTree(node)) - return 0; - const meta = data.nodeMetas[data.nodeParts[node.uid].metaUid]; - /* eslint-disable typescript/no-non-null-asserted-optional-chain typescript/no-extra-non-null-assertion */ - const bundleId = (_a = Object.entries(meta.moduleParts).find(([, uid]) => uid == node.uid)) === null || _a === void 0 ? void 0 : _a[0]; - const ownSize = getModuleSize(node, sizeProperty); - const zoomMultiplier = getNodeSizeMultiplier(node); - const filterMultiplier = getModuleFilterMultiplier(bundleId, meta); - return ownSize * zoomMultiplier * filterMultiplier; - }) - .sort((a, b) => getModuleSize(a.data, sizeProperty) - getModuleSize(b.data, sizeProperty)); - return layout(rootWithSizesAndSorted); - }, [ - data, - getModuleFilterMultiplier, - getModuleSize, - getNodeSizeMultiplier, - layout, - rawHierarchy, - sizeProperty, - ]); - console.timeEnd("root hierarchy compute"); - return (u$1(k$1, { children: [u$1(SideBar, { sizeProperty: sizeProperty, availableSizeProperties: availableSizeProperties, setSizeProperty: setSizeProperty, onExcludeChange: setExcludeFilter, onIncludeChange: setIncludeFilter }), u$1(Chart, { root: root, sizeProperty: sizeProperty, selectedNode: selectedNode, setSelectedNode: setSelectedNode })] })); + var formatTypes = { + "%": (x, p) => (x * 100).toFixed(p), + "b": (x) => Math.round(x).toString(2), + "c": (x) => x + "", + "d": formatDecimal, + "e": (x, p) => x.toExponential(p), + "f": (x, p) => x.toFixed(p), + "g": (x, p) => x.toPrecision(p), + "o": (x) => Math.round(x).toString(8), + "p": (x, p) => formatRounded(x * 100, p), + "r": formatRounded, + "s": formatPrefixAuto, + "X": (x) => Math.round(x).toString(16).toUpperCase(), + "x": (x) => Math.round(x).toString(16) }; - function ascending(a, b) { - return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; + function identity(x) { + return x; } - function descending(a, b) { - return a == null || b == null ? NaN - : b < a ? -1 - : b > a ? 1 - : b >= a ? 0 - : NaN; - } + var map = Array.prototype.map, + prefixes = ["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"]; - function bisector(f) { - let compare1, compare2, delta; + function formatLocale(locale) { + var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), + currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", + currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", + decimal = locale.decimal === undefined ? "." : locale.decimal + "", + numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)), + percent = locale.percent === undefined ? "%" : locale.percent + "", + minus = locale.minus === undefined ? "−" : locale.minus + "", + nan = locale.nan === undefined ? "NaN" : locale.nan + ""; - // If an accessor is specified, promote it to a comparator. In this case we - // can test whether the search value is (self-) comparable. We can’t do this - // for a comparator (except for specific, known comparators) because we can’t - // tell if the comparator is symmetric, and an asymmetric comparator can’t be - // used to test whether a single value is comparable. - if (f.length !== 2) { - compare1 = ascending; - compare2 = (d, x) => ascending(f(d), x); - delta = (d, x) => f(d) - x; - } else { - compare1 = f === ascending || f === descending ? f : zero$1; - compare2 = f; - delta = f; - } + function newFormat(specifier) { + specifier = formatSpecifier(specifier); - function left(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = (lo + hi) >>> 1; - if (compare2(a[mid], x) < 0) lo = mid + 1; - else hi = mid; - } while (lo < hi); - } - return lo; - } + var fill = specifier.fill, + align = specifier.align, + sign = specifier.sign, + symbol = specifier.symbol, + zero = specifier.zero, + width = specifier.width, + comma = specifier.comma, + precision = specifier.precision, + trim = specifier.trim, + type = specifier.type; - function right(a, x, lo = 0, hi = a.length) { - if (lo < hi) { - if (compare1(x, x) !== 0) return hi; - do { - const mid = (lo + hi) >>> 1; - if (compare2(a[mid], x) <= 0) lo = mid + 1; - else hi = mid; - } while (lo < hi); - } - return lo; - } + // The "n" type is an alias for ",g". + if (type === "n") comma = true, type = "g"; - function center(a, x, lo = 0, hi = a.length) { - const i = left(a, x, lo, hi - 1); - return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i; - } + // The "" type, and any invalid type, is an alias for ".12~g". + else if (!formatTypes[type]) precision === undefined && (precision = 12), trim = true, type = "g"; - return {left, center, right}; - } + // If zero fill is specified, padding goes after sign and before digits. + if (zero || (fill === "0" && align === "=")) zero = true, fill = "0", align = "="; - function zero$1() { - return 0; - } + // Compute the prefix and suffix. + // For SI-prefix, the suffix is lazily computed. + var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type) ? "0" + type.toLowerCase() : "", + suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type) ? percent : ""; - function number$1(x) { - return x === null ? NaN : +x; - } + // What format function should we use? + // Is this an integer type? + // Can this type generate exponential notation? + var formatType = formatTypes[type], + maybeSuffix = /[defgprs%]/.test(type); - const ascendingBisect = bisector(ascending); - const bisectRight = ascendingBisect.right; - bisector(number$1).center; + // Set the default precision if not specified, + // or clamp the specified precision to the supported range. + // For significant precision, it must be in [1, 21]. + // For fixed precision, it must be in [0, 20]. + precision = precision === undefined ? 6 + : /[gprs]/.test(type) ? Math.max(1, Math.min(21, precision)) + : Math.max(0, Math.min(20, precision)); - const e10 = Math.sqrt(50), - e5 = Math.sqrt(10), - e2 = Math.sqrt(2); + function format(value) { + var valuePrefix = prefix, + valueSuffix = suffix, + i, n, c; - function tickSpec(start, stop, count) { - const step = (stop - start) / Math.max(0, count), - power = Math.floor(Math.log10(step)), - error = step / Math.pow(10, power), - factor = error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1; - let i1, i2, inc; - if (power < 0) { - inc = Math.pow(10, -power) / factor; - i1 = Math.round(start * inc); - i2 = Math.round(stop * inc); - if (i1 / inc < start) ++i1; - if (i2 / inc > stop) --i2; - inc = -inc; - } else { - inc = Math.pow(10, power) * factor; - i1 = Math.round(start / inc); - i2 = Math.round(stop / inc); - if (i1 * inc < start) ++i1; - if (i2 * inc > stop) --i2; + if (type === "c") { + valueSuffix = formatType(value) + valueSuffix; + value = ""; + } else { + value = +value; + + // Determine the sign. -0 is not less than 0, but 1 / -0 is! + var valueNegative = value < 0 || 1 / value < 0; + + // Perform the initial formatting. + value = isNaN(value) ? nan : formatType(Math.abs(value), precision); + + // Trim insignificant zeros. + if (trim) value = formatTrim(value); + + // If a negative value rounds to zero after formatting, and no explicit positive sign is requested, hide the sign. + if (valueNegative && +value === 0 && sign !== "+") valueNegative = false; + + // Compute the prefix and suffix. + valuePrefix = (valueNegative ? (sign === "(" ? sign : minus) : sign === "-" || sign === "(" ? "" : sign) + valuePrefix; + valueSuffix = (type === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign === "(" ? ")" : ""); + + // Break the formatted value into the integer “value” part that can be + // grouped, and fractional or exponential “suffix” part that is not. + if (maybeSuffix) { + i = -1, n = value.length; + while (++i < n) { + if (c = value.charCodeAt(i), 48 > c || c > 57) { + valueSuffix = (c === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; + value = value.slice(0, i); + break; + } + } + } + } + + // If the fill character is not "0", grouping is applied before padding. + if (comma && !zero) value = group(value, Infinity); + + // Compute the padding. + var length = valuePrefix.length + value.length + valueSuffix.length, + padding = length < width ? new Array(width - length + 1).join(fill) : ""; + + // If the fill character is "0", grouping is applied after padding. + if (comma && zero) value = group(padding + value, padding.length ? width - valueSuffix.length : Infinity), padding = ""; + + // Reconstruct the final output based on the desired alignment. + switch (align) { + case "<": value = valuePrefix + value + valueSuffix + padding; break; + case "=": value = valuePrefix + padding + value + valueSuffix; break; + case "^": value = padding.slice(0, length = padding.length >> 1) + valuePrefix + value + valueSuffix + padding.slice(length); break; + default: value = padding + valuePrefix + value + valueSuffix; break; + } + + return numerals(value); + } + + format.toString = function() { + return specifier + ""; + }; + + return format; } - if (i2 < i1 && 0.5 <= count && count < 2) return tickSpec(start, stop, count * 2); - return [i1, i2, inc]; - } - function ticks(start, stop, count) { - stop = +stop, start = +start, count = +count; - if (!(count > 0)) return []; - if (start === stop) return [start]; - const reverse = stop < start, [i1, i2, inc] = reverse ? tickSpec(stop, start, count) : tickSpec(start, stop, count); - if (!(i2 >= i1)) return []; - const n = i2 - i1 + 1, ticks = new Array(n); - if (reverse) { - if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) / -inc; - else for (let i = 0; i < n; ++i) ticks[i] = (i2 - i) * inc; - } else { - if (inc < 0) for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) / -inc; - else for (let i = 0; i < n; ++i) ticks[i] = (i1 + i) * inc; + function formatPrefix(specifier, value) { + var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), + e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, + k = Math.pow(10, -e), + prefix = prefixes[8 + e / 3]; + return function(value) { + return f(k * value) + prefix; + }; } - return ticks; + + return { + format: newFormat, + formatPrefix: formatPrefix + }; } - function tickIncrement(start, stop, count) { - stop = +stop, start = +start, count = +count; - return tickSpec(start, stop, count)[2]; + var locale; + var format; + var formatPrefix; + + defaultLocale({ + thousands: ",", + grouping: [3], + currency: ["$", ""] + }); + + function defaultLocale(definition) { + locale = formatLocale(definition); + format = locale.format; + formatPrefix = locale.formatPrefix; + return locale; } - function tickStep(start, stop, count) { - stop = +stop, start = +start, count = +count; - const reverse = stop < start, inc = reverse ? tickIncrement(stop, start, count) : tickIncrement(start, stop, count); - return (reverse ? -1 : 1) * (inc < 0 ? 1 / -inc : inc); + function precisionFixed(step) { + return Math.max(0, -exponent(Math.abs(step))); } - function initRange(domain, range) { - switch (arguments.length) { - case 0: break; - case 1: this.range(domain); break; - default: this.range(range).domain(domain); break; - } - return this; + function precisionPrefix(step, value) { + return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); } - function initInterpolator(domain, interpolator) { - switch (arguments.length) { - case 0: break; - case 1: { - if (typeof domain === "function") this.interpolator(domain); - else this.range(domain); + function precisionRound(step, max) { + step = Math.abs(step), max = Math.abs(max) - step; + return Math.max(0, exponent(max) - exponent(step)) + 1; + } + + function tickFormat(start, stop, count, specifier) { + var step = tickStep(start, stop, count), + precision; + specifier = formatSpecifier(specifier == null ? ",f" : specifier); + switch (specifier.type) { + case "s": { + var value = Math.max(Math.abs(start), Math.abs(stop)); + if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision; + return formatPrefix(specifier, value); + } + case "": + case "e": + case "g": + case "p": + case "r": { + if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); break; } - default: { - this.domain(domain); - if (typeof interpolator === "function") this.interpolator(interpolator); - else this.range(interpolator); + case "f": + case "%": { + if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; break; } } - return this; + return format(specifier); } - function define(constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - } + function linearish(scale) { + var domain = scale.domain; - function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - for (var key in definition) prototype[key] = definition[key]; - return prototype; - } + scale.ticks = function(count) { + var d = domain(); + return ticks(d[0], d[d.length - 1], count == null ? 10 : count); + }; - function Color() {} + scale.tickFormat = function(count, specifier) { + var d = domain(); + return tickFormat(d[0], d[d.length - 1], count == null ? 10 : count, specifier); + }; - var darker = 0.7; - var brighter = 1 / darker; + scale.nice = function(count) { + if (count == null) count = 10; - var reI = "\\\\s*([+-]?\\\\d+)\\\\s*", - reN = "\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)\\\\s*", - reP = "\\\\s*([+-]?(?:\\\\d*\\\\.)?\\\\d+(?:[eE][+-]?\\\\d+)?)%\\\\s*", - reHex = /^#([0-9a-f]{3,8})$/, - reRgbInteger = new RegExp(\`^rgb\\\\(\${reI},\${reI},\${reI}\\\\)$\`), - reRgbPercent = new RegExp(\`^rgb\\\\(\${reP},\${reP},\${reP}\\\\)$\`), - reRgbaInteger = new RegExp(\`^rgba\\\\(\${reI},\${reI},\${reI},\${reN}\\\\)$\`), - reRgbaPercent = new RegExp(\`^rgba\\\\(\${reP},\${reP},\${reP},\${reN}\\\\)$\`), - reHslPercent = new RegExp(\`^hsl\\\\(\${reN},\${reP},\${reP}\\\\)$\`), - reHslaPercent = new RegExp(\`^hsla\\\\(\${reN},\${reP},\${reP},\${reN}\\\\)$\`); + var d = domain(); + var i0 = 0; + var i1 = d.length - 1; + var start = d[i0]; + var stop = d[i1]; + var prestep; + var step; + var maxIter = 10; - var named = { - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 - }; + if (stop < start) { + step = start, start = stop, stop = step; + step = i0, i0 = i1, i1 = step; + } + + while (maxIter-- > 0) { + step = tickIncrement(start, stop, count); + if (step === prestep) { + d[i0] = start; + d[i1] = stop; + return domain(d); + } else if (step > 0) { + start = Math.floor(start / step) * step; + stop = Math.ceil(stop / step) * step; + } else if (step < 0) { + start = Math.ceil(start * step) / step; + stop = Math.floor(stop * step) / step; + } else { + break; + } + prestep = step; + } - define(Color, color, { - copy(channels) { - return Object.assign(new this.constructor, this, channels); - }, - displayable() { - return this.rgb().displayable(); - }, - hex: color_formatHex, // Deprecated! Use color.formatHex. - formatHex: color_formatHex, - formatHex8: color_formatHex8, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb - }); + return scale; + }; - function color_formatHex() { - return this.rgb().formatHex(); + return scale; } - function color_formatHex8() { - return this.rgb().formatHex8(); - } + function linear() { + var scale = continuous(); - function color_formatHsl() { - return hslConvert(this).formatHsl(); - } + scale.copy = function() { + return copy$1(scale, linear()); + }; - function color_formatRgb() { - return this.rgb().formatRgb(); + initRange.apply(scale, arguments); + + return linearish(scale); } - function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 - : null) // invalid hex - : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) - : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins - : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) - : null; - } - - function rgbn(n) { - return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); - } - - function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); - } - - function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb; - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); - } - - function rgb$1(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); - } - - function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; - } - - define(Rgb, rgb$1, extend(Color, { - brighter(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb() { - return this; - }, - clamp() { - return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity)); - }, - displayable() { - return (-0.5 <= this.r && this.r < 255.5) - && (-0.5 <= this.g && this.g < 255.5) - && (-0.5 <= this.b && this.b < 255.5) - && (0 <= this.opacity && this.opacity <= 1); - }, - hex: rgb_formatHex, // Deprecated! Use color.formatHex. - formatHex: rgb_formatHex, - formatHex8: rgb_formatHex8, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb - })); - - function rgb_formatHex() { - return \`#\${hex(this.r)}\${hex(this.g)}\${hex(this.b)}\`; - } - - function rgb_formatHex8() { - return \`#\${hex(this.r)}\${hex(this.g)}\${hex(this.b)}\${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}\`; - } - - function rgb_formatRgb() { - const a = clampa(this.opacity); - return \`\${a === 1 ? "rgb(" : "rgba("}\${clampi(this.r)}, \${clampi(this.g)}, \${clampi(this.b)}\${a === 1 ? ")" : \`, \${a})\`}\`; - } - - function clampa(opacity) { - return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity)); - } - - function clampi(value) { - return Math.max(0, Math.min(255, Math.round(value) || 0)); - } - - function hex(value) { - value = clampi(value); - return (value < 16 ? "0" : "") + value.toString(16); - } - - function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN; - else if (l <= 0 || l >= 1) h = s = NaN; - else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); - } + function transformer() { + var x0 = 0, + x1 = 1, + t0, + t1, + k10, + transform, + interpolator = identity$1, + clamp = false, + unknown; - function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl; - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - h = NaN, - s = max - min, - l = (max + min) / 2; - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6; - else if (g === max) h = (b - r) / s + 2; - else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; + function scale(x) { + return x == null || isNaN(x = +x) ? unknown : interpolator(k10 === 0 ? 0.5 : (x = (transform(x) - t0) * k10, clamp ? Math.max(0, Math.min(1, x)) : x)); } - return new Hsl(h, s, l, o.opacity); - } - function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); - } + scale.domain = function(_) { + return arguments.length ? ([x0, x1] = _, t0 = transform(x0 = +x0), t1 = transform(x1 = +x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0), scale) : [x0, x1]; + }; - function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; - } + scale.clamp = function(_) { + return arguments.length ? (clamp = !!_, scale) : clamp; + }; - define(Hsl, hsl, extend(Color, { - brighter(k) { - k = k == null ? brighter : Math.pow(brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker(k) { - k = k == null ? darker : Math.pow(darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb() { - var h = this.h % 360 + (this.h < 0) * 360, - s = isNaN(h) || isNaN(this.s) ? 0 : this.s, - l = this.l, - m2 = l + (l < 0.5 ? l : 1 - l) * s, - m1 = 2 * l - m2; - return new Rgb( - hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), - hsl2rgb(h, m1, m2), - hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), - this.opacity - ); - }, - clamp() { - return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity)); - }, - displayable() { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) - && (0 <= this.l && this.l <= 1) - && (0 <= this.opacity && this.opacity <= 1); - }, - formatHsl() { - const a = clampa(this.opacity); - return \`\${a === 1 ? "hsl(" : "hsla("}\${clamph(this.h)}, \${clampt(this.s) * 100}%, \${clampt(this.l) * 100}%\${a === 1 ? ")" : \`, \${a})\`}\`; - } - })); + scale.interpolator = function(_) { + return arguments.length ? (interpolator = _, scale) : interpolator; + }; - function clamph(value) { - value = (value || 0) % 360; - return value < 0 ? value + 360 : value; - } + function range(interpolate) { + return function(_) { + var r0, r1; + return arguments.length ? ([r0, r1] = _, interpolator = interpolate(r0, r1), scale) : [interpolator(0), interpolator(1)]; + }; + } - function clampt(value) { - return Math.max(0, Math.min(1, value || 0)); - } + scale.range = range(interpolate); - /* From FvD 13.37, CSS Color Module Level 3 */ - function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 - : h < 180 ? m2 - : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 - : m1) * 255; - } + scale.rangeRound = range(interpolateRound); - var constant = x => () => x; + scale.unknown = function(_) { + return arguments.length ? (unknown = _, scale) : unknown; + }; - function linear$1(a, d) { return function(t) { - return a + t * d; + transform = t, t0 = t(x0), t1 = t(x1), k10 = t0 === t1 ? 0 : 1 / (t1 - t0); + return scale; }; } - function exponential(a, b, y) { - return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) { - return Math.pow(a + t * b, y); - }; + function copy(source, target) { + return target + .domain(source.domain()) + .interpolator(source.interpolator()) + .clamp(source.clamp()) + .unknown(source.unknown()); } - function gamma(y) { - return (y = +y) === 1 ? nogamma : function(a, b) { - return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a); + function sequential() { + var scale = linearish(transformer()(identity$1)); + + scale.copy = function() { + return copy(scale, sequential()); }; - } - function nogamma(a, b) { - var d = b - a; - return d ? linear$1(a, d) : constant(isNaN(a) ? b : a); + return initInterpolator.apply(scale, arguments); } - var rgb = (function rgbGamma(y) { - var color = gamma(y); - - function rgb(start, end) { - var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r), - g = color(start.g, end.g), - b = color(start.b, end.b), - opacity = nogamma(start.opacity, end.opacity); - return function(t) { - start.r = r(t); - start.g = g(t); - start.b = b(t); - start.opacity = opacity(t); - return start + ""; - }; - } - - rgb.gamma = rgbGamma; - - return rgb; - })(1); + const COLOR_BASE = "#cecece"; - function numberArray(a, b) { - if (!b) b = []; - var n = a ? Math.min(b.length, a.length) : 0, - c = b.slice(), - i; - return function(t) { - for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; - return c; - }; + // https://www.w3.org/TR/WCAG20/#relativeluminancedef + const rc = 0.2126; + const gc = 0.7152; + const bc = 0.0722; + // low-gamma adjust coefficient + const lowc = 1 / 12.92; + function adjustGamma(p) { + return Math.pow((p + 0.055) / 1.055, 2.4); } - - function isNumberArray(x) { - return ArrayBuffer.isView(x) && !(x instanceof DataView); + function relativeLuminance(o) { + const rsrgb = o.r / 255; + const gsrgb = o.g / 255; + const bsrgb = o.b / 255; + const r = rsrgb <= 0.03928 ? rsrgb * lowc : adjustGamma(rsrgb); + const g = gsrgb <= 0.03928 ? gsrgb * lowc : adjustGamma(gsrgb); + const b = bsrgb <= 0.03928 ? bsrgb * lowc : adjustGamma(bsrgb); + return r * rc + g * gc + b * bc; } + const createRainbowColor = (root) => { + const colorParentMap = new Map(); + colorParentMap.set(root, COLOR_BASE); + if (root.children != null) { + const colorScale = sequential([0, root.children.length], (n) => hsl(360 * n, 0.3, 0.85)); + root.children.forEach((c, id) => { + colorParentMap.set(c, colorScale(id).toString()); + }); + } + const colorMap = new Map(); + const lightScale = linear().domain([0, root.height]).range([0.9, 0.3]); + const getBackgroundColor = (node) => { + const parents = node.ancestors(); + const colorStr = parents.length === 1 + ? colorParentMap.get(parents[0]) + : colorParentMap.get(parents[parents.length - 2]); + const hslColor = hsl(colorStr); + hslColor.l = lightScale(node.depth); + return hslColor; + }; + return (node) => { + if (!colorMap.has(node)) { + const backgroundColor = getBackgroundColor(node); + const l = relativeLuminance(backgroundColor.rgb()); + const fontColor = l > 0.19 ? "#000" : "#fff"; + colorMap.set(node, { + backgroundColor: backgroundColor.toString(), + fontColor, + }); + } + return colorMap.get(node); + }; + }; - function genericArray(a, b) { - var nb = b ? b.length : 0, - na = a ? Math.min(nb, a.length) : 0, - x = new Array(na), - c = new Array(nb), - i; - - for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]); - for (; i < nb; ++i) c[i] = b[i]; + const StaticContext = J({}); + const drawChart = (parentNode, data, width, height) => { + const availableSizeProperties = getAvailableSizeOptions(data.options); + console.time("layout create"); + const layout = partition() + .size([width, height]) + .padding(PADDING) + .round(true); + console.timeEnd("layout create"); + console.time("rawHierarchy create"); + const rawHierarchy = hierarchy(data.tree); + console.timeEnd("rawHierarchy create"); + const nodeSizesCache = new Map(); + const nodeIdsCache = new Map(); + const getModuleSize = (node, sizeKey) => { var _a, _b; return (_b = (_a = nodeSizesCache.get(node)) === null || _a === void 0 ? void 0 : _a[sizeKey]) !== null && _b !== void 0 ? _b : 0; }; + console.time("rawHierarchy eachAfter cache"); + rawHierarchy.eachAfter((node) => { + var _a; + const nodeData = node.data; + nodeIdsCache.set(nodeData, { + nodeUid: generateUniqueId("node"), + clipUid: generateUniqueId("clip"), + }); + const sizes = { renderedLength: 0, gzipLength: 0, brotliLength: 0 }; + if (isModuleTree(nodeData)) { + for (const sizeKey of availableSizeProperties) { + sizes[sizeKey] = nodeData.children.reduce((acc, child) => getModuleSize(child, sizeKey) + acc, 0); + } + } + else { + for (const sizeKey of availableSizeProperties) { + sizes[sizeKey] = (_a = data.nodeParts[nodeData.uid][sizeKey]) !== null && _a !== void 0 ? _a : 0; + } + } + nodeSizesCache.set(nodeData, sizes); + }); + console.timeEnd("rawHierarchy eachAfter cache"); + const getModuleIds = (node) => nodeIdsCache.get(node); + console.time("color"); + const getModuleColor = createRainbowColor(rawHierarchy); + console.timeEnd("color"); + D$1(u$1(StaticContext.Provider, { value: { + data, + availableSizeProperties, + width, + height, + getModuleSize, + getModuleIds, + getModuleColor, + rawHierarchy, + layout, + }, children: u$1(Main, {}) }), parentNode); + }; - return function(t) { - for (i = 0; i < na; ++i) c[i] = x[i](t); - return c; - }; - } + exports.StaticContext = StaticContext; + exports.default = drawChart; - function date(a, b) { - var d = new Date; - return a = +a, b = +b, function(t) { - return d.setTime(a * (1 - t) + b * t), d; - }; - } + Object.defineProperty(exports, '__esModule', { value: true }); - function interpolateNumber(a, b) { - return a = +a, b = +b, function(t) { - return a * (1 - t) + b * t; - }; - } + return exports; - function object(a, b) { - var i = {}, - c = {}, - k; +})({}); - if (a === null || typeof a !== "object") a = {}; - if (b === null || typeof b !== "object") b = {}; + /*-->*/ + + + + - function one(b) { - return function(t) { - return b(t) + ""; - }; - } +" +`; - function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b - am, // current match in a - bm, // current match in b - bs, // string preceding current number in b, if any - i = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators +exports[`E2E > test - "list" 1`] = ` +"file3-XCd8Ebz0.js: + /test/e2e/file3.js: + rendered: 60 + gzip: 76 + brotli: 52 +input.js: + /test/e2e/input.js: + rendered: 78 + gzip: 91 + brotli: 69 +input2.js: + /test/e2e/input2.js: + rendered: 124 + gzip: 126 + brotli: 105 +" +`; - // Coerce inputs to strings. - a = a + "", b = b + ""; +exports[`E2E > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + var rgb = (function rgbGamma(y) { + var color = gamma(y); -" -`; + function rgb(start, end) { + var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r), + g = color(start.g, end.g), + b = color(start.b, end.b), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; + } -exports[`E2E > test - "list" 1`] = ` -"file3-XCd8Ebz0.js: - /test/e2e/file3.js: - rendered: 60 - gzip: 76 - brotli: 52 -input.js: - /test/e2e/input.js: - rendered: 78 - gzip: 91 - brotli: 69 -input2.js: - /test/e2e/input2.js: - rendered: 124 - gzip: 126 - brotli: 105 -" -`; + rgb.gamma = rgbGamma; -exports[`E2E > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - const decrement = type => { - state[type]--; - stack.pop(); - }; +" +`; - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; +exports[`E2E > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "input.js", + "children": [ + { + "name": "test/e2e/input.js", + "uid": "7665939b-1" + } + ] + }, + { + "name": "input2.js", + "children": [ + { + "name": "test/e2e/input2.js", + "uid": "7665939b-3" + } + ] + }, + { + "name": "file3-XCd8Ebz0.js", + "children": [ + { + "name": "test/e2e/file3.js", + "uid": "7665939b-5" } + ] + } + ], + "isRoot": true + }, + "nodeParts": { + "7665939b-1": { + "renderedLength": 78, + "gzipLength": 91, + "brotliLength": 69, + "metaUid": "7665939b-0" + }, + "7665939b-3": { + "renderedLength": 124, + "gzipLength": 126, + "brotliLength": 105, + "metaUid": "7665939b-2" + }, + "7665939b-5": { + "renderedLength": 60, + "gzipLength": 76, + "brotliLength": 52, + "metaUid": "7665939b-4" + } + }, + "nodeMetas": { + "7665939b-0": { + "id": "/test/e2e/input.js", + "moduleParts": { + "input.js": "7665939b-1" + }, + "imported": [ + { + "uid": "7665939b-6" + }, + { + "uid": "7665939b-7" } - - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; + ], + "importedBy": [], + "isEntry": true + }, + "7665939b-2": { + "id": "/test/e2e/input2.js", + "moduleParts": { + "input2.js": "7665939b-3" + }, + "imported": [ + { + "uid": "7665939b-4", + "dynamic": true } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; + ], + "importedBy": [], + "isEntry": true + }, + "7665939b-4": { + "id": "/test/e2e/file3.js", + "moduleParts": { + "file3-XCd8Ebz0.js": "7665939b-5" + }, + "imported": [], + "importedBy": [ + { + "uid": "7665939b-2" } + ] + }, + "7665939b-6": { + "id": "/test/e2e/node_modules/module/test.js", + "moduleParts": {}, + "imported": [], + "importedBy": [ + { + "uid": "7665939b-0" + } + ] + }, + "7665939b-7": { + "id": "jquery", + "moduleParts": {}, + "imported": [], + "importedBy": [ + { + "uid": "7665939b-0" + } + ] + } + }, + "env": { + "rollup": "4.23.0" + }, + "options": { + "gzip": true, + "brotli": true, + "sourcemap": false + } +}" +`; - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; +exports[`E2E > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - - -" -`; - -exports[`E2E > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "input.js", - "children": [ - { - "name": "test/e2e/input.js", - "uid": "7665939b-1" - } - ] - }, - { - "name": "input2.js", - "children": [ - { - "name": "test/e2e/input2.js", - "uid": "7665939b-3" - } - ] - }, - { - "name": "file3-XCd8Ebz0.js", - "children": [ - { - "name": "test/e2e/file3.js", - "uid": "7665939b-5" - } - ] - } - ], - "isRoot": true - }, - "nodeParts": { - "7665939b-1": { - "renderedLength": 78, - "gzipLength": 91, - "brotliLength": 69, - "metaUid": "7665939b-0" - }, - "7665939b-3": { - "renderedLength": 124, - "gzipLength": 126, - "brotliLength": 105, - "metaUid": "7665939b-2" - }, - "7665939b-5": { - "renderedLength": 60, - "gzipLength": 76, - "brotliLength": 52, - "metaUid": "7665939b-4" - } - }, - "nodeMetas": { - "7665939b-0": { - "id": "/test/e2e/input.js", - "moduleParts": { - "input.js": "7665939b-1" - }, - "imported": [ - { - "uid": "7665939b-6" - }, - { - "uid": "7665939b-7" - } - ], - "importedBy": [], - "isEntry": true - }, - "7665939b-2": { - "id": "/test/e2e/input2.js", - "moduleParts": { - "input2.js": "7665939b-3" - }, - "imported": [ - { - "uid": "7665939b-4", - "dynamic": true - } - ], - "importedBy": [], - "isEntry": true - }, - "7665939b-4": { - "id": "/test/e2e/file3.js", - "moduleParts": { - "file3-XCd8Ebz0.js": "7665939b-5" - }, - "imported": [], - "importedBy": [ - { - "uid": "7665939b-2" - } - ] - }, - "7665939b-6": { - "id": "/test/e2e/node_modules/module/test.js", - "moduleParts": {}, - "imported": [], - "importedBy": [ - { - "uid": "7665939b-0" - } - ] - }, - "7665939b-7": { - "id": "jquery", - "moduleParts": {}, - "imported": [], - "importedBy": [ - { - "uid": "7665939b-0" - } - ] - } - }, - "env": { - "rollup": "4.23.0" - }, - "options": { - "gzip": true, - "brotli": true, - "sourcemap": false - } -}" -`; - -exports[`E2E > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`E2E > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`E2E sourcemap > test - "flamegraph" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (output === undefined) { - parsed = parse$1(input, options); - parsed.prefix = prefix + (parsed.prefix || ''); - } else { - parsed.output = output; - } +" +`; - return picomatch.compileRe(parsed, options, returnOutput, returnState); - }; +exports[`E2E > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + function color(format) { + var m, l; + format = (format + "").trim().toLowerCase(); + return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 + : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 + : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 + : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 + : null) // invalid hex + : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) + : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) + : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) + : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) + : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) + : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) + : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins + : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) + : null; + } -" -`; + function rgbn(n) { + return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); + } -exports[`E2E sourcemap > test - "list" 1`] = ` -"file3-XCd8Ebz0.js: - /test/e2e/file3.js: - rendered: 13 -input.js: - /test/e2e/input.js: - rendered: 37 -input2.js: - /test/e2e/input2.js: - rendered: 82 -" -`; + function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); + } -exports[`E2E sourcemap > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - function formatRounded(x, p) { - var d = formatDecimalParts(x, p); - if (!d) return x + ""; - var coefficient = d[0], - exponent = d[1]; - return exponent < 0 ? "0." + new Array(-exponent).join("0") + coefficient - : coefficient.length > exponent + 1 ? coefficient.slice(0, exponent + 1) + "." + coefficient.slice(exponent + 1) - : coefficient + new Array(exponent - coefficient.length + 2).join("0"); - } +" +`; - var formatTypes = { - "%": (x, p) => (x * 100).toFixed(p), - "b": (x) => Math.round(x).toString(2), - "c": (x) => x + "", - "d": formatDecimal, - "e": (x, p) => x.toExponential(p), - "f": (x, p) => x.toFixed(p), - "g": (x, p) => x.toPrecision(p), - "o": (x) => Math.round(x).toString(8), - "p": (x, p) => formatRounded(x * 100, p), - "r": formatRounded, - "s": formatPrefixAuto, - "X": (x) => Math.round(x).toString(16).toUpperCase(), - "x": (x) => Math.round(x).toString(16) - }; +exports[`E2E sourcemap > test - "flamegraph" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } +" +`; - /** - * Pipes - */ +exports[`E2E sourcemap > test - "list" 1`] = ` +"file3-XCd8Ebz0.js: + /test/e2e/file3.js: + rendered: 13 +input.js: + /test/e2e/input.js: + rendered: 37 +input2.js: + /test/e2e/input2.js: + rendered: 82 +" +`; - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } +exports[`E2E sourcemap > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; + } -" -`; + var reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g, + reB = new RegExp(reA.source, "g"); -exports[`E2E sourcemap > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "input.js", - "children": [ - { - "name": "test/e2e/input.js", - "uid": "fea53995-1" - } - ] - }, - { - "name": "input2.js", - "children": [ - { - "name": "test/e2e/input2.js", - "uid": "fea53995-3" - } - ] - }, - { - "name": "file3-XCd8Ebz0.js", - "children": [ - { - "name": "test/e2e/file3.js", - "uid": "fea53995-5" - } - ] - } - ], - "isRoot": true - }, - "nodeParts": { - "fea53995-1": { - "renderedLength": 37, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "fea53995-0" - }, - "fea53995-3": { - "renderedLength": 82, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "fea53995-2" - }, - "fea53995-5": { - "renderedLength": 13, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "fea53995-4" + function zero(b) { + return function() { + return b; + }; } - }, - "nodeMetas": { - "fea53995-0": { - "id": "/test/e2e/input.js", - "moduleParts": { - "input.js": "fea53995-1" - }, - "imported": [ - { - "uid": "fea53995-6" - }, - { - "uid": "fea53995-7" - } - ], - "importedBy": [], - "isEntry": true - }, - "fea53995-2": { - "id": "/test/e2e/input2.js", - "moduleParts": { - "input2.js": "fea53995-3" - }, - "imported": [ - { - "uid": "fea53995-4", - "dynamic": true - } - ], - "importedBy": [], - "isEntry": true - }, - "fea53995-4": { - "id": "/test/e2e/file3.js", - "moduleParts": { - "file3-XCd8Ebz0.js": "fea53995-5" - }, - "imported": [], - "importedBy": [ - { - "uid": "fea53995-2" - } - ] - }, - "fea53995-6": { - "id": "/test/e2e/node_modules/module/test.js", - "moduleParts": {}, - "imported": [], - "importedBy": [ - { - "uid": "fea53995-0" + + function one(b) { + return function(t) { + return b(t) + ""; + }; + } + + function string(a, b) { + var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b + am, // current match in a + bm, // current match in b + bs, // string preceding current number in b, if any + i = -1, // index in s + s = [], // string constants and placeholders + q = []; // number interpolators + + // Coerce inputs to strings. + a = a + "", b = b + ""; + + // Interpolate pairs of numbers in a & b. + while ((am = reA.exec(a)) + && (bm = reB.exec(b))) { + if ((bs = bm.index) > bi) { // a string precedes the next number in b + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; } - ] - }, - "fea53995-7": { - "id": "jquery", - "moduleParts": {}, - "imported": [], - "importedBy": [ - { - "uid": "fea53995-0" + if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match + if (s[i]) s[i] += bm; // coalesce with previous string + else s[++i] = bm; + } else { // interpolate non-matching numbers + s[++i] = null; + q.push({i: i, x: interpolateNumber(am, bm)}); } - ] + bi = reB.lastIndex; + } + + // Add remains of b. + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; + } + + // Special optimization for only a single match. + // Otherwise, interpolate each of the numbers and rejoin the string. + return s.length < 2 ? (q[0] + ? one(q[0].x) + : zero(b)) + : (b = q.length, function(t) { + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); + } + + function interpolate(a, b) { + var t = typeof b, c; + return b == null || t === "boolean" ? constant$1(b) + : (t === "number" ? interpolateNumber + : t === "string" ? ((c = color(b)) ? (b = c, rgb) : string) + : b instanceof color ? rgb + : b instanceof Date ? date + : isNumberArray(b) ? numberArray + : Array.isArray(b) ? genericArray + : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object + : interpolateNumber)(a, b); + } + + function interpolateRound(a, b) { + return a = +a, b = +b, function(t) { + return Math.round(a * (1 - t) + b * t); + }; } - }, - "env": { - "rollup": "4.23.0" - }, - "options": { - "gzip": false, - "brotli": false, - "sourcemap": true - } -}" -`; -exports[`E2E sourcemap > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; - } +" +`; - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; +exports[`E2E sourcemap > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "input.js", + "children": [ + { + "name": "test/e2e/input.js", + "uid": "fea53995-1" + } + ] + }, + { + "name": "input2.js", + "children": [ + { + "name": "test/e2e/input2.js", + "uid": "fea53995-3" + } + ] + }, + { + "name": "file3-XCd8Ebz0.js", + "children": [ + { + "name": "test/e2e/file3.js", + "uid": "fea53995-5" + } + ] } + ], + "isRoot": true + }, + "nodeParts": { + "fea53995-1": { + "renderedLength": 37, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "fea53995-0" + }, + "fea53995-3": { + "renderedLength": 82, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "fea53995-2" + }, + "fea53995-5": { + "renderedLength": 13, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "fea53995-4" + } + }, + "nodeMetas": { + "fea53995-0": { + "id": "/test/e2e/input.js", + "moduleParts": { + "input.js": "fea53995-1" + }, + "imported": [ + { + "uid": "fea53995-6" + }, + { + "uid": "fea53995-7" + } + ], + "importedBy": [], + "isEntry": true + }, + "fea53995-2": { + "id": "/test/e2e/input2.js", + "moduleParts": { + "input2.js": "fea53995-3" + }, + "imported": [ + { + "uid": "fea53995-4", + "dynamic": true + } + ], + "importedBy": [], + "isEntry": true + }, + "fea53995-4": { + "id": "/test/e2e/file3.js", + "moduleParts": { + "file3-XCd8Ebz0.js": "fea53995-5" + }, + "imported": [], + "importedBy": [ + { + "uid": "fea53995-2" + } + ] + }, + "fea53995-6": { + "id": "/test/e2e/node_modules/module/test.js", + "moduleParts": {}, + "imported": [], + "importedBy": [ + { + "uid": "fea53995-0" + } + ] + }, + "fea53995-7": { + "id": "jquery", + "moduleParts": {}, + "imported": [], + "importedBy": [ + { + "uid": "fea53995-0" + } + ] + } + }, + "env": { + "rollup": "4.23.0" + }, + "options": { + "gzip": false, + "brotli": false, + "sourcemap": true + } +}" +`; - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; +exports[`E2E sourcemap > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + var unit = [0, 1]; -" -`; + function identity$1(x) { + return x; + } -exports[`E2E sourcemap > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } +" +`; - if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) { - output = token.close = \`)$))\${extglobStar}\`; - } +exports[`E2E sourcemap > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - function one(b) { - return function(t) { - return b(t) + ""; - }; - } +" +`; - function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b - am, // current match in a - bm, // current match in b - bs, // string preceding current number in b, if any - i = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators +exports[`E2E > test - "list" 1`] = ` +"file3-Bi_Qu0hn.js: + /test/e2e/file3.js: + rendered: 18 + gzip: 38 + brotli: 22 +input.js: + /test/e2e/input.js: + rendered: 66 + gzip: 80 + brotli: 67 +input2.js: + /test/e2e/input2.js: + rendered: 80 + gzip: 96 + brotli: 84 +" +`; - // Coerce inputs to strings. - a = a + "", b = b + ""; +exports[`E2E > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + var rgb = (function rgbGamma(y) { + var color = gamma(y); -" -`; + function rgb(start, end) { + var r = color((start = rgb$1(start)).r, (end = rgb$1(end)).r), + g = color(start.g, end.g), + b = color(start.b, end.b), + opacity = nogamma(start.opacity, end.opacity); + return function(t) { + start.r = r(t); + start.g = g(t); + start.b = b(t); + start.opacity = opacity(t); + return start + ""; + }; + } -exports[`E2E > test - "list" 1`] = ` -"file3-Bi_Qu0hn.js: - /test/e2e/file3.js: - rendered: 18 - gzip: 38 - brotli: 22 -input.js: - /test/e2e/input.js: - rendered: 66 - gzip: 80 - brotli: 67 -input2.js: - /test/e2e/input2.js: - rendered: 80 - gzip: 96 - brotli: 84 -" -`; + rgb.gamma = rgbGamma; -exports[`E2E > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - const decrement = type => { - state[type]--; - stack.pop(); - }; +" +`; - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; +exports[`E2E > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "input.js", + "children": [ + { + "name": "test/e2e/input.js", + "uid": "04193cf6-1" + } + ] + }, + { + "name": "input2.js", + "children": [ + { + "name": "test/e2e/input2.js", + "uid": "04193cf6-3" + } + ] + }, + { + "name": "file3-Bi_Qu0hn.js", + "children": [ + { + "name": "test/e2e/file3.js", + "uid": "04193cf6-5" } + ] + } + ], + "isRoot": true + }, + "nodeParts": { + "04193cf6-1": { + "renderedLength": 66, + "gzipLength": 80, + "brotliLength": 67, + "metaUid": "04193cf6-0" + }, + "04193cf6-3": { + "renderedLength": 80, + "gzipLength": 96, + "brotliLength": 84, + "metaUid": "04193cf6-2" + }, + "04193cf6-5": { + "renderedLength": 18, + "gzipLength": 38, + "brotliLength": 22, + "metaUid": "04193cf6-4" + } + }, + "nodeMetas": { + "04193cf6-0": { + "id": "/test/e2e/input.js", + "moduleParts": { + "input.js": "04193cf6-1" + }, + "imported": [ + { + "uid": "04193cf6-6" + }, + { + "uid": "04193cf6-7" } - - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; + ], + "importedBy": [], + "isEntry": true + }, + "04193cf6-2": { + "id": "/test/e2e/input2.js", + "moduleParts": { + "input2.js": "04193cf6-3" + }, + "imported": [ + { + "uid": "04193cf6-4", + "dynamic": true } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; + ], + "importedBy": [], + "isEntry": true + }, + "04193cf6-4": { + "id": "/test/e2e/file3.js", + "moduleParts": { + "file3-Bi_Qu0hn.js": "04193cf6-5" + }, + "imported": [], + "importedBy": [ + { + "uid": "04193cf6-2" } + ] + }, + "04193cf6-6": { + "id": "/test/e2e/node_modules/module/test.js", + "moduleParts": {}, + "imported": [], + "importedBy": [ + { + "uid": "04193cf6-0" + } + ] + }, + "04193cf6-7": { + "id": "jquery", + "moduleParts": {}, + "imported": [], + "importedBy": [ + { + "uid": "04193cf6-0" + } + ], + "isExternal": true + } + }, + "env": { + "rollup": "4.29.1" + }, + "options": { + "gzip": true, + "brotli": true, + "sourcemap": false + } +}" +`; - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; +exports[`E2E > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - - -" -`; - -exports[`E2E > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "input.js", - "children": [ - { - "name": "test/e2e/input.js", - "uid": "04193cf6-1" - } - ] - }, - { - "name": "input2.js", - "children": [ - { - "name": "test/e2e/input2.js", - "uid": "04193cf6-3" - } - ] - }, - { - "name": "file3-Bi_Qu0hn.js", - "children": [ - { - "name": "test/e2e/file3.js", - "uid": "04193cf6-5" - } - ] - } - ], - "isRoot": true - }, - "nodeParts": { - "04193cf6-1": { - "renderedLength": 66, - "gzipLength": 80, - "brotliLength": 67, - "metaUid": "04193cf6-0" - }, - "04193cf6-3": { - "renderedLength": 80, - "gzipLength": 96, - "brotliLength": 84, - "metaUid": "04193cf6-2" - }, - "04193cf6-5": { - "renderedLength": 18, - "gzipLength": 38, - "brotliLength": 22, - "metaUid": "04193cf6-4" - } - }, - "nodeMetas": { - "04193cf6-0": { - "id": "/test/e2e/input.js", - "moduleParts": { - "input.js": "04193cf6-1" - }, - "imported": [ - { - "uid": "04193cf6-6" - }, - { - "uid": "04193cf6-7" - } - ], - "importedBy": [], - "isEntry": true - }, - "04193cf6-2": { - "id": "/test/e2e/input2.js", - "moduleParts": { - "input2.js": "04193cf6-3" - }, - "imported": [ - { - "uid": "04193cf6-4", - "dynamic": true - } - ], - "importedBy": [], - "isEntry": true - }, - "04193cf6-4": { - "id": "/test/e2e/file3.js", - "moduleParts": { - "file3-Bi_Qu0hn.js": "04193cf6-5" - }, - "imported": [], - "importedBy": [ - { - "uid": "04193cf6-2" - } - ] - }, - "04193cf6-6": { - "id": "/test/e2e/node_modules/module/test.js", - "moduleParts": {}, - "imported": [], - "importedBy": [ - { - "uid": "04193cf6-0" - } - ] - }, - "04193cf6-7": { - "id": "jquery", - "moduleParts": {}, - "imported": [], - "importedBy": [ - { - "uid": "04193cf6-0" - } - ], - "isExternal": true - } - }, - "env": { - "rollup": "4.29.1" - }, - "options": { - "gzip": true, - "brotli": true, - "sourcemap": false - } -}" -`; - -exports[`E2E > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`E2E > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`E2E sourcemap > test - "flamegraph" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - function number$1(x) { - return x === null ? NaN : +x; - } +" +`; - const ascendingBisect = bisector(ascending); - const bisectRight = ascendingBisect.right; - bisector(number$1).center; +exports[`E2E > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + function intern_delete({_intern, _key}, value) { + const key = _key(value); + if (_intern.has(key)) { + value = _intern.get(key); + _intern.delete(key); + } + return value; + } -" -`; + function keyof(value) { + return value !== null && typeof value === "object" ? value.valueOf() : value; + } -exports[`E2E sourcemap > test - "list" 1`] = ` -"file3-Bi_Qu0hn.js: - /test/e2e/file3.js: - rendered: 19 -input.js: - /test/e2e/input.js: - rendered: 67 -input2.js: - /test/e2e/input2.js: - rendered: 80 -" -`; + function identity$2(x) { + return x; + } -exports[`E2E sourcemap > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - initRange.apply(scale, arguments); +" +`; - return scale; - } +exports[`E2E sourcemap > test - "flamegraph" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } +" +`; - push({ type: 'text', value }); - continue; - } +exports[`E2E sourcemap > test - "list" 1`] = ` +"file3-Bi_Qu0hn.js: + /test/e2e/file3.js: + rendered: 19 +input.js: + /test/e2e/input.js: + rendered: 67 +input2.js: + /test/e2e/input2.js: + rendered: 80 +" +`; - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } +exports[`E2E sourcemap > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + function interpolateNumber(a, b) { + return a = +a, b = +b, function(t) { + return a * (1 - t) + b * t; + }; + } -" -`; + function object(a, b) { + var i = {}, + c = {}, + k; -exports[`E2E sourcemap > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "input.js", - "children": [ - { - "name": "test/e2e/input.js", - "uid": "09f52cd2-1" - } - ] - }, - { - "name": "input2.js", - "children": [ - { - "name": "test/e2e/input2.js", - "uid": "09f52cd2-3" - } - ] - }, - { - "name": "file3-Bi_Qu0hn.js", - "children": [ - { - "name": "test/e2e/file3.js", - "uid": "09f52cd2-5" - } - ] + if (a === null || typeof a !== "object") a = {}; + if (b === null || typeof b !== "object") b = {}; + + for (k in b) { + if (k in a) { + i[k] = interpolate(a[k], b[k]); + } else { + c[k] = b[k]; + } } - ], - "isRoot": true - }, - "nodeParts": { - "09f52cd2-1": { - "renderedLength": 67, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "09f52cd2-0" - }, - "09f52cd2-3": { - "renderedLength": 80, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "09f52cd2-2" - }, - "09f52cd2-5": { - "renderedLength": 19, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "09f52cd2-4" + + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; } - }, - "nodeMetas": { - "09f52cd2-0": { - "id": "/test/e2e/input.js", - "moduleParts": { - "input.js": "09f52cd2-1" - }, - "imported": [ - { - "uid": "09f52cd2-6" - }, - { - "uid": "09f52cd2-7" - } - ], - "importedBy": [], - "isEntry": true - }, - "09f52cd2-2": { - "id": "/test/e2e/input2.js", - "moduleParts": { - "input2.js": "09f52cd2-3" - }, - "imported": [ - { - "uid": "09f52cd2-4", - "dynamic": true - } - ], - "importedBy": [], - "isEntry": true - }, - "09f52cd2-4": { - "id": "/test/e2e/file3.js", - "moduleParts": { - "file3-Bi_Qu0hn.js": "09f52cd2-5" - }, - "imported": [], - "importedBy": [ - { - "uid": "09f52cd2-2" - } - ] - }, - "09f52cd2-6": { - "id": "/test/e2e/node_modules/module/test.js", - "moduleParts": {}, - "imported": [], - "importedBy": [ - { - "uid": "09f52cd2-0" + + var reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g, + reB = new RegExp(reA.source, "g"); + + function zero(b) { + return function() { + return b; + }; + } + + function one(b) { + return function(t) { + return b(t) + ""; + }; + } + + function string(a, b) { + var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b + am, // current match in a + bm, // current match in b + bs, // string preceding current number in b, if any + i = -1, // index in s + s = [], // string constants and placeholders + q = []; // number interpolators + + // Coerce inputs to strings. + a = a + "", b = b + ""; + + // Interpolate pairs of numbers in a & b. + while ((am = reA.exec(a)) + && (bm = reB.exec(b))) { + if ((bs = bm.index) > bi) { // a string precedes the next number in b + bs = b.slice(bi, bs); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; } - ] - }, - "09f52cd2-7": { - "id": "jquery", - "moduleParts": {}, - "imported": [], - "importedBy": [ - { - "uid": "09f52cd2-0" + if ((am = am[0]) === (bm = bm[0])) { // numbers in a & b match + if (s[i]) s[i] += bm; // coalesce with previous string + else s[++i] = bm; + } else { // interpolate non-matching numbers + s[++i] = null; + q.push({i: i, x: interpolateNumber(am, bm)}); } - ], - "isExternal": true + bi = reB.lastIndex; + } + + // Add remains of b. + if (bi < b.length) { + bs = b.slice(bi); + if (s[i]) s[i] += bs; // coalesce with previous string + else s[++i] = bs; + } + + // Special optimization for only a single match. + // Otherwise, interpolate each of the numbers and rejoin the string. + return s.length < 2 ? (q[0] + ? one(q[0].x) + : zero(b)) + : (b = q.length, function(t) { + for (var i = 0, o; i < b; ++i) s[(o = q[i]).i] = o.x(t); + return s.join(""); + }); } - }, - "env": { - "rollup": "4.29.1" - }, - "options": { - "gzip": false, - "brotli": false, - "sourcemap": true - } -}" -`; -exports[`E2E sourcemap > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; - } +" +`; - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; +exports[`E2E sourcemap > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "input.js", + "children": [ + { + "name": "test/e2e/input.js", + "uid": "09f52cd2-1" + } + ] + }, + { + "name": "input2.js", + "children": [ + { + "name": "test/e2e/input2.js", + "uid": "09f52cd2-3" + } + ] + }, + { + "name": "file3-Bi_Qu0hn.js", + "children": [ + { + "name": "test/e2e/file3.js", + "uid": "09f52cd2-5" + } + ] } + ], + "isRoot": true + }, + "nodeParts": { + "09f52cd2-1": { + "renderedLength": 67, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "09f52cd2-0" + }, + "09f52cd2-3": { + "renderedLength": 80, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "09f52cd2-2" + }, + "09f52cd2-5": { + "renderedLength": 19, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "09f52cd2-4" + } + }, + "nodeMetas": { + "09f52cd2-0": { + "id": "/test/e2e/input.js", + "moduleParts": { + "input.js": "09f52cd2-1" + }, + "imported": [ + { + "uid": "09f52cd2-6" + }, + { + "uid": "09f52cd2-7" + } + ], + "importedBy": [], + "isEntry": true + }, + "09f52cd2-2": { + "id": "/test/e2e/input2.js", + "moduleParts": { + "input2.js": "09f52cd2-3" + }, + "imported": [ + { + "uid": "09f52cd2-4", + "dynamic": true + } + ], + "importedBy": [], + "isEntry": true + }, + "09f52cd2-4": { + "id": "/test/e2e/file3.js", + "moduleParts": { + "file3-Bi_Qu0hn.js": "09f52cd2-5" + }, + "imported": [], + "importedBy": [ + { + "uid": "09f52cd2-2" + } + ] + }, + "09f52cd2-6": { + "id": "/test/e2e/node_modules/module/test.js", + "moduleParts": {}, + "imported": [], + "importedBy": [ + { + "uid": "09f52cd2-0" + } + ] + }, + "09f52cd2-7": { + "id": "jquery", + "moduleParts": {}, + "imported": [], + "importedBy": [ + { + "uid": "09f52cd2-0" + } + ], + "isExternal": true + } + }, + "env": { + "rollup": "4.29.1" + }, + "options": { + "gzip": false, + "brotli": false, + "sourcemap": true + } +}" +`; - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; +exports[`E2E sourcemap > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + var unit = [0, 1]; -" -`; + function identity$1(x) { + return x; + } -exports[`E2E sourcemap > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } +" +`; - if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) { - output = token.close = \`)$))\${extglobStar}\`; - } +exports[`E2E sourcemap > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - function one(b) { - return function(t) { - return b(t) + ""; - }; - } +" +`; - function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b - am, // current match in a - bm, // current match in b - bs, // string preceding current number in b, if any - i = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators +exports[`GH-59 > test - "list" 1`] = ` +"components/A.js: + /test/gh59/src/components/A.js: + rendered: 12 + gzip: 32 + brotli: 16 +components/B.js: + /test/gh59/src/components/B.js: + rendered: 12 + gzip: 32 + brotli: 16 +components/index.js: + /test/gh59/src/components/index.js: + rendered: 0 + gzip: 0 + brotli: 0 +index.js: + /test/gh59/src/index.js: + rendered: 18 + gzip: 38 + brotli: 22 +" +`; - // Coerce inputs to strings. - a = a + "", b = b + ""; +exports[`GH-59 > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + return rgb; + })(1); -" -`; + function numberArray(a, b) { + if (!b) b = []; + var n = a ? Math.min(b.length, a.length) : 0, + c = b.slice(), + i; + return function(t) { + for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; + return c; + }; + } -exports[`GH-59 > test - "list" 1`] = ` -"components/A.js: - /test/gh59/src/components/A.js: - rendered: 12 - gzip: 32 - brotli: 16 -components/B.js: - /test/gh59/src/components/B.js: - rendered: 12 - gzip: 32 - brotli: 16 -components/index.js: - /test/gh59/src/components/index.js: - rendered: 0 - gzip: 0 - brotli: 0 -index.js: - /test/gh59/src/index.js: - rendered: 18 - gzip: 38 - brotli: 22 -" -`; + function isNumberArray(x) { + return ArrayBuffer.isView(x) && !(x instanceof DataView); + } -exports[`GH-59 > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - const decrement = type => { - state[type]--; - stack.pop(); - }; +" +`; - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; +exports[`GH-59 > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "components/index.js", + "children": [ + { + "name": "test/gh59/src/components/index.js", + "uid": "dea430a7-1" } - } - - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; - - const extglobClose = token => { - let output = token.close + (opts.capture ? ')' : ''); - - if (token.type === 'negate') { - let extglobStar = star; - - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); + ] + }, + { + "name": "index.js", + "children": [ + { + "name": "test/gh59/src/index.js", + "uid": "dea430a7-3" } - - if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) { - output = token.close = \`)$))\${extglobStar}\`; + ] + }, + { + "name": "components/A.js", + "children": [ + { + "name": "test/gh59/src/components/A.js", + "uid": "dea430a7-5" } - - if (token.prev.type === 'bos' && eos()) { - state.negatedExtglob = true; + ] + }, + { + "name": "components/B.js", + "children": [ + { + "name": "test/gh59/src/components/B.js", + "uid": "dea430a7-7" } + ] + } + ], + "isRoot": true + }, + "nodeParts": { + "dea430a7-1": { + "renderedLength": 0, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "dea430a7-0" + }, + "dea430a7-3": { + "renderedLength": 18, + "gzipLength": 38, + "brotliLength": 22, + "metaUid": "dea430a7-2" + }, + "dea430a7-5": { + "renderedLength": 12, + "gzipLength": 32, + "brotliLength": 16, + "metaUid": "dea430a7-4" + }, + "dea430a7-7": { + "renderedLength": 12, + "gzipLength": 32, + "brotliLength": 16, + "metaUid": "dea430a7-6" + } + }, + "nodeMetas": { + "dea430a7-0": { + "id": "/test/gh59/src/components/index.js", + "moduleParts": { + "components/index.js": "dea430a7-1" + }, + "imported": [ + { + "uid": "dea430a7-4" + }, + { + "uid": "dea430a7-6" } - - push({ type: 'paren', extglob: true, value, output }); - decrement('parens'); - }; - - /** - * Fast paths - */ - - if (opts.fastpaths !== false && !/(^[*!]|[/()[\\]{}"])/.test(input)) { - let backslashes = false; - - let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => { - if (first === '\\\\') { - backslashes = true; - return m; - } - - if (first === '?') { - if (esc) { - return esc + first + (rest ? QMARK.repeat(rest.length) : ''); - } - if (index === 0) { - return qmarkNoDot + (rest ? QMARK.repeat(rest.length) : ''); - } - return QMARK.repeat(chars.length); - } - - if (first === '.') { - return DOT_LITERAL.repeat(chars.length); - } - - if (first === '*') { - if (esc) { - return esc + first + (rest ? star : ''); - } - return star; - } - return esc ? m : \`\\\\\${m}\`; - }); - - if (backslashes === true) { - if (opts.unescape === true) { - output = output.replace(/\\\\/g, ''); - } else { - output = output.replace(/\\\\+/g, m => { - return m.length % 2 === 0 ? '\\\\\\\\' : (m ? '\\\\' : ''); - }); - } + ], + "importedBy": [ + { + "uid": "dea430a7-2" } - - if (output === input && opts.contains === true) { - state.output = input; - return state; + ], + "isEntry": true + }, + "dea430a7-2": { + "id": "/test/gh59/src/index.js", + "moduleParts": { + "index.js": "dea430a7-3" + }, + "imported": [ + { + "uid": "dea430a7-0" } - - state.output = utils$1.wrapOutput(output, state, options); - return state; - } - - /** - * Tokenize input until we reach end-of-string - */ - - while (!eos()) { - value = advance(); - - if (value === '\\u0000') { - continue; + ], + "importedBy": [], + "isEntry": true + }, + "dea430a7-4": { + "id": "/test/gh59/src/components/A.js", + "moduleParts": { + "components/A.js": "dea430a7-5" + }, + "imported": [], + "importedBy": [ + { + "uid": "dea430a7-0" + } + ], + "isEntry": true + }, + "dea430a7-6": { + "id": "/test/gh59/src/components/B.js", + "moduleParts": { + "components/B.js": "dea430a7-7" + }, + "imported": [], + "importedBy": [ + { + "uid": "dea430a7-0" } + ], + "isEntry": true + } + }, + "env": { + "rollup": "4.29.1" + }, + "options": { + "gzip": true, + "brotli": true, + "sourcemap": false + } +}" +`; - /** - * Escaped characters - */ +exports[`GH-59 > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + function extend(parent, definition) { + var prototype = Object.create(parent.prototype); + for (var key in definition) prototype[key] = definition[key]; + return prototype; + } -" -`; + function Color() {} -exports[`GH-59 > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "components/index.js", - "children": [ - { - "name": "test/gh59/src/components/index.js", - "uid": "dea430a7-1" - } - ] - }, - { - "name": "index.js", - "children": [ - { - "name": "test/gh59/src/index.js", - "uid": "dea430a7-3" - } - ] - }, - { - "name": "components/A.js", - "children": [ - { - "name": "test/gh59/src/components/A.js", - "uid": "dea430a7-5" - } - ] - }, - { - "name": "components/B.js", - "children": [ - { - "name": "test/gh59/src/components/B.js", - "uid": "dea430a7-7" - } - ] - } - ], - "isRoot": true - }, - "nodeParts": { - "dea430a7-1": { - "renderedLength": 0, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "dea430a7-0" - }, - "dea430a7-3": { - "renderedLength": 18, - "gzipLength": 38, - "brotliLength": 22, - "metaUid": "dea430a7-2" - }, - "dea430a7-5": { - "renderedLength": 12, - "gzipLength": 32, - "brotliLength": 16, - "metaUid": "dea430a7-4" - }, - "dea430a7-7": { - "renderedLength": 12, - "gzipLength": 32, - "brotliLength": 16, - "metaUid": "dea430a7-6" - } - }, - "nodeMetas": { - "dea430a7-0": { - "id": "/test/gh59/src/components/index.js", - "moduleParts": { - "components/index.js": "dea430a7-1" - }, - "imported": [ - { - "uid": "dea430a7-4" - }, - { - "uid": "dea430a7-6" - } - ], - "importedBy": [ - { - "uid": "dea430a7-2" - } - ], - "isEntry": true - }, - "dea430a7-2": { - "id": "/test/gh59/src/index.js", - "moduleParts": { - "index.js": "dea430a7-3" - }, - "imported": [ - { - "uid": "dea430a7-0" - } - ], - "importedBy": [], - "isEntry": true - }, - "dea430a7-4": { - "id": "/test/gh59/src/components/A.js", - "moduleParts": { - "components/A.js": "dea430a7-5" - }, - "imported": [], - "importedBy": [ - { - "uid": "dea430a7-0" - } - ], - "isEntry": true - }, - "dea430a7-6": { - "id": "/test/gh59/src/components/B.js", - "moduleParts": { - "components/B.js": "dea430a7-7" - }, - "imported": [], - "importedBy": [ - { - "uid": "dea430a7-0" - } - ], - "isEntry": true - } - }, - "env": { - "rollup": "4.29.1" - }, - "options": { - "gzip": true, - "brotli": true, - "sourcemap": false - } -}" -`; - -exports[`GH-59 > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`GH-59 > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`GH-59 sourcemap > test - "flamegraph" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - function number$1(x) { - return x === null ? NaN : +x; - } +" +`; - const ascendingBisect = bisector(ascending); - const bisectRight = ascendingBisect.right; - bisector(number$1).center; +exports[`GH-59 > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + const TreeMap = ({ root, onNodeHover, selectedNode, onNodeClick, }) => { + const { width, height, getModuleIds } = x(StaticContext); + console.time("layering"); + // this will make groups by height + const nestedData = T(() => { + const nestedDataMap = group(root.descendants(), (d) => d.height); + const nestedData = Array.from(nestedDataMap, ([key, values]) => ({ + key, + values, + })); + nestedData.sort((a, b) => b.key - a.key); + return nestedData; + }, [root]); + console.timeEnd("layering"); + return (u$1("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: \`0 0 \${width} \${height}\`, children: nestedData.map(({ key, values }) => { + return (u$1("g", { className: "layer", children: values.map((node) => { + return (u$1(Node, { node: node, onMouseOver: onNodeHover, selected: selectedNode === node, onClick: onNodeClick }, getModuleIds(node.data).nodeUid.id)); + }) }, key)); + }) })); + }; -" -`; + var bytes = {exports: {}}; -exports[`GH-59 sourcemap > test - "list" 1`] = ` -"components/A.js: - /test/gh59/src/components/A.js: - rendered: 13 -components/B.js: - /test/gh59/src/components/B.js: - rendered: 13 -components/index.js: - /test/gh59/src/components/index.js: - rendered: 112 -index.js: - /test/gh59/src/index.js: - rendered: 19 -" -`; + /*! + * bytes + * Copyright(c) 2012-2014 TJ Holowaychuk + * Copyright(c) 2015 Jed Watson + * MIT Licensed + */ -exports[`GH-59 sourcemap > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - initRange.apply(scale, arguments); +" +`; - return scale; - } +exports[`GH-59 sourcemap > test - "flamegraph" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - push({ type: 'text', value }); - continue; - } +" +`; - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } +exports[`GH-59 sourcemap > test - "list" 1`] = ` +"components/A.js: + /test/gh59/src/components/A.js: + rendered: 13 +components/B.js: + /test/gh59/src/components/B.js: + rendered: 13 +components/index.js: + /test/gh59/src/components/index.js: + rendered: 112 +index.js: + /test/gh59/src/index.js: + rendered: 19 +" +`; - let rest = remaining(); - if (opts.noextglob !== true && /^\\([^?]/.test(rest)) { - extglobOpen('star', value); - continue; - } +exports[`GH-59 sourcemap > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + function object(a, b) { + var i = {}, + c = {}, + k; -" -`; + if (a === null || typeof a !== "object") a = {}; + if (b === null || typeof b !== "object") b = {}; -exports[`GH-59 sourcemap > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "components/index.js", - "uid": "29c1b5e2-1" - }, - { - "name": "index.js", - "children": [ - { - "name": "test/gh59/src/index.js", - "uid": "29c1b5e2-3" - } - ] - }, - { - "name": "components/A.js", - "children": [ - { - "name": "test/gh59/src/components/A.js", - "uid": "29c1b5e2-5" - } - ] - }, - { - "name": "components/B.js", - "children": [ - { - "name": "test/gh59/src/components/B.js", - "uid": "29c1b5e2-7" - } - ] + for (k in b) { + if (k in a) { + i[k] = interpolate(a[k], b[k]); + } else { + c[k] = b[k]; + } } - ], - "isRoot": true - }, - "nodeParts": { - "29c1b5e2-1": { - "id": "components/index.js", - "gzipLength": 0, - "brotliLength": 0, - "renderedLength": 112, - "metaUid": "29c1b5e2-0" - }, - "29c1b5e2-3": { - "renderedLength": 19, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "29c1b5e2-2" - }, - "29c1b5e2-5": { - "renderedLength": 13, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "29c1b5e2-4" - }, - "29c1b5e2-7": { - "renderedLength": 13, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "29c1b5e2-6" + + return function(t) { + for (k in i) c[k] = i[k](t); + return c; + }; } - }, - "nodeMetas": { - "29c1b5e2-0": { - "id": "/test/gh59/src/components/index.js", - "moduleParts": { - "components/index.js": "29c1b5e2-1" - }, - "imported": [ - { - "uid": "29c1b5e2-4" - }, - { - "uid": "29c1b5e2-6" - } - ], - "importedBy": [ - { - "uid": "29c1b5e2-2" - } - ], - "isEntry": true - }, - "29c1b5e2-2": { - "id": "/test/gh59/src/index.js", - "moduleParts": { - "index.js": "29c1b5e2-3" - }, - "imported": [ - { - "uid": "29c1b5e2-0" - } - ], - "importedBy": [], - "isEntry": true - }, - "29c1b5e2-4": { - "id": "/test/gh59/src/components/A.js", - "moduleParts": { - "components/A.js": "29c1b5e2-5" - }, - "imported": [], - "importedBy": [ - { - "uid": "29c1b5e2-0" - } - ], - "isEntry": true - }, - "29c1b5e2-6": { - "id": "/test/gh59/src/components/B.js", - "moduleParts": { - "components/B.js": "29c1b5e2-7" - }, - "imported": [], - "importedBy": [ - { - "uid": "29c1b5e2-0" - } - ], - "isEntry": true + + var reA = /[-+]?(?:\\d+\\.?\\d*|\\.?\\d+)(?:[eE][-+]?\\d+)?/g, + reB = new RegExp(reA.source, "g"); + + function zero(b) { + return function() { + return b; + }; } - }, - "env": { - "rollup": "4.29.1" - }, - "options": { - "gzip": false, - "brotli": false, - "sourcemap": true - } -}" -`; -exports[`GH-59 sourcemap > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; +" +`; - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; +exports[`GH-59 sourcemap > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "components/index.js", + "uid": "29c1b5e2-1" + }, + { + "name": "index.js", + "children": [ + { + "name": "test/gh59/src/index.js", + "uid": "29c1b5e2-3" + } + ] + }, + { + "name": "components/A.js", + "children": [ + { + "name": "test/gh59/src/components/A.js", + "uid": "29c1b5e2-5" + } + ] + }, + { + "name": "components/B.js", + "children": [ + { + "name": "test/gh59/src/components/B.js", + "uid": "29c1b5e2-7" + } + ] + } + ], + "isRoot": true + }, + "nodeParts": { + "29c1b5e2-1": { + "id": "components/index.js", + "gzipLength": 0, + "brotliLength": 0, + "renderedLength": 112, + "metaUid": "29c1b5e2-0" + }, + "29c1b5e2-3": { + "renderedLength": 19, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "29c1b5e2-2" + }, + "29c1b5e2-5": { + "renderedLength": 13, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "29c1b5e2-4" + }, + "29c1b5e2-7": { + "renderedLength": 13, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "29c1b5e2-6" + } + }, + "nodeMetas": { + "29c1b5e2-0": { + "id": "/test/gh59/src/components/index.js", + "moduleParts": { + "components/index.js": "29c1b5e2-1" + }, + "imported": [ + { + "uid": "29c1b5e2-4" + }, + { + "uid": "29c1b5e2-6" + } + ], + "importedBy": [ + { + "uid": "29c1b5e2-2" + } + ], + "isEntry": true + }, + "29c1b5e2-2": { + "id": "/test/gh59/src/index.js", + "moduleParts": { + "index.js": "29c1b5e2-3" + }, + "imported": [ + { + "uid": "29c1b5e2-0" + } + ], + "importedBy": [], + "isEntry": true + }, + "29c1b5e2-4": { + "id": "/test/gh59/src/components/A.js", + "moduleParts": { + "components/A.js": "29c1b5e2-5" + }, + "imported": [], + "importedBy": [ + { + "uid": "29c1b5e2-0" + } + ], + "isEntry": true + }, + "29c1b5e2-6": { + "id": "/test/gh59/src/components/B.js", + "moduleParts": { + "components/B.js": "29c1b5e2-7" + }, + "imported": [], + "importedBy": [ + { + "uid": "29c1b5e2-0" + } + ], + "isEntry": true + } + }, + "env": { + "rollup": "4.29.1" + }, + "options": { + "gzip": false, + "brotli": false, + "sourcemap": true + } +}" +`; - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; +exports[`GH-59 sourcemap > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + var unit = [0, 1]; -" -`; + function identity$1(x) { + return x; + } -exports[`GH-59 sourcemap > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } +" +`; - if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) { - output = token.close = \`)$))\${extglobStar}\`; - } +exports[`GH-59 sourcemap > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - function one(b) { - return function(t) { - return b(t) + ""; - }; - } +" +`; - function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b - am, // current match in a - bm, // current match in b - bs, // string preceding current number in b, if any - i = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators +exports[`GH-69 > test - "list" 1`] = ` +"dynamic-AB-Kuj6Y.js: + /test/gh69/dynamic.js: + rendered: 6 + gzip: 26 + brotli: 10 +main.js: + /test/gh69/lib.js: + rendered: 86 + gzip: 73 + brotli: 67 + /test/gh69/main.js: + rendered: 84 + gzip: 98 + brotli: 88 +" +`; - // Coerce inputs to strings. - a = a + "", b = b + ""; +exports[`GH-69 > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + function isNumberArray(x) { + return ArrayBuffer.isView(x) && !(x instanceof DataView); + } -" -`; + function genericArray(a, b) { + var nb = b ? b.length : 0, + na = a ? Math.min(nb, a.length) : 0, + x = new Array(na), + c = new Array(nb), + i; -exports[`GH-69 > test - "list" 1`] = ` -"dynamic-AB-Kuj6Y.js: - /test/gh69/dynamic.js: - rendered: 6 - gzip: 26 - brotli: 10 -main.js: - /test/gh69/lib.js: - rendered: 86 - gzip: 73 - brotli: 67 - /test/gh69/main.js: - rendered: 84 - gzip: 98 - brotli: 88 -" -`; + for (i = 0; i < na; ++i) x[i] = interpolate(a[i], b[i]); + for (; i < nb; ++i) c[i] = b[i]; -exports[`GH-69 > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - const negate = () => { - let count = 1; +" +`; - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; +exports[`GH-69 > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "main.js", + "children": [ + { + "name": "test/gh69", + "children": [ + { + "uid": "9be6dbea-1", + "name": "lib.js" + }, + { + "uid": "9be6dbea-3", + "name": "main.js" + } + ] + } + ] + }, + { + "name": "dynamic-AB-Kuj6Y.js", + "children": [ + { + "name": "test/gh69/dynamic.js", + "uid": "9be6dbea-5" + } + ] + } + ], + "isRoot": true + }, + "nodeParts": { + "9be6dbea-1": { + "renderedLength": 86, + "gzipLength": 73, + "brotliLength": 67, + "metaUid": "9be6dbea-0" + }, + "9be6dbea-3": { + "renderedLength": 84, + "gzipLength": 98, + "brotliLength": 88, + "metaUid": "9be6dbea-2" + }, + "9be6dbea-5": { + "renderedLength": 6, + "gzipLength": 26, + "brotliLength": 10, + "metaUid": "9be6dbea-4" + } + }, + "nodeMetas": { + "9be6dbea-0": { + "id": "/test/gh69/lib.js", + "moduleParts": { + "main.js": "9be6dbea-1" + }, + "imported": [], + "importedBy": [ + { + "uid": "9be6dbea-2" + }, + { + "uid": "9be6dbea-4" } - - if (count % 2 === 0) { - return false; + ] + }, + "9be6dbea-2": { + "id": "/test/gh69/main.js", + "moduleParts": { + "main.js": "9be6dbea-3" + }, + "imported": [ + { + "uid": "9be6dbea-0" + }, + { + "uid": "9be6dbea-4", + "dynamic": true } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } + ], + "importedBy": [], + "isEntry": true + }, + "9be6dbea-4": { + "id": "/test/gh69/dynamic.js", + "moduleParts": { + "dynamic-AB-Kuj6Y.js": "9be6dbea-5" + }, + "imported": [ + { + "uid": "9be6dbea-0" } - - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; + ], + "importedBy": [ + { + "uid": "9be6dbea-2" } + ] + } + }, + "env": { + "rollup": "4.29.1" + }, + "options": { + "gzip": true, + "brotli": true, + "sourcemap": false + } +}" +`; - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } +exports[`GH-69 > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - - -" -`; - -exports[`GH-69 > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "main.js", - "children": [ - { - "name": "test/gh69", - "children": [ - { - "uid": "9be6dbea-1", - "name": "lib.js" - }, - { - "uid": "9be6dbea-3", - "name": "main.js" - } - ] - } - ] - }, - { - "name": "dynamic-AB-Kuj6Y.js", - "children": [ - { - "name": "test/gh69/dynamic.js", - "uid": "9be6dbea-5" - } - ] - } - ], - "isRoot": true - }, - "nodeParts": { - "9be6dbea-1": { - "renderedLength": 86, - "gzipLength": 73, - "brotliLength": 67, - "metaUid": "9be6dbea-0" - }, - "9be6dbea-3": { - "renderedLength": 84, - "gzipLength": 98, - "brotliLength": 88, - "metaUid": "9be6dbea-2" - }, - "9be6dbea-5": { - "renderedLength": 6, - "gzipLength": 26, - "brotliLength": 10, - "metaUid": "9be6dbea-4" - } - }, - "nodeMetas": { - "9be6dbea-0": { - "id": "/test/gh69/lib.js", - "moduleParts": { - "main.js": "9be6dbea-1" - }, - "imported": [], - "importedBy": [ - { - "uid": "9be6dbea-2" - }, - { - "uid": "9be6dbea-4" - } - ] - }, - "9be6dbea-2": { - "id": "/test/gh69/main.js", - "moduleParts": { - "main.js": "9be6dbea-3" - }, - "imported": [ - { - "uid": "9be6dbea-0" - }, - { - "uid": "9be6dbea-4", - "dynamic": true - } - ], - "importedBy": [], - "isEntry": true - }, - "9be6dbea-4": { - "id": "/test/gh69/dynamic.js", - "moduleParts": { - "dynamic-AB-Kuj6Y.js": "9be6dbea-5" - }, - "imported": [ - { - "uid": "9be6dbea-0" - } - ], - "importedBy": [ - { - "uid": "9be6dbea-2" - } - ] - } - }, - "env": { - "rollup": "4.29.1" - }, - "options": { - "gzip": true, - "brotli": true, - "sourcemap": false - } -}" -`; - -exports[`GH-69 > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`GH-69 > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`GH-69 sourcemap > test - "flamegraph" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (output === undefined) { - parsed = parse$1(input, options); - parsed.prefix = prefix + (parsed.prefix || ''); - } else { - parsed.output = output; - } +" +`; - return picomatch.compileRe(parsed, options, returnOutput, returnState); - }; +exports[`GH-69 > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + function color(format) { + var m, l; + format = (format + "").trim().toLowerCase(); + return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 + : l === 3 ? new Rgb((m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), ((m & 0xf) << 4) | (m & 0xf), 1) // #f00 + : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 + : l === 4 ? rgba((m >> 12 & 0xf) | (m >> 8 & 0xf0), (m >> 8 & 0xf) | (m >> 4 & 0xf0), (m >> 4 & 0xf) | (m & 0xf0), (((m & 0xf) << 4) | (m & 0xf)) / 0xff) // #f000 + : null) // invalid hex + : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) + : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) + : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) + : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) + : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) + : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) + : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins + : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) + : null; + } -" -`; + function rgbn(n) { + return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); + } -exports[`GH-69 sourcemap > test - "list" 1`] = ` -"dynamic-AB-Kuj6Y.js: - /test/gh69/dynamic.js: - rendered: 7 -main.js: - /test/gh69/lib.js: - rendered: 86 - /test/gh69/main.js: - rendered: 84 -" -`; + function rgba(r, g, b, a) { + if (a <= 0) r = g = b = NaN; + return new Rgb(r, g, b, a); + } -exports[`GH-69 sourcemap > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - function formatLocale(locale) { - var group = locale.grouping === undefined || locale.thousands === undefined ? identity : formatGroup(map.call(locale.grouping, Number), locale.thousands + ""), - currencyPrefix = locale.currency === undefined ? "" : locale.currency[0] + "", - currencySuffix = locale.currency === undefined ? "" : locale.currency[1] + "", - decimal = locale.decimal === undefined ? "." : locale.decimal + "", - numerals = locale.numerals === undefined ? identity : formatNumerals(map.call(locale.numerals, String)), - percent = locale.percent === undefined ? "%" : locale.percent + "", - minus = locale.minus === undefined ? "−" : locale.minus + "", - nan = locale.nan === undefined ? "NaN" : locale.nan + ""; +" +`; - function newFormat(specifier) { - specifier = formatSpecifier(specifier); +exports[`GH-69 sourcemap > test - "flamegraph" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - push({ type: 'brace', value, output }); - decrement('braces'); - braces.pop(); - continue; - } +" +`; - /** - * Pipes - */ +exports[`GH-69 sourcemap > test - "list" 1`] = ` +"dynamic-AB-Kuj6Y.js: + /test/gh69/dynamic.js: + rendered: 7 +main.js: + /test/gh69/lib.js: + rendered: 86 + /test/gh69/main.js: + rendered: 84 +" +`; - if (value === '|') { - if (extglobs.length > 0) { - extglobs[extglobs.length - 1].conditions++; - } - push({ type: 'text', value }); - continue; - } +exports[`GH-69 sourcemap > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - - -" -`; - -exports[`GH-69 sourcemap > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "main.js", - "children": [ - { - "name": "test/gh69", - "children": [ - { - "uid": "01148090-1", - "name": "lib.js" - }, - { - "uid": "01148090-3", - "name": "main.js" - } - ] - } - ] - }, - { - "name": "dynamic-AB-Kuj6Y.js", - "children": [ - { - "name": "test/gh69/dynamic.js", - "uid": "01148090-5" - } - ] - } - ], - "isRoot": true - }, - "nodeParts": { - "01148090-1": { - "renderedLength": 86, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "01148090-0" - }, - "01148090-3": { - "renderedLength": 84, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "01148090-2" - }, - "01148090-5": { - "renderedLength": 7, - "gzipLength": 0, - "brotliLength": 0, - "metaUid": "01148090-4" - } - }, - "nodeMetas": { - "01148090-0": { - "id": "/test/gh69/lib.js", - "moduleParts": { - "main.js": "01148090-1" - }, - "imported": [], - "importedBy": [ - { - "uid": "01148090-2" - }, - { - "uid": "01148090-4" - } - ] - }, - "01148090-2": { - "id": "/test/gh69/main.js", - "moduleParts": { - "main.js": "01148090-3" - }, - "imported": [ - { - "uid": "01148090-0" - }, - { - "uid": "01148090-4", - "dynamic": true - } - ], - "importedBy": [], - "isEntry": true - }, - "01148090-4": { - "id": "/test/gh69/dynamic.js", - "moduleParts": { - "dynamic-AB-Kuj6Y.js": "01148090-5" - }, - "imported": [ - { - "uid": "01148090-0" - } - ], - "importedBy": [ - { - "uid": "01148090-2" + // Trims insignificant zeros, e.g., replaces 1.2000k with 1.2k. + function formatTrim(s) { + out: for (var n = s.length, i = 1, i0 = -1, i1; i < n; ++i) { + switch (s[i]) { + case ".": i0 = i1 = i; break; + case "0": if (i0 === 0) i0 = i; i1 = i; break; + default: if (!+s[i]) break out; if (i0 > 0) i0 = 0; break; } - ] + } + return i0 > 0 ? s.slice(0, i0) + s.slice(i1 + 1) : s; } - }, - "env": { - "rollup": "4.29.1" - }, - "options": { - "gzip": false, - "brotli": false, - "sourcemap": true - } -}" -`; - -exports[`GH-69 sourcemap > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - const state = { - prefix, - input, - start, - base, - glob, - isBrace, - isBracket, - isGlob, - isExtglob, - isGlobstar, - negated - }; +" +`; - if (opts.tokens === true) { - state.maxDepth = 0; - if (!isPathSeparator(code)) { - tokens.push(token); +exports[`GH-69 sourcemap > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "main.js", + "children": [ + { + "name": "test/gh69", + "children": [ + { + "uid": "01148090-1", + "name": "lib.js" + }, + { + "uid": "01148090-3", + "name": "main.js" + } + ] + } + ] + }, + { + "name": "dynamic-AB-Kuj6Y.js", + "children": [ + { + "name": "test/gh69/dynamic.js", + "uid": "01148090-5" + } + ] } - state.tokens = tokens; + ], + "isRoot": true + }, + "nodeParts": { + "01148090-1": { + "renderedLength": 86, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "01148090-0" + }, + "01148090-3": { + "renderedLength": 84, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "01148090-2" + }, + "01148090-5": { + "renderedLength": 7, + "gzipLength": 0, + "brotliLength": 0, + "metaUid": "01148090-4" } - - if (opts.parts === true || opts.tokens === true) { - let prevIndex; - - for (let idx = 0; idx < slashes.length; idx++) { - const n = prevIndex ? prevIndex + 1 : start; - const i = slashes[idx]; - const value = input.slice(n, i); - if (opts.tokens) { - if (idx === 0 && start !== 0) { - tokens[idx].isPrefix = true; - tokens[idx].value = prefix; - } else { - tokens[idx].value = value; - } - depth(tokens[idx]); - state.maxDepth += tokens[idx].depth; + }, + "nodeMetas": { + "01148090-0": { + "id": "/test/gh69/lib.js", + "moduleParts": { + "main.js": "01148090-1" + }, + "imported": [], + "importedBy": [ + { + "uid": "01148090-2" + }, + { + "uid": "01148090-4" + } + ] + }, + "01148090-2": { + "id": "/test/gh69/main.js", + "moduleParts": { + "main.js": "01148090-3" + }, + "imported": [ + { + "uid": "01148090-0" + }, + { + "uid": "01148090-4", + "dynamic": true } - if (idx !== 0 || value !== '') { - parts.push(value); + ], + "importedBy": [], + "isEntry": true + }, + "01148090-4": { + "id": "/test/gh69/dynamic.js", + "moduleParts": { + "dynamic-AB-Kuj6Y.js": "01148090-5" + }, + "imported": [ + { + "uid": "01148090-0" } - prevIndex = i; - } - - if (prevIndex && prevIndex + 1 < input.length) { - const value = input.slice(prevIndex + 1); - parts.push(value); - - if (opts.tokens) { - tokens[tokens.length - 1].value = value; - depth(tokens[tokens.length - 1]); - state.maxDepth += tokens[tokens.length - 1].depth; + ], + "importedBy": [ + { + "uid": "01148090-2" } - } - - state.slashes = slashes; - state.parts = parts; - } - - return state; - }; - - var scan_1 = scan$1; - - const constants$1 = constants$2; - const utils$1 = utils$3; - - /** - * Constants - */ - - const { - MAX_LENGTH, - POSIX_REGEX_SOURCE, - REGEX_NON_SPECIAL_CHARS, - REGEX_SPECIAL_CHARS_BACKREF, - REPLACEMENTS - } = constants$1; - - /** - * Helpers - */ - - const expandRange = (args, options) => { - if (typeof options.expandRange === 'function') { - return options.expandRange(...args, options); - } - - args.sort(); - const value = \`[\${args.join('-')}]\`; - - try { - /* eslint-disable-next-line no-new */ - new RegExp(value); - } catch (ex) { - return args.map(v => utils$1.escapeRegex(v)).join('..'); - } - - return value; - }; - - /** - * Create the message for a syntax error - */ - - const syntaxError = (type, char) => { - return \`Missing \${type}: "\${char}" - use "\\\\\\\\\${char}" to match literal characters\`; - }; - - /** - * Parse the given input string. - * @param {String} input - * @param {Object} options - * @return {Object} - */ - - const parse$2 = (input, options) => { - if (typeof input !== 'string') { - throw new TypeError('Expected a string'); - } - - input = REPLACEMENTS[input] || input; - - const opts = { ...options }; - const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH; - - let len = input.length; - if (len > max) { - throw new SyntaxError(\`Input length: \${len}, exceeds maximum allowed length: \${max}\`); - } - - const bos = { type: 'bos', value: '', output: opts.prepend || '' }; - const tokens = [bos]; - - const capture = opts.capture ? '' : '?:'; - - // create constants based on platform, for windows or posix - const PLATFORM_CHARS = constants$1.globChars(opts.windows); - const EXTGLOB_CHARS = constants$1.extglobChars(PLATFORM_CHARS); - - const { - DOT_LITERAL, - PLUS_LITERAL, - SLASH_LITERAL, - ONE_CHAR, - DOTS_SLASH, - NO_DOT, - NO_DOT_SLASH, - NO_DOTS_SLASH, - QMARK, - QMARK_NO_DOT, - STAR, - START_ANCHOR - } = PLATFORM_CHARS; - - const globstar = (opts) => { - return \`(\${capture}(?:(?!\${START_ANCHOR}\${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)\`; - }; - - const nodot = opts.dot ? '' : NO_DOT; - const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT; - let star = opts.bash === true ? globstar(opts) : STAR; - - if (opts.capture) { - star = \`(\${star})\`; - } - - // minimatch options support - if (typeof opts.noext === 'boolean') { - opts.noextglob = opts.noext; + ] } + }, + "env": { + "rollup": "4.29.1" + }, + "options": { + "gzip": false, + "brotli": false, + "sourcemap": true + } +}" +`; - const state = { - input, - index: -1, - start: 0, - dot: opts.dot === true, - consumed: '', - output: '', - prefix: '', - backtrack: false, - negated: false, - brackets: 0, - braces: 0, - parens: 0, - quotes: 0, - globstar: false, - tokens - }; - - input = utils$1.removePrefix(input, state); - len = input.length; - - const extglobs = []; - const braces = []; - const stack = []; - let prev = bos; - let value; - - /** - * Tokenizing helpers - */ - - const eos = () => state.index === len - 1; - const peek = state.peek = (n = 1) => input[state.index + n]; - const advance = state.advance = () => input[++state.index]; - const remaining = () => input.slice(state.index + 1); - const consume = (value = '', num = 0) => { - state.consumed += value; - state.index += num; - }; - const append = token => { - state.output += token.output != null ? token.output : token.value; - consume(token.value); - }; - - const negate = () => { - let count = 1; - - while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) { - advance(); - state.start++; - count++; - } - - if (count % 2 === 0) { - return false; - } - - state.negated = true; - state.start++; - return true; - }; - - const increment = type => { - state[type]++; - stack.push(type); - }; - - const decrement = type => { - state[type]--; - stack.pop(); - }; - - /** - * Push tokens onto the tokens array. This helper speeds up - * tokenizing by 1) helping us avoid backtracking as much as possible, - * and 2) helping us avoid creating extra tokens when consecutive - * characters are plain text. This improves performance and simplifies - * lookbehinds. - */ - - const push = tok => { - if (prev.type === 'globstar') { - const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace'); - const isExtglob = tok.extglob === true || (extglobs.length && (tok.type === 'pipe' || tok.type === 'paren')); - - if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) { - state.output = state.output.slice(0, -prev.output.length); - prev.type = 'star'; - prev.value = '*'; - prev.output = star; - state.output += prev.output; - } - } - - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; - } - - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; - } - - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; +exports[`GH-69 sourcemap > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + var unit = [0, 1]; -" -`; + function identity$1(x) { + return x; + } -exports[`GH-69 sourcemap > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } +" +`; - if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) { - output = token.close = \`)$))\${extglobStar}\`; - } +exports[`GH-69 sourcemap > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - function one(b) { - return function(t) { - return b(t) + ""; - }; - } +" +`; - function string(a, b) { - var bi = reA.lastIndex = reB.lastIndex = 0, // scan index for next number in b - am, // current match in a - bm, // current match in b - bs, // string preceding current number in b, if any - i = -1, // index in s - s = [], // string constants and placeholders - q = []; // number interpolators +exports[`GH-93 > test - "list" 1`] = ` +"main.js: + /test/gh93/main.js: + rendered: 50 + gzip: 66 + brotli: 54 +virtual-id-a3e40_3s.js: + virtual-id: + rendered: 26 + gzip: 46 + brotli: 30 +" +`; - // Coerce inputs to strings. - a = a + "", b = b + ""; +exports[`GH-93 > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + return rgb; + })(1); -" -`; + function numberArray(a, b) { + if (!b) b = []; + var n = a ? Math.min(b.length, a.length) : 0, + c = b.slice(), + i; + return function(t) { + for (i = 0; i < n; ++i) c[i] = a[i] * (1 - t) + b[i] * t; + return c; + }; + } -exports[`GH-93 > test - "list" 1`] = ` -"main.js: - /test/gh93/main.js: - rendered: 50 - gzip: 66 - brotli: 54 -virtual-id-a3e40_3s.js: - virtual-id: - rendered: 26 - gzip: 46 - brotli: 30 -" -`; + function isNumberArray(x) { + return ArrayBuffer.isView(x) && !(x instanceof DataView); + } -exports[`GH-93 > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - push({ type: 'bracket', value }); - continue; - } +" +`; - if (value === ']') { - if (opts.nobracket === true || (prev && prev.type === 'bracket' && prev.value.length === 1)) { - push({ type: 'text', value, output: \`\\\\\${value}\` }); - continue; +exports[`GH-93 > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "main.js", + "children": [ + { + "name": "test/gh93/main.js", + "uid": "3acc92b5-1" } - - if (state.brackets === 0) { - if (opts.strictBrackets === true) { - throw new SyntaxError(syntaxError('opening', '[')); - } - - push({ type: 'text', value, output: \`\\\\\${value}\` }); - continue; + ] + }, + { + "name": "virtual-id-a3e40_3s.js", + "children": [ + { + "uid": "3acc92b5-3", + "name": "virtual-id" } + ] + } + ], + "isRoot": true + }, + "nodeParts": { + "3acc92b5-1": { + "renderedLength": 50, + "gzipLength": 66, + "brotliLength": 54, + "metaUid": "3acc92b5-0" + }, + "3acc92b5-3": { + "renderedLength": 26, + "gzipLength": 46, + "brotliLength": 30, + "metaUid": "3acc92b5-2" + } + }, + "nodeMetas": { + "3acc92b5-0": { + "id": "/test/gh93/main.js", + "moduleParts": { + "main.js": "3acc92b5-1" + }, + "imported": [], + "importedBy": [], + "isEntry": true + }, + "3acc92b5-2": { + "id": "virtual-id", + "moduleParts": { + "virtual-id-a3e40_3s.js": "3acc92b5-3" + }, + "imported": [], + "importedBy": [], + "isEntry": true + } + }, + "env": { + "rollup": "4.29.1" + }, + "options": { + "gzip": true, + "brotli": true, + "sourcemap": false + } +}" +`; - decrement('brackets'); +exports[`GH-93 > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - - -" -`; - -exports[`GH-93 > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "main.js", - "children": [ - { - "name": "test/gh93/main.js", - "uid": "3acc92b5-1" - } - ] - }, - { - "name": "virtual-id-a3e40_3s.js", - "children": [ - { - "uid": "3acc92b5-3", - "name": "virtual-id" - } - ] - } - ], - "isRoot": true - }, - "nodeParts": { - "3acc92b5-1": { - "renderedLength": 50, - "gzipLength": 66, - "brotliLength": 54, - "metaUid": "3acc92b5-0" - }, - "3acc92b5-3": { - "renderedLength": 26, - "gzipLength": 46, - "brotliLength": 30, - "metaUid": "3acc92b5-2" - } - }, - "nodeMetas": { - "3acc92b5-0": { - "id": "/test/gh93/main.js", - "moduleParts": { - "main.js": "3acc92b5-1" - }, - "imported": [], - "importedBy": [], - "isEntry": true - }, - "3acc92b5-2": { - "id": "virtual-id", - "moduleParts": { - "virtual-id-a3e40_3s.js": "3acc92b5-3" - }, - "imported": [], - "importedBy": [], - "isEntry": true - } - }, - "env": { - "rollup": "4.29.1" - }, - "options": { - "gzip": true, - "brotli": true, - "sourcemap": false - } -}" -`; - -exports[`GH-93 > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`GH-93 > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- - - - - -" -`; - -exports[`GH-93 sourcemap > test - "flamegraph" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + + +" +`; + +exports[`GH-93 > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + bytes.exports = bytes$1; + bytes.exports.format = format; + bytes.exports.parse = parse; -" -`; + /** + * Module variables. + * @private + */ -exports[`GH-93 sourcemap > test - "list" 1`] = ` -"main.js: - /test/gh93/main.js: - rendered: 84 -virtual-id-a3e40_3s.js: - virtual-id: - rendered: 75 -" -`; + var formatThousandsRegExp = /\\B(?=(\\d{3})+(?!\\d))/g; -exports[`GH-93 sourcemap > test - "network" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - var d = domain(); - var i0 = 0; - var i1 = d.length - 1; - var start = d[i0]; - var stop = d[i1]; - var prestep; - var step; - var maxIter = 10; +" +`; - if (stop < start) { - step = start, start = stop, stop = step; - step = i0, i0 = i1, i1 = step; - } - - while (maxIter-- > 0) { - step = tickIncrement(start, stop, count); - if (step === prestep) { - d[i0] = start; - d[i1] = stop; - return domain(d); - } else if (step > 0) { - start = Math.floor(start / step) * step; - stop = Math.ceil(stop / step) * step; - } else if (step < 0) { - start = Math.ceil(start * step) / step; - stop = Math.floor(stop * step) / step; - } else { - break; - } - prestep = step; - } +exports[`GH-93 sourcemap > test - "flamegraph" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ + + + - const match = REGEX_NON_SPECIAL_CHARS.exec(remaining()); - if (match) { - value += match[0]; - state.index += match[0].length; - } +" +`; - push({ type: 'text', value }); - continue; - } +exports[`GH-93 sourcemap > test - "list" 1`] = ` +"main.js: + /test/gh93/main.js: + rendered: 84 +virtual-id-a3e40_3s.js: + virtual-id: + rendered: 75 +" +`; - /** - * Stars - */ - - if (prev && (prev.type === 'globstar' || prev.star === true)) { - prev.type = 'star'; - prev.star = true; - prev.value += value; - prev.output = star; - state.backtrack = true; - state.globstar = true; - consume(value); - continue; - } +exports[`GH-93 sourcemap > test - "network" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + function identity$1(x) { + return x; + } -" -`; + function normalize(a, b) { + return (b -= (a = +a)) + ? function(x) { return (x - a) / b; } + : constants$1(isNaN(b) ? NaN : 0.5); + } -exports[`GH-93 sourcemap > test - "raw-data" 1`] = ` -"{ - "version": 2, - "tree": { - "name": "root", - "children": [ - { - "name": "main.js", - "uid": "d99fbd90-1" - }, - { - "name": "virtual-id-a3e40_3s.js", - "uid": "d99fbd90-3" - } - ], - "isRoot": true - }, - "nodeParts": { - "d99fbd90-1": { - "id": "main.js", - "gzipLength": 0, - "brotliLength": 0, - "renderedLength": 84, - "metaUid": "d99fbd90-0" - }, - "d99fbd90-3": { - "id": "virtual-id-a3e40_3s.js", - "gzipLength": 0, - "brotliLength": 0, - "renderedLength": 75, - "metaUid": "d99fbd90-2" + function clamper(a, b) { + var t; + if (a > b) t = a, a = b, b = t; + return function(x) { return Math.max(a, Math.min(b, x)); }; } - }, - "nodeMetas": { - "d99fbd90-0": { - "id": "/test/gh93/main.js", - "moduleParts": { - "main.js": "d99fbd90-1" - }, - "imported": [], - "importedBy": [], - "isEntry": true - }, - "d99fbd90-2": { - "id": "virtual-id", - "moduleParts": { - "virtual-id-a3e40_3s.js": "d99fbd90-3" - }, - "imported": [], - "importedBy": [], - "isEntry": true + + // normalize(a, b)(x) takes a domain value x in [a,b] and returns the corresponding parameter t in [0,1]. + // interpolate(a, b)(t) takes a parameter t in [0,1] and returns the corresponding range value x in [a,b]. + function bimap(domain, range, interpolate) { + var d0 = domain[0], d1 = domain[1], r0 = range[0], r1 = range[1]; + if (d1 < d0) d0 = normalize(d1, d0), r0 = interpolate(r1, r0); + else d0 = normalize(d0, d1), r0 = interpolate(r0, r1); + return function(x) { return r0(d0(x)); }; } - }, - "env": { - "rollup": "4.29.1" - }, - "options": { - "gzip": false, - "brotli": false, - "sourcemap": true - } -}" -`; -exports[`GH-93 sourcemap > test - "sunburst" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (extglobs.length && tok.type !== 'paren' && !EXTGLOB_CHARS[tok.value]) { - extglobs[extglobs.length - 1].inner += tok.value; - } +" +`; - if (tok.value || tok.output) append(tok); - if (prev && prev.type === 'text' && tok.type === 'text') { - prev.value += tok.value; - prev.output = (prev.output || '') + tok.value; - return; +exports[`GH-93 sourcemap > test - "raw-data" 1`] = ` +"{ + "version": 2, + "tree": { + "name": "root", + "children": [ + { + "name": "main.js", + "uid": "d99fbd90-1" + }, + { + "name": "virtual-id-a3e40_3s.js", + "uid": "d99fbd90-3" } + ], + "isRoot": true + }, + "nodeParts": { + "d99fbd90-1": { + "id": "main.js", + "gzipLength": 0, + "brotliLength": 0, + "renderedLength": 84, + "metaUid": "d99fbd90-0" + }, + "d99fbd90-3": { + "id": "virtual-id-a3e40_3s.js", + "gzipLength": 0, + "brotliLength": 0, + "renderedLength": 75, + "metaUid": "d99fbd90-2" + } + }, + "nodeMetas": { + "d99fbd90-0": { + "id": "/test/gh93/main.js", + "moduleParts": { + "main.js": "d99fbd90-1" + }, + "imported": [], + "importedBy": [], + "isEntry": true + }, + "d99fbd90-2": { + "id": "virtual-id", + "moduleParts": { + "virtual-id-a3e40_3s.js": "d99fbd90-3" + }, + "imported": [], + "importedBy": [], + "isEntry": true + } + }, + "env": { + "rollup": "4.29.1" + }, + "options": { + "gzip": false, + "brotli": false, + "sourcemap": true + } +}" +`; - tok.prev = prev; - tokens.push(tok); - prev = tok; - }; - - const extglobOpen = (type, value) => { - const token = { ...EXTGLOB_CHARS[value], conditions: 1, inner: '' }; - - token.prev = prev; - token.parens = state.parens; - token.output = state.output; - const output = (opts.capture ? '(' : '') + token.open; - - increment('parens'); - push({ type, value, output: state.output ? '' : ONE_CHAR }); - push({ type: 'paren', extglob: true, value: advance(), output }); - extglobs.push(token); - }; +exports[`GH-93 sourcemap > test - "sunburst" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+ - - - + var unit = [0, 1]; -" -`; + function identity$1(x) { + return x; + } -exports[`GH-93 sourcemap > test - "treemap" 1`] = ` -" - - - - - - - Rollup Visualizer - - - -
- + + + - if (token.inner && token.inner.length > 1 && token.inner.includes('/')) { - extglobStar = globstar(opts); - } +" +`; - if (extglobStar !== star || eos() || /^\\)+$/.test(remaining())) { - output = token.close = \`)$))\${extglobStar}\`; - } +exports[`GH-93 sourcemap > test - "treemap" 1`] = ` +" + + + + + + + Rollup Visualizer + + + +
+