diff options
Diffstat (limited to 'node_modules')
627 files changed, 31403 insertions, 0 deletions
diff --git a/node_modules/.bin/doiuse b/node_modules/.bin/doiuse new file mode 120000 index 00000000..3676a7ef --- /dev/null +++ b/node_modules/.bin/doiuse @@ -0,0 +1 @@ +../doiuse/bin/cli.js
\ No newline at end of file diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 7d850864..f901304f 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -2654,6 +2654,12 @@ "node": ">=10.13.0" } }, + "node_modules/@types/minimatch": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz", + "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==", + "dev": true + }, "node_modules/ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -2691,6 +2697,33 @@ "node": ">= 8" } }, + "node_modules/array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/autoprefixer": { "version": "10.4.16", "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.4.16.tgz", @@ -3014,6 +3047,12 @@ "url": "https://opencollective.com/core-js" } }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, "node_modules/css-blank-pseudo": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/css-blank-pseudo/-/css-blank-pseudo-6.0.0.tgz", @@ -3116,6 +3155,16 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/css-tokenize": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/css-tokenize/-/css-tokenize-1.0.1.tgz", + "integrity": "sha512-gLmmbJdwH9HLY4bcA17lnZ8GgPwEXRbvxBJGHnkiB6gLhRpTzjkjtMIvz7YORGW/Ptv2oMk8b5g+u7mRD6Dd7A==", + "dev": true, + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^1.0.33" + } + }, "node_modules/css-tree": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-2.3.1.tgz", @@ -3321,6 +3370,38 @@ "node": ">=8" } }, + "node_modules/doiuse": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/doiuse/-/doiuse-6.0.2.tgz", + "integrity": "sha512-eBTs23NOX+EAYPr4RbCR6J4DRW/TML3uMo37y0X1whlkersDYFCk9HmCl09KX98cis22VKsV1QaxfVNauJ3NBw==", + "dev": true, + "dependencies": { + "browserslist": "^4.21.5", + "caniuse-lite": "^1.0.30001487", + "css-tokenize": "^1.0.1", + "duplexify": "^4.1.2", + "ldjson-stream": "^1.2.1", + "multimatch": "^5.0.0", + "postcss": "^8.4.21", + "source-map": "^0.7.4", + "yargs": "^17.7.1" + }, + "bin": { + "doiuse": "bin/cli.js" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/doiuse/node_modules/source-map": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.4.tgz", + "integrity": "sha512-l3BikUxvPOcn5E74dZiq5BGsTb5yEwhaTSzccU6t4sDOH8NWJCstKO5QT2CvtFoK6F0saL7p9xHAqHOlCPJygA==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, "node_modules/dom-serializer": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", @@ -3376,6 +3457,41 @@ "url": "https://github.com/fb55/domutils?sponsor=1" } }, + "node_modules/duplexify": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.2.tgz", + "integrity": "sha512-fz3OjcNCHmRP12MJoZMPglx8m4rrFP8rovnk4vT8Fs+aonZoCwGg10dSsQsfP/E62eZcPTMSMP6686fu9Qlqtw==", + "dev": true, + "dependencies": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.0" + } + }, + "node_modules/duplexify/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dev": true, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/duplexify/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/electron-to-chromium": { "version": "1.4.554", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.554.tgz", @@ -3388,6 +3504,15 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "node_modules/end-of-stream": { + "version": "1.4.4", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", + "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "dev": true, + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", @@ -3737,6 +3862,12 @@ "node": ">=0.12.0" } }, + "node_modules/isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", + "dev": true + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -3779,6 +3910,16 @@ "graceful-fs": "^4.1.6" } }, + "node_modules/ldjson-stream": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ldjson-stream/-/ldjson-stream-1.2.1.tgz", + "integrity": "sha512-xw/nNEXafuPSLu8NjjG3+atVVw+8U1APZAQylmwQn19Hgw6rC7QjHvP6MupnHWCrzSm9m0xs5QWkCLuRvBPjgQ==", + "dev": true, + "dependencies": { + "split2": "^0.2.1", + "through2": "^0.6.1" + } + }, "node_modules/lilconfig": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", @@ -3892,6 +4033,25 @@ "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, + "node_modules/multimatch": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-5.0.0.tgz", + "integrity": "sha512-ypMKuglUrZUD99Tk2bUQ+xNQj43lPEfAeX2o9cTteAmShXy2VHDJpuwu1o0xqoKCt9jLVAvwyFKdLTPXKAfJyA==", + "dev": true, + "dependencies": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/nanoid": { "version": "3.3.6", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", @@ -5373,6 +5533,18 @@ "pify": "^2.3.0" } }, + "node_modules/readable-stream": { + "version": "1.1.14", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", + "integrity": "sha512-+MeVjFf4L44XUkhM1eYbD8fyEsxcV81pqMSR5gblfcLCHfZvbrqy4/qYHE+/R5HoBUT11WV5O08Cr1n3YXkWVQ==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, "node_modules/readdirp": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", @@ -5540,6 +5712,26 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -5579,6 +5771,27 @@ "node": ">=0.10.0" } }, + "node_modules/split2": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/split2/-/split2-0.2.1.tgz", + "integrity": "sha512-D/oTExYAkC9nWleOCTOyNmAuzfAT/6rHGBA9LIK7FVnGo13CSvrKCUzKenwH6U1s2znY9MqH6v0UQTEDa3vJmg==", + "dev": true, + "dependencies": { + "through2": "~0.6.1" + } + }, + "node_modules/stream-shift": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz", + "integrity": "sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==", + "dev": true + }, + "node_modules/string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==", + "dev": true + }, "node_modules/string-width": { "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", @@ -5675,6 +5888,28 @@ "integrity": "sha512-89Gi5raiWA3QZ4b2ePcEwswC3me9JIg+ToSgtE0JWeCynLnLxNr/f9G+xfo9K+Oj4AFdom8YNJjibIARTJmapQ==", "dev": true }, + "node_modules/through2": { + "version": "0.6.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-0.6.5.tgz", + "integrity": "sha512-RkK/CCESdTKQZHdmKICijdKKsCRVHs5KsLZ6pACAmF/1GPUQhonHSXWNERctxEp7RmvjdNbZTL5z9V7nSCXKcg==", + "dev": true, + "dependencies": { + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + } + }, + "node_modules/through2/node_modules/readable-stream": { + "version": "1.0.34", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "integrity": "sha512-ok1qVCJuRkNmvebYikljxJA/UEsKwLl2nI1OmaqAu4/UE+h0wKCHok4XkL/gvi39OacXvw59RJUOFUkDib2rHg==", + "dev": true, + "dependencies": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "0.0.1", + "string_decoder": "~0.10.x" + } + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -5804,6 +6039,15 @@ "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, + "node_modules/xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==", + "dev": true, + "engines": { + "node": ">=0.4" + } + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/node_modules/@types/minimatch/LICENSE b/node_modules/@types/minimatch/LICENSE new file mode 100755 index 00000000..9e841e7a --- /dev/null +++ b/node_modules/@types/minimatch/LICENSE @@ -0,0 +1,21 @@ + MIT License + + Copyright (c) Microsoft Corporation. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE diff --git a/node_modules/@types/minimatch/README.md b/node_modules/@types/minimatch/README.md new file mode 100755 index 00000000..d05647a5 --- /dev/null +++ b/node_modules/@types/minimatch/README.md @@ -0,0 +1,16 @@ +# Installation
+> `npm install --save @types/minimatch`
+
+# Summary
+This package contains type definitions for Minimatch (https://github.com/isaacs/minimatch).
+
+# Details
+Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/minimatch.
+
+### Additional Details
+ * Last updated: Wed, 07 Jul 2021 00:01:40 GMT
+ * Dependencies: none
+ * Global values: none
+
+# Credits
+These definitions were written by [vvakame](https://github.com/vvakame), and [Shant Marouti](https://github.com/shantmarouti).
diff --git a/node_modules/@types/minimatch/index.d.ts b/node_modules/@types/minimatch/index.d.ts new file mode 100755 index 00000000..3fc2faff --- /dev/null +++ b/node_modules/@types/minimatch/index.d.ts @@ -0,0 +1,204 @@ +// Type definitions for Minimatch 3.0 +// Project: https://github.com/isaacs/minimatch +// Definitions by: vvakame <https://github.com/vvakame> +// Shant Marouti <https://github.com/shantmarouti> +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Tests a path against the pattern using the options. + */ +declare function M(target: string, pattern: string, options?: M.IOptions): boolean; + +declare namespace M { + /** + * Match against the list of files, in the style of fnmatch or glob. + * If nothing is matched, and options.nonull is set, + * then return a list containing the pattern itself. + */ + function match(list: ReadonlyArray<string>, pattern: string, options?: IOptions): string[]; + + /** + * Returns a function that tests its supplied argument, suitable for use with Array.filter + */ + function filter(pattern: string, options?: IOptions): (element: string, indexed: number, array: ReadonlyArray<string>) => boolean; + + /** + * Make a regular expression object from the pattern. + */ + function makeRe(pattern: string, options?: IOptions): RegExp; + + let Minimatch: IMinimatchStatic; + + interface IOptions { + /** + * Dump a ton of stuff to stderr. + * + * @default false + */ + debug?: boolean | undefined; + + /** + * Do not expand {a,b} and {1..3} brace sets. + * + * @default false + */ + nobrace?: boolean | undefined; + + /** + * Disable ** matching against multiple folder names. + * + * @default false + */ + noglobstar?: boolean | undefined; + + /** + * Allow patterns to match filenames starting with a period, + * even if the pattern does not explicitly have a period in that spot. + * + * @default false + */ + dot?: boolean | undefined; + + /** + * Disable "extglob" style patterns like +(a|b). + * + * @default false + */ + noext?: boolean | undefined; + + /** + * Perform a case-insensitive match. + * + * @default false + */ + nocase?: boolean | undefined; + + /** + * When a match is not found by minimatch.match, + * return a list containing the pattern itself if this option is set. + * Otherwise, an empty list is returned if there are no matches. + * + * @default false + */ + nonull?: boolean | undefined; + + /** + * If set, then patterns without slashes will be matched against + * the basename of the path if it contains slashes. + * + * @default false + */ + matchBase?: boolean | undefined; + + /** + * Suppress the behavior of treating # + * at the start of a pattern as a comment. + * + * @default false + */ + nocomment?: boolean | undefined; + + /** + * Suppress the behavior of treating a leading ! character as negation. + * + * @default false + */ + nonegate?: boolean | undefined; + + /** + * Returns from negate expressions the same as if they were not negated. + * (Ie, true on a hit, false on a miss.) + * + * @default false + */ + flipNegate?: boolean | undefined; + } + + interface IMinimatchStatic { + new(pattern: string, options?: IOptions): IMinimatch; + prototype: IMinimatch; + } + + interface IMinimatch { + /** + * The original pattern the minimatch object represents. + */ + pattern: string; + + /** + * The options supplied to the constructor. + */ + options: IOptions; + + /** + * A 2-dimensional array of regexp or string expressions. + */ + set: any[][]; // (RegExp | string)[][] + + /** + * A single regular expression expressing the entire pattern. + * Created by the makeRe method. + */ + regexp: RegExp; + + /** + * True if the pattern is negated. + */ + negate: boolean; + + /** + * True if the pattern is a comment. + */ + comment: boolean; + + /** + * True if the pattern is "" + */ + empty: boolean; + + /** + * Generate the regexp member if necessary, and return it. + * Will return false if the pattern is invalid. + */ + makeRe(): RegExp; // regexp or boolean + + /** + * Return true if the filename matches the pattern, or false otherwise. + */ + match(fname: string): boolean; + + /** + * Take a /-split filename, and match it against a single row in the regExpSet. + * This method is mainly for internal use, but is exposed so that it can be used + * by a glob-walker that needs to avoid excessive filesystem calls. + */ + matchOne(files: string[], pattern: string[], partial: boolean): boolean; + + /** + * @deprecated. For internal use. + */ + debug(): void; + + /** + * @deprecated. For internal use. + */ + make(): void; + + /** + * @deprecated. For internal use. + */ + parseNegate(): void; + + /** + * @deprecated. For internal use. + */ + braceExpand(pattern: string, options: IOptions): void; + + /** + * @deprecated. For internal use. + */ + parse(pattern: string, isSub?: boolean): void; + } +} + +export = M; diff --git a/node_modules/@types/minimatch/package.json b/node_modules/@types/minimatch/package.json new file mode 100755 index 00000000..3aef5919 --- /dev/null +++ b/node_modules/@types/minimatch/package.json @@ -0,0 +1,30 @@ +{ + "name": "@types/minimatch", + "version": "3.0.5", + "description": "TypeScript definitions for Minimatch", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/minimatch", + "license": "MIT", + "contributors": [ + { + "name": "vvakame", + "url": "https://github.com/vvakame", + "githubUsername": "vvakame" + }, + { + "name": "Shant Marouti", + "url": "https://github.com/shantmarouti", + "githubUsername": "shantmarouti" + } + ], + "main": "", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/minimatch" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "ce8670ab7ddb0b32136aa0f819c3e7d791e75f04ff991f2f1baa3a9967dd61c0", + "typeScriptVersion": "3.6" +}
\ No newline at end of file diff --git a/node_modules/array-differ/index.d.ts b/node_modules/array-differ/index.d.ts new file mode 100644 index 00000000..3a038ea5 --- /dev/null +++ b/node_modules/array-differ/index.d.ts @@ -0,0 +1,21 @@ +/** +Create an array with values that are present in the first array but not additional ones. + +@param array - The array to compare against. +@param values - The arrays with values to be excluded. +@returns A new array of filtered values. + +@example +``` +import arrayDiffer = require('array-differ'); + +arrayDiffer([2, 3, 4], [3, 50]); +//=> [2, 4] +``` +*/ +declare function arrayDiffer<ValueType>( + array: readonly ValueType[], + ...values: (readonly ValueType[])[] +): ValueType[]; + +export = arrayDiffer; diff --git a/node_modules/array-differ/index.js b/node_modules/array-differ/index.js new file mode 100644 index 00000000..0dab1b86 --- /dev/null +++ b/node_modules/array-differ/index.js @@ -0,0 +1,8 @@ +'use strict'; + +const arrayDiffer = (array, ...values) => { + const rest = new Set([].concat(...values)); + return array.filter(element => !rest.has(element)); +}; + +module.exports = arrayDiffer; diff --git a/node_modules/array-differ/license b/node_modules/array-differ/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/array-differ/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/array-differ/package.json b/node_modules/array-differ/package.json new file mode 100644 index 00000000..e4ade95e --- /dev/null +++ b/node_modules/array-differ/package.json @@ -0,0 +1,35 @@ +{ + "name": "array-differ", + "version": "3.0.0", + "description": "Create an array with values that are present in the first input array but not additional ones", + "license": "MIT", + "repository": "sindresorhus/array-differ", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "array", + "difference", + "diff", + "differ", + "filter", + "exclude" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/array-differ/readme.md b/node_modules/array-differ/readme.md new file mode 100644 index 00000000..b98cc06d --- /dev/null +++ b/node_modules/array-differ/readme.md @@ -0,0 +1,41 @@ +# array-differ [](https://travis-ci.org/sindresorhus/array-differ) + +> Create an array with values that are present in the first input array but not additional ones + + +## Install + +``` +$ npm install array-differ +``` + + +## Usage + +```js +const arrayDiffer = require('array-differ'); + +arrayDiffer([2, 3, 4], [3, 50]); +//=> [2, 4] +``` + +## API + +### arrayDiffer(input, ...values) + +Returns a new array. + +#### input + +Type: `unknown[]` + +#### values + +Type: `unknown[]` + +Arrays of values to exclude. + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/array-union/index.d.ts b/node_modules/array-union/index.d.ts new file mode 100644 index 00000000..379fc1d2 --- /dev/null +++ b/node_modules/array-union/index.d.ts @@ -0,0 +1,25 @@ +/** +Create an array of unique values, in order, from the input arrays. + +@example +``` +import arrayUnion = require('array-union'); + +arrayUnion([1, 1, 2, 3], [2, 3]); +//=> [1, 2, 3] + +arrayUnion(['foo', 'foo', 'bar']); +//=> ['foo', 'bar'] + +arrayUnion(['🐱', '🦄', '🐻'], ['🦄', '🌈']); +//=> ['🐱', '🦄', '🐻', '🌈'] + +arrayUnion(['🐱', '🦄'], ['🐻', '🦄'], ['🐶', '🌈', '🌈']); +//=> ['🐱', '🦄', '🐻', '🐶', '🌈'] +``` +*/ +declare function arrayUnion<ArgumentsType extends readonly unknown[]>( + ...arguments: readonly ArgumentsType[] +): ArgumentsType; + +export = arrayUnion; diff --git a/node_modules/array-union/index.js b/node_modules/array-union/index.js new file mode 100644 index 00000000..7f85d3d1 --- /dev/null +++ b/node_modules/array-union/index.js @@ -0,0 +1,5 @@ +'use strict'; + +module.exports = (...arguments_) => { + return [...new Set([].concat(...arguments_))]; +}; diff --git a/node_modules/array-union/license b/node_modules/array-union/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/array-union/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/array-union/package.json b/node_modules/array-union/package.json new file mode 100644 index 00000000..5ad5afa7 --- /dev/null +++ b/node_modules/array-union/package.json @@ -0,0 +1,38 @@ +{ + "name": "array-union", + "version": "2.1.0", + "description": "Create an array of unique values, in order, from the input arrays", + "license": "MIT", + "repository": "sindresorhus/array-union", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "array", + "set", + "uniq", + "unique", + "duplicate", + "remove", + "union", + "combine", + "merge" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/array-union/readme.md b/node_modules/array-union/readme.md new file mode 100644 index 00000000..2474a1ae --- /dev/null +++ b/node_modules/array-union/readme.md @@ -0,0 +1,34 @@ +# array-union [](https://travis-ci.org/sindresorhus/array-union) + +> Create an array of unique values, in order, from the input arrays + + +## Install + +``` +$ npm install array-union +``` + + +## Usage + +```js +const arrayUnion = require('array-union'); + +arrayUnion([1, 1, 2, 3], [2, 3]); +//=> [1, 2, 3] + +arrayUnion(['foo', 'foo', 'bar']); +//=> ['foo', 'bar'] + +arrayUnion(['🐱', '🦄', '🐻'], ['🦄', '🌈']); +//=> ['🐱', '🦄', '🐻', '🌈'] + +arrayUnion(['🐱', '🦄'], ['🐻', '🦄'], ['🐶', '🌈', '🌈']); +//=> ['🐱', '🦄', '🐻', '🐶', '🌈'] +``` + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/arrify/index.d.ts b/node_modules/arrify/index.d.ts new file mode 100644 index 00000000..bfd0cf5e --- /dev/null +++ b/node_modules/arrify/index.d.ts @@ -0,0 +1,38 @@ +/** +Convert a value to an array. + +_Supplying `null` or `undefined` results in an empty array._ + +@example +``` +import arrify = require('arrify'); + +arrify('🦄'); +//=> ['🦄'] + +arrify(['🦄']); +//=> ['🦄'] + +arrify(new Set(['🦄'])); +//=> ['🦄'] + +arrify(null); +//=> [] + +arrify(undefined); +//=> [] +``` +*/ +declare function arrify<ValueType>( + value: ValueType +): ValueType extends (null | undefined) + ? [] + : ValueType extends string + ? [string] + : ValueType extends ReadonlyArray<unknown> // TODO: Use 'readonly unknown[]' in the next major version + ? ValueType + : ValueType extends Iterable<infer T> + ? T[] + : [ValueType]; + +export = arrify; diff --git a/node_modules/arrify/index.js b/node_modules/arrify/index.js new file mode 100644 index 00000000..49a5c9ad --- /dev/null +++ b/node_modules/arrify/index.js @@ -0,0 +1,23 @@ +'use strict'; + +const arrify = value => { + if (value === null || value === undefined) { + return []; + } + + if (Array.isArray(value)) { + return value; + } + + if (typeof value === 'string') { + return [value]; + } + + if (typeof value[Symbol.iterator] === 'function') { + return [...value]; + } + + return [value]; +}; + +module.exports = arrify; diff --git a/node_modules/arrify/license b/node_modules/arrify/license new file mode 100644 index 00000000..e7af2f77 --- /dev/null +++ b/node_modules/arrify/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/arrify/package.json b/node_modules/arrify/package.json new file mode 100644 index 00000000..07578884 --- /dev/null +++ b/node_modules/arrify/package.json @@ -0,0 +1,35 @@ +{ + "name": "arrify", + "version": "2.0.1", + "description": "Convert a value to an array", + "license": "MIT", + "repository": "sindresorhus/arrify", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "sindresorhus.com" + }, + "engines": { + "node": ">=8" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "array", + "arrify", + "arrayify", + "convert", + "value", + "ensure" + ], + "devDependencies": { + "ava": "^1.4.1", + "tsd": "^0.7.2", + "xo": "^0.24.0" + } +} diff --git a/node_modules/arrify/readme.md b/node_modules/arrify/readme.md new file mode 100644 index 00000000..b3dfc837 --- /dev/null +++ b/node_modules/arrify/readme.md @@ -0,0 +1,39 @@ +# arrify [](https://travis-ci.org/sindresorhus/arrify) + +> Convert a value to an array + + +## Install + +``` +$ npm install arrify +``` + + +## Usage + +```js +const arrify = require('arrify'); + +arrify('🦄'); +//=> ['🦄'] + +arrify(['🦄']); +//=> ['🦄'] + +arrify(new Set(['🦄'])); +//=> ['🦄'] + +arrify(null); +//=> [] + +arrify(undefined); +//=> [] +``` + +*Supplying `null` or `undefined` results in an empty array.* + + +## License + +MIT © [Sindre Sorhus](https://sindresorhus.com) diff --git a/node_modules/core-util-is/LICENSE b/node_modules/core-util-is/LICENSE new file mode 100644 index 00000000..d8d7f943 --- /dev/null +++ b/node_modules/core-util-is/LICENSE @@ -0,0 +1,19 @@ +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/node_modules/core-util-is/README.md b/node_modules/core-util-is/README.md new file mode 100644 index 00000000..5a76b414 --- /dev/null +++ b/node_modules/core-util-is/README.md @@ -0,0 +1,3 @@ +# core-util-is + +The `util.is*` functions introduced in Node v0.12. diff --git a/node_modules/core-util-is/lib/util.js b/node_modules/core-util-is/lib/util.js new file mode 100644 index 00000000..6e5a20d7 --- /dev/null +++ b/node_modules/core-util-is/lib/util.js @@ -0,0 +1,107 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// NOTE: These type checking functions intentionally don't use `instanceof` +// because it is fragile and can be easily faked with `Object.create()`. + +function isArray(arg) { + if (Array.isArray) { + return Array.isArray(arg); + } + return objectToString(arg) === '[object Array]'; +} +exports.isArray = isArray; + +function isBoolean(arg) { + return typeof arg === 'boolean'; +} +exports.isBoolean = isBoolean; + +function isNull(arg) { + return arg === null; +} +exports.isNull = isNull; + +function isNullOrUndefined(arg) { + return arg == null; +} +exports.isNullOrUndefined = isNullOrUndefined; + +function isNumber(arg) { + return typeof arg === 'number'; +} +exports.isNumber = isNumber; + +function isString(arg) { + return typeof arg === 'string'; +} +exports.isString = isString; + +function isSymbol(arg) { + return typeof arg === 'symbol'; +} +exports.isSymbol = isSymbol; + +function isUndefined(arg) { + return arg === void 0; +} +exports.isUndefined = isUndefined; + +function isRegExp(re) { + return objectToString(re) === '[object RegExp]'; +} +exports.isRegExp = isRegExp; + +function isObject(arg) { + return typeof arg === 'object' && arg !== null; +} +exports.isObject = isObject; + +function isDate(d) { + return objectToString(d) === '[object Date]'; +} +exports.isDate = isDate; + +function isError(e) { + return (objectToString(e) === '[object Error]' || e instanceof Error); +} +exports.isError = isError; + +function isFunction(arg) { + return typeof arg === 'function'; +} +exports.isFunction = isFunction; + +function isPrimitive(arg) { + return arg === null || + typeof arg === 'boolean' || + typeof arg === 'number' || + typeof arg === 'string' || + typeof arg === 'symbol' || // ES6 symbol + typeof arg === 'undefined'; +} +exports.isPrimitive = isPrimitive; + +exports.isBuffer = require('buffer').Buffer.isBuffer; + +function objectToString(o) { + return Object.prototype.toString.call(o); +} diff --git a/node_modules/core-util-is/package.json b/node_modules/core-util-is/package.json new file mode 100644 index 00000000..b0c51f58 --- /dev/null +++ b/node_modules/core-util-is/package.json @@ -0,0 +1,38 @@ +{ + "name": "core-util-is", + "version": "1.0.3", + "description": "The `util.is*` functions introduced in Node v0.12.", + "main": "lib/util.js", + "files": [ + "lib" + ], + "repository": { + "type": "git", + "url": "git://github.com/isaacs/core-util-is" + }, + "keywords": [ + "util", + "isBuffer", + "isArray", + "isNumber", + "isString", + "isRegExp", + "isThis", + "isThat", + "polyfill" + ], + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/isaacs/core-util-is/issues" + }, + "scripts": { + "test": "tap test.js", + "preversion": "npm test", + "postversion": "npm publish", + "prepublishOnly": "git push origin --follow-tags" + }, + "devDependencies": { + "tap": "^15.0.9" + } +} diff --git a/node_modules/css-tokenize/.npmignore b/node_modules/css-tokenize/.npmignore new file mode 100644 index 00000000..59d842ba --- /dev/null +++ b/node_modules/css-tokenize/.npmignore @@ -0,0 +1,28 @@ +# Logs +logs +*.log + +# Runtime data +pids +*.pid +*.seed + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directory +# Commenting this out is preferred by some people, see +# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- +node_modules + +# Users Environment Variables +.lock-wscript diff --git a/node_modules/css-tokenize/.travis.yml b/node_modules/css-tokenize/.travis.yml new file mode 100644 index 00000000..2083806b --- /dev/null +++ b/node_modules/css-tokenize/.travis.yml @@ -0,0 +1,4 @@ +language: node_js +node_js: + - "0.11" + - "0.10"
\ No newline at end of file diff --git a/node_modules/css-tokenize/LICENSE b/node_modules/css-tokenize/LICENSE new file mode 100644 index 00000000..18ed0820 --- /dev/null +++ b/node_modules/css-tokenize/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Anand Thakker + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/css-tokenize/README.md b/node_modules/css-tokenize/README.md new file mode 100644 index 00000000..df92e822 --- /dev/null +++ b/node_modules/css-tokenize/README.md @@ -0,0 +1,100 @@ +css-tokenize +============ + +Coarsely tokenize a stream of CSS, largely modeled after +[substack/html-tokenize](/substack/html-tokenize). + +```javascript +var tokenize = require('css-tokenize'), +through = require('through2'); + +process.stdin +.pipe(tokenize()) +.pipe(through.obj(function(token, enc, next) { + token[1] = token[1].toString(); // it's a buffer slice + console.log('TOKEN', token); + next(); +})) +``` + +Input: +```css + +div { + background: red; +} + +.cls { + color: green; +} + +#id { + font-size: 10px; +} + +/* comment */ + +@media screen and (min-width: 1000px) { + a { + text-decoration: underline; + } +} + +a:hover { + font-weight: bold; +} + +section + + +{ + margin: 0; + /* comment wthin a rule */ + padding: 5px; +} + + +body > * { + +} +``` + +Output: +``` +TOKEN [ 'root', '\n' ] +TOKEN [ 'rule_start', 'div {' ] +TOKEN [ 'rule', '\n background: red;\n' ] +TOKEN [ 'rule_end', '}' ] +TOKEN [ 'root', '\n\n' ] +TOKEN [ 'rule_start', '.cls {' ] +TOKEN [ 'rule', '\n color: green;\n' ] +TOKEN [ 'rule_end', '}' ] +TOKEN [ 'root', '\n\n' ] +TOKEN [ 'rule_start', '#id {' ] +TOKEN [ 'rule', '\n font-size: 10px;\n' ] +TOKEN [ 'rule_end', '}' ] +TOKEN [ 'comment', '\n\n/* comment */' ] +TOKEN [ 'space', '\n\n' ] +TOKEN [ 'atrule_start', '@media screen and (min-width: 1000px) {' ] +TOKEN [ 'atrule', '\n ' ] +TOKEN [ 'rule_start', 'a {' ] +TOKEN [ 'rule', '\n text-decoration: underline;\n ' ] +TOKEN [ 'rule_end', '}' ] +TOKEN [ 'atrule', '\n' ] +TOKEN [ 'atrule_end', '}' ] +TOKEN [ 'root', '\n\n' ] +TOKEN [ 'rule_start', 'a:hover {' ] +TOKEN [ 'rule', '\n font-weight: bold; \n' ] +TOKEN [ 'rule_end', '}' ] +TOKEN [ 'root', '\n\n' ] +TOKEN [ 'rule_start', 'section \n\n\n{' ] +TOKEN [ 'rule', '\n margin: 0;\n ' ] +TOKEN [ 'comment', '/* comment wthin a rule */' ] +TOKEN [ 'rule', '\n padding: 5px;\n' ] +TOKEN [ 'rule_end', '}' ] +TOKEN [ 'root', '\n\n\n' ] +TOKEN [ 'rule_start', 'body > * {' ] +TOKEN [ 'rule', '\n \n' ] +TOKEN [ 'rule_end', '}' ] +TOKEN [ 'root', '\n' ] +``` diff --git a/node_modules/css-tokenize/example.js b/node_modules/css-tokenize/example.js new file mode 100644 index 00000000..b0ff6534 --- /dev/null +++ b/node_modules/css-tokenize/example.js @@ -0,0 +1,13 @@ + +var tokenize = require('./'), + through = require('through2'), + fs = require('fs'); + +var input = process.argv[2] ? fs.createReadStream(process.argv[2]) : process.stdin; + +input.pipe(tokenize()) + .pipe(through.obj(function(token, enc, next) { + token[1] = token[1].toString(); // it's a buffer slice + console.log('TOKEN', token); + next(); + })) diff --git a/node_modules/css-tokenize/index.js b/node_modules/css-tokenize/index.js new file mode 100644 index 00000000..21d84470 --- /dev/null +++ b/node_modules/css-tokenize/index.js @@ -0,0 +1,172 @@ + +/** + * The approach here owes a LOT to https://github.com/substack/html-tokenize. + */ + +var Transform = require('readable-stream').Transform; +var inherits = require('inherits'); + +inherits(Tokenize, Transform); +module.exports = Tokenize; + +var codes = { + fslash: '/'.charCodeAt(0), + bslash: '\\'.charCodeAt(0), + lparen: '('.charCodeAt(0), + rparen: ')'.charCodeAt(0), + lbrace: '{'.charCodeAt(0), + rbrace: '}'.charCodeAt(0), + lbrack: '['.charCodeAt(0), + rbrack: ']'.charCodeAt(0), + squote: '\''.charCodeAt(0), + dquote: '"'.charCodeAt(0), + at: '@'.charCodeAt(0), + semi: ';'.charCodeAt(0), + asterisk: '*'.charCodeAt(0) +} + +var sequences = { + comment_start: '/*', + comment_end: '*/' +} + + +function charCodes(s) { return s.split('').map(function(c){return c.charCodeAt(0)}) } +var sets = { + space: charCodes(' \t\n\r\f'), + open_brackets: [codes.lparen, codes.lbrace, codes.lbrack], + newline: charCodes('\n\r\f') +} + +function Tokenize() { + if (!(this instanceof Tokenize)) return new Tokenize; + Transform.call(this); + this._readableState.objectMode = true; + this.state = [['root']]; + this._input = null; // buffer the input for read-ahead + this._position = 0; // current position in this._input + this.buffers = []; // collect data for current token +} + + +Tokenize.prototype._transform = function(buf, enc, next) { + var input = this._input = this._input ? Buffer.concat([ this._input, buf ]) : buf; + + for(var i = this._position; i < input.length; i++) { + var c = input[i]; + var state = this.state[this.state.length - 1][0], + stateData = this.state[this.state.length - 1][1], + end = null; + + // console.log(i, c, this.state); + + /* comments */ + if(i === input.length - 1 + && (('comment' === state && c === codes.asterisk) + || c === codes.fslash)) { + // need more data: save unprocessed input and bail out. + this._input = this._input.slice(this._position); + break; + } + else if('comment' !== state + && c === codes.fslash && input[i+1] === codes.asterisk) { + if('root' !== state) end = [].concat(state); + i--; //backup to save the '/*' for the comment token. + this.state.push(['comment']) + } + else if('comment' === state + && c === codes.asterisk && input[i+1] === codes.fslash) { + i++; + end = this.state.pop(); + } + /* strings */ + else if('string' === state + && c === stateData) { + this.state.pop(); + } + else if('string' !== state + && codes.squote === c || codes.dquote === c) { + this.state.push(['string', c]); + } + /* brackets */ + // else if(codes.lparen === c) { + // this.state.push(['brackets', codes.rparen]); + // } + // else if(codes.lbrack === c) { + // this.state.push(['brackets', codes.rbrack]); + // } + // else if('brackets' === state + // && c === stateData) { + // this.state.pop(); + // } + /* rules */ + else if('rule_start' === state + && c === codes.lbrace) { + end = this.state.pop(); + this.state.push(['rule']); + } + else if('atrule_start' === state + && c === codes.lbrace) { + end = this.state.pop(); + this.state.push(['atrule']); + } + else if(('rule' === state || 'atrule' === state) + && c === codes.rbrace) { + end = this.state.pop(); + i--; // backup to save the ending curly brace for the rule_end token. + this.state.push([ state + '_end' ]); + } + else if(('rule_end' === state || 'atrule_end' === state) + && c === codes.rbrace) { + end = this.state.pop(); + } + else if('root' === state + && c === codes.at) { + end = ['space']; + i--; + this.state.push(['atrule_start']) + } + // rules can start from the root or nested within at-rules. + else if(sets.space.indexOf(c) < 0) + { + if('root' === state) { + end = ['root']; + i--; + this.state.push(['rule_start']) + } + else if('atrule' === state) { + end = ['atrule']; + i--; + this.state.push(['rule_start']); + } + } + + if(end && i >= this._position) { + var out; + this.push(out = [end[0], input.slice(this._position, i+1)]); + this._position = i+1; + end = null; + } + } + + if(this._position < this._input.length) { + this._input = this._input.slice(this._position); + this._position = 0; + } + else { + this._input = null; + this._position = 0; + } + next(); +} + + +Tokenize.prototype._flush = function (next) { + if(this._input) + this.push([this.state.pop()[0], this._input.slice(this._position)]); + if(this.state.length !== 0) { + console.warn("[css-tokenize] unfinished business", this.state); + } + this.push(null); + next(); +}; diff --git a/node_modules/css-tokenize/package.json b/node_modules/css-tokenize/package.json new file mode 100644 index 00000000..5d0bfa3b --- /dev/null +++ b/node_modules/css-tokenize/package.json @@ -0,0 +1,34 @@ +{ + "name": "css-tokenize", + "version": "1.0.1", + "description": "Transform stream that tokenizes CSS", + "main": "index.js", + "scripts": { + "test": "tape test/*.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/anandthakker/css-tokenize.git" + }, + "keywords": [ + "css", + "tokenize", + "parse", + "stream", + "streaming" + ], + "author": "Anand Thakker <vestibule@anandthakker.net> (http://anandthakker.net)", + "license": "MIT", + "bugs": { + "url": "https://github.com/anandthakker/css-tokenize/issues" + }, + "homepage": "https://github.com/anandthakker/css-tokenize", + "devDependencies": { + "tape": "^3.0.3", + "through2": "^0.6.3" + }, + "dependencies": { + "inherits": "^2.0.1", + "readable-stream": "^1.0.33" + } +} diff --git a/node_modules/css-tokenize/test/base.js b/node_modules/css-tokenize/test/base.js new file mode 100644 index 00000000..a42298b7 --- /dev/null +++ b/node_modules/css-tokenize/test/base.js @@ -0,0 +1,100 @@ +var fs = require('fs'), + test = require('tape'), + through = require('through2'), + tokenize = require('../') + + +test('basic', function(t) { + var tok = tokenize(); + + var input = "html { font-size: 10px; }" + var expected = [ + ['rule_start', 'html {'], + ['rule', ' font-size: 10px; '], + ['rule_end', '}'] + ] + + t.plan(expected.length); + tok.pipe(through.obj(function(token, enc, next) { + token[1] = token[1].toString(); + if (expected.length > 0) t.same(token, expected.shift()) + next(); + })) + + tok.end(input); +}) + +test('at-rule nesting', function(t) { + var tok = tokenize(); + var expected = [ + [ 'atrule_start', '@media screen and (min-width: 1000px) {' ], + [ 'atrule', '\n ' ], + [ 'rule_start', 'a {' ], + [ 'rule', '\n text-decoration: underline;\n ' ], + [ 'rule_end', '}' ], + [ 'atrule', '\n' ], + [ 'atrule_end', '}' ], + [ 'root', '\n' ] + ] + + t.plan(expected.length); + tok.pipe(through.obj(function(token, enc, next) { + token[1] = token[1].toString(); + if (expected.length > 0) t.same(token, expected.shift()) + next(); + })) + + fs.createReadStream(__dirname + '/nested.css').pipe(tok); +}) + +test('gauntlet', function(t) { + var tok = tokenize(); + + var expected = [ + ['root', '\n'], + ['rule_start', 'div {'], + ['rule', '\n background: red;\n'], + ['rule_end', '}'], + ['root', '\n\n'], + ['rule_start', '.cls {'], + ['rule', '\n color: green;\n'], + ['rule_end', '}'], + ['root', '\n\n'], + ['rule_start', '#id {'], + ['rule', '\n font-size: 10px;\n'], + ['rule_end', '}'], + ['comment', '\n\n/* comment */'], + ['space', '\n\n'], + ['atrule_start', '@media screen and (min-width: 1000px) {'], + ['atrule', '\n '], + ['rule_start', 'a {'], + ['rule', '\n text-decoration: underline;\n '], + ['rule_end', '}'], + ['atrule', '\n'], + ['atrule_end', '}'], + ['root', '\n\n'], + ['rule_start', 'a:hover {'], + ['rule', '\n font-weight: bold; \n'], + ['rule_end', '}'], + ['root', '\n\n'], + ['rule_start', 'section \n\n\n{'], + ['rule', '\n margin: 0;\n '], + ['comment', '/* comment wthin a rule */'], + ['rule', '\n padding: 5px;\n'], + ['rule_end', '}'], + ['root', '\n\n\n'], + ['rule_start', 'body > * {'], + ['rule', '\n \n'], + ['rule_end', '}'], + ['root', '\n'] + ] + + t.plan(expected.length); + tok.pipe(through.obj(function(token, enc, next) { + token[1] = token[1].toString(); + if (expected.length > 0) t.same(token, expected.shift()) + next(); + })); + + fs.createReadStream(__dirname + '/gauntlet.css').pipe(tok); +}) diff --git a/node_modules/css-tokenize/test/brackets.css b/node_modules/css-tokenize/test/brackets.css new file mode 100644 index 00000000..559ca209 --- /dev/null +++ b/node_modules/css-tokenize/test/brackets.css @@ -0,0 +1,7 @@ + +.hello { + background: url(http://blahlbahlbah.com); +} + + +.explore-mail-tease{padding-top:20px;overflow:hidden;background:#202021 url(/assets/modules/home/octicons-bg-f51579234572c7286b1ead7a6408f2d43c7a0520dbb09f9d2b8b6b59024a01a0.png) center repeat;border-bottom:1px solid #ddd}.explore-mail-tease h3{color:#fff;text-align:center}.explore-mail-tease img{margin-bottom:-5px} diff --git a/node_modules/css-tokenize/test/gauntlet.css b/node_modules/css-tokenize/test/gauntlet.css new file mode 100644 index 00000000..833c8c9c --- /dev/null +++ b/node_modules/css-tokenize/test/gauntlet.css @@ -0,0 +1,38 @@ + +div { + background: red; +} + +.cls { + color: green; +} + +#id { + font-size: 10px; +} + +/* comment */ + +@media screen and (min-width: 1000px) { + a { + text-decoration: underline; + } +} + +a:hover { + font-weight: bold; +} + +section + + +{ + margin: 0; + /* comment wthin a rule */ + padding: 5px; +} + + +body > * { + +} diff --git a/node_modules/css-tokenize/test/nested.css b/node_modules/css-tokenize/test/nested.css new file mode 100644 index 00000000..8922e61a --- /dev/null +++ b/node_modules/css-tokenize/test/nested.css @@ -0,0 +1,5 @@ +@media screen and (min-width: 1000px) { + a { + text-decoration: underline; + } +} diff --git a/node_modules/doiuse/LICENSE b/node_modules/doiuse/LICENSE new file mode 100644 index 00000000..18ed0820 --- /dev/null +++ b/node_modules/doiuse/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2014 Anand Thakker + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/node_modules/doiuse/README.md b/node_modules/doiuse/README.md new file mode 100644 index 00000000..0964c18c --- /dev/null +++ b/node_modules/doiuse/README.md @@ -0,0 +1,172 @@ +[](https://travis-ci.org/anandthakker/doiuse) +[](https://release-notes.com/@open-source-community/anandthakker-doiuse) + +# doiuse + +Lint CSS for browser support against [Can I use](http://caniuse.com) database. + +## Install + +```sh +npm install -g doiuse +``` + +## Usage Examples + +### Command Line + +```bash +doiuse --browsers "ie >= 9, > 1%, last 2 versions" main.css +# or +cat main.css | doiuse --browsers "ie >= 9, > 1%, last 2 versions" +``` + +**Sample output:** +``` +/projects/website/main.css:5:3: CSS3 Box-sizing not supported by: IE (8,9,10,11), Chrome (36,37,38), Safari (8,7.1), Opera (24,25), iOS Safari (8,7.1,8.1), Android Browser (4.1,4.4,4.4.4), IE Mobile (10,11) +/projects/website/main.css:6:3: CSS3 Box-sizing not supported by: IE (8,9,10,11), Chrome (36,37,38), Safari (8,7.1), Opera (24,25), iOS Safari (8,7.1,8.1), Android Browser (4.1,4.4,4.4.4), IE Mobile (10,11) +/projects/website/main.css:8:3: CSS user-select: none not supported by: IE (8,9) +/projects/website/main.css:9:3: CSS user-select: none not supported by: IE (8,9) +/projects/website/main.css:10:3: CSS user-select: none not supported by: IE (8,9) +/projects/website/main.css:11:3: CSS user-select: none not supported by: IE (8,9) +/projects/website/main.css:12:3: CSS user-select: none not supported by: IE (8,9) +/projects/website/main.css:13:3: Pointer events not supported by: IE (8,9,10), Firefox (32,33), Chrome (36,37,38), Safari (8,7.1), Opera (24,25), iOS Safari (8,7.1,8.1), Android Browser (4.1,4.4,4.4.4), IE Mobile (10) +/projects/website/main.css:14:3: Pointer events not supported by: IE (8,9,10), Firefox (32,33), Chrome (36,37,38), Safari (8,7.1), Opera (24,25), iOS Safari (8,7.1,8.1), Android Browser (4.1,4.4,4.4.4), IE Mobile (10) +/projects/website/main.css:32:3: CSS3 Transforms not supported by: IE (8) +``` + +Use `--json` to get output as (newline-delimited) JSON objects. + +### JS + +```javascript +import postcss from 'postcss'; +import DoIUse from 'doiuse/lib/DoIUse.js'; + +postcss(new DoIUse({ + browsers:['ie >= 6', '> 1%'], + ignore: ['rem'], // an optional array of features to ignore + ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore + onFeatureUsage: (usageInfo) => { + console.log(usageInfo.message); + } +})).process("a { background-size: cover; }") +``` + +CommonJS syntax is still supported if using `var doiuse = require('doiuse')`. + +### Gulp (CommonJS) + +```javascript +var gulp = require('gulp') +var postcss = require('postcss') +var doiuse = require('doiuse') + +gulp.src(src, { cwd: process.cwd() }) +.pipe(gulp.postcss([ + doiuse({ + browsers: [ + 'ie >= 8', + '> 1%' + ], + ignore: ['rem'], // an optional array of features to ignore + ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore + onFeatureUsage: function (usageInfo) { + console.log(usageInfo.message) + } + }) +])) +``` + +## How it works + +In particular, the approach to detecting features usage is currently quite naive. + +<a name="features-list"></a>Refer to the data in [/data/features.js](data/features.js). + +- If a feature in that dataset only specifies `properties`, we just use those + properties for regex/substring matches against the properties used in the input CSS. +- If a feature also specifies `values`, then we also require that the associated + value matches one of those values. + +## API Details + +### As a transform stream + +```javascript +var doiuse = require('doiuse/stream'); + +process.stdin + .pipe(doiuse({ browsers: ['ie >= 8', '> 1%'], ignore: ['rem'] })) + .on('data', function (usageInfo) { + console.log(JSON.stringify(usageInfo)) + }) +``` + +Yields `UsageInfo` objects as described below. + +### As a postcss plugin + +`postcss(new DoIUse(opts)).process(css)`, where `opts` is: +```javascript +{ + browsers: ['ie >= 8', '> 1%'], // an autoprefixer-like array of browsers. + ignore: ['rem'], // an optional array of features to ignore + ignoreFiles: ['**/normalize.css'], // an optional array of file globs to match against original source file path, to ignore + onFeatureUsage: function(usageInfo) { } // a callback for usages of features not supported by the selected browsers +} +``` + +And `usageInfo` looks like this: + +```javascript +{ + message: '<input source>: line <l>, col <c> - CSS3 Gradients not supported by: IE (8)', + feature: 'css-gradients', // slug identifying a caniuse-db feature + featureData: { + title: 'CSS Gradients', + missing: "IE (8)", // string of browsers missing support for this feature. + missingData: { + // map of browser -> version -> (lack of)support code + ie: { '8': 'n' } + }, + caniuseData: { // data from caniuse-db/features-json/[feature].json } + }, + usage: {} //the postcss node where that feature is being used. +} +``` + +Called once for each usage of each css feature not supported by the selected browsers. + +### Ignoring file-specific rules + +For disabling some checks you can use just-in-place comments + +##### `/* doiuse-disable */` + +Disables checks of _all [features](#features-list)_ + +##### `/* doiuse-disable feature */` + +Disables checks of _specified [feature(s)](#features-list)_ (can be comma separated list) + +##### `/* doiuse-enable */` + +Re-enables checks of _all [features](#features-list)_ + +##### `/* doiuse-enable feature */` + +Enables checks of _specified [feature(s)](#features-list)_ (can be comma separated list) + - for following lines in file + +## [Contributing](CONTRIBUTING.md) + +doiuse is an [OPEN Open Source](http://openopensource.org/) Project. + +This means that individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project. + +## License + +MIT + +**NOTE:** Many of the files in test/cases are from autoprefixer-core, Copyright 2013 Andrey Sitnik <andrey@sitnik.ru>. Please see https://github.com/postcss/autoprefixer-core. diff --git a/node_modules/doiuse/bin/cli.js b/node_modules/doiuse/bin/cli.js new file mode 100755 index 00000000..d07d159b --- /dev/null +++ b/node_modules/doiuse/bin/cli.js @@ -0,0 +1,161 @@ +#!/usr/bin/env node + +import fs from 'node:fs'; +import path from 'node:path'; +import { PassThrough } from 'node:stream'; + +import browserslist from 'browserslist'; +import ldjson from 'ldjson-stream'; +import yargs from 'yargs'; + +import DoIUse from '../lib/DoIUse.js'; +import CssUsageDuplex from '../lib/stream/CssUsageDuplex.js'; +import { formatBrowserName } from '../utils/util.js'; + +const FILE_NOT_FOUND = 'ENOENT'; +const argv = await yargs(process.argv.slice(2)) + .usage('Lint your CSS for browser support.') + .example('cat FILE | $0 -b "ios >= 6"', '') + .example('$0 --browsers "ie >= 9, > 1%, last 3 versions" [FILE] [FILE] ...', '') + .example('$0 -b "ie >= 8" -b "> 1%" -b "last 3 versions" [FILE] [FILE] ...', '') + .options({ + browsers: { + type: 'string', + alias: 'b', + description: 'Autoprefixer-like browser criteria.', + default: /** @type {string} */ (null), + string: true, + }, + ignore: { + type: 'string', + alias: 'i', + description: 'List of features to ignore.', + default: '', + string: true, + }, + l: { + type: 'boolean', + alias: 'list-only', + description: 'Just show the browsers and features that would be tested by' + + 'the specified browser criteria, without actually processing any CSS.', + }, + config: { + type: 'string', + alias: 'c', + description: 'Provide options through config file', + }, + verbose: { + type: 'number', + alias: 'v', + description: 'Verbose output. Multiple levels available.', + }, + json: { + type: 'boolean', + alias: 'j', + description: 'Output JSON instead of string linter-like messages.', + }, + }) + .count('verbose') + .help('h', 'Show help message.') + .alias('h', 'help') + .argv; + +// Config file reading +if (argv.config) { + try { + const fileData = fs.readFileSync(path.resolve(argv.config)); + const config = JSON.parse(fileData.toString()); + + for (const [key, value] of Object.entries(config)) { + argv[key] = (key === 'browsers' && Array.isArray(value)) + ? value.join(',') + : value; + } + } catch (error) { + if (error && error.code === FILE_NOT_FOUND) { + process.stderr.write('Config file not found\n'); + } + throw error; + } +} + +const browsers = argv.browsers ? argv.browsers.split(',') + .map((/** @type {string} */ s) => s.trim()) : null; + +const ignore = argv.ignore.split(',').map((s) => s.trim()); + +// Informational output +if (argv.l || argv.verbose >= 1) { + const formattedBrowsers = browserslist(browsers) + .map((b) => { + const [name, version] = b.split(' '); + /** @type {[string, number]} */ + const formatted = [formatBrowserName(name), Number.parseInt(version, 10)]; + return formatted; + }) + .sort((a, b) => b[1] - a[1]) + .map((b) => b.join(' ')) + .join(', '); + process.stdout.write(`[doiuse] Browsers: ${formattedBrowsers}\n`); +} + +if (argv.verbose >= 2) { + const { features } = new DoIUse({ browsers }).info(); + process.stdout.write('[doiuse] Unsupported features:\n'); + for (const feature of Object.values(features)) { + process.stdout.write(`${feature.caniuseData.title}\n`); + if (argv.verbose >= 3) { + process.stdout.write(`\n${feature.missing}\n`); + } + } +} + +if (argv.l) { + // eslint-disable-next-line n/no-process-exit + process.exit(0); +} + +// Process the CSS +if (argv.help || (argv._.length === 0 && process.stdin.isTTY)) { + yargs.showHelp(); + // eslint-disable-next-line n/no-process-exit + process.exit(0); +} + +/** @type {import("stream").Writable} */ +let outStream; +if (argv.json) { + outStream = ldjson.serialize(); +} else { + outStream = new PassThrough({ + objectMode: true, + transform(usage, enc, next) { + next(null, `${usage.message}\n`); + }, + }); +} +outStream.pipe(process.stdout); + +/** + * @param {import('stream').Stream} stream + * @param {string} [file] + */ +function processStream(stream, file) { + stream.pipe(new CssUsageDuplex({ + browsers: argv.browsers, + // @ts-expect-error Skip cast + ignore, + }, file)) + .on('error', (error) => { + process.stderr.write('Error parsing file\n'); + throw error; + }) + .pipe(outStream); +} +if (argv._.length > 0) { + for (const file of argv._) { + processStream(fs.createReadStream(file.toString()), file.toString()); + } +} else { + processStream(process.stdin); +} diff --git a/node_modules/doiuse/data/.eslintrc.json b/node_modules/doiuse/data/.eslintrc.json new file mode 100644 index 00000000..5d42aab7 --- /dev/null +++ b/node_modules/doiuse/data/.eslintrc.json @@ -0,0 +1,18 @@ +{ + "rules": { + "canonical/filename-match-exported": "off", + "canonical/filename-match-regex": "off", + "import/order": "off", + "max-len": "off", + "object-shorthand": [ + "error", + "consistent" + ], + "quote-props": [ + "error", + "always" + ], + "unicorn/no-empty-file": "off", + "unicorn/prevent-abbreviations": "off" + } +}
\ No newline at end of file diff --git a/node_modules/doiuse/data/features.js b/node_modules/doiuse/data/features.js new file mode 100644 index 00000000..52bdc6c8 --- /dev/null +++ b/node_modules/doiuse/data/features.js @@ -0,0 +1,425 @@ +/* THIS FILE IS AUTOGENERATED */ +/* eslint-disable import/order, canonical/filename-match-exported */ + +import alternateStylesheet from './features/alternate-stylesheet.js'; +import backgroundAttachment from './features/background-attachment.js'; +import backgroundClipText from './features/background-clip-text.js'; +import backgroundImgOpts from './features/background-img-opts.js'; +import backgroundPositionXY from './features/background-position-x-y.js'; +import backgroundRepeatRoundSpace from './features/background-repeat-round-space.js'; +import borderImage from './features/border-image.js'; +import borderRadius from './features/border-radius.js'; +import calc from './features/calc.js'; +import chUnit from './features/ch-unit.js'; +import cssAll from './features/css-all.js'; +import cssAnimation from './features/css-animation.js'; +import cssAnyLink from './features/css-any-link.js'; +import cssAppearance from './features/css-appearance.js'; +import cssAtCounterStyle from './features/css-at-counter-style.js'; +import cssAutofill from './features/css-autofill.js'; +import cssBackdropFilter from './features/css-backdrop-filter.js'; +import cssBackgroundOffsets from './features/css-background-offsets.js'; +import cssBackgroundblendmode from './features/css-backgroundblendmode.js'; +import cssBoxdecorationbreak from './features/css-boxdecorationbreak.js'; +import cssBoxshadow from './features/css-boxshadow.js'; +import cssCanvas from './features/css-canvas.js'; +import cssCaretColor from './features/css-caret-color.js'; +import cssCascadeLayers from './features/css-cascade-layers.js'; +import cssCaseInsensitive from './features/css-case-insensitive.js'; +import cssClipPath from './features/css-clip-path.js'; +import cssColorAdjust from './features/css-color-adjust.js'; +import cssColorFunction from './features/css-color-function.js'; +import cssConicGradients from './features/css-conic-gradients.js'; +import cssContainerQueries from './features/css-container-queries.js'; +import cssContainerQueriesStyle from './features/css-container-queries-style.js'; +import cssContainerQueryUnits from './features/css-container-query-units.js'; +import cssContainment from './features/css-containment.js'; +import cssContentVisibility from './features/css-content-visibility.js'; +import cssCounters from './features/css-counters.js'; +import cssCrispEdges from './features/css-crisp-edges.js'; +import cssCrossFade from './features/css-cross-fade.js'; +import cssDefaultPseudo from './features/css-default-pseudo.js'; +import cssDescendantGtgt from './features/css-descendant-gtgt.js'; +import cssDeviceadaptation from './features/css-deviceadaptation.js'; +import cssDirPseudo from './features/css-dir-pseudo.js'; +import cssDisplayContents from './features/css-display-contents.js'; +import cssElementFunction from './features/css-element-function.js'; +import cssEnvFunction from './features/css-env-function.js'; +import cssExclusions from './features/css-exclusions.js'; +import cssFeaturequeries from './features/css-featurequeries.js'; +import cssFileSelectorButton from './features/css-file-selector-button.js'; +import cssFilterFunction from './features/css-filter-function.js'; +import cssFilters from './features/css-filters.js'; +import cssFirstLetter from './features/css-first-letter.js'; +import cssFirstLine from './features/css-first-line.js'; +import cssFixed from './features/css-fixed.js'; +import cssFocusVisible from './features/css-focus-visible.js'; +import cssFocusWithin from './features/css-focus-within.js'; +import cssFontPalette from './features/css-font-palette.js'; +import cssFontRenderingControls from './features/css-font-rendering-controls.js'; +import cssFontStretch from './features/css-font-stretch.js'; +import cssGencontent from './features/css-gencontent.js'; +import cssGradients from './features/css-gradients.js'; +import cssGrid from './features/css-grid.js'; +import cssGridAnimation from './features/css-grid-animation.js'; +import cssHangingPunctuation from './features/css-hanging-punctuation.js'; +import cssHas from './features/css-has.js'; +import cssHyphens from './features/css-hyphens.js'; +import cssImageOrientation from './features/css-image-orientation.js'; +import cssImageSet from './features/css-image-set.js'; +import cssInOutOfRange from './features/css-in-out-of-range.js'; +import cssIndeterminatePseudo from './features/css-indeterminate-pseudo.js'; +import cssInitialLetter from './features/css-initial-letter.js'; +import cssInitialValue from './features/css-initial-value.js'; +import cssLchLab from './features/css-lch-lab.js'; +import cssLetterSpacing from './features/css-letter-spacing.js'; +import cssLineClamp from './features/css-line-clamp.js'; +import cssLogicalProps from './features/css-logical-props.js'; +import cssMarkerPseudo from './features/css-marker-pseudo.js'; +import cssMasks from './features/css-masks.js'; +import cssMatchesPseudo from './features/css-matches-pseudo.js'; +import cssMathFunctions from './features/css-math-functions.js'; +import cssMediaInteraction from './features/css-media-interaction.js'; +import cssMediaRangeSyntax from './features/css-media-range-syntax.js'; +import cssMediaResolution from './features/css-media-resolution.js'; +import cssMediaScripting from './features/css-media-scripting.js'; +import cssMediaqueries from './features/css-mediaqueries.js'; +import cssMixblendmode from './features/css-mixblendmode.js'; +import cssMotionPaths from './features/css-motion-paths.js'; +import cssNamespaces from './features/css-namespaces.js'; +import cssNesting from './features/css-nesting.js'; +import cssNotSelList from './features/css-not-sel-list.js'; +import cssNthChildOf from './features/css-nth-child-of.js'; +import cssOpacity from './features/css-opacity.js'; +import cssOptionalPseudo from './features/css-optional-pseudo.js'; +import cssOverflow from './features/css-overflow.js'; +import cssOverflowAnchor from './features/css-overflow-anchor.js'; +import cssOverflowOverlay from './features/css-overflow-overlay.js'; +import cssOverscrollBehavior from './features/css-overscroll-behavior.js'; +import cssPageBreak from './features/css-page-break.js'; +import cssPagedMedia from './features/css-paged-media.js'; +import cssPaintApi from './features/css-paint-api.js'; +import cssPlaceholder from './features/css-placeholder.js'; +import cssPlaceholderShown from './features/css-placeholder-shown.js'; +import cssPrintColorAdjust from './features/css-print-color-adjust.js'; +import cssReadOnlyWrite from './features/css-read-only-write.js'; +import cssRebeccapurple from './features/css-rebeccapurple.js'; +import cssReflections from './features/css-reflections.js'; +import cssRegions from './features/css-regions.js'; +import cssRelativeColors from './features/css-relative-colors.js'; +import cssRepeatingGradients from './features/css-repeating-gradients.js'; +import cssResize from './features/css-resize.js'; +import cssRevertValue from './features/css-revert-value.js'; +import cssRrggbbaa from './features/css-rrggbbaa.js'; +import cssScrollBehavior from './features/css-scroll-behavior.js'; +import cssScrollTimeline from './features/css-scroll-timeline.js'; +import cssScrollbar from './features/css-scrollbar.js'; +import cssSel2 from './features/css-sel2.js'; +import cssSel3 from './features/css-sel3.js'; +import cssSelection from './features/css-selection.js'; +import cssShapes from './features/css-shapes.js'; +import cssSnappoints from './features/css-snappoints.js'; +import cssSticky from './features/css-sticky.js'; +import cssSubgrid from './features/css-subgrid.js'; +import cssSupportsApi from './features/css-supports-api.js'; +import cssTable from './features/css-table.js'; +import cssTextAlignLast from './features/css-text-align-last.js'; +import cssTextBoxTrim from './features/css-text-box-trim.js'; +import cssTextIndent from './features/css-text-indent.js'; +import cssTextJustify from './features/css-text-justify.js'; +import cssTextOrientation from './features/css-text-orientation.js'; +import cssTextSpacing from './features/css-text-spacing.js'; +import cssTextshadow from './features/css-textshadow.js'; +import cssTouchAction from './features/css-touch-action.js'; +import cssTransitions from './features/css-transitions.js'; +import cssUnicodeBidi from './features/css-unicode-bidi.js'; +import cssUnsetValue from './features/css-unset-value.js'; +import cssVariables from './features/css-variables.js'; +import cssWhenElse from './features/css-when-else.js'; +import cssWidowsOrphans from './features/css-widows-orphans.js'; +import cssWidthStretch from './features/css-width-stretch.js'; +import cssWritingMode from './features/css-writing-mode.js'; +import cssZoom from './features/css-zoom.js'; +import css3Attr from './features/css3-attr.js'; +import css3Boxsizing from './features/css3-boxsizing.js'; +import css3Colors from './features/css3-colors.js'; +import css3Cursors from './features/css3-cursors.js'; +import css3CursorsGrab from './features/css3-cursors-grab.js'; +import css3CursorsNewer from './features/css3-cursors-newer.js'; +import css3Tabsize from './features/css3-tabsize.js'; +import currentcolor from './features/currentcolor.js'; +import devicepixelratio from './features/devicepixelratio.js'; +import extendedSystemFonts from './features/extended-system-fonts.js'; +import flexbox from './features/flexbox.js'; +import flexboxGap from './features/flexbox-gap.js'; +import flowRoot from './features/flow-root.js'; +import fontFamilySystemUi from './features/font-family-system-ui.js'; +import fontFeature from './features/font-feature.js'; +import fontKerning from './features/font-kerning.js'; +import fontLoading from './features/font-loading.js'; +import fontSizeAdjust from './features/font-size-adjust.js'; +import fontSmooth from './features/font-smooth.js'; +import fontUnicodeRange from './features/font-unicode-range.js'; +import fontVariantAlternates from './features/font-variant-alternates.js'; +import fontVariantNumeric from './features/font-variant-numeric.js'; +import fontface from './features/fontface.js'; +import fullscreen from './features/fullscreen.js'; +import getcomputedstyle from './features/getcomputedstyle.js'; +import inlineBlock from './features/inline-block.js'; +import intrinsicWidth from './features/intrinsic-width.js'; +import justifyContentSpaceEvenly from './features/justify-content-space-evenly.js'; +import kerningPairsLigatures from './features/kerning-pairs-ligatures.js'; +import mdnCssUnicodeBidiIsolate from './features/mdn-css-unicode-bidi-isolate.js'; +import mdnCssUnicodeBidiIsolateOverride from './features/mdn-css-unicode-bidi-isolate-override.js'; +import mdnCssUnicodeBidiPlaintext from './features/mdn-css-unicode-bidi-plaintext.js'; +import mdnTextDecorationColor from './features/mdn-text-decoration-color.js'; +import mdnTextDecorationLine from './features/mdn-text-decoration-line.js'; +import mdnTextDecorationShorthand from './features/mdn-text-decoration-shorthand.js'; +import mdnTextDecorationStyle from './features/mdn-text-decoration-style.js'; +import minmaxwh from './features/minmaxwh.js'; +import multibackgrounds from './features/multibackgrounds.js'; +import multicolumn from './features/multicolumn.js'; +import objectFit from './features/object-fit.js'; +import outline from './features/outline.js'; +import pointer from './features/pointer.js'; +import pointerEvents from './features/pointer-events.js'; +import prefersColorScheme from './features/prefers-color-scheme.js'; +import prefersReducedMotion from './features/prefers-reduced-motion.js'; +import rem from './features/rem.js'; +import runIn from './features/run-in.js'; +import styleScoped from './features/style-scoped.js'; +import svgCss from './features/svg-css.js'; +import textDecoration from './features/text-decoration.js'; +import textEmphasis from './features/text-emphasis.js'; +import textOverflow from './features/text-overflow.js'; +import textSizeAdjust from './features/text-size-adjust.js'; +import textStroke from './features/text-stroke.js'; +import transforms2d from './features/transforms2d.js'; +import transforms3d from './features/transforms3d.js'; +import ttf from './features/ttf.js'; +import userSelectNone from './features/user-select-none.js'; +import variableFonts from './features/variable-fonts.js'; +import viewportUnitVariants from './features/viewport-unit-variants.js'; +import viewportUnits from './features/viewport-units.js'; +import webkitUserDrag from './features/webkit-user-drag.js'; +import willChange from './features/will-change.js'; +import wordBreak from './features/word-break.js'; +import wordwrap from './features/wordwrap.js'; + +/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */ + +/** @typedef {((rule:import('postcss').ChildNode) => boolean)} RuleCheck */ + +/** @typedef {Record<string, FeatureCheck|FeatureCheck[]|boolean> | RuleCheck | RuleCheck[]} Feature */ + +/** @enum {Feature} */ +const FEATURES = { + 'alternate-stylesheet': alternateStylesheet, + 'background-attachment': backgroundAttachment, + 'background-clip-text': backgroundClipText, + 'background-img-opts': backgroundImgOpts, + 'background-position-x-y': backgroundPositionXY, + 'background-repeat-round-space': backgroundRepeatRoundSpace, + 'border-image': borderImage, + 'border-radius': borderRadius, + 'calc': calc, + 'ch-unit': chUnit, + 'css-all': cssAll, + 'css-animation': cssAnimation, + 'css-any-link': cssAnyLink, + 'css-appearance': cssAppearance, + 'css-at-counter-style': cssAtCounterStyle, + 'css-autofill': cssAutofill, + 'css-backdrop-filter': cssBackdropFilter, + 'css-background-offsets': cssBackgroundOffsets, + 'css-backgroundblendmode': cssBackgroundblendmode, + 'css-boxdecorationbreak': cssBoxdecorationbreak, + 'css-boxshadow': cssBoxshadow, + 'css-canvas': cssCanvas, + 'css-caret-color': cssCaretColor, + 'css-cascade-layers': cssCascadeLayers, + 'css-case-insensitive': cssCaseInsensitive, + 'css-clip-path': cssClipPath, + 'css-color-adjust': cssColorAdjust, + 'css-color-function': cssColorFunction, + 'css-conic-gradients': cssConicGradients, + 'css-container-queries': cssContainerQueries, + 'css-container-queries-style': cssContainerQueriesStyle, + 'css-container-query-units': cssContainerQueryUnits, + 'css-containment': cssContainment, + 'css-content-visibility': cssContentVisibility, + 'css-counters': cssCounters, + 'css-crisp-edges': cssCrispEdges, + 'css-cross-fade': cssCrossFade, + 'css-default-pseudo': cssDefaultPseudo, + 'css-descendant-gtgt': cssDescendantGtgt, + 'css-deviceadaptation': cssDeviceadaptation, + 'css-dir-pseudo': cssDirPseudo, + 'css-display-contents': cssDisplayContents, + 'css-element-function': cssElementFunction, + 'css-env-function': cssEnvFunction, + 'css-exclusions': cssExclusions, + 'css-featurequeries': cssFeaturequeries, + 'css-file-selector-button': cssFileSelectorButton, + 'css-filter-function': cssFilterFunction, + 'css-filters': cssFilters, + 'css-first-letter': cssFirstLetter, + 'css-first-line': cssFirstLine, + 'css-fixed': cssFixed, + 'css-focus-visible': cssFocusVisible, + 'css-focus-within': cssFocusWithin, + 'css-font-palette': cssFontPalette, + 'css-font-rendering-controls': cssFontRenderingControls, + 'css-font-stretch': cssFontStretch, + 'css-gencontent': cssGencontent, + 'css-gradients': cssGradients, + 'css-grid': cssGrid, + 'css-grid-animation': cssGridAnimation, + 'css-hanging-punctuation': cssHangingPunctuation, + 'css-has': cssHas, + 'css-hyphens': cssHyphens, + 'css-image-orientation': cssImageOrientation, + 'css-image-set': cssImageSet, + 'css-in-out-of-range': cssInOutOfRange, + 'css-indeterminate-pseudo': cssIndeterminatePseudo, + 'css-initial-letter': cssInitialLetter, + 'css-initial-value': cssInitialValue, + 'css-lch-lab': cssLchLab, + 'css-letter-spacing': cssLetterSpacing, + 'css-line-clamp': cssLineClamp, + 'css-logical-props': cssLogicalProps, + 'css-marker-pseudo': cssMarkerPseudo, + 'css-masks': cssMasks, + 'css-matches-pseudo': cssMatchesPseudo, + 'css-math-functions': cssMathFunctions, + 'css-media-interaction': cssMediaInteraction, + 'css-media-range-syntax': cssMediaRangeSyntax, + 'css-media-resolution': cssMediaResolution, + 'css-media-scripting': cssMediaScripting, + 'css-mediaqueries': cssMediaqueries, + 'css-mixblendmode': cssMixblendmode, + 'css-motion-paths': cssMotionPaths, + 'css-namespaces': cssNamespaces, + 'css-nesting': cssNesting, + 'css-not-sel-list': cssNotSelList, + 'css-nth-child-of': cssNthChildOf, + 'css-opacity': cssOpacity, + 'css-optional-pseudo': cssOptionalPseudo, + 'css-overflow': cssOverflow, + 'css-overflow-anchor': cssOverflowAnchor, + 'css-overflow-overlay': cssOverflowOverlay, + 'css-overscroll-behavior': cssOverscrollBehavior, + 'css-page-break': cssPageBreak, + 'css-paged-media': cssPagedMedia, + 'css-paint-api': cssPaintApi, + 'css-placeholder': cssPlaceholder, + 'css-placeholder-shown': cssPlaceholderShown, + 'css-print-color-adjust': cssPrintColorAdjust, + 'css-read-only-write': cssReadOnlyWrite, + 'css-rebeccapurple': cssRebeccapurple, + 'css-reflections': cssReflections, + 'css-regions': cssRegions, + 'css-relative-colors': cssRelativeColors, + 'css-repeating-gradients': cssRepeatingGradients, + 'css-resize': cssResize, + 'css-revert-value': cssRevertValue, + 'css-rrggbbaa': cssRrggbbaa, + 'css-scroll-behavior': cssScrollBehavior, + 'css-scroll-timeline': cssScrollTimeline, + 'css-scrollbar': cssScrollbar, + 'css-sel2': cssSel2, + 'css-sel3': cssSel3, + 'css-selection': cssSelection, + 'css-shapes': cssShapes, + 'css-snappoints': cssSnappoints, + 'css-sticky': cssSticky, + 'css-subgrid': cssSubgrid, + 'css-supports-api': cssSupportsApi, + 'css-table': cssTable, + 'css-text-align-last': cssTextAlignLast, + 'css-text-box-trim': cssTextBoxTrim, + 'css-text-indent': cssTextIndent, + 'css-text-justify': cssTextJustify, + 'css-text-orientation': cssTextOrientation, + 'css-text-spacing': cssTextSpacing, + 'css-textshadow': cssTextshadow, + 'css-touch-action': cssTouchAction, + 'css-transitions': cssTransitions, + 'css-unicode-bidi': cssUnicodeBidi, + 'css-unset-value': cssUnsetValue, + 'css-variables': cssVariables, + 'css-when-else': cssWhenElse, + 'css-widows-orphans': cssWidowsOrphans, + 'css-width-stretch': cssWidthStretch, + 'css-writing-mode': cssWritingMode, + 'css-zoom': cssZoom, + 'css3-attr': css3Attr, + 'css3-boxsizing': css3Boxsizing, + 'css3-colors': css3Colors, + 'css3-cursors': css3Cursors, + 'css3-cursors-grab': css3CursorsGrab, + 'css3-cursors-newer': css3CursorsNewer, + 'css3-tabsize': css3Tabsize, + 'currentcolor': currentcolor, + 'devicepixelratio': devicepixelratio, + 'extended-system-fonts': extendedSystemFonts, + 'flexbox': flexbox, + 'flexbox-gap': flexboxGap, + 'flow-root': flowRoot, + 'font-family-system-ui': fontFamilySystemUi, + 'font-feature': fontFeature, + 'font-kerning': fontKerning, + 'font-loading': fontLoading, + 'font-size-adjust': fontSizeAdjust, + 'font-smooth': fontSmooth, + 'font-unicode-range': fontUnicodeRange, + 'font-variant-alternates': fontVariantAlternates, + 'font-variant-numeric': fontVariantNumeric, + 'fontface': fontface, + 'fullscreen': fullscreen, + 'getcomputedstyle': getcomputedstyle, + 'inline-block': inlineBlock, + 'intrinsic-width': intrinsicWidth, + 'justify-content-space-evenly': justifyContentSpaceEvenly, + 'kerning-pairs-ligatures': kerningPairsLigatures, + 'mdn-css-unicode-bidi-isolate': mdnCssUnicodeBidiIsolate, + 'mdn-css-unicode-bidi-isolate-override': mdnCssUnicodeBidiIsolateOverride, + 'mdn-css-unicode-bidi-plaintext': mdnCssUnicodeBidiPlaintext, + 'mdn-text-decoration-color': mdnTextDecorationColor, + 'mdn-text-decoration-line': mdnTextDecorationLine, + 'mdn-text-decoration-shorthand': mdnTextDecorationShorthand, + 'mdn-text-decoration-style': mdnTextDecorationStyle, + 'minmaxwh': minmaxwh, + 'multibackgrounds': multibackgrounds, + 'multicolumn': multicolumn, + 'object-fit': objectFit, + 'outline': outline, + 'pointer': pointer, + 'pointer-events': pointerEvents, + 'prefers-color-scheme': prefersColorScheme, + 'prefers-reduced-motion': prefersReducedMotion, + 'rem': rem, + 'run-in': runIn, + 'style-scoped': styleScoped, + 'svg-css': svgCss, + 'text-decoration': textDecoration, + 'text-emphasis': textEmphasis, + 'text-overflow': textOverflow, + 'text-size-adjust': textSizeAdjust, + 'text-stroke': textStroke, + 'transforms2d': transforms2d, + 'transforms3d': transforms3d, + 'ttf': ttf, + 'user-select-none': userSelectNone, + 'variable-fonts': variableFonts, + 'viewport-unit-variants': viewportUnitVariants, + 'viewport-units': viewportUnits, + 'webkit-user-drag': webkitUserDrag, + 'will-change': willChange, + 'word-break': wordBreak, + 'wordwrap': wordwrap, +}; + +/** @typedef {keyof typeof FEATURES} FeatureKeys */ + +export default /** @type {{[K in FeatureKeys]: Feature}} */ (FEATURES); diff --git a/node_modules/doiuse/data/features/alternate-stylesheet.js b/node_modules/doiuse/data/features/alternate-stylesheet.js new file mode 100644 index 00000000..f127e84d --- /dev/null +++ b/node_modules/doiuse/data/features/alternate-stylesheet.js @@ -0,0 +1,12 @@ +/** + * No description available. + * + * See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Alternate+stylesheet + */ + +// This feature is only in HTML, so we don't lint it + +/** + * @type {import('../features').Feature} + */ +export default {}; diff --git a/node_modules/doiuse/data/features/background-attachment.js b/node_modules/doiuse/data/features/background-attachment.js new file mode 100644 index 00000000..cd493ddb --- /dev/null +++ b/node_modules/doiuse/data/features/background-attachment.js @@ -0,0 +1,15 @@ +/** + * Method of defining how a background image is attached to a scrollable element. Values include `scroll` (default), `fixed` and `local`. + * + * See: https://caniuse.com/background-attachment + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'background-attachment': [ + 'fixed', + 'local', + ], +}; diff --git a/node_modules/doiuse/data/features/background-clip-text.js b/node_modules/doiuse/data/features/background-clip-text.js new file mode 100644 index 00000000..c02c5974 --- /dev/null +++ b/node_modules/doiuse/data/features/background-clip-text.js @@ -0,0 +1,13 @@ +/** + * Non-standard method of clipping a background image to the foreground text. + * + * See: https://caniuse.com/background-clip-text + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'background-clip': 'text', + '-webkit-background-clip': 'text', +}; diff --git a/node_modules/doiuse/data/features/background-img-opts.js b/node_modules/doiuse/data/features/background-img-opts.js new file mode 100644 index 00000000..32ba9590 --- /dev/null +++ b/node_modules/doiuse/data/features/background-img-opts.js @@ -0,0 +1,5 @@ +export default { + 'background-clip': true, + 'background-origin': true, + 'background-size': true, +}; diff --git a/node_modules/doiuse/data/features/background-position-x-y.js b/node_modules/doiuse/data/features/background-position-x-y.js new file mode 100644 index 00000000..9239d7d0 --- /dev/null +++ b/node_modules/doiuse/data/features/background-position-x-y.js @@ -0,0 +1,4 @@ +export default { + 'background-position-x': true, + 'background-position-y': true, +}; diff --git a/node_modules/doiuse/data/features/background-repeat-round-space.js b/node_modules/doiuse/data/features/background-repeat-round-space.js new file mode 100644 index 00000000..0a8fb685 --- /dev/null +++ b/node_modules/doiuse/data/features/background-repeat-round-space.js @@ -0,0 +1,12 @@ +/** + * Allows CSS background images to be repeated without clipping. + * + * See: https://caniuse.com/background-repeat-round-space + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'background-repeat': ['round', 'space'], +}; diff --git a/node_modules/doiuse/data/features/border-image.js b/node_modules/doiuse/data/features/border-image.js new file mode 100644 index 00000000..911a04ba --- /dev/null +++ b/node_modules/doiuse/data/features/border-image.js @@ -0,0 +1,9 @@ +export default { + 'border-image': true, + 'border-image-outset': true, + 'border-image-repeat': true, + 'border-image-slice': true, + 'border-image-source': true, + 'border-image-width': true, + +}; diff --git a/node_modules/doiuse/data/features/border-radius.js b/node_modules/doiuse/data/features/border-radius.js new file mode 100644 index 00000000..ed207b05 --- /dev/null +++ b/node_modules/doiuse/data/features/border-radius.js @@ -0,0 +1,7 @@ +export default { + 'border-radius': true, + 'border-top-left-radius': true, + 'border-top-right-radius': true, + 'border-bottom-right-radius': true, + 'border-bottom-left-radius': true, +}; diff --git a/node_modules/doiuse/data/features/calc.js b/node_modules/doiuse/data/features/calc.js new file mode 100644 index 00000000..f20331d6 --- /dev/null +++ b/node_modules/doiuse/data/features/calc.js @@ -0,0 +1,3 @@ +export default { + '': 'calc(', +}; diff --git a/node_modules/doiuse/data/features/ch-unit.js b/node_modules/doiuse/data/features/ch-unit.js new file mode 100644 index 00000000..57da8096 --- /dev/null +++ b/node_modules/doiuse/data/features/ch-unit.js @@ -0,0 +1,8 @@ +import { checkCSSLengthUnits } from '../../utils/util.js'; + +/** + * Unit representing the width of the character "0" in the current font, of particular use in combination with monospace fonts. + * @see https://caniuse.com/ch-unit + * @type {import('../features').Feature} + */ +export default checkCSSLengthUnits('ch'); diff --git a/node_modules/doiuse/data/features/css-all.js b/node_modules/doiuse/data/features/css-all.js new file mode 100644 index 00000000..8112d162 --- /dev/null +++ b/node_modules/doiuse/data/features/css-all.js @@ -0,0 +1,3 @@ +export default { + 'all': true, +}; diff --git a/node_modules/doiuse/data/features/css-animation.js b/node_modules/doiuse/data/features/css-animation.js new file mode 100644 index 00000000..7c2fb88f --- /dev/null +++ b/node_modules/doiuse/data/features/css-animation.js @@ -0,0 +1,14 @@ +export default { + 'animation': true, + 'animation-name': true, + 'animation-duration': true, + 'animation-timing-function': true, + 'animation-iteration-count': true, + 'animation-direction': true, + 'animation-play-state': true, + 'animation-delay': true, + 'animation-fill-mode': true, +}; + +// @keyframes isn't checked for, but if you try to use it, +// you'll still get a warning anyway because of the 'animation' property diff --git a/node_modules/doiuse/data/features/css-any-link.js b/node_modules/doiuse/data/features/css-any-link.js new file mode 100644 index 00000000..990a591d --- /dev/null +++ b/node_modules/doiuse/data/features/css-any-link.js @@ -0,0 +1,3 @@ +import { checkSelector } from '../../utils/util.js'; + +export default checkSelector([':any-link', ':-webkit-any-link']); diff --git a/node_modules/doiuse/data/features/css-appearance.js b/node_modules/doiuse/data/features/css-appearance.js new file mode 100644 index 00000000..f316c2d4 --- /dev/null +++ b/node_modules/doiuse/data/features/css-appearance.js @@ -0,0 +1,5 @@ +export default { + 'appearance': true, + '-webkit-appearance': true, + '-moz-appearance': true, +}; diff --git a/node_modules/doiuse/data/features/css-at-counter-style.js b/node_modules/doiuse/data/features/css-at-counter-style.js new file mode 100644 index 00000000..d944cc62 --- /dev/null +++ b/node_modules/doiuse/data/features/css-at-counter-style.js @@ -0,0 +1,3 @@ +import { checkAtRule } from '../../utils/util.js'; + +export default checkAtRule('counter-style'); diff --git a/node_modules/doiuse/data/features/css-autofill.js b/node_modules/doiuse/data/features/css-autofill.js new file mode 100644 index 00000000..52850482 --- /dev/null +++ b/node_modules/doiuse/data/features/css-autofill.js @@ -0,0 +1,3 @@ +import { checkSelector } from '../../utils/util.js'; + +export default checkSelector([':autofill', ':-webkit-autofill']); diff --git a/node_modules/doiuse/data/features/css-backdrop-filter.js b/node_modules/doiuse/data/features/css-backdrop-filter.js new file mode 100644 index 00000000..ac92860c --- /dev/null +++ b/node_modules/doiuse/data/features/css-backdrop-filter.js @@ -0,0 +1,3 @@ +export default { + 'backdrop-filter': true, +}; diff --git a/node_modules/doiuse/data/features/css-background-offsets.js b/node_modules/doiuse/data/features/css-background-offsets.js new file mode 100644 index 00000000..0fb021d4 --- /dev/null +++ b/node_modules/doiuse/data/features/css-background-offsets.js @@ -0,0 +1,11 @@ +import { list } from 'postcss'; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +export default (rule) => { + if (rule.type !== 'decl') return false; + if (rule.prop !== 'background-position') return false; + return list.space(rule.value).length > 2; +}; diff --git a/node_modules/doiuse/data/features/css-backgroundblendmode.js b/node_modules/doiuse/data/features/css-backgroundblendmode.js new file mode 100644 index 00000000..f2e5181e --- /dev/null +++ b/node_modules/doiuse/data/features/css-backgroundblendmode.js @@ -0,0 +1,3 @@ +export default { + 'background-blend-mode': true, +}; diff --git a/node_modules/doiuse/data/features/css-boxdecorationbreak.js b/node_modules/doiuse/data/features/css-boxdecorationbreak.js new file mode 100644 index 00000000..a68839a0 --- /dev/null +++ b/node_modules/doiuse/data/features/css-boxdecorationbreak.js @@ -0,0 +1,13 @@ +/** + * Controls whether the box's margins, borders, padding, and other decorations wrap the broken edges of the box fragments (when the box is split by a break (page/column/region/line). + * + * See: https://caniuse.com/css-boxdecorationbreak + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'box-decoration-break': true, + '-webkit-box-decoration-break': true, +}; diff --git a/node_modules/doiuse/data/features/css-boxshadow.js b/node_modules/doiuse/data/features/css-boxshadow.js new file mode 100644 index 00000000..ac91aba2 --- /dev/null +++ b/node_modules/doiuse/data/features/css-boxshadow.js @@ -0,0 +1,3 @@ +export default { + 'box-shadow': true, +}; diff --git a/node_modules/doiuse/data/features/css-canvas.js b/node_modules/doiuse/data/features/css-canvas.js new file mode 100644 index 00000000..92b858b8 --- /dev/null +++ b/node_modules/doiuse/data/features/css-canvas.js @@ -0,0 +1,9 @@ +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +export default (rule) => { + if (rule.type !== 'decl') return false; + if (!rule.prop.startsWith('background')) return false; + return rule.value.startsWith('-webkit-canvas'); +}; diff --git a/node_modules/doiuse/data/features/css-caret-color.js b/node_modules/doiuse/data/features/css-caret-color.js new file mode 100644 index 00000000..da95db5c --- /dev/null +++ b/node_modules/doiuse/data/features/css-caret-color.js @@ -0,0 +1,12 @@ +/** + * The `caret-color` property allows the color to be set of the caret (blinking text insertion pointer) in an editable text area. + * + * See: https://caniuse.com/css-caret-color + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'caret-color': true, +}; diff --git a/node_modules/doiuse/data/features/css-cascade-layers.js b/node_modules/doiuse/data/features/css-cascade-layers.js new file mode 100644 index 00000000..6edd5dbb --- /dev/null +++ b/node_modules/doiuse/data/features/css-cascade-layers.js @@ -0,0 +1,12 @@ +/** + * The `@layer` at-rule allows authors to explicitly layer their styles in the cascade, before specificity and order of appearance are considered. + * + * See: https://caniuse.com/css-cascade-layers + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('layer'); diff --git a/node_modules/doiuse/data/features/css-case-insensitive.js b/node_modules/doiuse/data/features/css-case-insensitive.js new file mode 100644 index 00000000..72c36107 --- /dev/null +++ b/node_modules/doiuse/data/features/css-case-insensitive.js @@ -0,0 +1,14 @@ +/** + * Including an `i` before the `]` in a CSS attribute selector causes the attribute value to be matched in an ASCII-case-insensitive manner. For example, `[b="xyz" i]` would match both `<a b="xyz">` and `<a b="XYZ">`. + * + * See: https://caniuse.com/css-case-insensitive + */ + +/** + * @type {import('../features').Feature} + */ +export default (rule) => { + if (rule.type !== 'rule') { return false; } + if (/\[.*i]/.test(rule.selector)) { return true; } + return false; +}; diff --git a/node_modules/doiuse/data/features/css-clip-path.js b/node_modules/doiuse/data/features/css-clip-path.js new file mode 100644 index 00000000..d1322c5e --- /dev/null +++ b/node_modules/doiuse/data/features/css-clip-path.js @@ -0,0 +1,3 @@ +export default { + 'clip-path': true, +}; diff --git a/node_modules/doiuse/data/features/css-color-adjust.js b/node_modules/doiuse/data/features/css-color-adjust.js new file mode 100644 index 00000000..1feb161f --- /dev/null +++ b/node_modules/doiuse/data/features/css-color-adjust.js @@ -0,0 +1,13 @@ +/** + * The `print-color-adjust` (or `-webkit-print-color-adjust` as prefixed in WebKit/Blink browsers) property is a CSS extension that can be used to force printing of background colors and images. + * + * See: https://caniuse.com/css-color-adjust + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'print-color-adjust': true, + '-webkit-print-color-adjust': true, +}; diff --git a/node_modules/doiuse/data/features/css-color-function.js b/node_modules/doiuse/data/features/css-color-function.js new file mode 100644 index 00000000..0cd1dc34 --- /dev/null +++ b/node_modules/doiuse/data/features/css-color-function.js @@ -0,0 +1,12 @@ +/** + * The CSS `color()` function allows the browser to display colors in any color space, such as the P3 color space which can display colors outside of the default sRGB color space. + * + * See: https://caniuse.com/css-color-function + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': 'color(', +}; diff --git a/node_modules/doiuse/data/features/css-conic-gradients.js b/node_modules/doiuse/data/features/css-conic-gradients.js new file mode 100644 index 00000000..60494e7b --- /dev/null +++ b/node_modules/doiuse/data/features/css-conic-gradients.js @@ -0,0 +1,12 @@ +const REGEX = /(^|[^-])(repeating-)?conic-gradient/; + +export default { + 'background': REGEX, + 'background-image': REGEX, + 'border-image': REGEX, + 'border-image-source': REGEX, + 'content': REGEX, + 'cursor': REGEX, + 'list-style': REGEX, + 'list-style-image': REGEX, +}; diff --git a/node_modules/doiuse/data/features/css-container-queries-style.js b/node_modules/doiuse/data/features/css-container-queries-style.js new file mode 100644 index 00000000..d9886295 --- /dev/null +++ b/node_modules/doiuse/data/features/css-container-queries-style.js @@ -0,0 +1,3 @@ +import { checkAtRule } from '../../utils/util.js'; + +export default checkAtRule('container', 'style('); diff --git a/node_modules/doiuse/data/features/css-container-queries.js b/node_modules/doiuse/data/features/css-container-queries.js new file mode 100644 index 00000000..1b013096 --- /dev/null +++ b/node_modules/doiuse/data/features/css-container-queries.js @@ -0,0 +1,12 @@ +/** + * Size queries in Container Queries provide a way to query the size of a container, and conditionally apply CSS to the content of that container. + * + * See: https://caniuse.com/css-container-queries + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('container'); diff --git a/node_modules/doiuse/data/features/css-container-query-units.js b/node_modules/doiuse/data/features/css-container-query-units.js new file mode 100644 index 00000000..c6212b4f --- /dev/null +++ b/node_modules/doiuse/data/features/css-container-query-units.js @@ -0,0 +1,10 @@ +import { checkCSSLengthUnits } from '../../utils/util.js'; + +export default checkCSSLengthUnits( + 'cqw', + 'cqh', + 'cqi', + 'cqb', + 'cqmin', + 'cqmax', +); diff --git a/node_modules/doiuse/data/features/css-containment.js b/node_modules/doiuse/data/features/css-containment.js new file mode 100644 index 00000000..c9492d32 --- /dev/null +++ b/node_modules/doiuse/data/features/css-containment.js @@ -0,0 +1,12 @@ +/** + * The CSS `contain` property lets developers limit the scope of the browser's styles, layout and paint work for faster and more efficient rendering. + * + * See: https://caniuse.com/css-containment + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'contain': true, +}; diff --git a/node_modules/doiuse/data/features/css-content-visibility.js b/node_modules/doiuse/data/features/css-content-visibility.js new file mode 100644 index 00000000..2adef2da --- /dev/null +++ b/node_modules/doiuse/data/features/css-content-visibility.js @@ -0,0 +1,12 @@ +/** + * Provides control over when elements are rendered, so rendering can be skipped for elements not yet in the user's viewport. + * + * See: https://caniuse.com/css-content-visibility + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'content-visibility': true, +}; diff --git a/node_modules/doiuse/data/features/css-counters.js b/node_modules/doiuse/data/features/css-counters.js new file mode 100644 index 00000000..56b824e2 --- /dev/null +++ b/node_modules/doiuse/data/features/css-counters.js @@ -0,0 +1,5 @@ +export default { + 'counter-reset': true, + 'counter-increment': true, + '': 'counter(', +}; diff --git a/node_modules/doiuse/data/features/css-crisp-edges.js b/node_modules/doiuse/data/features/css-crisp-edges.js new file mode 100644 index 00000000..31690145 --- /dev/null +++ b/node_modules/doiuse/data/features/css-crisp-edges.js @@ -0,0 +1,12 @@ +/** + * Scales images with an algorithm that preserves edges and contrast, without smoothing colors or introducing blur. This is intended for images such as pixel art. Official values that accomplish this for the `image-rendering` property are `crisp-edges` and `pixelated`. + * + * See: https://caniuse.com/css-crisp-edges + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'image-rendering': ['crisp-edges', 'pixelated'], +}; diff --git a/node_modules/doiuse/data/features/css-cross-fade.js b/node_modules/doiuse/data/features/css-cross-fade.js new file mode 100644 index 00000000..bf32aee7 --- /dev/null +++ b/node_modules/doiuse/data/features/css-cross-fade.js @@ -0,0 +1,15 @@ +/** + * Image function to create a "crossfade" between images. This allows one image to transition (fade) into another based on a percentage value. + * + * See: https://caniuse.com/css-cross-fade + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': [ + 'cross-fade(', + '-webkit-cross-fade(', + ], +}; diff --git a/node_modules/doiuse/data/features/css-default-pseudo.js b/node_modules/doiuse/data/features/css-default-pseudo.js new file mode 100644 index 00000000..e191fd88 --- /dev/null +++ b/node_modules/doiuse/data/features/css-default-pseudo.js @@ -0,0 +1,12 @@ +/** + * The `:default` pseudo-class matches checkboxes and radio buttons which are checked by default, `<option>`s with the `selected` attribute, and the default submit button (if any) of a form. + * + * See: https://caniuse.com/css-default-pseudo + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':default'); diff --git a/node_modules/doiuse/data/features/css-descendant-gtgt.js b/node_modules/doiuse/data/features/css-descendant-gtgt.js new file mode 100644 index 00000000..48371d35 --- /dev/null +++ b/node_modules/doiuse/data/features/css-descendant-gtgt.js @@ -0,0 +1,12 @@ +/** + * An explicit, non-whitespace spelling of the descendant combinator. `A >> B` is equivalent to `A B`. + * + * See: https://caniuse.com/css-descendant-gtgt + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector('>>'); diff --git a/node_modules/doiuse/data/features/css-deviceadaptation.js b/node_modules/doiuse/data/features/css-deviceadaptation.js new file mode 100644 index 00000000..ac3481ac --- /dev/null +++ b/node_modules/doiuse/data/features/css-deviceadaptation.js @@ -0,0 +1,12 @@ +/** + * Method of overriding the size of viewport in web page using the `@viewport` rule, replacing Apple's own popular `<meta>` viewport implementation. Includes the `extend-to-zoom` width value. + * + * See: https://caniuse.com/css-deviceadaptation + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('viewport'); diff --git a/node_modules/doiuse/data/features/css-dir-pseudo.js b/node_modules/doiuse/data/features/css-dir-pseudo.js new file mode 100644 index 00000000..0b16e8f8 --- /dev/null +++ b/node_modules/doiuse/data/features/css-dir-pseudo.js @@ -0,0 +1,12 @@ +/** + * Matches elements based on their directionality. `:dir(ltr)` matches elements which are Left-to-Right. `:dir(rtl)` matches elements which are Right-to-Left. + * + * See: https://caniuse.com/css-dir-pseudo + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':dir('); diff --git a/node_modules/doiuse/data/features/css-display-contents.js b/node_modules/doiuse/data/features/css-display-contents.js new file mode 100644 index 00000000..d6b002fd --- /dev/null +++ b/node_modules/doiuse/data/features/css-display-contents.js @@ -0,0 +1,12 @@ +/** + * `display: contents` causes an element's children to appear as if they were direct children of the element's parent, ignoring the element itself. This can be useful when a wrapper element should be ignored when using CSS grid or similar layout techniques. + * + * See: https://caniuse.com/css-display-contents + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'display': 'contents', +}; diff --git a/node_modules/doiuse/data/features/css-element-function.js b/node_modules/doiuse/data/features/css-element-function.js new file mode 100644 index 00000000..4d9171a0 --- /dev/null +++ b/node_modules/doiuse/data/features/css-element-function.js @@ -0,0 +1,12 @@ +/** + * This function renders a live image generated from an arbitrary HTML element + * + * See: https://caniuse.com/css-element-function + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': 'element(', +}; diff --git a/node_modules/doiuse/data/features/css-env-function.js b/node_modules/doiuse/data/features/css-env-function.js new file mode 100644 index 00000000..4b275b55 --- /dev/null +++ b/node_modules/doiuse/data/features/css-env-function.js @@ -0,0 +1,3 @@ +export default { + '': 'env(', +}; diff --git a/node_modules/doiuse/data/features/css-exclusions.js b/node_modules/doiuse/data/features/css-exclusions.js new file mode 100644 index 00000000..1e45ea6e --- /dev/null +++ b/node_modules/doiuse/data/features/css-exclusions.js @@ -0,0 +1,13 @@ +/** + * Exclusions defines how inline content flows around elements. It extends the content wrapping ability of floats to any block-level element. + * + * See: https://caniuse.com/css-exclusions + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'wrap-flow': true, + '-ms-wrap-flow': true, +}; diff --git a/node_modules/doiuse/data/features/css-featurequeries.js b/node_modules/doiuse/data/features/css-featurequeries.js new file mode 100644 index 00000000..ecd372f8 --- /dev/null +++ b/node_modules/doiuse/data/features/css-featurequeries.js @@ -0,0 +1,3 @@ +import { checkAtRule } from '../../utils/util.js'; + +export default checkAtRule(['supports']); diff --git a/node_modules/doiuse/data/features/css-file-selector-button.js b/node_modules/doiuse/data/features/css-file-selector-button.js new file mode 100644 index 00000000..bc8d7682 --- /dev/null +++ b/node_modules/doiuse/data/features/css-file-selector-button.js @@ -0,0 +1,12 @@ +/** + * No description available. + * + * See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=::file-selector-button+CSS+pseudo-element + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':file-selector-button'); diff --git a/node_modules/doiuse/data/features/css-filter-function.js b/node_modules/doiuse/data/features/css-filter-function.js new file mode 100644 index 00000000..d83f30f6 --- /dev/null +++ b/node_modules/doiuse/data/features/css-filter-function.js @@ -0,0 +1,12 @@ +/** + * This function filters a CSS input image with a set of filter functions (like blur, grayscale or hue) + * + * See: https://caniuse.com/css-filter-function + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': 'filter(', +}; diff --git a/node_modules/doiuse/data/features/css-filters.js b/node_modules/doiuse/data/features/css-filters.js new file mode 100644 index 00000000..f10dfe6c --- /dev/null +++ b/node_modules/doiuse/data/features/css-filters.js @@ -0,0 +1,3 @@ +export default { + 'filter': true, +}; diff --git a/node_modules/doiuse/data/features/css-first-letter.js b/node_modules/doiuse/data/features/css-first-letter.js new file mode 100644 index 00000000..efaf92f8 --- /dev/null +++ b/node_modules/doiuse/data/features/css-first-letter.js @@ -0,0 +1,12 @@ +/** + * CSS pseudo-element that allows styling only the first "letter" of text within an element. Useful for implementing initial caps or drop caps styling. + * + * See: https://caniuse.com/css-first-letter + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':first-letter'); diff --git a/node_modules/doiuse/data/features/css-first-line.js b/node_modules/doiuse/data/features/css-first-line.js new file mode 100644 index 00000000..4f6e5df7 --- /dev/null +++ b/node_modules/doiuse/data/features/css-first-line.js @@ -0,0 +1,12 @@ +/** + * Allows styling specifically for the first line of text using the `::first-line` pseudo-element. Note that only a limited set of properties can be applied. + * + * See: https://caniuse.com/css-first-line + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':first-line'); diff --git a/node_modules/doiuse/data/features/css-fixed.js b/node_modules/doiuse/data/features/css-fixed.js new file mode 100644 index 00000000..9075e504 --- /dev/null +++ b/node_modules/doiuse/data/features/css-fixed.js @@ -0,0 +1,3 @@ +export default { + 'position': 'fixed', +}; diff --git a/node_modules/doiuse/data/features/css-focus-visible.js b/node_modules/doiuse/data/features/css-focus-visible.js new file mode 100644 index 00000000..54d79eb6 --- /dev/null +++ b/node_modules/doiuse/data/features/css-focus-visible.js @@ -0,0 +1,12 @@ +/** + * The `:focus-visible` pseudo-class applies while an element matches the `:focus` pseudo-class, and the UA determines via heuristics that the focus should be specially indicated on the element (typically via a “focus ring”). + * + * See: https://caniuse.com/css-focus-visible + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':focus-visible'); diff --git a/node_modules/doiuse/data/features/css-focus-within.js b/node_modules/doiuse/data/features/css-focus-within.js new file mode 100644 index 00000000..f020462b --- /dev/null +++ b/node_modules/doiuse/data/features/css-focus-within.js @@ -0,0 +1,12 @@ +/** + * The `:focus-within` pseudo-class matches elements that either themselves match `:focus` or that have descendants which match `:focus`. + * + * See: https://caniuse.com/css-focus-within + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':focus-within'); diff --git a/node_modules/doiuse/data/features/css-font-palette.js b/node_modules/doiuse/data/features/css-font-palette.js new file mode 100644 index 00000000..8c8eff4e --- /dev/null +++ b/node_modules/doiuse/data/features/css-font-palette.js @@ -0,0 +1,6 @@ +import { checkAtRule, performFeatureCheck } from '../../utils/util.js'; + +export default [ + (rule) => performFeatureCheck('font-palette', rule.name), + checkAtRule('font-palette-values'), +]; diff --git a/node_modules/doiuse/data/features/css-font-rendering-controls.js b/node_modules/doiuse/data/features/css-font-rendering-controls.js new file mode 100644 index 00000000..ba99dfc8 --- /dev/null +++ b/node_modules/doiuse/data/features/css-font-rendering-controls.js @@ -0,0 +1,12 @@ +/** + * `@font-face` descriptor `font-display` that allows control over how a downloadable font renders before it is fully loaded. + * + * See: https://caniuse.com/css-font-rendering-controls + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'font-display': true, +}; diff --git a/node_modules/doiuse/data/features/css-font-stretch.js b/node_modules/doiuse/data/features/css-font-stretch.js new file mode 100644 index 00000000..239170d3 --- /dev/null +++ b/node_modules/doiuse/data/features/css-font-stretch.js @@ -0,0 +1,3 @@ +export default { + 'font-stretch': true, +}; diff --git a/node_modules/doiuse/data/features/css-gencontent.js b/node_modules/doiuse/data/features/css-gencontent.js new file mode 100644 index 00000000..d420e074 --- /dev/null +++ b/node_modules/doiuse/data/features/css-gencontent.js @@ -0,0 +1,3 @@ +import { checkSelector } from '../../utils/util.js'; + +export default checkSelector([':before', ':after']); diff --git a/node_modules/doiuse/data/features/css-gradients.js b/node_modules/doiuse/data/features/css-gradients.js new file mode 100644 index 00000000..b889583e --- /dev/null +++ b/node_modules/doiuse/data/features/css-gradients.js @@ -0,0 +1,12 @@ +const REGEX = /(^|[^-])((linear)|(radial))-gradient/; + +export default { + 'background': REGEX, + 'background-image': REGEX, + 'border-image': REGEX, + 'border-image-source': REGEX, + 'content': REGEX, + 'cursor': REGEX, + 'list-style': REGEX, + 'list-style-image': REGEX, +}; diff --git a/node_modules/doiuse/data/features/css-grid-animation.js b/node_modules/doiuse/data/features/css-grid-animation.js new file mode 100644 index 00000000..50be7da2 --- /dev/null +++ b/node_modules/doiuse/data/features/css-grid-animation.js @@ -0,0 +1,6 @@ +const REGEX = /grid/; + +export default { + 'transition': REGEX, + 'transition-property': REGEX, +}; diff --git a/node_modules/doiuse/data/features/css-grid.js b/node_modules/doiuse/data/features/css-grid.js new file mode 100644 index 00000000..3387ed60 --- /dev/null +++ b/node_modules/doiuse/data/features/css-grid.js @@ -0,0 +1,23 @@ +/** @see https://drafts.csswg.org/css-grid/ */ + +export default { + 'display': ['grid', 'inline-grid', '-ms-grid'], + 'grid': true, + 'grid-area': true, + 'grid-auto-columns': true, + + 'grid-auto-flow': true, + 'grid-auto-rows': true, + 'grid-column': true, + 'grid-column-end': true, + + 'grid-column-start': true, + 'grid-row': true, + 'grid-row-end': true, + 'grid-row-start': true, + + 'grid-template': true, + 'grid-template-areas': true, + 'grid-template-columns': true, + 'grid-template-rows': true, +}; diff --git a/node_modules/doiuse/data/features/css-hanging-punctuation.js b/node_modules/doiuse/data/features/css-hanging-punctuation.js new file mode 100644 index 00000000..def2e2db --- /dev/null +++ b/node_modules/doiuse/data/features/css-hanging-punctuation.js @@ -0,0 +1,11 @@ +/** + * Allows some punctuation characters from start (or the end) of text elements to be placed "outside" of the box in order to preserve the reading flow. + * @see https://caniuse.com/css-hanging-punctuation + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'hanging-punctuation': true, +}; diff --git a/node_modules/doiuse/data/features/css-has.js b/node_modules/doiuse/data/features/css-has.js new file mode 100644 index 00000000..da108c07 --- /dev/null +++ b/node_modules/doiuse/data/features/css-has.js @@ -0,0 +1,11 @@ +/** + * Select elements containing specific content. For example, `a:has(img)` selects all `<a>` elements that contain an `<img>` child. + * @see https://caniuse.com/css-has + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':has'); diff --git a/node_modules/doiuse/data/features/css-hyphens.js b/node_modules/doiuse/data/features/css-hyphens.js new file mode 100644 index 00000000..fff20407 --- /dev/null +++ b/node_modules/doiuse/data/features/css-hyphens.js @@ -0,0 +1,3 @@ +export default { + 'hyphens': true, +}; diff --git a/node_modules/doiuse/data/features/css-image-orientation.js b/node_modules/doiuse/data/features/css-image-orientation.js new file mode 100644 index 00000000..6a715f39 --- /dev/null +++ b/node_modules/doiuse/data/features/css-image-orientation.js @@ -0,0 +1,3 @@ +export default { + 'image-orientation': true, +}; diff --git a/node_modules/doiuse/data/features/css-image-set.js b/node_modules/doiuse/data/features/css-image-set.js new file mode 100644 index 00000000..9134ce83 --- /dev/null +++ b/node_modules/doiuse/data/features/css-image-set.js @@ -0,0 +1,11 @@ +/** + * Method of letting the browser pick the most appropriate CSS image from a given set. + * @see https://caniuse.com/css-image-set + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': 'image-set(', +}; diff --git a/node_modules/doiuse/data/features/css-in-out-of-range.js b/node_modules/doiuse/data/features/css-in-out-of-range.js new file mode 100644 index 00000000..dae751db --- /dev/null +++ b/node_modules/doiuse/data/features/css-in-out-of-range.js @@ -0,0 +1,14 @@ +/** + * If a temporal or number `<input>` has `max` and/or `min` attributes, then `:in-range` matches when the value is within the specified range and `:out-of-range` matches when the value is outside the specified range. If there are no range constraints, then neither pseudo-class matches. + * @see https://caniuse.com/css-in-out-of-range + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector([ + ':in-range', + ':out-of-range', +]); diff --git a/node_modules/doiuse/data/features/css-indeterminate-pseudo.js b/node_modules/doiuse/data/features/css-indeterminate-pseudo.js new file mode 100644 index 00000000..855f8b27 --- /dev/null +++ b/node_modules/doiuse/data/features/css-indeterminate-pseudo.js @@ -0,0 +1,11 @@ +/** + * The `:indeterminate` pseudo-class matches indeterminate checkboxes, indeterminate `<progress>` bars, and radio buttons with no checked button in their radio button group. + * @see https://caniuse.com/css-indeterminate-pseudo + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':indeterminate'); diff --git a/node_modules/doiuse/data/features/css-initial-letter.js b/node_modules/doiuse/data/features/css-initial-letter.js new file mode 100644 index 00000000..8376c7b8 --- /dev/null +++ b/node_modules/doiuse/data/features/css-initial-letter.js @@ -0,0 +1,11 @@ +/** + * Method of creating an enlarged cap, including a drop or raised cap, in a robust way. + * @see https://caniuse.com/css-initial-letter + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'initial-letter': true, +}; diff --git a/node_modules/doiuse/data/features/css-initial-value.js b/node_modules/doiuse/data/features/css-initial-value.js new file mode 100644 index 00000000..21eb98f5 --- /dev/null +++ b/node_modules/doiuse/data/features/css-initial-value.js @@ -0,0 +1,3 @@ +export default { + '': 'initial', +}; diff --git a/node_modules/doiuse/data/features/css-lch-lab.js b/node_modules/doiuse/data/features/css-lch-lab.js new file mode 100644 index 00000000..9d208641 --- /dev/null +++ b/node_modules/doiuse/data/features/css-lch-lab.js @@ -0,0 +1,14 @@ +/** + * The `lch()` and `lab()` color functions are based on the CIE LAB color space, representing colors in a way that closely matches human perception and provides access to a wider spectrum of colors than offered by the usual RGB color space. + * @see https://caniuse.com/css-lch-lab + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': [ + 'lch(', + 'lab(', + ], +}; diff --git a/node_modules/doiuse/data/features/css-letter-spacing.js b/node_modules/doiuse/data/features/css-letter-spacing.js new file mode 100644 index 00000000..60f900ab --- /dev/null +++ b/node_modules/doiuse/data/features/css-letter-spacing.js @@ -0,0 +1,11 @@ +/** + * Controls spacing between characters of text (i.e. "tracking" in typographical terms). Not to be confused with kerning. + * @see https://caniuse.com/css-letter-spacing + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'letter-spacing': true, +}; diff --git a/node_modules/doiuse/data/features/css-line-clamp.js b/node_modules/doiuse/data/features/css-line-clamp.js new file mode 100644 index 00000000..bb704439 --- /dev/null +++ b/node_modules/doiuse/data/features/css-line-clamp.js @@ -0,0 +1,12 @@ +/** + * CSS property that will contain text to a given amount of lines when used in combination with `display: -webkit-box`. It will end with ellipsis when `text-overflow: ellipsis` is included. + * @see https://caniuse.com/css-line-clamp + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'line-clamp': true, + '-webkit-line-clamp': true, +}; diff --git a/node_modules/doiuse/data/features/css-logical-props.js b/node_modules/doiuse/data/features/css-logical-props.js new file mode 100644 index 00000000..13c70831 --- /dev/null +++ b/node_modules/doiuse/data/features/css-logical-props.js @@ -0,0 +1,60 @@ +export default { + 'block-size': true, + 'inline-size': true, + 'min-block-size': true, + 'min-inline-size': true, + 'max-block-size': true, + 'max-inline-size': true, + 'margin-block-start': true, + 'margin-block-end': true, + 'margin-inline-start': true, + 'margin-inline-end': true, + 'margin-block': true, + 'margin-inline': true, + 'inset-block-start': true, + 'inset-block-end': true, + 'inset-inline-start': true, + 'inset-inline-end': true, + 'inset-block': true, + 'inset-inline': true, + 'inset': true, + 'padding-block-start': true, + 'padding-block-end': true, + 'padding-inline-start': true, + 'padding-inline-end': true, + 'padding-block': true, + 'padding-inline': true, + 'border-block-start-width': true, + 'border-block-end-width': true, + 'border-inline-start-width': true, + 'border-inline-end-width': true, + 'border-block-width': true, + 'border-inline-width': true, + 'border-block-start-style': true, + 'border-block-end-style': true, + 'border-inline-start-style': true, + 'border-inline-end-style': true, + 'border-block-style': true, + 'border-inline-style': true, + 'border-block-start-color': true, + 'border-block-end-color': true, + 'border-inline-start-color': true, + 'border-inline-end-color': true, + 'border-block-color': true, + 'border-inline-color': true, + 'border-block-start': true, + 'border-block-end': true, + 'border-inline-start': true, + 'border-inline-end': true, + 'border-block': true, + 'border-inline': true, + 'border-start-start-radius': true, + 'border-start-end-radius': true, + 'border-end-start-radius': true, + 'border-end-end-radius': true, + 'text-align': ['start', 'end'], + 'float': ['inline-start', 'inline-end'], + 'resize': ['block', 'inline'], + 'overflow-block': true, + 'overflow-inline': true, +}; diff --git a/node_modules/doiuse/data/features/css-marker-pseudo.js b/node_modules/doiuse/data/features/css-marker-pseudo.js new file mode 100644 index 00000000..e8d51a39 --- /dev/null +++ b/node_modules/doiuse/data/features/css-marker-pseudo.js @@ -0,0 +1,11 @@ +/** + * The `::marker` pseudo-element allows list item markers to be styled or have their content value customized. + * @see https://caniuse.com/css-marker-pseudo + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':marker'); diff --git a/node_modules/doiuse/data/features/css-masks.js b/node_modules/doiuse/data/features/css-masks.js new file mode 100644 index 00000000..fab5f338 --- /dev/null +++ b/node_modules/doiuse/data/features/css-masks.js @@ -0,0 +1,39 @@ +export default { + 'clip-path': true, + 'mask': true, + 'mask-border': true, + 'mask-border-mode': true, + 'mask-border-outset': true, + 'mask-border-repeat': true, + 'mask-border-slice': true, + 'mask-border-source': true, + 'mask-border-width': true, + 'mask-clip': true, + 'mask-composite': true, + 'mask-image': true, + 'mask-mode': true, + 'mask-origin': true, + 'mask-position': true, + 'mask-repeat': true, + 'mask-size': true, + 'mask-type': true, + // and webkit versions + '-webkit-clip-path': true, + '-webkit-mask': true, + '-webkit-mask-border': true, + '-webkit-mask-border-mode': true, + '-webkit-mask-border-outset': true, + '-webkit-mask-border-repeat': true, + '-webkit-mask-border-slice': true, + '-webkit-mask-border-source': true, + '-webkit-mask-border-width': true, + '-webkit-mask-clip': true, + '-webkit-mask-composite': true, + '-webkit-mask-image': true, + '-webkit-mask-mode': true, + '-webkit-mask-origin': true, + '-webkit-mask-position': true, + '-webkit-mask-repeat': true, + '-webkit-mask-size': true, + '-webkit-mask-type': true, +}; diff --git a/node_modules/doiuse/data/features/css-matches-pseudo.js b/node_modules/doiuse/data/features/css-matches-pseudo.js new file mode 100644 index 00000000..e1696a9a --- /dev/null +++ b/node_modules/doiuse/data/features/css-matches-pseudo.js @@ -0,0 +1,12 @@ +import { checkSelector } from '../../utils/util.js'; + +export default checkSelector([ + ':is', + ':where', + ':matches', + ':any', + ':-webkit-any', + ':-webkit-is', + ':-webkit-where', + ':-webkit-matches', +]); diff --git a/node_modules/doiuse/data/features/css-math-functions.js b/node_modules/doiuse/data/features/css-math-functions.js new file mode 100644 index 00000000..59bab0f4 --- /dev/null +++ b/node_modules/doiuse/data/features/css-math-functions.js @@ -0,0 +1,3 @@ +export default { + '': ['min(', 'max(', 'clamp('], +}; diff --git a/node_modules/doiuse/data/features/css-media-interaction.js b/node_modules/doiuse/data/features/css-media-interaction.js new file mode 100644 index 00000000..23e1a9c7 --- /dev/null +++ b/node_modules/doiuse/data/features/css-media-interaction.js @@ -0,0 +1,16 @@ +/** + * Allows a media query to be set based on the presence and accuracy of the user's pointing device, and whether they have the ability to hover over elements on the page. This includes the `pointer`, `any-pointer`, `hover`, and `any-hover` media features. + * @see https://caniuse.com/css-media-interaction + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('media', [ + 'pointer', + 'any-pointer', + 'hover', + 'any-hover', +]); diff --git a/node_modules/doiuse/data/features/css-media-range-syntax.js b/node_modules/doiuse/data/features/css-media-range-syntax.js new file mode 100644 index 00000000..ff9de126 --- /dev/null +++ b/node_modules/doiuse/data/features/css-media-range-syntax.js @@ -0,0 +1,3 @@ +import { checkAtRule } from '../../utils/util.js'; + +export default checkAtRule('media', [' > ', ' < ', ' <= ', ' >= ']); diff --git a/node_modules/doiuse/data/features/css-media-resolution.js b/node_modules/doiuse/data/features/css-media-resolution.js new file mode 100644 index 00000000..a995449a --- /dev/null +++ b/node_modules/doiuse/data/features/css-media-resolution.js @@ -0,0 +1,3 @@ +import { checkAtRule } from '../../utils/util.js'; + +export default checkAtRule('media', ['min-resolution', 'max-resolution', 'resolution', 'device-pixel-ratio']); diff --git a/node_modules/doiuse/data/features/css-media-scripting.js b/node_modules/doiuse/data/features/css-media-scripting.js new file mode 100644 index 00000000..cfac81d2 --- /dev/null +++ b/node_modules/doiuse/data/features/css-media-scripting.js @@ -0,0 +1,11 @@ +/** + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Media+Queries:+scripting+media+feature + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('media', ['scripting']); diff --git a/node_modules/doiuse/data/features/css-mediaqueries.js b/node_modules/doiuse/data/features/css-mediaqueries.js new file mode 100644 index 00000000..0f251607 --- /dev/null +++ b/node_modules/doiuse/data/features/css-mediaqueries.js @@ -0,0 +1,3 @@ +import { checkAtRule } from '../../utils/util.js'; + +export default checkAtRule(['media']); diff --git a/node_modules/doiuse/data/features/css-mixblendmode.js b/node_modules/doiuse/data/features/css-mixblendmode.js new file mode 100644 index 00000000..4197789b --- /dev/null +++ b/node_modules/doiuse/data/features/css-mixblendmode.js @@ -0,0 +1,3 @@ +export default { + 'mix-blend-mode': true, +}; diff --git a/node_modules/doiuse/data/features/css-motion-paths.js b/node_modules/doiuse/data/features/css-motion-paths.js new file mode 100644 index 00000000..c06f4cbf --- /dev/null +++ b/node_modules/doiuse/data/features/css-motion-paths.js @@ -0,0 +1,3 @@ +export default { + 'offset-path': true, +}; diff --git a/node_modules/doiuse/data/features/css-namespaces.js b/node_modules/doiuse/data/features/css-namespaces.js new file mode 100644 index 00000000..0e9797db --- /dev/null +++ b/node_modules/doiuse/data/features/css-namespaces.js @@ -0,0 +1,11 @@ +/** + * Using the `@namespace` at-rule, elements of other namespaces (e.g. SVG) can be targeted using the pipe (`|`) selector. + * @see https://caniuse.com/css-namespaces + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('namespace'); diff --git a/node_modules/doiuse/data/features/css-nesting.js b/node_modules/doiuse/data/features/css-nesting.js new file mode 100644 index 00000000..2415d08a --- /dev/null +++ b/node_modules/doiuse/data/features/css-nesting.js @@ -0,0 +1,19 @@ +/** + * CSS nesting provides the ability to nest one style rule inside another, with the selector of the child rule relative to the selector of the parent rule. Similar behavior previously required a CSS pre-processor. + * @see https://caniuse.com/css-nesting + */ + +/** + * @type {import('../features').Feature} + */ +export default (rule) => { + if (rule.type === 'rule' && rule.parent.type === 'rule') { + return true; + } + + if (rule.type === 'atrule' && rule.parent.type === 'rule') { + return true; + } + + return false; +}; diff --git a/node_modules/doiuse/data/features/css-not-sel-list.js b/node_modules/doiuse/data/features/css-not-sel-list.js new file mode 100644 index 00000000..ee745e7e --- /dev/null +++ b/node_modules/doiuse/data/features/css-not-sel-list.js @@ -0,0 +1,13 @@ +/** + * Selectors Level 3 only allowed `:not()` pseudo-class to accept a single simple selector, which the element must not match any of. Thus, `:not(a, .b, [c])` or `:not(a.b[c])` did not work. Selectors Level 4 allows `:not()` to accept a list of selectors. Thus, `:not(a):not(.b):not([c])` can instead be written as `:not(a, .b, [c])` and `:not(a.b[c])` works as intended. + * @see https://caniuse.com/css-not-sel-list + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector( + (selector) => selector.includes(':not(') && !/:not\(.?#?-?[\w[\]-]+\)/.test(selector), +); diff --git a/node_modules/doiuse/data/features/css-nth-child-of.js b/node_modules/doiuse/data/features/css-nth-child-of.js new file mode 100644 index 00000000..b1249f6f --- /dev/null +++ b/node_modules/doiuse/data/features/css-nth-child-of.js @@ -0,0 +1,13 @@ +/** + * The newest versions of `:nth-child()` and `:nth-last-child()` accept an optional `of S` clause which filters the children to only those which match the selector list `S`. For example, `:nth-child(1 of .foo)` selects the first child among the children that have the `foo` class (ignoring any non-`foo` children which precede that child). Similar to `:nth-of-type`, but for arbitrary selectors instead of only type selectors. + * @see https://caniuse.com/css-nth-child-of + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector( + (selector) => /:nth-(child|last-child)\(\s*\d+\s*of/.test(selector), +); diff --git a/node_modules/doiuse/data/features/css-opacity.js b/node_modules/doiuse/data/features/css-opacity.js new file mode 100644 index 00000000..50f65243 --- /dev/null +++ b/node_modules/doiuse/data/features/css-opacity.js @@ -0,0 +1,3 @@ +export default { + 'opacity': true, +}; diff --git a/node_modules/doiuse/data/features/css-optional-pseudo.js b/node_modules/doiuse/data/features/css-optional-pseudo.js new file mode 100644 index 00000000..8ecca39f --- /dev/null +++ b/node_modules/doiuse/data/features/css-optional-pseudo.js @@ -0,0 +1,11 @@ +/** + * The `:optional` pseudo-class matches form inputs (`<input>`, `<textarea>`, `<select>`) which are not `:required`. + * @see https://caniuse.com/css-optional-pseudo + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':optional'); diff --git a/node_modules/doiuse/data/features/css-overflow-anchor.js b/node_modules/doiuse/data/features/css-overflow-anchor.js new file mode 100644 index 00000000..6424835a --- /dev/null +++ b/node_modules/doiuse/data/features/css-overflow-anchor.js @@ -0,0 +1,11 @@ +/** + * Changes in DOM elements above the visible region of a scrolling box can result in the page moving while the user is in the middle of consuming the content. By default, the value of `overflow-anchor` is `auto`, it can mitigate this jarring user experience by keeping track of the position of an anchor node and adjusting the scroll offset accordingly + * @see https://caniuse.com/css-overflow-anchor + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'overflow-anchor': true, +}; diff --git a/node_modules/doiuse/data/features/css-overflow-overlay.js b/node_modules/doiuse/data/features/css-overflow-overlay.js new file mode 100644 index 00000000..bdbc6ba3 --- /dev/null +++ b/node_modules/doiuse/data/features/css-overflow-overlay.js @@ -0,0 +1,3 @@ +export default { + 'overflow': 'overlay', +}; diff --git a/node_modules/doiuse/data/features/css-overflow.js b/node_modules/doiuse/data/features/css-overflow.js new file mode 100644 index 00000000..324bbcda --- /dev/null +++ b/node_modules/doiuse/data/features/css-overflow.js @@ -0,0 +1,13 @@ +/** + * Originally a single property for controlling overflowing content in both horizontal & vertical directions, the `overflow` property is now a shorthand for `overflow-x` & `overflow-y`. The latest version of the specification also introduces the `clip` value that blocks programmatic scrolling. + * @see https://caniuse.com/css-overflow + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'overflow': true, + 'overflow-x': true, + 'overflow-y': true, +}; diff --git a/node_modules/doiuse/data/features/css-overscroll-behavior.js b/node_modules/doiuse/data/features/css-overscroll-behavior.js new file mode 100644 index 00000000..3f951b6a --- /dev/null +++ b/node_modules/doiuse/data/features/css-overscroll-behavior.js @@ -0,0 +1,5 @@ +export default { + 'overscroll-behavior': true, + 'overscroll-behavior-x': true, + 'overscroll-behavior-y': true, +}; diff --git a/node_modules/doiuse/data/features/css-page-break.js b/node_modules/doiuse/data/features/css-page-break.js new file mode 100644 index 00000000..93d95a04 --- /dev/null +++ b/node_modules/doiuse/data/features/css-page-break.js @@ -0,0 +1,13 @@ +/** + * Properties to control the way elements are broken across (printed) pages. + * @see https://caniuse.com/css-page-break + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'page-break-after': true, + 'page-break-before': true, + 'page-break-inside': true, +}; diff --git a/node_modules/doiuse/data/features/css-paged-media.js b/node_modules/doiuse/data/features/css-paged-media.js new file mode 100644 index 00000000..b06d2042 --- /dev/null +++ b/node_modules/doiuse/data/features/css-paged-media.js @@ -0,0 +1,11 @@ +/** + * CSS at-rule (`@page`) to define page-specific rules when printing web pages, such as margin per page and page dimensions. + * @see https://caniuse.com/css-paged-media + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('page'); diff --git a/node_modules/doiuse/data/features/css-paint-api.js b/node_modules/doiuse/data/features/css-paint-api.js new file mode 100644 index 00000000..cf951ec5 --- /dev/null +++ b/node_modules/doiuse/data/features/css-paint-api.js @@ -0,0 +1,9 @@ +/** + * Allows programmatic generation of images used by CSS + * @see https://caniuse.com/css-paint-api + */ + +/** + * @type {import('../features').Feature} + */ +export default { '': 'paint(' }; diff --git a/node_modules/doiuse/data/features/css-placeholder-shown.js b/node_modules/doiuse/data/features/css-placeholder-shown.js new file mode 100644 index 00000000..1a92d39e --- /dev/null +++ b/node_modules/doiuse/data/features/css-placeholder-shown.js @@ -0,0 +1,12 @@ +/** + * :placeholder-shown CSS pseudo-class + * Input elements can sometimes show placeholder text as a hint to the user on what to type in. See, for example, the placeholder attribute in HTML5. The :placeholder-shown pseudo-class matches an input element that is showing such placeholder text. + * @see https://caniuse.com/css-placeholder-shown + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector(':placeholder-shown'); diff --git a/node_modules/doiuse/data/features/css-placeholder.js b/node_modules/doiuse/data/features/css-placeholder.js new file mode 100644 index 00000000..52390e8c --- /dev/null +++ b/node_modules/doiuse/data/features/css-placeholder.js @@ -0,0 +1,5 @@ +import { checkSelector } from '../../utils/util.js'; + +export default [ + checkSelector(':placeholder'), +]; diff --git a/node_modules/doiuse/data/features/css-print-color-adjust.js b/node_modules/doiuse/data/features/css-print-color-adjust.js new file mode 100644 index 00000000..ffa89e69 --- /dev/null +++ b/node_modules/doiuse/data/features/css-print-color-adjust.js @@ -0,0 +1,3 @@ +export default { + 'print-color-adjust': true, +}; diff --git a/node_modules/doiuse/data/features/css-read-only-write.js b/node_modules/doiuse/data/features/css-read-only-write.js new file mode 100644 index 00000000..e9956292 --- /dev/null +++ b/node_modules/doiuse/data/features/css-read-only-write.js @@ -0,0 +1,12 @@ +/** + * CSS :read-only and :read-write selectors + * :read-only and :read-write pseudo-classes to match elements which are considered user-alterable + * @see https://caniuse.com/css-read-only-write + */ + +import { checkSelector } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkSelector([':read-only', ':read-write']); diff --git a/node_modules/doiuse/data/features/css-rebeccapurple.js b/node_modules/doiuse/data/features/css-rebeccapurple.js new file mode 100644 index 00000000..3a813b5d --- /dev/null +++ b/node_modules/doiuse/data/features/css-rebeccapurple.js @@ -0,0 +1,12 @@ +/** + * Rebeccapurple color + * The new color added in CSS Color Module Level 4 + * @see https://caniuse.com/css-rebeccapurple + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': 'rebeccapurple', +}; diff --git a/node_modules/doiuse/data/features/css-reflections.js b/node_modules/doiuse/data/features/css-reflections.js new file mode 100644 index 00000000..de0a7671 --- /dev/null +++ b/node_modules/doiuse/data/features/css-reflections.js @@ -0,0 +1,4 @@ +export default { + 'box-reflect': true, + '-webkit-box-reflect': true, +}; diff --git a/node_modules/doiuse/data/features/css-regions.js b/node_modules/doiuse/data/features/css-regions.js new file mode 100644 index 00000000..3aefaacf --- /dev/null +++ b/node_modules/doiuse/data/features/css-regions.js @@ -0,0 +1,15 @@ +/** + * CSS Regions + * Method of flowing content into multiple elements, allowing magazine-like layouts. While once supported in WebKit-based browsers and Internet Explorer, implementing the feature is no longer being pursued by any browser. + * @see https://caniuse.com/css-regions + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'flow-into': true, + 'flow-from': true, + '-webkit-flow-into': true, + '-webkit-flow-from': true, +}; diff --git a/node_modules/doiuse/data/features/css-relative-colors.js b/node_modules/doiuse/data/features/css-relative-colors.js new file mode 100644 index 00000000..48bcd665 --- /dev/null +++ b/node_modules/doiuse/data/features/css-relative-colors.js @@ -0,0 +1,12 @@ +/** + * CSS Relative colors + * The CSS Relative Color syntax allows a color to be defined relative to another color using the `from` keyword and optionally `calc()` for any of the color values. + * @see https://caniuse.com/css-relative-colors + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': /((rgb)|(rgba)|(hsl)|(hsla)|(hwb))\(\s*from/, +}; diff --git a/node_modules/doiuse/data/features/css-repeating-gradients.js b/node_modules/doiuse/data/features/css-repeating-gradients.js new file mode 100644 index 00000000..5639bbe6 --- /dev/null +++ b/node_modules/doiuse/data/features/css-repeating-gradients.js @@ -0,0 +1,6 @@ +export default { + '': [ + 'repeating-linear-gradient', + 'repeating-radial-gradient', + ], +}; diff --git a/node_modules/doiuse/data/features/css-resize.js b/node_modules/doiuse/data/features/css-resize.js new file mode 100644 index 00000000..8b25994b --- /dev/null +++ b/node_modules/doiuse/data/features/css-resize.js @@ -0,0 +1,3 @@ +export default { + 'resize': true, +}; diff --git a/node_modules/doiuse/data/features/css-revert-value.js b/node_modules/doiuse/data/features/css-revert-value.js new file mode 100644 index 00000000..03067c7b --- /dev/null +++ b/node_modules/doiuse/data/features/css-revert-value.js @@ -0,0 +1,4 @@ +export default { + '': 'revert', + +}; diff --git a/node_modules/doiuse/data/features/css-rrggbbaa.js b/node_modules/doiuse/data/features/css-rrggbbaa.js new file mode 100644 index 00000000..7d83f4e4 --- /dev/null +++ b/node_modules/doiuse/data/features/css-rrggbbaa.js @@ -0,0 +1,15 @@ +/** + * #rrggbbaa hex color notation + * The CSS Color Module Level 4 defines new 4 & 8 character hex notation for color to include the opacity level. + * @see https://caniuse.com/css-rrggbbaa + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': [ + /#[\da-f]{8}/i, + /#[\da-f]{4}(\W|$)/i, + ], +}; diff --git a/node_modules/doiuse/data/features/css-scroll-behavior.js b/node_modules/doiuse/data/features/css-scroll-behavior.js new file mode 100644 index 00000000..fc83e96f --- /dev/null +++ b/node_modules/doiuse/data/features/css-scroll-behavior.js @@ -0,0 +1,12 @@ +/** + * CSS Scroll-behavior + * Method of specifying the scrolling behavior for a scrolling box, when scrolling happens due to navigation or CSSOM scrolling APIs. + * @see https://caniuse.com/css-scroll-behavior + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'scroll-behavior': true, +}; diff --git a/node_modules/doiuse/data/features/css-scroll-timeline.js b/node_modules/doiuse/data/features/css-scroll-timeline.js new file mode 100644 index 00000000..48da61cd --- /dev/null +++ b/node_modules/doiuse/data/features/css-scroll-timeline.js @@ -0,0 +1,27 @@ +/** + * CSS @scroll-timeline + * CSS property that allows animations to be driven by a container's scroll position + * @see https://caniuse.com/css-scroll-timeline + */ + +import { checkAtRule } from '../../utils/util.js'; + +const checkAt = checkAtRule('scroll-timeline'); + +/** + * @type {import('../features').Feature} + */ +export default (node) => { + // check for @scroll-timeline + if (checkAt(node)) { + return true; + } + + // check for animation-timeline + if (node.type !== 'decl') return false; + if (node.prop.startsWith('animation-timeline')) { + return true; + } + + return false; +}; diff --git a/node_modules/doiuse/data/features/css-scrollbar.js b/node_modules/doiuse/data/features/css-scrollbar.js new file mode 100644 index 00000000..ed4edbf9 --- /dev/null +++ b/node_modules/doiuse/data/features/css-scrollbar.js @@ -0,0 +1,4 @@ +export default { + 'scrollbar-color': true, + 'scrollbar-width': true, +}; diff --git a/node_modules/doiuse/data/features/css-sel2.js b/node_modules/doiuse/data/features/css-sel2.js new file mode 100644 index 00000000..cdadf2ff --- /dev/null +++ b/node_modules/doiuse/data/features/css-sel2.js @@ -0,0 +1,42 @@ +import { checkSelector } from '../../utils/util.js'; + +const ATTRIBUTE_IDENTIFIER = '[^\\~|^$*\\]]*'; + +// Export for testing +export const REGEXES = { + 'HAS_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\]`), + 'MATCH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}=${ATTRIBUTE_IDENTIFIER}\\]`), + 'WORD_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\~=${ATTRIBUTE_IDENTIFIER}\\]`), + 'SUBCODE_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\|=${ATTRIBUTE_IDENTIFIER}\\]`), + 'BRACKET_PARENS': /(\[[^=\]]*(=("[^"]*")|[^\]]+|)])|(\([^)]*\))/g, +}; + +/** + * @param {RegExp} pattern + * @return {(str:string) => boolean} + */ +function matchOutsideOfBrackets(pattern) { + if (!(pattern instanceof RegExp)) { + throw new TypeError('matchOutsideOfBrackets expects a RegExp'); + } + return (string) => pattern.test(string.replaceAll(REGEXES.BRACKET_PARENS, '')); +} + +export default checkSelector([ + ':first-child', + ':link', + ':visited', + ':active', + ':hover', + ':focus', + ':lang', + REGEXES.HAS_ATTRIBUTE, + REGEXES.MATCH_ATTRIBUTE, + REGEXES.WORD_ATTRIBUTE, + REGEXES.SUBCODE_ATTRIBUTE, + matchOutsideOfBrackets(/\*/), + matchOutsideOfBrackets(/>/), + matchOutsideOfBrackets(/\+/), + matchOutsideOfBrackets(/\./), + matchOutsideOfBrackets(/#/), +]); diff --git a/node_modules/doiuse/data/features/css-sel3.js b/node_modules/doiuse/data/features/css-sel3.js new file mode 100644 index 00000000..c82db473 --- /dev/null +++ b/node_modules/doiuse/data/features/css-sel3.js @@ -0,0 +1,34 @@ +import { checkSelector } from '../../utils/util.js'; + +const ATTRIBUTE_IDENTIFIER = '[^\\~|^$*\\]]*'; + +// Export for testing +export const REGEXES = { + 'SIBLING_SELECTOR': /^[^[]*~/, + 'STARTSWITH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\^=${ATTRIBUTE_IDENTIFIER}\\]`), + 'ENDSWITH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\$=${ATTRIBUTE_IDENTIFIER}\\]`), + 'INSENSITIVE_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\*=${ATTRIBUTE_IDENTIFIER}\\]`), +}; + +export default checkSelector([ + ':root', + ':nth-child', + ':nth-last-child', + 'nth-of-type', + 'nth-last-of-type', + ':last-child', + ':first-of-type', + ':last-of-type', + ':only-child', + ':only-of-type', + ':empty', + ':target', + ':enabled', + ':disabled', + ':checked', + ':not', + REGEXES.SIBLING_SELECTOR, + REGEXES.STARTSWITH_ATTRIBUTE, + REGEXES.ENDSWITH_ATTRIBUTE, + REGEXES.INSENSITIVE_ATTRIBUTE, +]); diff --git a/node_modules/doiuse/data/features/css-selection.js b/node_modules/doiuse/data/features/css-selection.js new file mode 100644 index 00000000..34c6fd4f --- /dev/null +++ b/node_modules/doiuse/data/features/css-selection.js @@ -0,0 +1,3 @@ +import { checkSelector } from '../../utils/util.js'; + +export default checkSelector(':selection'); diff --git a/node_modules/doiuse/data/features/css-shapes.js b/node_modules/doiuse/data/features/css-shapes.js new file mode 100644 index 00000000..4eddbfa3 --- /dev/null +++ b/node_modules/doiuse/data/features/css-shapes.js @@ -0,0 +1,5 @@ +export default { + 'shape-outside': true, + 'shape-image-threshold': true, + 'shape-margin': true, +}; diff --git a/node_modules/doiuse/data/features/css-snappoints.js b/node_modules/doiuse/data/features/css-snappoints.js new file mode 100644 index 00000000..52b5649f --- /dev/null +++ b/node_modules/doiuse/data/features/css-snappoints.js @@ -0,0 +1,36 @@ +/** + * CSS Scroll Snap + * CSS technique that allows customizable scrolling experiences like pagination of carousels by setting defined snap positions. + * @see https://caniuse.com/css-snappoints + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'scroll-snap-type': true, + 'scroll-padding': true, + 'scroll-padding-top': true, + 'scroll-padding-right': true, + 'scroll-padding-bottom': true, + 'scroll-padding-left': true, + 'scroll-padding-inline': true, + 'scroll-padding-inline-start': true, + 'scroll-padding-inline-end': true, + 'scroll-padding-block': true, + 'scroll-padding-block-start': true, + 'scroll-padding-block-end': true, + 'scroll-snap-align': true, + 'scroll-margin': true, + 'scroll-margin-top': true, + 'scroll-margin-right': true, + 'scroll-margin-bottom': true, + 'scroll-margin-left': true, + 'scroll-margin-inline': true, + 'scroll-margin-inline-start': true, + 'scroll-margin-inline-end': true, + 'scroll-margin-block': true, + 'scroll-margin-block-start': true, + 'scroll-margin-block-end': true, + 'scroll-snap-stop': true, +}; diff --git a/node_modules/doiuse/data/features/css-sticky.js b/node_modules/doiuse/data/features/css-sticky.js new file mode 100644 index 00000000..b7336e62 --- /dev/null +++ b/node_modules/doiuse/data/features/css-sticky.js @@ -0,0 +1,3 @@ +export default { + 'position': 'sticky', +}; diff --git a/node_modules/doiuse/data/features/css-subgrid.js b/node_modules/doiuse/data/features/css-subgrid.js new file mode 100644 index 00000000..0b23eb99 --- /dev/null +++ b/node_modules/doiuse/data/features/css-subgrid.js @@ -0,0 +1,12 @@ +/** + * CSS Subgrid + * Feature of the CSS Grid Layout Module Level 2 that allows a grid-item with its own grid to align in one or both dimensions with its parent grid. + * @see https://caniuse.com/css-subgrid + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': 'subgrid', +}; diff --git a/node_modules/doiuse/data/features/css-supports-api.js b/node_modules/doiuse/data/features/css-supports-api.js new file mode 100644 index 00000000..cea5cab1 --- /dev/null +++ b/node_modules/doiuse/data/features/css-supports-api.js @@ -0,0 +1,12 @@ +/** + * CSS.supports() API + * The CSS.supports() static methods returns a Boolean value indicating if the browser supports a given CSS feature, or not. + * @see https://caniuse.com/css-supports-api + */ + +/** + * @type {import('../features').Feature} + */ +export default {}; + +/* this feature appears in JS, so it's not linted by this tool */ diff --git a/node_modules/doiuse/data/features/css-table.js b/node_modules/doiuse/data/features/css-table.js new file mode 100644 index 00000000..d86c5c2a --- /dev/null +++ b/node_modules/doiuse/data/features/css-table.js @@ -0,0 +1,7 @@ +export default { + 'display': [ + 'table', + 'table-', + 'inline-table', + ], +}; diff --git a/node_modules/doiuse/data/features/css-text-align-last.js b/node_modules/doiuse/data/features/css-text-align-last.js new file mode 100644 index 00000000..31883731 --- /dev/null +++ b/node_modules/doiuse/data/features/css-text-align-last.js @@ -0,0 +1,12 @@ +/** + * CSS3 text-align-last + * CSS property to describe how the last line of a block or a line right before a forced line break when `text-align` is `justify`. + * @see https://caniuse.com/css-text-align-last + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'text-align-last': true, +}; diff --git a/node_modules/doiuse/data/features/css-text-box-trim.js b/node_modules/doiuse/data/features/css-text-box-trim.js new file mode 100644 index 00000000..e91567f0 --- /dev/null +++ b/node_modules/doiuse/data/features/css-text-box-trim.js @@ -0,0 +1,13 @@ +/** + * CSS text-box-trim & text-box-edge + * Provides the ability to remove the vertical space appearing above and below text glyphs, allowing more precise positioning and alignment. Previously specified as the `leading-trim` & `text-edge` properties. + * @see https://caniuse.com/css-text-box-trim + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'text-box-trim': true, + 'text-box-edge': true, +}; diff --git a/node_modules/doiuse/data/features/css-text-indent.js b/node_modules/doiuse/data/features/css-text-indent.js new file mode 100644 index 00000000..574fab41 --- /dev/null +++ b/node_modules/doiuse/data/features/css-text-indent.js @@ -0,0 +1,12 @@ +/** + * CSS text-indent + * The `text-indent` property applies indentation to lines of inline content in a block. + * @see https://caniuse.com/css-text-indent + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'text-indent': true, +}; diff --git a/node_modules/doiuse/data/features/css-text-justify.js b/node_modules/doiuse/data/features/css-text-justify.js new file mode 100644 index 00000000..3b08cad8 --- /dev/null +++ b/node_modules/doiuse/data/features/css-text-justify.js @@ -0,0 +1,12 @@ +/** + * CSS text-justify + * CSS property to define how text should be justified when `text-align: justify` is set. + * @see https://caniuse.com/css-text-justify + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'text-justify': true, +}; diff --git a/node_modules/doiuse/data/features/css-text-orientation.js b/node_modules/doiuse/data/features/css-text-orientation.js new file mode 100644 index 00000000..93c7ccd0 --- /dev/null +++ b/node_modules/doiuse/data/features/css-text-orientation.js @@ -0,0 +1,12 @@ +/** + * CSS text-orientation + * The CSS `text-orientation` property specifies the orientation of text within a line. Current values only have an effect in vertical typographic modes (defined with the `writing-mode` property) + * @see https://caniuse.com/css-text-orientation + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'text-orientation': true, +}; diff --git a/node_modules/doiuse/data/features/css-text-spacing.js b/node_modules/doiuse/data/features/css-text-spacing.js new file mode 100644 index 00000000..08d3262b --- /dev/null +++ b/node_modules/doiuse/data/features/css-text-spacing.js @@ -0,0 +1,12 @@ +/** + * CSS Text 4 text-spacing + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=CSS+Text+4+text-spacing + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'text-spacing': true, +}; diff --git a/node_modules/doiuse/data/features/css-textshadow.js b/node_modules/doiuse/data/features/css-textshadow.js new file mode 100644 index 00000000..00ec173d --- /dev/null +++ b/node_modules/doiuse/data/features/css-textshadow.js @@ -0,0 +1,3 @@ +export default { + 'text-shadow': true, +}; diff --git a/node_modules/doiuse/data/features/css-touch-action.js b/node_modules/doiuse/data/features/css-touch-action.js new file mode 100644 index 00000000..fe8ccc57 --- /dev/null +++ b/node_modules/doiuse/data/features/css-touch-action.js @@ -0,0 +1,3 @@ +export default { + 'touch-action': true, +}; diff --git a/node_modules/doiuse/data/features/css-transitions.js b/node_modules/doiuse/data/features/css-transitions.js new file mode 100644 index 00000000..c2f29934 --- /dev/null +++ b/node_modules/doiuse/data/features/css-transitions.js @@ -0,0 +1,7 @@ +export default { + 'transition': true, + 'transition-property': true, + 'transition-duration': true, + 'transition-delay': true, + 'transition-timing-function': true, +}; diff --git a/node_modules/doiuse/data/features/css-unicode-bidi.js b/node_modules/doiuse/data/features/css-unicode-bidi.js new file mode 100644 index 00000000..7a16c868 --- /dev/null +++ b/node_modules/doiuse/data/features/css-unicode-bidi.js @@ -0,0 +1,12 @@ +/** + * CSS unicode-bidi property + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=CSS+unicode-bidi+property + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'unicode-bidi': true, +}; diff --git a/node_modules/doiuse/data/features/css-unset-value.js b/node_modules/doiuse/data/features/css-unset-value.js new file mode 100644 index 00000000..28b86a14 --- /dev/null +++ b/node_modules/doiuse/data/features/css-unset-value.js @@ -0,0 +1,3 @@ +export default { + '': 'unset', +}; diff --git a/node_modules/doiuse/data/features/css-variables.js b/node_modules/doiuse/data/features/css-variables.js new file mode 100644 index 00000000..fecc07b4 --- /dev/null +++ b/node_modules/doiuse/data/features/css-variables.js @@ -0,0 +1,8 @@ +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +export default (rule) => { + if (rule.type !== 'decl') return false; + return (rule.prop.startsWith('--') || rule.value.includes('var(')); +}; diff --git a/node_modules/doiuse/data/features/css-when-else.js b/node_modules/doiuse/data/features/css-when-else.js new file mode 100644 index 00000000..d449b9d3 --- /dev/null +++ b/node_modules/doiuse/data/features/css-when-else.js @@ -0,0 +1,12 @@ +/** + * CSS @when / @else conditional rules + * Syntax allowing CSS conditions (like media and support queries) to be written more simply, as well as making it possibly to write mutually exclusive rules using `@else` statements. + * @see https://caniuse.com/css-when-else + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule(['when', 'else']); diff --git a/node_modules/doiuse/data/features/css-widows-orphans.js b/node_modules/doiuse/data/features/css-widows-orphans.js new file mode 100644 index 00000000..1604f84d --- /dev/null +++ b/node_modules/doiuse/data/features/css-widows-orphans.js @@ -0,0 +1,13 @@ +/** + * CSS widows & orphans + * CSS properties to control when lines break across pages or columns by defining the amount of lines that must be left before or after the break. + * @see https://caniuse.com/css-widows-orphans + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'widows': true, + 'orphans': true, +}; diff --git a/node_modules/doiuse/data/features/css-width-stretch.js b/node_modules/doiuse/data/features/css-width-stretch.js new file mode 100644 index 00000000..f87b0b75 --- /dev/null +++ b/node_modules/doiuse/data/features/css-width-stretch.js @@ -0,0 +1,12 @@ +/** + * width: stretch property + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=width:+stretch+property + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'width': 'stretch', +}; diff --git a/node_modules/doiuse/data/features/css-writing-mode.js b/node_modules/doiuse/data/features/css-writing-mode.js new file mode 100644 index 00000000..0a43f59c --- /dev/null +++ b/node_modules/doiuse/data/features/css-writing-mode.js @@ -0,0 +1,12 @@ +/** + * CSS writing-mode property + * Property to define whether lines of text are laid out horizontally or vertically and the direction in which blocks progress. + * @see https://caniuse.com/css-writing-mode + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'writing-mode': true, +}; diff --git a/node_modules/doiuse/data/features/css-zoom.js b/node_modules/doiuse/data/features/css-zoom.js new file mode 100644 index 00000000..66f606b7 --- /dev/null +++ b/node_modules/doiuse/data/features/css-zoom.js @@ -0,0 +1,12 @@ +/** + * CSS zoom + * Non-standard method of scaling content. + * @see https://caniuse.com/css-zoom + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'zoom': true, +}; diff --git a/node_modules/doiuse/data/features/css3-attr.js b/node_modules/doiuse/data/features/css3-attr.js new file mode 100644 index 00000000..0031aedf --- /dev/null +++ b/node_modules/doiuse/data/features/css3-attr.js @@ -0,0 +1,17 @@ +/** + * CSS3 attr() function for all properties + * While `attr()` is supported for effectively all browsers for the `content` property, CSS Values and Units Level 5 adds the ability to use `attr()` on **any** CSS property, and to use it for non-string values (e.g. numbers, colors). + * @see https://caniuse.com/css3-attr + */ + +/** + * @type {import('../features').Feature} + */ +export default (rule) => { + if (rule.type !== 'decl') return false; + if (rule.prop === 'content') { + return false; + } + + return rule.toString().includes('attr('); +}; diff --git a/node_modules/doiuse/data/features/css3-boxsizing.js b/node_modules/doiuse/data/features/css3-boxsizing.js new file mode 100644 index 00000000..56f16d9f --- /dev/null +++ b/node_modules/doiuse/data/features/css3-boxsizing.js @@ -0,0 +1,3 @@ +export default { + 'box-sizing': true, +}; diff --git a/node_modules/doiuse/data/features/css3-colors.js b/node_modules/doiuse/data/features/css3-colors.js new file mode 100644 index 00000000..97fa5620 --- /dev/null +++ b/node_modules/doiuse/data/features/css3-colors.js @@ -0,0 +1,7 @@ +export default { + '': [ + 'rgba', + 'hsl', + 'hsla', + ], +}; diff --git a/node_modules/doiuse/data/features/css3-cursors-grab.js b/node_modules/doiuse/data/features/css3-cursors-grab.js new file mode 100644 index 00000000..69f55e6e --- /dev/null +++ b/node_modules/doiuse/data/features/css3-cursors-grab.js @@ -0,0 +1,3 @@ +export default { + 'cursor': ['grab', 'grabbing'], +}; diff --git a/node_modules/doiuse/data/features/css3-cursors-newer.js b/node_modules/doiuse/data/features/css3-cursors-newer.js new file mode 100644 index 00000000..8941c6f8 --- /dev/null +++ b/node_modules/doiuse/data/features/css3-cursors-newer.js @@ -0,0 +1,3 @@ +export default { + 'cursor': ['zoom-in', 'zoom-out'], +}; diff --git a/node_modules/doiuse/data/features/css3-cursors.js b/node_modules/doiuse/data/features/css3-cursors.js new file mode 100644 index 00000000..e6e96e18 --- /dev/null +++ b/node_modules/doiuse/data/features/css3-cursors.js @@ -0,0 +1,17 @@ +export default { + 'cursor': [ + 'none', + 'context-menu', + 'cell', + 'vertical-text', + 'alias', + 'copy', + 'no-drop', + 'not-allowed', + 'nesw-resize', + 'nwse-resize', + 'col-resize', + 'row-resize', + 'all-scroll', + ], +}; diff --git a/node_modules/doiuse/data/features/css3-tabsize.js b/node_modules/doiuse/data/features/css3-tabsize.js new file mode 100644 index 00000000..3176ab15 --- /dev/null +++ b/node_modules/doiuse/data/features/css3-tabsize.js @@ -0,0 +1,3 @@ +export default { + 'tab-size': true, +}; diff --git a/node_modules/doiuse/data/features/currentcolor.js b/node_modules/doiuse/data/features/currentcolor.js new file mode 100644 index 00000000..a3a733a7 --- /dev/null +++ b/node_modules/doiuse/data/features/currentcolor.js @@ -0,0 +1,12 @@ +/** + * CSS currentColor value + * A CSS value that will apply the existing `color` value to other properties like `background-color`, etc. + * @see https://caniuse.com/currentcolor + */ + +/** + * @type {import('../features').Feature} + */ +export default { + '': 'currentColor', +}; diff --git a/node_modules/doiuse/data/features/devicepixelratio.js b/node_modules/doiuse/data/features/devicepixelratio.js new file mode 100644 index 00000000..13fdd938 --- /dev/null +++ b/node_modules/doiuse/data/features/devicepixelratio.js @@ -0,0 +1,12 @@ +/** + * Window.devicePixelRatio + * Read-only property that returns the ratio of the (vertical) size of one physical pixel on the current display device to the size of one CSS pixel. + * @see https://caniuse.com/devicepixelratio + */ + +/** + * @type {import('../features').Feature} + */ +export default {}; + +/* this feature is found in JS and is not linted by this tool */ diff --git a/node_modules/doiuse/data/features/extended-system-fonts.js b/node_modules/doiuse/data/features/extended-system-fonts.js new file mode 100644 index 00000000..5376d3f7 --- /dev/null +++ b/node_modules/doiuse/data/features/extended-system-fonts.js @@ -0,0 +1,12 @@ +/** + * ui-serif, ui-sans-serif, ui-monospace and ui-rounded values for font-family + * Allows more control when choosing system interface fonts + * @see https://caniuse.com/extended-system-fonts + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'font-family': ['ui-serif', 'ui-sans-serif', 'ui-monospace', 'ui-rounded'], +}; diff --git a/node_modules/doiuse/data/features/flexbox-gap.js b/node_modules/doiuse/data/features/flexbox-gap.js new file mode 100644 index 00000000..c94eac38 --- /dev/null +++ b/node_modules/doiuse/data/features/flexbox-gap.js @@ -0,0 +1,18 @@ +/** + * gap property for Flexbox + * `gap` for flexbox containers to create gaps/gutters between flex items + * @see https://caniuse.com/flexbox-gap + */ + +/** + * @type {import('../features').Feature} + */ +export default (rule) => { + if (/display:\s(inline-)?flex/.test(rule.toString()) + && rule.toString().includes('gap:') + ) { + return true; + } + + return false; +}; diff --git a/node_modules/doiuse/data/features/flexbox.js b/node_modules/doiuse/data/features/flexbox.js new file mode 100644 index 00000000..e494acb1 --- /dev/null +++ b/node_modules/doiuse/data/features/flexbox.js @@ -0,0 +1,13 @@ +export default { + 'display': [ + 'flex', + 'inline-flex', + ], + 'flex': true, + 'flex-grow': true, + 'flex-shrink': true, + 'flex-basis': true, + 'flex-direction': true, + 'flex-wrap': true, + 'flex-flow': true, +}; diff --git a/node_modules/doiuse/data/features/flow-root.js b/node_modules/doiuse/data/features/flow-root.js new file mode 100644 index 00000000..9b16aede --- /dev/null +++ b/node_modules/doiuse/data/features/flow-root.js @@ -0,0 +1,12 @@ +/** + * display: flow-root + * The element generates a block container box, and lays out its contents using flow layout. It always establishes a new block formatting context for its contents. It provides a better solution to the most use cases of the "clearfix" hack. + * @see https://caniuse.com/flow-root + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'display': 'flow-root', +}; diff --git a/node_modules/doiuse/data/features/font-family-system-ui.js b/node_modules/doiuse/data/features/font-family-system-ui.js new file mode 100644 index 00000000..b1b6e08f --- /dev/null +++ b/node_modules/doiuse/data/features/font-family-system-ui.js @@ -0,0 +1,12 @@ +/** + * system-ui value for font-family + * Value for `font-family` that represents the default user interface font. + * @see https://caniuse.com/font-family-system-ui + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'font-family': 'system-ui', +}; diff --git a/node_modules/doiuse/data/features/font-feature.js b/node_modules/doiuse/data/features/font-feature.js new file mode 100644 index 00000000..f0b8ebd2 --- /dev/null +++ b/node_modules/doiuse/data/features/font-feature.js @@ -0,0 +1,6 @@ +export default { + 'font-feature-settings': true, + 'font-variant-ligatures': true, + 'font-language-override': true, + 'font-kerning': true, +}; diff --git a/node_modules/doiuse/data/features/font-kerning.js b/node_modules/doiuse/data/features/font-kerning.js new file mode 100644 index 00000000..d239756e --- /dev/null +++ b/node_modules/doiuse/data/features/font-kerning.js @@ -0,0 +1,12 @@ +/** + * CSS3 font-kerning + * Controls the usage of the kerning information (spacing between letters) stored in the font. Note that this only affects OpenType fonts with kerning information, it has no effect on other fonts. + * @see https://caniuse.com/font-kerning + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'font-kerning': true, +}; diff --git a/node_modules/doiuse/data/features/font-loading.js b/node_modules/doiuse/data/features/font-loading.js new file mode 100644 index 00000000..1a0c1ca9 --- /dev/null +++ b/node_modules/doiuse/data/features/font-loading.js @@ -0,0 +1,12 @@ +/** + * CSS Font Loading + * This CSS module defines a scripting interface to font faces in CSS, allowing font faces to be easily created and loaded from script. It also provides methods to track the loading status of an individual font, or of all the fonts on an entire page. + * @see https://caniuse.com/font-loading + */ + +/** + * @type {import('../features').Feature} + */ +export default {}; + +/* this feature appears in JS and as such is not linted */ diff --git a/node_modules/doiuse/data/features/font-size-adjust.js b/node_modules/doiuse/data/features/font-size-adjust.js new file mode 100644 index 00000000..4604c92a --- /dev/null +++ b/node_modules/doiuse/data/features/font-size-adjust.js @@ -0,0 +1,3 @@ +export default { + 'font-size-adjust': true, +}; diff --git a/node_modules/doiuse/data/features/font-smooth.js b/node_modules/doiuse/data/features/font-smooth.js new file mode 100644 index 00000000..8304c4ad --- /dev/null +++ b/node_modules/doiuse/data/features/font-smooth.js @@ -0,0 +1,12 @@ +/** + * CSS font-smooth + * Controls the application of anti-aliasing when fonts are rendered. + * @see https://caniuse.com/font-smooth + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'font-smooth': true, +}; diff --git a/node_modules/doiuse/data/features/font-unicode-range.js b/node_modules/doiuse/data/features/font-unicode-range.js new file mode 100644 index 00000000..945ebb6d --- /dev/null +++ b/node_modules/doiuse/data/features/font-unicode-range.js @@ -0,0 +1,3 @@ +export default { + 'unicode-range': true, +}; diff --git a/node_modules/doiuse/data/features/font-variant-alternates.js b/node_modules/doiuse/data/features/font-variant-alternates.js new file mode 100644 index 00000000..169e5c37 --- /dev/null +++ b/node_modules/doiuse/data/features/font-variant-alternates.js @@ -0,0 +1,12 @@ +/** + * CSS font-variant-alternates + * Controls the usage of alternate glyphs associated to alternative names defined in @font-feature-values for certain types of OpenType fonts. + * @see https://caniuse.com/font-variant-alternates + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'font-variant-alternates': true, +}; diff --git a/node_modules/doiuse/data/features/font-variant-numeric.js b/node_modules/doiuse/data/features/font-variant-numeric.js new file mode 100644 index 00000000..13b05164 --- /dev/null +++ b/node_modules/doiuse/data/features/font-variant-numeric.js @@ -0,0 +1,12 @@ +/** + * CSS font-variant-numeric + * CSS property that provides different ways of displaying numbers, fractions, and ordinal markers. + * @see https://caniuse.com/font-variant-numeric + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'font-variant-numeric': true, +}; diff --git a/node_modules/doiuse/data/features/fontface.js b/node_modules/doiuse/data/features/fontface.js new file mode 100644 index 00000000..2350dae0 --- /dev/null +++ b/node_modules/doiuse/data/features/fontface.js @@ -0,0 +1,5 @@ +import { checkAtRule } from '../../utils/util.js'; + +export default [ + checkAtRule('font-face'), +]; diff --git a/node_modules/doiuse/data/features/fullscreen.js b/node_modules/doiuse/data/features/fullscreen.js new file mode 100644 index 00000000..c5befe68 --- /dev/null +++ b/node_modules/doiuse/data/features/fullscreen.js @@ -0,0 +1,3 @@ +import { checkSelector } from '../../utils/util.js'; + +export default checkSelector(':fullscreen'); diff --git a/node_modules/doiuse/data/features/getcomputedstyle.js b/node_modules/doiuse/data/features/getcomputedstyle.js new file mode 100644 index 00000000..ac64aab5 --- /dev/null +++ b/node_modules/doiuse/data/features/getcomputedstyle.js @@ -0,0 +1,12 @@ +/** + * getComputedStyle + * API to get the current computed CSS styles applied to an element. This may be the current value applied by an animation or as set by a stylesheet. + * @see https://caniuse.com/getcomputedstyle + */ + +/** + * @type {import('../features').Feature} + */ +export default {}; + +/* this is a js api, so we don't lint it */ diff --git a/node_modules/doiuse/data/features/inline-block.js b/node_modules/doiuse/data/features/inline-block.js new file mode 100644 index 00000000..35b09093 --- /dev/null +++ b/node_modules/doiuse/data/features/inline-block.js @@ -0,0 +1,3 @@ +export default { + 'display': 'inline-block', +}; diff --git a/node_modules/doiuse/data/features/intrinsic-width.js b/node_modules/doiuse/data/features/intrinsic-width.js new file mode 100644 index 00000000..a01a8f3f --- /dev/null +++ b/node_modules/doiuse/data/features/intrinsic-width.js @@ -0,0 +1,10 @@ +const VALUES = ['max-content', 'min-content', 'fit-content', 'fill-available', 'stretch', 'fill']; + +export default { + 'width': VALUES, + 'min-width': VALUES, + 'max-width': VALUES, + 'height': VALUES, + 'min-height': VALUES, + 'max-height': VALUES, +}; diff --git a/node_modules/doiuse/data/features/justify-content-space-evenly.js b/node_modules/doiuse/data/features/justify-content-space-evenly.js new file mode 100644 index 00000000..0df7d327 --- /dev/null +++ b/node_modules/doiuse/data/features/justify-content-space-evenly.js @@ -0,0 +1,12 @@ +/** + * CSS justify-content: space-evenly + * The "space-evenly" value for the `justify-content` property distributes the space between items evenly. It is similar to space-around but provides equal instead of half-sized space on the edges. Can be used in both CSS flexbox & grid. + * @see https://caniuse.com/justify-content-space-evenly + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'justify-content': 'space-evenly', +}; diff --git a/node_modules/doiuse/data/features/kerning-pairs-ligatures.js b/node_modules/doiuse/data/features/kerning-pairs-ligatures.js new file mode 100644 index 00000000..31fbcbbc --- /dev/null +++ b/node_modules/doiuse/data/features/kerning-pairs-ligatures.js @@ -0,0 +1,3 @@ +export default { + 'text-rendering': 'optimizeLegibility', +}; diff --git a/node_modules/doiuse/data/features/mdn-css-unicode-bidi-isolate-override.js b/node_modules/doiuse/data/features/mdn-css-unicode-bidi-isolate-override.js new file mode 100644 index 00000000..72e64cf8 --- /dev/null +++ b/node_modules/doiuse/data/features/mdn-css-unicode-bidi-isolate-override.js @@ -0,0 +1,3 @@ +export default { + 'unicode-bidi': 'isolate-override', +}; diff --git a/node_modules/doiuse/data/features/mdn-css-unicode-bidi-isolate.js b/node_modules/doiuse/data/features/mdn-css-unicode-bidi-isolate.js new file mode 100644 index 00000000..84039895 --- /dev/null +++ b/node_modules/doiuse/data/features/mdn-css-unicode-bidi-isolate.js @@ -0,0 +1,3 @@ +export default { + 'unicode-bidi': 'isolate', +}; diff --git a/node_modules/doiuse/data/features/mdn-css-unicode-bidi-plaintext.js b/node_modules/doiuse/data/features/mdn-css-unicode-bidi-plaintext.js new file mode 100644 index 00000000..7850a81d --- /dev/null +++ b/node_modules/doiuse/data/features/mdn-css-unicode-bidi-plaintext.js @@ -0,0 +1,3 @@ +export default { + 'unicode-bidi': 'plaintext', +}; diff --git a/node_modules/doiuse/data/features/mdn-text-decoration-color.js b/node_modules/doiuse/data/features/mdn-text-decoration-color.js new file mode 100644 index 00000000..cc6cf839 --- /dev/null +++ b/node_modules/doiuse/data/features/mdn-text-decoration-color.js @@ -0,0 +1,3 @@ +export default { + 'text-decoration-color': true, +}; diff --git a/node_modules/doiuse/data/features/mdn-text-decoration-line.js b/node_modules/doiuse/data/features/mdn-text-decoration-line.js new file mode 100644 index 00000000..45ad538d --- /dev/null +++ b/node_modules/doiuse/data/features/mdn-text-decoration-line.js @@ -0,0 +1,3 @@ +export default { + 'text-decoration-line': true, +}; diff --git a/node_modules/doiuse/data/features/mdn-text-decoration-shorthand.js b/node_modules/doiuse/data/features/mdn-text-decoration-shorthand.js new file mode 100644 index 00000000..791f6067 --- /dev/null +++ b/node_modules/doiuse/data/features/mdn-text-decoration-shorthand.js @@ -0,0 +1,3 @@ +export default { + 'text-decoration': true, +}; diff --git a/node_modules/doiuse/data/features/mdn-text-decoration-style.js b/node_modules/doiuse/data/features/mdn-text-decoration-style.js new file mode 100644 index 00000000..5c1142c2 --- /dev/null +++ b/node_modules/doiuse/data/features/mdn-text-decoration-style.js @@ -0,0 +1,3 @@ +export default { + 'text-decoration-style': true, +}; diff --git a/node_modules/doiuse/data/features/minmaxwh.js b/node_modules/doiuse/data/features/minmaxwh.js new file mode 100644 index 00000000..4b6ab356 --- /dev/null +++ b/node_modules/doiuse/data/features/minmaxwh.js @@ -0,0 +1,6 @@ +export default { + 'min-width': true, + 'max-width': true, + 'min-height': true, + 'max-height': true, +}; diff --git a/node_modules/doiuse/data/features/multibackgrounds.js b/node_modules/doiuse/data/features/multibackgrounds.js new file mode 100644 index 00000000..6ff70435 --- /dev/null +++ b/node_modules/doiuse/data/features/multibackgrounds.js @@ -0,0 +1,11 @@ +import { list } from 'postcss'; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +export default (rule) => { + if (rule.type !== 'decl') return false; + if (!/^background-?/.test(rule.prop)) return false; + return list.comma(rule.value).length > 1; +}; diff --git a/node_modules/doiuse/data/features/multicolumn.js b/node_modules/doiuse/data/features/multicolumn.js new file mode 100644 index 00000000..3d2efc7c --- /dev/null +++ b/node_modules/doiuse/data/features/multicolumn.js @@ -0,0 +1,15 @@ +export default { + 'columns': true, + 'column-width': true, + 'column-gap': true, + 'column-rule': true, + 'column-rule-color': true, + 'column-rule-width': true, + 'column-count': true, + 'column-rule-style': true, + 'column-span': true, + 'column-fill': true, + 'break-before': true, + 'break-after': true, + 'break-inside': true, +}; diff --git a/node_modules/doiuse/data/features/object-fit.js b/node_modules/doiuse/data/features/object-fit.js new file mode 100644 index 00000000..44c59b2f --- /dev/null +++ b/node_modules/doiuse/data/features/object-fit.js @@ -0,0 +1,4 @@ +export default { + 'object-fit': true, + 'object-position': true, +}; diff --git a/node_modules/doiuse/data/features/outline.js b/node_modules/doiuse/data/features/outline.js new file mode 100644 index 00000000..17e62061 --- /dev/null +++ b/node_modules/doiuse/data/features/outline.js @@ -0,0 +1,6 @@ +export default { + 'outline': true, + 'outline-style': true, + 'outline-width': true, + 'outline-color': true, +}; diff --git a/node_modules/doiuse/data/features/pointer-events.js b/node_modules/doiuse/data/features/pointer-events.js new file mode 100644 index 00000000..15492e04 --- /dev/null +++ b/node_modules/doiuse/data/features/pointer-events.js @@ -0,0 +1,3 @@ +export default { + 'pointer-events': true, +}; diff --git a/node_modules/doiuse/data/features/pointer.js b/node_modules/doiuse/data/features/pointer.js new file mode 100644 index 00000000..fe8ccc57 --- /dev/null +++ b/node_modules/doiuse/data/features/pointer.js @@ -0,0 +1,3 @@ +export default { + 'touch-action': true, +}; diff --git a/node_modules/doiuse/data/features/prefers-color-scheme.js b/node_modules/doiuse/data/features/prefers-color-scheme.js new file mode 100644 index 00000000..3886efa3 --- /dev/null +++ b/node_modules/doiuse/data/features/prefers-color-scheme.js @@ -0,0 +1,12 @@ +/** + * prefers-color-scheme media query + * Media query to detect if the user has set their system to use a light or dark color theme. + * @see https://caniuse.com/prefers-color-scheme + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('media', 'prefers-color-scheme'); diff --git a/node_modules/doiuse/data/features/prefers-reduced-motion.js b/node_modules/doiuse/data/features/prefers-reduced-motion.js new file mode 100644 index 00000000..80246beb --- /dev/null +++ b/node_modules/doiuse/data/features/prefers-reduced-motion.js @@ -0,0 +1,13 @@ +/** + * TODO: initially implement feature + * prefers-reduced-motion media query + * CSS media query based on a user preference for preferring reduced motion (animation, etc). + * @see https://caniuse.com/prefers-reduced-motion + */ + +import { checkAtRule } from '../../utils/util.js'; + +/** + * @type {import('../features').Feature} + */ +export default checkAtRule('media', 'prefers-reduced-motion'); diff --git a/node_modules/doiuse/data/features/rem.js b/node_modules/doiuse/data/features/rem.js new file mode 100644 index 00000000..4fd69c35 --- /dev/null +++ b/node_modules/doiuse/data/features/rem.js @@ -0,0 +1,3 @@ +import { checkCSSLengthUnits } from '../../utils/util.js'; + +export default checkCSSLengthUnits('rem'); diff --git a/node_modules/doiuse/data/features/run-in.js b/node_modules/doiuse/data/features/run-in.js new file mode 100644 index 00000000..188909b0 --- /dev/null +++ b/node_modules/doiuse/data/features/run-in.js @@ -0,0 +1,12 @@ +/** + * display: run-in + * If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. + * @see https://caniuse.com/run-in + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'display': 'run-in', +}; diff --git a/node_modules/doiuse/data/features/style-scoped.js b/node_modules/doiuse/data/features/style-scoped.js new file mode 100644 index 00000000..667e7b52 --- /dev/null +++ b/node_modules/doiuse/data/features/style-scoped.js @@ -0,0 +1,12 @@ +/** + * Scoped CSS + * Allows CSS rules to be scoped to part of the document, based on the position of the style element. The attribute has been [removed from the current specification](https://github.com/whatwg/html/issues/552). + * @see https://caniuse.com/style-scoped + */ + +/** + * @type {import('../features').Feature} + */ +export default {}; + +/* this feature appears in HTML, so we don't lint it */ diff --git a/node_modules/doiuse/data/features/svg-css.js b/node_modules/doiuse/data/features/svg-css.js new file mode 100644 index 00000000..8b2039a6 --- /dev/null +++ b/node_modules/doiuse/data/features/svg-css.js @@ -0,0 +1,19 @@ +/** + * SVG in CSS backgrounds + * Method of using SVG images as CSS backgrounds + * @see https://caniuse.com/svg-css + */ + +/** + * @type {import('../features').Feature} + */ +export default (rule) => { + if (rule.type !== 'decl') return false; + if (/url\([\S\s]*svg/g.test( + rule.toString(), + )) { + return true; + } + + return false; +}; diff --git a/node_modules/doiuse/data/features/text-decoration.js b/node_modules/doiuse/data/features/text-decoration.js new file mode 100644 index 00000000..5b97b3a5 --- /dev/null +++ b/node_modules/doiuse/data/features/text-decoration.js @@ -0,0 +1,9 @@ +export default { + 'text-decoration-style': true, + 'text-decoration-line': true, + 'text-decoration-color': true, + 'text-decoration': /\w \w/, + 'text-decoration-thickness': true, + 'text-decoration-skip': true, + 'text-decoration-skip-ink': true, +}; diff --git a/node_modules/doiuse/data/features/text-emphasis.js b/node_modules/doiuse/data/features/text-emphasis.js new file mode 100644 index 00000000..8bd63742 --- /dev/null +++ b/node_modules/doiuse/data/features/text-emphasis.js @@ -0,0 +1,15 @@ +/** + * text-emphasis styling + * Method of using small symbols next to each glyph to emphasize a run of text, commonly used in East Asian languages. The `text-emphasis` shorthand, and its `text-emphasis-style` and `text-emphasis-color` longhands, can be used to apply marks to the text. The `text-emphasis-position` property, which inherits separately, allows setting the emphasis marks' position with respect to the text. + * @see https://caniuse.com/text-emphasis + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'text-emphasis': true, + 'text-emphasis-style': true, + 'text-emphasis-color': true, + 'text-emphasis-position': true, +}; diff --git a/node_modules/doiuse/data/features/text-overflow.js b/node_modules/doiuse/data/features/text-overflow.js new file mode 100644 index 00000000..faf236ea --- /dev/null +++ b/node_modules/doiuse/data/features/text-overflow.js @@ -0,0 +1,3 @@ +export default { + 'text-overflow': true, +}; diff --git a/node_modules/doiuse/data/features/text-size-adjust.js b/node_modules/doiuse/data/features/text-size-adjust.js new file mode 100644 index 00000000..828e27fb --- /dev/null +++ b/node_modules/doiuse/data/features/text-size-adjust.js @@ -0,0 +1,3 @@ +export default { + 'text-size-adjust': true, +}; diff --git a/node_modules/doiuse/data/features/text-stroke.js b/node_modules/doiuse/data/features/text-stroke.js new file mode 100644 index 00000000..82e489b1 --- /dev/null +++ b/node_modules/doiuse/data/features/text-stroke.js @@ -0,0 +1,15 @@ +/** + * CSS text-stroke and text-fill + * Method of declaring the outline (stroke) width and color for text. + * @see https://caniuse.com/text-stroke + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'text-stroke-color': true, + 'text-stroke-width': true, + 'text-stroke': true, + 'text-fill-color': true, +}; diff --git a/node_modules/doiuse/data/features/transforms2d.js b/node_modules/doiuse/data/features/transforms2d.js new file mode 100644 index 00000000..32f0dc6c --- /dev/null +++ b/node_modules/doiuse/data/features/transforms2d.js @@ -0,0 +1,4 @@ +export default { + 'transform': true, + 'transform-origin': true, +}; diff --git a/node_modules/doiuse/data/features/transforms3d.js b/node_modules/doiuse/data/features/transforms3d.js new file mode 100644 index 00000000..8f90cf6b --- /dev/null +++ b/node_modules/doiuse/data/features/transforms3d.js @@ -0,0 +1,7 @@ +export default { + 'perspective': true, + 'perspective-origin': true, + 'transform-style': true, + 'backface-visibility': true, + 'transform': '3d', +}; diff --git a/node_modules/doiuse/data/features/ttf.js b/node_modules/doiuse/data/features/ttf.js new file mode 100644 index 00000000..19f7687e --- /dev/null +++ b/node_modules/doiuse/data/features/ttf.js @@ -0,0 +1,20 @@ +/** + * TTF/OTF - TrueType and OpenType font support + * Support for the TrueType (.ttf) and OpenType (.otf) outline font formats in @font-face. + * @see https://caniuse.com/ttf + */ + +/** + * @type {import('../features').Feature} + */ +export default (rule) => { + const ruleText = rule.toString(); + + if (ruleText.includes('@font-face') && ( + (ruleText.includes('.ttf') || ruleText.includes('.otf')) + )) { + return true; + } + + return false; +}; diff --git a/node_modules/doiuse/data/features/user-select-none.js b/node_modules/doiuse/data/features/user-select-none.js new file mode 100644 index 00000000..880da5df --- /dev/null +++ b/node_modules/doiuse/data/features/user-select-none.js @@ -0,0 +1,3 @@ +export default { + 'user-select': true, +}; diff --git a/node_modules/doiuse/data/features/variable-fonts.js b/node_modules/doiuse/data/features/variable-fonts.js new file mode 100644 index 00000000..461bde8c --- /dev/null +++ b/node_modules/doiuse/data/features/variable-fonts.js @@ -0,0 +1,12 @@ +/** + * Variable fonts + * OpenType font settings that allows a single font file to behave like multiple fonts: it can contain all the allowed variations in width, weight, slant, optical size, or any other exposed axes of variation as defined by the font designer. Variations can be applied via the `font-variation-settings` property. + * @see https://caniuse.com/variable-fonts + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'font-variation-settings': true, +}; diff --git a/node_modules/doiuse/data/features/viewport-unit-variants.js b/node_modules/doiuse/data/features/viewport-unit-variants.js new file mode 100644 index 00000000..330df5df --- /dev/null +++ b/node_modules/doiuse/data/features/viewport-unit-variants.js @@ -0,0 +1,43 @@ +import { checkCSSLengthUnits } from '../../utils/util.js'; + +/** + * Small, Large, and Dynamic viewport units + * Viewport units similar to `vw` and `vh` that are based on shown or hidden + * browser UI states to address shortcomings of the original units. Currently + * defined as the + * `sv*` units (`svb`, `svh`, `svi`, `svmax`, `svmin`, `svw`), + * `lv*` units (`lvb`, `lvh`, `lvi`, `lvmax`, `lvmin`, `lvw`), + * `dv*` units (`dvb`, `dvh`, `dvi`, `dvmax`, `dvmin`, `dvw`) + * and the logical `vi`/`vb` units. + * @see https://caniuse.com/viewport-unit-variants + * @type {import('../features').Feature} + */ +export default checkCSSLengthUnits( + /* sv* units */ + 'svb', + 'svh', + 'svi', + 'svmax', + 'svmin', + 'svw', + + /* lv* units */ + 'lvb', + 'lvh', + 'lvi', + 'lvmax', + 'lvmin', + 'lvw', + + /* dv* units */ + 'dvb', + 'dvh', + 'dvi', + 'dvmax', + 'dvmin', + 'dvw', + + /* vi/vb units */ + 'vi', + 'vb', +); diff --git a/node_modules/doiuse/data/features/viewport-units.js b/node_modules/doiuse/data/features/viewport-units.js new file mode 100644 index 00000000..fe8b79a8 --- /dev/null +++ b/node_modules/doiuse/data/features/viewport-units.js @@ -0,0 +1,8 @@ +export default { + '': [ + 'vw', + 'vh', + 'vmin', + 'vmax', + ], +}; diff --git a/node_modules/doiuse/data/features/webkit-user-drag.js b/node_modules/doiuse/data/features/webkit-user-drag.js new file mode 100644 index 00000000..a695919a --- /dev/null +++ b/node_modules/doiuse/data/features/webkit-user-drag.js @@ -0,0 +1,12 @@ +/** + * CSS -webkit-user-drag property + * The non-standard `-webkit-user-drag` CSS property can be used to either make an element draggable or explicitly non-draggable (like links and images). See the standardized [draggable attribute/property](/mdn-api_htmlelement_draggable) for the recommended alternative method of accomplishing the same functionality. + * @see https://caniuse.com/webkit-user-drag + */ + +/** + * @type {import('../features').Feature} + */ +export default { + 'webkit-user-drag': true, +}; diff --git a/node_modules/doiuse/data/features/will-change.js b/node_modules/doiuse/data/features/will-change.js new file mode 100644 index 00000000..042ef87b --- /dev/null +++ b/node_modules/doiuse/data/features/will-change.js @@ -0,0 +1,3 @@ +export default { + 'will-change': true, +}; diff --git a/node_modules/doiuse/data/features/word-break.js b/node_modules/doiuse/data/features/word-break.js new file mode 100644 index 00000000..731e6be0 --- /dev/null +++ b/node_modules/doiuse/data/features/word-break.js @@ -0,0 +1,3 @@ +export default { + 'word-break': true, +}; diff --git a/node_modules/doiuse/data/features/wordwrap.js b/node_modules/doiuse/data/features/wordwrap.js new file mode 100644 index 00000000..b90e17f1 --- /dev/null +++ b/node_modules/doiuse/data/features/wordwrap.js @@ -0,0 +1,4 @@ +export default { + 'overflow-wrap': true, + 'word-wrap': true, +}; diff --git a/node_modules/doiuse/exports/index.cjs b/node_modules/doiuse/exports/index.cjs new file mode 100644 index 00000000..34cabe3a --- /dev/null +++ b/node_modules/doiuse/exports/index.cjs @@ -0,0 +1,2901 @@ +'use strict'; + +var multimatch = require('multimatch'); +var browserslist = require('browserslist'); +var caniuse = require('caniuse-lite'); +var postcss = require('postcss'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} + +var multimatch__default = /*#__PURE__*/_interopDefaultLegacy(multimatch); +var browserslist__default = /*#__PURE__*/_interopDefaultLegacy(browserslist); +var caniuse__namespace = /*#__PURE__*/_interopNamespace(caniuse); + +/** + * No description available. + * + * See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Alternate+stylesheet + */ + +// This feature is only in HTML, so we don't lint it + +/** + * @type {import('../features').Feature} + */ +var alternateStylesheet = {}; + +/** + * Method of defining how a background image is attached to a scrollable element. Values include `scroll` (default), `fixed` and `local`. + * + * See: https://caniuse.com/background-attachment + */ + +/** + * @type {import('../features').Feature} + */ +var backgroundAttachment = { + 'background-attachment': [ + 'fixed', + 'local', + ], +}; + +/** + * Non-standard method of clipping a background image to the foreground text. + * + * See: https://caniuse.com/background-clip-text + */ + +/** + * @type {import('../features').Feature} + */ +var backgroundClipText = { + 'background-clip': 'text', + '-webkit-background-clip': 'text', +}; + +var backgroundImgOpts = { + 'background-clip': true, + 'background-origin': true, + 'background-size': true, +}; + +var backgroundPositionXY = { + 'background-position-x': true, + 'background-position-y': true, +}; + +/** + * Allows CSS background images to be repeated without clipping. + * + * See: https://caniuse.com/background-repeat-round-space + */ + +/** + * @type {import('../features').Feature} + */ +var backgroundRepeatRoundSpace = { + 'background-repeat': ['round', 'space'], +}; + +var borderImage = { + 'border-image': true, + 'border-image-outset': true, + 'border-image-repeat': true, + 'border-image-slice': true, + 'border-image-source': true, + 'border-image-width': true, + +}; + +var borderRadius = { + 'border-radius': true, + 'border-top-left-radius': true, + 'border-top-right-radius': true, + 'border-bottom-right-radius': true, + 'border-bottom-left-radius': true, +}; + +var calc = { + '': 'calc(', +}; + +/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */ + +/** + * @param {string} browserKey + * @param {string[]} [versions] + * @return {string} + */ +function formatBrowserName(browserKey, versions) { + const entry = caniuse.agents[browserKey]; + const browserName = entry ? entry.browser : null; + if (!versions) { + return browserName || ''; + } + return (`${browserName} (${versions.join(',')})`); +} + +/** + * + * @param {FeatureCheck|FeatureCheck[]} check + * @param {?string|undefined} candidate + */ +function performFeatureCheck(check, candidate) { + if (check == null || candidate == null) return false; + if (check instanceof RegExp) { + return check.test(candidate); + } + switch (typeof check) { + case 'string': + return candidate.includes(check); + case 'function': + return check(candidate); + case 'boolean': + return check; + case 'object': + if (Array.isArray(check)) { + return check.some((c) => performFeatureCheck(c, candidate)); + } + // Fallthrough + default: + console.error(check); + throw new TypeError(`Unexpected feature check: ${check}`); + } +} + +/** + * @param {FeatureCheck|FeatureCheck[]} selector + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +function checkSelector(selector) { + return (rule) => rule.type === 'rule' + && performFeatureCheck(selector, rule.selector); +} + +/** + * @param {FeatureCheck|FeatureCheck[]} [name] + * @param {FeatureCheck|FeatureCheck[]} [parameters] + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +function checkAtRule(name, parameters) { + return (rule) => rule.type === 'atrule' + && performFeatureCheck(name, rule.name) + && (!parameters || performFeatureCheck(parameters, rule.params)); +} + +/** + * @see https://drafts.csswg.org/css-values/#lengths + * @see https://drafts.csswg.org/css-values/#number-value + * @param {string[]} units + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +function checkCSSLengthUnits(...units) { + const regexp = new RegExp(`(\\+-)?[\\d.]*\\.?\\d+(e(\\+-)?\\d+)?(${units.join('|')})`, 'i'); + return (rule) => ( + (rule.type === 'decl') ? performFeatureCheck(regexp, rule.value) + : ((rule.type === 'atrule') ? performFeatureCheck(regexp, rule.params) + : false)); +} + +/** + * Unit representing the width of the character "0" in the current font, of particular use in combination with monospace fonts. + * @see https://caniuse.com/ch-unit + * @type {import('../features').Feature} + */ +var chUnit = checkCSSLengthUnits('ch'); + +var cssAll = { + 'all': true, +}; + +var cssAnimation = { + 'animation': true, + 'animation-name': true, + 'animation-duration': true, + 'animation-timing-function': true, + 'animation-iteration-count': true, + 'animation-direction': true, + 'animation-play-state': true, + 'animation-delay': true, + 'animation-fill-mode': true, +}; + +// @keyframes isn't checked for, but if you try to use it, +// you'll still get a warning anyway because of the 'animation' property + +var cssAnyLink = checkSelector([':any-link', ':-webkit-any-link']); + +var cssAppearance = { + 'appearance': true, + '-webkit-appearance': true, + '-moz-appearance': true, +}; + +var cssAtCounterStyle = checkAtRule('counter-style'); + +var cssAutofill = checkSelector([':autofill', ':-webkit-autofill']); + +var cssBackdropFilter = { + 'backdrop-filter': true, +}; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +var cssBackgroundOffsets = (rule) => { + if (rule.type !== 'decl') return false; + if (rule.prop !== 'background-position') return false; + return postcss.list.space(rule.value).length > 2; +}; + +var cssBackgroundblendmode = { + 'background-blend-mode': true, +}; + +/** + * Controls whether the box's margins, borders, padding, and other decorations wrap the broken edges of the box fragments (when the box is split by a break (page/column/region/line). + * + * See: https://caniuse.com/css-boxdecorationbreak + */ + +/** + * @type {import('../features').Feature} + */ +var cssBoxdecorationbreak = { + 'box-decoration-break': true, + '-webkit-box-decoration-break': true, +}; + +var cssBoxshadow = { + 'box-shadow': true, +}; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +var cssCanvas = (rule) => { + if (rule.type !== 'decl') return false; + if (!rule.prop.startsWith('background')) return false; + return rule.value.startsWith('-webkit-canvas'); +}; + +/** + * The `caret-color` property allows the color to be set of the caret (blinking text insertion pointer) in an editable text area. + * + * See: https://caniuse.com/css-caret-color + */ + +/** + * @type {import('../features').Feature} + */ +var cssCaretColor = { + 'caret-color': true, +}; + +/** + * The `@layer` at-rule allows authors to explicitly layer their styles in the cascade, before specificity and order of appearance are considered. + * + * See: https://caniuse.com/css-cascade-layers + */ + +/** + * @type {import('../features').Feature} + */ +var cssCascadeLayers = checkAtRule('layer'); + +/** + * Including an `i` before the `]` in a CSS attribute selector causes the attribute value to be matched in an ASCII-case-insensitive manner. For example, `[b="xyz" i]` would match both `<a b="xyz">` and `<a b="XYZ">`. + * + * See: https://caniuse.com/css-case-insensitive + */ + +/** + * @type {import('../features').Feature} + */ +var cssCaseInsensitive = (rule) => { + if (rule.type !== 'rule') { return false; } + if (/\[.*i]/.test(rule.selector)) { return true; } + return false; +}; + +var cssClipPath = { + 'clip-path': true, +}; + +/** + * The `print-color-adjust` (or `-webkit-print-color-adjust` as prefixed in WebKit/Blink browsers) property is a CSS extension that can be used to force printing of background colors and images. + * + * See: https://caniuse.com/css-color-adjust + */ + +/** + * @type {import('../features').Feature} + */ +var cssColorAdjust = { + 'print-color-adjust': true, + '-webkit-print-color-adjust': true, +}; + +/** + * The CSS `color()` function allows the browser to display colors in any color space, such as the P3 color space which can display colors outside of the default sRGB color space. + * + * See: https://caniuse.com/css-color-function + */ + +/** + * @type {import('../features').Feature} + */ +var cssColorFunction = { + '': 'color(', +}; + +const REGEX$2 = /(^|[^-])(repeating-)?conic-gradient/; + +var cssConicGradients = { + 'background': REGEX$2, + 'background-image': REGEX$2, + 'border-image': REGEX$2, + 'border-image-source': REGEX$2, + 'content': REGEX$2, + 'cursor': REGEX$2, + 'list-style': REGEX$2, + 'list-style-image': REGEX$2, +}; + +/** + * Size queries in Container Queries provide a way to query the size of a container, and conditionally apply CSS to the content of that container. + * + * See: https://caniuse.com/css-container-queries + */ + +/** + * @type {import('../features').Feature} + */ +var cssContainerQueries = checkAtRule('container'); + +var cssContainerQueriesStyle = checkAtRule('container', 'style('); + +var cssContainerQueryUnits = checkCSSLengthUnits( + 'cqw', + 'cqh', + 'cqi', + 'cqb', + 'cqmin', + 'cqmax', +); + +/** + * The CSS `contain` property lets developers limit the scope of the browser's styles, layout and paint work for faster and more efficient rendering. + * + * See: https://caniuse.com/css-containment + */ + +/** + * @type {import('../features').Feature} + */ +var cssContainment = { + 'contain': true, +}; + +/** + * Provides control over when elements are rendered, so rendering can be skipped for elements not yet in the user's viewport. + * + * See: https://caniuse.com/css-content-visibility + */ + +/** + * @type {import('../features').Feature} + */ +var cssContentVisibility = { + 'content-visibility': true, +}; + +var cssCounters = { + 'counter-reset': true, + 'counter-increment': true, + '': 'counter(', +}; + +/** + * Scales images with an algorithm that preserves edges and contrast, without smoothing colors or introducing blur. This is intended for images such as pixel art. Official values that accomplish this for the `image-rendering` property are `crisp-edges` and `pixelated`. + * + * See: https://caniuse.com/css-crisp-edges + */ + +/** + * @type {import('../features').Feature} + */ +var cssCrispEdges = { + 'image-rendering': ['crisp-edges', 'pixelated'], +}; + +/** + * Image function to create a "crossfade" between images. This allows one image to transition (fade) into another based on a percentage value. + * + * See: https://caniuse.com/css-cross-fade + */ + +/** + * @type {import('../features').Feature} + */ +var cssCrossFade = { + '': [ + 'cross-fade(', + '-webkit-cross-fade(', + ], +}; + +/** + * The `:default` pseudo-class matches checkboxes and radio buttons which are checked by default, `<option>`s with the `selected` attribute, and the default submit button (if any) of a form. + * + * See: https://caniuse.com/css-default-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssDefaultPseudo = checkSelector(':default'); + +/** + * An explicit, non-whitespace spelling of the descendant combinator. `A >> B` is equivalent to `A B`. + * + * See: https://caniuse.com/css-descendant-gtgt + */ + +/** + * @type {import('../features').Feature} + */ +var cssDescendantGtgt = checkSelector('>>'); + +/** + * Method of overriding the size of viewport in web page using the `@viewport` rule, replacing Apple's own popular `<meta>` viewport implementation. Includes the `extend-to-zoom` width value. + * + * See: https://caniuse.com/css-deviceadaptation + */ + +/** + * @type {import('../features').Feature} + */ +var cssDeviceadaptation = checkAtRule('viewport'); + +/** + * Matches elements based on their directionality. `:dir(ltr)` matches elements which are Left-to-Right. `:dir(rtl)` matches elements which are Right-to-Left. + * + * See: https://caniuse.com/css-dir-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssDirPseudo = checkSelector(':dir('); + +/** + * `display: contents` causes an element's children to appear as if they were direct children of the element's parent, ignoring the element itself. This can be useful when a wrapper element should be ignored when using CSS grid or similar layout techniques. + * + * See: https://caniuse.com/css-display-contents + */ + +/** + * @type {import('../features').Feature} + */ +var cssDisplayContents = { + 'display': 'contents', +}; + +/** + * This function renders a live image generated from an arbitrary HTML element + * + * See: https://caniuse.com/css-element-function + */ + +/** + * @type {import('../features').Feature} + */ +var cssElementFunction = { + '': 'element(', +}; + +var cssEnvFunction = { + '': 'env(', +}; + +/** + * Exclusions defines how inline content flows around elements. It extends the content wrapping ability of floats to any block-level element. + * + * See: https://caniuse.com/css-exclusions + */ + +/** + * @type {import('../features').Feature} + */ +var cssExclusions = { + 'wrap-flow': true, + '-ms-wrap-flow': true, +}; + +var cssFeaturequeries = checkAtRule(['supports']); + +/** + * No description available. + * + * See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=::file-selector-button+CSS+pseudo-element + */ + +/** + * @type {import('../features').Feature} + */ +var cssFileSelectorButton = checkSelector(':file-selector-button'); + +/** + * This function filters a CSS input image with a set of filter functions (like blur, grayscale or hue) + * + * See: https://caniuse.com/css-filter-function + */ + +/** + * @type {import('../features').Feature} + */ +var cssFilterFunction = { + '': 'filter(', +}; + +var cssFilters = { + 'filter': true, +}; + +/** + * CSS pseudo-element that allows styling only the first "letter" of text within an element. Useful for implementing initial caps or drop caps styling. + * + * See: https://caniuse.com/css-first-letter + */ + +/** + * @type {import('../features').Feature} + */ +var cssFirstLetter = checkSelector(':first-letter'); + +/** + * Allows styling specifically for the first line of text using the `::first-line` pseudo-element. Note that only a limited set of properties can be applied. + * + * See: https://caniuse.com/css-first-line + */ + +/** + * @type {import('../features').Feature} + */ +var cssFirstLine = checkSelector(':first-line'); + +var cssFixed = { + 'position': 'fixed', +}; + +/** + * The `:focus-visible` pseudo-class applies while an element matches the `:focus` pseudo-class, and the UA determines via heuristics that the focus should be specially indicated on the element (typically via a “focus ring”). + * + * See: https://caniuse.com/css-focus-visible + */ + +/** + * @type {import('../features').Feature} + */ +var cssFocusVisible = checkSelector(':focus-visible'); + +/** + * The `:focus-within` pseudo-class matches elements that either themselves match `:focus` or that have descendants which match `:focus`. + * + * See: https://caniuse.com/css-focus-within + */ + +/** + * @type {import('../features').Feature} + */ +var cssFocusWithin = checkSelector(':focus-within'); + +var cssFontPalette = [ + (rule) => performFeatureCheck('font-palette', rule.name), + checkAtRule('font-palette-values'), +]; + +/** + * `@font-face` descriptor `font-display` that allows control over how a downloadable font renders before it is fully loaded. + * + * See: https://caniuse.com/css-font-rendering-controls + */ + +/** + * @type {import('../features').Feature} + */ +var cssFontRenderingControls = { + 'font-display': true, +}; + +var cssFontStretch = { + 'font-stretch': true, +}; + +var cssGencontent = checkSelector([':before', ':after']); + +const REGEX$1 = /(^|[^-])((linear)|(radial))-gradient/; + +var cssGradients = { + 'background': REGEX$1, + 'background-image': REGEX$1, + 'border-image': REGEX$1, + 'border-image-source': REGEX$1, + 'content': REGEX$1, + 'cursor': REGEX$1, + 'list-style': REGEX$1, + 'list-style-image': REGEX$1, +}; + +/** @see https://drafts.csswg.org/css-grid/ */ + +var cssGrid = { + 'display': ['grid', 'inline-grid', '-ms-grid'], + 'grid': true, + 'grid-area': true, + 'grid-auto-columns': true, + + 'grid-auto-flow': true, + 'grid-auto-rows': true, + 'grid-column': true, + 'grid-column-end': true, + + 'grid-column-start': true, + 'grid-row': true, + 'grid-row-end': true, + 'grid-row-start': true, + + 'grid-template': true, + 'grid-template-areas': true, + 'grid-template-columns': true, + 'grid-template-rows': true, +}; + +const REGEX = /grid/; + +var cssGridAnimation = { + 'transition': REGEX, + 'transition-property': REGEX, +}; + +/** + * Allows some punctuation characters from start (or the end) of text elements to be placed "outside" of the box in order to preserve the reading flow. + * @see https://caniuse.com/css-hanging-punctuation + */ + +/** + * @type {import('../features').Feature} + */ +var cssHangingPunctuation = { + 'hanging-punctuation': true, +}; + +/** + * Select elements containing specific content. For example, `a:has(img)` selects all `<a>` elements that contain an `<img>` child. + * @see https://caniuse.com/css-has + */ + +/** + * @type {import('../features').Feature} + */ +var cssHas = checkSelector(':has'); + +var cssHyphens = { + 'hyphens': true, +}; + +var cssImageOrientation = { + 'image-orientation': true, +}; + +/** + * Method of letting the browser pick the most appropriate CSS image from a given set. + * @see https://caniuse.com/css-image-set + */ + +/** + * @type {import('../features').Feature} + */ +var cssImageSet = { + '': 'image-set(', +}; + +/** + * If a temporal or number `<input>` has `max` and/or `min` attributes, then `:in-range` matches when the value is within the specified range and `:out-of-range` matches when the value is outside the specified range. If there are no range constraints, then neither pseudo-class matches. + * @see https://caniuse.com/css-in-out-of-range + */ + +/** + * @type {import('../features').Feature} + */ +var cssInOutOfRange = checkSelector([ + ':in-range', + ':out-of-range', +]); + +/** + * The `:indeterminate` pseudo-class matches indeterminate checkboxes, indeterminate `<progress>` bars, and radio buttons with no checked button in their radio button group. + * @see https://caniuse.com/css-indeterminate-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssIndeterminatePseudo = checkSelector(':indeterminate'); + +/** + * Method of creating an enlarged cap, including a drop or raised cap, in a robust way. + * @see https://caniuse.com/css-initial-letter + */ + +/** + * @type {import('../features').Feature} + */ +var cssInitialLetter = { + 'initial-letter': true, +}; + +var cssInitialValue = { + '': 'initial', +}; + +/** + * The `lch()` and `lab()` color functions are based on the CIE LAB color space, representing colors in a way that closely matches human perception and provides access to a wider spectrum of colors than offered by the usual RGB color space. + * @see https://caniuse.com/css-lch-lab + */ + +/** + * @type {import('../features').Feature} + */ +var cssLchLab = { + '': [ + 'lch(', + 'lab(', + ], +}; + +/** + * Controls spacing between characters of text (i.e. "tracking" in typographical terms). Not to be confused with kerning. + * @see https://caniuse.com/css-letter-spacing + */ + +/** + * @type {import('../features').Feature} + */ +var cssLetterSpacing = { + 'letter-spacing': true, +}; + +/** + * CSS property that will contain text to a given amount of lines when used in combination with `display: -webkit-box`. It will end with ellipsis when `text-overflow: ellipsis` is included. + * @see https://caniuse.com/css-line-clamp + */ + +/** + * @type {import('../features').Feature} + */ +var cssLineClamp = { + 'line-clamp': true, + '-webkit-line-clamp': true, +}; + +var cssLogicalProps = { + 'block-size': true, + 'inline-size': true, + 'min-block-size': true, + 'min-inline-size': true, + 'max-block-size': true, + 'max-inline-size': true, + 'margin-block-start': true, + 'margin-block-end': true, + 'margin-inline-start': true, + 'margin-inline-end': true, + 'margin-block': true, + 'margin-inline': true, + 'inset-block-start': true, + 'inset-block-end': true, + 'inset-inline-start': true, + 'inset-inline-end': true, + 'inset-block': true, + 'inset-inline': true, + 'inset': true, + 'padding-block-start': true, + 'padding-block-end': true, + 'padding-inline-start': true, + 'padding-inline-end': true, + 'padding-block': true, + 'padding-inline': true, + 'border-block-start-width': true, + 'border-block-end-width': true, + 'border-inline-start-width': true, + 'border-inline-end-width': true, + 'border-block-width': true, + 'border-inline-width': true, + 'border-block-start-style': true, + 'border-block-end-style': true, + 'border-inline-start-style': true, + 'border-inline-end-style': true, + 'border-block-style': true, + 'border-inline-style': true, + 'border-block-start-color': true, + 'border-block-end-color': true, + 'border-inline-start-color': true, + 'border-inline-end-color': true, + 'border-block-color': true, + 'border-inline-color': true, + 'border-block-start': true, + 'border-block-end': true, + 'border-inline-start': true, + 'border-inline-end': true, + 'border-block': true, + 'border-inline': true, + 'border-start-start-radius': true, + 'border-start-end-radius': true, + 'border-end-start-radius': true, + 'border-end-end-radius': true, + 'text-align': ['start', 'end'], + 'float': ['inline-start', 'inline-end'], + 'resize': ['block', 'inline'], + 'overflow-block': true, + 'overflow-inline': true, +}; + +/** + * The `::marker` pseudo-element allows list item markers to be styled or have their content value customized. + * @see https://caniuse.com/css-marker-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssMarkerPseudo = checkSelector(':marker'); + +var cssMasks = { + 'clip-path': true, + 'mask': true, + 'mask-border': true, + 'mask-border-mode': true, + 'mask-border-outset': true, + 'mask-border-repeat': true, + 'mask-border-slice': true, + 'mask-border-source': true, + 'mask-border-width': true, + 'mask-clip': true, + 'mask-composite': true, + 'mask-image': true, + 'mask-mode': true, + 'mask-origin': true, + 'mask-position': true, + 'mask-repeat': true, + 'mask-size': true, + 'mask-type': true, + // and webkit versions + '-webkit-clip-path': true, + '-webkit-mask': true, + '-webkit-mask-border': true, + '-webkit-mask-border-mode': true, + '-webkit-mask-border-outset': true, + '-webkit-mask-border-repeat': true, + '-webkit-mask-border-slice': true, + '-webkit-mask-border-source': true, + '-webkit-mask-border-width': true, + '-webkit-mask-clip': true, + '-webkit-mask-composite': true, + '-webkit-mask-image': true, + '-webkit-mask-mode': true, + '-webkit-mask-origin': true, + '-webkit-mask-position': true, + '-webkit-mask-repeat': true, + '-webkit-mask-size': true, + '-webkit-mask-type': true, +}; + +var cssMatchesPseudo = checkSelector([ + ':is', + ':where', + ':matches', + ':any', + ':-webkit-any', + ':-webkit-is', + ':-webkit-where', + ':-webkit-matches', +]); + +var cssMathFunctions = { + '': ['min(', 'max(', 'clamp('], +}; + +/** + * Allows a media query to be set based on the presence and accuracy of the user's pointing device, and whether they have the ability to hover over elements on the page. This includes the `pointer`, `any-pointer`, `hover`, and `any-hover` media features. + * @see https://caniuse.com/css-media-interaction + */ + +/** + * @type {import('../features').Feature} + */ +var cssMediaInteraction = checkAtRule('media', [ + 'pointer', + 'any-pointer', + 'hover', + 'any-hover', +]); + +var cssMediaRangeSyntax = checkAtRule('media', [' > ', ' < ', ' <= ', ' >= ']); + +var cssMediaResolution = checkAtRule('media', ['min-resolution', 'max-resolution', 'resolution', 'device-pixel-ratio']); + +/** + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Media+Queries:+scripting+media+feature + */ + +/** + * @type {import('../features').Feature} + */ +var cssMediaScripting = checkAtRule('media', ['scripting']); + +var cssMediaqueries = checkAtRule(['media']); + +var cssMixblendmode = { + 'mix-blend-mode': true, +}; + +var cssMotionPaths = { + 'offset-path': true, +}; + +/** + * Using the `@namespace` at-rule, elements of other namespaces (e.g. SVG) can be targeted using the pipe (`|`) selector. + * @see https://caniuse.com/css-namespaces + */ + +/** + * @type {import('../features').Feature} + */ +var cssNamespaces = checkAtRule('namespace'); + +/** + * CSS nesting provides the ability to nest one style rule inside another, with the selector of the child rule relative to the selector of the parent rule. Similar behavior previously required a CSS pre-processor. + * @see https://caniuse.com/css-nesting + */ + +/** + * @type {import('../features').Feature} + */ +var cssNesting = (rule) => { + if (rule.type === 'rule' && rule.parent.type === 'rule') { + return true; + } + + if (rule.type === 'atrule' && rule.parent.type === 'rule') { + return true; + } + + return false; +}; + +/** + * Selectors Level 3 only allowed `:not()` pseudo-class to accept a single simple selector, which the element must not match any of. Thus, `:not(a, .b, [c])` or `:not(a.b[c])` did not work. Selectors Level 4 allows `:not()` to accept a list of selectors. Thus, `:not(a):not(.b):not([c])` can instead be written as `:not(a, .b, [c])` and `:not(a.b[c])` works as intended. + * @see https://caniuse.com/css-not-sel-list + */ + +/** + * @type {import('../features').Feature} + */ +var cssNotSelList = checkSelector( + (selector) => selector.includes(':not(') && !/:not\(.?#?-?[\w[\]-]+\)/.test(selector), +); + +/** + * The newest versions of `:nth-child()` and `:nth-last-child()` accept an optional `of S` clause which filters the children to only those which match the selector list `S`. For example, `:nth-child(1 of .foo)` selects the first child among the children that have the `foo` class (ignoring any non-`foo` children which precede that child). Similar to `:nth-of-type`, but for arbitrary selectors instead of only type selectors. + * @see https://caniuse.com/css-nth-child-of + */ + +/** + * @type {import('../features').Feature} + */ +var cssNthChildOf = checkSelector( + (selector) => /:nth-(child|last-child)\(\s*\d+\s*of/.test(selector), +); + +var cssOpacity = { + 'opacity': true, +}; + +/** + * The `:optional` pseudo-class matches form inputs (`<input>`, `<textarea>`, `<select>`) which are not `:required`. + * @see https://caniuse.com/css-optional-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssOptionalPseudo = checkSelector(':optional'); + +/** + * Originally a single property for controlling overflowing content in both horizontal & vertical directions, the `overflow` property is now a shorthand for `overflow-x` & `overflow-y`. The latest version of the specification also introduces the `clip` value that blocks programmatic scrolling. + * @see https://caniuse.com/css-overflow + */ + +/** + * @type {import('../features').Feature} + */ +var cssOverflow = { + 'overflow': true, + 'overflow-x': true, + 'overflow-y': true, +}; + +/** + * Changes in DOM elements above the visible region of a scrolling box can result in the page moving while the user is in the middle of consuming the content. By default, the value of `overflow-anchor` is `auto`, it can mitigate this jarring user experience by keeping track of the position of an anchor node and adjusting the scroll offset accordingly + * @see https://caniuse.com/css-overflow-anchor + */ + +/** + * @type {import('../features').Feature} + */ +var cssOverflowAnchor = { + 'overflow-anchor': true, +}; + +var cssOverflowOverlay = { + 'overflow': 'overlay', +}; + +var cssOverscrollBehavior = { + 'overscroll-behavior': true, + 'overscroll-behavior-x': true, + 'overscroll-behavior-y': true, +}; + +/** + * Properties to control the way elements are broken across (printed) pages. + * @see https://caniuse.com/css-page-break + */ + +/** + * @type {import('../features').Feature} + */ +var cssPageBreak = { + 'page-break-after': true, + 'page-break-before': true, + 'page-break-inside': true, +}; + +/** + * CSS at-rule (`@page`) to define page-specific rules when printing web pages, such as margin per page and page dimensions. + * @see https://caniuse.com/css-paged-media + */ + +/** + * @type {import('../features').Feature} + */ +var cssPagedMedia = checkAtRule('page'); + +/** + * Allows programmatic generation of images used by CSS + * @see https://caniuse.com/css-paint-api + */ + +/** + * @type {import('../features').Feature} + */ +var cssPaintApi = { '': 'paint(' }; + +var cssPlaceholder = [ + checkSelector(':placeholder'), +]; + +/** + * :placeholder-shown CSS pseudo-class + * Input elements can sometimes show placeholder text as a hint to the user on what to type in. See, for example, the placeholder attribute in HTML5. The :placeholder-shown pseudo-class matches an input element that is showing such placeholder text. + * @see https://caniuse.com/css-placeholder-shown + */ + +/** + * @type {import('../features').Feature} + */ +var cssPlaceholderShown = checkSelector(':placeholder-shown'); + +var cssPrintColorAdjust = { + 'print-color-adjust': true, +}; + +/** + * CSS :read-only and :read-write selectors + * :read-only and :read-write pseudo-classes to match elements which are considered user-alterable + * @see https://caniuse.com/css-read-only-write + */ + +/** + * @type {import('../features').Feature} + */ +var cssReadOnlyWrite = checkSelector([':read-only', ':read-write']); + +/** + * Rebeccapurple color + * The new color added in CSS Color Module Level 4 + * @see https://caniuse.com/css-rebeccapurple + */ + +/** + * @type {import('../features').Feature} + */ +var cssRebeccapurple = { + '': 'rebeccapurple', +}; + +var cssReflections = { + 'box-reflect': true, + '-webkit-box-reflect': true, +}; + +/** + * CSS Regions + * Method of flowing content into multiple elements, allowing magazine-like layouts. While once supported in WebKit-based browsers and Internet Explorer, implementing the feature is no longer being pursued by any browser. + * @see https://caniuse.com/css-regions + */ + +/** + * @type {import('../features').Feature} + */ +var cssRegions = { + 'flow-into': true, + 'flow-from': true, + '-webkit-flow-into': true, + '-webkit-flow-from': true, +}; + +/** + * CSS Relative colors + * The CSS Relative Color syntax allows a color to be defined relative to another color using the `from` keyword and optionally `calc()` for any of the color values. + * @see https://caniuse.com/css-relative-colors + */ + +/** + * @type {import('../features').Feature} + */ +var cssRelativeColors = { + '': /((rgb)|(rgba)|(hsl)|(hsla)|(hwb))\(\s*from/, +}; + +var cssRepeatingGradients = { + '': [ + 'repeating-linear-gradient', + 'repeating-radial-gradient', + ], +}; + +var cssResize = { + 'resize': true, +}; + +var cssRevertValue = { + '': 'revert', + +}; + +/** + * #rrggbbaa hex color notation + * The CSS Color Module Level 4 defines new 4 & 8 character hex notation for color to include the opacity level. + * @see https://caniuse.com/css-rrggbbaa + */ + +/** + * @type {import('../features').Feature} + */ +var cssRrggbbaa = { + '': [ + /#[\da-f]{8}/i, + /#[\da-f]{4}(\W|$)/i, + ], +}; + +/** + * CSS Scroll-behavior + * Method of specifying the scrolling behavior for a scrolling box, when scrolling happens due to navigation or CSSOM scrolling APIs. + * @see https://caniuse.com/css-scroll-behavior + */ + +/** + * @type {import('../features').Feature} + */ +var cssScrollBehavior = { + 'scroll-behavior': true, +}; + +/** + * CSS @scroll-timeline + * CSS property that allows animations to be driven by a container's scroll position + * @see https://caniuse.com/css-scroll-timeline + */ + +const checkAt = checkAtRule('scroll-timeline'); + +/** + * @type {import('../features').Feature} + */ +var cssScrollTimeline = (node) => { + // check for @scroll-timeline + if (checkAt(node)) { + return true; + } + + // check for animation-timeline + if (node.type !== 'decl') return false; + if (node.prop.startsWith('animation-timeline')) { + return true; + } + + return false; +}; + +var cssScrollbar = { + 'scrollbar-color': true, + 'scrollbar-width': true, +}; + +const ATTRIBUTE_IDENTIFIER$1 = '[^\\~|^$*\\]]*'; + +// Export for testing +const REGEXES$1 = { + 'HAS_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\]`), + 'MATCH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}=${ATTRIBUTE_IDENTIFIER$1}\\]`), + 'WORD_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\~=${ATTRIBUTE_IDENTIFIER$1}\\]`), + 'SUBCODE_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\|=${ATTRIBUTE_IDENTIFIER$1}\\]`), + 'BRACKET_PARENS': /(\[[^=\]]*(=("[^"]*")|[^\]]+|)])|(\([^)]*\))/g, +}; + +/** + * @param {RegExp} pattern + * @return {(str:string) => boolean} + */ +function matchOutsideOfBrackets(pattern) { + if (!(pattern instanceof RegExp)) { + throw new TypeError('matchOutsideOfBrackets expects a RegExp'); + } + return (string) => pattern.test(string.replaceAll(REGEXES$1.BRACKET_PARENS, '')); +} + +var cssSel2 = checkSelector([ + ':first-child', + ':link', + ':visited', + ':active', + ':hover', + ':focus', + ':lang', + REGEXES$1.HAS_ATTRIBUTE, + REGEXES$1.MATCH_ATTRIBUTE, + REGEXES$1.WORD_ATTRIBUTE, + REGEXES$1.SUBCODE_ATTRIBUTE, + matchOutsideOfBrackets(/\*/), + matchOutsideOfBrackets(/>/), + matchOutsideOfBrackets(/\+/), + matchOutsideOfBrackets(/\./), + matchOutsideOfBrackets(/#/), +]); + +const ATTRIBUTE_IDENTIFIER = '[^\\~|^$*\\]]*'; + +// Export for testing +const REGEXES = { + 'SIBLING_SELECTOR': /^[^[]*~/, + 'STARTSWITH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\^=${ATTRIBUTE_IDENTIFIER}\\]`), + 'ENDSWITH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\$=${ATTRIBUTE_IDENTIFIER}\\]`), + 'INSENSITIVE_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\*=${ATTRIBUTE_IDENTIFIER}\\]`), +}; + +var cssSel3 = checkSelector([ + ':root', + ':nth-child', + ':nth-last-child', + 'nth-of-type', + 'nth-last-of-type', + ':last-child', + ':first-of-type', + ':last-of-type', + ':only-child', + ':only-of-type', + ':empty', + ':target', + ':enabled', + ':disabled', + ':checked', + ':not', + REGEXES.SIBLING_SELECTOR, + REGEXES.STARTSWITH_ATTRIBUTE, + REGEXES.ENDSWITH_ATTRIBUTE, + REGEXES.INSENSITIVE_ATTRIBUTE, +]); + +var cssSelection = checkSelector(':selection'); + +var cssShapes = { + 'shape-outside': true, + 'shape-image-threshold': true, + 'shape-margin': true, +}; + +/** + * CSS Scroll Snap + * CSS technique that allows customizable scrolling experiences like pagination of carousels by setting defined snap positions. + * @see https://caniuse.com/css-snappoints + */ + +/** + * @type {import('../features').Feature} + */ +var cssSnappoints = { + 'scroll-snap-type': true, + 'scroll-padding': true, + 'scroll-padding-top': true, + 'scroll-padding-right': true, + 'scroll-padding-bottom': true, + 'scroll-padding-left': true, + 'scroll-padding-inline': true, + 'scroll-padding-inline-start': true, + 'scroll-padding-inline-end': true, + 'scroll-padding-block': true, + 'scroll-padding-block-start': true, + 'scroll-padding-block-end': true, + 'scroll-snap-align': true, + 'scroll-margin': true, + 'scroll-margin-top': true, + 'scroll-margin-right': true, + 'scroll-margin-bottom': true, + 'scroll-margin-left': true, + 'scroll-margin-inline': true, + 'scroll-margin-inline-start': true, + 'scroll-margin-inline-end': true, + 'scroll-margin-block': true, + 'scroll-margin-block-start': true, + 'scroll-margin-block-end': true, + 'scroll-snap-stop': true, +}; + +var cssSticky = { + 'position': 'sticky', +}; + +/** + * CSS Subgrid + * Feature of the CSS Grid Layout Module Level 2 that allows a grid-item with its own grid to align in one or both dimensions with its parent grid. + * @see https://caniuse.com/css-subgrid + */ + +/** + * @type {import('../features').Feature} + */ +var cssSubgrid = { + '': 'subgrid', +}; + +/** + * CSS.supports() API + * The CSS.supports() static methods returns a Boolean value indicating if the browser supports a given CSS feature, or not. + * @see https://caniuse.com/css-supports-api + */ + +/** + * @type {import('../features').Feature} + */ +var cssSupportsApi = {}; + +/* this feature appears in JS, so it's not linted by this tool */ + +var cssTable = { + 'display': [ + 'table', + 'table-', + 'inline-table', + ], +}; + +/** + * CSS3 text-align-last + * CSS property to describe how the last line of a block or a line right before a forced line break when `text-align` is `justify`. + * @see https://caniuse.com/css-text-align-last + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextAlignLast = { + 'text-align-last': true, +}; + +/** + * CSS text-box-trim & text-box-edge + * Provides the ability to remove the vertical space appearing above and below text glyphs, allowing more precise positioning and alignment. Previously specified as the `leading-trim` & `text-edge` properties. + * @see https://caniuse.com/css-text-box-trim + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextBoxTrim = { + 'text-box-trim': true, + 'text-box-edge': true, +}; + +/** + * CSS text-indent + * The `text-indent` property applies indentation to lines of inline content in a block. + * @see https://caniuse.com/css-text-indent + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextIndent = { + 'text-indent': true, +}; + +/** + * CSS text-justify + * CSS property to define how text should be justified when `text-align: justify` is set. + * @see https://caniuse.com/css-text-justify + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextJustify = { + 'text-justify': true, +}; + +/** + * CSS text-orientation + * The CSS `text-orientation` property specifies the orientation of text within a line. Current values only have an effect in vertical typographic modes (defined with the `writing-mode` property) + * @see https://caniuse.com/css-text-orientation + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextOrientation = { + 'text-orientation': true, +}; + +/** + * CSS Text 4 text-spacing + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=CSS+Text+4+text-spacing + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextSpacing = { + 'text-spacing': true, +}; + +var cssTextshadow = { + 'text-shadow': true, +}; + +var cssTouchAction = { + 'touch-action': true, +}; + +var cssTransitions = { + 'transition': true, + 'transition-property': true, + 'transition-duration': true, + 'transition-delay': true, + 'transition-timing-function': true, +}; + +/** + * CSS unicode-bidi property + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=CSS+unicode-bidi+property + */ + +/** + * @type {import('../features').Feature} + */ +var cssUnicodeBidi = { + 'unicode-bidi': true, +}; + +var cssUnsetValue = { + '': 'unset', +}; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +var cssVariables = (rule) => { + if (rule.type !== 'decl') return false; + return (rule.prop.startsWith('--') || rule.value.includes('var(')); +}; + +/** + * CSS @when / @else conditional rules + * Syntax allowing CSS conditions (like media and support queries) to be written more simply, as well as making it possibly to write mutually exclusive rules using `@else` statements. + * @see https://caniuse.com/css-when-else + */ + +/** + * @type {import('../features').Feature} + */ +var cssWhenElse = checkAtRule(['when', 'else']); + +/** + * CSS widows & orphans + * CSS properties to control when lines break across pages or columns by defining the amount of lines that must be left before or after the break. + * @see https://caniuse.com/css-widows-orphans + */ + +/** + * @type {import('../features').Feature} + */ +var cssWidowsOrphans = { + 'widows': true, + 'orphans': true, +}; + +/** + * width: stretch property + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=width:+stretch+property + */ + +/** + * @type {import('../features').Feature} + */ +var cssWidthStretch = { + 'width': 'stretch', +}; + +/** + * CSS writing-mode property + * Property to define whether lines of text are laid out horizontally or vertically and the direction in which blocks progress. + * @see https://caniuse.com/css-writing-mode + */ + +/** + * @type {import('../features').Feature} + */ +var cssWritingMode = { + 'writing-mode': true, +}; + +/** + * CSS zoom + * Non-standard method of scaling content. + * @see https://caniuse.com/css-zoom + */ + +/** + * @type {import('../features').Feature} + */ +var cssZoom = { + 'zoom': true, +}; + +/** + * CSS3 attr() function for all properties + * While `attr()` is supported for effectively all browsers for the `content` property, CSS Values and Units Level 5 adds the ability to use `attr()` on **any** CSS property, and to use it for non-string values (e.g. numbers, colors). + * @see https://caniuse.com/css3-attr + */ + +/** + * @type {import('../features').Feature} + */ +var css3Attr = (rule) => { + if (rule.type !== 'decl') return false; + if (rule.prop === 'content') { + return false; + } + + return rule.toString().includes('attr('); +}; + +var css3Boxsizing = { + 'box-sizing': true, +}; + +var css3Colors = { + '': [ + 'rgba', + 'hsl', + 'hsla', + ], +}; + +var css3Cursors = { + 'cursor': [ + 'none', + 'context-menu', + 'cell', + 'vertical-text', + 'alias', + 'copy', + 'no-drop', + 'not-allowed', + 'nesw-resize', + 'nwse-resize', + 'col-resize', + 'row-resize', + 'all-scroll', + ], +}; + +var css3CursorsGrab = { + 'cursor': ['grab', 'grabbing'], +}; + +var css3CursorsNewer = { + 'cursor': ['zoom-in', 'zoom-out'], +}; + +var css3Tabsize = { + 'tab-size': true, +}; + +/** + * CSS currentColor value + * A CSS value that will apply the existing `color` value to other properties like `background-color`, etc. + * @see https://caniuse.com/currentcolor + */ + +/** + * @type {import('../features').Feature} + */ +var currentcolor = { + '': 'currentColor', +}; + +/** + * Window.devicePixelRatio + * Read-only property that returns the ratio of the (vertical) size of one physical pixel on the current display device to the size of one CSS pixel. + * @see https://caniuse.com/devicepixelratio + */ + +/** + * @type {import('../features').Feature} + */ +var devicepixelratio = {}; + +/* this feature is found in JS and is not linted by this tool */ + +/** + * ui-serif, ui-sans-serif, ui-monospace and ui-rounded values for font-family + * Allows more control when choosing system interface fonts + * @see https://caniuse.com/extended-system-fonts + */ + +/** + * @type {import('../features').Feature} + */ +var extendedSystemFonts = { + 'font-family': ['ui-serif', 'ui-sans-serif', 'ui-monospace', 'ui-rounded'], +}; + +var flexbox = { + 'display': [ + 'flex', + 'inline-flex', + ], + 'flex': true, + 'flex-grow': true, + 'flex-shrink': true, + 'flex-basis': true, + 'flex-direction': true, + 'flex-wrap': true, + 'flex-flow': true, +}; + +/** + * gap property for Flexbox + * `gap` for flexbox containers to create gaps/gutters between flex items + * @see https://caniuse.com/flexbox-gap + */ + +/** + * @type {import('../features').Feature} + */ +var flexboxGap = (rule) => { + if (/display:\s(inline-)?flex/.test(rule.toString()) + && rule.toString().includes('gap:') + ) { + return true; + } + + return false; +}; + +/** + * display: flow-root + * The element generates a block container box, and lays out its contents using flow layout. It always establishes a new block formatting context for its contents. It provides a better solution to the most use cases of the "clearfix" hack. + * @see https://caniuse.com/flow-root + */ + +/** + * @type {import('../features').Feature} + */ +var flowRoot = { + 'display': 'flow-root', +}; + +/** + * system-ui value for font-family + * Value for `font-family` that represents the default user interface font. + * @see https://caniuse.com/font-family-system-ui + */ + +/** + * @type {import('../features').Feature} + */ +var fontFamilySystemUi = { + 'font-family': 'system-ui', +}; + +var fontFeature = { + 'font-feature-settings': true, + 'font-variant-ligatures': true, + 'font-language-override': true, + 'font-kerning': true, +}; + +/** + * CSS3 font-kerning + * Controls the usage of the kerning information (spacing between letters) stored in the font. Note that this only affects OpenType fonts with kerning information, it has no effect on other fonts. + * @see https://caniuse.com/font-kerning + */ + +/** + * @type {import('../features').Feature} + */ +var fontKerning = { + 'font-kerning': true, +}; + +/** + * CSS Font Loading + * This CSS module defines a scripting interface to font faces in CSS, allowing font faces to be easily created and loaded from script. It also provides methods to track the loading status of an individual font, or of all the fonts on an entire page. + * @see https://caniuse.com/font-loading + */ + +/** + * @type {import('../features').Feature} + */ +var fontLoading = {}; + +/* this feature appears in JS and as such is not linted */ + +var fontSizeAdjust = { + 'font-size-adjust': true, +}; + +/** + * CSS font-smooth + * Controls the application of anti-aliasing when fonts are rendered. + * @see https://caniuse.com/font-smooth + */ + +/** + * @type {import('../features').Feature} + */ +var fontSmooth = { + 'font-smooth': true, +}; + +var fontUnicodeRange = { + 'unicode-range': true, +}; + +/** + * CSS font-variant-alternates + * Controls the usage of alternate glyphs associated to alternative names defined in @font-feature-values for certain types of OpenType fonts. + * @see https://caniuse.com/font-variant-alternates + */ + +/** + * @type {import('../features').Feature} + */ +var fontVariantAlternates = { + 'font-variant-alternates': true, +}; + +/** + * CSS font-variant-numeric + * CSS property that provides different ways of displaying numbers, fractions, and ordinal markers. + * @see https://caniuse.com/font-variant-numeric + */ + +/** + * @type {import('../features').Feature} + */ +var fontVariantNumeric = { + 'font-variant-numeric': true, +}; + +var fontface = [ + checkAtRule('font-face'), +]; + +var fullscreen = checkSelector(':fullscreen'); + +/** + * getComputedStyle + * API to get the current computed CSS styles applied to an element. This may be the current value applied by an animation or as set by a stylesheet. + * @see https://caniuse.com/getcomputedstyle + */ + +/** + * @type {import('../features').Feature} + */ +var getcomputedstyle = {}; + +/* this is a js api, so we don't lint it */ + +var inlineBlock = { + 'display': 'inline-block', +}; + +const VALUES = ['max-content', 'min-content', 'fit-content', 'fill-available', 'stretch', 'fill']; + +var intrinsicWidth = { + 'width': VALUES, + 'min-width': VALUES, + 'max-width': VALUES, + 'height': VALUES, + 'min-height': VALUES, + 'max-height': VALUES, +}; + +/** + * CSS justify-content: space-evenly + * The "space-evenly" value for the `justify-content` property distributes the space between items evenly. It is similar to space-around but provides equal instead of half-sized space on the edges. Can be used in both CSS flexbox & grid. + * @see https://caniuse.com/justify-content-space-evenly + */ + +/** + * @type {import('../features').Feature} + */ +var justifyContentSpaceEvenly = { + 'justify-content': 'space-evenly', +}; + +var kerningPairsLigatures = { + 'text-rendering': 'optimizeLegibility', +}; + +var mdnCssUnicodeBidiIsolate = { + 'unicode-bidi': 'isolate', +}; + +var mdnCssUnicodeBidiIsolateOverride = { + 'unicode-bidi': 'isolate-override', +}; + +var mdnCssUnicodeBidiPlaintext = { + 'unicode-bidi': 'plaintext', +}; + +var mdnTextDecorationColor = { + 'text-decoration-color': true, +}; + +var mdnTextDecorationLine = { + 'text-decoration-line': true, +}; + +var mdnTextDecorationShorthand = { + 'text-decoration': true, +}; + +var mdnTextDecorationStyle = { + 'text-decoration-style': true, +}; + +var minmaxwh = { + 'min-width': true, + 'max-width': true, + 'min-height': true, + 'max-height': true, +}; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +var multibackgrounds = (rule) => { + if (rule.type !== 'decl') return false; + if (!/^background-?/.test(rule.prop)) return false; + return postcss.list.comma(rule.value).length > 1; +}; + +var multicolumn = { + 'columns': true, + 'column-width': true, + 'column-gap': true, + 'column-rule': true, + 'column-rule-color': true, + 'column-rule-width': true, + 'column-count': true, + 'column-rule-style': true, + 'column-span': true, + 'column-fill': true, + 'break-before': true, + 'break-after': true, + 'break-inside': true, +}; + +var objectFit = { + 'object-fit': true, + 'object-position': true, +}; + +var outline = { + 'outline': true, + 'outline-style': true, + 'outline-width': true, + 'outline-color': true, +}; + +var pointer = { + 'touch-action': true, +}; + +var pointerEvents = { + 'pointer-events': true, +}; + +/** + * prefers-color-scheme media query + * Media query to detect if the user has set their system to use a light or dark color theme. + * @see https://caniuse.com/prefers-color-scheme + */ + +/** + * @type {import('../features').Feature} + */ +var prefersColorScheme = checkAtRule('media', 'prefers-color-scheme'); + +/** + * TODO: initially implement feature + * prefers-reduced-motion media query + * CSS media query based on a user preference for preferring reduced motion (animation, etc). + * @see https://caniuse.com/prefers-reduced-motion + */ + +/** + * @type {import('../features').Feature} + */ +var prefersReducedMotion = checkAtRule('media', 'prefers-reduced-motion'); + +var rem = checkCSSLengthUnits('rem'); + +/** + * display: run-in + * If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. + * @see https://caniuse.com/run-in + */ + +/** + * @type {import('../features').Feature} + */ +var runIn = { + 'display': 'run-in', +}; + +/** + * Scoped CSS + * Allows CSS rules to be scoped to part of the document, based on the position of the style element. The attribute has been [removed from the current specification](https://github.com/whatwg/html/issues/552). + * @see https://caniuse.com/style-scoped + */ + +/** + * @type {import('../features').Feature} + */ +var styleScoped = {}; + +/* this feature appears in HTML, so we don't lint it */ + +/** + * SVG in CSS backgrounds + * Method of using SVG images as CSS backgrounds + * @see https://caniuse.com/svg-css + */ + +/** + * @type {import('../features').Feature} + */ +var svgCss = (rule) => { + if (rule.type !== 'decl') return false; + if (/url\([\S\s]*svg/g.test( + rule.toString(), + )) { + return true; + } + + return false; +}; + +var textDecoration = { + 'text-decoration-style': true, + 'text-decoration-line': true, + 'text-decoration-color': true, + 'text-decoration': /\w \w/, + 'text-decoration-thickness': true, + 'text-decoration-skip': true, + 'text-decoration-skip-ink': true, +}; + +/** + * text-emphasis styling + * Method of using small symbols next to each glyph to emphasize a run of text, commonly used in East Asian languages. The `text-emphasis` shorthand, and its `text-emphasis-style` and `text-emphasis-color` longhands, can be used to apply marks to the text. The `text-emphasis-position` property, which inherits separately, allows setting the emphasis marks' position with respect to the text. + * @see https://caniuse.com/text-emphasis + */ + +/** + * @type {import('../features').Feature} + */ +var textEmphasis = { + 'text-emphasis': true, + 'text-emphasis-style': true, + 'text-emphasis-color': true, + 'text-emphasis-position': true, +}; + +var textOverflow = { + 'text-overflow': true, +}; + +var textSizeAdjust = { + 'text-size-adjust': true, +}; + +/** + * CSS text-stroke and text-fill + * Method of declaring the outline (stroke) width and color for text. + * @see https://caniuse.com/text-stroke + */ + +/** + * @type {import('../features').Feature} + */ +var textStroke = { + 'text-stroke-color': true, + 'text-stroke-width': true, + 'text-stroke': true, + 'text-fill-color': true, +}; + +var transforms2d = { + 'transform': true, + 'transform-origin': true, +}; + +var transforms3d = { + 'perspective': true, + 'perspective-origin': true, + 'transform-style': true, + 'backface-visibility': true, + 'transform': '3d', +}; + +/** + * TTF/OTF - TrueType and OpenType font support + * Support for the TrueType (.ttf) and OpenType (.otf) outline font formats in @font-face. + * @see https://caniuse.com/ttf + */ + +/** + * @type {import('../features').Feature} + */ +var ttf = (rule) => { + const ruleText = rule.toString(); + + if (ruleText.includes('@font-face') && ( + (ruleText.includes('.ttf') || ruleText.includes('.otf')) + )) { + return true; + } + + return false; +}; + +var userSelectNone = { + 'user-select': true, +}; + +/** + * Variable fonts + * OpenType font settings that allows a single font file to behave like multiple fonts: it can contain all the allowed variations in width, weight, slant, optical size, or any other exposed axes of variation as defined by the font designer. Variations can be applied via the `font-variation-settings` property. + * @see https://caniuse.com/variable-fonts + */ + +/** + * @type {import('../features').Feature} + */ +var variableFonts = { + 'font-variation-settings': true, +}; + +/** + * Small, Large, and Dynamic viewport units + * Viewport units similar to `vw` and `vh` that are based on shown or hidden + * browser UI states to address shortcomings of the original units. Currently + * defined as the + * `sv*` units (`svb`, `svh`, `svi`, `svmax`, `svmin`, `svw`), + * `lv*` units (`lvb`, `lvh`, `lvi`, `lvmax`, `lvmin`, `lvw`), + * `dv*` units (`dvb`, `dvh`, `dvi`, `dvmax`, `dvmin`, `dvw`) + * and the logical `vi`/`vb` units. + * @see https://caniuse.com/viewport-unit-variants + * @type {import('../features').Feature} + */ +var viewportUnitVariants = checkCSSLengthUnits( + /* sv* units */ + 'svb', + 'svh', + 'svi', + 'svmax', + 'svmin', + 'svw', + + /* lv* units */ + 'lvb', + 'lvh', + 'lvi', + 'lvmax', + 'lvmin', + 'lvw', + + /* dv* units */ + 'dvb', + 'dvh', + 'dvi', + 'dvmax', + 'dvmin', + 'dvw', + + /* vi/vb units */ + 'vi', + 'vb', +); + +var viewportUnits = { + '': [ + 'vw', + 'vh', + 'vmin', + 'vmax', + ], +}; + +/** + * CSS -webkit-user-drag property + * The non-standard `-webkit-user-drag` CSS property can be used to either make an element draggable or explicitly non-draggable (like links and images). See the standardized [draggable attribute/property](/mdn-api_htmlelement_draggable) for the recommended alternative method of accomplishing the same functionality. + * @see https://caniuse.com/webkit-user-drag + */ + +/** + * @type {import('../features').Feature} + */ +var webkitUserDrag = { + 'webkit-user-drag': true, +}; + +var willChange = { + 'will-change': true, +}; + +var wordBreak = { + 'word-break': true, +}; + +var wordwrap = { + 'overflow-wrap': true, + 'word-wrap': true, +}; + +/* THIS FILE IS AUTOGENERATED */ + +/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */ + +/** @typedef {((rule:import('postcss').ChildNode) => boolean)} RuleCheck */ + +/** @typedef {Record<string, FeatureCheck|FeatureCheck[]|boolean> | RuleCheck | RuleCheck[]} Feature */ + +/** @enum {Feature} */ +const FEATURES = { + 'alternate-stylesheet': alternateStylesheet, + 'background-attachment': backgroundAttachment, + 'background-clip-text': backgroundClipText, + 'background-img-opts': backgroundImgOpts, + 'background-position-x-y': backgroundPositionXY, + 'background-repeat-round-space': backgroundRepeatRoundSpace, + 'border-image': borderImage, + 'border-radius': borderRadius, + 'calc': calc, + 'ch-unit': chUnit, + 'css-all': cssAll, + 'css-animation': cssAnimation, + 'css-any-link': cssAnyLink, + 'css-appearance': cssAppearance, + 'css-at-counter-style': cssAtCounterStyle, + 'css-autofill': cssAutofill, + 'css-backdrop-filter': cssBackdropFilter, + 'css-background-offsets': cssBackgroundOffsets, + 'css-backgroundblendmode': cssBackgroundblendmode, + 'css-boxdecorationbreak': cssBoxdecorationbreak, + 'css-boxshadow': cssBoxshadow, + 'css-canvas': cssCanvas, + 'css-caret-color': cssCaretColor, + 'css-cascade-layers': cssCascadeLayers, + 'css-case-insensitive': cssCaseInsensitive, + 'css-clip-path': cssClipPath, + 'css-color-adjust': cssColorAdjust, + 'css-color-function': cssColorFunction, + 'css-conic-gradients': cssConicGradients, + 'css-container-queries': cssContainerQueries, + 'css-container-queries-style': cssContainerQueriesStyle, + 'css-container-query-units': cssContainerQueryUnits, + 'css-containment': cssContainment, + 'css-content-visibility': cssContentVisibility, + 'css-counters': cssCounters, + 'css-crisp-edges': cssCrispEdges, + 'css-cross-fade': cssCrossFade, + 'css-default-pseudo': cssDefaultPseudo, + 'css-descendant-gtgt': cssDescendantGtgt, + 'css-deviceadaptation': cssDeviceadaptation, + 'css-dir-pseudo': cssDirPseudo, + 'css-display-contents': cssDisplayContents, + 'css-element-function': cssElementFunction, + 'css-env-function': cssEnvFunction, + 'css-exclusions': cssExclusions, + 'css-featurequeries': cssFeaturequeries, + 'css-file-selector-button': cssFileSelectorButton, + 'css-filter-function': cssFilterFunction, + 'css-filters': cssFilters, + 'css-first-letter': cssFirstLetter, + 'css-first-line': cssFirstLine, + 'css-fixed': cssFixed, + 'css-focus-visible': cssFocusVisible, + 'css-focus-within': cssFocusWithin, + 'css-font-palette': cssFontPalette, + 'css-font-rendering-controls': cssFontRenderingControls, + 'css-font-stretch': cssFontStretch, + 'css-gencontent': cssGencontent, + 'css-gradients': cssGradients, + 'css-grid': cssGrid, + 'css-grid-animation': cssGridAnimation, + 'css-hanging-punctuation': cssHangingPunctuation, + 'css-has': cssHas, + 'css-hyphens': cssHyphens, + 'css-image-orientation': cssImageOrientation, + 'css-image-set': cssImageSet, + 'css-in-out-of-range': cssInOutOfRange, + 'css-indeterminate-pseudo': cssIndeterminatePseudo, + 'css-initial-letter': cssInitialLetter, + 'css-initial-value': cssInitialValue, + 'css-lch-lab': cssLchLab, + 'css-letter-spacing': cssLetterSpacing, + 'css-line-clamp': cssLineClamp, + 'css-logical-props': cssLogicalProps, + 'css-marker-pseudo': cssMarkerPseudo, + 'css-masks': cssMasks, + 'css-matches-pseudo': cssMatchesPseudo, + 'css-math-functions': cssMathFunctions, + 'css-media-interaction': cssMediaInteraction, + 'css-media-range-syntax': cssMediaRangeSyntax, + 'css-media-resolution': cssMediaResolution, + 'css-media-scripting': cssMediaScripting, + 'css-mediaqueries': cssMediaqueries, + 'css-mixblendmode': cssMixblendmode, + 'css-motion-paths': cssMotionPaths, + 'css-namespaces': cssNamespaces, + 'css-nesting': cssNesting, + 'css-not-sel-list': cssNotSelList, + 'css-nth-child-of': cssNthChildOf, + 'css-opacity': cssOpacity, + 'css-optional-pseudo': cssOptionalPseudo, + 'css-overflow': cssOverflow, + 'css-overflow-anchor': cssOverflowAnchor, + 'css-overflow-overlay': cssOverflowOverlay, + 'css-overscroll-behavior': cssOverscrollBehavior, + 'css-page-break': cssPageBreak, + 'css-paged-media': cssPagedMedia, + 'css-paint-api': cssPaintApi, + 'css-placeholder': cssPlaceholder, + 'css-placeholder-shown': cssPlaceholderShown, + 'css-print-color-adjust': cssPrintColorAdjust, + 'css-read-only-write': cssReadOnlyWrite, + 'css-rebeccapurple': cssRebeccapurple, + 'css-reflections': cssReflections, + 'css-regions': cssRegions, + 'css-relative-colors': cssRelativeColors, + 'css-repeating-gradients': cssRepeatingGradients, + 'css-resize': cssResize, + 'css-revert-value': cssRevertValue, + 'css-rrggbbaa': cssRrggbbaa, + 'css-scroll-behavior': cssScrollBehavior, + 'css-scroll-timeline': cssScrollTimeline, + 'css-scrollbar': cssScrollbar, + 'css-sel2': cssSel2, + 'css-sel3': cssSel3, + 'css-selection': cssSelection, + 'css-shapes': cssShapes, + 'css-snappoints': cssSnappoints, + 'css-sticky': cssSticky, + 'css-subgrid': cssSubgrid, + 'css-supports-api': cssSupportsApi, + 'css-table': cssTable, + 'css-text-align-last': cssTextAlignLast, + 'css-text-box-trim': cssTextBoxTrim, + 'css-text-indent': cssTextIndent, + 'css-text-justify': cssTextJustify, + 'css-text-orientation': cssTextOrientation, + 'css-text-spacing': cssTextSpacing, + 'css-textshadow': cssTextshadow, + 'css-touch-action': cssTouchAction, + 'css-transitions': cssTransitions, + 'css-unicode-bidi': cssUnicodeBidi, + 'css-unset-value': cssUnsetValue, + 'css-variables': cssVariables, + 'css-when-else': cssWhenElse, + 'css-widows-orphans': cssWidowsOrphans, + 'css-width-stretch': cssWidthStretch, + 'css-writing-mode': cssWritingMode, + 'css-zoom': cssZoom, + 'css3-attr': css3Attr, + 'css3-boxsizing': css3Boxsizing, + 'css3-colors': css3Colors, + 'css3-cursors': css3Cursors, + 'css3-cursors-grab': css3CursorsGrab, + 'css3-cursors-newer': css3CursorsNewer, + 'css3-tabsize': css3Tabsize, + 'currentcolor': currentcolor, + 'devicepixelratio': devicepixelratio, + 'extended-system-fonts': extendedSystemFonts, + 'flexbox': flexbox, + 'flexbox-gap': flexboxGap, + 'flow-root': flowRoot, + 'font-family-system-ui': fontFamilySystemUi, + 'font-feature': fontFeature, + 'font-kerning': fontKerning, + 'font-loading': fontLoading, + 'font-size-adjust': fontSizeAdjust, + 'font-smooth': fontSmooth, + 'font-unicode-range': fontUnicodeRange, + 'font-variant-alternates': fontVariantAlternates, + 'font-variant-numeric': fontVariantNumeric, + 'fontface': fontface, + 'fullscreen': fullscreen, + 'getcomputedstyle': getcomputedstyle, + 'inline-block': inlineBlock, + 'intrinsic-width': intrinsicWidth, + 'justify-content-space-evenly': justifyContentSpaceEvenly, + 'kerning-pairs-ligatures': kerningPairsLigatures, + 'mdn-css-unicode-bidi-isolate': mdnCssUnicodeBidiIsolate, + 'mdn-css-unicode-bidi-isolate-override': mdnCssUnicodeBidiIsolateOverride, + 'mdn-css-unicode-bidi-plaintext': mdnCssUnicodeBidiPlaintext, + 'mdn-text-decoration-color': mdnTextDecorationColor, + 'mdn-text-decoration-line': mdnTextDecorationLine, + 'mdn-text-decoration-shorthand': mdnTextDecorationShorthand, + 'mdn-text-decoration-style': mdnTextDecorationStyle, + 'minmaxwh': minmaxwh, + 'multibackgrounds': multibackgrounds, + 'multicolumn': multicolumn, + 'object-fit': objectFit, + 'outline': outline, + 'pointer': pointer, + 'pointer-events': pointerEvents, + 'prefers-color-scheme': prefersColorScheme, + 'prefers-reduced-motion': prefersReducedMotion, + 'rem': rem, + 'run-in': runIn, + 'style-scoped': styleScoped, + 'svg-css': svgCss, + 'text-decoration': textDecoration, + 'text-emphasis': textEmphasis, + 'text-overflow': textOverflow, + 'text-size-adjust': textSizeAdjust, + 'text-stroke': textStroke, + 'transforms2d': transforms2d, + 'transforms3d': transforms3d, + 'ttf': ttf, + 'user-select-none': userSelectNone, + 'variable-fonts': variableFonts, + 'viewport-unit-variants': viewportUnitVariants, + 'viewport-units': viewportUnits, + 'webkit-user-drag': webkitUserDrag, + 'will-change': willChange, + 'word-break': wordBreak, + 'wordwrap': wordwrap, +}; + +/** + * @template T + * @typedef {{missing: T, partial: T}} Filter + */ + +/** + * @typedef {Object} MissingSupportResultStats + * @prop {string} title + * @prop {caniuse.Feature} caniuseData + * @prop {string} [missing] + * @prop {Record<string, Record<string, string>>} [missingData] + * @prop {string} [partial] + * @prop {Record<string, Record<string, string>>} [partialData] + */ + +/** + * @typedef {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} BrowserSupportStats + */ + +/** + * @typedef {Object} MissingSupportResult + * @prop {string[][]} browsers + * @prop {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} features + */ + +class BrowserSelection { + #list; + + /** + * @param {string | string[]} [query] + * @param {string | false} [from] + */ + constructor(query, from) { + this.browsersRequest = query; + const options = from ? { path: from } : {}; + this.#list = browserslist__default["default"](this.browsersRequest, options).map((browser) => browser.split(' ')); + } + + /** + * @param {string} browser + * @param {string} version + * @return {string[]|undefined} + */ + test(browser, version) { + const versions = version.split('-'); + + if (versions.length === 1) { + versions.push(versions[0]); + } + + return this.#list.find(([b, v]) => b === browser && v >= versions[0] && v <= versions[1]); + } + + list() { + return [...this.#list]; + } + + /** + * @param {Record<string, Record<string, string>>} browserStats + * @return {string} + */ + static lackingBrowsers(browserStats) { + const result = []; + for (const browser of Object.keys(browserStats)) { + result.push(formatBrowserName(browser, Object.keys(browserStats[browser]))); + } + return result.join(', '); + } + + /** + * @param {import('caniuse-lite').StatsByAgentID} stats + * @return {Filter<Record<string,Record<string, string>>>} + */ + filterStats(stats) { + /** @type {Filter<Record<string,Record<string, string>>>} */ + const result = { missing: {}, partial: {} }; + for (const [browser, versions] of Object.entries(stats)) { + /** @type {Filter<Record<string,string>>} */ + const feature = { missing: {}, partial: {} }; + for (const [version, support] of Object.entries(versions)) { + const selected = this.test(browser, version); + + // check if browser is NOT fully (i.e., don't have 'y' in their stats) supported + if (!selected) continue; + if ((/(^|\s)y($|\s)/.test(support))) continue; + // when it's not partially supported ('a'), it's missing + const type = (/(^|\s)a($|\s)/.test(support) ? 'partial' : 'missing'); + + if (!feature[type]) { + feature[type] = {}; + } + + feature[type][selected[1]] = support; + } + if (Object.keys(feature.missing).length > 0) { + result.missing[browser] = feature.missing; + } + + if (Object.keys(feature.partial).length > 0) { + result.partial[browser] = feature.partial; + } + } + return result; + } + + /** + * Get data on CSS features not supported by the given autoprefixer-like + * browser selection. + * @return {BrowserSupportStats} `features` is an array of: + * ``` + * { + * 'feature-name': { + * title: 'Title of feature' + * missing: "IE (8), Chrome (31)" + * missingData: { + * // map of browser -> version -> (lack of)support code + * ie: { '8': 'n' }, + * chrome: { '31': 'n' } + * } + * partialData: { + * // map of browser -> version -> (partial)support code + * ie: { '7': 'a' }, + * ff: { '29': 'a #1' } + * } + * caniuseData: { + * // caniuse-db json data for this feature + * } + * }, + * 'feature-name-2': {} // etc. + * } + * ``` + * + * `feature-name` is a caniuse-db slug. + */ + compileBrowserSupport() { + /** @type {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} */ + const result = {}; + + for (const key of Object.keys(FEATURES)) { + const feature = /** @type {keyof FEATURES} */ (key); + const packedFeature = caniuse__namespace.features[feature]; + const featureData = caniuse__namespace.feature(packedFeature); + const lackData = this.filterStats(featureData.stats); + const missingData = lackData.missing; + const partialData = lackData.partial; + // browsers with missing or partial support for this feature + const missing = BrowserSelection.lackingBrowsers(missingData); + const partial = BrowserSelection.lackingBrowsers(partialData); + + if (missing.length > 0 || partial.length > 0) { + result[feature] = { + title: featureData.title, + caniuseData: featureData, + ...(missing.length > 0 ? { missingData, missing } : null), + ...(partial.length > 0 ? { partialData, partial } : null), + }; + } + } + + return result; + } + + /** + * @see BrowserSelection.compileBrowserSupport + * @param {ConstructorParameters<typeof this>} constructorParameters + * @return {MissingSupportResult} `{browsers, features}` + */ + static missingSupport(...constructorParameters) { + const selection = new BrowserSelection(...constructorParameters); + return { + browsers: selection.list(), + features: selection.compileBrowserSupport(), + }; + } +} + +/** + * @typedef DetectorCallbackArgument + * @prop {!import('postcss').ChildNode} usage + * @prop {keyof FEATURES} feature + * @prop {(keyof FEATURES & string)[]} ignore + */ + +/** + * @callback DetectorCallback + * @param {DetectorCallbackArgument} result + * @return {any} + */ + +const PLUGIN_OPTION_COMMENT = 'doiuse-'; +const DISABLE_FEATURE_COMMENT = `${PLUGIN_OPTION_COMMENT}disable`; +const ENABLE_FEATURE_COMMENT = `${PLUGIN_OPTION_COMMENT}enable`; + +/** + * Strip the contents of url literals so they aren't matched + * by our naive substring matching. + * @param {string} input + * @return {string} + */ +function stripUrls(input) { + return input.replaceAll(/url\([^)]*\)/g, 'url()'); +} + +/** + * Detect the use of any of a given list of CSS features. + * ``` + * var detector = new Detector(featureList) + * detector.process(css, cb) + * ``` + * + * `featureList`: an array of feature slugs (see caniuse-db) + * `cb`: a callback that gets called for each usage of one of the given features, + * called with an argument like: + * ``` + * { + * usage: {} // postcss node where usage was found + * feature: {} // caniuse-db feature slug + * ignore: {} // caniuse-db feature to ignore in current file + * } + * ``` + */ +class Detector { + /** + * @param {(keyof FEATURES & string)[]} featureList an array of feature slugs (see caniuse-db) + */ + constructor(featureList) { + /** @type {Partial<FEATURES>} */ + this.features = {}; + for (const feature of featureList) { + if (FEATURES[feature]) { + this.features[feature] = FEATURES[feature]; + } + } + /** @type {(keyof FEATURES & string)[]} */ + this.ignore = []; + } + + /** + * @param {import('postcss').Comment} comment + * @return {void} + */ + comment(comment) { + const text = comment.text.toLowerCase(); + + if (!text.startsWith(PLUGIN_OPTION_COMMENT)) return; + const option = text.split(' ', 1)[0]; + const value = text.replace(option, '').trim(); + + switch (option) { + case DISABLE_FEATURE_COMMENT: { + if (value === '') { + // @ts-expect-error Skip cast + this.ignore = Object.keys(this.features); + } else { + for (const feat of value.split(',')) { + /** @type {any} */ + const f = feat.trim(); + if (!this.ignore.includes(f)) { + this.ignore.push(f); + } + } + } + break; + } + case ENABLE_FEATURE_COMMENT: { + if (value === '') { + this.ignore = []; + } else { + const without = new Set(value.split(',').map((feat) => feat.trim())); + this.ignore = this.ignore.filter((index) => !without.has(index)); + } + break; + } + } + } + + /** + * @param {import('postcss').Container} node + * @param {DetectorCallback} callback + * @return {void} + */ + node(node, callback) { + node.each((child) => { + if (child.type === 'comment') { + this.comment(child); + return; + } + + for (const [feat] of Object.entries(this.features).filter(([, featValue]) => { + if (!featValue) return false; + if (typeof featValue === 'function') { + return featValue(child); + } + if (Array.isArray(featValue)) { + return featValue.some((function_) => function_(child)); + } + if (child.type !== 'decl') { + return false; + } + + return Object.entries(featValue).some(([property, value]) => { + if (property !== '' && property !== child.prop) return false; + if (value === true) return true; + if (value === false) return false; + return performFeatureCheck(value, stripUrls(child.value)); + }); + })) { + const feature = /** @type {keyof FEATURES} */ (feat); + callback({ usage: child, feature, ignore: this.ignore }); + } + if (child.type !== 'decl') { + this.node(child, callback); + } + }); + } + + /** + * @param {import('postcss').Root} node + * @param {DetectorCallback} callback + * @return {void} + */ + process(node, callback) { + // Reset ignoring rules specified by inline comments per each file + this.ignore = []; + + // Recursively walk nodes in file + this.node(node, callback); + } +} + +/** @typedef {import('../data/features.js').FeatureKeys} FeatureKeys */ + +/** + * @typedef {Object} OnFeatureUsageArguments + * @prop {FeatureKeys} feature + * @prop {import('./BrowserSelection.js').MissingSupportResultStats|undefined} featureData + * @prop {import('postcss').Node} usage + * @prop {string} message + */ + +/** + * @callback OnFeatureUsage + * @param {OnFeatureUsageArguments} result + * @return {any} + */ + +/** + * @typedef {Object} DoIUseOptions + * @prop {ConstructorParameters<typeof BrowserSelection>[0]} [browsers] + * @prop {FeatureKeys[]} [ignore] + * @prop {OnFeatureUsage} [onFeatureUsage] + * @prop {string[]} [ignoreFiles] + */ + +class DoIUse { + static default = null; + + /** + * @param {DoIUseOptions} [optionsOrBrowserQuery] + */ + constructor(optionsOrBrowserQuery) { + const options = (typeof optionsOrBrowserQuery === 'string') + ? { browsers: optionsOrBrowserQuery } + : { ...optionsOrBrowserQuery }; + this.browserQuery = options.browsers; + this.onFeatureUsage = options.onFeatureUsage; + this.ignoreOptions = options.ignore; + this.ignoreFiles = options.ignoreFiles; + this.info = this.info.bind(this); + this.postcss = this.postcss.bind(this); + } + + /** + * @param {Object} [options] + * @param {ConstructorParameters<typeof BrowserSelection>[1]} [options.from] + */ + info(options = {}) { + const { browsers, features } = BrowserSelection.missingSupport(this.browserQuery, options.from); + + return { + browsers, + features, + }; + } + + /** @type {import('postcss').TransformCallback} */ + postcss(css, result) { + let from; + if (css.source && css.source.input) { + from = css.source.input.file; + } + const { features } = BrowserSelection.missingSupport(this.browserQuery, from); + // @ts-expect-error Needs cast + const detector = new Detector(Object.keys(features)); + + return detector.process(css, ({ feature, usage, ignore }) => { + if (ignore && ignore.includes(feature)) { + return; + } + + if (this.ignoreOptions && this.ignoreOptions.includes(feature)) { + return; + } + + if (!usage.source) { + throw new Error('No source?'); + } + if (this.ignoreFiles && multimatch__default["default"](usage.source.input.from, this.ignoreFiles).length > 0) { + return; + } + + const data = features[feature]; + if (!data) { + throw new Error('No feature data?'); + } + const messages = []; + if (data.missing) { + messages.push(`not supported by: ${data.missing}`); + } + if (data.partial) { + messages.push(`only partially supported by: ${data.partial}`); + } + + let message = `${data.title} ${messages.join(' and ')} (${feature})`; + + result.warn(message, { node: usage, plugin: 'doiuse' }); + + if (this.onFeatureUsage) { + if (!usage.source) { + throw new Error('No usage source?'); + } + const { start, input } = usage.source; + if (!start) { + throw new Error('No usage source start?'); + } + + const map = css.source && css.source.input.map; + const mappedStart = map && map.consumer().originalPositionFor(start); + + const file = (mappedStart && mappedStart.source) || input.file || input.from; + const line = (mappedStart && mappedStart.line) || start.line; + const column = (mappedStart && mappedStart.column) || start.column; + + message = `${file}:${line}:${column}: ${message}`; + + this.onFeatureUsage({ + feature, + featureData: features[feature], + usage, + message, + }); + } + }); + } +} + +/** + * @param {ConstructorParameters<typeof DoIUse>} options + * @return {DoIUse} + */ +function index(...options) { + return new DoIUse(...options); +} + +module.exports = index; diff --git a/node_modules/doiuse/exports/index.js b/node_modules/doiuse/exports/index.js new file mode 100644 index 00000000..dde9ea23 --- /dev/null +++ b/node_modules/doiuse/exports/index.js @@ -0,0 +1,9 @@ +import DoIUse from '../lib/DoIUse.js'; + +/** + * @param {ConstructorParameters<typeof DoIUse>} options + * @return {DoIUse} + */ +export default function index(...options) { + return new DoIUse(...options); +} diff --git a/node_modules/doiuse/exports/stream.cjs b/node_modules/doiuse/exports/stream.cjs new file mode 100644 index 00000000..982a0d35 --- /dev/null +++ b/node_modules/doiuse/exports/stream.cjs @@ -0,0 +1,3087 @@ +'use strict'; + +var node_stream = require('node:stream'); +var Tokenize = require('css-tokenize'); +var Duplexify = require('duplexify'); +var postcss = require('postcss'); +var sourcemap = require('source-map'); +var multimatch = require('multimatch'); +var browserslist = require('browserslist'); +var caniuse = require('caniuse-lite'); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} + +var Tokenize__default = /*#__PURE__*/_interopDefaultLegacy(Tokenize); +var Duplexify__default = /*#__PURE__*/_interopDefaultLegacy(Duplexify); +var postcss__default = /*#__PURE__*/_interopDefaultLegacy(postcss); +var sourcemap__default = /*#__PURE__*/_interopDefaultLegacy(sourcemap); +var multimatch__default = /*#__PURE__*/_interopDefaultLegacy(multimatch); +var browserslist__default = /*#__PURE__*/_interopDefaultLegacy(browserslist); +var caniuse__namespace = /*#__PURE__*/_interopNamespace(caniuse); + +/** + * No description available. + * + * See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Alternate+stylesheet + */ + +// This feature is only in HTML, so we don't lint it + +/** + * @type {import('../features').Feature} + */ +var alternateStylesheet = {}; + +/** + * Method of defining how a background image is attached to a scrollable element. Values include `scroll` (default), `fixed` and `local`. + * + * See: https://caniuse.com/background-attachment + */ + +/** + * @type {import('../features').Feature} + */ +var backgroundAttachment = { + 'background-attachment': [ + 'fixed', + 'local', + ], +}; + +/** + * Non-standard method of clipping a background image to the foreground text. + * + * See: https://caniuse.com/background-clip-text + */ + +/** + * @type {import('../features').Feature} + */ +var backgroundClipText = { + 'background-clip': 'text', + '-webkit-background-clip': 'text', +}; + +var backgroundImgOpts = { + 'background-clip': true, + 'background-origin': true, + 'background-size': true, +}; + +var backgroundPositionXY = { + 'background-position-x': true, + 'background-position-y': true, +}; + +/** + * Allows CSS background images to be repeated without clipping. + * + * See: https://caniuse.com/background-repeat-round-space + */ + +/** + * @type {import('../features').Feature} + */ +var backgroundRepeatRoundSpace = { + 'background-repeat': ['round', 'space'], +}; + +var borderImage = { + 'border-image': true, + 'border-image-outset': true, + 'border-image-repeat': true, + 'border-image-slice': true, + 'border-image-source': true, + 'border-image-width': true, + +}; + +var borderRadius = { + 'border-radius': true, + 'border-top-left-radius': true, + 'border-top-right-radius': true, + 'border-bottom-right-radius': true, + 'border-bottom-left-radius': true, +}; + +var calc = { + '': 'calc(', +}; + +/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */ + +/** + * @param {string} browserKey + * @param {string[]} [versions] + * @return {string} + */ +function formatBrowserName(browserKey, versions) { + const entry = caniuse.agents[browserKey]; + const browserName = entry ? entry.browser : null; + if (!versions) { + return browserName || ''; + } + return (`${browserName} (${versions.join(',')})`); +} + +/** + * + * @param {FeatureCheck|FeatureCheck[]} check + * @param {?string|undefined} candidate + */ +function performFeatureCheck(check, candidate) { + if (check == null || candidate == null) return false; + if (check instanceof RegExp) { + return check.test(candidate); + } + switch (typeof check) { + case 'string': + return candidate.includes(check); + case 'function': + return check(candidate); + case 'boolean': + return check; + case 'object': + if (Array.isArray(check)) { + return check.some((c) => performFeatureCheck(c, candidate)); + } + // Fallthrough + default: + console.error(check); + throw new TypeError(`Unexpected feature check: ${check}`); + } +} + +/** + * @param {FeatureCheck|FeatureCheck[]} selector + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +function checkSelector(selector) { + return (rule) => rule.type === 'rule' + && performFeatureCheck(selector, rule.selector); +} + +/** + * @param {FeatureCheck|FeatureCheck[]} [name] + * @param {FeatureCheck|FeatureCheck[]} [parameters] + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +function checkAtRule(name, parameters) { + return (rule) => rule.type === 'atrule' + && performFeatureCheck(name, rule.name) + && (!parameters || performFeatureCheck(parameters, rule.params)); +} + +/** + * @see https://drafts.csswg.org/css-values/#lengths + * @see https://drafts.csswg.org/css-values/#number-value + * @param {string[]} units + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +function checkCSSLengthUnits(...units) { + const regexp = new RegExp(`(\\+-)?[\\d.]*\\.?\\d+(e(\\+-)?\\d+)?(${units.join('|')})`, 'i'); + return (rule) => ( + (rule.type === 'decl') ? performFeatureCheck(regexp, rule.value) + : ((rule.type === 'atrule') ? performFeatureCheck(regexp, rule.params) + : false)); +} + +/** + * Unit representing the width of the character "0" in the current font, of particular use in combination with monospace fonts. + * @see https://caniuse.com/ch-unit + * @type {import('../features').Feature} + */ +var chUnit = checkCSSLengthUnits('ch'); + +var cssAll = { + 'all': true, +}; + +var cssAnimation = { + 'animation': true, + 'animation-name': true, + 'animation-duration': true, + 'animation-timing-function': true, + 'animation-iteration-count': true, + 'animation-direction': true, + 'animation-play-state': true, + 'animation-delay': true, + 'animation-fill-mode': true, +}; + +// @keyframes isn't checked for, but if you try to use it, +// you'll still get a warning anyway because of the 'animation' property + +var cssAnyLink = checkSelector([':any-link', ':-webkit-any-link']); + +var cssAppearance = { + 'appearance': true, + '-webkit-appearance': true, + '-moz-appearance': true, +}; + +var cssAtCounterStyle = checkAtRule('counter-style'); + +var cssAutofill = checkSelector([':autofill', ':-webkit-autofill']); + +var cssBackdropFilter = { + 'backdrop-filter': true, +}; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +var cssBackgroundOffsets = (rule) => { + if (rule.type !== 'decl') return false; + if (rule.prop !== 'background-position') return false; + return postcss.list.space(rule.value).length > 2; +}; + +var cssBackgroundblendmode = { + 'background-blend-mode': true, +}; + +/** + * Controls whether the box's margins, borders, padding, and other decorations wrap the broken edges of the box fragments (when the box is split by a break (page/column/region/line). + * + * See: https://caniuse.com/css-boxdecorationbreak + */ + +/** + * @type {import('../features').Feature} + */ +var cssBoxdecorationbreak = { + 'box-decoration-break': true, + '-webkit-box-decoration-break': true, +}; + +var cssBoxshadow = { + 'box-shadow': true, +}; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +var cssCanvas = (rule) => { + if (rule.type !== 'decl') return false; + if (!rule.prop.startsWith('background')) return false; + return rule.value.startsWith('-webkit-canvas'); +}; + +/** + * The `caret-color` property allows the color to be set of the caret (blinking text insertion pointer) in an editable text area. + * + * See: https://caniuse.com/css-caret-color + */ + +/** + * @type {import('../features').Feature} + */ +var cssCaretColor = { + 'caret-color': true, +}; + +/** + * The `@layer` at-rule allows authors to explicitly layer their styles in the cascade, before specificity and order of appearance are considered. + * + * See: https://caniuse.com/css-cascade-layers + */ + +/** + * @type {import('../features').Feature} + */ +var cssCascadeLayers = checkAtRule('layer'); + +/** + * Including an `i` before the `]` in a CSS attribute selector causes the attribute value to be matched in an ASCII-case-insensitive manner. For example, `[b="xyz" i]` would match both `<a b="xyz">` and `<a b="XYZ">`. + * + * See: https://caniuse.com/css-case-insensitive + */ + +/** + * @type {import('../features').Feature} + */ +var cssCaseInsensitive = (rule) => { + if (rule.type !== 'rule') { return false; } + if (/\[.*i]/.test(rule.selector)) { return true; } + return false; +}; + +var cssClipPath = { + 'clip-path': true, +}; + +/** + * The `print-color-adjust` (or `-webkit-print-color-adjust` as prefixed in WebKit/Blink browsers) property is a CSS extension that can be used to force printing of background colors and images. + * + * See: https://caniuse.com/css-color-adjust + */ + +/** + * @type {import('../features').Feature} + */ +var cssColorAdjust = { + 'print-color-adjust': true, + '-webkit-print-color-adjust': true, +}; + +/** + * The CSS `color()` function allows the browser to display colors in any color space, such as the P3 color space which can display colors outside of the default sRGB color space. + * + * See: https://caniuse.com/css-color-function + */ + +/** + * @type {import('../features').Feature} + */ +var cssColorFunction = { + '': 'color(', +}; + +const REGEX$2 = /(^|[^-])(repeating-)?conic-gradient/; + +var cssConicGradients = { + 'background': REGEX$2, + 'background-image': REGEX$2, + 'border-image': REGEX$2, + 'border-image-source': REGEX$2, + 'content': REGEX$2, + 'cursor': REGEX$2, + 'list-style': REGEX$2, + 'list-style-image': REGEX$2, +}; + +/** + * Size queries in Container Queries provide a way to query the size of a container, and conditionally apply CSS to the content of that container. + * + * See: https://caniuse.com/css-container-queries + */ + +/** + * @type {import('../features').Feature} + */ +var cssContainerQueries = checkAtRule('container'); + +var cssContainerQueriesStyle = checkAtRule('container', 'style('); + +var cssContainerQueryUnits = checkCSSLengthUnits( + 'cqw', + 'cqh', + 'cqi', + 'cqb', + 'cqmin', + 'cqmax', +); + +/** + * The CSS `contain` property lets developers limit the scope of the browser's styles, layout and paint work for faster and more efficient rendering. + * + * See: https://caniuse.com/css-containment + */ + +/** + * @type {import('../features').Feature} + */ +var cssContainment = { + 'contain': true, +}; + +/** + * Provides control over when elements are rendered, so rendering can be skipped for elements not yet in the user's viewport. + * + * See: https://caniuse.com/css-content-visibility + */ + +/** + * @type {import('../features').Feature} + */ +var cssContentVisibility = { + 'content-visibility': true, +}; + +var cssCounters = { + 'counter-reset': true, + 'counter-increment': true, + '': 'counter(', +}; + +/** + * Scales images with an algorithm that preserves edges and contrast, without smoothing colors or introducing blur. This is intended for images such as pixel art. Official values that accomplish this for the `image-rendering` property are `crisp-edges` and `pixelated`. + * + * See: https://caniuse.com/css-crisp-edges + */ + +/** + * @type {import('../features').Feature} + */ +var cssCrispEdges = { + 'image-rendering': ['crisp-edges', 'pixelated'], +}; + +/** + * Image function to create a "crossfade" between images. This allows one image to transition (fade) into another based on a percentage value. + * + * See: https://caniuse.com/css-cross-fade + */ + +/** + * @type {import('../features').Feature} + */ +var cssCrossFade = { + '': [ + 'cross-fade(', + '-webkit-cross-fade(', + ], +}; + +/** + * The `:default` pseudo-class matches checkboxes and radio buttons which are checked by default, `<option>`s with the `selected` attribute, and the default submit button (if any) of a form. + * + * See: https://caniuse.com/css-default-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssDefaultPseudo = checkSelector(':default'); + +/** + * An explicit, non-whitespace spelling of the descendant combinator. `A >> B` is equivalent to `A B`. + * + * See: https://caniuse.com/css-descendant-gtgt + */ + +/** + * @type {import('../features').Feature} + */ +var cssDescendantGtgt = checkSelector('>>'); + +/** + * Method of overriding the size of viewport in web page using the `@viewport` rule, replacing Apple's own popular `<meta>` viewport implementation. Includes the `extend-to-zoom` width value. + * + * See: https://caniuse.com/css-deviceadaptation + */ + +/** + * @type {import('../features').Feature} + */ +var cssDeviceadaptation = checkAtRule('viewport'); + +/** + * Matches elements based on their directionality. `:dir(ltr)` matches elements which are Left-to-Right. `:dir(rtl)` matches elements which are Right-to-Left. + * + * See: https://caniuse.com/css-dir-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssDirPseudo = checkSelector(':dir('); + +/** + * `display: contents` causes an element's children to appear as if they were direct children of the element's parent, ignoring the element itself. This can be useful when a wrapper element should be ignored when using CSS grid or similar layout techniques. + * + * See: https://caniuse.com/css-display-contents + */ + +/** + * @type {import('../features').Feature} + */ +var cssDisplayContents = { + 'display': 'contents', +}; + +/** + * This function renders a live image generated from an arbitrary HTML element + * + * See: https://caniuse.com/css-element-function + */ + +/** + * @type {import('../features').Feature} + */ +var cssElementFunction = { + '': 'element(', +}; + +var cssEnvFunction = { + '': 'env(', +}; + +/** + * Exclusions defines how inline content flows around elements. It extends the content wrapping ability of floats to any block-level element. + * + * See: https://caniuse.com/css-exclusions + */ + +/** + * @type {import('../features').Feature} + */ +var cssExclusions = { + 'wrap-flow': true, + '-ms-wrap-flow': true, +}; + +var cssFeaturequeries = checkAtRule(['supports']); + +/** + * No description available. + * + * See: This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=::file-selector-button+CSS+pseudo-element + */ + +/** + * @type {import('../features').Feature} + */ +var cssFileSelectorButton = checkSelector(':file-selector-button'); + +/** + * This function filters a CSS input image with a set of filter functions (like blur, grayscale or hue) + * + * See: https://caniuse.com/css-filter-function + */ + +/** + * @type {import('../features').Feature} + */ +var cssFilterFunction = { + '': 'filter(', +}; + +var cssFilters = { + 'filter': true, +}; + +/** + * CSS pseudo-element that allows styling only the first "letter" of text within an element. Useful for implementing initial caps or drop caps styling. + * + * See: https://caniuse.com/css-first-letter + */ + +/** + * @type {import('../features').Feature} + */ +var cssFirstLetter = checkSelector(':first-letter'); + +/** + * Allows styling specifically for the first line of text using the `::first-line` pseudo-element. Note that only a limited set of properties can be applied. + * + * See: https://caniuse.com/css-first-line + */ + +/** + * @type {import('../features').Feature} + */ +var cssFirstLine = checkSelector(':first-line'); + +var cssFixed = { + 'position': 'fixed', +}; + +/** + * The `:focus-visible` pseudo-class applies while an element matches the `:focus` pseudo-class, and the UA determines via heuristics that the focus should be specially indicated on the element (typically via a “focus ring”). + * + * See: https://caniuse.com/css-focus-visible + */ + +/** + * @type {import('../features').Feature} + */ +var cssFocusVisible = checkSelector(':focus-visible'); + +/** + * The `:focus-within` pseudo-class matches elements that either themselves match `:focus` or that have descendants which match `:focus`. + * + * See: https://caniuse.com/css-focus-within + */ + +/** + * @type {import('../features').Feature} + */ +var cssFocusWithin = checkSelector(':focus-within'); + +var cssFontPalette = [ + (rule) => performFeatureCheck('font-palette', rule.name), + checkAtRule('font-palette-values'), +]; + +/** + * `@font-face` descriptor `font-display` that allows control over how a downloadable font renders before it is fully loaded. + * + * See: https://caniuse.com/css-font-rendering-controls + */ + +/** + * @type {import('../features').Feature} + */ +var cssFontRenderingControls = { + 'font-display': true, +}; + +var cssFontStretch = { + 'font-stretch': true, +}; + +var cssGencontent = checkSelector([':before', ':after']); + +const REGEX$1 = /(^|[^-])((linear)|(radial))-gradient/; + +var cssGradients = { + 'background': REGEX$1, + 'background-image': REGEX$1, + 'border-image': REGEX$1, + 'border-image-source': REGEX$1, + 'content': REGEX$1, + 'cursor': REGEX$1, + 'list-style': REGEX$1, + 'list-style-image': REGEX$1, +}; + +/** @see https://drafts.csswg.org/css-grid/ */ + +var cssGrid = { + 'display': ['grid', 'inline-grid', '-ms-grid'], + 'grid': true, + 'grid-area': true, + 'grid-auto-columns': true, + + 'grid-auto-flow': true, + 'grid-auto-rows': true, + 'grid-column': true, + 'grid-column-end': true, + + 'grid-column-start': true, + 'grid-row': true, + 'grid-row-end': true, + 'grid-row-start': true, + + 'grid-template': true, + 'grid-template-areas': true, + 'grid-template-columns': true, + 'grid-template-rows': true, +}; + +const REGEX = /grid/; + +var cssGridAnimation = { + 'transition': REGEX, + 'transition-property': REGEX, +}; + +/** + * Allows some punctuation characters from start (or the end) of text elements to be placed "outside" of the box in order to preserve the reading flow. + * @see https://caniuse.com/css-hanging-punctuation + */ + +/** + * @type {import('../features').Feature} + */ +var cssHangingPunctuation = { + 'hanging-punctuation': true, +}; + +/** + * Select elements containing specific content. For example, `a:has(img)` selects all `<a>` elements that contain an `<img>` child. + * @see https://caniuse.com/css-has + */ + +/** + * @type {import('../features').Feature} + */ +var cssHas = checkSelector(':has'); + +var cssHyphens = { + 'hyphens': true, +}; + +var cssImageOrientation = { + 'image-orientation': true, +}; + +/** + * Method of letting the browser pick the most appropriate CSS image from a given set. + * @see https://caniuse.com/css-image-set + */ + +/** + * @type {import('../features').Feature} + */ +var cssImageSet = { + '': 'image-set(', +}; + +/** + * If a temporal or number `<input>` has `max` and/or `min` attributes, then `:in-range` matches when the value is within the specified range and `:out-of-range` matches when the value is outside the specified range. If there are no range constraints, then neither pseudo-class matches. + * @see https://caniuse.com/css-in-out-of-range + */ + +/** + * @type {import('../features').Feature} + */ +var cssInOutOfRange = checkSelector([ + ':in-range', + ':out-of-range', +]); + +/** + * The `:indeterminate` pseudo-class matches indeterminate checkboxes, indeterminate `<progress>` bars, and radio buttons with no checked button in their radio button group. + * @see https://caniuse.com/css-indeterminate-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssIndeterminatePseudo = checkSelector(':indeterminate'); + +/** + * Method of creating an enlarged cap, including a drop or raised cap, in a robust way. + * @see https://caniuse.com/css-initial-letter + */ + +/** + * @type {import('../features').Feature} + */ +var cssInitialLetter = { + 'initial-letter': true, +}; + +var cssInitialValue = { + '': 'initial', +}; + +/** + * The `lch()` and `lab()` color functions are based on the CIE LAB color space, representing colors in a way that closely matches human perception and provides access to a wider spectrum of colors than offered by the usual RGB color space. + * @see https://caniuse.com/css-lch-lab + */ + +/** + * @type {import('../features').Feature} + */ +var cssLchLab = { + '': [ + 'lch(', + 'lab(', + ], +}; + +/** + * Controls spacing between characters of text (i.e. "tracking" in typographical terms). Not to be confused with kerning. + * @see https://caniuse.com/css-letter-spacing + */ + +/** + * @type {import('../features').Feature} + */ +var cssLetterSpacing = { + 'letter-spacing': true, +}; + +/** + * CSS property that will contain text to a given amount of lines when used in combination with `display: -webkit-box`. It will end with ellipsis when `text-overflow: ellipsis` is included. + * @see https://caniuse.com/css-line-clamp + */ + +/** + * @type {import('../features').Feature} + */ +var cssLineClamp = { + 'line-clamp': true, + '-webkit-line-clamp': true, +}; + +var cssLogicalProps = { + 'block-size': true, + 'inline-size': true, + 'min-block-size': true, + 'min-inline-size': true, + 'max-block-size': true, + 'max-inline-size': true, + 'margin-block-start': true, + 'margin-block-end': true, + 'margin-inline-start': true, + 'margin-inline-end': true, + 'margin-block': true, + 'margin-inline': true, + 'inset-block-start': true, + 'inset-block-end': true, + 'inset-inline-start': true, + 'inset-inline-end': true, + 'inset-block': true, + 'inset-inline': true, + 'inset': true, + 'padding-block-start': true, + 'padding-block-end': true, + 'padding-inline-start': true, + 'padding-inline-end': true, + 'padding-block': true, + 'padding-inline': true, + 'border-block-start-width': true, + 'border-block-end-width': true, + 'border-inline-start-width': true, + 'border-inline-end-width': true, + 'border-block-width': true, + 'border-inline-width': true, + 'border-block-start-style': true, + 'border-block-end-style': true, + 'border-inline-start-style': true, + 'border-inline-end-style': true, + 'border-block-style': true, + 'border-inline-style': true, + 'border-block-start-color': true, + 'border-block-end-color': true, + 'border-inline-start-color': true, + 'border-inline-end-color': true, + 'border-block-color': true, + 'border-inline-color': true, + 'border-block-start': true, + 'border-block-end': true, + 'border-inline-start': true, + 'border-inline-end': true, + 'border-block': true, + 'border-inline': true, + 'border-start-start-radius': true, + 'border-start-end-radius': true, + 'border-end-start-radius': true, + 'border-end-end-radius': true, + 'text-align': ['start', 'end'], + 'float': ['inline-start', 'inline-end'], + 'resize': ['block', 'inline'], + 'overflow-block': true, + 'overflow-inline': true, +}; + +/** + * The `::marker` pseudo-element allows list item markers to be styled or have their content value customized. + * @see https://caniuse.com/css-marker-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssMarkerPseudo = checkSelector(':marker'); + +var cssMasks = { + 'clip-path': true, + 'mask': true, + 'mask-border': true, + 'mask-border-mode': true, + 'mask-border-outset': true, + 'mask-border-repeat': true, + 'mask-border-slice': true, + 'mask-border-source': true, + 'mask-border-width': true, + 'mask-clip': true, + 'mask-composite': true, + 'mask-image': true, + 'mask-mode': true, + 'mask-origin': true, + 'mask-position': true, + 'mask-repeat': true, + 'mask-size': true, + 'mask-type': true, + // and webkit versions + '-webkit-clip-path': true, + '-webkit-mask': true, + '-webkit-mask-border': true, + '-webkit-mask-border-mode': true, + '-webkit-mask-border-outset': true, + '-webkit-mask-border-repeat': true, + '-webkit-mask-border-slice': true, + '-webkit-mask-border-source': true, + '-webkit-mask-border-width': true, + '-webkit-mask-clip': true, + '-webkit-mask-composite': true, + '-webkit-mask-image': true, + '-webkit-mask-mode': true, + '-webkit-mask-origin': true, + '-webkit-mask-position': true, + '-webkit-mask-repeat': true, + '-webkit-mask-size': true, + '-webkit-mask-type': true, +}; + +var cssMatchesPseudo = checkSelector([ + ':is', + ':where', + ':matches', + ':any', + ':-webkit-any', + ':-webkit-is', + ':-webkit-where', + ':-webkit-matches', +]); + +var cssMathFunctions = { + '': ['min(', 'max(', 'clamp('], +}; + +/** + * Allows a media query to be set based on the presence and accuracy of the user's pointing device, and whether they have the ability to hover over elements on the page. This includes the `pointer`, `any-pointer`, `hover`, and `any-hover` media features. + * @see https://caniuse.com/css-media-interaction + */ + +/** + * @type {import('../features').Feature} + */ +var cssMediaInteraction = checkAtRule('media', [ + 'pointer', + 'any-pointer', + 'hover', + 'any-hover', +]); + +var cssMediaRangeSyntax = checkAtRule('media', [' > ', ' < ', ' <= ', ' >= ']); + +var cssMediaResolution = checkAtRule('media', ['min-resolution', 'max-resolution', 'resolution', 'device-pixel-ratio']); + +/** + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=Media+Queries:+scripting+media+feature + */ + +/** + * @type {import('../features').Feature} + */ +var cssMediaScripting = checkAtRule('media', ['scripting']); + +var cssMediaqueries = checkAtRule(['media']); + +var cssMixblendmode = { + 'mix-blend-mode': true, +}; + +var cssMotionPaths = { + 'offset-path': true, +}; + +/** + * Using the `@namespace` at-rule, elements of other namespaces (e.g. SVG) can be targeted using the pipe (`|`) selector. + * @see https://caniuse.com/css-namespaces + */ + +/** + * @type {import('../features').Feature} + */ +var cssNamespaces = checkAtRule('namespace'); + +/** + * CSS nesting provides the ability to nest one style rule inside another, with the selector of the child rule relative to the selector of the parent rule. Similar behavior previously required a CSS pre-processor. + * @see https://caniuse.com/css-nesting + */ + +/** + * @type {import('../features').Feature} + */ +var cssNesting = (rule) => { + if (rule.type === 'rule' && rule.parent.type === 'rule') { + return true; + } + + if (rule.type === 'atrule' && rule.parent.type === 'rule') { + return true; + } + + return false; +}; + +/** + * Selectors Level 3 only allowed `:not()` pseudo-class to accept a single simple selector, which the element must not match any of. Thus, `:not(a, .b, [c])` or `:not(a.b[c])` did not work. Selectors Level 4 allows `:not()` to accept a list of selectors. Thus, `:not(a):not(.b):not([c])` can instead be written as `:not(a, .b, [c])` and `:not(a.b[c])` works as intended. + * @see https://caniuse.com/css-not-sel-list + */ + +/** + * @type {import('../features').Feature} + */ +var cssNotSelList = checkSelector( + (selector) => selector.includes(':not(') && !/:not\(.?#?-?[\w[\]-]+\)/.test(selector), +); + +/** + * The newest versions of `:nth-child()` and `:nth-last-child()` accept an optional `of S` clause which filters the children to only those which match the selector list `S`. For example, `:nth-child(1 of .foo)` selects the first child among the children that have the `foo` class (ignoring any non-`foo` children which precede that child). Similar to `:nth-of-type`, but for arbitrary selectors instead of only type selectors. + * @see https://caniuse.com/css-nth-child-of + */ + +/** + * @type {import('../features').Feature} + */ +var cssNthChildOf = checkSelector( + (selector) => /:nth-(child|last-child)\(\s*\d+\s*of/.test(selector), +); + +var cssOpacity = { + 'opacity': true, +}; + +/** + * The `:optional` pseudo-class matches form inputs (`<input>`, `<textarea>`, `<select>`) which are not `:required`. + * @see https://caniuse.com/css-optional-pseudo + */ + +/** + * @type {import('../features').Feature} + */ +var cssOptionalPseudo = checkSelector(':optional'); + +/** + * Originally a single property for controlling overflowing content in both horizontal & vertical directions, the `overflow` property is now a shorthand for `overflow-x` & `overflow-y`. The latest version of the specification also introduces the `clip` value that blocks programmatic scrolling. + * @see https://caniuse.com/css-overflow + */ + +/** + * @type {import('../features').Feature} + */ +var cssOverflow = { + 'overflow': true, + 'overflow-x': true, + 'overflow-y': true, +}; + +/** + * Changes in DOM elements above the visible region of a scrolling box can result in the page moving while the user is in the middle of consuming the content. By default, the value of `overflow-anchor` is `auto`, it can mitigate this jarring user experience by keeping track of the position of an anchor node and adjusting the scroll offset accordingly + * @see https://caniuse.com/css-overflow-anchor + */ + +/** + * @type {import('../features').Feature} + */ +var cssOverflowAnchor = { + 'overflow-anchor': true, +}; + +var cssOverflowOverlay = { + 'overflow': 'overlay', +}; + +var cssOverscrollBehavior = { + 'overscroll-behavior': true, + 'overscroll-behavior-x': true, + 'overscroll-behavior-y': true, +}; + +/** + * Properties to control the way elements are broken across (printed) pages. + * @see https://caniuse.com/css-page-break + */ + +/** + * @type {import('../features').Feature} + */ +var cssPageBreak = { + 'page-break-after': true, + 'page-break-before': true, + 'page-break-inside': true, +}; + +/** + * CSS at-rule (`@page`) to define page-specific rules when printing web pages, such as margin per page and page dimensions. + * @see https://caniuse.com/css-paged-media + */ + +/** + * @type {import('../features').Feature} + */ +var cssPagedMedia = checkAtRule('page'); + +/** + * Allows programmatic generation of images used by CSS + * @see https://caniuse.com/css-paint-api + */ + +/** + * @type {import('../features').Feature} + */ +var cssPaintApi = { '': 'paint(' }; + +var cssPlaceholder = [ + checkSelector(':placeholder'), +]; + +/** + * :placeholder-shown CSS pseudo-class + * Input elements can sometimes show placeholder text as a hint to the user on what to type in. See, for example, the placeholder attribute in HTML5. The :placeholder-shown pseudo-class matches an input element that is showing such placeholder text. + * @see https://caniuse.com/css-placeholder-shown + */ + +/** + * @type {import('../features').Feature} + */ +var cssPlaceholderShown = checkSelector(':placeholder-shown'); + +var cssPrintColorAdjust = { + 'print-color-adjust': true, +}; + +/** + * CSS :read-only and :read-write selectors + * :read-only and :read-write pseudo-classes to match elements which are considered user-alterable + * @see https://caniuse.com/css-read-only-write + */ + +/** + * @type {import('../features').Feature} + */ +var cssReadOnlyWrite = checkSelector([':read-only', ':read-write']); + +/** + * Rebeccapurple color + * The new color added in CSS Color Module Level 4 + * @see https://caniuse.com/css-rebeccapurple + */ + +/** + * @type {import('../features').Feature} + */ +var cssRebeccapurple = { + '': 'rebeccapurple', +}; + +var cssReflections = { + 'box-reflect': true, + '-webkit-box-reflect': true, +}; + +/** + * CSS Regions + * Method of flowing content into multiple elements, allowing magazine-like layouts. While once supported in WebKit-based browsers and Internet Explorer, implementing the feature is no longer being pursued by any browser. + * @see https://caniuse.com/css-regions + */ + +/** + * @type {import('../features').Feature} + */ +var cssRegions = { + 'flow-into': true, + 'flow-from': true, + '-webkit-flow-into': true, + '-webkit-flow-from': true, +}; + +/** + * CSS Relative colors + * The CSS Relative Color syntax allows a color to be defined relative to another color using the `from` keyword and optionally `calc()` for any of the color values. + * @see https://caniuse.com/css-relative-colors + */ + +/** + * @type {import('../features').Feature} + */ +var cssRelativeColors = { + '': /((rgb)|(rgba)|(hsl)|(hsla)|(hwb))\(\s*from/, +}; + +var cssRepeatingGradients = { + '': [ + 'repeating-linear-gradient', + 'repeating-radial-gradient', + ], +}; + +var cssResize = { + 'resize': true, +}; + +var cssRevertValue = { + '': 'revert', + +}; + +/** + * #rrggbbaa hex color notation + * The CSS Color Module Level 4 defines new 4 & 8 character hex notation for color to include the opacity level. + * @see https://caniuse.com/css-rrggbbaa + */ + +/** + * @type {import('../features').Feature} + */ +var cssRrggbbaa = { + '': [ + /#[\da-f]{8}/i, + /#[\da-f]{4}(\W|$)/i, + ], +}; + +/** + * CSS Scroll-behavior + * Method of specifying the scrolling behavior for a scrolling box, when scrolling happens due to navigation or CSSOM scrolling APIs. + * @see https://caniuse.com/css-scroll-behavior + */ + +/** + * @type {import('../features').Feature} + */ +var cssScrollBehavior = { + 'scroll-behavior': true, +}; + +/** + * CSS @scroll-timeline + * CSS property that allows animations to be driven by a container's scroll position + * @see https://caniuse.com/css-scroll-timeline + */ + +const checkAt = checkAtRule('scroll-timeline'); + +/** + * @type {import('../features').Feature} + */ +var cssScrollTimeline = (node) => { + // check for @scroll-timeline + if (checkAt(node)) { + return true; + } + + // check for animation-timeline + if (node.type !== 'decl') return false; + if (node.prop.startsWith('animation-timeline')) { + return true; + } + + return false; +}; + +var cssScrollbar = { + 'scrollbar-color': true, + 'scrollbar-width': true, +}; + +const ATTRIBUTE_IDENTIFIER$1 = '[^\\~|^$*\\]]*'; + +// Export for testing +const REGEXES$1 = { + 'HAS_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\]`), + 'MATCH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}=${ATTRIBUTE_IDENTIFIER$1}\\]`), + 'WORD_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\~=${ATTRIBUTE_IDENTIFIER$1}\\]`), + 'SUBCODE_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER$1}\\|=${ATTRIBUTE_IDENTIFIER$1}\\]`), + 'BRACKET_PARENS': /(\[[^=\]]*(=("[^"]*")|[^\]]+|)])|(\([^)]*\))/g, +}; + +/** + * @param {RegExp} pattern + * @return {(str:string) => boolean} + */ +function matchOutsideOfBrackets(pattern) { + if (!(pattern instanceof RegExp)) { + throw new TypeError('matchOutsideOfBrackets expects a RegExp'); + } + return (string) => pattern.test(string.replaceAll(REGEXES$1.BRACKET_PARENS, '')); +} + +var cssSel2 = checkSelector([ + ':first-child', + ':link', + ':visited', + ':active', + ':hover', + ':focus', + ':lang', + REGEXES$1.HAS_ATTRIBUTE, + REGEXES$1.MATCH_ATTRIBUTE, + REGEXES$1.WORD_ATTRIBUTE, + REGEXES$1.SUBCODE_ATTRIBUTE, + matchOutsideOfBrackets(/\*/), + matchOutsideOfBrackets(/>/), + matchOutsideOfBrackets(/\+/), + matchOutsideOfBrackets(/\./), + matchOutsideOfBrackets(/#/), +]); + +const ATTRIBUTE_IDENTIFIER = '[^\\~|^$*\\]]*'; + +// Export for testing +const REGEXES = { + 'SIBLING_SELECTOR': /^[^[]*~/, + 'STARTSWITH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\^=${ATTRIBUTE_IDENTIFIER}\\]`), + 'ENDSWITH_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\$=${ATTRIBUTE_IDENTIFIER}\\]`), + 'INSENSITIVE_ATTRIBUTE': new RegExp(`\\[${ATTRIBUTE_IDENTIFIER}\\*=${ATTRIBUTE_IDENTIFIER}\\]`), +}; + +var cssSel3 = checkSelector([ + ':root', + ':nth-child', + ':nth-last-child', + 'nth-of-type', + 'nth-last-of-type', + ':last-child', + ':first-of-type', + ':last-of-type', + ':only-child', + ':only-of-type', + ':empty', + ':target', + ':enabled', + ':disabled', + ':checked', + ':not', + REGEXES.SIBLING_SELECTOR, + REGEXES.STARTSWITH_ATTRIBUTE, + REGEXES.ENDSWITH_ATTRIBUTE, + REGEXES.INSENSITIVE_ATTRIBUTE, +]); + +var cssSelection = checkSelector(':selection'); + +var cssShapes = { + 'shape-outside': true, + 'shape-image-threshold': true, + 'shape-margin': true, +}; + +/** + * CSS Scroll Snap + * CSS technique that allows customizable scrolling experiences like pagination of carousels by setting defined snap positions. + * @see https://caniuse.com/css-snappoints + */ + +/** + * @type {import('../features').Feature} + */ +var cssSnappoints = { + 'scroll-snap-type': true, + 'scroll-padding': true, + 'scroll-padding-top': true, + 'scroll-padding-right': true, + 'scroll-padding-bottom': true, + 'scroll-padding-left': true, + 'scroll-padding-inline': true, + 'scroll-padding-inline-start': true, + 'scroll-padding-inline-end': true, + 'scroll-padding-block': true, + 'scroll-padding-block-start': true, + 'scroll-padding-block-end': true, + 'scroll-snap-align': true, + 'scroll-margin': true, + 'scroll-margin-top': true, + 'scroll-margin-right': true, + 'scroll-margin-bottom': true, + 'scroll-margin-left': true, + 'scroll-margin-inline': true, + 'scroll-margin-inline-start': true, + 'scroll-margin-inline-end': true, + 'scroll-margin-block': true, + 'scroll-margin-block-start': true, + 'scroll-margin-block-end': true, + 'scroll-snap-stop': true, +}; + +var cssSticky = { + 'position': 'sticky', +}; + +/** + * CSS Subgrid + * Feature of the CSS Grid Layout Module Level 2 that allows a grid-item with its own grid to align in one or both dimensions with its parent grid. + * @see https://caniuse.com/css-subgrid + */ + +/** + * @type {import('../features').Feature} + */ +var cssSubgrid = { + '': 'subgrid', +}; + +/** + * CSS.supports() API + * The CSS.supports() static methods returns a Boolean value indicating if the browser supports a given CSS feature, or not. + * @see https://caniuse.com/css-supports-api + */ + +/** + * @type {import('../features').Feature} + */ +var cssSupportsApi = {}; + +/* this feature appears in JS, so it's not linted by this tool */ + +var cssTable = { + 'display': [ + 'table', + 'table-', + 'inline-table', + ], +}; + +/** + * CSS3 text-align-last + * CSS property to describe how the last line of a block or a line right before a forced line break when `text-align` is `justify`. + * @see https://caniuse.com/css-text-align-last + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextAlignLast = { + 'text-align-last': true, +}; + +/** + * CSS text-box-trim & text-box-edge + * Provides the ability to remove the vertical space appearing above and below text glyphs, allowing more precise positioning and alignment. Previously specified as the `leading-trim` & `text-edge` properties. + * @see https://caniuse.com/css-text-box-trim + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextBoxTrim = { + 'text-box-trim': true, + 'text-box-edge': true, +}; + +/** + * CSS text-indent + * The `text-indent` property applies indentation to lines of inline content in a block. + * @see https://caniuse.com/css-text-indent + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextIndent = { + 'text-indent': true, +}; + +/** + * CSS text-justify + * CSS property to define how text should be justified when `text-align: justify` is set. + * @see https://caniuse.com/css-text-justify + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextJustify = { + 'text-justify': true, +}; + +/** + * CSS text-orientation + * The CSS `text-orientation` property specifies the orientation of text within a line. Current values only have an effect in vertical typographic modes (defined with the `writing-mode` property) + * @see https://caniuse.com/css-text-orientation + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextOrientation = { + 'text-orientation': true, +}; + +/** + * CSS Text 4 text-spacing + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=CSS+Text+4+text-spacing + */ + +/** + * @type {import('../features').Feature} + */ +var cssTextSpacing = { + 'text-spacing': true, +}; + +var cssTextshadow = { + 'text-shadow': true, +}; + +var cssTouchAction = { + 'touch-action': true, +}; + +var cssTransitions = { + 'transition': true, + 'transition-property': true, + 'transition-duration': true, + 'transition-delay': true, + 'transition-timing-function': true, +}; + +/** + * CSS unicode-bidi property + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=CSS+unicode-bidi+property + */ + +/** + * @type {import('../features').Feature} + */ +var cssUnicodeBidi = { + 'unicode-bidi': true, +}; + +var cssUnsetValue = { + '': 'unset', +}; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +var cssVariables = (rule) => { + if (rule.type !== 'decl') return false; + return (rule.prop.startsWith('--') || rule.value.includes('var(')); +}; + +/** + * CSS @when / @else conditional rules + * Syntax allowing CSS conditions (like media and support queries) to be written more simply, as well as making it possibly to write mutually exclusive rules using `@else` statements. + * @see https://caniuse.com/css-when-else + */ + +/** + * @type {import('../features').Feature} + */ +var cssWhenElse = checkAtRule(['when', 'else']); + +/** + * CSS widows & orphans + * CSS properties to control when lines break across pages or columns by defining the amount of lines that must be left before or after the break. + * @see https://caniuse.com/css-widows-orphans + */ + +/** + * @type {import('../features').Feature} + */ +var cssWidowsOrphans = { + 'widows': true, + 'orphans': true, +}; + +/** + * width: stretch property + * No description available. + * @see This feature comes from MDN: https://developer.mozilla.org/en-US/search?q=width:+stretch+property + */ + +/** + * @type {import('../features').Feature} + */ +var cssWidthStretch = { + 'width': 'stretch', +}; + +/** + * CSS writing-mode property + * Property to define whether lines of text are laid out horizontally or vertically and the direction in which blocks progress. + * @see https://caniuse.com/css-writing-mode + */ + +/** + * @type {import('../features').Feature} + */ +var cssWritingMode = { + 'writing-mode': true, +}; + +/** + * CSS zoom + * Non-standard method of scaling content. + * @see https://caniuse.com/css-zoom + */ + +/** + * @type {import('../features').Feature} + */ +var cssZoom = { + 'zoom': true, +}; + +/** + * CSS3 attr() function for all properties + * While `attr()` is supported for effectively all browsers for the `content` property, CSS Values and Units Level 5 adds the ability to use `attr()` on **any** CSS property, and to use it for non-string values (e.g. numbers, colors). + * @see https://caniuse.com/css3-attr + */ + +/** + * @type {import('../features').Feature} + */ +var css3Attr = (rule) => { + if (rule.type !== 'decl') return false; + if (rule.prop === 'content') { + return false; + } + + return rule.toString().includes('attr('); +}; + +var css3Boxsizing = { + 'box-sizing': true, +}; + +var css3Colors = { + '': [ + 'rgba', + 'hsl', + 'hsla', + ], +}; + +var css3Cursors = { + 'cursor': [ + 'none', + 'context-menu', + 'cell', + 'vertical-text', + 'alias', + 'copy', + 'no-drop', + 'not-allowed', + 'nesw-resize', + 'nwse-resize', + 'col-resize', + 'row-resize', + 'all-scroll', + ], +}; + +var css3CursorsGrab = { + 'cursor': ['grab', 'grabbing'], +}; + +var css3CursorsNewer = { + 'cursor': ['zoom-in', 'zoom-out'], +}; + +var css3Tabsize = { + 'tab-size': true, +}; + +/** + * CSS currentColor value + * A CSS value that will apply the existing `color` value to other properties like `background-color`, etc. + * @see https://caniuse.com/currentcolor + */ + +/** + * @type {import('../features').Feature} + */ +var currentcolor = { + '': 'currentColor', +}; + +/** + * Window.devicePixelRatio + * Read-only property that returns the ratio of the (vertical) size of one physical pixel on the current display device to the size of one CSS pixel. + * @see https://caniuse.com/devicepixelratio + */ + +/** + * @type {import('../features').Feature} + */ +var devicepixelratio = {}; + +/* this feature is found in JS and is not linted by this tool */ + +/** + * ui-serif, ui-sans-serif, ui-monospace and ui-rounded values for font-family + * Allows more control when choosing system interface fonts + * @see https://caniuse.com/extended-system-fonts + */ + +/** + * @type {import('../features').Feature} + */ +var extendedSystemFonts = { + 'font-family': ['ui-serif', 'ui-sans-serif', 'ui-monospace', 'ui-rounded'], +}; + +var flexbox = { + 'display': [ + 'flex', + 'inline-flex', + ], + 'flex': true, + 'flex-grow': true, + 'flex-shrink': true, + 'flex-basis': true, + 'flex-direction': true, + 'flex-wrap': true, + 'flex-flow': true, +}; + +/** + * gap property for Flexbox + * `gap` for flexbox containers to create gaps/gutters between flex items + * @see https://caniuse.com/flexbox-gap + */ + +/** + * @type {import('../features').Feature} + */ +var flexboxGap = (rule) => { + if (/display:\s(inline-)?flex/.test(rule.toString()) + && rule.toString().includes('gap:') + ) { + return true; + } + + return false; +}; + +/** + * display: flow-root + * The element generates a block container box, and lays out its contents using flow layout. It always establishes a new block formatting context for its contents. It provides a better solution to the most use cases of the "clearfix" hack. + * @see https://caniuse.com/flow-root + */ + +/** + * @type {import('../features').Feature} + */ +var flowRoot = { + 'display': 'flow-root', +}; + +/** + * system-ui value for font-family + * Value for `font-family` that represents the default user interface font. + * @see https://caniuse.com/font-family-system-ui + */ + +/** + * @type {import('../features').Feature} + */ +var fontFamilySystemUi = { + 'font-family': 'system-ui', +}; + +var fontFeature = { + 'font-feature-settings': true, + 'font-variant-ligatures': true, + 'font-language-override': true, + 'font-kerning': true, +}; + +/** + * CSS3 font-kerning + * Controls the usage of the kerning information (spacing between letters) stored in the font. Note that this only affects OpenType fonts with kerning information, it has no effect on other fonts. + * @see https://caniuse.com/font-kerning + */ + +/** + * @type {import('../features').Feature} + */ +var fontKerning = { + 'font-kerning': true, +}; + +/** + * CSS Font Loading + * This CSS module defines a scripting interface to font faces in CSS, allowing font faces to be easily created and loaded from script. It also provides methods to track the loading status of an individual font, or of all the fonts on an entire page. + * @see https://caniuse.com/font-loading + */ + +/** + * @type {import('../features').Feature} + */ +var fontLoading = {}; + +/* this feature appears in JS and as such is not linted */ + +var fontSizeAdjust = { + 'font-size-adjust': true, +}; + +/** + * CSS font-smooth + * Controls the application of anti-aliasing when fonts are rendered. + * @see https://caniuse.com/font-smooth + */ + +/** + * @type {import('../features').Feature} + */ +var fontSmooth = { + 'font-smooth': true, +}; + +var fontUnicodeRange = { + 'unicode-range': true, +}; + +/** + * CSS font-variant-alternates + * Controls the usage of alternate glyphs associated to alternative names defined in @font-feature-values for certain types of OpenType fonts. + * @see https://caniuse.com/font-variant-alternates + */ + +/** + * @type {import('../features').Feature} + */ +var fontVariantAlternates = { + 'font-variant-alternates': true, +}; + +/** + * CSS font-variant-numeric + * CSS property that provides different ways of displaying numbers, fractions, and ordinal markers. + * @see https://caniuse.com/font-variant-numeric + */ + +/** + * @type {import('../features').Feature} + */ +var fontVariantNumeric = { + 'font-variant-numeric': true, +}; + +var fontface = [ + checkAtRule('font-face'), +]; + +var fullscreen = checkSelector(':fullscreen'); + +/** + * getComputedStyle + * API to get the current computed CSS styles applied to an element. This may be the current value applied by an animation or as set by a stylesheet. + * @see https://caniuse.com/getcomputedstyle + */ + +/** + * @type {import('../features').Feature} + */ +var getcomputedstyle = {}; + +/* this is a js api, so we don't lint it */ + +var inlineBlock = { + 'display': 'inline-block', +}; + +const VALUES = ['max-content', 'min-content', 'fit-content', 'fill-available', 'stretch', 'fill']; + +var intrinsicWidth = { + 'width': VALUES, + 'min-width': VALUES, + 'max-width': VALUES, + 'height': VALUES, + 'min-height': VALUES, + 'max-height': VALUES, +}; + +/** + * CSS justify-content: space-evenly + * The "space-evenly" value for the `justify-content` property distributes the space between items evenly. It is similar to space-around but provides equal instead of half-sized space on the edges. Can be used in both CSS flexbox & grid. + * @see https://caniuse.com/justify-content-space-evenly + */ + +/** + * @type {import('../features').Feature} + */ +var justifyContentSpaceEvenly = { + 'justify-content': 'space-evenly', +}; + +var kerningPairsLigatures = { + 'text-rendering': 'optimizeLegibility', +}; + +var mdnCssUnicodeBidiIsolate = { + 'unicode-bidi': 'isolate', +}; + +var mdnCssUnicodeBidiIsolateOverride = { + 'unicode-bidi': 'isolate-override', +}; + +var mdnCssUnicodeBidiPlaintext = { + 'unicode-bidi': 'plaintext', +}; + +var mdnTextDecorationColor = { + 'text-decoration-color': true, +}; + +var mdnTextDecorationLine = { + 'text-decoration-line': true, +}; + +var mdnTextDecorationShorthand = { + 'text-decoration': true, +}; + +var mdnTextDecorationStyle = { + 'text-decoration-style': true, +}; + +var minmaxwh = { + 'min-width': true, + 'max-width': true, + 'min-height': true, + 'max-height': true, +}; + +/** + * @param {import('postcss').ChildNode} rule + * @return {boolean} + */ +var multibackgrounds = (rule) => { + if (rule.type !== 'decl') return false; + if (!/^background-?/.test(rule.prop)) return false; + return postcss.list.comma(rule.value).length > 1; +}; + +var multicolumn = { + 'columns': true, + 'column-width': true, + 'column-gap': true, + 'column-rule': true, + 'column-rule-color': true, + 'column-rule-width': true, + 'column-count': true, + 'column-rule-style': true, + 'column-span': true, + 'column-fill': true, + 'break-before': true, + 'break-after': true, + 'break-inside': true, +}; + +var objectFit = { + 'object-fit': true, + 'object-position': true, +}; + +var outline = { + 'outline': true, + 'outline-style': true, + 'outline-width': true, + 'outline-color': true, +}; + +var pointer = { + 'touch-action': true, +}; + +var pointerEvents = { + 'pointer-events': true, +}; + +/** + * prefers-color-scheme media query + * Media query to detect if the user has set their system to use a light or dark color theme. + * @see https://caniuse.com/prefers-color-scheme + */ + +/** + * @type {import('../features').Feature} + */ +var prefersColorScheme = checkAtRule('media', 'prefers-color-scheme'); + +/** + * TODO: initially implement feature + * prefers-reduced-motion media query + * CSS media query based on a user preference for preferring reduced motion (animation, etc). + * @see https://caniuse.com/prefers-reduced-motion + */ + +/** + * @type {import('../features').Feature} + */ +var prefersReducedMotion = checkAtRule('media', 'prefers-reduced-motion'); + +var rem = checkCSSLengthUnits('rem'); + +/** + * display: run-in + * If the run-in box contains a block box, same as block. If a block box follows the run-in box, the run-in box becomes the first inline box of the block box. If an inline box follows, the run-in box becomes a block box. + * @see https://caniuse.com/run-in + */ + +/** + * @type {import('../features').Feature} + */ +var runIn = { + 'display': 'run-in', +}; + +/** + * Scoped CSS + * Allows CSS rules to be scoped to part of the document, based on the position of the style element. The attribute has been [removed from the current specification](https://github.com/whatwg/html/issues/552). + * @see https://caniuse.com/style-scoped + */ + +/** + * @type {import('../features').Feature} + */ +var styleScoped = {}; + +/* this feature appears in HTML, so we don't lint it */ + +/** + * SVG in CSS backgrounds + * Method of using SVG images as CSS backgrounds + * @see https://caniuse.com/svg-css + */ + +/** + * @type {import('../features').Feature} + */ +var svgCss = (rule) => { + if (rule.type !== 'decl') return false; + if (/url\([\S\s]*svg/g.test( + rule.toString(), + )) { + return true; + } + + return false; +}; + +var textDecoration = { + 'text-decoration-style': true, + 'text-decoration-line': true, + 'text-decoration-color': true, + 'text-decoration': /\w \w/, + 'text-decoration-thickness': true, + 'text-decoration-skip': true, + 'text-decoration-skip-ink': true, +}; + +/** + * text-emphasis styling + * Method of using small symbols next to each glyph to emphasize a run of text, commonly used in East Asian languages. The `text-emphasis` shorthand, and its `text-emphasis-style` and `text-emphasis-color` longhands, can be used to apply marks to the text. The `text-emphasis-position` property, which inherits separately, allows setting the emphasis marks' position with respect to the text. + * @see https://caniuse.com/text-emphasis + */ + +/** + * @type {import('../features').Feature} + */ +var textEmphasis = { + 'text-emphasis': true, + 'text-emphasis-style': true, + 'text-emphasis-color': true, + 'text-emphasis-position': true, +}; + +var textOverflow = { + 'text-overflow': true, +}; + +var textSizeAdjust = { + 'text-size-adjust': true, +}; + +/** + * CSS text-stroke and text-fill + * Method of declaring the outline (stroke) width and color for text. + * @see https://caniuse.com/text-stroke + */ + +/** + * @type {import('../features').Feature} + */ +var textStroke = { + 'text-stroke-color': true, + 'text-stroke-width': true, + 'text-stroke': true, + 'text-fill-color': true, +}; + +var transforms2d = { + 'transform': true, + 'transform-origin': true, +}; + +var transforms3d = { + 'perspective': true, + 'perspective-origin': true, + 'transform-style': true, + 'backface-visibility': true, + 'transform': '3d', +}; + +/** + * TTF/OTF - TrueType and OpenType font support + * Support for the TrueType (.ttf) and OpenType (.otf) outline font formats in @font-face. + * @see https://caniuse.com/ttf + */ + +/** + * @type {import('../features').Feature} + */ +var ttf = (rule) => { + const ruleText = rule.toString(); + + if (ruleText.includes('@font-face') && ( + (ruleText.includes('.ttf') || ruleText.includes('.otf')) + )) { + return true; + } + + return false; +}; + +var userSelectNone = { + 'user-select': true, +}; + +/** + * Variable fonts + * OpenType font settings that allows a single font file to behave like multiple fonts: it can contain all the allowed variations in width, weight, slant, optical size, or any other exposed axes of variation as defined by the font designer. Variations can be applied via the `font-variation-settings` property. + * @see https://caniuse.com/variable-fonts + */ + +/** + * @type {import('../features').Feature} + */ +var variableFonts = { + 'font-variation-settings': true, +}; + +/** + * Small, Large, and Dynamic viewport units + * Viewport units similar to `vw` and `vh` that are based on shown or hidden + * browser UI states to address shortcomings of the original units. Currently + * defined as the + * `sv*` units (`svb`, `svh`, `svi`, `svmax`, `svmin`, `svw`), + * `lv*` units (`lvb`, `lvh`, `lvi`, `lvmax`, `lvmin`, `lvw`), + * `dv*` units (`dvb`, `dvh`, `dvi`, `dvmax`, `dvmin`, `dvw`) + * and the logical `vi`/`vb` units. + * @see https://caniuse.com/viewport-unit-variants + * @type {import('../features').Feature} + */ +var viewportUnitVariants = checkCSSLengthUnits( + /* sv* units */ + 'svb', + 'svh', + 'svi', + 'svmax', + 'svmin', + 'svw', + + /* lv* units */ + 'lvb', + 'lvh', + 'lvi', + 'lvmax', + 'lvmin', + 'lvw', + + /* dv* units */ + 'dvb', + 'dvh', + 'dvi', + 'dvmax', + 'dvmin', + 'dvw', + + /* vi/vb units */ + 'vi', + 'vb', +); + +var viewportUnits = { + '': [ + 'vw', + 'vh', + 'vmin', + 'vmax', + ], +}; + +/** + * CSS -webkit-user-drag property + * The non-standard `-webkit-user-drag` CSS property can be used to either make an element draggable or explicitly non-draggable (like links and images). See the standardized [draggable attribute/property](/mdn-api_htmlelement_draggable) for the recommended alternative method of accomplishing the same functionality. + * @see https://caniuse.com/webkit-user-drag + */ + +/** + * @type {import('../features').Feature} + */ +var webkitUserDrag = { + 'webkit-user-drag': true, +}; + +var willChange = { + 'will-change': true, +}; + +var wordBreak = { + 'word-break': true, +}; + +var wordwrap = { + 'overflow-wrap': true, + 'word-wrap': true, +}; + +/* THIS FILE IS AUTOGENERATED */ + +/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */ + +/** @typedef {((rule:import('postcss').ChildNode) => boolean)} RuleCheck */ + +/** @typedef {Record<string, FeatureCheck|FeatureCheck[]|boolean> | RuleCheck | RuleCheck[]} Feature */ + +/** @enum {Feature} */ +const FEATURES = { + 'alternate-stylesheet': alternateStylesheet, + 'background-attachment': backgroundAttachment, + 'background-clip-text': backgroundClipText, + 'background-img-opts': backgroundImgOpts, + 'background-position-x-y': backgroundPositionXY, + 'background-repeat-round-space': backgroundRepeatRoundSpace, + 'border-image': borderImage, + 'border-radius': borderRadius, + 'calc': calc, + 'ch-unit': chUnit, + 'css-all': cssAll, + 'css-animation': cssAnimation, + 'css-any-link': cssAnyLink, + 'css-appearance': cssAppearance, + 'css-at-counter-style': cssAtCounterStyle, + 'css-autofill': cssAutofill, + 'css-backdrop-filter': cssBackdropFilter, + 'css-background-offsets': cssBackgroundOffsets, + 'css-backgroundblendmode': cssBackgroundblendmode, + 'css-boxdecorationbreak': cssBoxdecorationbreak, + 'css-boxshadow': cssBoxshadow, + 'css-canvas': cssCanvas, + 'css-caret-color': cssCaretColor, + 'css-cascade-layers': cssCascadeLayers, + 'css-case-insensitive': cssCaseInsensitive, + 'css-clip-path': cssClipPath, + 'css-color-adjust': cssColorAdjust, + 'css-color-function': cssColorFunction, + 'css-conic-gradients': cssConicGradients, + 'css-container-queries': cssContainerQueries, + 'css-container-queries-style': cssContainerQueriesStyle, + 'css-container-query-units': cssContainerQueryUnits, + 'css-containment': cssContainment, + 'css-content-visibility': cssContentVisibility, + 'css-counters': cssCounters, + 'css-crisp-edges': cssCrispEdges, + 'css-cross-fade': cssCrossFade, + 'css-default-pseudo': cssDefaultPseudo, + 'css-descendant-gtgt': cssDescendantGtgt, + 'css-deviceadaptation': cssDeviceadaptation, + 'css-dir-pseudo': cssDirPseudo, + 'css-display-contents': cssDisplayContents, + 'css-element-function': cssElementFunction, + 'css-env-function': cssEnvFunction, + 'css-exclusions': cssExclusions, + 'css-featurequeries': cssFeaturequeries, + 'css-file-selector-button': cssFileSelectorButton, + 'css-filter-function': cssFilterFunction, + 'css-filters': cssFilters, + 'css-first-letter': cssFirstLetter, + 'css-first-line': cssFirstLine, + 'css-fixed': cssFixed, + 'css-focus-visible': cssFocusVisible, + 'css-focus-within': cssFocusWithin, + 'css-font-palette': cssFontPalette, + 'css-font-rendering-controls': cssFontRenderingControls, + 'css-font-stretch': cssFontStretch, + 'css-gencontent': cssGencontent, + 'css-gradients': cssGradients, + 'css-grid': cssGrid, + 'css-grid-animation': cssGridAnimation, + 'css-hanging-punctuation': cssHangingPunctuation, + 'css-has': cssHas, + 'css-hyphens': cssHyphens, + 'css-image-orientation': cssImageOrientation, + 'css-image-set': cssImageSet, + 'css-in-out-of-range': cssInOutOfRange, + 'css-indeterminate-pseudo': cssIndeterminatePseudo, + 'css-initial-letter': cssInitialLetter, + 'css-initial-value': cssInitialValue, + 'css-lch-lab': cssLchLab, + 'css-letter-spacing': cssLetterSpacing, + 'css-line-clamp': cssLineClamp, + 'css-logical-props': cssLogicalProps, + 'css-marker-pseudo': cssMarkerPseudo, + 'css-masks': cssMasks, + 'css-matches-pseudo': cssMatchesPseudo, + 'css-math-functions': cssMathFunctions, + 'css-media-interaction': cssMediaInteraction, + 'css-media-range-syntax': cssMediaRangeSyntax, + 'css-media-resolution': cssMediaResolution, + 'css-media-scripting': cssMediaScripting, + 'css-mediaqueries': cssMediaqueries, + 'css-mixblendmode': cssMixblendmode, + 'css-motion-paths': cssMotionPaths, + 'css-namespaces': cssNamespaces, + 'css-nesting': cssNesting, + 'css-not-sel-list': cssNotSelList, + 'css-nth-child-of': cssNthChildOf, + 'css-opacity': cssOpacity, + 'css-optional-pseudo': cssOptionalPseudo, + 'css-overflow': cssOverflow, + 'css-overflow-anchor': cssOverflowAnchor, + 'css-overflow-overlay': cssOverflowOverlay, + 'css-overscroll-behavior': cssOverscrollBehavior, + 'css-page-break': cssPageBreak, + 'css-paged-media': cssPagedMedia, + 'css-paint-api': cssPaintApi, + 'css-placeholder': cssPlaceholder, + 'css-placeholder-shown': cssPlaceholderShown, + 'css-print-color-adjust': cssPrintColorAdjust, + 'css-read-only-write': cssReadOnlyWrite, + 'css-rebeccapurple': cssRebeccapurple, + 'css-reflections': cssReflections, + 'css-regions': cssRegions, + 'css-relative-colors': cssRelativeColors, + 'css-repeating-gradients': cssRepeatingGradients, + 'css-resize': cssResize, + 'css-revert-value': cssRevertValue, + 'css-rrggbbaa': cssRrggbbaa, + 'css-scroll-behavior': cssScrollBehavior, + 'css-scroll-timeline': cssScrollTimeline, + 'css-scrollbar': cssScrollbar, + 'css-sel2': cssSel2, + 'css-sel3': cssSel3, + 'css-selection': cssSelection, + 'css-shapes': cssShapes, + 'css-snappoints': cssSnappoints, + 'css-sticky': cssSticky, + 'css-subgrid': cssSubgrid, + 'css-supports-api': cssSupportsApi, + 'css-table': cssTable, + 'css-text-align-last': cssTextAlignLast, + 'css-text-box-trim': cssTextBoxTrim, + 'css-text-indent': cssTextIndent, + 'css-text-justify': cssTextJustify, + 'css-text-orientation': cssTextOrientation, + 'css-text-spacing': cssTextSpacing, + 'css-textshadow': cssTextshadow, + 'css-touch-action': cssTouchAction, + 'css-transitions': cssTransitions, + 'css-unicode-bidi': cssUnicodeBidi, + 'css-unset-value': cssUnsetValue, + 'css-variables': cssVariables, + 'css-when-else': cssWhenElse, + 'css-widows-orphans': cssWidowsOrphans, + 'css-width-stretch': cssWidthStretch, + 'css-writing-mode': cssWritingMode, + 'css-zoom': cssZoom, + 'css3-attr': css3Attr, + 'css3-boxsizing': css3Boxsizing, + 'css3-colors': css3Colors, + 'css3-cursors': css3Cursors, + 'css3-cursors-grab': css3CursorsGrab, + 'css3-cursors-newer': css3CursorsNewer, + 'css3-tabsize': css3Tabsize, + 'currentcolor': currentcolor, + 'devicepixelratio': devicepixelratio, + 'extended-system-fonts': extendedSystemFonts, + 'flexbox': flexbox, + 'flexbox-gap': flexboxGap, + 'flow-root': flowRoot, + 'font-family-system-ui': fontFamilySystemUi, + 'font-feature': fontFeature, + 'font-kerning': fontKerning, + 'font-loading': fontLoading, + 'font-size-adjust': fontSizeAdjust, + 'font-smooth': fontSmooth, + 'font-unicode-range': fontUnicodeRange, + 'font-variant-alternates': fontVariantAlternates, + 'font-variant-numeric': fontVariantNumeric, + 'fontface': fontface, + 'fullscreen': fullscreen, + 'getcomputedstyle': getcomputedstyle, + 'inline-block': inlineBlock, + 'intrinsic-width': intrinsicWidth, + 'justify-content-space-evenly': justifyContentSpaceEvenly, + 'kerning-pairs-ligatures': kerningPairsLigatures, + 'mdn-css-unicode-bidi-isolate': mdnCssUnicodeBidiIsolate, + 'mdn-css-unicode-bidi-isolate-override': mdnCssUnicodeBidiIsolateOverride, + 'mdn-css-unicode-bidi-plaintext': mdnCssUnicodeBidiPlaintext, + 'mdn-text-decoration-color': mdnTextDecorationColor, + 'mdn-text-decoration-line': mdnTextDecorationLine, + 'mdn-text-decoration-shorthand': mdnTextDecorationShorthand, + 'mdn-text-decoration-style': mdnTextDecorationStyle, + 'minmaxwh': minmaxwh, + 'multibackgrounds': multibackgrounds, + 'multicolumn': multicolumn, + 'object-fit': objectFit, + 'outline': outline, + 'pointer': pointer, + 'pointer-events': pointerEvents, + 'prefers-color-scheme': prefersColorScheme, + 'prefers-reduced-motion': prefersReducedMotion, + 'rem': rem, + 'run-in': runIn, + 'style-scoped': styleScoped, + 'svg-css': svgCss, + 'text-decoration': textDecoration, + 'text-emphasis': textEmphasis, + 'text-overflow': textOverflow, + 'text-size-adjust': textSizeAdjust, + 'text-stroke': textStroke, + 'transforms2d': transforms2d, + 'transforms3d': transforms3d, + 'ttf': ttf, + 'user-select-none': userSelectNone, + 'variable-fonts': variableFonts, + 'viewport-unit-variants': viewportUnitVariants, + 'viewport-units': viewportUnits, + 'webkit-user-drag': webkitUserDrag, + 'will-change': willChange, + 'word-break': wordBreak, + 'wordwrap': wordwrap, +}; + +/** + * @template T + * @typedef {{missing: T, partial: T}} Filter + */ + +/** + * @typedef {Object} MissingSupportResultStats + * @prop {string} title + * @prop {caniuse.Feature} caniuseData + * @prop {string} [missing] + * @prop {Record<string, Record<string, string>>} [missingData] + * @prop {string} [partial] + * @prop {Record<string, Record<string, string>>} [partialData] + */ + +/** + * @typedef {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} BrowserSupportStats + */ + +/** + * @typedef {Object} MissingSupportResult + * @prop {string[][]} browsers + * @prop {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} features + */ + +class BrowserSelection { + #list; + + /** + * @param {string | string[]} [query] + * @param {string | false} [from] + */ + constructor(query, from) { + this.browsersRequest = query; + const options = from ? { path: from } : {}; + this.#list = browserslist__default["default"](this.browsersRequest, options).map((browser) => browser.split(' ')); + } + + /** + * @param {string} browser + * @param {string} version + * @return {string[]|undefined} + */ + test(browser, version) { + const versions = version.split('-'); + + if (versions.length === 1) { + versions.push(versions[0]); + } + + return this.#list.find(([b, v]) => b === browser && v >= versions[0] && v <= versions[1]); + } + + list() { + return [...this.#list]; + } + + /** + * @param {Record<string, Record<string, string>>} browserStats + * @return {string} + */ + static lackingBrowsers(browserStats) { + const result = []; + for (const browser of Object.keys(browserStats)) { + result.push(formatBrowserName(browser, Object.keys(browserStats[browser]))); + } + return result.join(', '); + } + + /** + * @param {import('caniuse-lite').StatsByAgentID} stats + * @return {Filter<Record<string,Record<string, string>>>} + */ + filterStats(stats) { + /** @type {Filter<Record<string,Record<string, string>>>} */ + const result = { missing: {}, partial: {} }; + for (const [browser, versions] of Object.entries(stats)) { + /** @type {Filter<Record<string,string>>} */ + const feature = { missing: {}, partial: {} }; + for (const [version, support] of Object.entries(versions)) { + const selected = this.test(browser, version); + + // check if browser is NOT fully (i.e., don't have 'y' in their stats) supported + if (!selected) continue; + if ((/(^|\s)y($|\s)/.test(support))) continue; + // when it's not partially supported ('a'), it's missing + const type = (/(^|\s)a($|\s)/.test(support) ? 'partial' : 'missing'); + + if (!feature[type]) { + feature[type] = {}; + } + + feature[type][selected[1]] = support; + } + if (Object.keys(feature.missing).length > 0) { + result.missing[browser] = feature.missing; + } + + if (Object.keys(feature.partial).length > 0) { + result.partial[browser] = feature.partial; + } + } + return result; + } + + /** + * Get data on CSS features not supported by the given autoprefixer-like + * browser selection. + * @return {BrowserSupportStats} `features` is an array of: + * ``` + * { + * 'feature-name': { + * title: 'Title of feature' + * missing: "IE (8), Chrome (31)" + * missingData: { + * // map of browser -> version -> (lack of)support code + * ie: { '8': 'n' }, + * chrome: { '31': 'n' } + * } + * partialData: { + * // map of browser -> version -> (partial)support code + * ie: { '7': 'a' }, + * ff: { '29': 'a #1' } + * } + * caniuseData: { + * // caniuse-db json data for this feature + * } + * }, + * 'feature-name-2': {} // etc. + * } + * ``` + * + * `feature-name` is a caniuse-db slug. + */ + compileBrowserSupport() { + /** @type {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} */ + const result = {}; + + for (const key of Object.keys(FEATURES)) { + const feature = /** @type {keyof FEATURES} */ (key); + const packedFeature = caniuse__namespace.features[feature]; + const featureData = caniuse__namespace.feature(packedFeature); + const lackData = this.filterStats(featureData.stats); + const missingData = lackData.missing; + const partialData = lackData.partial; + // browsers with missing or partial support for this feature + const missing = BrowserSelection.lackingBrowsers(missingData); + const partial = BrowserSelection.lackingBrowsers(partialData); + + if (missing.length > 0 || partial.length > 0) { + result[feature] = { + title: featureData.title, + caniuseData: featureData, + ...(missing.length > 0 ? { missingData, missing } : null), + ...(partial.length > 0 ? { partialData, partial } : null), + }; + } + } + + return result; + } + + /** + * @see BrowserSelection.compileBrowserSupport + * @param {ConstructorParameters<typeof this>} constructorParameters + * @return {MissingSupportResult} `{browsers, features}` + */ + static missingSupport(...constructorParameters) { + const selection = new BrowserSelection(...constructorParameters); + return { + browsers: selection.list(), + features: selection.compileBrowserSupport(), + }; + } +} + +/** + * @typedef DetectorCallbackArgument + * @prop {!import('postcss').ChildNode} usage + * @prop {keyof FEATURES} feature + * @prop {(keyof FEATURES & string)[]} ignore + */ + +/** + * @callback DetectorCallback + * @param {DetectorCallbackArgument} result + * @return {any} + */ + +const PLUGIN_OPTION_COMMENT = 'doiuse-'; +const DISABLE_FEATURE_COMMENT = `${PLUGIN_OPTION_COMMENT}disable`; +const ENABLE_FEATURE_COMMENT = `${PLUGIN_OPTION_COMMENT}enable`; + +/** + * Strip the contents of url literals so they aren't matched + * by our naive substring matching. + * @param {string} input + * @return {string} + */ +function stripUrls(input) { + return input.replaceAll(/url\([^)]*\)/g, 'url()'); +} + +/** + * Detect the use of any of a given list of CSS features. + * ``` + * var detector = new Detector(featureList) + * detector.process(css, cb) + * ``` + * + * `featureList`: an array of feature slugs (see caniuse-db) + * `cb`: a callback that gets called for each usage of one of the given features, + * called with an argument like: + * ``` + * { + * usage: {} // postcss node where usage was found + * feature: {} // caniuse-db feature slug + * ignore: {} // caniuse-db feature to ignore in current file + * } + * ``` + */ +class Detector { + /** + * @param {(keyof FEATURES & string)[]} featureList an array of feature slugs (see caniuse-db) + */ + constructor(featureList) { + /** @type {Partial<FEATURES>} */ + this.features = {}; + for (const feature of featureList) { + if (FEATURES[feature]) { + this.features[feature] = FEATURES[feature]; + } + } + /** @type {(keyof FEATURES & string)[]} */ + this.ignore = []; + } + + /** + * @param {import('postcss').Comment} comment + * @return {void} + */ + comment(comment) { + const text = comment.text.toLowerCase(); + + if (!text.startsWith(PLUGIN_OPTION_COMMENT)) return; + const option = text.split(' ', 1)[0]; + const value = text.replace(option, '').trim(); + + switch (option) { + case DISABLE_FEATURE_COMMENT: { + if (value === '') { + // @ts-expect-error Skip cast + this.ignore = Object.keys(this.features); + } else { + for (const feat of value.split(',')) { + /** @type {any} */ + const f = feat.trim(); + if (!this.ignore.includes(f)) { + this.ignore.push(f); + } + } + } + break; + } + case ENABLE_FEATURE_COMMENT: { + if (value === '') { + this.ignore = []; + } else { + const without = new Set(value.split(',').map((feat) => feat.trim())); + this.ignore = this.ignore.filter((index) => !without.has(index)); + } + break; + } + } + } + + /** + * @param {import('postcss').Container} node + * @param {DetectorCallback} callback + * @return {void} + */ + node(node, callback) { + node.each((child) => { + if (child.type === 'comment') { + this.comment(child); + return; + } + + for (const [feat] of Object.entries(this.features).filter(([, featValue]) => { + if (!featValue) return false; + if (typeof featValue === 'function') { + return featValue(child); + } + if (Array.isArray(featValue)) { + return featValue.some((function_) => function_(child)); + } + if (child.type !== 'decl') { + return false; + } + + return Object.entries(featValue).some(([property, value]) => { + if (property !== '' && property !== child.prop) return false; + if (value === true) return true; + if (value === false) return false; + return performFeatureCheck(value, stripUrls(child.value)); + }); + })) { + const feature = /** @type {keyof FEATURES} */ (feat); + callback({ usage: child, feature, ignore: this.ignore }); + } + if (child.type !== 'decl') { + this.node(child, callback); + } + }); + } + + /** + * @param {import('postcss').Root} node + * @param {DetectorCallback} callback + * @return {void} + */ + process(node, callback) { + // Reset ignoring rules specified by inline comments per each file + this.ignore = []; + + // Recursively walk nodes in file + this.node(node, callback); + } +} + +/** @typedef {import('../data/features.js').FeatureKeys} FeatureKeys */ + +/** + * @typedef {Object} OnFeatureUsageArguments + * @prop {FeatureKeys} feature + * @prop {import('./BrowserSelection.js').MissingSupportResultStats|undefined} featureData + * @prop {import('postcss').Node} usage + * @prop {string} message + */ + +/** + * @callback OnFeatureUsage + * @param {OnFeatureUsageArguments} result + * @return {any} + */ + +/** + * @typedef {Object} DoIUseOptions + * @prop {ConstructorParameters<typeof BrowserSelection>[0]} [browsers] + * @prop {FeatureKeys[]} [ignore] + * @prop {OnFeatureUsage} [onFeatureUsage] + * @prop {string[]} [ignoreFiles] + */ + +class DoIUse { + static default = null; + + /** + * @param {DoIUseOptions} [optionsOrBrowserQuery] + */ + constructor(optionsOrBrowserQuery) { + const options = (typeof optionsOrBrowserQuery === 'string') + ? { browsers: optionsOrBrowserQuery } + : { ...optionsOrBrowserQuery }; + this.browserQuery = options.browsers; + this.onFeatureUsage = options.onFeatureUsage; + this.ignoreOptions = options.ignore; + this.ignoreFiles = options.ignoreFiles; + this.info = this.info.bind(this); + this.postcss = this.postcss.bind(this); + } + + /** + * @param {Object} [options] + * @param {ConstructorParameters<typeof BrowserSelection>[1]} [options.from] + */ + info(options = {}) { + const { browsers, features } = BrowserSelection.missingSupport(this.browserQuery, options.from); + + return { + browsers, + features, + }; + } + + /** @type {import('postcss').TransformCallback} */ + postcss(css, result) { + let from; + if (css.source && css.source.input) { + from = css.source.input.file; + } + const { features } = BrowserSelection.missingSupport(this.browserQuery, from); + // @ts-expect-error Needs cast + const detector = new Detector(Object.keys(features)); + + return detector.process(css, ({ feature, usage, ignore }) => { + if (ignore && ignore.includes(feature)) { + return; + } + + if (this.ignoreOptions && this.ignoreOptions.includes(feature)) { + return; + } + + if (!usage.source) { + throw new Error('No source?'); + } + if (this.ignoreFiles && multimatch__default["default"](usage.source.input.from, this.ignoreFiles).length > 0) { + return; + } + + const data = features[feature]; + if (!data) { + throw new Error('No feature data?'); + } + const messages = []; + if (data.missing) { + messages.push(`not supported by: ${data.missing}`); + } + if (data.partial) { + messages.push(`only partially supported by: ${data.partial}`); + } + + let message = `${data.title} ${messages.join(' and ')} (${feature})`; + + result.warn(message, { node: usage, plugin: 'doiuse' }); + + if (this.onFeatureUsage) { + if (!usage.source) { + throw new Error('No usage source?'); + } + const { start, input } = usage.source; + if (!start) { + throw new Error('No usage source start?'); + } + + const map = css.source && css.source.input.map; + const mappedStart = map && map.consumer().originalPositionFor(start); + + const file = (mappedStart && mappedStart.source) || input.file || input.from; + const line = (mappedStart && mappedStart.line) || start.line; + const column = (mappedStart && mappedStart.column) || start.column; + + message = `${file}:${line}:${column}: ${message}`; + + this.onFeatureUsage({ + feature, + featureData: features[feature], + usage, + message, + }); + } + }); + } +} + +/* eslint-disable no-underscore-dangle */ + +/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */ +/** @typedef {import('./SourceMapTransform.js').SourceMapTransformation} SourceMapTransformation */ + +class RuleUsageTransform extends node_stream.Transform { + /** @type {import("postcss").Processor} */ + #processor; + + #skipErrors; + + #filename; + + /** + * @param {Object} options + * @param {string} options.browsers + * @param {FeatureKeys[]} [options.ignore] + * @param {boolean} [options.skipErrors] + * @param {string} [filename] Filename for outputting source code locations. + */ + constructor(options, filename = '<streaming css input>') { + super({ + objectMode: true, + }); + this.#processor = postcss__default["default"]([new DoIUse({ + browsers: options.browsers, + ignore: options.ignore, + onFeatureUsage: (usage) => { + this.push(usage); + }, + })]); + this.#filename = filename; + this.#skipErrors = options.skipErrors; + } + + /** + * @param {SourceMapTransformation} rule + * @param {any} encoding + * @param {Function} callback + */ + async _transform(rule, encoding, callback) { + let caughtError; + try { + const mapper = new sourcemap__default["default"].SourceMapGenerator(); + const lines = rule.content.split('\n'); + let oline = rule.line; + let ocol = rule.column; + for (const [lineNumber, content] of lines.entries()) { + mapper.addMapping({ + generated: { line: lineNumber + 1, column: 1 }, + original: { line: oline, column: ocol }, + source: this.#filename, + }); + mapper.addMapping({ + generated: { line: lineNumber + 1, column: content.length }, + original: { line: oline, column: ocol + content.length }, + source: this.#filename, + }); + oline += 1; + ocol = 1; + } + await this.#processor.process(rule.content, { + from: this.#filename, map: { prev: mapper.toString() }, + }); + } catch (error) { + if (this.#skipErrors) { + this.emit('warning', error); + } else { + caughtError = error; + } + } + callback(caughtError); + } +} + +/* eslint-disable no-underscore-dangle */ + +const NEW_LINE_CHAR = '\n'.codePointAt(0); + +/** + * @typedef {Object} SourceMapTransformation + * @prop {number} line + * @prop {number} column + * @prop {string} content + */ + +class SourceMapTransform extends node_stream.Transform { + constructor() { + super({ objectMode: true }); + } + + /** + * @type {?{location:[number,number], buffers: Buffer[]}} + * buffer for the current incoming rule. + */ + #current = null; + + /** track depth to handle rules nested in at-rules. */ + #depth = 0; + + /** track this and pass it downstream for source mapping. */ + #line = 1; + + /** track this and pass it downstream for source mapping. */ + #column = 1; + + /** + * @param {[string,Buffer]} chunk + * @param {any} encoding + * @param {Function} callback + */ + _transform([type, buf], encoding, callback) { + if ((type === 'rule_start' || type === 'atrule_start')) { + this.#depth += 1; + } + if (this.#depth > 0 && !this.#current) { + this.#current = { location: [this.#line, this.#column], buffers: [] }; + } + if (type === 'rule_end' || type === 'atrule_end') { + this.#depth -= 1; + } + + if (this.#current) { + this.#current.buffers.push(buf); + if (this.#depth === 0) { + // Push rule + this.push({ + line: this.#current.location[0], + column: this.#current.location[1], + content: Buffer.concat(this.#current.buffers).toString(), + }); + this.#current = null; + } + } + + // Update position + for (const char of buf) { + if (char === NEW_LINE_CHAR) { + this.#line += 1; + this.#column = 1; + } else { + this.#column += 1; + } + } + + callback(); + } +} + +/* eslint-disable no-underscore-dangle */ + +/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */ + +class CssUsageDuplex extends Duplexify__default["default"] { + /** + * @param {Object} options + * @param {string} options.browsers + * @param {FeatureKeys[]} [options.ignore] + * @param {boolean} [options.skipErrors] + * @param {string} [filename] Filename for outputting source code locations. + */ + constructor(options, filename) { + const streams = [ + new Tokenize__default["default"](), + new SourceMapTransform(), + new RuleUsageTransform(options, filename), + ]; + node_stream.pipeline( + // @ts-expect-error Bad typings + ...streams, + () => { + // noop (Error handled by Duplexify) + }, + ); + super(streams[0], streams.at(-1), { objectMode: true }); + } +} + +/** + * @param {ConstructorParameters<typeof CssUsageDuplex>} options + * @return {CssUsageDuplex} + */ +function index(...options) { + return new CssUsageDuplex(...options); +} + +module.exports = index; diff --git a/node_modules/doiuse/exports/stream.js b/node_modules/doiuse/exports/stream.js new file mode 100644 index 00000000..fecaefac --- /dev/null +++ b/node_modules/doiuse/exports/stream.js @@ -0,0 +1,9 @@ +import CssUsageDuplex from '../lib/stream/CssUsageDuplex.js'; + +/** + * @param {ConstructorParameters<typeof CssUsageDuplex>} options + * @return {CssUsageDuplex} + */ +export default function index(...options) { + return new CssUsageDuplex(...options); +} diff --git a/node_modules/doiuse/lib/BrowserSelection.js b/node_modules/doiuse/lib/BrowserSelection.js new file mode 100644 index 00000000..17467548 --- /dev/null +++ b/node_modules/doiuse/lib/BrowserSelection.js @@ -0,0 +1,181 @@ +import browserslist from 'browserslist'; +import * as caniuse from 'caniuse-lite'; + +import FEATURES from '../data/features.js'; +import { formatBrowserName } from '../utils/util.js'; + +/** + * @template T + * @typedef {{missing: T, partial: T}} Filter + */ + +/** + * @typedef {Object} MissingSupportResultStats + * @prop {string} title + * @prop {caniuse.Feature} caniuseData + * @prop {string} [missing] + * @prop {Record<string, Record<string, string>>} [missingData] + * @prop {string} [partial] + * @prop {Record<string, Record<string, string>>} [partialData] + */ + +/** + * @typedef {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} BrowserSupportStats + */ + +/** + * @typedef {Object} MissingSupportResult + * @prop {string[][]} browsers + * @prop {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} features + */ + +export default class BrowserSelection { + #list; + + /** + * @param {string | string[]} [query] + * @param {string | false} [from] + */ + constructor(query, from) { + this.browsersRequest = query; + const options = from ? { path: from } : {}; + this.#list = browserslist(this.browsersRequest, options).map((browser) => browser.split(' ')); + } + + /** + * @param {string} browser + * @param {string} version + * @return {string[]|undefined} + */ + test(browser, version) { + const versions = version.split('-'); + + if (versions.length === 1) { + versions.push(versions[0]); + } + + return this.#list.find(([b, v]) => b === browser && v >= versions[0] && v <= versions[1]); + } + + list() { + return [...this.#list]; + } + + /** + * @param {Record<string, Record<string, string>>} browserStats + * @return {string} + */ + static lackingBrowsers(browserStats) { + const result = []; + for (const browser of Object.keys(browserStats)) { + result.push(formatBrowserName(browser, Object.keys(browserStats[browser]))); + } + return result.join(', '); + } + + /** + * @param {import('caniuse-lite').StatsByAgentID} stats + * @return {Filter<Record<string,Record<string, string>>>} + */ + filterStats(stats) { + /** @type {Filter<Record<string,Record<string, string>>>} */ + const result = { missing: {}, partial: {} }; + for (const [browser, versions] of Object.entries(stats)) { + /** @type {Filter<Record<string,string>>} */ + const feature = { missing: {}, partial: {} }; + for (const [version, support] of Object.entries(versions)) { + const selected = this.test(browser, version); + + // check if browser is NOT fully (i.e., don't have 'y' in their stats) supported + if (!selected) continue; + if ((/(^|\s)y($|\s)/.test(support))) continue; + // when it's not partially supported ('a'), it's missing + const type = (/(^|\s)a($|\s)/.test(support) ? 'partial' : 'missing'); + + if (!feature[type]) { + feature[type] = {}; + } + + feature[type][selected[1]] = support; + } + if (Object.keys(feature.missing).length > 0) { + result.missing[browser] = feature.missing; + } + + if (Object.keys(feature.partial).length > 0) { + result.partial[browser] = feature.partial; + } + } + return result; + } + + /** + * Get data on CSS features not supported by the given autoprefixer-like + * browser selection. + * @return {BrowserSupportStats} `features` is an array of: + * ``` + * { + * 'feature-name': { + * title: 'Title of feature' + * missing: "IE (8), Chrome (31)" + * missingData: { + * // map of browser -> version -> (lack of)support code + * ie: { '8': 'n' }, + * chrome: { '31': 'n' } + * } + * partialData: { + * // map of browser -> version -> (partial)support code + * ie: { '7': 'a' }, + * ff: { '29': 'a #1' } + * } + * caniuseData: { + * // caniuse-db json data for this feature + * } + * }, + * 'feature-name-2': {} // etc. + * } + * ``` + * + * `feature-name` is a caniuse-db slug. + */ + compileBrowserSupport() { + /** @type {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} */ + const result = {}; + + for (const key of Object.keys(FEATURES)) { + const feature = /** @type {keyof FEATURES} */ (key); + const packedFeature = caniuse.features[feature]; + const featureData = caniuse.feature(packedFeature); + const lackData = this.filterStats(featureData.stats); + const missingData = lackData.missing; + const partialData = lackData.partial; + // browsers with missing or partial support for this feature + const missing = BrowserSelection.lackingBrowsers(missingData); + const partial = BrowserSelection.lackingBrowsers(partialData); + + if (missing.length > 0 || partial.length > 0) { + result[feature] = { + title: featureData.title, + caniuseData: featureData, + ...(missing.length > 0 ? { missingData, missing } : null), + ...(partial.length > 0 ? { partialData, partial } : null), + }; + } + } + + return result; + } + + /** + * @see BrowserSelection.compileBrowserSupport + * @param {ConstructorParameters<typeof this>} constructorParameters + * @return {MissingSupportResult} `{browsers, features}` + */ + static missingSupport(...constructorParameters) { + const selection = new BrowserSelection(...constructorParameters); + return { + browsers: selection.list(), + features: selection.compileBrowserSupport(), + }; + } +} diff --git a/node_modules/doiuse/lib/Detector.js b/node_modules/doiuse/lib/Detector.js new file mode 100644 index 00000000..2858bca9 --- /dev/null +++ b/node_modules/doiuse/lib/Detector.js @@ -0,0 +1,157 @@ +import FEATURES from '../data/features.js'; +import { performFeatureCheck } from '../utils/util.js'; + +/** + * @typedef DetectorCallbackArgument + * @prop {!import('postcss').ChildNode} usage + * @prop {keyof FEATURES} feature + * @prop {(keyof FEATURES & string)[]} ignore + */ + +/** + * @callback DetectorCallback + * @param {DetectorCallbackArgument} result + * @return {any} + */ + +const PLUGIN_OPTION_COMMENT = 'doiuse-'; +const DISABLE_FEATURE_COMMENT = `${PLUGIN_OPTION_COMMENT}disable`; +const ENABLE_FEATURE_COMMENT = `${PLUGIN_OPTION_COMMENT}enable`; + +/** + * Strip the contents of url literals so they aren't matched + * by our naive substring matching. + * @param {string} input + * @return {string} + */ +function stripUrls(input) { + return input.replaceAll(/url\([^)]*\)/g, 'url()'); +} + +/** + * Detect the use of any of a given list of CSS features. + * ``` + * var detector = new Detector(featureList) + * detector.process(css, cb) + * ``` + * + * `featureList`: an array of feature slugs (see caniuse-db) + * `cb`: a callback that gets called for each usage of one of the given features, + * called with an argument like: + * ``` + * { + * usage: {} // postcss node where usage was found + * feature: {} // caniuse-db feature slug + * ignore: {} // caniuse-db feature to ignore in current file + * } + * ``` + */ +export default class Detector { + /** + * @param {(keyof FEATURES & string)[]} featureList an array of feature slugs (see caniuse-db) + */ + constructor(featureList) { + /** @type {Partial<FEATURES>} */ + this.features = {}; + for (const feature of featureList) { + if (FEATURES[feature]) { + this.features[feature] = FEATURES[feature]; + } + } + /** @type {(keyof FEATURES & string)[]} */ + this.ignore = []; + } + + /** + * @param {import('postcss').Comment} comment + * @return {void} + */ + comment(comment) { + const text = comment.text.toLowerCase(); + + if (!text.startsWith(PLUGIN_OPTION_COMMENT)) return; + const option = text.split(' ', 1)[0]; + const value = text.replace(option, '').trim(); + + switch (option) { + case DISABLE_FEATURE_COMMENT: { + if (value === '') { + // @ts-expect-error Skip cast + this.ignore = Object.keys(this.features); + } else { + for (const feat of value.split(',')) { + /** @type {any} */ + const f = feat.trim(); + if (!this.ignore.includes(f)) { + this.ignore.push(f); + } + } + } + break; + } + case ENABLE_FEATURE_COMMENT: { + if (value === '') { + this.ignore = []; + } else { + const without = new Set(value.split(',').map((feat) => feat.trim())); + this.ignore = this.ignore.filter((index) => !without.has(index)); + } + break; + } + default: + } + } + + /** + * @param {import('postcss').Container} node + * @param {DetectorCallback} callback + * @return {void} + */ + node(node, callback) { + node.each((child) => { + if (child.type === 'comment') { + this.comment(child); + return; + } + + for (const [feat] of Object.entries(this.features).filter(([, featValue]) => { + if (!featValue) return false; + if (typeof featValue === 'function') { + return featValue(child); + } + if (Array.isArray(featValue)) { + return featValue.some((function_) => function_(child)); + } + if (child.type !== 'decl') { + return false; + } + + return Object.entries(featValue).some(([property, value]) => { + if (property !== '' && property !== child.prop) return false; + if (value === true) return true; + if (value === false) return false; + return performFeatureCheck(value, stripUrls(child.value)); + }); + })) { + const feature = /** @type {keyof FEATURES} */ (feat); + callback({ usage: child, feature, ignore: this.ignore }); + } + if (child.type !== 'decl') { + this.node(child, callback); + } + }); + } + + /** + * @param {import('postcss').Root} node + * @param {DetectorCallback} callback + * @return {void} + */ + process(node, callback) { + // Reset ignoring rules specified by inline comments per each file + this.ignore = []; + + // Recursively walk nodes in file + this.node(node, callback); + } +} diff --git a/node_modules/doiuse/lib/DoIUse.js b/node_modules/doiuse/lib/DoIUse.js new file mode 100644 index 00000000..78db53c8 --- /dev/null +++ b/node_modules/doiuse/lib/DoIUse.js @@ -0,0 +1,130 @@ +import multimatch from 'multimatch'; + +import BrowserSelection from './BrowserSelection.js'; +import Detector from './Detector.js'; + +/** @typedef {import('../data/features.js').FeatureKeys} FeatureKeys */ + +/** + * @typedef {Object} OnFeatureUsageArguments + * @prop {FeatureKeys} feature + * @prop {import('./BrowserSelection.js').MissingSupportResultStats|undefined} featureData + * @prop {import('postcss').Node} usage + * @prop {string} message + */ + +/** + * @callback OnFeatureUsage + * @param {OnFeatureUsageArguments} result + * @return {any} + */ + +/** + * @typedef {Object} DoIUseOptions + * @prop {ConstructorParameters<typeof BrowserSelection>[0]} [browsers] + * @prop {FeatureKeys[]} [ignore] + * @prop {OnFeatureUsage} [onFeatureUsage] + * @prop {string[]} [ignoreFiles] + */ + +export default class DoIUse { + static default = null; + + /** + * @param {DoIUseOptions} [optionsOrBrowserQuery] + */ + constructor(optionsOrBrowserQuery) { + const options = (typeof optionsOrBrowserQuery === 'string') + ? { browsers: optionsOrBrowserQuery } + : { ...optionsOrBrowserQuery }; + this.browserQuery = options.browsers; + this.onFeatureUsage = options.onFeatureUsage; + this.ignoreOptions = options.ignore; + this.ignoreFiles = options.ignoreFiles; + this.info = this.info.bind(this); + this.postcss = this.postcss.bind(this); + } + + /** + * @param {Object} [options] + * @param {ConstructorParameters<typeof BrowserSelection>[1]} [options.from] + */ + info(options = {}) { + const { browsers, features } = BrowserSelection.missingSupport(this.browserQuery, options.from); + + return { + browsers, + features, + }; + } + + /** @type {import('postcss').TransformCallback} */ + postcss(css, result) { + let from; + if (css.source && css.source.input) { + from = css.source.input.file; + } + const { features } = BrowserSelection.missingSupport(this.browserQuery, from); + // @ts-expect-error Needs cast + const detector = new Detector(Object.keys(features)); + + return detector.process(css, ({ feature, usage, ignore }) => { + if (ignore && ignore.includes(feature)) { + return; + } + + if (this.ignoreOptions && this.ignoreOptions.includes(feature)) { + return; + } + + if (!usage.source) { + throw new Error('No source?'); + } + if (this.ignoreFiles && multimatch(usage.source.input.from, this.ignoreFiles).length > 0) { + return; + } + + const data = features[feature]; + if (!data) { + throw new Error('No feature data?'); + } + const messages = []; + if (data.missing) { + messages.push(`not supported by: ${data.missing}`); + } + if (data.partial) { + messages.push(`only partially supported by: ${data.partial}`); + } + + let message = `${data.title} ${messages.join(' and ')} (${feature})`; + + result.warn(message, { node: usage, plugin: 'doiuse' }); + + if (this.onFeatureUsage) { + if (!usage.source) { + throw new Error('No usage source?'); + } + const { start, input } = usage.source; + if (!start) { + throw new Error('No usage source start?'); + } + + const map = css.source && css.source.input.map; + const mappedStart = map && map.consumer().originalPositionFor(start); + + const file = (mappedStart && mappedStart.source) || input.file || input.from; + const line = (mappedStart && mappedStart.line) || start.line; + const column = (mappedStart && mappedStart.column) || start.column; + + message = `${file}:${line}:${column}: ${message}`; + + this.onFeatureUsage({ + feature, + featureData: features[feature], + usage, + message, + }); + } + }); + } +} diff --git a/node_modules/doiuse/lib/stream/CssUsageDuplex.js b/node_modules/doiuse/lib/stream/CssUsageDuplex.js new file mode 100644 index 00000000..063ed1dc --- /dev/null +++ b/node_modules/doiuse/lib/stream/CssUsageDuplex.js @@ -0,0 +1,36 @@ +/* eslint-disable no-underscore-dangle */ + +import { pipeline } from 'node:stream'; + +import Tokenize from 'css-tokenize'; +import Duplexify from 'duplexify'; + +import RuleUsageTransform from './RuleUsageTransform.js'; +import SourceMapTransform from './SourceMapTransform.js'; + +/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */ + +export default class CssUsageDuplex extends Duplexify { + /** + * @param {Object} options + * @param {string} options.browsers + * @param {FeatureKeys[]} [options.ignore] + * @param {boolean} [options.skipErrors] + * @param {string} [filename] Filename for outputting source code locations. + */ + constructor(options, filename) { + const streams = [ + new Tokenize(), + new SourceMapTransform(), + new RuleUsageTransform(options, filename), + ]; + pipeline( + // @ts-expect-error Bad typings + ...streams, + () => { + // noop (Error handled by Duplexify) + }, + ); + super(streams[0], streams.at(-1), { objectMode: true }); + } +} diff --git a/node_modules/doiuse/lib/stream/RuleUsageTransform.js b/node_modules/doiuse/lib/stream/RuleUsageTransform.js new file mode 100644 index 00000000..a2a79d4d --- /dev/null +++ b/node_modules/doiuse/lib/stream/RuleUsageTransform.js @@ -0,0 +1,80 @@ +/* eslint-disable no-underscore-dangle */ +import { Transform } from 'node:stream'; + +import postcss from 'postcss'; +import sourcemap from 'source-map'; + +import DoIUse from '../DoIUse.js'; + +/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */ +/** @typedef {import('./SourceMapTransform.js').SourceMapTransformation} SourceMapTransformation */ + +export default class RuleUsageTransform extends Transform { + /** @type {import("postcss").Processor} */ + #processor; + + #skipErrors; + + #filename; + + /** + * @param {Object} options + * @param {string} options.browsers + * @param {FeatureKeys[]} [options.ignore] + * @param {boolean} [options.skipErrors] + * @param {string} [filename] Filename for outputting source code locations. + */ + constructor(options, filename = '<streaming css input>') { + super({ + objectMode: true, + }); + this.#processor = postcss([new DoIUse({ + browsers: options.browsers, + ignore: options.ignore, + onFeatureUsage: (usage) => { + this.push(usage); + }, + })]); + this.#filename = filename; + this.#skipErrors = options.skipErrors; + } + + /** + * @param {SourceMapTransformation} rule + * @param {any} encoding + * @param {Function} callback + */ + async _transform(rule, encoding, callback) { + let caughtError; + try { + const mapper = new sourcemap.SourceMapGenerator(); + const lines = rule.content.split('\n'); + let oline = rule.line; + let ocol = rule.column; + for (const [lineNumber, content] of lines.entries()) { + mapper.addMapping({ + generated: { line: lineNumber + 1, column: 1 }, + original: { line: oline, column: ocol }, + source: this.#filename, + }); + mapper.addMapping({ + generated: { line: lineNumber + 1, column: content.length }, + original: { line: oline, column: ocol + content.length }, + source: this.#filename, + }); + oline += 1; + ocol = 1; + } + await this.#processor.process(rule.content, { + from: this.#filename, map: { prev: mapper.toString() }, + }); + } catch (error) { + if (this.#skipErrors) { + this.emit('warning', error); + } else { + caughtError = error; + } + } + callback(caughtError); + } +} diff --git a/node_modules/doiuse/lib/stream/SourceMapTransform.js b/node_modules/doiuse/lib/stream/SourceMapTransform.js new file mode 100644 index 00000000..6295b1d3 --- /dev/null +++ b/node_modules/doiuse/lib/stream/SourceMapTransform.js @@ -0,0 +1,74 @@ +/* eslint-disable no-underscore-dangle */ +import { Transform } from 'node:stream'; + +const NEW_LINE_CHAR = '\n'.codePointAt(0); + +/** + * @typedef {Object} SourceMapTransformation + * @prop {number} line + * @prop {number} column + * @prop {string} content + */ + +export default class SourceMapTransform extends Transform { + constructor() { + super({ objectMode: true }); + } + + /** + * @type {?{location:[number,number], buffers: Buffer[]}} + * buffer for the current incoming rule. + */ + #current = null; + + /** track depth to handle rules nested in at-rules. */ + #depth = 0; + + /** track this and pass it downstream for source mapping. */ + #line = 1; + + /** track this and pass it downstream for source mapping. */ + #column = 1; + + /** + * @param {[string,Buffer]} chunk + * @param {any} encoding + * @param {Function} callback + */ + _transform([type, buf], encoding, callback) { + if ((type === 'rule_start' || type === 'atrule_start')) { + this.#depth += 1; + } + if (this.#depth > 0 && !this.#current) { + this.#current = { location: [this.#line, this.#column], buffers: [] }; + } + if (type === 'rule_end' || type === 'atrule_end') { + this.#depth -= 1; + } + + if (this.#current) { + this.#current.buffers.push(buf); + if (this.#depth === 0) { + // Push rule + this.push({ + line: this.#current.location[0], + column: this.#current.location[1], + content: Buffer.concat(this.#current.buffers).toString(), + }); + this.#current = null; + } + } + + // Update position + for (const char of buf) { + if (char === NEW_LINE_CHAR) { + this.#line += 1; + this.#column = 1; + } else { + this.#column += 1; + } + } + + callback(); + } +} diff --git a/node_modules/doiuse/node_modules/source-map/LICENSE b/node_modules/doiuse/node_modules/source-map/LICENSE new file mode 100644 index 00000000..ed1b7cf2 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/LICENSE @@ -0,0 +1,28 @@ + +Copyright (c) 2009-2011, Mozilla Foundation and contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the names of the Mozilla Foundation nor the names of project + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/node_modules/doiuse/node_modules/source-map/README.md b/node_modules/doiuse/node_modules/source-map/README.md new file mode 100644 index 00000000..56e5ac3e --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/README.md @@ -0,0 +1,822 @@ +# Source Map + +[](https://travis-ci.org/mozilla/source-map) + +[](https://coveralls.io/github/mozilla/source-map) + +[](https://www.npmjs.com/package/source-map) + +This is a library to generate and consume the source map format +[described here][format]. + +[format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit + +## Use with Node + + $ npm install source-map + +## Use on the Web + + <script src="https://unpkg.com/source-map@0.7.3/dist/source-map.js"></script> + <script> + sourceMap.SourceMapConsumer.initialize({ + "lib/mappings.wasm": "https://unpkg.com/source-map@0.7.3/lib/mappings.wasm" + }); + </script> + +-------------------------------------------------------------------------------- + +<!-- `npm run toc` to regenerate the Table of Contents --> + +<!-- START doctoc generated TOC please keep comment here to allow auto update --> +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> +## Table of Contents + +- [Examples](#examples) + - [Consuming a source map](#consuming-a-source-map) + - [Generating a source map](#generating-a-source-map) + - [With SourceNode (high level API)](#with-sourcenode-high-level-api) + - [With SourceMapGenerator (low level API)](#with-sourcemapgenerator-low-level-api) +- [API](#api) + - [SourceMapConsumer](#sourcemapconsumer) + - [SourceMapConsumer.initialize(options)](#sourcemapconsumerinitializeoptions) + - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) + - [SourceMapConsumer.with](#sourcemapconsumerwith) + - [SourceMapConsumer.prototype.destroy()](#sourcemapconsumerprototypedestroy) + - [SourceMapConsumer.prototype.computeColumnSpans()](#sourcemapconsumerprototypecomputecolumnspans) + - [SourceMapConsumer.prototype.originalPositionFor(generatedPosition)](#sourcemapconsumerprototypeoriginalpositionforgeneratedposition) + - [SourceMapConsumer.prototype.generatedPositionFor(originalPosition)](#sourcemapconsumerprototypegeneratedpositionfororiginalposition) + - [SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition)](#sourcemapconsumerprototypeallgeneratedpositionsfororiginalposition) + - [SourceMapConsumer.prototype.hasContentsOfAllSources()](#sourcemapconsumerprototypehascontentsofallsources) + - [SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing])](#sourcemapconsumerprototypesourcecontentforsource-returnnullonmissing) + - [SourceMapConsumer.prototype.eachMapping(callback, context, order)](#sourcemapconsumerprototypeeachmappingcallback-context-order) + - [SourceMapGenerator](#sourcemapgenerator) + - [new SourceMapGenerator([startOfSourceMap])](#new-sourcemapgeneratorstartofsourcemap) + - [SourceMapGenerator.fromSourceMap(sourceMapConsumer)](#sourcemapgeneratorfromsourcemapsourcemapconsumer) + - [SourceMapGenerator.prototype.addMapping(mapping)](#sourcemapgeneratorprototypeaddmappingmapping) + - [SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent)](#sourcemapgeneratorprototypesetsourcecontentsourcefile-sourcecontent) + - [SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]])](#sourcemapgeneratorprototypeapplysourcemapsourcemapconsumer-sourcefile-sourcemappath) + - [SourceMapGenerator.prototype.toString()](#sourcemapgeneratorprototypetostring) + - [SourceNode](#sourcenode) + - [new SourceNode([line, column, source[, chunk[, name]]])](#new-sourcenodeline-column-source-chunk-name) + - [SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath])](#sourcenodefromstringwithsourcemapcode-sourcemapconsumer-relativepath) + - [SourceNode.prototype.add(chunk)](#sourcenodeprototypeaddchunk) + - [SourceNode.prototype.prepend(chunk)](#sourcenodeprototypeprependchunk) + - [SourceNode.prototype.setSourceContent(sourceFile, sourceContent)](#sourcenodeprototypesetsourcecontentsourcefile-sourcecontent) + - [SourceNode.prototype.walk(fn)](#sourcenodeprototypewalkfn) + - [SourceNode.prototype.walkSourceContents(fn)](#sourcenodeprototypewalksourcecontentsfn) + - [SourceNode.prototype.join(sep)](#sourcenodeprototypejoinsep) + - [SourceNode.prototype.replaceRight(pattern, replacement)](#sourcenodeprototypereplacerightpattern-replacement) + - [SourceNode.prototype.toString()](#sourcenodeprototypetostring) + - [SourceNode.prototype.toStringWithSourceMap([startOfSourceMap])](#sourcenodeprototypetostringwithsourcemapstartofsourcemap) + +<!-- END doctoc generated TOC please keep comment here to allow auto update --> + +## Examples + +### Consuming a source map + +```js +const rawSourceMap = { + version: 3, + file: 'min.js', + names: ['bar', 'baz', 'n'], + sources: ['one.js', 'two.js'], + sourceRoot: 'http://example.com/www/js/', + mappings: 'CAAC,IAAI,IAAM,SAAUA,GAClB,OAAOC,IAAID;CCDb,IAAI,IAAM,SAAUE,GAClB,OAAOA' +}; + +const whatever = await SourceMapConsumer.with(rawSourceMap, null, consumer => { + + console.log(consumer.sources); + // [ 'http://example.com/www/js/one.js', + // 'http://example.com/www/js/two.js' ] + + console.log(consumer.originalPositionFor({ + line: 2, + column: 28 + })); + // { source: 'http://example.com/www/js/two.js', + // line: 2, + // column: 10, + // name: 'n' } + + console.log(consumer.generatedPositionFor({ + source: 'http://example.com/www/js/two.js', + line: 2, + column: 10 + })); + // { line: 2, column: 28 } + + consumer.eachMapping(function (m) { + // ... + }); + + return computeWhatever(); +}); +``` + +### Generating a source map + +In depth guide: +[**Compiling to JavaScript, and Debugging with Source Maps**](https://hacks.mozilla.org/2013/05/compiling-to-javascript-and-debugging-with-source-maps/) + +#### With SourceNode (high level API) + +```js +function compile(ast) { + switch (ast.type) { + case 'BinaryExpression': + return new SourceNode( + ast.location.line, + ast.location.column, + ast.location.source, + [compile(ast.left), " + ", compile(ast.right)] + ); + case 'Literal': + return new SourceNode( + ast.location.line, + ast.location.column, + ast.location.source, + String(ast.value) + ); + // ... + default: + throw new Error("Bad AST"); + } +} + +var ast = parse("40 + 2", "add.js"); +console.log(compile(ast).toStringWithSourceMap({ + file: 'add.js' +})); +// { code: '40 + 2', +// map: [object SourceMapGenerator] } +``` + +#### With SourceMapGenerator (low level API) + +```js +var map = new SourceMapGenerator({ + file: "source-mapped.js" +}); + +map.addMapping({ + generated: { + line: 10, + column: 35 + }, + source: "foo.js", + original: { + line: 33, + column: 2 + }, + name: "christopher" +}); + +console.log(map.toString()); +// '{"version":3,"file":"source-mapped.js","sources":["foo.js"],"names":["christopher"],"mappings":";;;;;;;;;mCAgCEA"}' +``` + +## API + +Get a reference to the module: + +```js +// Node.js +var sourceMap = require('source-map'); + +// Browser builds +var sourceMap = window.sourceMap; + +// Inside Firefox +const sourceMap = require("devtools/toolkit/sourcemap/source-map.js"); +``` + +### SourceMapConsumer + +A `SourceMapConsumer` instance represents a parsed source map which we can query +for information about the original file positions by giving it a file position +in the generated source. + +#### SourceMapConsumer.initialize(options) + +When using `SourceMapConsumer` outside of node.js, for example on the Web, it +needs to know from what URL to load `lib/mappings.wasm`. You must inform it by +calling `initialize` before constructing any `SourceMapConsumer`s. + +The options object has the following properties: + +* `"lib/mappings.wasm"`: A `String` containing the URL of the + `lib/mappings.wasm` file, or an `ArrayBuffer` with the contents of `lib/mappings.wasm`. + +```js +sourceMap.SourceMapConsumer.initialize({ + "lib/mappings.wasm": "https://example.com/source-map/lib/mappings.wasm" +}); +``` + +#### new SourceMapConsumer(rawSourceMap) + +The only parameter is the raw source map (either as a string which can be +`JSON.parse`'d, or an object). According to the spec, source maps have the +following attributes: + +* `version`: Which version of the source map spec this map is following. + +* `sources`: An array of URLs to the original source files. + +* `names`: An array of identifiers which can be referenced by individual + mappings. + +* `sourceRoot`: Optional. The URL root from which all sources are relative. + +* `sourcesContent`: Optional. An array of contents of the original source files. + +* `mappings`: A string of base64 VLQs which contain the actual mappings. + +* `file`: Optional. The generated filename this source map is associated with. + +The promise of the constructed souce map consumer is returned. + +When the `SourceMapConsumer` will no longer be used anymore, you must call its +`destroy` method. + +```js +const consumer = await new sourceMap.SourceMapConsumer(rawSourceMapJsonData); +doStuffWith(consumer); +consumer.destroy(); +``` + +Alternatively, you can use `SourceMapConsumer.with` to avoid needing to remember +to call `destroy`. + +#### SourceMapConsumer.with + +Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl` +(see the `SourceMapConsumer` constructor for details. Then, invoke the `async +function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait +for `f` to complete, call `destroy` on the consumer, and return `f`'s return +value. + +You must not use the consumer after `f` completes! + +By using `with`, you do not have to remember to manually call `destroy` on +the consumer, since it will be called automatically once `f` completes. + +```js +const xSquared = await SourceMapConsumer.with( + myRawSourceMap, + null, + async function (consumer) { + // Use `consumer` inside here and don't worry about remembering + // to call `destroy`. + + const x = await whatever(consumer); + return x * x; + } +); + +// You may not use that `consumer` anymore out here; it has +// been destroyed. But you can use `xSquared`. +console.log(xSquared); +``` + +#### SourceMapConsumer.prototype.destroy() + +Free this source map consumer's associated wasm data that is manually-managed. + +```js +consumer.destroy(); +``` + +Alternatively, you can use `SourceMapConsumer.with` to avoid needing to remember +to call `destroy`. + +#### SourceMapConsumer.prototype.computeColumnSpans() + +Compute the last column for each generated mapping. The last column is +inclusive. + +```js +// Before: +consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1 }, +// { line: 2, +// column: 10 }, +// { line: 2, +// column: 20 } ] + +consumer.computeColumnSpans(); + +// After: +consumer.allGeneratedPositionsFor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1, +// lastColumn: 9 }, +// { line: 2, +// column: 10, +// lastColumn: 19 }, +// { line: 2, +// column: 20, +// lastColumn: Infinity } ] +``` + +#### SourceMapConsumer.prototype.originalPositionFor(generatedPosition) + +Returns the original source, line, and column information for the generated +source's line and column positions provided. The only argument is an object with +the following properties: + +* `line`: The line number in the generated source. Line numbers in + this library are 1-based (note that the underlying source map + specification uses 0-based line numbers -- this library handles the + translation). + +* `column`: The column number in the generated source. Column numbers + in this library are 0-based. + +* `bias`: Either `SourceMapConsumer.GREATEST_LOWER_BOUND` or + `SourceMapConsumer.LEAST_UPPER_BOUND`. Specifies whether to return the closest + element that is smaller than or greater than the one we are searching for, + respectively, if the exact element cannot be found. Defaults to + `SourceMapConsumer.GREATEST_LOWER_BOUND`. + +and an object is returned with the following properties: + +* `source`: The original source file, or null if this information is not + available. + +* `line`: The line number in the original source, or null if this information is + not available. The line number is 1-based. + +* `column`: The column number in the original source, or null if this + information is not available. The column number is 0-based. + +* `name`: The original identifier, or null if this information is not available. + +```js +consumer.originalPositionFor({ line: 2, column: 10 }) +// { source: 'foo.coffee', +// line: 2, +// column: 2, +// name: null } + +consumer.originalPositionFor({ line: 99999999999999999, column: 999999999999999 }) +// { source: null, +// line: null, +// column: null, +// name: null } +``` + +#### SourceMapConsumer.prototype.generatedPositionFor(originalPosition) + +Returns the generated line and column information for the original source, +line, and column positions provided. The only argument is an object with +the following properties: + +* `source`: The filename of the original source. + +* `line`: The line number in the original source. The line number is + 1-based. + +* `column`: The column number in the original source. The column + number is 0-based. + +and an object is returned with the following properties: + +* `line`: The line number in the generated source, or null. The line + number is 1-based. + +* `column`: The column number in the generated source, or null. The + column number is 0-based. + +```js +consumer.generatedPositionFor({ source: "example.js", line: 2, column: 10 }) +// { line: 1, +// column: 56 } +``` + +#### SourceMapConsumer.prototype.allGeneratedPositionsFor(originalPosition) + +Returns all generated line and column information for the original source, line, +and column provided. If no column is provided, returns all mappings +corresponding to a either the line we are searching for or the next closest line +that has any mappings. Otherwise, returns all mappings corresponding to the +given line and either the column we are searching for or the next closest column +that has any offsets. + +The only argument is an object with the following properties: + +* `source`: The filename of the original source. + +* `line`: The line number in the original source. The line number is + 1-based. + +* `column`: Optional. The column number in the original source. The + column number is 0-based. + +and an array of objects is returned, each with the following properties: + +* `line`: The line number in the generated source, or null. The line + number is 1-based. + +* `column`: The column number in the generated source, or null. The + column number is 0-based. + +```js +consumer.allGeneratedpositionsfor({ line: 2, source: "foo.coffee" }) +// [ { line: 2, +// column: 1 }, +// { line: 2, +// column: 10 }, +// { line: 2, +// column: 20 } ] +``` + +#### SourceMapConsumer.prototype.hasContentsOfAllSources() + +Return true if we have the embedded source content for every source listed in +the source map, false otherwise. + +In other words, if this method returns `true`, then +`consumer.sourceContentFor(s)` will succeed for every source `s` in +`consumer.sources`. + +```js +// ... +if (consumer.hasContentsOfAllSources()) { + consumerReadyCallback(consumer); +} else { + fetchSources(consumer, consumerReadyCallback); +} +// ... +``` + +#### SourceMapConsumer.prototype.sourceContentFor(source[, returnNullOnMissing]) + +Returns the original source content for the source provided. The only +argument is the URL of the original source file. + +If the source content for the given source is not found, then an error is +thrown. Optionally, pass `true` as the second param to have `null` returned +instead. + +```js +consumer.sources +// [ "my-cool-lib.clj" ] + +consumer.sourceContentFor("my-cool-lib.clj") +// "..." + +consumer.sourceContentFor("this is not in the source map"); +// Error: "this is not in the source map" is not in the source map + +consumer.sourceContentFor("this is not in the source map", true); +// null +``` + +#### SourceMapConsumer.prototype.eachMapping(callback, context, order) + +Iterate over each mapping between an original source/line/column and a +generated line/column in this source map. + +* `callback`: The function that is called with each mapping. Mappings have the + form `{ source, generatedLine, generatedColumn, originalLine, originalColumn, + name }` + +* `context`: Optional. If specified, this object will be the value of `this` + every time that `callback` is called. + +* `order`: Either `SourceMapConsumer.GENERATED_ORDER` or + `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to iterate over + the mappings sorted by the generated file's line/column order or the + original's source/line/column order, respectively. Defaults to + `SourceMapConsumer.GENERATED_ORDER`. + +```js +consumer.eachMapping(function (m) { console.log(m); }) +// ... +// { source: 'illmatic.js', +// generatedLine: 1, +// generatedColumn: 0, +// originalLine: 1, +// originalColumn: 0, +// name: null } +// { source: 'illmatic.js', +// generatedLine: 2, +// generatedColumn: 0, +// originalLine: 2, +// originalColumn: 0, +// name: null } +// ... +``` +### SourceMapGenerator + +An instance of the SourceMapGenerator represents a source map which is being +built incrementally. + +#### new SourceMapGenerator([startOfSourceMap]) + +You may pass an object with the following properties: + +* `file`: The filename of the generated source that this source map is + associated with. + +* `sourceRoot`: A root for all relative URLs in this source map. + +* `skipValidation`: Optional. When `true`, disables validation of mappings as + they are added. This can improve performance but should be used with + discretion, as a last resort. Even then, one should avoid using this flag when + running tests, if possible. + +```js +var generator = new sourceMap.SourceMapGenerator({ + file: "my-generated-javascript-file.js", + sourceRoot: "http://example.com/app/js/" +}); +``` + +#### SourceMapGenerator.fromSourceMap(sourceMapConsumer) + +Creates a new `SourceMapGenerator` from an existing `SourceMapConsumer` instance. + +* `sourceMapConsumer` The SourceMap. + +```js +var generator = sourceMap.SourceMapGenerator.fromSourceMap(consumer); +``` + +#### SourceMapGenerator.prototype.addMapping(mapping) + +Add a single mapping from original source line and column to the generated +source's line and column for this source map being created. The mapping object +should have the following properties: + +* `generated`: An object with the generated line and column positions. + +* `original`: An object with the original line and column positions. + +* `source`: The original source file (relative to the sourceRoot). + +* `name`: An optional original token name for this mapping. + +```js +generator.addMapping({ + source: "module-one.scm", + original: { line: 128, column: 0 }, + generated: { line: 3, column: 456 } +}) +``` + +#### SourceMapGenerator.prototype.setSourceContent(sourceFile, sourceContent) + +Set the source content for an original source file. + +* `sourceFile` the URL of the original source file. + +* `sourceContent` the content of the source file. + +```js +generator.setSourceContent("module-one.scm", + fs.readFileSync("path/to/module-one.scm")) +``` + +#### SourceMapGenerator.prototype.applySourceMap(sourceMapConsumer[, sourceFile[, sourceMapPath]]) + +Applies a SourceMap for a source file to the SourceMap. +Each mapping to the supplied source file is rewritten using the +supplied SourceMap. Note: The resolution for the resulting mappings +is the minimum of this map and the supplied map. + +* `sourceMapConsumer`: The SourceMap to be applied. + +* `sourceFile`: Optional. The filename of the source file. + If omitted, sourceMapConsumer.file will be used, if it exists. + Otherwise an error will be thrown. + +* `sourceMapPath`: Optional. The dirname of the path to the SourceMap + to be applied. If relative, it is relative to the SourceMap. + + This parameter is needed when the two SourceMaps aren't in the same + directory, and the SourceMap to be applied contains relative source + paths. If so, those relative source paths need to be rewritten + relative to the SourceMap. + + If omitted, it is assumed that both SourceMaps are in the same directory, + thus not needing any rewriting. (Supplying `'.'` has the same effect.) + +#### SourceMapGenerator.prototype.toString() + +Renders the source map being generated to a string. + +```js +generator.toString() +// '{"version":3,"sources":["module-one.scm"],"names":[],"mappings":"...snip...","file":"my-generated-javascript-file.js","sourceRoot":"http://example.com/app/js/"}' +``` + +### SourceNode + +SourceNodes provide a way to abstract over interpolating and/or concatenating +snippets of generated JavaScript source code, while maintaining the line and +column information associated between those snippets and the original source +code. This is useful as the final intermediate representation a compiler might +use before outputting the generated JS and source map. + +#### new SourceNode([line, column, source[, chunk[, name]]]) + +* `line`: The original line number associated with this source node, or null if + it isn't associated with an original line. The line number is 1-based. + +* `column`: The original column number associated with this source node, or null + if it isn't associated with an original column. The column number + is 0-based. + +* `source`: The original source's filename; null if no filename is provided. + +* `chunk`: Optional. Is immediately passed to `SourceNode.prototype.add`, see + below. + +* `name`: Optional. The original identifier. + +```js +var node = new SourceNode(1, 2, "a.cpp", [ + new SourceNode(3, 4, "b.cpp", "extern int status;\n"), + new SourceNode(5, 6, "c.cpp", "std::string* make_string(size_t n);\n"), + new SourceNode(7, 8, "d.cpp", "int main(int argc, char** argv) {}\n"), +]); +``` + +#### SourceNode.fromStringWithSourceMap(code, sourceMapConsumer[, relativePath]) + +Creates a SourceNode from generated code and a SourceMapConsumer. + +* `code`: The generated code + +* `sourceMapConsumer` The SourceMap for the generated code + +* `relativePath` The optional path that relative sources in `sourceMapConsumer` + should be relative to. + +```js +const consumer = await new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); +const node = SourceNode.fromStringWithSourceMap(fs.readFileSync("path/to/my-file.js"), consumer); +``` + +#### SourceNode.prototype.add(chunk) + +Add a chunk of generated JS to this source node. + +* `chunk`: A string snippet of generated JS code, another instance of + `SourceNode`, or an array where each member is one of those things. + +```js +node.add(" + "); +node.add(otherNode); +node.add([leftHandOperandNode, " + ", rightHandOperandNode]); +``` + +#### SourceNode.prototype.prepend(chunk) + +Prepend a chunk of generated JS to this source node. + +* `chunk`: A string snippet of generated JS code, another instance of + `SourceNode`, or an array where each member is one of those things. + +```js +node.prepend("/** Build Id: f783haef86324gf **/\n\n"); +``` + +#### SourceNode.prototype.setSourceContent(sourceFile, sourceContent) + +Set the source content for a source file. This will be added to the +`SourceMap` in the `sourcesContent` field. + +* `sourceFile`: The filename of the source file + +* `sourceContent`: The content of the source file + +```js +node.setSourceContent("module-one.scm", + fs.readFileSync("path/to/module-one.scm")) +``` + +#### SourceNode.prototype.walk(fn) + +Walk over the tree of JS snippets in this node and its children. The walking +function is called once for each snippet of JS and is passed that snippet and +the its original associated source's line/column location. + +* `fn`: The traversal function. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.walk(function (code, loc) { console.log("WALK:", code, loc); }) +// WALK: uno { source: 'b.js', line: 3, column: 4, name: null } +// WALK: dos { source: 'a.js', line: 1, column: 2, name: null } +// WALK: tres { source: 'a.js', line: 1, column: 2, name: null } +// WALK: quatro { source: 'c.js', line: 5, column: 6, name: null } +``` + +#### SourceNode.prototype.walkSourceContents(fn) + +Walk over the tree of SourceNodes. The walking function is called for each +source file content and is passed the filename and source content. + +* `fn`: The traversal function. + +```js +var a = new SourceNode(1, 2, "a.js", "generated from a"); +a.setSourceContent("a.js", "original a"); +var b = new SourceNode(1, 2, "b.js", "generated from b"); +b.setSourceContent("b.js", "original b"); +var c = new SourceNode(1, 2, "c.js", "generated from c"); +c.setSourceContent("c.js", "original c"); + +var node = new SourceNode(null, null, null, [a, b, c]); +node.walkSourceContents(function (source, contents) { console.log("WALK:", source, ":", contents); }) +// WALK: a.js : original a +// WALK: b.js : original b +// WALK: c.js : original c +``` + +#### SourceNode.prototype.join(sep) + +Like `Array.prototype.join` except for SourceNodes. Inserts the separator +between each of this source node's children. + +* `sep`: The separator. + +```js +var lhs = new SourceNode(1, 2, "a.rs", "my_copy"); +var operand = new SourceNode(3, 4, "a.rs", "="); +var rhs = new SourceNode(5, 6, "a.rs", "orig.clone()"); + +var node = new SourceNode(null, null, null, [ lhs, operand, rhs ]); +var joinedNode = node.join(" "); +``` + +#### SourceNode.prototype.replaceRight(pattern, replacement) + +Call `String.prototype.replace` on the very right-most source snippet. Useful +for trimming white space from the end of a source node, etc. + +* `pattern`: The pattern to replace. + +* `replacement`: The thing to replace the pattern with. + +```js +// Trim trailing white space. +node.replaceRight(/\s*$/, ""); +``` + +#### SourceNode.prototype.toString() + +Return the string representation of this source node. Walks over the tree and +concatenates all the various snippets together to one string. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.toString() +// 'unodostresquatro' +``` + +#### SourceNode.prototype.toStringWithSourceMap([startOfSourceMap]) + +Returns the string representation of this tree of source nodes, plus a +SourceMapGenerator which contains all the mappings between the generated and +original sources. + +The arguments are the same as those to `new SourceMapGenerator`. + +```js +var node = new SourceNode(1, 2, "a.js", [ + new SourceNode(3, 4, "b.js", "uno"), + "dos", + [ + "tres", + new SourceNode(5, 6, "c.js", "quatro") + ] +]); + +node.toStringWithSourceMap({ file: "my-output-file.js" }) +// { code: 'unodostresquatro', +// map: [object SourceMapGenerator] } +``` diff --git a/node_modules/doiuse/node_modules/source-map/dist/source-map.js b/node_modules/doiuse/node_modules/source-map/dist/source-map.js new file mode 100644 index 00000000..b75e98bd --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/dist/source-map.js @@ -0,0 +1 @@ +!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("fs"),require("path")):"function"==typeof define&&define.amd?define(["fs","path"],n):"object"==typeof exports?exports.sourceMap=n(require("fs"),require("path")):e.sourceMap=n(e.fs,e.path)}(window,(function(e,n){return function(e){var n={};function t(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.exports}return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{enumerable:!0,get:r})},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},t.t=function(e,n){if(1&n&&(e=t(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)t.d(r,o,function(n){return e[n]}.bind(null,o));return r},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},t.p="",t(t.s=5)}([function(e,n){n.getArg=function(e,n,t){if(n in e)return e[n];if(3===arguments.length)return t;throw new Error('"'+n+'" is a required argument.')};const t=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,r=/^data:.+\,.+$/;function o(e){const n=e.match(t);return n?{scheme:n[1],auth:n[2],host:n[3],port:n[4],path:n[5]}:null}function i(e){let n="";return e.scheme&&(n+=e.scheme+":"),n+="//",e.auth&&(n+=e.auth+"@"),e.host&&(n+=e.host),e.port&&(n+=":"+e.port),e.path&&(n+=e.path),n}n.urlParse=o,n.urlGenerate=i;const s=function(e){const n=[];return function(t){for(let e=0;e<n.length;e++)if(n[e].input===t){const t=n[0];return n[0]=n[e],n[e]=t,n[0].result}const r=e(t);return n.unshift({input:t,result:r}),n.length>32&&n.pop(),r}}((function(e){let t=e;const r=o(e);if(r){if(!r.path)return e;t=r.path}const s=n.isAbsolute(t),l=[];let a=0,u=0;for(;;){if(a=u,u=t.indexOf("/",a),-1===u){l.push(t.slice(a));break}for(l.push(t.slice(a,u));u<t.length&&"/"===t[u];)u++}let c=0;for(u=l.length-1;u>=0;u--){const e=l[u];"."===e?l.splice(u,1):".."===e?c++:c>0&&(""===e?(l.splice(u+1,c),c=0):(l.splice(u,2),c--))}return t=l.join("/"),""===t&&(t=s?"/":"."),r?(r.path=t,i(r)):t}));function l(e,n){""===e&&(e="."),""===n&&(n=".");const t=o(n),l=o(e);if(l&&(e=l.path||"/"),t&&!t.scheme)return l&&(t.scheme=l.scheme),i(t);if(t||n.match(r))return n;if(l&&!l.host&&!l.path)return l.host=n,i(l);const a="/"===n.charAt(0)?n:s(e.replace(/\/+$/,"")+"/"+n);return l?(l.path=a,i(l)):a}n.normalize=s,n.join=l,n.isAbsolute=function(e){return"/"===e.charAt(0)||t.test(e)},n.relative=function(e,n){""===e&&(e="."),e=e.replace(/\/$/,"");let t=0;for(;0!==n.indexOf(e+"/");){const r=e.lastIndexOf("/");if(r<0)return n;if((e=e.slice(0,r)).match(/^([^\/]+:\/)?\/*$/))return n;++t}return Array(t+1).join("../")+n.substr(e.length+1)};const a=!("__proto__"in Object.create(null));function u(e){return e}function c(e){if(!e)return!1;const n=e.length;if(n<9)return!1;if(95!==e.charCodeAt(n-1)||95!==e.charCodeAt(n-2)||111!==e.charCodeAt(n-3)||116!==e.charCodeAt(n-4)||111!==e.charCodeAt(n-5)||114!==e.charCodeAt(n-6)||112!==e.charCodeAt(n-7)||95!==e.charCodeAt(n-8)||95!==e.charCodeAt(n-9))return!1;for(let t=n-10;t>=0;t--)if(36!==e.charCodeAt(t))return!1;return!0}function g(e,n){return e===n?0:null===e?1:null===n?-1:e>n?1:-1}n.toSetString=a?u:function(e){return c(e)?"$"+e:e},n.fromSetString=a?u:function(e){return c(e)?e.slice(1):e},n.compareByOriginalPositions=function(e,n,t){let r=g(e.source,n.source);return 0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r||t?r:(r=e.generatedColumn-n.generatedColumn,0!==r?r:(r=e.generatedLine-n.generatedLine,0!==r?r:g(e.name,n.name)))))},n.compareByGeneratedPositionsDeflated=function(e,n,t){let r=e.generatedLine-n.generatedLine;return 0!==r?r:(r=e.generatedColumn-n.generatedColumn,0!==r||t?r:(r=g(e.source,n.source),0!==r?r:(r=e.originalLine-n.originalLine,0!==r?r:(r=e.originalColumn-n.originalColumn,0!==r?r:g(e.name,n.name)))))},n.compareByGeneratedPositionsInflated=function(e,n){let t=e.generatedLine-n.generatedLine;return 0!==t?t:(t=e.generatedColumn-n.generatedColumn,0!==t?t:(t=g(e.source,n.source),0!==t?t:(t=e.originalLine-n.originalLine,0!==t?t:(t=e.originalColumn-n.originalColumn,0!==t?t:g(e.name,n.name)))))},n.parseSourceMapInput=function(e){return JSON.parse(e.replace(/^\)]}'[^\n]*\n/,""))},n.computeSourceURL=function(e,n,t){if(n=n||"",e&&("/"!==e[e.length-1]&&"/"!==n[0]&&(e+="/"),n=e+n),t){const e=o(t);if(!e)throw new Error("sourceMapURL could not be parsed");if(e.path){const n=e.path.lastIndexOf("/");n>=0&&(e.path=e.path.substring(0,n+1))}n=l(i(e),n)}return s(n)}},function(e,n,t){const r=t(2),o=t(0),i=t(3).ArraySet,s=t(7).MappingList;class l{constructor(e){e||(e={}),this._file=o.getArg(e,"file",null),this._sourceRoot=o.getArg(e,"sourceRoot",null),this._skipValidation=o.getArg(e,"skipValidation",!1),this._sources=new i,this._names=new i,this._mappings=new s,this._sourcesContents=null}static fromSourceMap(e){const n=e.sourceRoot,t=new l({file:e.file,sourceRoot:n});return e.eachMapping((function(e){const r={generated:{line:e.generatedLine,column:e.generatedColumn}};null!=e.source&&(r.source=e.source,null!=n&&(r.source=o.relative(n,r.source)),r.original={line:e.originalLine,column:e.originalColumn},null!=e.name&&(r.name=e.name)),t.addMapping(r)})),e.sources.forEach((function(r){let i=r;null!==n&&(i=o.relative(n,r)),t._sources.has(i)||t._sources.add(i);const s=e.sourceContentFor(r);null!=s&&t.setSourceContent(r,s)})),t}addMapping(e){const n=o.getArg(e,"generated"),t=o.getArg(e,"original",null);let r=o.getArg(e,"source",null),i=o.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,t,r,i),null!=r&&(r=String(r),this._sources.has(r)||this._sources.add(r)),null!=i&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:null!=t&&t.line,originalColumn:null!=t&&t.column,source:r,name:i})}setSourceContent(e,n){let t=e;null!=this._sourceRoot&&(t=o.relative(this._sourceRoot,t)),null!=n?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[o.toSetString(t)]=n):this._sourcesContents&&(delete this._sourcesContents[o.toSetString(t)],0===Object.keys(this._sourcesContents).length&&(this._sourcesContents=null))}applySourceMap(e,n,t){let r=n;if(null==n){if(null==e.file)throw new Error('SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map\'s "file" property. Both were omitted.');r=e.file}const s=this._sourceRoot;null!=s&&(r=o.relative(s,r));const l=this._mappings.toArray().length>0?new i:this._sources,a=new i;this._mappings.unsortedForEach((function(n){if(n.source===r&&null!=n.originalLine){const r=e.originalPositionFor({line:n.originalLine,column:n.originalColumn});null!=r.source&&(n.source=r.source,null!=t&&(n.source=o.join(t,n.source)),null!=s&&(n.source=o.relative(s,n.source)),n.originalLine=r.line,n.originalColumn=r.column,null!=r.name&&(n.name=r.name))}const i=n.source;null==i||l.has(i)||l.add(i);const u=n.name;null==u||a.has(u)||a.add(u)}),this),this._sources=l,this._names=a,e.sources.forEach((function(n){const r=e.sourceContentFor(n);null!=r&&(null!=t&&(n=o.join(t,n)),null!=s&&(n=o.relative(s,n)),this.setSourceContent(n,r))}),this)}_validateMapping(e,n,t,r){if(n&&"number"!=typeof n.line&&"number"!=typeof n.column)throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!n&&!t&&!r);else if(!(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&t))throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:t,original:n,name:r}))}_serializeMappings(){let e,n,t,i,s=0,l=1,a=0,u=0,c=0,g=0,p="";const h=this._mappings.toArray();for(let m=0,d=h.length;m<d;m++){if(n=h[m],e="",n.generatedLine!==l)for(s=0;n.generatedLine!==l;)e+=";",l++;else if(m>0){if(!o.compareByGeneratedPositionsInflated(n,h[m-1]))continue;e+=","}e+=r.encode(n.generatedColumn-s),s=n.generatedColumn,null!=n.source&&(i=this._sources.indexOf(n.source),e+=r.encode(i-g),g=i,e+=r.encode(n.originalLine-1-u),u=n.originalLine-1,e+=r.encode(n.originalColumn-a),a=n.originalColumn,null!=n.name&&(t=this._names.indexOf(n.name),e+=r.encode(t-c),c=t)),p+=e}return p}_generateSourcesContent(e,n){return e.map((function(e){if(!this._sourcesContents)return null;null!=n&&(e=o.relative(n,e));const t=o.toSetString(e);return Object.prototype.hasOwnProperty.call(this._sourcesContents,t)?this._sourcesContents[t]:null}),this)}toJSON(){const e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return null!=this._file&&(e.file=this._file),null!=this._sourceRoot&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e}toString(){return JSON.stringify(this.toJSON())}}l.prototype._version=3,n.SourceMapGenerator=l},function(e,n,t){const r=t(6);n.encode=function(e){let n,t="",o=function(e){return e<0?1+(-e<<1):0+(e<<1)}(e);do{n=31&o,o>>>=5,o>0&&(n|=32),t+=r.encode(n)}while(o>0);return t}},function(e,n){class t{constructor(){this._array=[],this._set=new Map}static fromArray(e,n){const r=new t;for(let t=0,o=e.length;t<o;t++)r.add(e[t],n);return r}size(){return this._set.size}add(e,n){const t=this.has(e),r=this._array.length;t&&!n||this._array.push(e),t||this._set.set(e,r)}has(e){return this._set.has(e)}indexOf(e){const n=this._set.get(e);if(n>=0)return n;throw new Error('"'+e+'" is not in the set.')}at(e){if(e>=0&&e<this._array.length)return this._array[e];throw new Error("No element indexed by "+e)}toArray(){return this._array.slice()}}n.ArraySet=t},function(e,n,t){(function(n){if(function(){return"undefined"!=typeof window&&this===window}.call()){let n=null;e.exports=function(){if("string"==typeof n)return fetch(n).then(e=>e.arrayBuffer());if(n instanceof ArrayBuffer)return Promise.resolve(n);throw new Error("You must provide the string URL or ArrayBuffer contents of lib/mappings.wasm by calling SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) before using SourceMapConsumer")},e.exports.initialize=e=>n=e}else{const r=t(10),o=t(11);e.exports=function(){return new Promise((e,t)=>{const i=o.join(n,"mappings.wasm");r.readFile(i,null,(n,r)=>{n?t(n):e(r.buffer)})})},e.exports.initialize=e=>{console.debug("SourceMapConsumer.initialize is a no-op when running in node.js")}}}).call(this,"/")},function(e,n,t){n.SourceMapGenerator=t(1).SourceMapGenerator,n.SourceMapConsumer=t(8).SourceMapConsumer,n.SourceNode=t(13).SourceNode},function(e,n){const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");n.encode=function(e){if(0<=e&&e<t.length)return t[e];throw new TypeError("Must be between 0 and 63: "+e)}},function(e,n,t){const r=t(0);n.MappingList=class{constructor(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}unsortedForEach(e,n){this._array.forEach(e,n)}add(e){!function(e,n){const t=e.generatedLine,o=n.generatedLine,i=e.generatedColumn,s=n.generatedColumn;return o>t||o==t&&s>=i||r.compareByGeneratedPositionsInflated(e,n)<=0}(this._last,e)?(this._sorted=!1,this._array.push(e)):(this._last=e,this._array.push(e))}toArray(){return this._sorted||(this._array.sort(r.compareByGeneratedPositionsInflated),this._sorted=!0),this._array}}},function(e,n,t){const r=t(0),o=t(9),i=t(3).ArraySet,s=(t(2),t(4)),l=t(12),a=Symbol("smcInternal");class u{constructor(e,n){return e==a?Promise.resolve(this):function(e,n){let t=e;"string"==typeof e&&(t=r.parseSourceMapInput(e));const o=null!=t.sections?new g(t,n):new c(t,n);return Promise.resolve(o)}(e,n)}static initialize(e){s.initialize(e["lib/mappings.wasm"])}static fromSourceMap(e,n){return function(e,n){return c.fromSourceMap(e,n)}(e,n)}static async with(e,n,t){const r=await new u(e,n);try{return await t(r)}finally{r.destroy()}}_parseMappings(e,n){throw new Error("Subclasses must implement _parseMappings")}eachMapping(e,n,t){throw new Error("Subclasses must implement eachMapping")}allGeneratedPositionsFor(e){throw new Error("Subclasses must implement allGeneratedPositionsFor")}destroy(){throw new Error("Subclasses must implement destroy")}}u.prototype._version=3,u.GENERATED_ORDER=1,u.ORIGINAL_ORDER=2,u.GREATEST_LOWER_BOUND=1,u.LEAST_UPPER_BOUND=2,n.SourceMapConsumer=u;class c extends u{constructor(e,n){return super(a).then(t=>{let o=e;"string"==typeof e&&(o=r.parseSourceMapInput(e));const s=r.getArg(o,"version");let a=r.getArg(o,"sources");const u=r.getArg(o,"names",[]);let c=r.getArg(o,"sourceRoot",null);const g=r.getArg(o,"sourcesContent",null),p=r.getArg(o,"mappings"),h=r.getArg(o,"file",null);if(s!=t._version)throw new Error("Unsupported version: "+s);return c&&(c=r.normalize(c)),a=a.map(String).map(r.normalize).map((function(e){return c&&r.isAbsolute(c)&&r.isAbsolute(e)?r.relative(c,e):e})),t._names=i.fromArray(u.map(String),!0),t._sources=i.fromArray(a,!0),t._absoluteSources=t._sources.toArray().map((function(e){return r.computeSourceURL(c,e,n)})),t.sourceRoot=c,t.sourcesContent=g,t._mappings=p,t._sourceMapURL=n,t.file=h,t._computedColumnSpans=!1,t._mappingsPtr=0,t._wasm=null,l().then(e=>(t._wasm=e,t))})}_findSourceIndex(e){let n=e;if(null!=this.sourceRoot&&(n=r.relative(this.sourceRoot,n)),this._sources.has(n))return this._sources.indexOf(n);for(let n=0;n<this._absoluteSources.length;++n)if(this._absoluteSources[n]==e)return n;return-1}static fromSourceMap(e,n){return new c(e.toString())}get sources(){return this._absoluteSources.slice()}_getMappingsPtr(){return 0===this._mappingsPtr&&this._parseMappings(this._mappings,this.sourceRoot),this._mappingsPtr}_parseMappings(e,n){const t=e.length,r=this._wasm.exports.allocate_mappings(t),o=new Uint8Array(this._wasm.exports.memory.buffer,r,t);for(let n=0;n<t;n++)o[n]=e.charCodeAt(n);const i=this._wasm.exports.parse_mappings(r);if(!i){const e=this._wasm.exports.get_last_error();let n=`Error parsing mappings (code ${e}): `;switch(e){case 1:n+="the mappings contained a negative line, column, source index, or name index";break;case 2:n+="the mappings contained a number larger than 2**32";break;case 3:n+="reached EOF while in the middle of parsing a VLQ";break;case 4:n+="invalid base 64 character while parsing a VLQ";break;default:n+="unknown error code"}throw new Error(n)}this._mappingsPtr=i}eachMapping(e,n,t){const o=n||null,i=t||u.GENERATED_ORDER,s=this.sourceRoot;this._wasm.withMappingCallback(n=>{null!==n.source&&(n.source=this._sources.at(n.source),n.source=r.computeSourceURL(s,n.source,this._sourceMapURL),null!==n.name&&(n.name=this._names.at(n.name))),e.call(o,n)},()=>{switch(i){case u.GENERATED_ORDER:this._wasm.exports.by_generated_location(this._getMappingsPtr());break;case u.ORIGINAL_ORDER:this._wasm.exports.by_original_location(this._getMappingsPtr());break;default:throw new Error("Unknown order of iteration.")}})}allGeneratedPositionsFor(e){let n=r.getArg(e,"source");const t=r.getArg(e,"line"),o=e.column||0;if(n=this._findSourceIndex(n),n<0)return[];if(t<1)throw new Error("Line numbers must be >= 1");if(o<0)throw new Error("Column numbers must be >= 0");const i=[];return this._wasm.withMappingCallback(e=>{let n=e.lastGeneratedColumn;this._computedColumnSpans&&null===n&&(n=1/0),i.push({line:e.generatedLine,column:e.generatedColumn,lastColumn:n})},()=>{this._wasm.exports.all_generated_locations_for(this._getMappingsPtr(),n,t-1,"column"in e,o)}),i}destroy(){0!==this._mappingsPtr&&(this._wasm.exports.free_mappings(this._mappingsPtr),this._mappingsPtr=0)}computeColumnSpans(){this._computedColumnSpans||(this._wasm.exports.compute_column_spans(this._getMappingsPtr()),this._computedColumnSpans=!0)}originalPositionFor(e){const n={generatedLine:r.getArg(e,"line"),generatedColumn:r.getArg(e,"column")};if(n.generatedLine<1)throw new Error("Line numbers must be >= 1");if(n.generatedColumn<0)throw new Error("Column numbers must be >= 0");let t,o=r.getArg(e,"bias",u.GREATEST_LOWER_BOUND);if(null==o&&(o=u.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback(e=>t=e,()=>{this._wasm.exports.original_location_for(this._getMappingsPtr(),n.generatedLine-1,n.generatedColumn,o)}),t&&t.generatedLine===n.generatedLine){let e=r.getArg(t,"source",null);null!==e&&(e=this._sources.at(e),e=r.computeSourceURL(this.sourceRoot,e,this._sourceMapURL));let n=r.getArg(t,"name",null);return null!==n&&(n=this._names.at(n)),{source:e,line:r.getArg(t,"originalLine",null),column:r.getArg(t,"originalColumn",null),name:n}}return{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return!!this.sourcesContent&&(this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some((function(e){return null==e})))}sourceContentFor(e,n){if(!this.sourcesContent)return null;const t=this._findSourceIndex(e);if(t>=0)return this.sourcesContent[t];let o,i=e;if(null!=this.sourceRoot&&(i=r.relative(this.sourceRoot,i)),null!=this.sourceRoot&&(o=r.urlParse(this.sourceRoot))){const e=i.replace(/^file:\/\//,"");if("file"==o.scheme&&this._sources.has(e))return this.sourcesContent[this._sources.indexOf(e)];if((!o.path||"/"==o.path)&&this._sources.has("/"+i))return this.sourcesContent[this._sources.indexOf("/"+i)]}if(n)return null;throw new Error('"'+i+'" is not in the SourceMap.')}generatedPositionFor(e){let n=r.getArg(e,"source");if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};const t={source:n,originalLine:r.getArg(e,"line"),originalColumn:r.getArg(e,"column")};if(t.originalLine<1)throw new Error("Line numbers must be >= 1");if(t.originalColumn<0)throw new Error("Column numbers must be >= 0");let o,i=r.getArg(e,"bias",u.GREATEST_LOWER_BOUND);if(null==i&&(i=u.GREATEST_LOWER_BOUND),this._wasm.withMappingCallback(e=>o=e,()=>{this._wasm.exports.generated_location_for(this._getMappingsPtr(),t.source,t.originalLine-1,t.originalColumn,i)}),o&&o.source===t.source){let e=o.lastGeneratedColumn;return this._computedColumnSpans&&null===e&&(e=1/0),{line:r.getArg(o,"generatedLine",null),column:r.getArg(o,"generatedColumn",null),lastColumn:e}}return{line:null,column:null,lastColumn:null}}}c.prototype.consumer=u,n.BasicSourceMapConsumer=c;class g extends u{constructor(e,n){return super(a).then(t=>{let o=e;"string"==typeof e&&(o=r.parseSourceMapInput(e));const s=r.getArg(o,"version"),l=r.getArg(o,"sections");if(s!=t._version)throw new Error("Unsupported version: "+s);t._sources=new i,t._names=new i,t.__generatedMappings=null,t.__originalMappings=null,t.__generatedMappingsUnsorted=null,t.__originalMappingsUnsorted=null;let a={line:-1,column:0};return Promise.all(l.map(e=>{if(e.url)throw new Error("Support for url field in sections not implemented.");const t=r.getArg(e,"offset"),o=r.getArg(t,"line"),i=r.getArg(t,"column");if(o<a.line||o===a.line&&i<a.column)throw new Error("Section offsets must be ordered and non-overlapping.");a=t;return new u(r.getArg(e,"map"),n).then(e=>({generatedOffset:{generatedLine:o+1,generatedColumn:i+1},consumer:e}))})).then(e=>(t._sections=e,t))})}get _generatedMappings(){return this.__generatedMappings||this._sortGeneratedMappings(),this.__generatedMappings}get _originalMappings(){return this.__originalMappings||this._sortOriginalMappings(),this.__originalMappings}get _generatedMappingsUnsorted(){return this.__generatedMappingsUnsorted||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappingsUnsorted}get _originalMappingsUnsorted(){return this.__originalMappingsUnsorted||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappingsUnsorted}_sortGeneratedMappings(){const e=this._generatedMappingsUnsorted;e.sort(r.compareByGeneratedPositionsDeflated),this.__generatedMappings=e}_sortOriginalMappings(){const e=this._originalMappingsUnsorted;e.sort(r.compareByOriginalPositions),this.__originalMappings=e}get sources(){const e=[];for(let n=0;n<this._sections.length;n++)for(let t=0;t<this._sections[n].consumer.sources.length;t++)e.push(this._sections[n].consumer.sources[t]);return e}originalPositionFor(e){const n={generatedLine:r.getArg(e,"line"),generatedColumn:r.getArg(e,"column")},t=o.search(n,this._sections,(function(e,n){const t=e.generatedLine-n.generatedOffset.generatedLine;return t||e.generatedColumn-n.generatedOffset.generatedColumn})),i=this._sections[t];return i?i.consumer.originalPositionFor({line:n.generatedLine-(i.generatedOffset.generatedLine-1),column:n.generatedColumn-(i.generatedOffset.generatedLine===n.generatedLine?i.generatedOffset.generatedColumn-1:0),bias:e.bias}):{source:null,line:null,column:null,name:null}}hasContentsOfAllSources(){return this._sections.every((function(e){return e.consumer.hasContentsOfAllSources()}))}sourceContentFor(e,n){for(let n=0;n<this._sections.length;n++){const t=this._sections[n].consumer.sourceContentFor(e,!0);if(t)return t}if(n)return null;throw new Error('"'+e+'" is not in the SourceMap.')}generatedPositionFor(e){for(let n=0;n<this._sections.length;n++){const t=this._sections[n];if(-1===t.consumer._findSourceIndex(r.getArg(e,"source")))continue;const o=t.consumer.generatedPositionFor(e);if(o){return{line:o.line+(t.generatedOffset.generatedLine-1),column:o.column+(t.generatedOffset.generatedLine===o.line?t.generatedOffset.generatedColumn-1:0)}}}return{line:null,column:null}}_parseMappings(e,n){const t=this.__generatedMappingsUnsorted=[],o=this.__originalMappingsUnsorted=[];for(let e=0;e<this._sections.length;e++){const n=this._sections[e],i=[];n.consumer.eachMapping(e=>i.push(e));for(let e=0;e<i.length;e++){const s=i[e];let l=r.computeSourceURL(n.consumer.sourceRoot,null,this._sourceMapURL);this._sources.add(l),l=this._sources.indexOf(l);let a=null;s.name&&(this._names.add(s.name),a=this._names.indexOf(s.name));const u={source:l,generatedLine:s.generatedLine+(n.generatedOffset.generatedLine-1),generatedColumn:s.generatedColumn+(n.generatedOffset.generatedLine===s.generatedLine?n.generatedOffset.generatedColumn-1:0),originalLine:s.originalLine,originalColumn:s.originalColumn,name:a};t.push(u),"number"==typeof u.originalLine&&o.push(u)}}}eachMapping(e,n,t){const o=n||null;let i;switch(t||u.GENERATED_ORDER){case u.GENERATED_ORDER:i=this._generatedMappings;break;case u.ORIGINAL_ORDER:i=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}const s=this.sourceRoot;i.map((function(e){let n=null;return null!==e.source&&(n=this._sources.at(e.source),n=r.computeSourceURL(s,n,this._sourceMapURL)),{source:n,generatedLine:e.generatedLine,generatedColumn:e.generatedColumn,originalLine:e.originalLine,originalColumn:e.originalColumn,name:null===e.name?null:this._names.at(e.name)}}),this).forEach(e,o)}_findMapping(e,n,t,r,i,s){if(e[t]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[t]);if(e[r]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[r]);return o.search(e,n,i,s)}allGeneratedPositionsFor(e){const n=r.getArg(e,"line"),t={source:r.getArg(e,"source"),originalLine:n,originalColumn:r.getArg(e,"column",0)};if(t.source=this._findSourceIndex(t.source),t.source<0)return[];if(t.originalLine<1)throw new Error("Line numbers must be >= 1");if(t.originalColumn<0)throw new Error("Column numbers must be >= 0");const i=[];let s=this._findMapping(t,this._originalMappings,"originalLine","originalColumn",r.compareByOriginalPositions,o.LEAST_UPPER_BOUND);if(s>=0){let t=this._originalMappings[s];if(void 0===e.column){const e=t.originalLine;for(;t&&t.originalLine===e;){let e=t.lastGeneratedColumn;this._computedColumnSpans&&null===e&&(e=1/0),i.push({line:r.getArg(t,"generatedLine",null),column:r.getArg(t,"generatedColumn",null),lastColumn:e}),t=this._originalMappings[++s]}}else{const e=t.originalColumn;for(;t&&t.originalLine===n&&t.originalColumn==e;){let e=t.lastGeneratedColumn;this._computedColumnSpans&&null===e&&(e=1/0),i.push({line:r.getArg(t,"generatedLine",null),column:r.getArg(t,"generatedColumn",null),lastColumn:e}),t=this._originalMappings[++s]}}}return i}destroy(){for(let e=0;e<this._sections.length;e++)this._sections[e].consumer.destroy()}}n.IndexedSourceMapConsumer=g},function(e,n){n.GREATEST_LOWER_BOUND=1,n.LEAST_UPPER_BOUND=2,n.search=function(e,t,r,o){if(0===t.length)return-1;let i=function e(t,r,o,i,s,l){const a=Math.floor((r-t)/2)+t,u=s(o,i[a],!0);return 0===u?a:u>0?r-a>1?e(a,r,o,i,s,l):l==n.LEAST_UPPER_BOUND?r<i.length?r:-1:a:a-t>1?e(t,a,o,i,s,l):l==n.LEAST_UPPER_BOUND?a:t<0?-1:t}(-1,t.length,e,t,r,o||n.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&0===r(t[i],t[i-1],!0);)--i;return i}},function(n,t){n.exports=e},function(e,t){e.exports=n},function(e,n,t){const r=t(4);function o(){this.generatedLine=0,this.generatedColumn=0,this.lastGeneratedColumn=null,this.source=null,this.originalLine=null,this.originalColumn=null,this.name=null}let i=null;e.exports=function(){if(i)return i;const e=[];return i=r().then(n=>WebAssembly.instantiate(n,{env:{mapping_callback(n,t,r,i,s,l,a,u,c,g){const p=new o;p.generatedLine=n+1,p.generatedColumn=t,r&&(p.lastGeneratedColumn=i-1),s&&(p.source=l,p.originalLine=a+1,p.originalColumn=u,c&&(p.name=g)),e[e.length-1](p)},start_all_generated_locations_for(){console.time("all_generated_locations_for")},end_all_generated_locations_for(){console.timeEnd("all_generated_locations_for")},start_compute_column_spans(){console.time("compute_column_spans")},end_compute_column_spans(){console.timeEnd("compute_column_spans")},start_generated_location_for(){console.time("generated_location_for")},end_generated_location_for(){console.timeEnd("generated_location_for")},start_original_location_for(){console.time("original_location_for")},end_original_location_for(){console.timeEnd("original_location_for")},start_parse_mappings(){console.time("parse_mappings")},end_parse_mappings(){console.timeEnd("parse_mappings")},start_sort_by_generated_location(){console.time("sort_by_generated_location")},end_sort_by_generated_location(){console.timeEnd("sort_by_generated_location")},start_sort_by_original_location(){console.time("sort_by_original_location")},end_sort_by_original_location(){console.timeEnd("sort_by_original_location")}}})).then(n=>({exports:n.instance.exports,withMappingCallback:(n,t)=>{e.push(n);try{t()}finally{e.pop()}}})).then(null,e=>{throw i=null,e}),i}},function(e,n,t){const r=t(1).SourceMapGenerator,o=t(0),i=/(\r?\n)/,s="$$$isSourceNode$$$";class l{constructor(e,n,t,r,o){this.children=[],this.sourceContents={},this.line=null==e?null:e,this.column=null==n?null:n,this.source=null==t?null:t,this.name=null==o?null:o,this[s]=!0,null!=r&&this.add(r)}static fromStringWithSourceMap(e,n,t){const r=new l,s=e.split(i);let a=0;const u=function(){return e()+(e()||"");function e(){return a<s.length?s[a++]:void 0}};let c,g=1,p=0,h=null;return n.eachMapping((function(e){if(null!==h){if(!(g<e.generatedLine)){c=s[a]||"";const n=c.substr(0,e.generatedColumn-p);return s[a]=c.substr(e.generatedColumn-p),p=e.generatedColumn,m(h,n),void(h=e)}m(h,u()),g++,p=0}for(;g<e.generatedLine;)r.add(u()),g++;p<e.generatedColumn&&(c=s[a]||"",r.add(c.substr(0,e.generatedColumn)),s[a]=c.substr(e.generatedColumn),p=e.generatedColumn),h=e}),this),a<s.length&&(h&&m(h,u()),r.add(s.splice(a).join(""))),n.sources.forEach((function(e){const i=n.sourceContentFor(e);null!=i&&(null!=t&&(e=o.join(t,e)),r.setSourceContent(e,i))})),r;function m(e,n){if(null===e||void 0===e.source)r.add(n);else{const i=t?o.join(t,e.source):e.source;r.add(new l(e.originalLine,e.originalColumn,i,n,e.name))}}}add(e){if(Array.isArray(e))e.forEach((function(e){this.add(e)}),this);else{if(!e[s]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);e&&this.children.push(e)}return this}prepend(e){if(Array.isArray(e))for(let n=e.length-1;n>=0;n--)this.prepend(e[n]);else{if(!e[s]&&"string"!=typeof e)throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);this.children.unshift(e)}return this}walk(e){let n;for(let t=0,r=this.children.length;t<r;t++)n=this.children[t],n[s]?n.walk(e):""!==n&&e(n,{source:this.source,line:this.line,column:this.column,name:this.name})}join(e){let n,t;const r=this.children.length;if(r>0){for(n=[],t=0;t<r-1;t++)n.push(this.children[t]),n.push(e);n.push(this.children[t]),this.children=n}return this}replaceRight(e,n){const t=this.children[this.children.length-1];return t[s]?t.replaceRight(e,n):"string"==typeof t?this.children[this.children.length-1]=t.replace(e,n):this.children.push("".replace(e,n)),this}setSourceContent(e,n){this.sourceContents[o.toSetString(e)]=n}walkSourceContents(e){for(let n=0,t=this.children.length;n<t;n++)this.children[n][s]&&this.children[n].walkSourceContents(e);const n=Object.keys(this.sourceContents);for(let t=0,r=n.length;t<r;t++)e(o.fromSetString(n[t]),this.sourceContents[n[t]])}toString(){let e="";return this.walk((function(n){e+=n})),e}toStringWithSourceMap(e){const n={code:"",line:1,column:0},t=new r(e);let o=!1,i=null,s=null,l=null,a=null;return this.walk((function(e,r){n.code+=e,null!==r.source&&null!==r.line&&null!==r.column?(i===r.source&&s===r.line&&l===r.column&&a===r.name||t.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:n.line,column:n.column},name:r.name}),i=r.source,s=r.line,l=r.column,a=r.name,o=!0):o&&(t.addMapping({generated:{line:n.line,column:n.column}}),i=null,o=!1);for(let s=0,l=e.length;s<l;s++)10===e.charCodeAt(s)?(n.line++,n.column=0,s+1===l?(i=null,o=!1):o&&t.addMapping({source:r.source,original:{line:r.line,column:r.column},generated:{line:n.line,column:n.column},name:r.name})):n.column++})),this.walkSourceContents((function(e,n){t.setSourceContent(e,n)})),{code:n.code,map:t}}}n.SourceNode=l}])}));
\ No newline at end of file diff --git a/node_modules/doiuse/node_modules/source-map/lib/array-set.js b/node_modules/doiuse/node_modules/source-map/lib/array-set.js new file mode 100644 index 00000000..40171b9a --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/array-set.js @@ -0,0 +1,100 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +class ArraySet { + constructor() { + this._array = []; + this._set = new Map(); + } + + /** + * Static method for creating ArraySet instances from an existing array. + */ + static fromArray(aArray, aAllowDuplicates) { + const set = new ArraySet(); + for (let i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; + } + + /** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ + size() { + return this._set.size; + } + + /** + * Add the given string to this set. + * + * @param String aStr + */ + add(aStr, aAllowDuplicates) { + const isDuplicate = this.has(aStr); + const idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + this._set.set(aStr, idx); + } + } + + /** + * Is the given string a member of this set? + * + * @param String aStr + */ + has(aStr) { + return this._set.has(aStr); + } + + /** + * What is the index of the given string in the array? + * + * @param String aStr + */ + indexOf(aStr) { + const idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + throw new Error('"' + aStr + '" is not in the set.'); + } + + /** + * What is the element at the given index? + * + * @param Number aIdx + */ + at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error("No element indexed by " + aIdx); + } + + /** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ + toArray() { + return this._array.slice(); + } +} +exports.ArraySet = ArraySet; diff --git a/node_modules/doiuse/node_modules/source-map/lib/base64-vlq.js b/node_modules/doiuse/node_modules/source-map/lib/base64-vlq.js new file mode 100644 index 00000000..fc1049c8 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/base64-vlq.js @@ -0,0 +1,111 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +const base64 = require("./base64"); + +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 + +const VLQ_BASE_SHIFT = 5; + +// binary: 100000 +const VLQ_BASE = 1 << VLQ_BASE_SHIFT; + +// binary: 011111 +const VLQ_BASE_MASK = VLQ_BASE - 1; + +// binary: 100000 +const VLQ_CONTINUATION_BIT = VLQ_BASE; + +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; +} + +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +// eslint-disable-next-line no-unused-vars +function fromVLQSigned(aValue) { + const isNegative = (aValue & 1) === 1; + const shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; +} + +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + let encoded = ""; + let digit; + + let vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; +}; diff --git a/node_modules/doiuse/node_modules/source-map/lib/base64.js b/node_modules/doiuse/node_modules/source-map/lib/base64.js new file mode 100644 index 00000000..b9ca3199 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/base64.js @@ -0,0 +1,18 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +const intToCharMap = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""); + +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function(number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; diff --git a/node_modules/doiuse/node_modules/source-map/lib/binary-search.js b/node_modules/doiuse/node_modules/source-map/lib/binary-search.js new file mode 100644 index 00000000..d6f898ea --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/binary-search.js @@ -0,0 +1,107 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +exports.GREATEST_LOWER_BOUND = 1; +exports.LEAST_UPPER_BOUND = 2; + +/** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ +function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + const mid = Math.floor((aHigh - aLow) / 2) + aLow; + const cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } + return mid; + } + + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } + return aLow < 0 ? -1 : aLow; +} + +/** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ +exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + let index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; +}; diff --git a/node_modules/doiuse/node_modules/source-map/lib/mapping-list.js b/node_modules/doiuse/node_modules/source-map/lib/mapping-list.js new file mode 100644 index 00000000..70568610 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/mapping-list.js @@ -0,0 +1,80 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +const util = require("./util"); + +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + const lineA = mappingA.generatedLine; + const lineB = mappingB.generatedLine; + const columnA = mappingA.generatedColumn; + const columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} + +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a negligible overhead in general + * case for a large speedup in case of mappings being added in order. + */ +class MappingList { + constructor() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; + } + + /** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ + unsortedForEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + } + + /** + * Add the given source mapping. + * + * @param Object aMapping + */ + add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } + } + + /** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ + toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; + } +} + +exports.MappingList = MappingList; diff --git a/node_modules/doiuse/node_modules/source-map/lib/mappings.wasm b/node_modules/doiuse/node_modules/source-map/lib/mappings.wasm Binary files differnew file mode 100644 index 00000000..35153707 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/mappings.wasm diff --git a/node_modules/doiuse/node_modules/source-map/lib/read-wasm.js b/node_modules/doiuse/node_modules/source-map/lib/read-wasm.js new file mode 100644 index 00000000..e81c1772 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/read-wasm.js @@ -0,0 +1,49 @@ +/* Determine browser vs node environment by testing the default top level context. Solution courtesy of: https://stackoverflow.com/questions/17575790/environment-detection-node-js-or-browser */ +const isBrowserEnvironment = (function() { + // eslint-disable-next-line no-undef + return (typeof window !== "undefined") && (this === window); +}).call(); + +if (isBrowserEnvironment) { + // Web version of reading a wasm file into an array buffer. + + let mappingsWasm = null; + + module.exports = function readWasm() { + if (typeof mappingsWasm === "string") { + return fetch(mappingsWasm) + .then(response => response.arrayBuffer()); + } + if (mappingsWasm instanceof ArrayBuffer) { + return Promise.resolve(mappingsWasm); + } + throw new Error("You must provide the string URL or ArrayBuffer contents " + + "of lib/mappings.wasm by calling " + + "SourceMapConsumer.initialize({ 'lib/mappings.wasm': ... }) " + + "before using SourceMapConsumer"); + }; + + module.exports.initialize = input => mappingsWasm = input; +} else { + // Node version of reading a wasm file into an array buffer. + const fs = require("fs"); + const path = require("path"); + + module.exports = function readWasm() { + return new Promise((resolve, reject) => { + const wasmPath = path.join(__dirname, "mappings.wasm"); + fs.readFile(wasmPath, null, (error, data) => { + if (error) { + reject(error); + return; + } + + resolve(data.buffer); + }); + }); + }; + + module.exports.initialize = _ => { + console.debug("SourceMapConsumer.initialize is a no-op when running in node.js"); + }; +} diff --git a/node_modules/doiuse/node_modules/source-map/lib/source-map-consumer.js b/node_modules/doiuse/node_modules/source-map/lib/source-map-consumer.js new file mode 100644 index 00000000..9aaf92f5 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/source-map-consumer.js @@ -0,0 +1,1237 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +const util = require("./util"); +const binarySearch = require("./binary-search"); +const ArraySet = require("./array-set").ArraySet; +const base64VLQ = require("./base64-vlq"); // eslint-disable-line no-unused-vars +const readWasm = require("../lib/read-wasm"); +const wasm = require("./wasm"); + +const INTERNAL = Symbol("smcInternal"); + +class SourceMapConsumer { + constructor(aSourceMap, aSourceMapURL) { + // If the constructor was called by super(), just return Promise<this>. + // Yes, this is a hack to retain the pre-existing API of the base-class + // constructor also being an async factory function. + if (aSourceMap == INTERNAL) { + return Promise.resolve(this); + } + + return _factory(aSourceMap, aSourceMapURL); + } + + static initialize(opts) { + readWasm.initialize(opts["lib/mappings.wasm"]); + } + + static fromSourceMap(aSourceMap, aSourceMapURL) { + return _factoryBSM(aSourceMap, aSourceMapURL); + } + + /** + * Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl` + * (see the `SourceMapConsumer` constructor for details. Then, invoke the `async + * function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait + * for `f` to complete, call `destroy` on the consumer, and return `f`'s return + * value. + * + * You must not use the consumer after `f` completes! + * + * By using `with`, you do not have to remember to manually call `destroy` on + * the consumer, since it will be called automatically once `f` completes. + * + * ```js + * const xSquared = await SourceMapConsumer.with( + * myRawSourceMap, + * null, + * async function (consumer) { + * // Use `consumer` inside here and don't worry about remembering + * // to call `destroy`. + * + * const x = await whatever(consumer); + * return x * x; + * } + * ); + * + * // You may not use that `consumer` anymore out here; it has + * // been destroyed. But you can use `xSquared`. + * console.log(xSquared); + * ``` + */ + static async with(rawSourceMap, sourceMapUrl, f) { + const consumer = await new SourceMapConsumer(rawSourceMap, sourceMapUrl); + try { + return await f(consumer); + } finally { + consumer.destroy(); + } + } + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + _parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + } + + /** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ + eachMapping(aCallback, aContext, aOrder) { + throw new Error("Subclasses must implement eachMapping"); + } + + /** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number is 1-based. + * - column: Optional. the column number in the original source. + * The column number is 0-based. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + allGeneratedPositionsFor(aArgs) { + throw new Error("Subclasses must implement allGeneratedPositionsFor"); + } + + destroy() { + throw new Error("Subclasses must implement destroy"); + } +} + +/** + * The version of the source mapping spec that we are consuming. + */ +SourceMapConsumer.prototype._version = 3; +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; + +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; + +exports.SourceMapConsumer = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The first parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +class BasicSourceMapConsumer extends SourceMapConsumer { + constructor(aSourceMap, aSourceMapURL) { + return super(INTERNAL).then(that => { + let sourceMap = aSourceMap; + if (typeof aSourceMap === "string") { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + const version = util.getArg(sourceMap, "version"); + let sources = util.getArg(sourceMap, "sources"); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + const names = util.getArg(sourceMap, "names", []); + let sourceRoot = util.getArg(sourceMap, "sourceRoot", null); + const sourcesContent = util.getArg(sourceMap, "sourcesContent", null); + const mappings = util.getArg(sourceMap, "mappings"); + const file = util.getArg(sourceMap, "file", null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != that._version) { + throw new Error("Unsupported version: " + version); + } + + if (sourceRoot) { + sourceRoot = util.normalize(sourceRoot); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function(source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + that._names = ArraySet.fromArray(names.map(String), true); + that._sources = ArraySet.fromArray(sources, true); + + that._absoluteSources = that._sources.toArray().map(function(s) { + return util.computeSourceURL(sourceRoot, s, aSourceMapURL); + }); + + that.sourceRoot = sourceRoot; + that.sourcesContent = sourcesContent; + that._mappings = mappings; + that._sourceMapURL = aSourceMapURL; + that.file = file; + + that._computedColumnSpans = false; + that._mappingsPtr = 0; + that._wasm = null; + + return wasm().then(w => { + that._wasm = w; + return that; + }); + }); + } + + /** + * Utility function to find the index of a source. Returns -1 if not + * found. + */ + _findSourceIndex(aSource) { + let relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + if (this._sources.has(relativeSource)) { + return this._sources.indexOf(relativeSource); + } + + // Maybe aSource is an absolute URL as returned by |sources|. In + // this case we can't simply undo the transform. + for (let i = 0; i < this._absoluteSources.length; ++i) { + if (this._absoluteSources[i] == aSource) { + return i; + } + } + + return -1; + } + + /** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @param String aSourceMapURL + * The URL at which the source map can be found (optional) + * @returns BasicSourceMapConsumer + */ + static fromSourceMap(aSourceMap, aSourceMapURL) { + return new BasicSourceMapConsumer(aSourceMap.toString()); + } + + get sources() { + return this._absoluteSources.slice(); + } + + _getMappingsPtr() { + if (this._mappingsPtr === 0) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this._mappingsPtr; + } + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + _parseMappings(aStr, aSourceRoot) { + const size = aStr.length; + + const mappingsBufPtr = this._wasm.exports.allocate_mappings(size); + const mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size); + for (let i = 0; i < size; i++) { + mappingsBuf[i] = aStr.charCodeAt(i); + } + + const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr); + + if (!mappingsPtr) { + const error = this._wasm.exports.get_last_error(); + let msg = `Error parsing mappings (code ${error}): `; + + // XXX: keep these error codes in sync with `fitzgen/source-map-mappings`. + switch (error) { + case 1: + msg += "the mappings contained a negative line, column, source index, or name index"; + break; + case 2: + msg += "the mappings contained a number larger than 2**32"; + break; + case 3: + msg += "reached EOF while in the middle of parsing a VLQ"; + break; + case 4: + msg += "invalid base 64 character while parsing a VLQ"; + break; + default: + msg += "unknown error code"; + break; + } + + throw new Error(msg); + } + + this._mappingsPtr = mappingsPtr; + } + + eachMapping(aCallback, aContext, aOrder) { + const context = aContext || null; + const order = aOrder || SourceMapConsumer.GENERATED_ORDER; + const sourceRoot = this.sourceRoot; + + this._wasm.withMappingCallback( + mapping => { + if (mapping.source !== null) { + mapping.source = this._sources.at(mapping.source); + mapping.source = util.computeSourceURL(sourceRoot, mapping.source, this._sourceMapURL); + + if (mapping.name !== null) { + mapping.name = this._names.at(mapping.name); + } + } + + aCallback.call(context, mapping); + }, + () => { + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + this._wasm.exports.by_generated_location(this._getMappingsPtr()); + break; + case SourceMapConsumer.ORIGINAL_ORDER: + this._wasm.exports.by_original_location(this._getMappingsPtr()); + break; + default: + throw new Error("Unknown order of iteration."); + } + } + ); + } + + allGeneratedPositionsFor(aArgs) { + let source = util.getArg(aArgs, "source"); + const originalLine = util.getArg(aArgs, "line"); + const originalColumn = aArgs.column || 0; + + source = this._findSourceIndex(source); + if (source < 0) { + return []; + } + + if (originalLine < 1) { + throw new Error("Line numbers must be >= 1"); + } + + if (originalColumn < 0) { + throw new Error("Column numbers must be >= 0"); + } + + const mappings = []; + + this._wasm.withMappingCallback( + m => { + let lastColumn = m.lastGeneratedColumn; + if (this._computedColumnSpans && lastColumn === null) { + lastColumn = Infinity; + } + mappings.push({ + line: m.generatedLine, + column: m.generatedColumn, + lastColumn, + }); + }, () => { + this._wasm.exports.all_generated_locations_for( + this._getMappingsPtr(), + source, + originalLine - 1, + "column" in aArgs, + originalColumn + ); + } + ); + + return mappings; + } + + destroy() { + if (this._mappingsPtr !== 0) { + this._wasm.exports.free_mappings(this._mappingsPtr); + this._mappingsPtr = 0; + } + } + + /** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ + computeColumnSpans() { + if (this._computedColumnSpans) { + return; + } + + this._wasm.exports.compute_column_spans(this._getMappingsPtr()); + this._computedColumnSpans = true; + } + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ + originalPositionFor(aArgs) { + const needle = { + generatedLine: util.getArg(aArgs, "line"), + generatedColumn: util.getArg(aArgs, "column") + }; + + if (needle.generatedLine < 1) { + throw new Error("Line numbers must be >= 1"); + } + + if (needle.generatedColumn < 0) { + throw new Error("Column numbers must be >= 0"); + } + + let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND); + if (bias == null) { + bias = SourceMapConsumer.GREATEST_LOWER_BOUND; + } + + let mapping; + this._wasm.withMappingCallback(m => mapping = m, () => { + this._wasm.exports.original_location_for( + this._getMappingsPtr(), + needle.generatedLine - 1, + needle.generatedColumn, + bias + ); + }); + + if (mapping) { + if (mapping.generatedLine === needle.generatedLine) { + let source = util.getArg(mapping, "source", null); + if (source !== null) { + source = this._sources.at(source); + source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); + } + + let name = util.getArg(mapping, "name", null); + if (name !== null) { + name = this._names.at(name); + } + + return { + source, + line: util.getArg(mapping, "originalLine", null), + column: util.getArg(mapping, "originalColumn", null), + name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + } + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function(sc) { return sc == null; }); + } + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + const index = this._findSourceIndex(aSource); + if (index >= 0) { + return this.sourcesContent[index]; + } + + let relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + let url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + const fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]; + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + relativeSource)) { + return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + + throw new Error('"' + relativeSource + '" is not in the SourceMap.'); + } + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + generatedPositionFor(aArgs) { + let source = util.getArg(aArgs, "source"); + source = this._findSourceIndex(source); + if (source < 0) { + return { + line: null, + column: null, + lastColumn: null + }; + } + + const needle = { + source, + originalLine: util.getArg(aArgs, "line"), + originalColumn: util.getArg(aArgs, "column") + }; + + if (needle.originalLine < 1) { + throw new Error("Line numbers must be >= 1"); + } + + if (needle.originalColumn < 0) { + throw new Error("Column numbers must be >= 0"); + } + + let bias = util.getArg(aArgs, "bias", SourceMapConsumer.GREATEST_LOWER_BOUND); + if (bias == null) { + bias = SourceMapConsumer.GREATEST_LOWER_BOUND; + } + + let mapping; + this._wasm.withMappingCallback(m => mapping = m, () => { + this._wasm.exports.generated_location_for( + this._getMappingsPtr(), + needle.source, + needle.originalLine - 1, + needle.originalColumn, + bias + ); + }); + + if (mapping) { + if (mapping.source === needle.source) { + let lastColumn = mapping.lastGeneratedColumn; + if (this._computedColumnSpans && lastColumn === null) { + lastColumn = Infinity; + } + return { + line: util.getArg(mapping, "generatedLine", null), + column: util.getArg(mapping, "generatedColumn", null), + lastColumn, + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + } +} + +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; +exports.BasicSourceMapConsumer = BasicSourceMapConsumer; + +/** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The first parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ +class IndexedSourceMapConsumer extends SourceMapConsumer { + constructor(aSourceMap, aSourceMapURL) { + return super(INTERNAL).then(that => { + let sourceMap = aSourceMap; + if (typeof aSourceMap === "string") { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + const version = util.getArg(sourceMap, "version"); + const sections = util.getArg(sourceMap, "sections"); + + if (version != that._version) { + throw new Error("Unsupported version: " + version); + } + + that._sources = new ArraySet(); + that._names = new ArraySet(); + that.__generatedMappings = null; + that.__originalMappings = null; + that.__generatedMappingsUnsorted = null; + that.__originalMappingsUnsorted = null; + + let lastOffset = { + line: -1, + column: 0 + }; + return Promise.all(sections.map(s => { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error("Support for url field in sections not implemented."); + } + const offset = util.getArg(s, "offset"); + const offsetLine = util.getArg(offset, "line"); + const offsetColumn = util.getArg(offset, "column"); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error("Section offsets must be ordered and non-overlapping."); + } + lastOffset = offset; + + const cons = new SourceMapConsumer(util.getArg(s, "map"), aSourceMapURL); + return cons.then(consumer => { + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer + }; + }); + })).then(s => { + that._sections = s; + return that; + }); + }); + } + + // `__generatedMappings` and `__originalMappings` are arrays that hold the + // parsed mapping coordinates from the source map's "mappings" attribute. They + // are lazily instantiated, accessed via the `_generatedMappings` and + // `_originalMappings` getters respectively, and we only parse the mappings + // and create these arrays once queried for a source location. We jump through + // these hoops because there can be many thousands of mappings, and parsing + // them is expensive, so we only want to do it if we must. + // + // Each object in the arrays is of the form: + // + // { + // generatedLine: The line number in the generated code, + // generatedColumn: The column number in the generated code, + // source: The path to the original source file that generated this + // chunk of code, + // originalLine: The line number in the original source that + // corresponds to this chunk of generated code, + // originalColumn: The column number in the original source that + // corresponds to this chunk of generated code, + // name: The name of the original symbol which generated this chunk of + // code. + // } + // + // All properties except for `generatedLine` and `generatedColumn` can be + // `null`. + // + // `_generatedMappings` is ordered by the generated positions. + // + // `_originalMappings` is ordered by the original positions. + get _generatedMappings() { + if (!this.__generatedMappings) { + this._sortGeneratedMappings(); + } + + return this.__generatedMappings; + } + + get _originalMappings() { + if (!this.__originalMappings) { + this._sortOriginalMappings(); + } + + return this.__originalMappings; + } + + get _generatedMappingsUnsorted() { + if (!this.__generatedMappingsUnsorted) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappingsUnsorted; + } + + get _originalMappingsUnsorted() { + if (!this.__originalMappingsUnsorted) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappingsUnsorted; + } + + _sortGeneratedMappings() { + const mappings = this._generatedMappingsUnsorted; + mappings.sort(util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = mappings; + } + + _sortOriginalMappings() { + const mappings = this._originalMappingsUnsorted; + mappings.sort(util.compareByOriginalPositions); + this.__originalMappings = mappings; + } + + /** + * The list of original sources. + */ + get sources() { + const sources = []; + for (let i = 0; i < this._sections.length; i++) { + for (let j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ + originalPositionFor(aArgs) { + const needle = { + generatedLine: util.getArg(aArgs, "line"), + generatedColumn: util.getArg(aArgs, "column") + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + const sectionIndex = binarySearch.search(needle, this._sections, + function(aNeedle, section) { + const cmp = aNeedle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (aNeedle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + const section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + } + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + hasContentsOfAllSources() { + return this._sections.every(function(s) { + return s.consumer.hasContentsOfAllSources(); + }); + } + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + sourceContentFor(aSource, nullOnMissing) { + for (let i = 0; i < this._sections.length; i++) { + const section = this._sections[i]; + + const content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ + generatedPositionFor(aArgs) { + for (let i = 0; i < this._sections.length; i++) { + const section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer._findSourceIndex(util.getArg(aArgs, "source")) === -1) { + continue; + } + const generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + const ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + } + + /** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ + _parseMappings(aStr, aSourceRoot) { + const generatedMappings = this.__generatedMappingsUnsorted = []; + const originalMappings = this.__originalMappingsUnsorted = []; + for (let i = 0; i < this._sections.length; i++) { + const section = this._sections[i]; + + const sectionMappings = []; + section.consumer.eachMapping(m => sectionMappings.push(m)); + + for (let j = 0; j < sectionMappings.length; j++) { + const mapping = sectionMappings[j]; + + // TODO: test if null is correct here. The original code used + // `source`, which would actually have gotten used as null because + // var's get hoisted. + // See: https://github.com/mozilla/source-map/issues/333 + let source = util.computeSourceURL(section.consumer.sourceRoot, null, this._sourceMapURL); + this._sources.add(source); + source = this._sources.indexOf(source); + + let name = null; + if (mapping.name) { + this._names.add(mapping.name); + name = this._names.indexOf(mapping.name); + } + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + const adjustedMapping = { + source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name + }; + + generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === "number") { + originalMappings.push(adjustedMapping); + } + } + } + } + + eachMapping(aCallback, aContext, aOrder) { + const context = aContext || null; + const order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + let mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + const sourceRoot = this.sourceRoot; + mappings.map(function(mapping) { + let source = null; + if (mapping.source !== null) { + source = this._sources.at(mapping.source); + source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); + } + return { + source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + } + + /** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ + _findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError("Line must be greater than or equal to 1, got " + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError("Column must be greater than or equal to 0, got " + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + } + + allGeneratedPositionsFor(aArgs) { + const line = util.getArg(aArgs, "line"); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + const needle = { + source: util.getArg(aArgs, "source"), + originalLine: line, + originalColumn: util.getArg(aArgs, "column", 0) + }; + + needle.source = this._findSourceIndex(needle.source); + if (needle.source < 0) { + return []; + } + + if (needle.originalLine < 1) { + throw new Error("Line numbers must be >= 1"); + } + + if (needle.originalColumn < 0) { + throw new Error("Column numbers must be >= 0"); + } + + const mappings = []; + + let index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + let mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + const originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + let lastColumn = mapping.lastGeneratedColumn; + if (this._computedColumnSpans && lastColumn === null) { + lastColumn = Infinity; + } + mappings.push({ + line: util.getArg(mapping, "generatedLine", null), + column: util.getArg(mapping, "generatedColumn", null), + lastColumn, + }); + + mapping = this._originalMappings[++index]; + } + } else { + const originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + let lastColumn = mapping.lastGeneratedColumn; + if (this._computedColumnSpans && lastColumn === null) { + lastColumn = Infinity; + } + mappings.push({ + line: util.getArg(mapping, "generatedLine", null), + column: util.getArg(mapping, "generatedColumn", null), + lastColumn, + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + } + + destroy() { + for (let i = 0; i < this._sections.length; i++) { + this._sections[i].consumer.destroy(); + } + } +} +exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; + +/* + * Cheat to get around inter-twingled classes. `factory()` can be at the end + * where it has access to non-hoisted classes, but it gets hoisted itself. + */ +function _factory(aSourceMap, aSourceMapURL) { + let sourceMap = aSourceMap; + if (typeof aSourceMap === "string") { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + const consumer = sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) + : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); + return Promise.resolve(consumer); +} + +function _factoryBSM(aSourceMap, aSourceMapURL) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); +} diff --git a/node_modules/doiuse/node_modules/source-map/lib/source-map-generator.js b/node_modules/doiuse/node_modules/source-map/lib/source-map-generator.js new file mode 100644 index 00000000..8111e061 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/source-map-generator.js @@ -0,0 +1,413 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +const base64VLQ = require("./base64-vlq"); +const util = require("./util"); +const ArraySet = require("./array-set").ArraySet; +const MappingList = require("./mapping-list").MappingList; + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +class SourceMapGenerator { + constructor(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, "file", null); + this._sourceRoot = util.getArg(aArgs, "sourceRoot", null); + this._skipValidation = util.getArg(aArgs, "skipValidation", false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; + } + + /** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ + static fromSourceMap(aSourceMapConsumer) { + const sourceRoot = aSourceMapConsumer.sourceRoot; + const generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot + }); + aSourceMapConsumer.eachMapping(function(mapping) { + const newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function(sourceFile) { + let sourceRelative = sourceFile; + if (sourceRoot !== null) { + sourceRelative = util.relative(sourceRoot, sourceFile); + } + + if (!generator._sources.has(sourceRelative)) { + generator._sources.add(sourceRelative); + } + + const content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + } + + /** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ + addMapping(aArgs) { + const generated = util.getArg(aArgs, "generated"); + const original = util.getArg(aArgs, "original", null); + let source = util.getArg(aArgs, "source", null); + let name = util.getArg(aArgs, "name", null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source, + name + }); + } + + /** + * Set the source content for a source file. + */ + setSourceContent(aSourceFile, aSourceContent) { + let source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + } + + /** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ + applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + let sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + "SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, " + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + const sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + const newSources = this._mappings.toArray().length > 0 + ? new ArraySet() + : this._sources; + const newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function(mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + const original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source); + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + const source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + const name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function(srcFile) { + const content = aSourceMapConsumer.sourceContentFor(srcFile); + if (content != null) { + if (aSourceMapPath != null) { + srcFile = util.join(aSourceMapPath, srcFile); + } + if (sourceRoot != null) { + srcFile = util.relative(sourceRoot, srcFile); + } + this.setSourceContent(srcFile, content); + } + }, this); + } + + /** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ + _validateMapping(aGenerated, aOriginal, aSource, aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== "number" && typeof aOriginal.column !== "number") { + throw new Error( + "original.line and original.column are not numbers -- you probably meant to omit " + + "the original mapping entirely and only map the generated position. If so, pass " + + "null for the original mapping instead of an object with empty or null values." + ); + } + + if (aGenerated && "line" in aGenerated && "column" in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + + } else if (aGenerated && "line" in aGenerated && "column" in aGenerated + && aOriginal && "line" in aOriginal && "column" in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + + } else { + throw new Error("Invalid mapping: " + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + } + + /** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ + _serializeMappings() { + let previousGeneratedColumn = 0; + let previousGeneratedLine = 1; + let previousOriginalColumn = 0; + let previousOriginalLine = 0; + let previousName = 0; + let previousSource = 0; + let result = ""; + let next; + let mapping; + let nameIdx; + let sourceIdx; + + const mappings = this._mappings.toArray(); + for (let i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = ""; + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ";"; + previousGeneratedLine++; + } + } else if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ","; + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + } + + _generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function(source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + const key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + } + + /** + * Externalize the source map. + */ + toJSON() { + const map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + } + + /** + * Render the source map being generated to a string. + */ + toString() { + return JSON.stringify(this.toJSON()); + } +} + +SourceMapGenerator.prototype._version = 3; +exports.SourceMapGenerator = SourceMapGenerator; diff --git a/node_modules/doiuse/node_modules/source-map/lib/source-node.js b/node_modules/doiuse/node_modules/source-map/lib/source-node.js new file mode 100644 index 00000000..8a7a157e --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/source-node.js @@ -0,0 +1,404 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +const SourceMapGenerator = require("./source-map-generator").SourceMapGenerator; +const util = require("./util"); + +// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other +// operating systems these days (capturing the result). +const REGEX_NEWLINE = /(\r?\n)/; + +// Newline character code for charCodeAt() comparisons +const NEWLINE_CODE = 10; + +// Private symbol for identifying `SourceNode`s when multiple versions of +// the source-map library are loaded. This MUST NOT CHANGE across +// versions! +const isSourceNode = "$$$isSourceNode$$$"; + +/** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ +class SourceNode { + constructor(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); + } + + /** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ + static fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + const node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + const remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + let remainingLinesIndex = 0; + const shiftNextLine = function() { + const lineContents = getNextLine(); + // The last line of a file might not have a newline. + const newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + let lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + let lastMapping = null; + let nextLine; + + aSourceMapConsumer.eachMapping(function(mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + nextLine = remainingLines[remainingLinesIndex] || ""; + const code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + nextLine = remainingLines[remainingLinesIndex] || ""; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function(sourceFile) { + const content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + const source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + } + + /** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function(chunk) { + this.add(chunk); + }, this); + } else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + } + + /** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ + prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (let i = aChunk.length - 1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; + } + + /** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ + walk(aFn) { + let chunk; + for (let i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } else if (chunk !== "") { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } + + /** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ + join(aSep) { + let newChildren; + let i; + const len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len - 1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; + } + + /** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ + replaceRight(aPattern, aReplacement) { + const lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } else if (typeof lastChild === "string") { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } else { + this.children.push("".replace(aPattern, aReplacement)); + } + return this; + } + + /** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ + setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + } + + /** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ + walkSourceContents(aFn) { + for (let i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + const sources = Object.keys(this.sourceContents); + for (let i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + } + + /** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ + toString() { + let str = ""; + this.walk(function(chunk) { + str += chunk; + }); + return str; + } + + /** + * Returns the string representation of this source node along with a source + * map. + */ + toStringWithSourceMap(aArgs) { + const generated = { + code: "", + line: 1, + column: 0 + }; + const map = new SourceMapGenerator(aArgs); + let sourceMappingActive = false; + let lastOriginalSource = null; + let lastOriginalLine = null; + let lastOriginalColumn = null; + let lastOriginalName = null; + this.walk(function(chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if (lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (let idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function(sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map }; + } +} + +exports.SourceNode = SourceNode; diff --git a/node_modules/doiuse/node_modules/source-map/lib/util.js b/node_modules/doiuse/node_modules/source-map/lib/util.js new file mode 100644 index 00000000..35bd93d6 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/util.js @@ -0,0 +1,546 @@ +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } + throw new Error('"' + aName + '" is a required argument.'); + +} +exports.getArg = getArg; + +const urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; +const dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + const match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + let url = ""; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ":"; + } + url += "//"; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + "@"; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port; + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; + +const MAX_CACHED_INPUTS = 32; + +/** + * Takes some function `f(input) -> result` and returns a memoized version of + * `f`. + * + * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The + * memoization is a dumb-simple, linear least-recently-used cache. + */ +function lruMemoize(f) { + const cache = []; + + return function(input) { + for (let i = 0; i < cache.length; i++) { + if (cache[i].input === input) { + const temp = cache[0]; + cache[0] = cache[i]; + cache[i] = temp; + return cache[0].result; + } + } + + const result = f(input); + + cache.unshift({ + input, + result, + }); + + if (cache.length > MAX_CACHED_INPUTS) { + cache.pop(); + } + + return result; + }; +} + +/** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '<dir>/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ +const normalize = lruMemoize(function normalize(aPath) { + let path = aPath; + const url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + const isAbsolute = exports.isAbsolute(path); + + // Split the path into parts between `/` characters. This is much faster than + // using `.split(/\/+/g)`. + const parts = []; + let start = 0; + let i = 0; + while (true) { + start = i; + i = path.indexOf("/", start); + if (i === -1) { + parts.push(path.slice(start)); + break; + } else { + parts.push(path.slice(start, i)); + while (i < path.length && path[i] === "/") { + i++; + } + } + } + + let up = 0; + for (i = parts.length - 1; i >= 0; i--) { + const part = parts[i]; + if (part === ".") { + parts.splice(i, 1); + } else if (part === "..") { + up++; + } else if (up > 0) { + if (part === "") { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join("/"); + + if (path === "") { + path = isAbsolute ? "/" : "."; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +}); +exports.normalize = normalize; + +/** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + const aPathUrl = urlParse(aPath); + const aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || "/"; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + const joined = aPath.charAt(0) === "/" + ? aPath + : normalize(aRoot.replace(/\/+$/, "") + "/" + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; +} +exports.join = join; + +exports.isAbsolute = function(aPath) { + return aPath.charAt(0) === "/" || urlRegexp.test(aPath); +}; + +/** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ""); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + let level = 0; + while (aPath.indexOf(aRoot + "/") !== 0) { + const index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +const supportsNullProto = (function() { + const obj = Object.create(null); + return !("__proto__" in obj); +}()); + +function identity(s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return "$" + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + const length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + /* eslint-disable no-multi-spaces */ + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + /* eslint-enable no-multi-spaces */ + + for (let i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + let cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + let cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + let cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + +/** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ +function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, "")); +} +exports.parseSourceMapInput = parseSourceMapInput; + +/** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ +function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ""; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== "/" && sourceURL[0] !== "/") { + sourceRoot += "/"; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + const parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + const index = parsed.path.lastIndexOf("/"); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); +} +exports.computeSourceURL = computeSourceURL; diff --git a/node_modules/doiuse/node_modules/source-map/lib/wasm.js b/node_modules/doiuse/node_modules/source-map/lib/wasm.js new file mode 100644 index 00000000..88b18bea --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/lib/wasm.js @@ -0,0 +1,107 @@ +const readWasm = require("../lib/read-wasm"); + +/** + * Provide the JIT with a nice shape / hidden class. + */ +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.lastGeneratedColumn = null; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} + +let cachedWasm = null; + +module.exports = function wasm() { + if (cachedWasm) { + return cachedWasm; + } + + const callbackStack = []; + + cachedWasm = readWasm().then(buffer => { + return WebAssembly.instantiate(buffer, { + env: { + mapping_callback( + generatedLine, + generatedColumn, + + hasLastGeneratedColumn, + lastGeneratedColumn, + + hasOriginal, + source, + originalLine, + originalColumn, + + hasName, + name + ) { + const mapping = new Mapping(); + // JS uses 1-based line numbers, wasm uses 0-based. + mapping.generatedLine = generatedLine + 1; + mapping.generatedColumn = generatedColumn; + + if (hasLastGeneratedColumn) { + // JS uses inclusive last generated column, wasm uses exclusive. + mapping.lastGeneratedColumn = lastGeneratedColumn - 1; + } + + if (hasOriginal) { + mapping.source = source; + // JS uses 1-based line numbers, wasm uses 0-based. + mapping.originalLine = originalLine + 1; + mapping.originalColumn = originalColumn; + + if (hasName) { + mapping.name = name; + } + } + + callbackStack[callbackStack.length - 1](mapping); + }, + + start_all_generated_locations_for() { console.time("all_generated_locations_for"); }, + end_all_generated_locations_for() { console.timeEnd("all_generated_locations_for"); }, + + start_compute_column_spans() { console.time("compute_column_spans"); }, + end_compute_column_spans() { console.timeEnd("compute_column_spans"); }, + + start_generated_location_for() { console.time("generated_location_for"); }, + end_generated_location_for() { console.timeEnd("generated_location_for"); }, + + start_original_location_for() { console.time("original_location_for"); }, + end_original_location_for() { console.timeEnd("original_location_for"); }, + + start_parse_mappings() { console.time("parse_mappings"); }, + end_parse_mappings() { console.timeEnd("parse_mappings"); }, + + start_sort_by_generated_location() { console.time("sort_by_generated_location"); }, + end_sort_by_generated_location() { console.timeEnd("sort_by_generated_location"); }, + + start_sort_by_original_location() { console.time("sort_by_original_location"); }, + end_sort_by_original_location() { console.timeEnd("sort_by_original_location"); }, + } + }); + }).then(Wasm => { + return { + exports: Wasm.instance.exports, + withMappingCallback: (mappingCallback, f) => { + callbackStack.push(mappingCallback); + try { + f(); + } finally { + callbackStack.pop(); + } + } + }; + }).then(null, e => { + cachedWasm = null; + throw e; + }); + + return cachedWasm; +}; diff --git a/node_modules/doiuse/node_modules/source-map/package.json b/node_modules/doiuse/node_modules/source-map/package.json new file mode 100644 index 00000000..1d67accb --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/package.json @@ -0,0 +1,91 @@ +{ + "name": "source-map", + "description": "Generates and consumes source maps", + "version": "0.7.4", + "homepage": "https://github.com/mozilla/source-map", + "author": "Nick Fitzgerald <nfitzgerald@mozilla.com>", + "contributors": [ + "Tobias Koppers <tobias.koppers@googlemail.com>", + "Duncan Beevers <duncan@dweebd.com>", + "Stephen Crane <scrane@mozilla.com>", + "Ryan Seddon <seddon.ryan@gmail.com>", + "Miles Elam <miles.elam@deem.com>", + "Mihai Bazon <mihai.bazon@gmail.com>", + "Michael Ficarra <github.public.email@michael.ficarra.me>", + "Todd Wolfson <todd@twolfson.com>", + "Alexander Solovyov <alexander@solovyov.net>", + "Felix Gnass <fgnass@gmail.com>", + "Conrad Irwin <conrad.irwin@gmail.com>", + "usrbincc <usrbincc@yahoo.com>", + "David Glasser <glasser@davidglasser.net>", + "Chase Douglas <chase@newrelic.com>", + "Evan Wallace <evan.exe@gmail.com>", + "Heather Arthur <fayearthur@gmail.com>", + "Hugh Kennedy <hughskennedy@gmail.com>", + "David Glasser <glasser@davidglasser.net>", + "Simon Lydell <simon.lydell@gmail.com>", + "Jmeas Smith <jellyes2@gmail.com>", + "Michael Z Goddard <mzgoddard@gmail.com>", + "azu <azu@users.noreply.github.com>", + "John Gozde <john@gozde.ca>", + "Adam Kirkton <akirkton@truefitinnovation.com>", + "Chris Montgomery <christopher.montgomery@dowjones.com>", + "J. Ryan Stinnett <jryans@gmail.com>", + "Jack Herrington <jherrington@walmartlabs.com>", + "Chris Truter <jeffpalentine@gmail.com>", + "Daniel Espeset <daniel@danielespeset.com>", + "Jamie Wong <jamie.lf.wong@gmail.com>", + "Eddy Bruël <ejpbruel@mozilla.com>", + "Hawken Rives <hawkrives@gmail.com>", + "Gilad Peleg <giladp007@gmail.com>", + "djchie <djchie.dev@gmail.com>", + "Gary Ye <garysye@gmail.com>", + "Nicolas Lalevée <nicolas.lalevee@hibnet.org>" + ], + "repository": { + "type": "git", + "url": "http://github.com/mozilla/source-map.git" + }, + "main": "./source-map.js", + "types": "./source-map.d.ts", + "files": [ + "source-map.js", + "source-map.d.ts", + "lib/", + "dist/source-map.js" + ], + "engines": { + "node": ">= 8" + }, + "license": "BSD-3-Clause", + "scripts": { + "lint": "eslint *.js lib/ test/", + "prebuild": "npm run lint", + "build": "webpack --color", + "pretest": "npm run build", + "test": "node test/run-tests.js", + "precoverage": "npm run build", + "coverage": "nyc node test/run-tests.js", + "setup": "mkdir -p coverage && cp -n .waiting.html coverage/index.html || true", + "dev:live": "live-server --port=4103 --ignorePattern='(js|css|png)$' coverage", + "dev:watch": "watch 'npm run coverage' lib/ test/", + "predev": "npm run setup", + "dev": "npm-run-all -p --silent dev:*", + "clean": "rm -rf coverage .nyc_output", + "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" + }, + "devDependencies": { + "doctoc": "^1.3.1", + "eslint": "^4.19.1", + "live-server": "^1.2.0", + "npm-run-all": "^4.1.2", + "nyc": "^11.7.1", + "watch": "^1.0.2", + "webpack": "^4.9.1", + "webpack-cli": "^3.1" + }, + "nyc": { + "reporter": "html" + }, + "typings": "source-map" +} diff --git a/node_modules/doiuse/node_modules/source-map/source-map.d.ts b/node_modules/doiuse/node_modules/source-map/source-map.d.ts new file mode 100644 index 00000000..24593915 --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/source-map.d.ts @@ -0,0 +1,369 @@ +// Type definitions for source-map 0.7 +// Project: https://github.com/mozilla/source-map +// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>, +// Ron Buckton <https://github.com/rbuckton>, +// John Vilk <https://github.com/jvilk> +// Definitions: https://github.com/mozilla/source-map +export type SourceMapUrl = string; + +export interface StartOfSourceMap { + file?: string; + sourceRoot?: string; + skipValidation?: boolean; +} + +export interface RawSourceMap { + version: number; + sources: string[]; + names: string[]; + sourceRoot?: string; + sourcesContent?: string[]; + mappings: string; + file: string; +} + +export interface RawIndexMap extends StartOfSourceMap { + version: number; + sections: RawSection[]; +} + +export interface RawSection { + offset: Position; + map: RawSourceMap; +} + +export interface Position { + line: number; + column: number; +} + +export interface NullablePosition { + line: number | null; + column: number | null; + lastColumn: number | null; +} + +export interface MappedPosition { + source: string; + line: number; + column: number; + name?: string; +} + +export interface NullableMappedPosition { + source: string | null; + line: number | null; + column: number | null; + name: string | null; +} + +export interface MappingItem { + source: string; + generatedLine: number; + generatedColumn: number; + originalLine: number; + originalColumn: number; + name: string; +} + +export interface Mapping { + generated: Position; + original: Position; + source: string; + name?: string; +} + +export interface CodeWithSourceMap { + code: string; + map: SourceMapGenerator; +} + +export interface SourceMapConsumer { + /** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ + computeColumnSpans(): void; + + /** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. + * - column: The column number in the generated source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. + * - column: The column number in the original source, or null. + * - name: The original identifier, or null. + */ + originalPositionFor(generatedPosition: Position & { bias?: number }): NullableMappedPosition; + + /** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: The column number in the original source. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + generatedPositionFor(originalPosition: MappedPosition & { bias?: number }): NullablePosition; + + /** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. + * - column: Optional. the column number in the original source. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. + * - column: The column number in the generated source, or null. + */ + allGeneratedPositionsFor(originalPosition: MappedPosition): NullablePosition[]; + + /** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ + hasContentsOfAllSources(): boolean; + + /** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ + sourceContentFor(source: string, returnNullOnMissing?: boolean): string | null; + + /** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param callback + * The function that is called with each mapping. + * @param context + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param order + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ + eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void; + /** + * Free this source map consumer's associated wasm data that is manually-managed. + * Alternatively, you can use SourceMapConsumer.with to avoid needing to remember to call destroy. + */ + destroy(): void; +} + +export interface SourceMapConsumerConstructor { + prototype: SourceMapConsumer; + + GENERATED_ORDER: number; + ORIGINAL_ORDER: number; + GREATEST_LOWER_BOUND: number; + LEAST_UPPER_BOUND: number; + + new (rawSourceMap: RawSourceMap, sourceMapUrl?: SourceMapUrl): Promise<BasicSourceMapConsumer>; + new (rawSourceMap: RawIndexMap, sourceMapUrl?: SourceMapUrl): Promise<IndexedSourceMapConsumer>; + new (rawSourceMap: RawSourceMap | RawIndexMap | string, sourceMapUrl?: SourceMapUrl): Promise<BasicSourceMapConsumer | IndexedSourceMapConsumer>; + + /** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param sourceMap + * The source map that will be consumed. + */ + fromSourceMap(sourceMap: SourceMapGenerator, sourceMapUrl?: SourceMapUrl): Promise<BasicSourceMapConsumer>; + + /** + * Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl` + * (see the `SourceMapConsumer` constructor for details. Then, invoke the `async + * function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait + * for `f` to complete, call `destroy` on the consumer, and return `f`'s return + * value. + * + * You must not use the consumer after `f` completes! + * + * By using `with`, you do not have to remember to manually call `destroy` on + * the consumer, since it will be called automatically once `f` completes. + * + * ```js + * const xSquared = await SourceMapConsumer.with( + * myRawSourceMap, + * null, + * async function (consumer) { + * // Use `consumer` inside here and don't worry about remembering + * // to call `destroy`. + * + * const x = await whatever(consumer); + * return x * x; + * } + * ); + * + * // You may not use that `consumer` anymore out here; it has + * // been destroyed. But you can use `xSquared`. + * console.log(xSquared); + * ``` + */ + with<T>(rawSourceMap: RawSourceMap | RawIndexMap | string, sourceMapUrl: SourceMapUrl | null | undefined, callback: (consumer: BasicSourceMapConsumer | IndexedSourceMapConsumer) => Promise<T> | T): Promise<T>; +} + +export const SourceMapConsumer: SourceMapConsumerConstructor; + +export interface BasicSourceMapConsumer extends SourceMapConsumer { + file: string; + sourceRoot: string; + sources: string[]; + sourcesContent: string[]; +} + +export interface BasicSourceMapConsumerConstructor { + prototype: BasicSourceMapConsumer; + + new (rawSourceMap: RawSourceMap | string): Promise<BasicSourceMapConsumer>; + + /** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param sourceMap + * The source map that will be consumed. + */ + fromSourceMap(sourceMap: SourceMapGenerator): Promise<BasicSourceMapConsumer>; +} + +export const BasicSourceMapConsumer: BasicSourceMapConsumerConstructor; + +export interface IndexedSourceMapConsumer extends SourceMapConsumer { + sources: string[]; +} + +export interface IndexedSourceMapConsumerConstructor { + prototype: IndexedSourceMapConsumer; + + new (rawSourceMap: RawIndexMap | string): Promise<IndexedSourceMapConsumer>; +} + +export const IndexedSourceMapConsumer: IndexedSourceMapConsumerConstructor; + +export class SourceMapGenerator { + constructor(startOfSourceMap?: StartOfSourceMap); + + /** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param sourceMapConsumer The SourceMap. + */ + static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator; + + /** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ + addMapping(mapping: Mapping): void; + + /** + * Set the source content for a source file. + */ + setSourceContent(sourceFile: string, sourceContent: string): void; + + /** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param sourceMapConsumer The source map to be applied. + * @param sourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param sourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ + applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void; + + toString(): string; + + toJSON(): RawSourceMap; +} + +export class SourceNode { + children: SourceNode[]; + sourceContents: any; + line: number; + column: number; + source: string; + name: string; + + constructor(); + constructor( + line: number | null, + column: number | null, + source: string | null, + chunks?: Array<(string | SourceNode)> | SourceNode | string, + name?: string + ); + + static fromStringWithSourceMap( + code: string, + sourceMapConsumer: SourceMapConsumer, + relativePath?: string + ): SourceNode; + + add(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode; + + prepend(chunk: Array<(string | SourceNode)> | SourceNode | string): SourceNode; + + setSourceContent(sourceFile: string, sourceContent: string): void; + + walk(fn: (chunk: string, mapping: MappedPosition) => void): void; + + walkSourceContents(fn: (file: string, content: string) => void): void; + + join(sep: string): SourceNode; + + replaceRight(pattern: string, replacement: string): SourceNode; + + toString(): string; + + toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap; +} diff --git a/node_modules/doiuse/node_modules/source-map/source-map.js b/node_modules/doiuse/node_modules/source-map/source-map.js new file mode 100644 index 00000000..a84abf1e --- /dev/null +++ b/node_modules/doiuse/node_modules/source-map/source-map.js @@ -0,0 +1,8 @@ +/* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ +exports.SourceMapGenerator = require("./lib/source-map-generator").SourceMapGenerator; +exports.SourceMapConsumer = require("./lib/source-map-consumer").SourceMapConsumer; +exports.SourceNode = require("./lib/source-node").SourceNode; diff --git a/node_modules/doiuse/package.json b/node_modules/doiuse/package.json new file mode 100644 index 00000000..c82d589c --- /dev/null +++ b/node_modules/doiuse/package.json @@ -0,0 +1,96 @@ +{ + "name": "doiuse", + "version": "6.0.2", + "description": "Lint CSS for browser support against caniuse database", + "main:": "./exports/index.cjs", + "type": "module", + "exports": { + "./lib/*": "./lib/*", + ".": { + "require": "./exports/index.cjs", + "import": "./exports/index.js" + }, + "./stream": { + "require": "./exports/stream.cjs", + "import": "./exports/stream.js" + } + }, + "bin": "./bin/cli.js", + "repository": { + "type": "git", + "url": "https://github.com/anandthakker/doiuse.git" + }, + "keywords": [ + "lint", + "css", + "browser", + "support", + "caniuse", + "stylelint" + ], + "author": "Carlos Lopez Jr. <clshortfuse@gmail.com> (https://github.com/clshortfuse)", + "contributors": [ + "Robbie Wadley (https://github.com/RJWadley)", + "Anand Thakker <mail@anandthakker.net> (http://www.anandthakker.net/)", + "Piotr Kuczynski <piotr.kuczynski@gmail.com> (https://github.com/pkuczynski)" + ], + "license": "MIT", + "bugs": { + "url": "https://github.com/anandthakker/doiuse/issues" + }, + "homepage": "https://github.com/anandthakker/doiuse", + "engines": { + "node": ">=16" + }, + "dependencies": { + "browserslist": "^4.21.5", + "caniuse-lite": "^1.0.30001487", + "css-tokenize": "^1.0.1", + "duplexify": "^4.1.2", + "ldjson-stream": "^1.2.1", + "multimatch": "^5.0.0", + "postcss": "^8.4.21", + "source-map": "^0.7.4", + "yargs": "^17.7.1" + }, + "devDependencies": { + "@types/caniuse-lite": "^1.0.1", + "@types/duplexify": "^3.6.1", + "@types/node": "^16.18.34", + "@types/tap": "^15.0.8", + "@types/yargs": "^17.0.24", + "@typescript-eslint/eslint-plugin": "^5.54.0", + "@typescript-eslint/parser": "^5.54.0", + "c8": "^7.13.0", + "caniuse-db": "^1.0.30001487", + "eslint": "^8.35.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-plugin-canonical": "^4.2.2", + "eslint-plugin-import": "^2.27.5", + "eslint-plugin-jsdoc": "^46.4.3", + "eslint-plugin-n": "^16.0.0", + "eslint-plugin-unicorn": "^47.0.0", + "mock-fs": "^4.14.0", + "postcss-import": "^14.1.0", + "rollup": "^2.79.1", + "safe-regex": "^2.1.1", + "tap": "^16.3.4", + "typescript": "^5.1.6" + }, + "files": [ + "bin", + "data", + "features", + "exports", + "lib", + "types", + "utils" + ], + "scripts": { + "pretest": "eslint \"./bin/**/*.js\" \"./data/**/*.js\" \"./utils/**/*.js\" \"./lib/**/*.js\" \"./test/**/*.js\" && tsc --noEmit", + "test": "c8 tap --no-coverage", + "prepare": "rollup -c rollup.config.js", + "prepublishOnly": "tsc --emitDeclarationOnly", + "updateFeatures": "scripts/update-caniuse.sh && node scripts/update-features.js" + } +} diff --git a/node_modules/doiuse/types/bin/cli.d.ts b/node_modules/doiuse/types/bin/cli.d.ts new file mode 100644 index 00000000..b7988016 --- /dev/null +++ b/node_modules/doiuse/types/bin/cli.d.ts @@ -0,0 +1,2 @@ +#!/usr/bin/env node +export {}; diff --git a/node_modules/doiuse/types/data/features.d.ts b/node_modules/doiuse/types/data/features.d.ts new file mode 100644 index 00000000..f724f4d4 --- /dev/null +++ b/node_modules/doiuse/types/data/features.d.ts @@ -0,0 +1,786 @@ +declare const _default: { + outline: Feature; + "background-attachment": Feature; + pointer: Feature; + "flow-root": Feature; + "font-kerning": Feature; + "font-smooth": Feature; + "font-variant-alternates": Feature; + "font-variant-numeric": Feature; + "inline-block": Feature; + "prefers-color-scheme": Feature; + "prefers-reduced-motion": Feature; + rem: Feature; + "run-in": Feature; + "text-emphasis": Feature; + "text-stroke": Feature; + "webkit-user-drag": Feature; + "border-image": Feature; + "border-radius": Feature; + "font-size-adjust": Feature; + "text-decoration": Feature; + "object-fit": Feature; + "pointer-events": Feature; + "text-overflow": Feature; + "text-size-adjust": Feature; + "will-change": Feature; + "word-break": Feature; + "alternate-stylesheet": Feature; + "background-clip-text": Feature; + "background-img-opts": Feature; + "background-position-x-y": Feature; + "background-repeat-round-space": Feature; + calc: Feature; + "ch-unit": Feature; + "css-all": Feature; + "css-animation": Feature; + "css-any-link": Feature; + "css-appearance": Feature; + "css-at-counter-style": Feature; + "css-autofill": Feature; + "css-backdrop-filter": Feature; + "css-background-offsets": Feature; + "css-backgroundblendmode": Feature; + "css-boxdecorationbreak": Feature; + "css-boxshadow": Feature; + "css-canvas": Feature; + "css-caret-color": Feature; + "css-cascade-layers": Feature; + "css-case-insensitive": Feature; + "css-clip-path": Feature; + "css-color-adjust": Feature; + "css-color-function": Feature; + "css-conic-gradients": Feature; + "css-container-queries": Feature; + "css-container-queries-style": Feature; + "css-container-query-units": Feature; + "css-containment": Feature; + "css-content-visibility": Feature; + "css-counters": Feature; + "css-crisp-edges": Feature; + "css-cross-fade": Feature; + "css-default-pseudo": Feature; + "css-descendant-gtgt": Feature; + "css-deviceadaptation": Feature; + "css-dir-pseudo": Feature; + "css-display-contents": Feature; + "css-element-function": Feature; + "css-env-function": Feature; + "css-exclusions": Feature; + "css-featurequeries": Feature; + "css-file-selector-button": Feature; + "css-filter-function": Feature; + "css-filters": Feature; + "css-first-letter": Feature; + "css-first-line": Feature; + "css-fixed": Feature; + "css-focus-visible": Feature; + "css-focus-within": Feature; + "css-font-palette": Feature; + "css-font-rendering-controls": Feature; + "css-font-stretch": Feature; + "css-gencontent": Feature; + "css-gradients": Feature; + "css-grid": Feature; + "css-grid-animation": Feature; + "css-hanging-punctuation": Feature; + "css-has": Feature; + "css-hyphens": Feature; + "css-image-orientation": Feature; + "css-image-set": Feature; + "css-in-out-of-range": Feature; + "css-indeterminate-pseudo": Feature; + "css-initial-letter": Feature; + "css-initial-value": Feature; + "css-lch-lab": Feature; + "css-letter-spacing": Feature; + "css-line-clamp": Feature; + "css-logical-props": Feature; + "css-marker-pseudo": Feature; + "css-masks": Feature; + "css-matches-pseudo": Feature; + "css-math-functions": Feature; + "css-media-interaction": Feature; + "css-media-range-syntax": Feature; + "css-media-resolution": Feature; + "css-media-scripting": Feature; + "css-mediaqueries": Feature; + "css-mixblendmode": Feature; + "css-motion-paths": Feature; + "css-namespaces": Feature; + "css-nesting": Feature; + "css-not-sel-list": Feature; + "css-nth-child-of": Feature; + "css-opacity": Feature; + "css-optional-pseudo": Feature; + "css-overflow": Feature; + "css-overflow-anchor": Feature; + "css-overflow-overlay": Feature; + "css-overscroll-behavior": Feature; + "css-page-break": Feature; + "css-paged-media": Feature; + "css-paint-api": Feature; + "css-placeholder": Feature; + "css-placeholder-shown": Feature; + "css-print-color-adjust": Feature; + "css-read-only-write": Feature; + "css-rebeccapurple": Feature; + "css-reflections": Feature; + "css-regions": Feature; + "css-relative-colors": Feature; + "css-repeating-gradients": Feature; + "css-resize": Feature; + "css-revert-value": Feature; + "css-rrggbbaa": Feature; + "css-scroll-behavior": Feature; + "css-scroll-timeline": Feature; + "css-scrollbar": Feature; + "css-sel2": Feature; + "css-sel3": Feature; + "css-selection": Feature; + "css-shapes": Feature; + "css-snappoints": Feature; + "css-sticky": Feature; + "css-subgrid": Feature; + "css-supports-api": Feature; + "css-table": Feature; + "css-text-align-last": Feature; + "css-text-box-trim": Feature; + "css-text-indent": Feature; + "css-text-justify": Feature; + "css-text-orientation": Feature; + "css-text-spacing": Feature; + "css-textshadow": Feature; + "css-touch-action": Feature; + "css-transitions": Feature; + "css-unicode-bidi": Feature; + "css-unset-value": Feature; + "css-variables": Feature; + "css-when-else": Feature; + "css-widows-orphans": Feature; + "css-width-stretch": Feature; + "css-writing-mode": Feature; + "css-zoom": Feature; + "css3-attr": Feature; + "css3-boxsizing": Feature; + "css3-colors": Feature; + "css3-cursors": Feature; + "css3-cursors-grab": Feature; + "css3-cursors-newer": Feature; + "css3-tabsize": Feature; + currentcolor: Feature; + devicepixelratio: Feature; + "extended-system-fonts": Feature; + flexbox: Feature; + "flexbox-gap": Feature; + "font-family-system-ui": Feature; + "font-feature": Feature; + "font-loading": Feature; + "font-unicode-range": Feature; + fontface: Feature; + fullscreen: Feature; + getcomputedstyle: Feature; + "intrinsic-width": Feature; + "justify-content-space-evenly": Feature; + "kerning-pairs-ligatures": Feature; + "mdn-css-unicode-bidi-isolate": Feature; + "mdn-css-unicode-bidi-isolate-override": Feature; + "mdn-css-unicode-bidi-plaintext": Feature; + "mdn-text-decoration-color": Feature; + "mdn-text-decoration-line": Feature; + "mdn-text-decoration-shorthand": Feature; + "mdn-text-decoration-style": Feature; + minmaxwh: Feature; + multibackgrounds: Feature; + multicolumn: Feature; + "style-scoped": Feature; + "svg-css": Feature; + transforms2d: Feature; + transforms3d: Feature; + ttf: Feature; + "user-select-none": Feature; + "variable-fonts": Feature; + "viewport-unit-variants": Feature; + "viewport-units": Feature; + wordwrap: Feature; +}; +export default _default; +export type FeatureCheck = string | RegExp | ((value: string) => boolean); +export type RuleCheck = (rule: import('postcss').ChildNode) => boolean; +export type Feature = Record<string, FeatureCheck | FeatureCheck[] | boolean> | RuleCheck | RuleCheck[]; +export type FeatureKeys = keyof typeof FEATURES; +type FEATURES = Feature; +/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */ +/** @typedef {((rule:import('postcss').ChildNode) => boolean)} RuleCheck */ +/** @typedef {Record<string, FeatureCheck|FeatureCheck[]|boolean> | RuleCheck | RuleCheck[]} Feature */ +/** @enum {Feature} */ +declare const FEATURES: { + 'alternate-stylesheet': Feature; + 'background-attachment': Feature; + 'background-clip-text': Feature; + 'background-img-opts': { + 'background-clip': boolean; + 'background-origin': boolean; + 'background-size': boolean; + }; + 'background-position-x-y': { + 'background-position-x': boolean; + 'background-position-y': boolean; + }; + 'background-repeat-round-space': Feature; + 'border-image': { + 'border-image': boolean; + 'border-image-outset': boolean; + 'border-image-repeat': boolean; + 'border-image-slice': boolean; + 'border-image-source': boolean; + 'border-image-width': boolean; + }; + 'border-radius': { + 'border-radius': boolean; + 'border-top-left-radius': boolean; + 'border-top-right-radius': boolean; + 'border-bottom-right-radius': boolean; + 'border-bottom-left-radius': boolean; + }; + calc: { + '': string; + }; + 'ch-unit': Feature; + 'css-all': { + all: boolean; + }; + 'css-animation': { + animation: boolean; + 'animation-name': boolean; + 'animation-duration': boolean; + 'animation-timing-function': boolean; + 'animation-iteration-count': boolean; + 'animation-direction': boolean; + 'animation-play-state': boolean; + 'animation-delay': boolean; + 'animation-fill-mode': boolean; + }; + 'css-any-link': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-appearance': { + appearance: boolean; + '-webkit-appearance': boolean; + '-moz-appearance': boolean; + }; + 'css-at-counter-style': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-autofill': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-backdrop-filter': { + 'backdrop-filter': boolean; + }; + 'css-background-offsets': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-backgroundblendmode': { + 'background-blend-mode': boolean; + }; + 'css-boxdecorationbreak': Feature; + 'css-boxshadow': { + 'box-shadow': boolean; + }; + 'css-canvas': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-caret-color': Feature; + 'css-cascade-layers': Feature; + 'css-case-insensitive': Feature; + 'css-clip-path': { + 'clip-path': boolean; + }; + 'css-color-adjust': Feature; + 'css-color-function': Feature; + 'css-conic-gradients': { + background: RegExp; + 'background-image': RegExp; + 'border-image': RegExp; + 'border-image-source': RegExp; + content: RegExp; + cursor: RegExp; + 'list-style': RegExp; + 'list-style-image': RegExp; + }; + 'css-container-queries': Feature; + 'css-container-queries-style': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-container-query-units': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-containment': Feature; + 'css-content-visibility': Feature; + 'css-counters': { + 'counter-reset': boolean; + 'counter-increment': boolean; + '': string; + }; + 'css-crisp-edges': Feature; + 'css-cross-fade': Feature; + 'css-default-pseudo': Feature; + 'css-descendant-gtgt': Feature; + 'css-deviceadaptation': Feature; + 'css-dir-pseudo': Feature; + 'css-display-contents': Feature; + 'css-element-function': Feature; + 'css-env-function': { + '': string; + }; + 'css-exclusions': Feature; + 'css-featurequeries': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-file-selector-button': Feature; + 'css-filter-function': Feature; + 'css-filters': { + filter: boolean; + }; + 'css-first-letter': Feature; + 'css-first-line': Feature; + 'css-fixed': { + position: string; + }; + 'css-focus-visible': Feature; + 'css-focus-within': Feature; + 'css-font-palette': ((rule: any) => any)[]; + 'css-font-rendering-controls': Feature; + 'css-font-stretch': { + 'font-stretch': boolean; + }; + 'css-gencontent': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-gradients': { + background: RegExp; + 'background-image': RegExp; + 'border-image': RegExp; + 'border-image-source': RegExp; + content: RegExp; + cursor: RegExp; + 'list-style': RegExp; + 'list-style-image': RegExp; + }; + 'css-grid': { + display: string[]; + grid: boolean; + 'grid-area': boolean; + 'grid-auto-columns': boolean; + 'grid-auto-flow': boolean; + 'grid-auto-rows': boolean; + 'grid-column': boolean; + 'grid-column-end': boolean; + 'grid-column-start': boolean; + 'grid-row': boolean; + 'grid-row-end': boolean; + 'grid-row-start': boolean; + 'grid-template': boolean; + 'grid-template-areas': boolean; + 'grid-template-columns': boolean; + 'grid-template-rows': boolean; + }; + 'css-grid-animation': { + transition: RegExp; + 'transition-property': RegExp; + }; + 'css-hanging-punctuation': Feature; + 'css-has': Feature; + 'css-hyphens': { + hyphens: boolean; + }; + 'css-image-orientation': { + 'image-orientation': boolean; + }; + 'css-image-set': Feature; + 'css-in-out-of-range': Feature; + 'css-indeterminate-pseudo': Feature; + 'css-initial-letter': Feature; + 'css-initial-value': { + '': string; + }; + 'css-lch-lab': Feature; + 'css-letter-spacing': Feature; + 'css-line-clamp': Feature; + 'css-logical-props': { + 'block-size': boolean; + 'inline-size': boolean; + 'min-block-size': boolean; + 'min-inline-size': boolean; + 'max-block-size': boolean; + 'max-inline-size': boolean; + 'margin-block-start': boolean; + 'margin-block-end': boolean; + 'margin-inline-start': boolean; + 'margin-inline-end': boolean; + 'margin-block': boolean; + 'margin-inline': boolean; + 'inset-block-start': boolean; + 'inset-block-end': boolean; + 'inset-inline-start': boolean; + 'inset-inline-end': boolean; + 'inset-block': boolean; + 'inset-inline': boolean; + inset: boolean; + 'padding-block-start': boolean; + 'padding-block-end': boolean; + 'padding-inline-start': boolean; + 'padding-inline-end': boolean; + 'padding-block': boolean; + 'padding-inline': boolean; + 'border-block-start-width': boolean; + 'border-block-end-width': boolean; + 'border-inline-start-width': boolean; + 'border-inline-end-width': boolean; + 'border-block-width': boolean; + 'border-inline-width': boolean; + 'border-block-start-style': boolean; + 'border-block-end-style': boolean; + 'border-inline-start-style': boolean; + 'border-inline-end-style': boolean; + 'border-block-style': boolean; + 'border-inline-style': boolean; + 'border-block-start-color': boolean; + 'border-block-end-color': boolean; + 'border-inline-start-color': boolean; + 'border-inline-end-color': boolean; + 'border-block-color': boolean; + 'border-inline-color': boolean; + 'border-block-start': boolean; + 'border-block-end': boolean; + 'border-inline-start': boolean; + 'border-inline-end': boolean; + 'border-block': boolean; + 'border-inline': boolean; + 'border-start-start-radius': boolean; + 'border-start-end-radius': boolean; + 'border-end-start-radius': boolean; + 'border-end-end-radius': boolean; + 'text-align': string[]; + float: string[]; + resize: string[]; + 'overflow-block': boolean; + 'overflow-inline': boolean; + }; + 'css-marker-pseudo': Feature; + 'css-masks': { + 'clip-path': boolean; + mask: boolean; + 'mask-border': boolean; + 'mask-border-mode': boolean; + 'mask-border-outset': boolean; + 'mask-border-repeat': boolean; + 'mask-border-slice': boolean; + 'mask-border-source': boolean; + 'mask-border-width': boolean; + 'mask-clip': boolean; + 'mask-composite': boolean; + 'mask-image': boolean; + 'mask-mode': boolean; + 'mask-origin': boolean; + 'mask-position': boolean; + 'mask-repeat': boolean; + 'mask-size': boolean; + 'mask-type': boolean; + '-webkit-clip-path': boolean; + '-webkit-mask': boolean; + '-webkit-mask-border': boolean; + '-webkit-mask-border-mode': boolean; + '-webkit-mask-border-outset': boolean; + '-webkit-mask-border-repeat': boolean; + '-webkit-mask-border-slice': boolean; + '-webkit-mask-border-source': boolean; + '-webkit-mask-border-width': boolean; + '-webkit-mask-clip': boolean; + '-webkit-mask-composite': boolean; + '-webkit-mask-image': boolean; + '-webkit-mask-mode': boolean; + '-webkit-mask-origin': boolean; + '-webkit-mask-position': boolean; + '-webkit-mask-repeat': boolean; + '-webkit-mask-size': boolean; + '-webkit-mask-type': boolean; + }; + 'css-matches-pseudo': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-math-functions': { + '': string[]; + }; + 'css-media-interaction': Feature; + 'css-media-range-syntax': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-media-resolution': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-media-scripting': Feature; + 'css-mediaqueries': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-mixblendmode': { + 'mix-blend-mode': boolean; + }; + 'css-motion-paths': { + 'offset-path': boolean; + }; + 'css-namespaces': Feature; + 'css-nesting': Feature; + 'css-not-sel-list': Feature; + 'css-nth-child-of': Feature; + 'css-opacity': { + opacity: boolean; + }; + 'css-optional-pseudo': Feature; + 'css-overflow': Feature; + 'css-overflow-anchor': Feature; + 'css-overflow-overlay': { + overflow: string; + }; + 'css-overscroll-behavior': { + 'overscroll-behavior': boolean; + 'overscroll-behavior-x': boolean; + 'overscroll-behavior-y': boolean; + }; + 'css-page-break': Feature; + 'css-paged-media': Feature; + 'css-paint-api': Feature; + 'css-placeholder': ((rule: import("postcss/lib/node.js").ChildNode) => boolean)[]; + 'css-placeholder-shown': Feature; + 'css-print-color-adjust': { + 'print-color-adjust': boolean; + }; + 'css-read-only-write': Feature; + 'css-rebeccapurple': Feature; + 'css-reflections': { + 'box-reflect': boolean; + '-webkit-box-reflect': boolean; + }; + 'css-regions': Feature; + 'css-relative-colors': Feature; + 'css-repeating-gradients': { + '': string[]; + }; + 'css-resize': { + resize: boolean; + }; + 'css-revert-value': { + '': string; + }; + 'css-rrggbbaa': Feature; + 'css-scroll-behavior': Feature; + 'css-scroll-timeline': Feature; + 'css-scrollbar': { + 'scrollbar-color': boolean; + 'scrollbar-width': boolean; + }; + 'css-sel2': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-sel3': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-selection': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-shapes': { + 'shape-outside': boolean; + 'shape-image-threshold': boolean; + 'shape-margin': boolean; + }; + 'css-snappoints': Feature; + 'css-sticky': { + position: string; + }; + 'css-subgrid': Feature; + 'css-supports-api': Feature; + 'css-table': { + display: string[]; + }; + 'css-text-align-last': Feature; + 'css-text-box-trim': Feature; + 'css-text-indent': Feature; + 'css-text-justify': Feature; + 'css-text-orientation': Feature; + 'css-text-spacing': Feature; + 'css-textshadow': { + 'text-shadow': boolean; + }; + 'css-touch-action': { + 'touch-action': boolean; + }; + 'css-transitions': { + transition: boolean; + 'transition-property': boolean; + 'transition-duration': boolean; + 'transition-delay': boolean; + 'transition-timing-function': boolean; + }; + 'css-unicode-bidi': Feature; + 'css-unset-value': { + '': string; + }; + 'css-variables': (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'css-when-else': Feature; + 'css-widows-orphans': Feature; + 'css-width-stretch': Feature; + 'css-writing-mode': Feature; + 'css-zoom': Feature; + 'css3-attr': Feature; + 'css3-boxsizing': { + 'box-sizing': boolean; + }; + 'css3-colors': { + '': string[]; + }; + 'css3-cursors': { + cursor: string[]; + }; + 'css3-cursors-grab': { + cursor: string[]; + }; + 'css3-cursors-newer': { + cursor: string[]; + }; + 'css3-tabsize': { + 'tab-size': boolean; + }; + currentcolor: Feature; + devicepixelratio: Feature; + 'extended-system-fonts': Feature; + flexbox: { + display: string[]; + flex: boolean; + 'flex-grow': boolean; + 'flex-shrink': boolean; + 'flex-basis': boolean; + 'flex-direction': boolean; + 'flex-wrap': boolean; + 'flex-flow': boolean; + }; + 'flexbox-gap': Feature; + 'flow-root': Feature; + 'font-family-system-ui': Feature; + 'font-feature': { + 'font-feature-settings': boolean; + 'font-variant-ligatures': boolean; + 'font-language-override': boolean; + 'font-kerning': boolean; + }; + 'font-kerning': Feature; + 'font-loading': Feature; + 'font-size-adjust': { + 'font-size-adjust': boolean; + }; + 'font-smooth': Feature; + 'font-unicode-range': { + 'unicode-range': boolean; + }; + 'font-variant-alternates': Feature; + 'font-variant-numeric': Feature; + fontface: ((rule: import("postcss/lib/node.js").ChildNode) => boolean)[]; + fullscreen: (rule: import("postcss/lib/node.js").ChildNode) => boolean; + getcomputedstyle: Feature; + 'inline-block': { + display: string; + }; + 'intrinsic-width': { + width: string[]; + 'min-width': string[]; + 'max-width': string[]; + height: string[]; + 'min-height': string[]; + 'max-height': string[]; + }; + 'justify-content-space-evenly': Feature; + 'kerning-pairs-ligatures': { + 'text-rendering': string; + }; + 'mdn-css-unicode-bidi-isolate': { + 'unicode-bidi': string; + }; + 'mdn-css-unicode-bidi-isolate-override': { + 'unicode-bidi': string; + }; + 'mdn-css-unicode-bidi-plaintext': { + 'unicode-bidi': string; + }; + 'mdn-text-decoration-color': { + 'text-decoration-color': boolean; + }; + 'mdn-text-decoration-line': { + 'text-decoration-line': boolean; + }; + 'mdn-text-decoration-shorthand': { + 'text-decoration': boolean; + }; + 'mdn-text-decoration-style': { + 'text-decoration-style': boolean; + }; + minmaxwh: { + 'min-width': boolean; + 'max-width': boolean; + 'min-height': boolean; + 'max-height': boolean; + }; + multibackgrounds: (rule: import("postcss/lib/node.js").ChildNode) => boolean; + multicolumn: { + columns: boolean; + 'column-width': boolean; + 'column-gap': boolean; + 'column-rule': boolean; + 'column-rule-color': boolean; + 'column-rule-width': boolean; + 'column-count': boolean; + 'column-rule-style': boolean; + 'column-span': boolean; + 'column-fill': boolean; + 'break-before': boolean; + 'break-after': boolean; + 'break-inside': boolean; + }; + 'object-fit': { + 'object-fit': boolean; + 'object-position': boolean; + }; + outline: { + outline: boolean; + 'outline-style': boolean; + 'outline-width': boolean; + 'outline-color': boolean; + }; + pointer: { + 'touch-action': boolean; + }; + 'pointer-events': { + 'pointer-events': boolean; + }; + 'prefers-color-scheme': Feature; + 'prefers-reduced-motion': Feature; + rem: (rule: import("postcss/lib/node.js").ChildNode) => boolean; + 'run-in': Feature; + 'style-scoped': Feature; + 'svg-css': Feature; + 'text-decoration': { + 'text-decoration-style': boolean; + 'text-decoration-line': boolean; + 'text-decoration-color': boolean; + 'text-decoration': RegExp; + 'text-decoration-thickness': boolean; + 'text-decoration-skip': boolean; + 'text-decoration-skip-ink': boolean; + }; + 'text-emphasis': Feature; + 'text-overflow': { + 'text-overflow': boolean; + }; + 'text-size-adjust': { + 'text-size-adjust': boolean; + }; + 'text-stroke': Feature; + transforms2d: { + transform: boolean; + 'transform-origin': boolean; + }; + transforms3d: { + perspective: boolean; + 'perspective-origin': boolean; + 'transform-style': boolean; + 'backface-visibility': boolean; + transform: string; + }; + ttf: Feature; + 'user-select-none': { + 'user-select': boolean; + }; + 'variable-fonts': Feature; + 'viewport-unit-variants': Feature; + 'viewport-units': { + '': string[]; + }; + 'webkit-user-drag': Feature; + 'will-change': { + 'will-change': boolean; + }; + 'word-break': { + 'word-break': boolean; + }; + wordwrap: { + 'overflow-wrap': boolean; + 'word-wrap': boolean; + }; +}; diff --git a/node_modules/doiuse/types/data/features/alternate-stylesheet.d.ts b/node_modules/doiuse/types/data/features/alternate-stylesheet.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/alternate-stylesheet.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/background-attachment.d.ts b/node_modules/doiuse/types/data/features/background-attachment.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/background-attachment.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/background-clip-text.d.ts b/node_modules/doiuse/types/data/features/background-clip-text.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/background-clip-text.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/background-img-opts.d.ts b/node_modules/doiuse/types/data/features/background-img-opts.d.ts new file mode 100644 index 00000000..78c1aefe --- /dev/null +++ b/node_modules/doiuse/types/data/features/background-img-opts.d.ts @@ -0,0 +1,6 @@ +declare const _default: { + 'background-clip': boolean; + 'background-origin': boolean; + 'background-size': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/background-position-x-y.d.ts b/node_modules/doiuse/types/data/features/background-position-x-y.d.ts new file mode 100644 index 00000000..a6c9a187 --- /dev/null +++ b/node_modules/doiuse/types/data/features/background-position-x-y.d.ts @@ -0,0 +1,5 @@ +declare const _default: { + 'background-position-x': boolean; + 'background-position-y': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/background-repeat-round-space.d.ts b/node_modules/doiuse/types/data/features/background-repeat-round-space.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/background-repeat-round-space.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/border-image.d.ts b/node_modules/doiuse/types/data/features/border-image.d.ts new file mode 100644 index 00000000..5ea36f26 --- /dev/null +++ b/node_modules/doiuse/types/data/features/border-image.d.ts @@ -0,0 +1,9 @@ +declare const _default: { + 'border-image': boolean; + 'border-image-outset': boolean; + 'border-image-repeat': boolean; + 'border-image-slice': boolean; + 'border-image-source': boolean; + 'border-image-width': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/border-radius.d.ts b/node_modules/doiuse/types/data/features/border-radius.d.ts new file mode 100644 index 00000000..42a5f870 --- /dev/null +++ b/node_modules/doiuse/types/data/features/border-radius.d.ts @@ -0,0 +1,8 @@ +declare const _default: { + 'border-radius': boolean; + 'border-top-left-radius': boolean; + 'border-top-right-radius': boolean; + 'border-bottom-right-radius': boolean; + 'border-bottom-left-radius': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/calc.d.ts b/node_modules/doiuse/types/data/features/calc.d.ts new file mode 100644 index 00000000..e9abdf25 --- /dev/null +++ b/node_modules/doiuse/types/data/features/calc.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/ch-unit.d.ts b/node_modules/doiuse/types/data/features/ch-unit.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/ch-unit.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-all.d.ts b/node_modules/doiuse/types/data/features/css-all.d.ts new file mode 100644 index 00000000..9d932f8c --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-all.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let all: boolean; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-animation.d.ts b/node_modules/doiuse/types/data/features/css-animation.d.ts new file mode 100644 index 00000000..00d5a94f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-animation.d.ts @@ -0,0 +1,12 @@ +declare const _default: { + animation: boolean; + 'animation-name': boolean; + 'animation-duration': boolean; + 'animation-timing-function': boolean; + 'animation-iteration-count': boolean; + 'animation-direction': boolean; + 'animation-play-state': boolean; + 'animation-delay': boolean; + 'animation-fill-mode': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-any-link.d.ts b/node_modules/doiuse/types/data/features/css-any-link.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-any-link.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-appearance.d.ts b/node_modules/doiuse/types/data/features/css-appearance.d.ts new file mode 100644 index 00000000..5306895c --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-appearance.d.ts @@ -0,0 +1,6 @@ +declare const _default: { + appearance: boolean; + '-webkit-appearance': boolean; + '-moz-appearance': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-at-counter-style.d.ts b/node_modules/doiuse/types/data/features/css-at-counter-style.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-at-counter-style.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-autofill.d.ts b/node_modules/doiuse/types/data/features/css-autofill.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-autofill.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-backdrop-filter.d.ts b/node_modules/doiuse/types/data/features/css-backdrop-filter.d.ts new file mode 100644 index 00000000..7b11086f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-backdrop-filter.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'backdrop-filter': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-background-offsets.d.ts b/node_modules/doiuse/types/data/features/css-background-offsets.d.ts new file mode 100644 index 00000000..2dbf6838 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-background-offsets.d.ts @@ -0,0 +1,2 @@ +declare function _default(rule: import('postcss').ChildNode): boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-backgroundblendmode.d.ts b/node_modules/doiuse/types/data/features/css-backgroundblendmode.d.ts new file mode 100644 index 00000000..0b1cfffb --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-backgroundblendmode.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'background-blend-mode': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-boxdecorationbreak.d.ts b/node_modules/doiuse/types/data/features/css-boxdecorationbreak.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-boxdecorationbreak.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-boxshadow.d.ts b/node_modules/doiuse/types/data/features/css-boxshadow.d.ts new file mode 100644 index 00000000..42eee3a6 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-boxshadow.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'box-shadow': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-canvas.d.ts b/node_modules/doiuse/types/data/features/css-canvas.d.ts new file mode 100644 index 00000000..2dbf6838 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-canvas.d.ts @@ -0,0 +1,2 @@ +declare function _default(rule: import('postcss').ChildNode): boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-caret-color.d.ts b/node_modules/doiuse/types/data/features/css-caret-color.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-caret-color.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-cascade-layers.d.ts b/node_modules/doiuse/types/data/features/css-cascade-layers.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-cascade-layers.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-case-insensitive.d.ts b/node_modules/doiuse/types/data/features/css-case-insensitive.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-case-insensitive.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-clip-path.d.ts b/node_modules/doiuse/types/data/features/css-clip-path.d.ts new file mode 100644 index 00000000..4d709c81 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-clip-path.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'clip-path': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-color-adjust.d.ts b/node_modules/doiuse/types/data/features/css-color-adjust.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-color-adjust.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-color-function.d.ts b/node_modules/doiuse/types/data/features/css-color-function.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-color-function.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-conic-gradients.d.ts b/node_modules/doiuse/types/data/features/css-conic-gradients.d.ts new file mode 100644 index 00000000..0f7d08ee --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-conic-gradients.d.ts @@ -0,0 +1,11 @@ +declare const _default: { + background: RegExp; + 'background-image': RegExp; + 'border-image': RegExp; + 'border-image-source': RegExp; + content: RegExp; + cursor: RegExp; + 'list-style': RegExp; + 'list-style-image': RegExp; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-container-queries-style.d.ts b/node_modules/doiuse/types/data/features/css-container-queries-style.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-container-queries-style.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-container-queries.d.ts b/node_modules/doiuse/types/data/features/css-container-queries.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-container-queries.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-container-query-units.d.ts b/node_modules/doiuse/types/data/features/css-container-query-units.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-container-query-units.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-containment.d.ts b/node_modules/doiuse/types/data/features/css-containment.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-containment.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-content-visibility.d.ts b/node_modules/doiuse/types/data/features/css-content-visibility.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-content-visibility.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-counters.d.ts b/node_modules/doiuse/types/data/features/css-counters.d.ts new file mode 100644 index 00000000..15591bb6 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-counters.d.ts @@ -0,0 +1,6 @@ +declare const _default: { + 'counter-reset': boolean; + 'counter-increment': boolean; + '': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-crisp-edges.d.ts b/node_modules/doiuse/types/data/features/css-crisp-edges.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-crisp-edges.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-cross-fade.d.ts b/node_modules/doiuse/types/data/features/css-cross-fade.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-cross-fade.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-default-pseudo.d.ts b/node_modules/doiuse/types/data/features/css-default-pseudo.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-default-pseudo.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-descendant-gtgt.d.ts b/node_modules/doiuse/types/data/features/css-descendant-gtgt.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-descendant-gtgt.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-deviceadaptation.d.ts b/node_modules/doiuse/types/data/features/css-deviceadaptation.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-deviceadaptation.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-dir-pseudo.d.ts b/node_modules/doiuse/types/data/features/css-dir-pseudo.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-dir-pseudo.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-display-contents.d.ts b/node_modules/doiuse/types/data/features/css-display-contents.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-display-contents.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-element-function.d.ts b/node_modules/doiuse/types/data/features/css-element-function.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-element-function.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-env-function.d.ts b/node_modules/doiuse/types/data/features/css-env-function.d.ts new file mode 100644 index 00000000..e9abdf25 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-env-function.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-exclusions.d.ts b/node_modules/doiuse/types/data/features/css-exclusions.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-exclusions.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-featurequeries.d.ts b/node_modules/doiuse/types/data/features/css-featurequeries.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-featurequeries.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-file-selector-button.d.ts b/node_modules/doiuse/types/data/features/css-file-selector-button.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-file-selector-button.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-filter-function.d.ts b/node_modules/doiuse/types/data/features/css-filter-function.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-filter-function.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-filters.d.ts b/node_modules/doiuse/types/data/features/css-filters.d.ts new file mode 100644 index 00000000..7d91e054 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-filters.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let filter: boolean; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-first-letter.d.ts b/node_modules/doiuse/types/data/features/css-first-letter.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-first-letter.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-first-line.d.ts b/node_modules/doiuse/types/data/features/css-first-line.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-first-line.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-fixed.d.ts b/node_modules/doiuse/types/data/features/css-fixed.d.ts new file mode 100644 index 00000000..48be0197 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-fixed.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let position: string; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-focus-visible.d.ts b/node_modules/doiuse/types/data/features/css-focus-visible.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-focus-visible.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-focus-within.d.ts b/node_modules/doiuse/types/data/features/css-focus-within.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-focus-within.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-font-palette.d.ts b/node_modules/doiuse/types/data/features/css-font-palette.d.ts new file mode 100644 index 00000000..2e9f0c70 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-font-palette.d.ts @@ -0,0 +1,2 @@ +declare const _default: ((rule: any) => any)[]; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-font-rendering-controls.d.ts b/node_modules/doiuse/types/data/features/css-font-rendering-controls.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-font-rendering-controls.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-font-stretch.d.ts b/node_modules/doiuse/types/data/features/css-font-stretch.d.ts new file mode 100644 index 00000000..e5d73f80 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-font-stretch.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'font-stretch': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-gencontent.d.ts b/node_modules/doiuse/types/data/features/css-gencontent.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-gencontent.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-gradients.d.ts b/node_modules/doiuse/types/data/features/css-gradients.d.ts new file mode 100644 index 00000000..0f7d08ee --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-gradients.d.ts @@ -0,0 +1,11 @@ +declare const _default: { + background: RegExp; + 'background-image': RegExp; + 'border-image': RegExp; + 'border-image-source': RegExp; + content: RegExp; + cursor: RegExp; + 'list-style': RegExp; + 'list-style-image': RegExp; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-grid-animation.d.ts b/node_modules/doiuse/types/data/features/css-grid-animation.d.ts new file mode 100644 index 00000000..7b363681 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-grid-animation.d.ts @@ -0,0 +1,5 @@ +declare const _default: { + transition: RegExp; + 'transition-property': RegExp; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-grid.d.ts b/node_modules/doiuse/types/data/features/css-grid.d.ts new file mode 100644 index 00000000..0239676e --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-grid.d.ts @@ -0,0 +1,19 @@ +declare const _default: { + display: string[]; + grid: boolean; + 'grid-area': boolean; + 'grid-auto-columns': boolean; + 'grid-auto-flow': boolean; + 'grid-auto-rows': boolean; + 'grid-column': boolean; + 'grid-column-end': boolean; + 'grid-column-start': boolean; + 'grid-row': boolean; + 'grid-row-end': boolean; + 'grid-row-start': boolean; + 'grid-template': boolean; + 'grid-template-areas': boolean; + 'grid-template-columns': boolean; + 'grid-template-rows': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-hanging-punctuation.d.ts b/node_modules/doiuse/types/data/features/css-hanging-punctuation.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-hanging-punctuation.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-has.d.ts b/node_modules/doiuse/types/data/features/css-has.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-has.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-hyphens.d.ts b/node_modules/doiuse/types/data/features/css-hyphens.d.ts new file mode 100644 index 00000000..daa4d458 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-hyphens.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let hyphens: boolean; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-image-orientation.d.ts b/node_modules/doiuse/types/data/features/css-image-orientation.d.ts new file mode 100644 index 00000000..e0cd313f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-image-orientation.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'image-orientation': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-image-set.d.ts b/node_modules/doiuse/types/data/features/css-image-set.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-image-set.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-in-out-of-range.d.ts b/node_modules/doiuse/types/data/features/css-in-out-of-range.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-in-out-of-range.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-indeterminate-pseudo.d.ts b/node_modules/doiuse/types/data/features/css-indeterminate-pseudo.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-indeterminate-pseudo.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-initial-letter.d.ts b/node_modules/doiuse/types/data/features/css-initial-letter.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-initial-letter.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-initial-value.d.ts b/node_modules/doiuse/types/data/features/css-initial-value.d.ts new file mode 100644 index 00000000..e9abdf25 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-initial-value.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-lch-lab.d.ts b/node_modules/doiuse/types/data/features/css-lch-lab.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-lch-lab.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-letter-spacing.d.ts b/node_modules/doiuse/types/data/features/css-letter-spacing.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-letter-spacing.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-line-clamp.d.ts b/node_modules/doiuse/types/data/features/css-line-clamp.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-line-clamp.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-logical-props.d.ts b/node_modules/doiuse/types/data/features/css-logical-props.d.ts new file mode 100644 index 00000000..f214d4c1 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-logical-props.d.ts @@ -0,0 +1,61 @@ +declare const _default: { + 'block-size': boolean; + 'inline-size': boolean; + 'min-block-size': boolean; + 'min-inline-size': boolean; + 'max-block-size': boolean; + 'max-inline-size': boolean; + 'margin-block-start': boolean; + 'margin-block-end': boolean; + 'margin-inline-start': boolean; + 'margin-inline-end': boolean; + 'margin-block': boolean; + 'margin-inline': boolean; + 'inset-block-start': boolean; + 'inset-block-end': boolean; + 'inset-inline-start': boolean; + 'inset-inline-end': boolean; + 'inset-block': boolean; + 'inset-inline': boolean; + inset: boolean; + 'padding-block-start': boolean; + 'padding-block-end': boolean; + 'padding-inline-start': boolean; + 'padding-inline-end': boolean; + 'padding-block': boolean; + 'padding-inline': boolean; + 'border-block-start-width': boolean; + 'border-block-end-width': boolean; + 'border-inline-start-width': boolean; + 'border-inline-end-width': boolean; + 'border-block-width': boolean; + 'border-inline-width': boolean; + 'border-block-start-style': boolean; + 'border-block-end-style': boolean; + 'border-inline-start-style': boolean; + 'border-inline-end-style': boolean; + 'border-block-style': boolean; + 'border-inline-style': boolean; + 'border-block-start-color': boolean; + 'border-block-end-color': boolean; + 'border-inline-start-color': boolean; + 'border-inline-end-color': boolean; + 'border-block-color': boolean; + 'border-inline-color': boolean; + 'border-block-start': boolean; + 'border-block-end': boolean; + 'border-inline-start': boolean; + 'border-inline-end': boolean; + 'border-block': boolean; + 'border-inline': boolean; + 'border-start-start-radius': boolean; + 'border-start-end-radius': boolean; + 'border-end-start-radius': boolean; + 'border-end-end-radius': boolean; + 'text-align': string[]; + float: string[]; + resize: string[]; + 'overflow-block': boolean; + 'overflow-inline': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-marker-pseudo.d.ts b/node_modules/doiuse/types/data/features/css-marker-pseudo.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-marker-pseudo.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-masks.d.ts b/node_modules/doiuse/types/data/features/css-masks.d.ts new file mode 100644 index 00000000..4e8cb234 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-masks.d.ts @@ -0,0 +1,39 @@ +declare const _default: { + 'clip-path': boolean; + mask: boolean; + 'mask-border': boolean; + 'mask-border-mode': boolean; + 'mask-border-outset': boolean; + 'mask-border-repeat': boolean; + 'mask-border-slice': boolean; + 'mask-border-source': boolean; + 'mask-border-width': boolean; + 'mask-clip': boolean; + 'mask-composite': boolean; + 'mask-image': boolean; + 'mask-mode': boolean; + 'mask-origin': boolean; + 'mask-position': boolean; + 'mask-repeat': boolean; + 'mask-size': boolean; + 'mask-type': boolean; + '-webkit-clip-path': boolean; + '-webkit-mask': boolean; + '-webkit-mask-border': boolean; + '-webkit-mask-border-mode': boolean; + '-webkit-mask-border-outset': boolean; + '-webkit-mask-border-repeat': boolean; + '-webkit-mask-border-slice': boolean; + '-webkit-mask-border-source': boolean; + '-webkit-mask-border-width': boolean; + '-webkit-mask-clip': boolean; + '-webkit-mask-composite': boolean; + '-webkit-mask-image': boolean; + '-webkit-mask-mode': boolean; + '-webkit-mask-origin': boolean; + '-webkit-mask-position': boolean; + '-webkit-mask-repeat': boolean; + '-webkit-mask-size': boolean; + '-webkit-mask-type': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-matches-pseudo.d.ts b/node_modules/doiuse/types/data/features/css-matches-pseudo.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-matches-pseudo.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-math-functions.d.ts b/node_modules/doiuse/types/data/features/css-math-functions.d.ts new file mode 100644 index 00000000..de2aca6e --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-math-functions.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string[]; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-media-interaction.d.ts b/node_modules/doiuse/types/data/features/css-media-interaction.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-media-interaction.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-media-range-syntax.d.ts b/node_modules/doiuse/types/data/features/css-media-range-syntax.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-media-range-syntax.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-media-resolution.d.ts b/node_modules/doiuse/types/data/features/css-media-resolution.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-media-resolution.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-media-scripting.d.ts b/node_modules/doiuse/types/data/features/css-media-scripting.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-media-scripting.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-mediaqueries.d.ts b/node_modules/doiuse/types/data/features/css-mediaqueries.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-mediaqueries.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-mixblendmode.d.ts b/node_modules/doiuse/types/data/features/css-mixblendmode.d.ts new file mode 100644 index 00000000..7c651984 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-mixblendmode.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'mix-blend-mode': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-motion-paths.d.ts b/node_modules/doiuse/types/data/features/css-motion-paths.d.ts new file mode 100644 index 00000000..668aad63 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-motion-paths.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'offset-path': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-namespaces.d.ts b/node_modules/doiuse/types/data/features/css-namespaces.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-namespaces.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-nesting.d.ts b/node_modules/doiuse/types/data/features/css-nesting.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-nesting.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-not-sel-list.d.ts b/node_modules/doiuse/types/data/features/css-not-sel-list.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-not-sel-list.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-nth-child-of.d.ts b/node_modules/doiuse/types/data/features/css-nth-child-of.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-nth-child-of.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-opacity.d.ts b/node_modules/doiuse/types/data/features/css-opacity.d.ts new file mode 100644 index 00000000..503169ee --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-opacity.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let opacity: boolean; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-optional-pseudo.d.ts b/node_modules/doiuse/types/data/features/css-optional-pseudo.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-optional-pseudo.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-overflow-anchor.d.ts b/node_modules/doiuse/types/data/features/css-overflow-anchor.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-overflow-anchor.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-overflow-overlay.d.ts b/node_modules/doiuse/types/data/features/css-overflow-overlay.d.ts new file mode 100644 index 00000000..b3f11e17 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-overflow-overlay.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let overflow: string; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-overflow.d.ts b/node_modules/doiuse/types/data/features/css-overflow.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-overflow.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-overscroll-behavior.d.ts b/node_modules/doiuse/types/data/features/css-overscroll-behavior.d.ts new file mode 100644 index 00000000..fc0a2dce --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-overscroll-behavior.d.ts @@ -0,0 +1,6 @@ +declare const _default: { + 'overscroll-behavior': boolean; + 'overscroll-behavior-x': boolean; + 'overscroll-behavior-y': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-page-break.d.ts b/node_modules/doiuse/types/data/features/css-page-break.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-page-break.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-paged-media.d.ts b/node_modules/doiuse/types/data/features/css-paged-media.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-paged-media.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-paint-api.d.ts b/node_modules/doiuse/types/data/features/css-paint-api.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-paint-api.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-placeholder-shown.d.ts b/node_modules/doiuse/types/data/features/css-placeholder-shown.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-placeholder-shown.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-placeholder.d.ts b/node_modules/doiuse/types/data/features/css-placeholder.d.ts new file mode 100644 index 00000000..ead1e0f0 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-placeholder.d.ts @@ -0,0 +1,2 @@ +declare const _default: ((rule: import("postcss/lib/node.js").ChildNode) => boolean)[]; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-print-color-adjust.d.ts b/node_modules/doiuse/types/data/features/css-print-color-adjust.d.ts new file mode 100644 index 00000000..69a15267 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-print-color-adjust.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'print-color-adjust': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-read-only-write.d.ts b/node_modules/doiuse/types/data/features/css-read-only-write.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-read-only-write.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-rebeccapurple.d.ts b/node_modules/doiuse/types/data/features/css-rebeccapurple.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-rebeccapurple.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-reflections.d.ts b/node_modules/doiuse/types/data/features/css-reflections.d.ts new file mode 100644 index 00000000..20d0b51a --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-reflections.d.ts @@ -0,0 +1,5 @@ +declare const _default: { + 'box-reflect': boolean; + '-webkit-box-reflect': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-regions.d.ts b/node_modules/doiuse/types/data/features/css-regions.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-regions.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-relative-colors.d.ts b/node_modules/doiuse/types/data/features/css-relative-colors.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-relative-colors.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-repeating-gradients.d.ts b/node_modules/doiuse/types/data/features/css-repeating-gradients.d.ts new file mode 100644 index 00000000..de2aca6e --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-repeating-gradients.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string[]; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-resize.d.ts b/node_modules/doiuse/types/data/features/css-resize.d.ts new file mode 100644 index 00000000..f30fce5a --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-resize.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let resize: boolean; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-revert-value.d.ts b/node_modules/doiuse/types/data/features/css-revert-value.d.ts new file mode 100644 index 00000000..e9abdf25 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-revert-value.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-rrggbbaa.d.ts b/node_modules/doiuse/types/data/features/css-rrggbbaa.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-rrggbbaa.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-scroll-behavior.d.ts b/node_modules/doiuse/types/data/features/css-scroll-behavior.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-scroll-behavior.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-scroll-timeline.d.ts b/node_modules/doiuse/types/data/features/css-scroll-timeline.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-scroll-timeline.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-scrollbar.d.ts b/node_modules/doiuse/types/data/features/css-scrollbar.d.ts new file mode 100644 index 00000000..d4c79319 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-scrollbar.d.ts @@ -0,0 +1,5 @@ +declare const _default: { + 'scrollbar-color': boolean; + 'scrollbar-width': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-sel2.d.ts b/node_modules/doiuse/types/data/features/css-sel2.d.ts new file mode 100644 index 00000000..ff916920 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-sel2.d.ts @@ -0,0 +1,9 @@ +export namespace REGEXES { + let HAS_ATTRIBUTE: RegExp; + let MATCH_ATTRIBUTE: RegExp; + let WORD_ATTRIBUTE: RegExp; + let SUBCODE_ATTRIBUTE: RegExp; + let BRACKET_PARENS: RegExp; +} +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-sel3.d.ts b/node_modules/doiuse/types/data/features/css-sel3.d.ts new file mode 100644 index 00000000..cfd74e8d --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-sel3.d.ts @@ -0,0 +1,8 @@ +export namespace REGEXES { + let SIBLING_SELECTOR: RegExp; + let STARTSWITH_ATTRIBUTE: RegExp; + let ENDSWITH_ATTRIBUTE: RegExp; + let INSENSITIVE_ATTRIBUTE: RegExp; +} +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-selection.d.ts b/node_modules/doiuse/types/data/features/css-selection.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-selection.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-shapes.d.ts b/node_modules/doiuse/types/data/features/css-shapes.d.ts new file mode 100644 index 00000000..17233b47 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-shapes.d.ts @@ -0,0 +1,6 @@ +declare const _default: { + 'shape-outside': boolean; + 'shape-image-threshold': boolean; + 'shape-margin': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-snappoints.d.ts b/node_modules/doiuse/types/data/features/css-snappoints.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-snappoints.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-sticky.d.ts b/node_modules/doiuse/types/data/features/css-sticky.d.ts new file mode 100644 index 00000000..48be0197 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-sticky.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let position: string; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-subgrid.d.ts b/node_modules/doiuse/types/data/features/css-subgrid.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-subgrid.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-supports-api.d.ts b/node_modules/doiuse/types/data/features/css-supports-api.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-supports-api.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-table.d.ts b/node_modules/doiuse/types/data/features/css-table.d.ts new file mode 100644 index 00000000..8ee6ac9c --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-table.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let display: string[]; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-text-align-last.d.ts b/node_modules/doiuse/types/data/features/css-text-align-last.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-text-align-last.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-text-box-trim.d.ts b/node_modules/doiuse/types/data/features/css-text-box-trim.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-text-box-trim.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-text-indent.d.ts b/node_modules/doiuse/types/data/features/css-text-indent.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-text-indent.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-text-justify.d.ts b/node_modules/doiuse/types/data/features/css-text-justify.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-text-justify.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-text-orientation.d.ts b/node_modules/doiuse/types/data/features/css-text-orientation.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-text-orientation.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-text-spacing.d.ts b/node_modules/doiuse/types/data/features/css-text-spacing.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-text-spacing.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-textshadow.d.ts b/node_modules/doiuse/types/data/features/css-textshadow.d.ts new file mode 100644 index 00000000..f1647e7c --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-textshadow.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'text-shadow': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-touch-action.d.ts b/node_modules/doiuse/types/data/features/css-touch-action.d.ts new file mode 100644 index 00000000..41e36c8a --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-touch-action.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'touch-action': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-transitions.d.ts b/node_modules/doiuse/types/data/features/css-transitions.d.ts new file mode 100644 index 00000000..b2b373e7 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-transitions.d.ts @@ -0,0 +1,8 @@ +declare const _default: { + transition: boolean; + 'transition-property': boolean; + 'transition-duration': boolean; + 'transition-delay': boolean; + 'transition-timing-function': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-unicode-bidi.d.ts b/node_modules/doiuse/types/data/features/css-unicode-bidi.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-unicode-bidi.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-unset-value.d.ts b/node_modules/doiuse/types/data/features/css-unset-value.d.ts new file mode 100644 index 00000000..e9abdf25 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-unset-value.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-variables.d.ts b/node_modules/doiuse/types/data/features/css-variables.d.ts new file mode 100644 index 00000000..2dbf6838 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-variables.d.ts @@ -0,0 +1,2 @@ +declare function _default(rule: import('postcss').ChildNode): boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-when-else.d.ts b/node_modules/doiuse/types/data/features/css-when-else.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-when-else.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-widows-orphans.d.ts b/node_modules/doiuse/types/data/features/css-widows-orphans.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-widows-orphans.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-width-stretch.d.ts b/node_modules/doiuse/types/data/features/css-width-stretch.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-width-stretch.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-writing-mode.d.ts b/node_modules/doiuse/types/data/features/css-writing-mode.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-writing-mode.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css-zoom.d.ts b/node_modules/doiuse/types/data/features/css-zoom.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css-zoom.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css3-attr.d.ts b/node_modules/doiuse/types/data/features/css3-attr.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/css3-attr.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css3-boxsizing.d.ts b/node_modules/doiuse/types/data/features/css3-boxsizing.d.ts new file mode 100644 index 00000000..2f6e597c --- /dev/null +++ b/node_modules/doiuse/types/data/features/css3-boxsizing.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'box-sizing': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css3-colors.d.ts b/node_modules/doiuse/types/data/features/css3-colors.d.ts new file mode 100644 index 00000000..de2aca6e --- /dev/null +++ b/node_modules/doiuse/types/data/features/css3-colors.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string[]; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/css3-cursors-grab.d.ts b/node_modules/doiuse/types/data/features/css3-cursors-grab.d.ts new file mode 100644 index 00000000..8cea8157 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css3-cursors-grab.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let cursor: string[]; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css3-cursors-newer.d.ts b/node_modules/doiuse/types/data/features/css3-cursors-newer.d.ts new file mode 100644 index 00000000..8cea8157 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css3-cursors-newer.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let cursor: string[]; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css3-cursors.d.ts b/node_modules/doiuse/types/data/features/css3-cursors.d.ts new file mode 100644 index 00000000..8cea8157 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css3-cursors.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let cursor: string[]; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/css3-tabsize.d.ts b/node_modules/doiuse/types/data/features/css3-tabsize.d.ts new file mode 100644 index 00000000..8c68b4f7 --- /dev/null +++ b/node_modules/doiuse/types/data/features/css3-tabsize.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'tab-size': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/currentcolor.d.ts b/node_modules/doiuse/types/data/features/currentcolor.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/currentcolor.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/devicepixelratio.d.ts b/node_modules/doiuse/types/data/features/devicepixelratio.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/devicepixelratio.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/extended-system-fonts.d.ts b/node_modules/doiuse/types/data/features/extended-system-fonts.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/extended-system-fonts.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/flexbox-gap.d.ts b/node_modules/doiuse/types/data/features/flexbox-gap.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/flexbox-gap.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/flexbox.d.ts b/node_modules/doiuse/types/data/features/flexbox.d.ts new file mode 100644 index 00000000..aee7362b --- /dev/null +++ b/node_modules/doiuse/types/data/features/flexbox.d.ts @@ -0,0 +1,11 @@ +declare const _default: { + display: string[]; + flex: boolean; + 'flex-grow': boolean; + 'flex-shrink': boolean; + 'flex-basis': boolean; + 'flex-direction': boolean; + 'flex-wrap': boolean; + 'flex-flow': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/flow-root.d.ts b/node_modules/doiuse/types/data/features/flow-root.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/flow-root.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-family-system-ui.d.ts b/node_modules/doiuse/types/data/features/font-family-system-ui.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-family-system-ui.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-feature.d.ts b/node_modules/doiuse/types/data/features/font-feature.d.ts new file mode 100644 index 00000000..cee8d3b2 --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-feature.d.ts @@ -0,0 +1,7 @@ +declare const _default: { + 'font-feature-settings': boolean; + 'font-variant-ligatures': boolean; + 'font-language-override': boolean; + 'font-kerning': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-kerning.d.ts b/node_modules/doiuse/types/data/features/font-kerning.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-kerning.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-loading.d.ts b/node_modules/doiuse/types/data/features/font-loading.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-loading.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-size-adjust.d.ts b/node_modules/doiuse/types/data/features/font-size-adjust.d.ts new file mode 100644 index 00000000..d271aa3e --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-size-adjust.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'font-size-adjust': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-smooth.d.ts b/node_modules/doiuse/types/data/features/font-smooth.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-smooth.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-unicode-range.d.ts b/node_modules/doiuse/types/data/features/font-unicode-range.d.ts new file mode 100644 index 00000000..b2de26b1 --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-unicode-range.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'unicode-range': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-variant-alternates.d.ts b/node_modules/doiuse/types/data/features/font-variant-alternates.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-variant-alternates.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/font-variant-numeric.d.ts b/node_modules/doiuse/types/data/features/font-variant-numeric.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/font-variant-numeric.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/fontface.d.ts b/node_modules/doiuse/types/data/features/fontface.d.ts new file mode 100644 index 00000000..ead1e0f0 --- /dev/null +++ b/node_modules/doiuse/types/data/features/fontface.d.ts @@ -0,0 +1,2 @@ +declare const _default: ((rule: import("postcss/lib/node.js").ChildNode) => boolean)[]; +export default _default; diff --git a/node_modules/doiuse/types/data/features/fullscreen.d.ts b/node_modules/doiuse/types/data/features/fullscreen.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/fullscreen.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/getcomputedstyle.d.ts b/node_modules/doiuse/types/data/features/getcomputedstyle.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/getcomputedstyle.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/inline-block.d.ts b/node_modules/doiuse/types/data/features/inline-block.d.ts new file mode 100644 index 00000000..076ffde4 --- /dev/null +++ b/node_modules/doiuse/types/data/features/inline-block.d.ts @@ -0,0 +1,4 @@ +declare namespace _default { + let display: string; +} +export default _default; diff --git a/node_modules/doiuse/types/data/features/intrinsic-width.d.ts b/node_modules/doiuse/types/data/features/intrinsic-width.d.ts new file mode 100644 index 00000000..a19e9901 --- /dev/null +++ b/node_modules/doiuse/types/data/features/intrinsic-width.d.ts @@ -0,0 +1,9 @@ +declare const _default: { + width: string[]; + 'min-width': string[]; + 'max-width': string[]; + height: string[]; + 'min-height': string[]; + 'max-height': string[]; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/justify-content-space-evenly.d.ts b/node_modules/doiuse/types/data/features/justify-content-space-evenly.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/justify-content-space-evenly.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/kerning-pairs-ligatures.d.ts b/node_modules/doiuse/types/data/features/kerning-pairs-ligatures.d.ts new file mode 100644 index 00000000..8ef9c98d --- /dev/null +++ b/node_modules/doiuse/types/data/features/kerning-pairs-ligatures.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'text-rendering': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-isolate-override.d.ts b/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-isolate-override.d.ts new file mode 100644 index 00000000..63183b7c --- /dev/null +++ b/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-isolate-override.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'unicode-bidi': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-isolate.d.ts b/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-isolate.d.ts new file mode 100644 index 00000000..63183b7c --- /dev/null +++ b/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-isolate.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'unicode-bidi': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-plaintext.d.ts b/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-plaintext.d.ts new file mode 100644 index 00000000..63183b7c --- /dev/null +++ b/node_modules/doiuse/types/data/features/mdn-css-unicode-bidi-plaintext.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'unicode-bidi': string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/mdn-text-decoration-color.d.ts b/node_modules/doiuse/types/data/features/mdn-text-decoration-color.d.ts new file mode 100644 index 00000000..b795d459 --- /dev/null +++ b/node_modules/doiuse/types/data/features/mdn-text-decoration-color.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'text-decoration-color': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/mdn-text-decoration-line.d.ts b/node_modules/doiuse/types/data/features/mdn-text-decoration-line.d.ts new file mode 100644 index 00000000..69fd574c --- /dev/null +++ b/node_modules/doiuse/types/data/features/mdn-text-decoration-line.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'text-decoration-line': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/mdn-text-decoration-shorthand.d.ts b/node_modules/doiuse/types/data/features/mdn-text-decoration-shorthand.d.ts new file mode 100644 index 00000000..a2ccf44f --- /dev/null +++ b/node_modules/doiuse/types/data/features/mdn-text-decoration-shorthand.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'text-decoration': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/mdn-text-decoration-style.d.ts b/node_modules/doiuse/types/data/features/mdn-text-decoration-style.d.ts new file mode 100644 index 00000000..f715fd10 --- /dev/null +++ b/node_modules/doiuse/types/data/features/mdn-text-decoration-style.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'text-decoration-style': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/minmaxwh.d.ts b/node_modules/doiuse/types/data/features/minmaxwh.d.ts new file mode 100644 index 00000000..758cc182 --- /dev/null +++ b/node_modules/doiuse/types/data/features/minmaxwh.d.ts @@ -0,0 +1,7 @@ +declare const _default: { + 'min-width': boolean; + 'max-width': boolean; + 'min-height': boolean; + 'max-height': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/multibackgrounds.d.ts b/node_modules/doiuse/types/data/features/multibackgrounds.d.ts new file mode 100644 index 00000000..2dbf6838 --- /dev/null +++ b/node_modules/doiuse/types/data/features/multibackgrounds.d.ts @@ -0,0 +1,2 @@ +declare function _default(rule: import('postcss').ChildNode): boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/multicolumn.d.ts b/node_modules/doiuse/types/data/features/multicolumn.d.ts new file mode 100644 index 00000000..97aca34e --- /dev/null +++ b/node_modules/doiuse/types/data/features/multicolumn.d.ts @@ -0,0 +1,16 @@ +declare const _default: { + columns: boolean; + 'column-width': boolean; + 'column-gap': boolean; + 'column-rule': boolean; + 'column-rule-color': boolean; + 'column-rule-width': boolean; + 'column-count': boolean; + 'column-rule-style': boolean; + 'column-span': boolean; + 'column-fill': boolean; + 'break-before': boolean; + 'break-after': boolean; + 'break-inside': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/object-fit.d.ts b/node_modules/doiuse/types/data/features/object-fit.d.ts new file mode 100644 index 00000000..54045cea --- /dev/null +++ b/node_modules/doiuse/types/data/features/object-fit.d.ts @@ -0,0 +1,5 @@ +declare const _default: { + 'object-fit': boolean; + 'object-position': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/outline.d.ts b/node_modules/doiuse/types/data/features/outline.d.ts new file mode 100644 index 00000000..58053da8 --- /dev/null +++ b/node_modules/doiuse/types/data/features/outline.d.ts @@ -0,0 +1,7 @@ +declare const _default: { + outline: boolean; + 'outline-style': boolean; + 'outline-width': boolean; + 'outline-color': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/pointer-events.d.ts b/node_modules/doiuse/types/data/features/pointer-events.d.ts new file mode 100644 index 00000000..f8fecaf9 --- /dev/null +++ b/node_modules/doiuse/types/data/features/pointer-events.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'pointer-events': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/pointer.d.ts b/node_modules/doiuse/types/data/features/pointer.d.ts new file mode 100644 index 00000000..41e36c8a --- /dev/null +++ b/node_modules/doiuse/types/data/features/pointer.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'touch-action': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/prefers-color-scheme.d.ts b/node_modules/doiuse/types/data/features/prefers-color-scheme.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/prefers-color-scheme.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/prefers-reduced-motion.d.ts b/node_modules/doiuse/types/data/features/prefers-reduced-motion.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/prefers-reduced-motion.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/rem.d.ts b/node_modules/doiuse/types/data/features/rem.d.ts new file mode 100644 index 00000000..5f226387 --- /dev/null +++ b/node_modules/doiuse/types/data/features/rem.d.ts @@ -0,0 +1,2 @@ +declare const _default: (rule: import("postcss/lib/node.js").ChildNode) => boolean; +export default _default; diff --git a/node_modules/doiuse/types/data/features/run-in.d.ts b/node_modules/doiuse/types/data/features/run-in.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/run-in.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/style-scoped.d.ts b/node_modules/doiuse/types/data/features/style-scoped.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/style-scoped.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/svg-css.d.ts b/node_modules/doiuse/types/data/features/svg-css.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/svg-css.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/text-decoration.d.ts b/node_modules/doiuse/types/data/features/text-decoration.d.ts new file mode 100644 index 00000000..9f64bd04 --- /dev/null +++ b/node_modules/doiuse/types/data/features/text-decoration.d.ts @@ -0,0 +1,10 @@ +declare const _default: { + 'text-decoration-style': boolean; + 'text-decoration-line': boolean; + 'text-decoration-color': boolean; + 'text-decoration': RegExp; + 'text-decoration-thickness': boolean; + 'text-decoration-skip': boolean; + 'text-decoration-skip-ink': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/text-emphasis.d.ts b/node_modules/doiuse/types/data/features/text-emphasis.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/text-emphasis.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/text-overflow.d.ts b/node_modules/doiuse/types/data/features/text-overflow.d.ts new file mode 100644 index 00000000..3d129e43 --- /dev/null +++ b/node_modules/doiuse/types/data/features/text-overflow.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'text-overflow': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/text-size-adjust.d.ts b/node_modules/doiuse/types/data/features/text-size-adjust.d.ts new file mode 100644 index 00000000..51ca2e87 --- /dev/null +++ b/node_modules/doiuse/types/data/features/text-size-adjust.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'text-size-adjust': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/text-stroke.d.ts b/node_modules/doiuse/types/data/features/text-stroke.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/text-stroke.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/transforms2d.d.ts b/node_modules/doiuse/types/data/features/transforms2d.d.ts new file mode 100644 index 00000000..f870ccec --- /dev/null +++ b/node_modules/doiuse/types/data/features/transforms2d.d.ts @@ -0,0 +1,5 @@ +declare const _default: { + transform: boolean; + 'transform-origin': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/transforms3d.d.ts b/node_modules/doiuse/types/data/features/transforms3d.d.ts new file mode 100644 index 00000000..31f3a085 --- /dev/null +++ b/node_modules/doiuse/types/data/features/transforms3d.d.ts @@ -0,0 +1,8 @@ +declare const _default: { + perspective: boolean; + 'perspective-origin': boolean; + 'transform-style': boolean; + 'backface-visibility': boolean; + transform: string; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/ttf.d.ts b/node_modules/doiuse/types/data/features/ttf.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/ttf.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/user-select-none.d.ts b/node_modules/doiuse/types/data/features/user-select-none.d.ts new file mode 100644 index 00000000..bf7305af --- /dev/null +++ b/node_modules/doiuse/types/data/features/user-select-none.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'user-select': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/variable-fonts.d.ts b/node_modules/doiuse/types/data/features/variable-fonts.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/variable-fonts.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/viewport-unit-variants.d.ts b/node_modules/doiuse/types/data/features/viewport-unit-variants.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/viewport-unit-variants.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/viewport-units.d.ts b/node_modules/doiuse/types/data/features/viewport-units.d.ts new file mode 100644 index 00000000..de2aca6e --- /dev/null +++ b/node_modules/doiuse/types/data/features/viewport-units.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + '': string[]; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/webkit-user-drag.d.ts b/node_modules/doiuse/types/data/features/webkit-user-drag.d.ts new file mode 100644 index 00000000..ba3f665f --- /dev/null +++ b/node_modules/doiuse/types/data/features/webkit-user-drag.d.ts @@ -0,0 +1,2 @@ +declare const _default: import('../features').Feature; +export default _default; diff --git a/node_modules/doiuse/types/data/features/will-change.d.ts b/node_modules/doiuse/types/data/features/will-change.d.ts new file mode 100644 index 00000000..7e1c986d --- /dev/null +++ b/node_modules/doiuse/types/data/features/will-change.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'will-change': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/word-break.d.ts b/node_modules/doiuse/types/data/features/word-break.d.ts new file mode 100644 index 00000000..5163a5e3 --- /dev/null +++ b/node_modules/doiuse/types/data/features/word-break.d.ts @@ -0,0 +1,4 @@ +declare const _default: { + 'word-break': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/data/features/wordwrap.d.ts b/node_modules/doiuse/types/data/features/wordwrap.d.ts new file mode 100644 index 00000000..e34cb3cc --- /dev/null +++ b/node_modules/doiuse/types/data/features/wordwrap.d.ts @@ -0,0 +1,5 @@ +declare const _default: { + 'overflow-wrap': boolean; + 'word-wrap': boolean; +}; +export default _default; diff --git a/node_modules/doiuse/types/exports/index.d.ts b/node_modules/doiuse/types/exports/index.d.ts new file mode 100644 index 00000000..33d2d468 --- /dev/null +++ b/node_modules/doiuse/types/exports/index.d.ts @@ -0,0 +1,6 @@ +/** + * @param {ConstructorParameters<typeof DoIUse>} options + * @return {DoIUse} + */ +export default function index(optionsOrBrowserQuery?: import("../lib/DoIUse.js").DoIUseOptions): DoIUse; +import DoIUse from '../lib/DoIUse.js'; diff --git a/node_modules/doiuse/types/exports/stream.d.ts b/node_modules/doiuse/types/exports/stream.d.ts new file mode 100644 index 00000000..acaa62d8 --- /dev/null +++ b/node_modules/doiuse/types/exports/stream.d.ts @@ -0,0 +1,10 @@ +/** + * @param {ConstructorParameters<typeof CssUsageDuplex>} options + * @return {CssUsageDuplex} + */ +export default function index(options: { + browsers: string; + ignore?: ("outline" | "background-attachment" | "pointer" | "flow-root" | "font-kerning" | "font-smooth" | "font-variant-alternates" | "font-variant-numeric" | "inline-block" | "prefers-color-scheme" | "prefers-reduced-motion" | "rem" | "run-in" | "text-emphasis" | "text-stroke" | "webkit-user-drag" | "border-image" | "border-radius" | "font-size-adjust" | "text-decoration" | "object-fit" | "pointer-events" | "text-overflow" | "text-size-adjust" | "will-change" | "word-break" | "alternate-stylesheet" | "background-clip-text" | "background-img-opts" | "background-position-x-y" | "background-repeat-round-space" | "calc" | "ch-unit" | "css-all" | "css-animation" | "css-any-link" | "css-appearance" | "css-at-counter-style" | "css-autofill" | "css-backdrop-filter" | "css-background-offsets" | "css-backgroundblendmode" | "css-boxdecorationbreak" | "css-boxshadow" | "css-canvas" | "css-caret-color" | "css-cascade-layers" | "css-case-insensitive" | "css-clip-path" | "css-color-adjust" | "css-color-function" | "css-conic-gradients" | "css-container-queries" | "css-container-queries-style" | "css-container-query-units" | "css-containment" | "css-content-visibility" | "css-counters" | "css-crisp-edges" | "css-cross-fade" | "css-default-pseudo" | "css-descendant-gtgt" | "css-deviceadaptation" | "css-dir-pseudo" | "css-display-contents" | "css-element-function" | "css-env-function" | "css-exclusions" | "css-featurequeries" | "css-file-selector-button" | "css-filter-function" | "css-filters" | "css-first-letter" | "css-first-line" | "css-fixed" | "css-focus-visible" | "css-focus-within" | "css-font-palette" | "css-font-rendering-controls" | "css-font-stretch" | "css-gencontent" | "css-gradients" | "css-grid" | "css-grid-animation" | "css-hanging-punctuation" | "css-has" | "css-hyphens" | "css-image-orientation" | "css-image-set" | "css-in-out-of-range" | "css-indeterminate-pseudo" | "css-initial-letter" | "css-initial-value" | "css-lch-lab" | "css-letter-spacing" | "css-line-clamp" | "css-logical-props" | "css-marker-pseudo" | "css-masks" | "css-matches-pseudo" | "css-math-functions" | "css-media-interaction" | "css-media-range-syntax" | "css-media-resolution" | "css-media-scripting" | "css-mediaqueries" | "css-mixblendmode" | "css-motion-paths" | "css-namespaces" | "css-nesting" | "css-not-sel-list" | "css-nth-child-of" | "css-opacity" | "css-optional-pseudo" | "css-overflow" | "css-overflow-anchor" | "css-overflow-overlay" | "css-overscroll-behavior" | "css-page-break" | "css-paged-media" | "css-paint-api" | "css-placeholder" | "css-placeholder-shown" | "css-print-color-adjust" | "css-read-only-write" | "css-rebeccapurple" | "css-reflections" | "css-regions" | "css-relative-colors" | "css-repeating-gradients" | "css-resize" | "css-revert-value" | "css-rrggbbaa" | "css-scroll-behavior" | "css-scroll-timeline" | "css-scrollbar" | "css-sel2" | "css-sel3" | "css-selection" | "css-shapes" | "css-snappoints" | "css-sticky" | "css-subgrid" | "css-supports-api" | "css-table" | "css-text-align-last" | "css-text-box-trim" | "css-text-indent" | "css-text-justify" | "css-text-orientation" | "css-text-spacing" | "css-textshadow" | "css-touch-action" | "css-transitions" | "css-unicode-bidi" | "css-unset-value" | "css-variables" | "css-when-else" | "css-widows-orphans" | "css-width-stretch" | "css-writing-mode" | "css-zoom" | "css3-attr" | "css3-boxsizing" | "css3-colors" | "css3-cursors" | "css3-cursors-grab" | "css3-cursors-newer" | "css3-tabsize" | "currentcolor" | "devicepixelratio" | "extended-system-fonts" | "flexbox" | "flexbox-gap" | "font-family-system-ui" | "font-feature" | "font-loading" | "font-unicode-range" | "fontface" | "fullscreen" | "getcomputedstyle" | "intrinsic-width" | "justify-content-space-evenly" | "kerning-pairs-ligatures" | "mdn-css-unicode-bidi-isolate" | "mdn-css-unicode-bidi-isolate-override" | "mdn-css-unicode-bidi-plaintext" | "mdn-text-decoration-color" | "mdn-text-decoration-line" | "mdn-text-decoration-shorthand" | "mdn-text-decoration-style" | "minmaxwh" | "multibackgrounds" | "multicolumn" | "style-scoped" | "svg-css" | "transforms2d" | "transforms3d" | "ttf" | "user-select-none" | "variable-fonts" | "viewport-unit-variants" | "viewport-units" | "wordwrap")[]; + skipErrors?: boolean; +}, filename?: string): CssUsageDuplex; +import CssUsageDuplex from '../lib/stream/CssUsageDuplex.js'; diff --git a/node_modules/doiuse/types/lib/BrowserSelection.d.ts b/node_modules/doiuse/types/lib/BrowserSelection.d.ts new file mode 100644 index 00000000..26b71cc0 --- /dev/null +++ b/node_modules/doiuse/types/lib/BrowserSelection.d.ts @@ -0,0 +1,511 @@ +/** + * @template T + * @typedef {{missing: T, partial: T}} Filter + */ +/** + * @typedef {Object} MissingSupportResultStats + * @prop {string} title + * @prop {caniuse.Feature} caniuseData + * @prop {string} [missing] + * @prop {Record<string, Record<string, string>>} [missingData] + * @prop {string} [partial] + * @prop {Record<string, Record<string, string>>} [partialData] + */ +/** + * @typedef {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} BrowserSupportStats + */ +/** + * @typedef {Object} MissingSupportResult + * @prop {string[][]} browsers + * @prop {Partial<Record<keyof FEATURES, MissingSupportResultStats>>} features + */ +export default class BrowserSelection { + /** + * @param {Record<string, Record<string, string>>} browserStats + * @return {string} + */ + static lackingBrowsers(browserStats: Record<string, Record<string, string>>): string; + /** + * @see BrowserSelection.compileBrowserSupport + * @param {ConstructorParameters<typeof this>} constructorParameters + * @return {MissingSupportResult} `{browsers, features}` + */ + static missingSupport(query?: string | string[], from?: string | false): MissingSupportResult; + /** + * @param {string | string[]} [query] + * @param {string | false} [from] + */ + constructor(query?: string | string[], from?: string | false); + browsersRequest: string | string[]; + /** + * @param {string} browser + * @param {string} version + * @return {string[]|undefined} + */ + test(browser: string, version: string): string[] | undefined; + list(): string[][]; + /** + * @param {import('caniuse-lite').StatsByAgentID} stats + * @return {Filter<Record<string,Record<string, string>>>} + */ + filterStats(stats: import('caniuse-lite').StatsByAgentID): Filter<Record<string, Record<string, string>>>; + /** + * Get data on CSS features not supported by the given autoprefixer-like + * browser selection. + * @return {BrowserSupportStats} `features` is an array of: + * ``` + * { + * 'feature-name': { + * title: 'Title of feature' + * missing: "IE (8), Chrome (31)" + * missingData: { + * // map of browser -> version -> (lack of)support code + * ie: { '8': 'n' }, + * chrome: { '31': 'n' } + * } + * partialData: { + * // map of browser -> version -> (partial)support code + * ie: { '7': 'a' }, + * ff: { '29': 'a #1' } + * } + * caniuseData: { + * // caniuse-db json data for this feature + * } + * }, + * 'feature-name-2': {} // etc. + * } + * ``` + * + * `feature-name` is a caniuse-db slug. + */ + compileBrowserSupport(): BrowserSupportStats; + #private; +} +export type Filter<T> = { + missing: T; + partial: T; +}; +export type MissingSupportResultStats = { + title: string; + caniuseData: caniuse.Feature; + missing?: string; + missingData?: Record<string, Record<string, string>>; + partial?: string; + partialData?: Record<string, Record<string, string>>; +}; +export type BrowserSupportStats = Partial<Record<keyof { + outline: import("../data/features.js").Feature; + "background-attachment": import("../data/features.js").Feature; + pointer: import("../data/features.js").Feature; + "flow-root": import("../data/features.js").Feature; + "font-kerning": import("../data/features.js").Feature; + "font-smooth": import("../data/features.js").Feature; + "font-variant-alternates": import("../data/features.js").Feature; + "font-variant-numeric": import("../data/features.js").Feature; + "inline-block": import("../data/features.js").Feature; + "prefers-color-scheme": import("../data/features.js").Feature; + "prefers-reduced-motion": import("../data/features.js").Feature; + rem: import("../data/features.js").Feature; + "run-in": import("../data/features.js").Feature; + "text-emphasis": import("../data/features.js").Feature; + "text-stroke": import("../data/features.js").Feature; + "webkit-user-drag": import("../data/features.js").Feature; + "border-image": import("../data/features.js").Feature; + "border-radius": import("../data/features.js").Feature; + "font-size-adjust": import("../data/features.js").Feature; + "text-decoration": import("../data/features.js").Feature; + "object-fit": import("../data/features.js").Feature; + "pointer-events": import("../data/features.js").Feature; + "text-overflow": import("../data/features.js").Feature; + "text-size-adjust": import("../data/features.js").Feature; + "will-change": import("../data/features.js").Feature; + "word-break": import("../data/features.js").Feature; + "alternate-stylesheet": import("../data/features.js").Feature; + "background-clip-text": import("../data/features.js").Feature; + "background-img-opts": import("../data/features.js").Feature; + "background-position-x-y": import("../data/features.js").Feature; + "background-repeat-round-space": import("../data/features.js").Feature; + calc: import("../data/features.js").Feature; + "ch-unit": import("../data/features.js").Feature; + "css-all": import("../data/features.js").Feature; + "css-animation": import("../data/features.js").Feature; + "css-any-link": import("../data/features.js").Feature; + "css-appearance": import("../data/features.js").Feature; + "css-at-counter-style": import("../data/features.js").Feature; + "css-autofill": import("../data/features.js").Feature; + "css-backdrop-filter": import("../data/features.js").Feature; + "css-background-offsets": import("../data/features.js").Feature; + "css-backgroundblendmode": import("../data/features.js").Feature; + "css-boxdecorationbreak": import("../data/features.js").Feature; + "css-boxshadow": import("../data/features.js").Feature; + "css-canvas": import("../data/features.js").Feature; + "css-caret-color": import("../data/features.js").Feature; + "css-cascade-layers": import("../data/features.js").Feature; + "css-case-insensitive": import("../data/features.js").Feature; + "css-clip-path": import("../data/features.js").Feature; + "css-color-adjust": import("../data/features.js").Feature; + "css-color-function": import("../data/features.js").Feature; + "css-conic-gradients": import("../data/features.js").Feature; + "css-container-queries": import("../data/features.js").Feature; + "css-container-queries-style": import("../data/features.js").Feature; + "css-container-query-units": import("../data/features.js").Feature; + "css-containment": import("../data/features.js").Feature; + "css-content-visibility": import("../data/features.js").Feature; + "css-counters": import("../data/features.js").Feature; + "css-crisp-edges": import("../data/features.js").Feature; + "css-cross-fade": import("../data/features.js").Feature; + "css-default-pseudo": import("../data/features.js").Feature; + "css-descendant-gtgt": import("../data/features.js").Feature; + "css-deviceadaptation": import("../data/features.js").Feature; + "css-dir-pseudo": import("../data/features.js").Feature; + "css-display-contents": import("../data/features.js").Feature; + "css-element-function": import("../data/features.js").Feature; + "css-env-function": import("../data/features.js").Feature; + "css-exclusions": import("../data/features.js").Feature; + "css-featurequeries": import("../data/features.js").Feature; + "css-file-selector-button": import("../data/features.js").Feature; + "css-filter-function": import("../data/features.js").Feature; + "css-filters": import("../data/features.js").Feature; + "css-first-letter": import("../data/features.js").Feature; + "css-first-line": import("../data/features.js").Feature; + "css-fixed": import("../data/features.js").Feature; + "css-focus-visible": import("../data/features.js").Feature; + "css-focus-within": import("../data/features.js").Feature; + "css-font-palette": import("../data/features.js").Feature; + "css-font-rendering-controls": import("../data/features.js").Feature; + "css-font-stretch": import("../data/features.js").Feature; + "css-gencontent": import("../data/features.js").Feature; + "css-gradients": import("../data/features.js").Feature; + "css-grid": import("../data/features.js").Feature; + "css-grid-animation": import("../data/features.js").Feature; + "css-hanging-punctuation": import("../data/features.js").Feature; + "css-has": import("../data/features.js").Feature; + "css-hyphens": import("../data/features.js").Feature; + "css-image-orientation": import("../data/features.js").Feature; + "css-image-set": import("../data/features.js").Feature; + "css-in-out-of-range": import("../data/features.js").Feature; + "css-indeterminate-pseudo": import("../data/features.js").Feature; + "css-initial-letter": import("../data/features.js").Feature; + "css-initial-value": import("../data/features.js").Feature; + "css-lch-lab": import("../data/features.js").Feature; + "css-letter-spacing": import("../data/features.js").Feature; + "css-line-clamp": import("../data/features.js").Feature; + "css-logical-props": import("../data/features.js").Feature; + "css-marker-pseudo": import("../data/features.js").Feature; + "css-masks": import("../data/features.js").Feature; + "css-matches-pseudo": import("../data/features.js").Feature; + "css-math-functions": import("../data/features.js").Feature; + "css-media-interaction": import("../data/features.js").Feature; + "css-media-range-syntax": import("../data/features.js").Feature; + "css-media-resolution": import("../data/features.js").Feature; + "css-media-scripting": import("../data/features.js").Feature; + "css-mediaqueries": import("../data/features.js").Feature; + "css-mixblendmode": import("../data/features.js").Feature; + "css-motion-paths": import("../data/features.js").Feature; + "css-namespaces": import("../data/features.js").Feature; + "css-nesting": import("../data/features.js").Feature; + "css-not-sel-list": import("../data/features.js").Feature; + "css-nth-child-of": import("../data/features.js").Feature; + "css-opacity": import("../data/features.js").Feature; + "css-optional-pseudo": import("../data/features.js").Feature; + "css-overflow": import("../data/features.js").Feature; + "css-overflow-anchor": import("../data/features.js").Feature; + "css-overflow-overlay": import("../data/features.js").Feature; + "css-overscroll-behavior": import("../data/features.js").Feature; + "css-page-break": import("../data/features.js").Feature; + "css-paged-media": import("../data/features.js").Feature; + "css-paint-api": import("../data/features.js").Feature; + "css-placeholder": import("../data/features.js").Feature; + "css-placeholder-shown": import("../data/features.js").Feature; + "css-print-color-adjust": import("../data/features.js").Feature; + "css-read-only-write": import("../data/features.js").Feature; + "css-rebeccapurple": import("../data/features.js").Feature; + "css-reflections": import("../data/features.js").Feature; + "css-regions": import("../data/features.js").Feature; + "css-relative-colors": import("../data/features.js").Feature; + "css-repeating-gradients": import("../data/features.js").Feature; + "css-resize": import("../data/features.js").Feature; + "css-revert-value": import("../data/features.js").Feature; + "css-rrggbbaa": import("../data/features.js").Feature; + "css-scroll-behavior": import("../data/features.js").Feature; + "css-scroll-timeline": import("../data/features.js").Feature; + "css-scrollbar": import("../data/features.js").Feature; + "css-sel2": import("../data/features.js").Feature; + "css-sel3": import("../data/features.js").Feature; + "css-selection": import("../data/features.js").Feature; + "css-shapes": import("../data/features.js").Feature; + "css-snappoints": import("../data/features.js").Feature; + "css-sticky": import("../data/features.js").Feature; + "css-subgrid": import("../data/features.js").Feature; + "css-supports-api": import("../data/features.js").Feature; + "css-table": import("../data/features.js").Feature; + "css-text-align-last": import("../data/features.js").Feature; + "css-text-box-trim": import("../data/features.js").Feature; + "css-text-indent": import("../data/features.js").Feature; + "css-text-justify": import("../data/features.js").Feature; + "css-text-orientation": import("../data/features.js").Feature; + "css-text-spacing": import("../data/features.js").Feature; + "css-textshadow": import("../data/features.js").Feature; + "css-touch-action": import("../data/features.js").Feature; + "css-transitions": import("../data/features.js").Feature; + "css-unicode-bidi": import("../data/features.js").Feature; + "css-unset-value": import("../data/features.js").Feature; + "css-variables": import("../data/features.js").Feature; + "css-when-else": import("../data/features.js").Feature; + "css-widows-orphans": import("../data/features.js").Feature; + "css-width-stretch": import("../data/features.js").Feature; + "css-writing-mode": import("../data/features.js").Feature; + "css-zoom": import("../data/features.js").Feature; + "css3-attr": import("../data/features.js").Feature; + "css3-boxsizing": import("../data/features.js").Feature; + "css3-colors": import("../data/features.js").Feature; + "css3-cursors": import("../data/features.js").Feature; + "css3-cursors-grab": import("../data/features.js").Feature; + "css3-cursors-newer": import("../data/features.js").Feature; + "css3-tabsize": import("../data/features.js").Feature; + currentcolor: import("../data/features.js").Feature; + devicepixelratio: import("../data/features.js").Feature; + "extended-system-fonts": import("../data/features.js").Feature; + flexbox: import("../data/features.js").Feature; + "flexbox-gap": import("../data/features.js").Feature; + "font-family-system-ui": import("../data/features.js").Feature; + "font-feature": import("../data/features.js").Feature; + "font-loading": import("../data/features.js").Feature; + "font-unicode-range": import("../data/features.js").Feature; + fontface: import("../data/features.js").Feature; + fullscreen: import("../data/features.js").Feature; + getcomputedstyle: import("../data/features.js").Feature; + "intrinsic-width": import("../data/features.js").Feature; + "justify-content-space-evenly": import("../data/features.js").Feature; + "kerning-pairs-ligatures": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate-override": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-plaintext": import("../data/features.js").Feature; + "mdn-text-decoration-color": import("../data/features.js").Feature; + "mdn-text-decoration-line": import("../data/features.js").Feature; + "mdn-text-decoration-shorthand": import("../data/features.js").Feature; + "mdn-text-decoration-style": import("../data/features.js").Feature; + minmaxwh: import("../data/features.js").Feature; + multibackgrounds: import("../data/features.js").Feature; + multicolumn: import("../data/features.js").Feature; + "style-scoped": import("../data/features.js").Feature; + "svg-css": import("../data/features.js").Feature; + transforms2d: import("../data/features.js").Feature; + transforms3d: import("../data/features.js").Feature; + ttf: import("../data/features.js").Feature; + "user-select-none": import("../data/features.js").Feature; + "variable-fonts": import("../data/features.js").Feature; + "viewport-unit-variants": import("../data/features.js").Feature; + "viewport-units": import("../data/features.js").Feature; + wordwrap: import("../data/features.js").Feature; +}, MissingSupportResultStats>>; +export type MissingSupportResult = { + browsers: string[][]; + features: Partial<Record<keyof { + outline: import("../data/features.js").Feature; + "background-attachment": import("../data/features.js").Feature; + pointer: import("../data/features.js").Feature; + "flow-root": import("../data/features.js").Feature; + "font-kerning": import("../data/features.js").Feature; + "font-smooth": import("../data/features.js").Feature; + "font-variant-alternates": import("../data/features.js").Feature; + "font-variant-numeric": import("../data/features.js").Feature; + "inline-block": import("../data/features.js").Feature; + "prefers-color-scheme": import("../data/features.js").Feature; + "prefers-reduced-motion": import("../data/features.js").Feature; + rem: import("../data/features.js").Feature; + "run-in": import("../data/features.js").Feature; + "text-emphasis": import("../data/features.js").Feature; + "text-stroke": import("../data/features.js").Feature; + "webkit-user-drag": import("../data/features.js").Feature; + "border-image": import("../data/features.js").Feature; + "border-radius": import("../data/features.js").Feature; + "font-size-adjust": import("../data/features.js").Feature; + "text-decoration": import("../data/features.js").Feature; + "object-fit": import("../data/features.js").Feature; + "pointer-events": import("../data/features.js").Feature; + "text-overflow": import("../data/features.js").Feature; + "text-size-adjust": import("../data/features.js").Feature; + "will-change": import("../data/features.js").Feature; + "word-break": import("../data/features.js").Feature; + "alternate-stylesheet": import("../data/features.js").Feature; + "background-clip-text": import("../data/features.js").Feature; + "background-img-opts": import("../data/features.js").Feature; + "background-position-x-y": import("../data/features.js").Feature; + "background-repeat-round-space": import("../data/features.js").Feature; + calc: import("../data/features.js").Feature; + "ch-unit": import("../data/features.js").Feature; + "css-all": import("../data/features.js").Feature; + "css-animation": import("../data/features.js").Feature; + "css-any-link": import("../data/features.js").Feature; + "css-appearance": import("../data/features.js").Feature; + "css-at-counter-style": import("../data/features.js").Feature; + "css-autofill": import("../data/features.js").Feature; + "css-backdrop-filter": import("../data/features.js").Feature; + "css-background-offsets": import("../data/features.js").Feature; + "css-backgroundblendmode": import("../data/features.js").Feature; + "css-boxdecorationbreak": import("../data/features.js").Feature; + "css-boxshadow": import("../data/features.js").Feature; + "css-canvas": import("../data/features.js").Feature; + "css-caret-color": import("../data/features.js").Feature; + "css-cascade-layers": import("../data/features.js").Feature; + "css-case-insensitive": import("../data/features.js").Feature; + "css-clip-path": import("../data/features.js").Feature; + "css-color-adjust": import("../data/features.js").Feature; + "css-color-function": import("../data/features.js").Feature; + "css-conic-gradients": import("../data/features.js").Feature; + "css-container-queries": import("../data/features.js").Feature; + "css-container-queries-style": import("../data/features.js").Feature; + "css-container-query-units": import("../data/features.js").Feature; + "css-containment": import("../data/features.js").Feature; + "css-content-visibility": import("../data/features.js").Feature; + "css-counters": import("../data/features.js").Feature; + "css-crisp-edges": import("../data/features.js").Feature; + "css-cross-fade": import("../data/features.js").Feature; + "css-default-pseudo": import("../data/features.js").Feature; + "css-descendant-gtgt": import("../data/features.js").Feature; + "css-deviceadaptation": import("../data/features.js").Feature; + "css-dir-pseudo": import("../data/features.js").Feature; + "css-display-contents": import("../data/features.js").Feature; + "css-element-function": import("../data/features.js").Feature; + "css-env-function": import("../data/features.js").Feature; + "css-exclusions": import("../data/features.js").Feature; + "css-featurequeries": import("../data/features.js").Feature; + "css-file-selector-button": import("../data/features.js").Feature; + "css-filter-function": import("../data/features.js").Feature; + "css-filters": import("../data/features.js").Feature; + "css-first-letter": import("../data/features.js").Feature; + "css-first-line": import("../data/features.js").Feature; + "css-fixed": import("../data/features.js").Feature; + "css-focus-visible": import("../data/features.js").Feature; + "css-focus-within": import("../data/features.js").Feature; + "css-font-palette": import("../data/features.js").Feature; + "css-font-rendering-controls": import("../data/features.js").Feature; + "css-font-stretch": import("../data/features.js").Feature; + "css-gencontent": import("../data/features.js").Feature; + "css-gradients": import("../data/features.js").Feature; + "css-grid": import("../data/features.js").Feature; + "css-grid-animation": import("../data/features.js").Feature; + "css-hanging-punctuation": import("../data/features.js").Feature; + "css-has": import("../data/features.js").Feature; + "css-hyphens": import("../data/features.js").Feature; + "css-image-orientation": import("../data/features.js").Feature; + "css-image-set": import("../data/features.js").Feature; + "css-in-out-of-range": import("../data/features.js").Feature; + "css-indeterminate-pseudo": import("../data/features.js").Feature; + "css-initial-letter": import("../data/features.js").Feature; + "css-initial-value": import("../data/features.js").Feature; + "css-lch-lab": import("../data/features.js").Feature; + "css-letter-spacing": import("../data/features.js").Feature; + "css-line-clamp": import("../data/features.js").Feature; + "css-logical-props": import("../data/features.js").Feature; + "css-marker-pseudo": import("../data/features.js").Feature; + "css-masks": import("../data/features.js").Feature; + "css-matches-pseudo": import("../data/features.js").Feature; + "css-math-functions": import("../data/features.js").Feature; + "css-media-interaction": import("../data/features.js").Feature; + "css-media-range-syntax": import("../data/features.js").Feature; + "css-media-resolution": import("../data/features.js").Feature; + "css-media-scripting": import("../data/features.js").Feature; + "css-mediaqueries": import("../data/features.js").Feature; + "css-mixblendmode": import("../data/features.js").Feature; + "css-motion-paths": import("../data/features.js").Feature; + "css-namespaces": import("../data/features.js").Feature; + "css-nesting": import("../data/features.js").Feature; + "css-not-sel-list": import("../data/features.js").Feature; + "css-nth-child-of": import("../data/features.js").Feature; + "css-opacity": import("../data/features.js").Feature; + "css-optional-pseudo": import("../data/features.js").Feature; + "css-overflow": import("../data/features.js").Feature; + "css-overflow-anchor": import("../data/features.js").Feature; + "css-overflow-overlay": import("../data/features.js").Feature; + "css-overscroll-behavior": import("../data/features.js").Feature; + "css-page-break": import("../data/features.js").Feature; + "css-paged-media": import("../data/features.js").Feature; + "css-paint-api": import("../data/features.js").Feature; + "css-placeholder": import("../data/features.js").Feature; + "css-placeholder-shown": import("../data/features.js").Feature; + "css-print-color-adjust": import("../data/features.js").Feature; + "css-read-only-write": import("../data/features.js").Feature; + "css-rebeccapurple": import("../data/features.js").Feature; + "css-reflections": import("../data/features.js").Feature; + "css-regions": import("../data/features.js").Feature; + "css-relative-colors": import("../data/features.js").Feature; + "css-repeating-gradients": import("../data/features.js").Feature; + "css-resize": import("../data/features.js").Feature; + "css-revert-value": import("../data/features.js").Feature; + "css-rrggbbaa": import("../data/features.js").Feature; + "css-scroll-behavior": import("../data/features.js").Feature; + "css-scroll-timeline": import("../data/features.js").Feature; + "css-scrollbar": import("../data/features.js").Feature; + "css-sel2": import("../data/features.js").Feature; + "css-sel3": import("../data/features.js").Feature; + "css-selection": import("../data/features.js").Feature; + "css-shapes": import("../data/features.js").Feature; + "css-snappoints": import("../data/features.js").Feature; + "css-sticky": import("../data/features.js").Feature; + "css-subgrid": import("../data/features.js").Feature; + "css-supports-api": import("../data/features.js").Feature; + "css-table": import("../data/features.js").Feature; + "css-text-align-last": import("../data/features.js").Feature; + "css-text-box-trim": import("../data/features.js").Feature; + "css-text-indent": import("../data/features.js").Feature; + "css-text-justify": import("../data/features.js").Feature; + "css-text-orientation": import("../data/features.js").Feature; + "css-text-spacing": import("../data/features.js").Feature; + "css-textshadow": import("../data/features.js").Feature; + "css-touch-action": import("../data/features.js").Feature; + "css-transitions": import("../data/features.js").Feature; + "css-unicode-bidi": import("../data/features.js").Feature; + "css-unset-value": import("../data/features.js").Feature; + "css-variables": import("../data/features.js").Feature; + "css-when-else": import("../data/features.js").Feature; + "css-widows-orphans": import("../data/features.js").Feature; + "css-width-stretch": import("../data/features.js").Feature; + "css-writing-mode": import("../data/features.js").Feature; + "css-zoom": import("../data/features.js").Feature; + "css3-attr": import("../data/features.js").Feature; + "css3-boxsizing": import("../data/features.js").Feature; + "css3-colors": import("../data/features.js").Feature; + "css3-cursors": import("../data/features.js").Feature; + "css3-cursors-grab": import("../data/features.js").Feature; + "css3-cursors-newer": import("../data/features.js").Feature; + "css3-tabsize": import("../data/features.js").Feature; + currentcolor: import("../data/features.js").Feature; + devicepixelratio: import("../data/features.js").Feature; + "extended-system-fonts": import("../data/features.js").Feature; + flexbox: import("../data/features.js").Feature; + "flexbox-gap": import("../data/features.js").Feature; + "font-family-system-ui": import("../data/features.js").Feature; + "font-feature": import("../data/features.js").Feature; + "font-loading": import("../data/features.js").Feature; + "font-unicode-range": import("../data/features.js").Feature; + fontface: import("../data/features.js").Feature; + fullscreen: import("../data/features.js").Feature; + getcomputedstyle: import("../data/features.js").Feature; + "intrinsic-width": import("../data/features.js").Feature; + "justify-content-space-evenly": import("../data/features.js").Feature; + "kerning-pairs-ligatures": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate-override": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-plaintext": import("../data/features.js").Feature; + "mdn-text-decoration-color": import("../data/features.js").Feature; + "mdn-text-decoration-line": import("../data/features.js").Feature; + "mdn-text-decoration-shorthand": import("../data/features.js").Feature; + "mdn-text-decoration-style": import("../data/features.js").Feature; + minmaxwh: import("../data/features.js").Feature; + multibackgrounds: import("../data/features.js").Feature; + multicolumn: import("../data/features.js").Feature; + "style-scoped": import("../data/features.js").Feature; + "svg-css": import("../data/features.js").Feature; + transforms2d: import("../data/features.js").Feature; + transforms3d: import("../data/features.js").Feature; + ttf: import("../data/features.js").Feature; + "user-select-none": import("../data/features.js").Feature; + "variable-fonts": import("../data/features.js").Feature; + "viewport-unit-variants": import("../data/features.js").Feature; + "viewport-units": import("../data/features.js").Feature; + wordwrap: import("../data/features.js").Feature; + }, MissingSupportResultStats>>; +}; +import * as caniuse from 'caniuse-lite'; diff --git a/node_modules/doiuse/types/lib/Detector.d.ts b/node_modules/doiuse/types/lib/Detector.d.ts new file mode 100644 index 00000000..27be89f3 --- /dev/null +++ b/node_modules/doiuse/types/lib/Detector.d.ts @@ -0,0 +1,1076 @@ +/** + * Detect the use of any of a given list of CSS features. + * ``` + * var detector = new Detector(featureList) + * detector.process(css, cb) + * ``` + * + * `featureList`: an array of feature slugs (see caniuse-db) + * `cb`: a callback that gets called for each usage of one of the given features, + * called with an argument like: + * ``` + * { + * usage: {} // postcss node where usage was found + * feature: {} // caniuse-db feature slug + * ignore: {} // caniuse-db feature to ignore in current file + * } + * ``` + */ +export default class Detector { + /** + * @param {(keyof FEATURES & string)[]} featureList an array of feature slugs (see caniuse-db) + */ + constructor(featureList: (keyof { + outline: import("../data/features.js").Feature; + "background-attachment": import("../data/features.js").Feature; + pointer: import("../data/features.js").Feature; + "flow-root": import("../data/features.js").Feature; + "font-kerning": import("../data/features.js").Feature; + "font-smooth": import("../data/features.js").Feature; + "font-variant-alternates": import("../data/features.js").Feature; + "font-variant-numeric": import("../data/features.js").Feature; + "inline-block": import("../data/features.js").Feature; + "prefers-color-scheme": import("../data/features.js").Feature; + "prefers-reduced-motion": import("../data/features.js").Feature; + rem: import("../data/features.js").Feature; + "run-in": import("../data/features.js").Feature; + "text-emphasis": import("../data/features.js").Feature; + "text-stroke": import("../data/features.js").Feature; + "webkit-user-drag": import("../data/features.js").Feature; + "border-image": import("../data/features.js").Feature; + "border-radius": import("../data/features.js").Feature; + "font-size-adjust": import("../data/features.js").Feature; + "text-decoration": import("../data/features.js").Feature; + "object-fit": import("../data/features.js").Feature; + "pointer-events": import("../data/features.js").Feature; + "text-overflow": import("../data/features.js").Feature; + "text-size-adjust": import("../data/features.js").Feature; + "will-change": import("../data/features.js").Feature; + "word-break": import("../data/features.js").Feature; + "alternate-stylesheet": import("../data/features.js").Feature; + "background-clip-text": import("../data/features.js").Feature; + "background-img-opts": import("../data/features.js").Feature; + "background-position-x-y": import("../data/features.js").Feature; + "background-repeat-round-space": import("../data/features.js").Feature; + calc: import("../data/features.js").Feature; + "ch-unit": import("../data/features.js").Feature; + "css-all": import("../data/features.js").Feature; + "css-animation": import("../data/features.js").Feature; + "css-any-link": import("../data/features.js").Feature; + "css-appearance": import("../data/features.js").Feature; + "css-at-counter-style": import("../data/features.js").Feature; + "css-autofill": import("../data/features.js").Feature; + "css-backdrop-filter": import("../data/features.js").Feature; + "css-background-offsets": import("../data/features.js").Feature; + "css-backgroundblendmode": import("../data/features.js").Feature; + "css-boxdecorationbreak": import("../data/features.js").Feature; + "css-boxshadow": import("../data/features.js").Feature; + "css-canvas": import("../data/features.js").Feature; + "css-caret-color": import("../data/features.js").Feature; + "css-cascade-layers": import("../data/features.js").Feature; + "css-case-insensitive": import("../data/features.js").Feature; + "css-clip-path": import("../data/features.js").Feature; + "css-color-adjust": import("../data/features.js").Feature; + "css-color-function": import("../data/features.js").Feature; + "css-conic-gradients": import("../data/features.js").Feature; + "css-container-queries": import("../data/features.js").Feature; + "css-container-queries-style": import("../data/features.js").Feature; + "css-container-query-units": import("../data/features.js").Feature; + "css-containment": import("../data/features.js").Feature; + "css-content-visibility": import("../data/features.js").Feature; + "css-counters": import("../data/features.js").Feature; + "css-crisp-edges": import("../data/features.js").Feature; + "css-cross-fade": import("../data/features.js").Feature; + "css-default-pseudo": import("../data/features.js").Feature; + "css-descendant-gtgt": import("../data/features.js").Feature; + "css-deviceadaptation": import("../data/features.js").Feature; + "css-dir-pseudo": import("../data/features.js").Feature; + "css-display-contents": import("../data/features.js").Feature; + "css-element-function": import("../data/features.js").Feature; + "css-env-function": import("../data/features.js").Feature; + "css-exclusions": import("../data/features.js").Feature; + "css-featurequeries": import("../data/features.js").Feature; + "css-file-selector-button": import("../data/features.js").Feature; + "css-filter-function": import("../data/features.js").Feature; + "css-filters": import("../data/features.js").Feature; + "css-first-letter": import("../data/features.js").Feature; + "css-first-line": import("../data/features.js").Feature; + "css-fixed": import("../data/features.js").Feature; + "css-focus-visible": import("../data/features.js").Feature; + "css-focus-within": import("../data/features.js").Feature; + "css-font-palette": import("../data/features.js").Feature; + "css-font-rendering-controls": import("../data/features.js").Feature; + "css-font-stretch": import("../data/features.js").Feature; + "css-gencontent": import("../data/features.js").Feature; + "css-gradients": import("../data/features.js").Feature; + "css-grid": import("../data/features.js").Feature; + "css-grid-animation": import("../data/features.js").Feature; + "css-hanging-punctuation": import("../data/features.js").Feature; + "css-has": import("../data/features.js").Feature; + "css-hyphens": import("../data/features.js").Feature; + "css-image-orientation": import("../data/features.js").Feature; + "css-image-set": import("../data/features.js").Feature; + "css-in-out-of-range": import("../data/features.js").Feature; + "css-indeterminate-pseudo": import("../data/features.js").Feature; + "css-initial-letter": import("../data/features.js").Feature; + "css-initial-value": import("../data/features.js").Feature; + "css-lch-lab": import("../data/features.js").Feature; + "css-letter-spacing": import("../data/features.js").Feature; + "css-line-clamp": import("../data/features.js").Feature; + "css-logical-props": import("../data/features.js").Feature; + "css-marker-pseudo": import("../data/features.js").Feature; + "css-masks": import("../data/features.js").Feature; + "css-matches-pseudo": import("../data/features.js").Feature; + "css-math-functions": import("../data/features.js").Feature; + "css-media-interaction": import("../data/features.js").Feature; + "css-media-range-syntax": import("../data/features.js").Feature; + "css-media-resolution": import("../data/features.js").Feature; + "css-media-scripting": import("../data/features.js").Feature; + "css-mediaqueries": import("../data/features.js").Feature; + "css-mixblendmode": import("../data/features.js").Feature; + "css-motion-paths": import("../data/features.js").Feature; + "css-namespaces": import("../data/features.js").Feature; + "css-nesting": import("../data/features.js").Feature; + "css-not-sel-list": import("../data/features.js").Feature; + "css-nth-child-of": import("../data/features.js").Feature; + "css-opacity": import("../data/features.js").Feature; + "css-optional-pseudo": import("../data/features.js").Feature; + "css-overflow": import("../data/features.js").Feature; + "css-overflow-anchor": import("../data/features.js").Feature; + "css-overflow-overlay": import("../data/features.js").Feature; + "css-overscroll-behavior": import("../data/features.js").Feature; + "css-page-break": import("../data/features.js").Feature; + "css-paged-media": import("../data/features.js").Feature; + "css-paint-api": import("../data/features.js").Feature; + "css-placeholder": import("../data/features.js").Feature; + "css-placeholder-shown": import("../data/features.js").Feature; + "css-print-color-adjust": import("../data/features.js").Feature; + "css-read-only-write": import("../data/features.js").Feature; + "css-rebeccapurple": import("../data/features.js").Feature; + "css-reflections": import("../data/features.js").Feature; + "css-regions": import("../data/features.js").Feature; + "css-relative-colors": import("../data/features.js").Feature; + "css-repeating-gradients": import("../data/features.js").Feature; + "css-resize": import("../data/features.js").Feature; + "css-revert-value": import("../data/features.js").Feature; + "css-rrggbbaa": import("../data/features.js").Feature; + "css-scroll-behavior": import("../data/features.js").Feature; + "css-scroll-timeline": import("../data/features.js").Feature; + "css-scrollbar": import("../data/features.js").Feature; + "css-sel2": import("../data/features.js").Feature; + "css-sel3": import("../data/features.js").Feature; + "css-selection": import("../data/features.js").Feature; + "css-shapes": import("../data/features.js").Feature; + "css-snappoints": import("../data/features.js").Feature; + "css-sticky": import("../data/features.js").Feature; + "css-subgrid": import("../data/features.js").Feature; + "css-supports-api": import("../data/features.js").Feature; + "css-table": import("../data/features.js").Feature; + "css-text-align-last": import("../data/features.js").Feature; + "css-text-box-trim": import("../data/features.js").Feature; + "css-text-indent": import("../data/features.js").Feature; + "css-text-justify": import("../data/features.js").Feature; + "css-text-orientation": import("../data/features.js").Feature; + "css-text-spacing": import("../data/features.js").Feature; + "css-textshadow": import("../data/features.js").Feature; + "css-touch-action": import("../data/features.js").Feature; + "css-transitions": import("../data/features.js").Feature; + "css-unicode-bidi": import("../data/features.js").Feature; + "css-unset-value": import("../data/features.js").Feature; + "css-variables": import("../data/features.js").Feature; + "css-when-else": import("../data/features.js").Feature; + "css-widows-orphans": import("../data/features.js").Feature; + "css-width-stretch": import("../data/features.js").Feature; + "css-writing-mode": import("../data/features.js").Feature; + "css-zoom": import("../data/features.js").Feature; + "css3-attr": import("../data/features.js").Feature; + "css3-boxsizing": import("../data/features.js").Feature; + "css3-colors": import("../data/features.js").Feature; + "css3-cursors": import("../data/features.js").Feature; + "css3-cursors-grab": import("../data/features.js").Feature; + "css3-cursors-newer": import("../data/features.js").Feature; + "css3-tabsize": import("../data/features.js").Feature; + currentcolor: import("../data/features.js").Feature; + devicepixelratio: import("../data/features.js").Feature; + "extended-system-fonts": import("../data/features.js").Feature; + flexbox: import("../data/features.js").Feature; + "flexbox-gap": import("../data/features.js").Feature; + "font-family-system-ui": import("../data/features.js").Feature; + "font-feature": import("../data/features.js").Feature; + "font-loading": import("../data/features.js").Feature; + "font-unicode-range": import("../data/features.js").Feature; + fontface: import("../data/features.js").Feature; + fullscreen: import("../data/features.js").Feature; + getcomputedstyle: import("../data/features.js").Feature; + "intrinsic-width": import("../data/features.js").Feature; + "justify-content-space-evenly": import("../data/features.js").Feature; + "kerning-pairs-ligatures": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate-override": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-plaintext": import("../data/features.js").Feature; + "mdn-text-decoration-color": import("../data/features.js").Feature; + "mdn-text-decoration-line": import("../data/features.js").Feature; + "mdn-text-decoration-shorthand": import("../data/features.js").Feature; + "mdn-text-decoration-style": import("../data/features.js").Feature; + minmaxwh: import("../data/features.js").Feature; + multibackgrounds: import("../data/features.js").Feature; + multicolumn: import("../data/features.js").Feature; + "style-scoped": import("../data/features.js").Feature; + "svg-css": import("../data/features.js").Feature; + transforms2d: import("../data/features.js").Feature; + transforms3d: import("../data/features.js").Feature; + ttf: import("../data/features.js").Feature; + "user-select-none": import("../data/features.js").Feature; + "variable-fonts": import("../data/features.js").Feature; + "viewport-unit-variants": import("../data/features.js").Feature; + "viewport-units": import("../data/features.js").Feature; + wordwrap: import("../data/features.js").Feature; + } & string)[]); + /** @type {Partial<FEATURES>} */ + features: Partial<{ + outline: import("../data/features.js").Feature; + "background-attachment": import("../data/features.js").Feature; + pointer: import("../data/features.js").Feature; + "flow-root": import("../data/features.js").Feature; + "font-kerning": import("../data/features.js").Feature; + "font-smooth": import("../data/features.js").Feature; + "font-variant-alternates": import("../data/features.js").Feature; + "font-variant-numeric": import("../data/features.js").Feature; + "inline-block": import("../data/features.js").Feature; + "prefers-color-scheme": import("../data/features.js").Feature; + "prefers-reduced-motion": import("../data/features.js").Feature; + rem: import("../data/features.js").Feature; + "run-in": import("../data/features.js").Feature; + "text-emphasis": import("../data/features.js").Feature; + "text-stroke": import("../data/features.js").Feature; + "webkit-user-drag": import("../data/features.js").Feature; + "border-image": import("../data/features.js").Feature; + "border-radius": import("../data/features.js").Feature; + "font-size-adjust": import("../data/features.js").Feature; + "text-decoration": import("../data/features.js").Feature; + "object-fit": import("../data/features.js").Feature; + "pointer-events": import("../data/features.js").Feature; + "text-overflow": import("../data/features.js").Feature; + "text-size-adjust": import("../data/features.js").Feature; + "will-change": import("../data/features.js").Feature; + "word-break": import("../data/features.js").Feature; + "alternate-stylesheet": import("../data/features.js").Feature; + "background-clip-text": import("../data/features.js").Feature; + "background-img-opts": import("../data/features.js").Feature; + "background-position-x-y": import("../data/features.js").Feature; + "background-repeat-round-space": import("../data/features.js").Feature; + calc: import("../data/features.js").Feature; + "ch-unit": import("../data/features.js").Feature; + "css-all": import("../data/features.js").Feature; + "css-animation": import("../data/features.js").Feature; + "css-any-link": import("../data/features.js").Feature; + "css-appearance": import("../data/features.js").Feature; + "css-at-counter-style": import("../data/features.js").Feature; + "css-autofill": import("../data/features.js").Feature; + "css-backdrop-filter": import("../data/features.js").Feature; + "css-background-offsets": import("../data/features.js").Feature; + "css-backgroundblendmode": import("../data/features.js").Feature; + "css-boxdecorationbreak": import("../data/features.js").Feature; + "css-boxshadow": import("../data/features.js").Feature; + "css-canvas": import("../data/features.js").Feature; + "css-caret-color": import("../data/features.js").Feature; + "css-cascade-layers": import("../data/features.js").Feature; + "css-case-insensitive": import("../data/features.js").Feature; + "css-clip-path": import("../data/features.js").Feature; + "css-color-adjust": import("../data/features.js").Feature; + "css-color-function": import("../data/features.js").Feature; + "css-conic-gradients": import("../data/features.js").Feature; + "css-container-queries": import("../data/features.js").Feature; + "css-container-queries-style": import("../data/features.js").Feature; + "css-container-query-units": import("../data/features.js").Feature; + "css-containment": import("../data/features.js").Feature; + "css-content-visibility": import("../data/features.js").Feature; + "css-counters": import("../data/features.js").Feature; + "css-crisp-edges": import("../data/features.js").Feature; + "css-cross-fade": import("../data/features.js").Feature; + "css-default-pseudo": import("../data/features.js").Feature; + "css-descendant-gtgt": import("../data/features.js").Feature; + "css-deviceadaptation": import("../data/features.js").Feature; + "css-dir-pseudo": import("../data/features.js").Feature; + "css-display-contents": import("../data/features.js").Feature; + "css-element-function": import("../data/features.js").Feature; + "css-env-function": import("../data/features.js").Feature; + "css-exclusions": import("../data/features.js").Feature; + "css-featurequeries": import("../data/features.js").Feature; + "css-file-selector-button": import("../data/features.js").Feature; + "css-filter-function": import("../data/features.js").Feature; + "css-filters": import("../data/features.js").Feature; + "css-first-letter": import("../data/features.js").Feature; + "css-first-line": import("../data/features.js").Feature; + "css-fixed": import("../data/features.js").Feature; + "css-focus-visible": import("../data/features.js").Feature; + "css-focus-within": import("../data/features.js").Feature; + "css-font-palette": import("../data/features.js").Feature; + "css-font-rendering-controls": import("../data/features.js").Feature; + "css-font-stretch": import("../data/features.js").Feature; + "css-gencontent": import("../data/features.js").Feature; + "css-gradients": import("../data/features.js").Feature; + "css-grid": import("../data/features.js").Feature; + "css-grid-animation": import("../data/features.js").Feature; + "css-hanging-punctuation": import("../data/features.js").Feature; + "css-has": import("../data/features.js").Feature; + "css-hyphens": import("../data/features.js").Feature; + "css-image-orientation": import("../data/features.js").Feature; + "css-image-set": import("../data/features.js").Feature; + "css-in-out-of-range": import("../data/features.js").Feature; + "css-indeterminate-pseudo": import("../data/features.js").Feature; + "css-initial-letter": import("../data/features.js").Feature; + "css-initial-value": import("../data/features.js").Feature; + "css-lch-lab": import("../data/features.js").Feature; + "css-letter-spacing": import("../data/features.js").Feature; + "css-line-clamp": import("../data/features.js").Feature; + "css-logical-props": import("../data/features.js").Feature; + "css-marker-pseudo": import("../data/features.js").Feature; + "css-masks": import("../data/features.js").Feature; + "css-matches-pseudo": import("../data/features.js").Feature; + "css-math-functions": import("../data/features.js").Feature; + "css-media-interaction": import("../data/features.js").Feature; + "css-media-range-syntax": import("../data/features.js").Feature; + "css-media-resolution": import("../data/features.js").Feature; + "css-media-scripting": import("../data/features.js").Feature; + "css-mediaqueries": import("../data/features.js").Feature; + "css-mixblendmode": import("../data/features.js").Feature; + "css-motion-paths": import("../data/features.js").Feature; + "css-namespaces": import("../data/features.js").Feature; + "css-nesting": import("../data/features.js").Feature; + "css-not-sel-list": import("../data/features.js").Feature; + "css-nth-child-of": import("../data/features.js").Feature; + "css-opacity": import("../data/features.js").Feature; + "css-optional-pseudo": import("../data/features.js").Feature; + "css-overflow": import("../data/features.js").Feature; + "css-overflow-anchor": import("../data/features.js").Feature; + "css-overflow-overlay": import("../data/features.js").Feature; + "css-overscroll-behavior": import("../data/features.js").Feature; + "css-page-break": import("../data/features.js").Feature; + "css-paged-media": import("../data/features.js").Feature; + "css-paint-api": import("../data/features.js").Feature; + "css-placeholder": import("../data/features.js").Feature; + "css-placeholder-shown": import("../data/features.js").Feature; + "css-print-color-adjust": import("../data/features.js").Feature; + "css-read-only-write": import("../data/features.js").Feature; + "css-rebeccapurple": import("../data/features.js").Feature; + "css-reflections": import("../data/features.js").Feature; + "css-regions": import("../data/features.js").Feature; + "css-relative-colors": import("../data/features.js").Feature; + "css-repeating-gradients": import("../data/features.js").Feature; + "css-resize": import("../data/features.js").Feature; + "css-revert-value": import("../data/features.js").Feature; + "css-rrggbbaa": import("../data/features.js").Feature; + "css-scroll-behavior": import("../data/features.js").Feature; + "css-scroll-timeline": import("../data/features.js").Feature; + "css-scrollbar": import("../data/features.js").Feature; + "css-sel2": import("../data/features.js").Feature; + "css-sel3": import("../data/features.js").Feature; + "css-selection": import("../data/features.js").Feature; + "css-shapes": import("../data/features.js").Feature; + "css-snappoints": import("../data/features.js").Feature; + "css-sticky": import("../data/features.js").Feature; + "css-subgrid": import("../data/features.js").Feature; + "css-supports-api": import("../data/features.js").Feature; + "css-table": import("../data/features.js").Feature; + "css-text-align-last": import("../data/features.js").Feature; + "css-text-box-trim": import("../data/features.js").Feature; + "css-text-indent": import("../data/features.js").Feature; + "css-text-justify": import("../data/features.js").Feature; + "css-text-orientation": import("../data/features.js").Feature; + "css-text-spacing": import("../data/features.js").Feature; + "css-textshadow": import("../data/features.js").Feature; + "css-touch-action": import("../data/features.js").Feature; + "css-transitions": import("../data/features.js").Feature; + "css-unicode-bidi": import("../data/features.js").Feature; + "css-unset-value": import("../data/features.js").Feature; + "css-variables": import("../data/features.js").Feature; + "css-when-else": import("../data/features.js").Feature; + "css-widows-orphans": import("../data/features.js").Feature; + "css-width-stretch": import("../data/features.js").Feature; + "css-writing-mode": import("../data/features.js").Feature; + "css-zoom": import("../data/features.js").Feature; + "css3-attr": import("../data/features.js").Feature; + "css3-boxsizing": import("../data/features.js").Feature; + "css3-colors": import("../data/features.js").Feature; + "css3-cursors": import("../data/features.js").Feature; + "css3-cursors-grab": import("../data/features.js").Feature; + "css3-cursors-newer": import("../data/features.js").Feature; + "css3-tabsize": import("../data/features.js").Feature; + currentcolor: import("../data/features.js").Feature; + devicepixelratio: import("../data/features.js").Feature; + "extended-system-fonts": import("../data/features.js").Feature; + flexbox: import("../data/features.js").Feature; + "flexbox-gap": import("../data/features.js").Feature; + "font-family-system-ui": import("../data/features.js").Feature; + "font-feature": import("../data/features.js").Feature; + "font-loading": import("../data/features.js").Feature; + "font-unicode-range": import("../data/features.js").Feature; + fontface: import("../data/features.js").Feature; + fullscreen: import("../data/features.js").Feature; + getcomputedstyle: import("../data/features.js").Feature; + "intrinsic-width": import("../data/features.js").Feature; + "justify-content-space-evenly": import("../data/features.js").Feature; + "kerning-pairs-ligatures": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate-override": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-plaintext": import("../data/features.js").Feature; + "mdn-text-decoration-color": import("../data/features.js").Feature; + "mdn-text-decoration-line": import("../data/features.js").Feature; + "mdn-text-decoration-shorthand": import("../data/features.js").Feature; + "mdn-text-decoration-style": import("../data/features.js").Feature; + minmaxwh: import("../data/features.js").Feature; + multibackgrounds: import("../data/features.js").Feature; + multicolumn: import("../data/features.js").Feature; + "style-scoped": import("../data/features.js").Feature; + "svg-css": import("../data/features.js").Feature; + transforms2d: import("../data/features.js").Feature; + transforms3d: import("../data/features.js").Feature; + ttf: import("../data/features.js").Feature; + "user-select-none": import("../data/features.js").Feature; + "variable-fonts": import("../data/features.js").Feature; + "viewport-unit-variants": import("../data/features.js").Feature; + "viewport-units": import("../data/features.js").Feature; + wordwrap: import("../data/features.js").Feature; + }>; + /** @type {(keyof FEATURES & string)[]} */ + ignore: (keyof { + outline: import("../data/features.js").Feature; + "background-attachment": import("../data/features.js").Feature; + pointer: import("../data/features.js").Feature; + "flow-root": import("../data/features.js").Feature; + "font-kerning": import("../data/features.js").Feature; + "font-smooth": import("../data/features.js").Feature; + "font-variant-alternates": import("../data/features.js").Feature; + "font-variant-numeric": import("../data/features.js").Feature; + "inline-block": import("../data/features.js").Feature; + "prefers-color-scheme": import("../data/features.js").Feature; + "prefers-reduced-motion": import("../data/features.js").Feature; + rem: import("../data/features.js").Feature; + "run-in": import("../data/features.js").Feature; + "text-emphasis": import("../data/features.js").Feature; + "text-stroke": import("../data/features.js").Feature; + "webkit-user-drag": import("../data/features.js").Feature; + "border-image": import("../data/features.js").Feature; + "border-radius": import("../data/features.js").Feature; + "font-size-adjust": import("../data/features.js").Feature; + "text-decoration": import("../data/features.js").Feature; + "object-fit": import("../data/features.js").Feature; + "pointer-events": import("../data/features.js").Feature; + "text-overflow": import("../data/features.js").Feature; + "text-size-adjust": import("../data/features.js").Feature; + "will-change": import("../data/features.js").Feature; + "word-break": import("../data/features.js").Feature; + "alternate-stylesheet": import("../data/features.js").Feature; + "background-clip-text": import("../data/features.js").Feature; + "background-img-opts": import("../data/features.js").Feature; + "background-position-x-y": import("../data/features.js").Feature; + "background-repeat-round-space": import("../data/features.js").Feature; + calc: import("../data/features.js").Feature; + "ch-unit": import("../data/features.js").Feature; + "css-all": import("../data/features.js").Feature; + "css-animation": import("../data/features.js").Feature; + "css-any-link": import("../data/features.js").Feature; + "css-appearance": import("../data/features.js").Feature; + "css-at-counter-style": import("../data/features.js").Feature; + "css-autofill": import("../data/features.js").Feature; + "css-backdrop-filter": import("../data/features.js").Feature; + "css-background-offsets": import("../data/features.js").Feature; + "css-backgroundblendmode": import("../data/features.js").Feature; + "css-boxdecorationbreak": import("../data/features.js").Feature; + "css-boxshadow": import("../data/features.js").Feature; + "css-canvas": import("../data/features.js").Feature; + "css-caret-color": import("../data/features.js").Feature; + "css-cascade-layers": import("../data/features.js").Feature; + "css-case-insensitive": import("../data/features.js").Feature; + "css-clip-path": import("../data/features.js").Feature; + "css-color-adjust": import("../data/features.js").Feature; + "css-color-function": import("../data/features.js").Feature; + "css-conic-gradients": import("../data/features.js").Feature; + "css-container-queries": import("../data/features.js").Feature; + "css-container-queries-style": import("../data/features.js").Feature; + "css-container-query-units": import("../data/features.js").Feature; + "css-containment": import("../data/features.js").Feature; + "css-content-visibility": import("../data/features.js").Feature; + "css-counters": import("../data/features.js").Feature; + "css-crisp-edges": import("../data/features.js").Feature; + "css-cross-fade": import("../data/features.js").Feature; + "css-default-pseudo": import("../data/features.js").Feature; + "css-descendant-gtgt": import("../data/features.js").Feature; + "css-deviceadaptation": import("../data/features.js").Feature; + "css-dir-pseudo": import("../data/features.js").Feature; + "css-display-contents": import("../data/features.js").Feature; + "css-element-function": import("../data/features.js").Feature; + "css-env-function": import("../data/features.js").Feature; + "css-exclusions": import("../data/features.js").Feature; + "css-featurequeries": import("../data/features.js").Feature; + "css-file-selector-button": import("../data/features.js").Feature; + "css-filter-function": import("../data/features.js").Feature; + "css-filters": import("../data/features.js").Feature; + "css-first-letter": import("../data/features.js").Feature; + "css-first-line": import("../data/features.js").Feature; + "css-fixed": import("../data/features.js").Feature; + "css-focus-visible": import("../data/features.js").Feature; + "css-focus-within": import("../data/features.js").Feature; + "css-font-palette": import("../data/features.js").Feature; + "css-font-rendering-controls": import("../data/features.js").Feature; + "css-font-stretch": import("../data/features.js").Feature; + "css-gencontent": import("../data/features.js").Feature; + "css-gradients": import("../data/features.js").Feature; + "css-grid": import("../data/features.js").Feature; + "css-grid-animation": import("../data/features.js").Feature; + "css-hanging-punctuation": import("../data/features.js").Feature; + "css-has": import("../data/features.js").Feature; + "css-hyphens": import("../data/features.js").Feature; + "css-image-orientation": import("../data/features.js").Feature; + "css-image-set": import("../data/features.js").Feature; + "css-in-out-of-range": import("../data/features.js").Feature; + "css-indeterminate-pseudo": import("../data/features.js").Feature; + "css-initial-letter": import("../data/features.js").Feature; + "css-initial-value": import("../data/features.js").Feature; + "css-lch-lab": import("../data/features.js").Feature; + "css-letter-spacing": import("../data/features.js").Feature; + "css-line-clamp": import("../data/features.js").Feature; + "css-logical-props": import("../data/features.js").Feature; + "css-marker-pseudo": import("../data/features.js").Feature; + "css-masks": import("../data/features.js").Feature; + "css-matches-pseudo": import("../data/features.js").Feature; + "css-math-functions": import("../data/features.js").Feature; + "css-media-interaction": import("../data/features.js").Feature; + "css-media-range-syntax": import("../data/features.js").Feature; + "css-media-resolution": import("../data/features.js").Feature; + "css-media-scripting": import("../data/features.js").Feature; + "css-mediaqueries": import("../data/features.js").Feature; + "css-mixblendmode": import("../data/features.js").Feature; + "css-motion-paths": import("../data/features.js").Feature; + "css-namespaces": import("../data/features.js").Feature; + "css-nesting": import("../data/features.js").Feature; + "css-not-sel-list": import("../data/features.js").Feature; + "css-nth-child-of": import("../data/features.js").Feature; + "css-opacity": import("../data/features.js").Feature; + "css-optional-pseudo": import("../data/features.js").Feature; + "css-overflow": import("../data/features.js").Feature; + "css-overflow-anchor": import("../data/features.js").Feature; + "css-overflow-overlay": import("../data/features.js").Feature; + "css-overscroll-behavior": import("../data/features.js").Feature; + "css-page-break": import("../data/features.js").Feature; + "css-paged-media": import("../data/features.js").Feature; + "css-paint-api": import("../data/features.js").Feature; + "css-placeholder": import("../data/features.js").Feature; + "css-placeholder-shown": import("../data/features.js").Feature; + "css-print-color-adjust": import("../data/features.js").Feature; + "css-read-only-write": import("../data/features.js").Feature; + "css-rebeccapurple": import("../data/features.js").Feature; + "css-reflections": import("../data/features.js").Feature; + "css-regions": import("../data/features.js").Feature; + "css-relative-colors": import("../data/features.js").Feature; + "css-repeating-gradients": import("../data/features.js").Feature; + "css-resize": import("../data/features.js").Feature; + "css-revert-value": import("../data/features.js").Feature; + "css-rrggbbaa": import("../data/features.js").Feature; + "css-scroll-behavior": import("../data/features.js").Feature; + "css-scroll-timeline": import("../data/features.js").Feature; + "css-scrollbar": import("../data/features.js").Feature; + "css-sel2": import("../data/features.js").Feature; + "css-sel3": import("../data/features.js").Feature; + "css-selection": import("../data/features.js").Feature; + "css-shapes": import("../data/features.js").Feature; + "css-snappoints": import("../data/features.js").Feature; + "css-sticky": import("../data/features.js").Feature; + "css-subgrid": import("../data/features.js").Feature; + "css-supports-api": import("../data/features.js").Feature; + "css-table": import("../data/features.js").Feature; + "css-text-align-last": import("../data/features.js").Feature; + "css-text-box-trim": import("../data/features.js").Feature; + "css-text-indent": import("../data/features.js").Feature; + "css-text-justify": import("../data/features.js").Feature; + "css-text-orientation": import("../data/features.js").Feature; + "css-text-spacing": import("../data/features.js").Feature; + "css-textshadow": import("../data/features.js").Feature; + "css-touch-action": import("../data/features.js").Feature; + "css-transitions": import("../data/features.js").Feature; + "css-unicode-bidi": import("../data/features.js").Feature; + "css-unset-value": import("../data/features.js").Feature; + "css-variables": import("../data/features.js").Feature; + "css-when-else": import("../data/features.js").Feature; + "css-widows-orphans": import("../data/features.js").Feature; + "css-width-stretch": import("../data/features.js").Feature; + "css-writing-mode": import("../data/features.js").Feature; + "css-zoom": import("../data/features.js").Feature; + "css3-attr": import("../data/features.js").Feature; + "css3-boxsizing": import("../data/features.js").Feature; + "css3-colors": import("../data/features.js").Feature; + "css3-cursors": import("../data/features.js").Feature; + "css3-cursors-grab": import("../data/features.js").Feature; + "css3-cursors-newer": import("../data/features.js").Feature; + "css3-tabsize": import("../data/features.js").Feature; + currentcolor: import("../data/features.js").Feature; + devicepixelratio: import("../data/features.js").Feature; + "extended-system-fonts": import("../data/features.js").Feature; + flexbox: import("../data/features.js").Feature; + "flexbox-gap": import("../data/features.js").Feature; + "font-family-system-ui": import("../data/features.js").Feature; + "font-feature": import("../data/features.js").Feature; + "font-loading": import("../data/features.js").Feature; + "font-unicode-range": import("../data/features.js").Feature; + fontface: import("../data/features.js").Feature; + fullscreen: import("../data/features.js").Feature; + getcomputedstyle: import("../data/features.js").Feature; + "intrinsic-width": import("../data/features.js").Feature; + "justify-content-space-evenly": import("../data/features.js").Feature; + "kerning-pairs-ligatures": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate-override": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-plaintext": import("../data/features.js").Feature; + "mdn-text-decoration-color": import("../data/features.js").Feature; + "mdn-text-decoration-line": import("../data/features.js").Feature; + "mdn-text-decoration-shorthand": import("../data/features.js").Feature; + "mdn-text-decoration-style": import("../data/features.js").Feature; + minmaxwh: import("../data/features.js").Feature; + multibackgrounds: import("../data/features.js").Feature; + multicolumn: import("../data/features.js").Feature; + "style-scoped": import("../data/features.js").Feature; + "svg-css": import("../data/features.js").Feature; + transforms2d: import("../data/features.js").Feature; + transforms3d: import("../data/features.js").Feature; + ttf: import("../data/features.js").Feature; + "user-select-none": import("../data/features.js").Feature; + "variable-fonts": import("../data/features.js").Feature; + "viewport-unit-variants": import("../data/features.js").Feature; + "viewport-units": import("../data/features.js").Feature; + wordwrap: import("../data/features.js").Feature; + } & string)[]; + /** + * @param {import('postcss').Comment} comment + * @return {void} + */ + comment(comment: import('postcss').Comment): void; + /** + * @param {import('postcss').Container} node + * @param {DetectorCallback} callback + * @return {void} + */ + node(node: import('postcss').Container, callback: DetectorCallback): void; + /** + * @param {import('postcss').Root} node + * @param {DetectorCallback} callback + * @return {void} + */ + process(node: import('postcss').Root, callback: DetectorCallback): void; +} +export type DetectorCallbackArgument = { + usage: import('postcss').ChildNode; + feature: keyof { + outline: import("../data/features.js").Feature; + "background-attachment": import("../data/features.js").Feature; + pointer: import("../data/features.js").Feature; + "flow-root": import("../data/features.js").Feature; + "font-kerning": import("../data/features.js").Feature; + "font-smooth": import("../data/features.js").Feature; + "font-variant-alternates": import("../data/features.js").Feature; + "font-variant-numeric": import("../data/features.js").Feature; + "inline-block": import("../data/features.js").Feature; + "prefers-color-scheme": import("../data/features.js").Feature; + "prefers-reduced-motion": import("../data/features.js").Feature; + rem: import("../data/features.js").Feature; + "run-in": import("../data/features.js").Feature; + "text-emphasis": import("../data/features.js").Feature; + "text-stroke": import("../data/features.js").Feature; + "webkit-user-drag": import("../data/features.js").Feature; + "border-image": import("../data/features.js").Feature; + "border-radius": import("../data/features.js").Feature; + "font-size-adjust": import("../data/features.js").Feature; + "text-decoration": import("../data/features.js").Feature; + "object-fit": import("../data/features.js").Feature; + "pointer-events": import("../data/features.js").Feature; + "text-overflow": import("../data/features.js").Feature; + "text-size-adjust": import("../data/features.js").Feature; + "will-change": import("../data/features.js").Feature; + "word-break": import("../data/features.js").Feature; + "alternate-stylesheet": import("../data/features.js").Feature; + "background-clip-text": import("../data/features.js").Feature; + "background-img-opts": import("../data/features.js").Feature; + "background-position-x-y": import("../data/features.js").Feature; + "background-repeat-round-space": import("../data/features.js").Feature; + calc: import("../data/features.js").Feature; + "ch-unit": import("../data/features.js").Feature; + "css-all": import("../data/features.js").Feature; + "css-animation": import("../data/features.js").Feature; + "css-any-link": import("../data/features.js").Feature; + "css-appearance": import("../data/features.js").Feature; + "css-at-counter-style": import("../data/features.js").Feature; + "css-autofill": import("../data/features.js").Feature; + "css-backdrop-filter": import("../data/features.js").Feature; + "css-background-offsets": import("../data/features.js").Feature; + "css-backgroundblendmode": import("../data/features.js").Feature; + "css-boxdecorationbreak": import("../data/features.js").Feature; + "css-boxshadow": import("../data/features.js").Feature; + "css-canvas": import("../data/features.js").Feature; + "css-caret-color": import("../data/features.js").Feature; + "css-cascade-layers": import("../data/features.js").Feature; + "css-case-insensitive": import("../data/features.js").Feature; + "css-clip-path": import("../data/features.js").Feature; + "css-color-adjust": import("../data/features.js").Feature; + "css-color-function": import("../data/features.js").Feature; + "css-conic-gradients": import("../data/features.js").Feature; + "css-container-queries": import("../data/features.js").Feature; + "css-container-queries-style": import("../data/features.js").Feature; + "css-container-query-units": import("../data/features.js").Feature; + "css-containment": import("../data/features.js").Feature; + "css-content-visibility": import("../data/features.js").Feature; + "css-counters": import("../data/features.js").Feature; + "css-crisp-edges": import("../data/features.js").Feature; + "css-cross-fade": import("../data/features.js").Feature; + "css-default-pseudo": import("../data/features.js").Feature; + "css-descendant-gtgt": import("../data/features.js").Feature; + "css-deviceadaptation": import("../data/features.js").Feature; + "css-dir-pseudo": import("../data/features.js").Feature; + "css-display-contents": import("../data/features.js").Feature; + "css-element-function": import("../data/features.js").Feature; + "css-env-function": import("../data/features.js").Feature; + "css-exclusions": import("../data/features.js").Feature; + "css-featurequeries": import("../data/features.js").Feature; + "css-file-selector-button": import("../data/features.js").Feature; + "css-filter-function": import("../data/features.js").Feature; + "css-filters": import("../data/features.js").Feature; + "css-first-letter": import("../data/features.js").Feature; + "css-first-line": import("../data/features.js").Feature; + "css-fixed": import("../data/features.js").Feature; + "css-focus-visible": import("../data/features.js").Feature; + "css-focus-within": import("../data/features.js").Feature; + "css-font-palette": import("../data/features.js").Feature; + "css-font-rendering-controls": import("../data/features.js").Feature; + "css-font-stretch": import("../data/features.js").Feature; + "css-gencontent": import("../data/features.js").Feature; + "css-gradients": import("../data/features.js").Feature; + "css-grid": import("../data/features.js").Feature; + "css-grid-animation": import("../data/features.js").Feature; + "css-hanging-punctuation": import("../data/features.js").Feature; + "css-has": import("../data/features.js").Feature; + "css-hyphens": import("../data/features.js").Feature; + "css-image-orientation": import("../data/features.js").Feature; + "css-image-set": import("../data/features.js").Feature; + "css-in-out-of-range": import("../data/features.js").Feature; + "css-indeterminate-pseudo": import("../data/features.js").Feature; + "css-initial-letter": import("../data/features.js").Feature; + "css-initial-value": import("../data/features.js").Feature; + "css-lch-lab": import("../data/features.js").Feature; + "css-letter-spacing": import("../data/features.js").Feature; + "css-line-clamp": import("../data/features.js").Feature; + "css-logical-props": import("../data/features.js").Feature; + "css-marker-pseudo": import("../data/features.js").Feature; + "css-masks": import("../data/features.js").Feature; + "css-matches-pseudo": import("../data/features.js").Feature; + "css-math-functions": import("../data/features.js").Feature; + "css-media-interaction": import("../data/features.js").Feature; + "css-media-range-syntax": import("../data/features.js").Feature; + "css-media-resolution": import("../data/features.js").Feature; + "css-media-scripting": import("../data/features.js").Feature; + "css-mediaqueries": import("../data/features.js").Feature; + "css-mixblendmode": import("../data/features.js").Feature; + "css-motion-paths": import("../data/features.js").Feature; + "css-namespaces": import("../data/features.js").Feature; + "css-nesting": import("../data/features.js").Feature; + "css-not-sel-list": import("../data/features.js").Feature; + "css-nth-child-of": import("../data/features.js").Feature; + "css-opacity": import("../data/features.js").Feature; + "css-optional-pseudo": import("../data/features.js").Feature; + "css-overflow": import("../data/features.js").Feature; + "css-overflow-anchor": import("../data/features.js").Feature; + "css-overflow-overlay": import("../data/features.js").Feature; + "css-overscroll-behavior": import("../data/features.js").Feature; + "css-page-break": import("../data/features.js").Feature; + "css-paged-media": import("../data/features.js").Feature; + "css-paint-api": import("../data/features.js").Feature; + "css-placeholder": import("../data/features.js").Feature; + "css-placeholder-shown": import("../data/features.js").Feature; + "css-print-color-adjust": import("../data/features.js").Feature; + "css-read-only-write": import("../data/features.js").Feature; + "css-rebeccapurple": import("../data/features.js").Feature; + "css-reflections": import("../data/features.js").Feature; + "css-regions": import("../data/features.js").Feature; + "css-relative-colors": import("../data/features.js").Feature; + "css-repeating-gradients": import("../data/features.js").Feature; + "css-resize": import("../data/features.js").Feature; + "css-revert-value": import("../data/features.js").Feature; + "css-rrggbbaa": import("../data/features.js").Feature; + "css-scroll-behavior": import("../data/features.js").Feature; + "css-scroll-timeline": import("../data/features.js").Feature; + "css-scrollbar": import("../data/features.js").Feature; + "css-sel2": import("../data/features.js").Feature; + "css-sel3": import("../data/features.js").Feature; + "css-selection": import("../data/features.js").Feature; + "css-shapes": import("../data/features.js").Feature; + "css-snappoints": import("../data/features.js").Feature; + "css-sticky": import("../data/features.js").Feature; + "css-subgrid": import("../data/features.js").Feature; + "css-supports-api": import("../data/features.js").Feature; + "css-table": import("../data/features.js").Feature; + "css-text-align-last": import("../data/features.js").Feature; + "css-text-box-trim": import("../data/features.js").Feature; + "css-text-indent": import("../data/features.js").Feature; + "css-text-justify": import("../data/features.js").Feature; + "css-text-orientation": import("../data/features.js").Feature; + "css-text-spacing": import("../data/features.js").Feature; + "css-textshadow": import("../data/features.js").Feature; + "css-touch-action": import("../data/features.js").Feature; + "css-transitions": import("../data/features.js").Feature; + "css-unicode-bidi": import("../data/features.js").Feature; + "css-unset-value": import("../data/features.js").Feature; + "css-variables": import("../data/features.js").Feature; + "css-when-else": import("../data/features.js").Feature; + "css-widows-orphans": import("../data/features.js").Feature; + "css-width-stretch": import("../data/features.js").Feature; + "css-writing-mode": import("../data/features.js").Feature; + "css-zoom": import("../data/features.js").Feature; + "css3-attr": import("../data/features.js").Feature; + "css3-boxsizing": import("../data/features.js").Feature; + "css3-colors": import("../data/features.js").Feature; + "css3-cursors": import("../data/features.js").Feature; + "css3-cursors-grab": import("../data/features.js").Feature; + "css3-cursors-newer": import("../data/features.js").Feature; + "css3-tabsize": import("../data/features.js").Feature; + currentcolor: import("../data/features.js").Feature; + devicepixelratio: import("../data/features.js").Feature; + "extended-system-fonts": import("../data/features.js").Feature; + flexbox: import("../data/features.js").Feature; + "flexbox-gap": import("../data/features.js").Feature; + "font-family-system-ui": import("../data/features.js").Feature; + "font-feature": import("../data/features.js").Feature; + "font-loading": import("../data/features.js").Feature; + "font-unicode-range": import("../data/features.js").Feature; + fontface: import("../data/features.js").Feature; + fullscreen: import("../data/features.js").Feature; + getcomputedstyle: import("../data/features.js").Feature; + "intrinsic-width": import("../data/features.js").Feature; + "justify-content-space-evenly": import("../data/features.js").Feature; + "kerning-pairs-ligatures": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate-override": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-plaintext": import("../data/features.js").Feature; + "mdn-text-decoration-color": import("../data/features.js").Feature; + "mdn-text-decoration-line": import("../data/features.js").Feature; + "mdn-text-decoration-shorthand": import("../data/features.js").Feature; + "mdn-text-decoration-style": import("../data/features.js").Feature; + minmaxwh: import("../data/features.js").Feature; + multibackgrounds: import("../data/features.js").Feature; + multicolumn: import("../data/features.js").Feature; + "style-scoped": import("../data/features.js").Feature; + "svg-css": import("../data/features.js").Feature; + transforms2d: import("../data/features.js").Feature; + transforms3d: import("../data/features.js").Feature; + ttf: import("../data/features.js").Feature; + "user-select-none": import("../data/features.js").Feature; + "variable-fonts": import("../data/features.js").Feature; + "viewport-unit-variants": import("../data/features.js").Feature; + "viewport-units": import("../data/features.js").Feature; + wordwrap: import("../data/features.js").Feature; + }; + ignore: (keyof { + outline: import("../data/features.js").Feature; + "background-attachment": import("../data/features.js").Feature; + pointer: import("../data/features.js").Feature; + "flow-root": import("../data/features.js").Feature; + "font-kerning": import("../data/features.js").Feature; + "font-smooth": import("../data/features.js").Feature; + "font-variant-alternates": import("../data/features.js").Feature; + "font-variant-numeric": import("../data/features.js").Feature; + "inline-block": import("../data/features.js").Feature; + "prefers-color-scheme": import("../data/features.js").Feature; + "prefers-reduced-motion": import("../data/features.js").Feature; + rem: import("../data/features.js").Feature; + "run-in": import("../data/features.js").Feature; + "text-emphasis": import("../data/features.js").Feature; + "text-stroke": import("../data/features.js").Feature; + "webkit-user-drag": import("../data/features.js").Feature; + "border-image": import("../data/features.js").Feature; + "border-radius": import("../data/features.js").Feature; + "font-size-adjust": import("../data/features.js").Feature; + "text-decoration": import("../data/features.js").Feature; + "object-fit": import("../data/features.js").Feature; + "pointer-events": import("../data/features.js").Feature; + "text-overflow": import("../data/features.js").Feature; + "text-size-adjust": import("../data/features.js").Feature; + "will-change": import("../data/features.js").Feature; + "word-break": import("../data/features.js").Feature; + "alternate-stylesheet": import("../data/features.js").Feature; + "background-clip-text": import("../data/features.js").Feature; + "background-img-opts": import("../data/features.js").Feature; + "background-position-x-y": import("../data/features.js").Feature; + "background-repeat-round-space": import("../data/features.js").Feature; + calc: import("../data/features.js").Feature; + "ch-unit": import("../data/features.js").Feature; + "css-all": import("../data/features.js").Feature; + "css-animation": import("../data/features.js").Feature; + "css-any-link": import("../data/features.js").Feature; + "css-appearance": import("../data/features.js").Feature; + "css-at-counter-style": import("../data/features.js").Feature; + "css-autofill": import("../data/features.js").Feature; + "css-backdrop-filter": import("../data/features.js").Feature; + "css-background-offsets": import("../data/features.js").Feature; + "css-backgroundblendmode": import("../data/features.js").Feature; + "css-boxdecorationbreak": import("../data/features.js").Feature; + "css-boxshadow": import("../data/features.js").Feature; + "css-canvas": import("../data/features.js").Feature; + "css-caret-color": import("../data/features.js").Feature; + "css-cascade-layers": import("../data/features.js").Feature; + "css-case-insensitive": import("../data/features.js").Feature; + "css-clip-path": import("../data/features.js").Feature; + "css-color-adjust": import("../data/features.js").Feature; + "css-color-function": import("../data/features.js").Feature; + "css-conic-gradients": import("../data/features.js").Feature; + "css-container-queries": import("../data/features.js").Feature; + "css-container-queries-style": import("../data/features.js").Feature; + "css-container-query-units": import("../data/features.js").Feature; + "css-containment": import("../data/features.js").Feature; + "css-content-visibility": import("../data/features.js").Feature; + "css-counters": import("../data/features.js").Feature; + "css-crisp-edges": import("../data/features.js").Feature; + "css-cross-fade": import("../data/features.js").Feature; + "css-default-pseudo": import("../data/features.js").Feature; + "css-descendant-gtgt": import("../data/features.js").Feature; + "css-deviceadaptation": import("../data/features.js").Feature; + "css-dir-pseudo": import("../data/features.js").Feature; + "css-display-contents": import("../data/features.js").Feature; + "css-element-function": import("../data/features.js").Feature; + "css-env-function": import("../data/features.js").Feature; + "css-exclusions": import("../data/features.js").Feature; + "css-featurequeries": import("../data/features.js").Feature; + "css-file-selector-button": import("../data/features.js").Feature; + "css-filter-function": import("../data/features.js").Feature; + "css-filters": import("../data/features.js").Feature; + "css-first-letter": import("../data/features.js").Feature; + "css-first-line": import("../data/features.js").Feature; + "css-fixed": import("../data/features.js").Feature; + "css-focus-visible": import("../data/features.js").Feature; + "css-focus-within": import("../data/features.js").Feature; + "css-font-palette": import("../data/features.js").Feature; + "css-font-rendering-controls": import("../data/features.js").Feature; + "css-font-stretch": import("../data/features.js").Feature; + "css-gencontent": import("../data/features.js").Feature; + "css-gradients": import("../data/features.js").Feature; + "css-grid": import("../data/features.js").Feature; + "css-grid-animation": import("../data/features.js").Feature; + "css-hanging-punctuation": import("../data/features.js").Feature; + "css-has": import("../data/features.js").Feature; + "css-hyphens": import("../data/features.js").Feature; + "css-image-orientation": import("../data/features.js").Feature; + "css-image-set": import("../data/features.js").Feature; + "css-in-out-of-range": import("../data/features.js").Feature; + "css-indeterminate-pseudo": import("../data/features.js").Feature; + "css-initial-letter": import("../data/features.js").Feature; + "css-initial-value": import("../data/features.js").Feature; + "css-lch-lab": import("../data/features.js").Feature; + "css-letter-spacing": import("../data/features.js").Feature; + "css-line-clamp": import("../data/features.js").Feature; + "css-logical-props": import("../data/features.js").Feature; + "css-marker-pseudo": import("../data/features.js").Feature; + "css-masks": import("../data/features.js").Feature; + "css-matches-pseudo": import("../data/features.js").Feature; + "css-math-functions": import("../data/features.js").Feature; + "css-media-interaction": import("../data/features.js").Feature; + "css-media-range-syntax": import("../data/features.js").Feature; + "css-media-resolution": import("../data/features.js").Feature; + "css-media-scripting": import("../data/features.js").Feature; + "css-mediaqueries": import("../data/features.js").Feature; + "css-mixblendmode": import("../data/features.js").Feature; + "css-motion-paths": import("../data/features.js").Feature; + "css-namespaces": import("../data/features.js").Feature; + "css-nesting": import("../data/features.js").Feature; + "css-not-sel-list": import("../data/features.js").Feature; + "css-nth-child-of": import("../data/features.js").Feature; + "css-opacity": import("../data/features.js").Feature; + "css-optional-pseudo": import("../data/features.js").Feature; + "css-overflow": import("../data/features.js").Feature; + "css-overflow-anchor": import("../data/features.js").Feature; + "css-overflow-overlay": import("../data/features.js").Feature; + "css-overscroll-behavior": import("../data/features.js").Feature; + "css-page-break": import("../data/features.js").Feature; + "css-paged-media": import("../data/features.js").Feature; + "css-paint-api": import("../data/features.js").Feature; + "css-placeholder": import("../data/features.js").Feature; + "css-placeholder-shown": import("../data/features.js").Feature; + "css-print-color-adjust": import("../data/features.js").Feature; + "css-read-only-write": import("../data/features.js").Feature; + "css-rebeccapurple": import("../data/features.js").Feature; + "css-reflections": import("../data/features.js").Feature; + "css-regions": import("../data/features.js").Feature; + "css-relative-colors": import("../data/features.js").Feature; + "css-repeating-gradients": import("../data/features.js").Feature; + "css-resize": import("../data/features.js").Feature; + "css-revert-value": import("../data/features.js").Feature; + "css-rrggbbaa": import("../data/features.js").Feature; + "css-scroll-behavior": import("../data/features.js").Feature; + "css-scroll-timeline": import("../data/features.js").Feature; + "css-scrollbar": import("../data/features.js").Feature; + "css-sel2": import("../data/features.js").Feature; + "css-sel3": import("../data/features.js").Feature; + "css-selection": import("../data/features.js").Feature; + "css-shapes": import("../data/features.js").Feature; + "css-snappoints": import("../data/features.js").Feature; + "css-sticky": import("../data/features.js").Feature; + "css-subgrid": import("../data/features.js").Feature; + "css-supports-api": import("../data/features.js").Feature; + "css-table": import("../data/features.js").Feature; + "css-text-align-last": import("../data/features.js").Feature; + "css-text-box-trim": import("../data/features.js").Feature; + "css-text-indent": import("../data/features.js").Feature; + "css-text-justify": import("../data/features.js").Feature; + "css-text-orientation": import("../data/features.js").Feature; + "css-text-spacing": import("../data/features.js").Feature; + "css-textshadow": import("../data/features.js").Feature; + "css-touch-action": import("../data/features.js").Feature; + "css-transitions": import("../data/features.js").Feature; + "css-unicode-bidi": import("../data/features.js").Feature; + "css-unset-value": import("../data/features.js").Feature; + "css-variables": import("../data/features.js").Feature; + "css-when-else": import("../data/features.js").Feature; + "css-widows-orphans": import("../data/features.js").Feature; + "css-width-stretch": import("../data/features.js").Feature; + "css-writing-mode": import("../data/features.js").Feature; + "css-zoom": import("../data/features.js").Feature; + "css3-attr": import("../data/features.js").Feature; + "css3-boxsizing": import("../data/features.js").Feature; + "css3-colors": import("../data/features.js").Feature; + "css3-cursors": import("../data/features.js").Feature; + "css3-cursors-grab": import("../data/features.js").Feature; + "css3-cursors-newer": import("../data/features.js").Feature; + "css3-tabsize": import("../data/features.js").Feature; + currentcolor: import("../data/features.js").Feature; + devicepixelratio: import("../data/features.js").Feature; + "extended-system-fonts": import("../data/features.js").Feature; + flexbox: import("../data/features.js").Feature; + "flexbox-gap": import("../data/features.js").Feature; + "font-family-system-ui": import("../data/features.js").Feature; + "font-feature": import("../data/features.js").Feature; + "font-loading": import("../data/features.js").Feature; + "font-unicode-range": import("../data/features.js").Feature; + fontface: import("../data/features.js").Feature; + fullscreen: import("../data/features.js").Feature; + getcomputedstyle: import("../data/features.js").Feature; + "intrinsic-width": import("../data/features.js").Feature; + "justify-content-space-evenly": import("../data/features.js").Feature; + "kerning-pairs-ligatures": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-isolate-override": import("../data/features.js").Feature; + "mdn-css-unicode-bidi-plaintext": import("../data/features.js").Feature; + "mdn-text-decoration-color": import("../data/features.js").Feature; + "mdn-text-decoration-line": import("../data/features.js").Feature; + "mdn-text-decoration-shorthand": import("../data/features.js").Feature; + "mdn-text-decoration-style": import("../data/features.js").Feature; + minmaxwh: import("../data/features.js").Feature; + multibackgrounds: import("../data/features.js").Feature; + multicolumn: import("../data/features.js").Feature; + "style-scoped": import("../data/features.js").Feature; + "svg-css": import("../data/features.js").Feature; + transforms2d: import("../data/features.js").Feature; + transforms3d: import("../data/features.js").Feature; + ttf: import("../data/features.js").Feature; + "user-select-none": import("../data/features.js").Feature; + "variable-fonts": import("../data/features.js").Feature; + "viewport-unit-variants": import("../data/features.js").Feature; + "viewport-units": import("../data/features.js").Feature; + wordwrap: import("../data/features.js").Feature; + } & string)[]; +}; +export type DetectorCallback = (result: DetectorCallbackArgument) => any; diff --git a/node_modules/doiuse/types/lib/DoIUse.d.ts b/node_modules/doiuse/types/lib/DoIUse.d.ts new file mode 100644 index 00000000..491be904 --- /dev/null +++ b/node_modules/doiuse/types/lib/DoIUse.d.ts @@ -0,0 +1,56 @@ +/** @typedef {import('../data/features.js').FeatureKeys} FeatureKeys */ +/** + * @typedef {Object} OnFeatureUsageArguments + * @prop {FeatureKeys} feature + * @prop {import('./BrowserSelection.js').MissingSupportResultStats|undefined} featureData + * @prop {import('postcss').Node} usage + * @prop {string} message + */ +/** + * @callback OnFeatureUsage + * @param {OnFeatureUsageArguments} result + * @return {any} + */ +/** + * @typedef {Object} DoIUseOptions + * @prop {ConstructorParameters<typeof BrowserSelection>[0]} [browsers] + * @prop {FeatureKeys[]} [ignore] + * @prop {OnFeatureUsage} [onFeatureUsage] + * @prop {string[]} [ignoreFiles] + */ +export default class DoIUse { + static default: any; + /** + * @param {DoIUseOptions} [optionsOrBrowserQuery] + */ + constructor(optionsOrBrowserQuery?: DoIUseOptions); + browserQuery: string | string[]; + onFeatureUsage: OnFeatureUsage; + ignoreOptions: ("outline" | "background-attachment" | "pointer" | "flow-root" | "font-kerning" | "font-smooth" | "font-variant-alternates" | "font-variant-numeric" | "inline-block" | "prefers-color-scheme" | "prefers-reduced-motion" | "rem" | "run-in" | "text-emphasis" | "text-stroke" | "webkit-user-drag" | "border-image" | "border-radius" | "font-size-adjust" | "text-decoration" | "object-fit" | "pointer-events" | "text-overflow" | "text-size-adjust" | "will-change" | "word-break" | "alternate-stylesheet" | "background-clip-text" | "background-img-opts" | "background-position-x-y" | "background-repeat-round-space" | "calc" | "ch-unit" | "css-all" | "css-animation" | "css-any-link" | "css-appearance" | "css-at-counter-style" | "css-autofill" | "css-backdrop-filter" | "css-background-offsets" | "css-backgroundblendmode" | "css-boxdecorationbreak" | "css-boxshadow" | "css-canvas" | "css-caret-color" | "css-cascade-layers" | "css-case-insensitive" | "css-clip-path" | "css-color-adjust" | "css-color-function" | "css-conic-gradients" | "css-container-queries" | "css-container-queries-style" | "css-container-query-units" | "css-containment" | "css-content-visibility" | "css-counters" | "css-crisp-edges" | "css-cross-fade" | "css-default-pseudo" | "css-descendant-gtgt" | "css-deviceadaptation" | "css-dir-pseudo" | "css-display-contents" | "css-element-function" | "css-env-function" | "css-exclusions" | "css-featurequeries" | "css-file-selector-button" | "css-filter-function" | "css-filters" | "css-first-letter" | "css-first-line" | "css-fixed" | "css-focus-visible" | "css-focus-within" | "css-font-palette" | "css-font-rendering-controls" | "css-font-stretch" | "css-gencontent" | "css-gradients" | "css-grid" | "css-grid-animation" | "css-hanging-punctuation" | "css-has" | "css-hyphens" | "css-image-orientation" | "css-image-set" | "css-in-out-of-range" | "css-indeterminate-pseudo" | "css-initial-letter" | "css-initial-value" | "css-lch-lab" | "css-letter-spacing" | "css-line-clamp" | "css-logical-props" | "css-marker-pseudo" | "css-masks" | "css-matches-pseudo" | "css-math-functions" | "css-media-interaction" | "css-media-range-syntax" | "css-media-resolution" | "css-media-scripting" | "css-mediaqueries" | "css-mixblendmode" | "css-motion-paths" | "css-namespaces" | "css-nesting" | "css-not-sel-list" | "css-nth-child-of" | "css-opacity" | "css-optional-pseudo" | "css-overflow" | "css-overflow-anchor" | "css-overflow-overlay" | "css-overscroll-behavior" | "css-page-break" | "css-paged-media" | "css-paint-api" | "css-placeholder" | "css-placeholder-shown" | "css-print-color-adjust" | "css-read-only-write" | "css-rebeccapurple" | "css-reflections" | "css-regions" | "css-relative-colors" | "css-repeating-gradients" | "css-resize" | "css-revert-value" | "css-rrggbbaa" | "css-scroll-behavior" | "css-scroll-timeline" | "css-scrollbar" | "css-sel2" | "css-sel3" | "css-selection" | "css-shapes" | "css-snappoints" | "css-sticky" | "css-subgrid" | "css-supports-api" | "css-table" | "css-text-align-last" | "css-text-box-trim" | "css-text-indent" | "css-text-justify" | "css-text-orientation" | "css-text-spacing" | "css-textshadow" | "css-touch-action" | "css-transitions" | "css-unicode-bidi" | "css-unset-value" | "css-variables" | "css-when-else" | "css-widows-orphans" | "css-width-stretch" | "css-writing-mode" | "css-zoom" | "css3-attr" | "css3-boxsizing" | "css3-colors" | "css3-cursors" | "css3-cursors-grab" | "css3-cursors-newer" | "css3-tabsize" | "currentcolor" | "devicepixelratio" | "extended-system-fonts" | "flexbox" | "flexbox-gap" | "font-family-system-ui" | "font-feature" | "font-loading" | "font-unicode-range" | "fontface" | "fullscreen" | "getcomputedstyle" | "intrinsic-width" | "justify-content-space-evenly" | "kerning-pairs-ligatures" | "mdn-css-unicode-bidi-isolate" | "mdn-css-unicode-bidi-isolate-override" | "mdn-css-unicode-bidi-plaintext" | "mdn-text-decoration-color" | "mdn-text-decoration-line" | "mdn-text-decoration-shorthand" | "mdn-text-decoration-style" | "minmaxwh" | "multibackgrounds" | "multicolumn" | "style-scoped" | "svg-css" | "transforms2d" | "transforms3d" | "ttf" | "user-select-none" | "variable-fonts" | "viewport-unit-variants" | "viewport-units" | "wordwrap")[]; + ignoreFiles: string[]; + /** + * @param {Object} [options] + * @param {ConstructorParameters<typeof BrowserSelection>[1]} [options.from] + */ + info(options?: { + from?: [query?: string | string[], from?: string | false][1]; + }): { + browsers: string[][]; + features: Partial<Record<"outline" | "background-attachment" | "pointer" | "flow-root" | "font-kerning" | "font-smooth" | "font-variant-alternates" | "font-variant-numeric" | "inline-block" | "prefers-color-scheme" | "prefers-reduced-motion" | "rem" | "run-in" | "text-emphasis" | "text-stroke" | "webkit-user-drag" | "border-image" | "border-radius" | "font-size-adjust" | "text-decoration" | "object-fit" | "pointer-events" | "text-overflow" | "text-size-adjust" | "will-change" | "word-break" | "alternate-stylesheet" | "background-clip-text" | "background-img-opts" | "background-position-x-y" | "background-repeat-round-space" | "calc" | "ch-unit" | "css-all" | "css-animation" | "css-any-link" | "css-appearance" | "css-at-counter-style" | "css-autofill" | "css-backdrop-filter" | "css-background-offsets" | "css-backgroundblendmode" | "css-boxdecorationbreak" | "css-boxshadow" | "css-canvas" | "css-caret-color" | "css-cascade-layers" | "css-case-insensitive" | "css-clip-path" | "css-color-adjust" | "css-color-function" | "css-conic-gradients" | "css-container-queries" | "css-container-queries-style" | "css-container-query-units" | "css-containment" | "css-content-visibility" | "css-counters" | "css-crisp-edges" | "css-cross-fade" | "css-default-pseudo" | "css-descendant-gtgt" | "css-deviceadaptation" | "css-dir-pseudo" | "css-display-contents" | "css-element-function" | "css-env-function" | "css-exclusions" | "css-featurequeries" | "css-file-selector-button" | "css-filter-function" | "css-filters" | "css-first-letter" | "css-first-line" | "css-fixed" | "css-focus-visible" | "css-focus-within" | "css-font-palette" | "css-font-rendering-controls" | "css-font-stretch" | "css-gencontent" | "css-gradients" | "css-grid" | "css-grid-animation" | "css-hanging-punctuation" | "css-has" | "css-hyphens" | "css-image-orientation" | "css-image-set" | "css-in-out-of-range" | "css-indeterminate-pseudo" | "css-initial-letter" | "css-initial-value" | "css-lch-lab" | "css-letter-spacing" | "css-line-clamp" | "css-logical-props" | "css-marker-pseudo" | "css-masks" | "css-matches-pseudo" | "css-math-functions" | "css-media-interaction" | "css-media-range-syntax" | "css-media-resolution" | "css-media-scripting" | "css-mediaqueries" | "css-mixblendmode" | "css-motion-paths" | "css-namespaces" | "css-nesting" | "css-not-sel-list" | "css-nth-child-of" | "css-opacity" | "css-optional-pseudo" | "css-overflow" | "css-overflow-anchor" | "css-overflow-overlay" | "css-overscroll-behavior" | "css-page-break" | "css-paged-media" | "css-paint-api" | "css-placeholder" | "css-placeholder-shown" | "css-print-color-adjust" | "css-read-only-write" | "css-rebeccapurple" | "css-reflections" | "css-regions" | "css-relative-colors" | "css-repeating-gradients" | "css-resize" | "css-revert-value" | "css-rrggbbaa" | "css-scroll-behavior" | "css-scroll-timeline" | "css-scrollbar" | "css-sel2" | "css-sel3" | "css-selection" | "css-shapes" | "css-snappoints" | "css-sticky" | "css-subgrid" | "css-supports-api" | "css-table" | "css-text-align-last" | "css-text-box-trim" | "css-text-indent" | "css-text-justify" | "css-text-orientation" | "css-text-spacing" | "css-textshadow" | "css-touch-action" | "css-transitions" | "css-unicode-bidi" | "css-unset-value" | "css-variables" | "css-when-else" | "css-widows-orphans" | "css-width-stretch" | "css-writing-mode" | "css-zoom" | "css3-attr" | "css3-boxsizing" | "css3-colors" | "css3-cursors" | "css3-cursors-grab" | "css3-cursors-newer" | "css3-tabsize" | "currentcolor" | "devicepixelratio" | "extended-system-fonts" | "flexbox" | "flexbox-gap" | "font-family-system-ui" | "font-feature" | "font-loading" | "font-unicode-range" | "fontface" | "fullscreen" | "getcomputedstyle" | "intrinsic-width" | "justify-content-space-evenly" | "kerning-pairs-ligatures" | "mdn-css-unicode-bidi-isolate" | "mdn-css-unicode-bidi-isolate-override" | "mdn-css-unicode-bidi-plaintext" | "mdn-text-decoration-color" | "mdn-text-decoration-line" | "mdn-text-decoration-shorthand" | "mdn-text-decoration-style" | "minmaxwh" | "multibackgrounds" | "multicolumn" | "style-scoped" | "svg-css" | "transforms2d" | "transforms3d" | "ttf" | "user-select-none" | "variable-fonts" | "viewport-unit-variants" | "viewport-units" | "wordwrap", import("./BrowserSelection.js").MissingSupportResultStats>>; + }; + postcss(root: import("postcss/lib/root.js").default, result: import("postcss/lib/result.js").default): void | Promise<void>; +} +export type FeatureKeys = import('../data/features.js').FeatureKeys; +export type OnFeatureUsageArguments = { + feature: FeatureKeys; + featureData: import('./BrowserSelection.js').MissingSupportResultStats | undefined; + usage: import('postcss').Node; + message: string; +}; +export type OnFeatureUsage = (result: OnFeatureUsageArguments) => any; +export type DoIUseOptions = { + browsers?: [query?: string | string[], from?: string | false][0]; + ignore?: FeatureKeys[]; + onFeatureUsage?: OnFeatureUsage; + ignoreFiles?: string[]; +}; diff --git a/node_modules/doiuse/types/lib/stream/CssUsageDuplex.d.ts b/node_modules/doiuse/types/lib/stream/CssUsageDuplex.d.ts new file mode 100644 index 00000000..4b977cb3 --- /dev/null +++ b/node_modules/doiuse/types/lib/stream/CssUsageDuplex.d.ts @@ -0,0 +1,17 @@ +/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */ +export default class CssUsageDuplex extends Duplexify.Duplexify { + /** + * @param {Object} options + * @param {string} options.browsers + * @param {FeatureKeys[]} [options.ignore] + * @param {boolean} [options.skipErrors] + * @param {string} [filename] Filename for outputting source code locations. + */ + constructor(options: { + browsers: string; + ignore?: FeatureKeys[]; + skipErrors?: boolean; + }, filename?: string); +} +export type FeatureKeys = import('../../data/features.js').FeatureKeys; +import Duplexify from 'duplexify'; diff --git a/node_modules/doiuse/types/lib/stream/RuleUsageTransform.d.ts b/node_modules/doiuse/types/lib/stream/RuleUsageTransform.d.ts new file mode 100644 index 00000000..dc2c0259 --- /dev/null +++ b/node_modules/doiuse/types/lib/stream/RuleUsageTransform.d.ts @@ -0,0 +1,26 @@ +/** @typedef {import('../../data/features.js').FeatureKeys} FeatureKeys */ +/** @typedef {import('./SourceMapTransform.js').SourceMapTransformation} SourceMapTransformation */ +export default class RuleUsageTransform extends Transform { + /** + * @param {Object} options + * @param {string} options.browsers + * @param {FeatureKeys[]} [options.ignore] + * @param {boolean} [options.skipErrors] + * @param {string} [filename] Filename for outputting source code locations. + */ + constructor(options: { + browsers: string; + ignore?: FeatureKeys[]; + skipErrors?: boolean; + }, filename?: string); + /** + * @param {SourceMapTransformation} rule + * @param {any} encoding + * @param {Function} callback + */ + _transform(rule: SourceMapTransformation, encoding: any, callback: Function): Promise<void>; + #private; +} +export type FeatureKeys = import('../../data/features.js').FeatureKeys; +export type SourceMapTransformation = import('./SourceMapTransform.js').SourceMapTransformation; +import { Transform } from 'node:stream'; diff --git a/node_modules/doiuse/types/lib/stream/SourceMapTransform.d.ts b/node_modules/doiuse/types/lib/stream/SourceMapTransform.d.ts new file mode 100644 index 00000000..f7bb4800 --- /dev/null +++ b/node_modules/doiuse/types/lib/stream/SourceMapTransform.d.ts @@ -0,0 +1,22 @@ +/** + * @typedef {Object} SourceMapTransformation + * @prop {number} line + * @prop {number} column + * @prop {string} content + */ +export default class SourceMapTransform extends Transform { + constructor(); + /** + * @param {[string,Buffer]} chunk + * @param {any} encoding + * @param {Function} callback + */ + _transform([type, buf]: [string, Buffer], encoding: any, callback: Function): void; + #private; +} +export type SourceMapTransformation = { + line: number; + column: number; + content: string; +}; +import { Transform } from 'node:stream'; diff --git a/node_modules/doiuse/types/scripts/update-features.d.ts b/node_modules/doiuse/types/scripts/update-features.d.ts new file mode 100644 index 00000000..6370e8f8 --- /dev/null +++ b/node_modules/doiuse/types/scripts/update-features.d.ts @@ -0,0 +1,7 @@ +#!/usr/bin/env node +export type StubOptions = { + id: string; + name: string; + description: string; + link: string; +}; diff --git a/node_modules/doiuse/types/test/caniuse-lite.d.ts b/node_modules/doiuse/types/test/caniuse-lite.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/doiuse/types/test/caniuse-lite.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/doiuse/types/test/cli.d.ts b/node_modules/doiuse/types/test/cli.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/doiuse/types/test/cli.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/doiuse/types/test/css-rule-stream.d.ts b/node_modules/doiuse/types/test/css-rule-stream.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/doiuse/types/test/css-rule-stream.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/doiuse/types/test/detect-feature-use.d.ts b/node_modules/doiuse/types/test/detect-feature-use.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/doiuse/types/test/detect-feature-use.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/doiuse/types/test/missing-support.d.ts b/node_modules/doiuse/types/test/missing-support.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/doiuse/types/test/missing-support.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/doiuse/types/test/postcss-plugin.d.ts b/node_modules/doiuse/types/test/postcss-plugin.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/doiuse/types/test/postcss-plugin.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/doiuse/types/test/regex.d.ts b/node_modules/doiuse/types/test/regex.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/doiuse/types/test/regex.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/doiuse/types/test/stream.d.ts b/node_modules/doiuse/types/test/stream.d.ts new file mode 100644 index 00000000..cb0ff5c3 --- /dev/null +++ b/node_modules/doiuse/types/test/stream.d.ts @@ -0,0 +1 @@ +export {}; diff --git a/node_modules/doiuse/types/test/utils.d.ts b/node_modules/doiuse/types/test/utils.d.ts new file mode 100644 index 00000000..48ed3372 --- /dev/null +++ b/node_modules/doiuse/types/test/utils.d.ts @@ -0,0 +1,7 @@ +/** + * @template {Object} T + * @param {Tap.Test} t + * @param {T} object + * @param {(keyof T)[]} keys + */ +export function hasKeys<T extends unknown>(t: Tap.Test, object: T, keys: (keyof T)[]): boolean; diff --git a/node_modules/doiuse/types/utils/getFiles.d.ts b/node_modules/doiuse/types/utils/getFiles.d.ts new file mode 100644 index 00000000..09b1b1df --- /dev/null +++ b/node_modules/doiuse/types/utils/getFiles.d.ts @@ -0,0 +1,7 @@ +/** + * recursively get all files in a directory + * @param {string} directory the directory to read + * @yields {string} the path to each file + * @return {AsyncGenerator<string>} the path to each file + */ +export function getFiles(directory: string): AsyncGenerator<string>; diff --git a/node_modules/doiuse/types/utils/kebabToCamel.d.ts b/node_modules/doiuse/types/utils/kebabToCamel.d.ts new file mode 100644 index 00000000..398896c0 --- /dev/null +++ b/node_modules/doiuse/types/utils/kebabToCamel.d.ts @@ -0,0 +1,6 @@ +/** + * given a kebab-case string, returns a camelCase string + * @param {string} kebab the kebab-case string + * @return {string} the camelCase string + */ +export function kebabToCamel(kebab: string): string; diff --git a/node_modules/doiuse/types/utils/util.d.ts b/node_modules/doiuse/types/utils/util.d.ts new file mode 100644 index 00000000..c62d04ca --- /dev/null +++ b/node_modules/doiuse/types/utils/util.d.ts @@ -0,0 +1,32 @@ +/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */ +/** + * @param {string} browserKey + * @param {string[]} [versions] + * @return {string} + */ +export function formatBrowserName(browserKey: string, versions?: string[]): string; +/** + * + * @param {FeatureCheck|FeatureCheck[]} check + * @param {?string|undefined} candidate + */ +export function performFeatureCheck(check: FeatureCheck | FeatureCheck[], candidate: (string | undefined) | null): any; +/** + * @param {FeatureCheck|FeatureCheck[]} selector + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +export function checkSelector(selector: FeatureCheck | FeatureCheck[]): (rule: import('postcss').ChildNode) => boolean; +/** + * @param {FeatureCheck|FeatureCheck[]} [name] + * @param {FeatureCheck|FeatureCheck[]} [parameters] + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +export function checkAtRule(name?: FeatureCheck | FeatureCheck[], parameters?: FeatureCheck | FeatureCheck[]): (rule: import('postcss').ChildNode) => boolean; +/** + * @see https://drafts.csswg.org/css-values/#lengths + * @see https://drafts.csswg.org/css-values/#number-value + * @param {string[]} units + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +export function checkCSSLengthUnits(...units: string[]): (rule: import('postcss').ChildNode) => boolean; +export type FeatureCheck = string | RegExp | ((value: string) => boolean); diff --git a/node_modules/doiuse/utils/getFiles.js b/node_modules/doiuse/utils/getFiles.js new file mode 100644 index 00000000..3e939420 --- /dev/null +++ b/node_modules/doiuse/utils/getFiles.js @@ -0,0 +1,19 @@ +import { readdir } from 'node:fs/promises'; +import { resolve } from 'node:path'; + +/** + * recursively get all files in a directory + * @param {string} directory the directory to read + * @yields {string} the path to each file + * @return {AsyncGenerator<string>} the path to each file + */ +export async function* getFiles(directory) { + for (const entry of await readdir(directory, { withFileTypes: true })) { + const path = resolve(directory, entry.name); + if (entry.isDirectory()) { + yield* getFiles(path); + } else { + yield path; + } + } +} diff --git a/node_modules/doiuse/utils/kebabToCamel.js b/node_modules/doiuse/utils/kebabToCamel.js new file mode 100644 index 00000000..c7237c3c --- /dev/null +++ b/node_modules/doiuse/utils/kebabToCamel.js @@ -0,0 +1,8 @@ +/** + * given a kebab-case string, returns a camelCase string + * @param {string} kebab the kebab-case string + * @return {string} the camelCase string + */ +export function kebabToCamel(kebab) { + return kebab.replaceAll(/-([a-z])/g, (match, letter) => letter.toUpperCase()); +} diff --git a/node_modules/doiuse/utils/util.js b/node_modules/doiuse/utils/util.js new file mode 100644 index 00000000..e9b323e9 --- /dev/null +++ b/node_modules/doiuse/utils/util.js @@ -0,0 +1,79 @@ +import { agents } from 'caniuse-lite'; + +/** @typedef {RegExp|string|((value:string) => boolean)} FeatureCheck */ + +/** + * @param {string} browserKey + * @param {string[]} [versions] + * @return {string} + */ +export function formatBrowserName(browserKey, versions) { + const entry = agents[browserKey]; + const browserName = entry ? entry.browser : null; + if (!versions) { + return browserName || ''; + } + return (`${browserName} (${versions.join(',')})`); +} + +/** + * + * @param {FeatureCheck|FeatureCheck[]} check + * @param {?string|undefined} candidate + */ +export function performFeatureCheck(check, candidate) { + if (check == null || candidate == null) return false; + if (check instanceof RegExp) { + return check.test(candidate); + } + switch (typeof check) { + case 'string': + return candidate.includes(check); + case 'function': + return check(candidate); + case 'boolean': + return check; + case 'object': + if (Array.isArray(check)) { + return check.some((c) => performFeatureCheck(c, candidate)); + } + // Fallthrough + default: + console.error(check); + throw new TypeError(`Unexpected feature check: ${check}`); + } +} + +/** + * @param {FeatureCheck|FeatureCheck[]} selector + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +export function checkSelector(selector) { + return (rule) => rule.type === 'rule' + && performFeatureCheck(selector, rule.selector); +} + +/** + * @param {FeatureCheck|FeatureCheck[]} [name] + * @param {FeatureCheck|FeatureCheck[]} [parameters] + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +export function checkAtRule(name, parameters) { + return (rule) => rule.type === 'atrule' + && performFeatureCheck(name, rule.name) + && (!parameters || performFeatureCheck(parameters, rule.params)); +} + +/** + * @see https://drafts.csswg.org/css-values/#lengths + * @see https://drafts.csswg.org/css-values/#number-value + * @param {string[]} units + * @return {(rule:import('postcss').ChildNode) => boolean} + */ +export function checkCSSLengthUnits(...units) { + const regexp = new RegExp(`(\\+-)?[\\d.]*\\.?\\d+(e(\\+-)?\\d+)?(${units.join('|')})`, 'i'); + return (rule) => ( + (rule.type === 'decl') ? performFeatureCheck(regexp, rule.value) + : ((rule.type === 'atrule') ? performFeatureCheck(regexp, rule.params) + : false)); +} diff --git a/node_modules/duplexify/.travis.yml b/node_modules/duplexify/.travis.yml new file mode 100644 index 00000000..37494af3 --- /dev/null +++ b/node_modules/duplexify/.travis.yml @@ -0,0 +1,9 @@ +language: node_js +arch: + - amd64 + - ppc64le +node_js: + - "4" + - "6" + - "8" + - "10" diff --git a/node_modules/duplexify/LICENSE b/node_modules/duplexify/LICENSE new file mode 100644 index 00000000..757562ec --- /dev/null +++ b/node_modules/duplexify/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Mathias Buus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.
\ No newline at end of file diff --git a/node_modules/duplexify/README.md b/node_modules/duplexify/README.md new file mode 100644 index 00000000..8352900f --- /dev/null +++ b/node_modules/duplexify/README.md @@ -0,0 +1,97 @@ +# duplexify + +Turn a writeable and readable stream into a single streams2 duplex stream. + +Similar to [duplexer2](https://github.com/deoxxa/duplexer2) except it supports both streams2 and streams1 as input +and it allows you to set the readable and writable part asynchronously using `setReadable(stream)` and `setWritable(stream)` + +``` +npm install duplexify +``` + +[](http://travis-ci.org/mafintosh/duplexify) + +## Usage + +Use `duplexify(writable, readable, streamOptions)` (or `duplexify.obj(writable, readable)` to create an object stream) + +``` js +var duplexify = require('duplexify') + +// turn writableStream and readableStream into a single duplex stream +var dup = duplexify(writableStream, readableStream) + +dup.write('hello world') // will write to writableStream +dup.on('data', function(data) { + // will read from readableStream +}) +``` + +You can also set the readable and writable parts asynchronously + +``` js +var dup = duplexify() + +dup.write('hello world') // write will buffer until the writable + // part has been set + +// wait a bit ... +dup.setReadable(readableStream) + +// maybe wait some more? +dup.setWritable(writableStream) +``` + +If you call `setReadable` or `setWritable` multiple times it will unregister the previous readable/writable stream. +To disable the readable or writable part call `setReadable` or `setWritable` with `null`. + +If the readable or writable streams emits an error or close it will destroy both streams and bubble up the event. +You can also explicitly destroy the streams by calling `dup.destroy()`. The `destroy` method optionally takes an +error object as argument, in which case the error is emitted as part of the `error` event. + +``` js +dup.on('error', function(err) { + console.log('readable or writable emitted an error - close will follow') +}) + +dup.on('close', function() { + console.log('the duplex stream is destroyed') +}) + +dup.destroy() // calls destroy on the readable and writable part (if present) +``` + +## HTTP request example + +Turn a node core http request into a duplex stream is as easy as + +``` js +var duplexify = require('duplexify') +var http = require('http') + +var request = function(opts) { + var req = http.request(opts) + var dup = duplexify(req) + req.on('response', function(res) { + dup.setReadable(res) + }) + return dup +} + +var req = request({ + method: 'GET', + host: 'www.google.com', + port: 80 +}) + +req.end() +req.pipe(process.stdout) +``` + +## License + +MIT + +## Related + +`duplexify` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one. diff --git a/node_modules/duplexify/example.js b/node_modules/duplexify/example.js new file mode 100644 index 00000000..5585c197 --- /dev/null +++ b/node_modules/duplexify/example.js @@ -0,0 +1,21 @@ +var duplexify = require('duplexify') +var http = require('http') + +var request = function(opts) { + var req = http.request(opts) + var dup = duplexify() + dup.setWritable(req) + req.on('response', function(res) { + dup.setReadable(res) + }) + return dup +} + +var req = request({ + method: 'GET', + host: 'www.google.com', + port: 80 +}) + +req.end() +req.pipe(process.stdout) diff --git a/node_modules/duplexify/index.js b/node_modules/duplexify/index.js new file mode 100644 index 00000000..3430fe46 --- /dev/null +++ b/node_modules/duplexify/index.js @@ -0,0 +1,238 @@ +var stream = require('readable-stream') +var eos = require('end-of-stream') +var inherits = require('inherits') +var shift = require('stream-shift') + +var SIGNAL_FLUSH = (Buffer.from && Buffer.from !== Uint8Array.from) + ? Buffer.from([0]) + : new Buffer([0]) + +var onuncork = function(self, fn) { + if (self._corked) self.once('uncork', fn) + else fn() +} + +var autoDestroy = function (self, err) { + if (self._autoDestroy) self.destroy(err) +} + +var destroyer = function(self, end) { + return function(err) { + if (err) autoDestroy(self, err.message === 'premature close' ? null : err) + else if (end && !self._ended) self.end() + } +} + +var end = function(ws, fn) { + if (!ws) return fn() + if (ws._writableState && ws._writableState.finished) return fn() + if (ws._writableState) return ws.end(fn) + ws.end() + fn() +} + +var noop = function() {} + +var toStreams2 = function(rs) { + return new (stream.Readable)({objectMode:true, highWaterMark:16}).wrap(rs) +} + +var Duplexify = function(writable, readable, opts) { + if (!(this instanceof Duplexify)) return new Duplexify(writable, readable, opts) + stream.Duplex.call(this, opts) + + this._writable = null + this._readable = null + this._readable2 = null + + this._autoDestroy = !opts || opts.autoDestroy !== false + this._forwardDestroy = !opts || opts.destroy !== false + this._forwardEnd = !opts || opts.end !== false + this._corked = 1 // start corked + this._ondrain = null + this._drained = false + this._forwarding = false + this._unwrite = null + this._unread = null + this._ended = false + + this.destroyed = false + + if (writable) this.setWritable(writable) + if (readable) this.setReadable(readable) +} + +inherits(Duplexify, stream.Duplex) + +Duplexify.obj = function(writable, readable, opts) { + if (!opts) opts = {} + opts.objectMode = true + opts.highWaterMark = 16 + return new Duplexify(writable, readable, opts) +} + +Duplexify.prototype.cork = function() { + if (++this._corked === 1) this.emit('cork') +} + +Duplexify.prototype.uncork = function() { + if (this._corked && --this._corked === 0) this.emit('uncork') +} + +Duplexify.prototype.setWritable = function(writable) { + if (this._unwrite) this._unwrite() + + if (this.destroyed) { + if (writable && writable.destroy) writable.destroy() + return + } + + if (writable === null || writable === false) { + this.end() + return + } + + var self = this + var unend = eos(writable, {writable:true, readable:false}, destroyer(this, this._forwardEnd)) + + var ondrain = function() { + var ondrain = self._ondrain + self._ondrain = null + if (ondrain) ondrain() + } + + var clear = function() { + self._writable.removeListener('drain', ondrain) + unend() + } + + if (this._unwrite) process.nextTick(ondrain) // force a drain on stream reset to avoid livelocks + + this._writable = writable + this._writable.on('drain', ondrain) + this._unwrite = clear + + this.uncork() // always uncork setWritable +} + +Duplexify.prototype.setReadable = function(readable) { + if (this._unread) this._unread() + + if (this.destroyed) { + if (readable && readable.destroy) readable.destroy() + return + } + + if (readable === null || readable === false) { + this.push(null) + this.resume() + return + } + + var self = this + var unend = eos(readable, {writable:false, readable:true}, destroyer(this)) + + var onreadable = function() { + self._forward() + } + + var onend = function() { + self.push(null) + } + + var clear = function() { + self._readable2.removeListener('readable', onreadable) + self._readable2.removeListener('end', onend) + unend() + } + + this._drained = true + this._readable = readable + this._readable2 = readable._readableState ? readable : toStreams2(readable) + this._readable2.on('readable', onreadable) + this._readable2.on('end', onend) + this._unread = clear + + this._forward() +} + +Duplexify.prototype._read = function() { + this._drained = true + this._forward() +} + +Duplexify.prototype._forward = function() { + if (this._forwarding || !this._readable2 || !this._drained) return + this._forwarding = true + + var data + + while (this._drained && (data = shift(this._readable2)) !== null) { + if (this.destroyed) continue + this._drained = this.push(data) + } + + this._forwarding = false +} + +Duplexify.prototype.destroy = function(err, cb) { + if (!cb) cb = noop + if (this.destroyed) return cb(null) + this.destroyed = true + + var self = this + process.nextTick(function() { + self._destroy(err) + cb(null) + }) +} + +Duplexify.prototype._destroy = function(err) { + if (err) { + var ondrain = this._ondrain + this._ondrain = null + if (ondrain) ondrain(err) + else this.emit('error', err) + } + + if (this._forwardDestroy) { + if (this._readable && this._readable.destroy) this._readable.destroy() + if (this._writable && this._writable.destroy) this._writable.destroy() + } + + this.emit('close') +} + +Duplexify.prototype._write = function(data, enc, cb) { + if (this.destroyed) return + if (this._corked) return onuncork(this, this._write.bind(this, data, enc, cb)) + if (data === SIGNAL_FLUSH) return this._finish(cb) + if (!this._writable) return cb() + + if (this._writable.write(data) === false) this._ondrain = cb + else if (!this.destroyed) cb() +} + +Duplexify.prototype._finish = function(cb) { + var self = this + this.emit('preend') + onuncork(this, function() { + end(self._forwardEnd && self._writable, function() { + // haxx to not emit prefinish twice + if (self._writableState.prefinished === false) self._writableState.prefinished = true + self.emit('prefinish') + onuncork(self, cb) + }) + }) +} + +Duplexify.prototype.end = function(data, enc, cb) { + if (typeof data === 'function') return this.end(null, null, data) + if (typeof enc === 'function') return this.end(data, null, enc) + this._ended = true + if (data) this.write(data) + if (!this._writableState.ending && !this._writableState.destroyed) this.write(SIGNAL_FLUSH) + return stream.Writable.prototype.end.call(this, cb) +} + +module.exports = Duplexify diff --git a/node_modules/duplexify/node_modules/readable-stream/CONTRIBUTING.md b/node_modules/duplexify/node_modules/readable-stream/CONTRIBUTING.md new file mode 100644 index 00000000..f478d58d --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +* (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +* (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +* (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +* (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +## Moderation Policy + +The [Node.js Moderation Policy] applies to this WG. + +## Code of Conduct + +The [Node.js Code of Conduct][] applies to this WG. + +[Node.js Code of Conduct]: +https://github.com/nodejs/node/blob/master/CODE_OF_CONDUCT.md +[Node.js Moderation Policy]: +https://github.com/nodejs/TSC/blob/master/Moderation-Policy.md diff --git a/node_modules/duplexify/node_modules/readable-stream/GOVERNANCE.md b/node_modules/duplexify/node_modules/readable-stream/GOVERNANCE.md new file mode 100644 index 00000000..16ffb93f --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/GOVERNANCE.md @@ -0,0 +1,136 @@ +### Streams Working Group + +The Node.js Streams is jointly governed by a Working Group +(WG) +that is responsible for high-level guidance of the project. + +The WG has final authority over this project including: + +* Technical direction +* Project governance and process (including this policy) +* Contribution policy +* GitHub repository hosting +* Conduct guidelines +* Maintaining the list of additional Collaborators + +For the current list of WG members, see the project +[README.md](./README.md#current-project-team-members). + +### Collaborators + +The readable-stream GitHub repository is +maintained by the WG and additional Collaborators who are added by the +WG on an ongoing basis. + +Individuals making significant and valuable contributions are made +Collaborators and given commit-access to the project. These +individuals are identified by the WG and their addition as +Collaborators is discussed during the WG meeting. + +_Note:_ If you make a significant contribution and are not considered +for commit-access log an issue or contact a WG member directly and it +will be brought up in the next WG meeting. + +Modifications of the contents of the readable-stream repository are +made on +a collaborative basis. Anybody with a GitHub account may propose a +modification via pull request and it will be considered by the project +Collaborators. All pull requests must be reviewed and accepted by a +Collaborator with sufficient expertise who is able to take full +responsibility for the change. In the case of pull requests proposed +by an existing Collaborator, an additional Collaborator is required +for sign-off. Consensus should be sought if additional Collaborators +participate and there is disagreement around a particular +modification. See _Consensus Seeking Process_ below for further detail +on the consensus model used for governance. + +Collaborators may opt to elevate significant or controversial +modifications, or modifications that have not found consensus to the +WG for discussion by assigning the ***WG-agenda*** tag to a pull +request or issue. The WG should serve as the final arbiter where +required. + +For the current list of Collaborators, see the project +[README.md](./README.md#members). + +### WG Membership + +WG seats are not time-limited. There is no fixed size of the WG. +However, the expected target is between 6 and 12, to ensure adequate +coverage of important areas of expertise, balanced with the ability to +make decisions efficiently. + +There is no specific set of requirements or qualifications for WG +membership beyond these rules. + +The WG may add additional members to the WG by unanimous consensus. + +A WG member may be removed from the WG by voluntary resignation, or by +unanimous consensus of all other WG members. + +Changes to WG membership should be posted in the agenda, and may be +suggested as any other agenda item (see "WG Meetings" below). + +If an addition or removal is proposed during a meeting, and the full +WG is not in attendance to participate, then the addition or removal +is added to the agenda for the subsequent meeting. This is to ensure +that all members are given the opportunity to participate in all +membership decisions. If a WG member is unable to attend a meeting +where a planned membership decision is being made, then their consent +is assumed. + +No more than 1/3 of the WG members may be affiliated with the same +employer. If removal or resignation of a WG member, or a change of +employment by a WG member, creates a situation where more than 1/3 of +the WG membership shares an employer, then the situation must be +immediately remedied by the resignation or removal of one or more WG +members affiliated with the over-represented employer(s). + +### WG Meetings + +The WG meets occasionally on a Google Hangout On Air. A designated moderator +approved by the WG runs the meeting. Each meeting should be +published to YouTube. + +Items are added to the WG agenda that are considered contentious or +are modifications of governance, contribution policy, WG membership, +or release process. + +The intention of the agenda is not to approve or review all patches; +that should happen continuously on GitHub and be handled by the larger +group of Collaborators. + +Any community member or contributor can ask that something be added to +the next meeting's agenda by logging a GitHub Issue. Any Collaborator, +WG member or the moderator can add the item to the agenda by adding +the ***WG-agenda*** tag to the issue. + +Prior to each WG meeting the moderator will share the Agenda with +members of the WG. WG members can add any items they like to the +agenda at the beginning of each meeting. The moderator and the WG +cannot veto or remove items. + +The WG may invite persons or representatives from certain projects to +participate in a non-voting capacity. + +The moderator is responsible for summarizing the discussion of each +agenda item and sends it as a pull request after the meeting. + +### Consensus Seeking Process + +The WG follows a +[Consensus +Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) +decision-making model. + +When an agenda item has appeared to reach a consensus the moderator +will ask "Does anyone object?" as a final call for dissent from the +consensus. + +If an agenda item cannot reach a consensus a WG member can call for +either a closing vote or a vote to table the issue to the next +meeting. The call for a vote must be seconded by a majority of the WG +or else the discussion will continue. Simple majority wins. + +Note that changes to WG membership require a majority consensus. See +"WG Membership" above. diff --git a/node_modules/duplexify/node_modules/readable-stream/LICENSE b/node_modules/duplexify/node_modules/readable-stream/LICENSE new file mode 100644 index 00000000..2873b3b2 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/LICENSE @@ -0,0 +1,47 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" diff --git a/node_modules/duplexify/node_modules/readable-stream/README.md b/node_modules/duplexify/node_modules/readable-stream/README.md new file mode 100644 index 00000000..19117c1a --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/README.md @@ -0,0 +1,106 @@ +# readable-stream + +***Node.js core streams for userland*** [](https://travis-ci.com/nodejs/readable-stream) + + +[](https://nodei.co/npm/readable-stream/) +[](https://nodei.co/npm/readable-stream/) + + +[](https://saucelabs.com/u/readabe-stream) + +```bash +npm install --save readable-stream +``` + +This package is a mirror of the streams implementations in Node.js. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v10.18.1/docs/api/stream.html). + +If you want to guarantee a stable streams base, regardless of what version of +Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). + +As of version 2.0.0 **readable-stream** uses semantic versioning. + +## Version 3.x.x + +v3.x.x of `readable-stream` is a cut from Node 10. This version supports Node 6, 8, and 10, as well as evergreen browsers, IE 11 and latest Safari. The breaking changes introduced by v3 are composed by the combined breaking changes in [Node v9](https://nodejs.org/en/blog/release/v9.0.0/) and [Node v10](https://nodejs.org/en/blog/release/v10.0.0/), as follows: + +1. Error codes: https://github.com/nodejs/node/pull/13310, + https://github.com/nodejs/node/pull/13291, + https://github.com/nodejs/node/pull/16589, + https://github.com/nodejs/node/pull/15042, + https://github.com/nodejs/node/pull/15665, + https://github.com/nodejs/readable-stream/pull/344 +2. 'readable' have precedence over flowing + https://github.com/nodejs/node/pull/18994 +3. make virtual methods errors consistent + https://github.com/nodejs/node/pull/18813 +4. updated streams error handling + https://github.com/nodejs/node/pull/18438 +5. writable.end should return this. + https://github.com/nodejs/node/pull/18780 +6. readable continues to read when push('') + https://github.com/nodejs/node/pull/18211 +7. add custom inspect to BufferList + https://github.com/nodejs/node/pull/17907 +8. always defer 'readable' with nextTick + https://github.com/nodejs/node/pull/17979 + +## Version 2.x.x +v2.x.x of `readable-stream` is a cut of the stream module from Node 8 (there have been no semver-major changes from Node 4 to 8). This version supports all Node.js versions from 0.8, as well as evergreen browsers and IE 10 & 11. + +### Big Thanks + +Cross-browser Testing Platform and Open Source <3 Provided by [Sauce Labs][sauce] + +# Usage + +You can swap your `require('stream')` with `require('readable-stream')` +without any changes, if you are just using one of the main classes and +functions. + +```js +const { + Readable, + Writable, + Transform, + Duplex, + pipeline, + finished +} = require('readable-stream') +```` + +Note that `require('stream')` will return `Stream`, while +`require('readable-stream')` will return `Readable`. We discourage using +whatever is exported directly, but rather use one of the properties as +shown in the example above. + +# Streams Working Group + +`readable-stream` is maintained by the Streams Working Group, which +oversees the development and maintenance of the Streams API within +Node.js. The responsibilities of the Streams Working Group include: + +* Addressing stream issues on the Node.js issue tracker. +* Authoring and editing stream documentation within the Node.js project. +* Reviewing changes to stream subclasses within the Node.js project. +* Redirecting changes to streams from the Node.js project to this + project. +* Assisting in the implementation of stream providers within Node.js. +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance + notice of changes. + +<a name="members"></a> +## Team Members + +* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> + - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 +* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> +* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com> + - Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E +* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com> +* **Yoshua Wyuts** ([@yoshuawuyts](https://github.com/yoshuawuyts)) <yoshuawuyts@gmail.com> + +[sauce]: https://saucelabs.com diff --git a/node_modules/duplexify/node_modules/readable-stream/errors-browser.js b/node_modules/duplexify/node_modules/readable-stream/errors-browser.js new file mode 100644 index 00000000..fb8e73e1 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/errors-browser.js @@ -0,0 +1,127 @@ +'use strict'; + +function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; } + +var codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error; + } + + function getMessage(arg1, arg2, arg3) { + if (typeof message === 'string') { + return message; + } else { + return message(arg1, arg2, arg3); + } + } + + var NodeError = + /*#__PURE__*/ + function (_Base) { + _inheritsLoose(NodeError, _Base); + + function NodeError(arg1, arg2, arg3) { + return _Base.call(this, getMessage(arg1, arg2, arg3)) || this; + } + + return NodeError; + }(Base); + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + codes[code] = NodeError; +} // https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js + + +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + var len = expected.length; + expected = expected.map(function (i) { + return String(i); + }); + + if (len > 2) { + return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1]; + } else if (len === 2) { + return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]); + } else { + return "of ".concat(thing, " ").concat(expected[0]); + } + } else { + return "of ".concat(thing, " ").concat(String(expected)); + } +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith + + +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith + + +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + + return str.substring(this_len - search.length, this_len) === search; +} // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes + + +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"'; +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + var determiner; + + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + var msg; + + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } else { + var type = includes(name, '.') ? 'property' : 'argument'; + msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type')); + } + + msg += ". Received type ".concat(typeof actual); + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented'; +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg; +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); +module.exports.codes = codes; diff --git a/node_modules/duplexify/node_modules/readable-stream/errors.js b/node_modules/duplexify/node_modules/readable-stream/errors.js new file mode 100644 index 00000000..8471526d --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/errors.js @@ -0,0 +1,116 @@ +'use strict'; + +const codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error + } + + function getMessage (arg1, arg2, arg3) { + if (typeof message === 'string') { + return message + } else { + return message(arg1, arg2, arg3) + } + } + + class NodeError extends Base { + constructor (arg1, arg2, arg3) { + super(getMessage(arg1, arg2, arg3)); + } + } + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + + codes[code] = NodeError; +} + +// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + const len = expected.length; + expected = expected.map((i) => String(i)); + if (len > 2) { + return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + + expected[len - 1]; + } else if (len === 2) { + return `one of ${thing} ${expected[0]} or ${expected[1]}`; + } else { + return `of ${thing} ${expected[0]}`; + } + } else { + return `of ${thing} ${String(expected)}`; + } +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + return str.substring(this_len - search.length, this_len) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"' +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + let determiner; + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + let msg; + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; + } else { + const type = includes(name, '.') ? 'property' : 'argument'; + msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; + } + + msg += `. Received type ${typeof actual}`; + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented' +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); + +module.exports.codes = codes; diff --git a/node_modules/duplexify/node_modules/readable-stream/experimentalWarning.js b/node_modules/duplexify/node_modules/readable-stream/experimentalWarning.js new file mode 100644 index 00000000..78e84149 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/experimentalWarning.js @@ -0,0 +1,17 @@ +'use strict' + +var experimentalWarnings = new Set(); + +function emitExperimentalWarning(feature) { + if (experimentalWarnings.has(feature)) return; + var msg = feature + ' is an experimental feature. This feature could ' + + 'change at any time'; + experimentalWarnings.add(feature); + process.emitWarning(msg, 'ExperimentalWarning'); +} + +function noop() {} + +module.exports.emitExperimentalWarning = process.emitWarning + ? emitExperimentalWarning + : noop; diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 00000000..19abfa60 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,126 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +'use strict'; + +/*<replacement>*/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/*</replacement>*/ + +module.exports = Duplex; +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); +require('inherits')(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +});
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 00000000..24a6bdde --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,37 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +'use strict'; + +module.exports = PassThrough; +var Transform = require('./_stream_transform'); +require('inherits')(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +};
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 00000000..df1f608d --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,1027 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +module.exports = Readable; + +/*<replacement>*/ +var Duplex; +/*</replacement>*/ + +Readable.ReadableState = ReadableState; + +/*<replacement>*/ +var EE = require('events').EventEmitter; +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/*</replacement>*/ + +/*<replacement>*/ +var Stream = require('./internal/streams/stream'); +/*</replacement>*/ + +var Buffer = require('buffer').Buffer; +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/*<replacement>*/ +var debugUtil = require('util'); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/*</replacement>*/ + +var BufferList = require('./internal/streams/buffer_list'); +var destroyImpl = require('./internal/streams/destroy'); +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + +// Lazy loaded to improve the startup performance. +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; +require('inherits')(Readable, Stream); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} +function Readable(options) { + Duplex = Duplex || require('./_stream_duplex'); + if (!(this instanceof Readable)) return new Readable(options); + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + + // legacy + this.readable = true; + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + Stream.call(this); +} +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + return er; +} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + + // Iterate over current buffer to convert already stored Buffers: + var p = this._readableState.buffer.head; + var content = ''; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; + +// Don't raise the hwm > 1GB +var MAX_HWM = 0x40000000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + if (ret !== null) this.emit('data', ret); + return ret; +}; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } + + // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + return dest; +}; +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; + + // Try start flowing on next tick if stream isn't explicitly paused + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; + + // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} +function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + this._readableState.paused = true; + return this; +}; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = require('./internal/streams/async_iterator'); + } + return createReadableStreamAsyncIterator(this); + }; +} +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); + + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = require('./internal/streams/from'); + } + return from(Readable, iterable, opts); + }; +} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +}
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 00000000..1ccb7157 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,190 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +'use strict'; + +module.exports = Transform; +var _require$codes = require('../errors').codes, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; +var Duplex = require('./_stream_duplex'); +require('inherits')(Transform, Duplex); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +}
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 00000000..292415e2 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,641 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + +'use strict'; + +module.exports = Writable; + +/* <replacement> */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* </replacement> */ + +/*<replacement>*/ +var Duplex; +/*</replacement>*/ + +Writable.WritableState = WritableState; + +/*<replacement>*/ +var internalUtil = { + deprecate: require('util-deprecate') +}; +/*</replacement>*/ + +/*<replacement>*/ +var Stream = require('./internal/streams/stream'); +/*</replacement>*/ + +var Buffer = require('buffer').Buffer; +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = require('./internal/streams/destroy'); +var _require = require('./internal/streams/state'), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = require('../errors').codes, + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +require('inherits')(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || require('./_stream_duplex'); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +};
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/async_iterator.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/async_iterator.js new file mode 100644 index 00000000..742c5a46 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/async_iterator.js @@ -0,0 +1,180 @@ +'use strict'; + +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = require('./end-of-stream'); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } + + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator;
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/buffer_list.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/buffer_list.js new file mode 100644 index 00000000..69bda497 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/buffer_list.js @@ -0,0 +1,183 @@ +'use strict'; + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = require('buffer'), + Buffer = _require.Buffer; +var _require2 = require('util'), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } + + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } + + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + return BufferList; +}();
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/destroy.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/destroy.js new file mode 100644 index 00000000..31a17c4d --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/destroy.js @@ -0,0 +1,96 @@ +'use strict'; + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +};
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/end-of-stream.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/end-of-stream.js new file mode 100644 index 00000000..59c671b5 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/end-of-stream.js @@ -0,0 +1,86 @@ +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + +'use strict'; + +var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos;
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/from-browser.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/from-browser.js new file mode 100644 index 00000000..a4ce56f3 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/from-browser.js @@ -0,0 +1,3 @@ +module.exports = function () { + throw new Error('Readable.from is not available in the browser') +}; diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/from.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/from.js new file mode 100644 index 00000000..0a34ee92 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/from.js @@ -0,0 +1,52 @@ +'use strict'; + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var ERR_INVALID_ARG_TYPE = require('../../../errors').codes.ERR_INVALID_ARG_TYPE; +function from(Readable, iterable, opts) { + var iterator; + if (iterable && typeof iterable.next === 'function') { + iterator = iterable; + } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); + var readable = new Readable(_objectSpread({ + objectMode: true + }, opts)); + // Reading boolean to protect against _read + // being called before last iteration completion. + var reading = false; + readable._read = function () { + if (!reading) { + reading = true; + next(); + } + }; + function next() { + return _next2.apply(this, arguments); + } + function _next2() { + _next2 = _asyncToGenerator(function* () { + try { + var _yield$iterator$next = yield iterator.next(), + value = _yield$iterator$next.value, + done = _yield$iterator$next.done; + if (done) { + readable.push(null); + } else if (readable.push(yield value)) { + next(); + } else { + reading = false; + } + } catch (err) { + readable.destroy(err); + } + }); + return _next2.apply(this, arguments); + } + return readable; +} +module.exports = from; diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/pipeline.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/pipeline.js new file mode 100644 index 00000000..e6f39241 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/pipeline.js @@ -0,0 +1,86 @@ +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + +'use strict'; + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = require('../../../errors').codes, + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = require('./end-of-stream'); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline;
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/state.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/state.js new file mode 100644 index 00000000..3fbf8927 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/state.js @@ -0,0 +1,22 @@ +'use strict'; + +var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE; +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +};
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream-browser.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream-browser.js new file mode 100644 index 00000000..9332a3fd --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream-browser.js @@ -0,0 +1 @@ +module.exports = require('events').EventEmitter; diff --git a/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream.js b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream.js new file mode 100644 index 00000000..ce2ad5b6 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/lib/internal/streams/stream.js @@ -0,0 +1 @@ +module.exports = require('stream'); diff --git a/node_modules/duplexify/node_modules/readable-stream/package.json b/node_modules/duplexify/node_modules/readable-stream/package.json new file mode 100644 index 00000000..ade59e71 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/package.json @@ -0,0 +1,68 @@ +{ + "name": "readable-stream", + "version": "3.6.2", + "description": "Streams3, a user-land copy of the stream library from Node.js", + "main": "readable.js", + "engines": { + "node": ">= 6" + }, + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "devDependencies": { + "@babel/cli": "^7.2.0", + "@babel/core": "^7.2.0", + "@babel/polyfill": "^7.0.0", + "@babel/preset-env": "^7.2.0", + "airtap": "0.0.9", + "assert": "^1.4.0", + "bl": "^2.0.0", + "deep-strict-equal": "^0.2.0", + "events.once": "^2.0.2", + "glob": "^7.1.2", + "gunzip-maybe": "^1.4.1", + "hyperquest": "^2.1.3", + "lolex": "^2.6.0", + "nyc": "^11.0.0", + "pump": "^3.0.0", + "rimraf": "^2.6.2", + "tap": "^12.0.0", + "tape": "^4.9.0", + "tar-fs": "^1.16.2", + "util-promisify": "^2.1.0" + }, + "scripts": { + "test": "tap -J --no-esm test/parallel/*.js test/ours/*.js", + "ci": "TAP=1 tap --no-esm test/parallel/*.js test/ours/*.js | tee test.tap", + "test-browsers": "airtap --sauce-connect --loopback airtap.local -- test/browser.js", + "test-browser-local": "airtap --open --local -- test/browser.js", + "cover": "nyc npm test", + "report": "nyc report --reporter=lcov", + "update-browser-errors": "babel -o errors-browser.js errors.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/readable-stream" + }, + "keywords": [ + "readable", + "stream", + "pipe" + ], + "browser": { + "util": false, + "worker_threads": false, + "./errors": "./errors-browser.js", + "./readable.js": "./readable-browser.js", + "./lib/internal/streams/from.js": "./lib/internal/streams/from-browser.js", + "./lib/internal/streams/stream.js": "./lib/internal/streams/stream-browser.js" + }, + "nyc": { + "include": [ + "lib/**.js" + ] + }, + "license": "MIT" +} diff --git a/node_modules/duplexify/node_modules/readable-stream/readable-browser.js b/node_modules/duplexify/node_modules/readable-stream/readable-browser.js new file mode 100644 index 00000000..adbf60de --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/readable-browser.js @@ -0,0 +1,9 @@ +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = exports; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); +exports.finished = require('./lib/internal/streams/end-of-stream.js'); +exports.pipeline = require('./lib/internal/streams/pipeline.js'); diff --git a/node_modules/duplexify/node_modules/readable-stream/readable.js b/node_modules/duplexify/node_modules/readable-stream/readable.js new file mode 100644 index 00000000..9e0ca120 --- /dev/null +++ b/node_modules/duplexify/node_modules/readable-stream/readable.js @@ -0,0 +1,16 @@ +var Stream = require('stream'); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream.Readable; + Object.assign(module.exports, Stream); + module.exports.Stream = Stream; +} else { + exports = module.exports = require('./lib/_stream_readable.js'); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = require('./lib/_stream_writable.js'); + exports.Duplex = require('./lib/_stream_duplex.js'); + exports.Transform = require('./lib/_stream_transform.js'); + exports.PassThrough = require('./lib/_stream_passthrough.js'); + exports.finished = require('./lib/internal/streams/end-of-stream.js'); + exports.pipeline = require('./lib/internal/streams/pipeline.js'); +} diff --git a/node_modules/duplexify/node_modules/string_decoder/LICENSE b/node_modules/duplexify/node_modules/string_decoder/LICENSE new file mode 100644 index 00000000..778edb20 --- /dev/null +++ b/node_modules/duplexify/node_modules/string_decoder/LICENSE @@ -0,0 +1,48 @@ +Node.js is licensed for use as follows: + +""" +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + +This license applies to parts of Node.js originating from the +https://github.com/joyent/node repository: + +""" +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +""" + diff --git a/node_modules/duplexify/node_modules/string_decoder/README.md b/node_modules/duplexify/node_modules/string_decoder/README.md new file mode 100644 index 00000000..5fd58315 --- /dev/null +++ b/node_modules/duplexify/node_modules/string_decoder/README.md @@ -0,0 +1,47 @@ +# string_decoder + +***Node-core v8.9.4 string_decoder for userland*** + + +[](https://nodei.co/npm/string_decoder/) +[](https://nodei.co/npm/string_decoder/) + + +```bash +npm install --save string_decoder +``` + +***Node-core string_decoder for userland*** + +This package is a mirror of the string_decoder implementation in Node-core. + +Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.9.4/docs/api/). + +As of version 1.0.0 **string_decoder** uses semantic versioning. + +## Previous versions + +Previous version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. + +## Update + +The *build/* directory contains a build script that will scrape the source from the [nodejs/node](https://github.com/nodejs/node) repo given a specific Node version. + +## Streams Working Group + +`string_decoder` is maintained by the Streams Working Group, which +oversees the development and maintenance of the Streams API within +Node.js. The responsibilities of the Streams Working Group include: + +* Addressing stream issues on the Node.js issue tracker. +* Authoring and editing stream documentation within the Node.js project. +* Reviewing changes to stream subclasses within the Node.js project. +* Redirecting changes to streams from the Node.js project to this + project. +* Assisting in the implementation of stream providers within Node.js. +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance + notice of changes. + +See [readable-stream](https://github.com/nodejs/readable-stream) for +more details. diff --git a/node_modules/duplexify/node_modules/string_decoder/lib/string_decoder.js b/node_modules/duplexify/node_modules/string_decoder/lib/string_decoder.js new file mode 100644 index 00000000..2e89e63f --- /dev/null +++ b/node_modules/duplexify/node_modules/string_decoder/lib/string_decoder.js @@ -0,0 +1,296 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +'use strict'; + +/*<replacement>*/ + +var Buffer = require('safe-buffer').Buffer; +/*</replacement>*/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.StringDecoder = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +}
\ No newline at end of file diff --git a/node_modules/duplexify/node_modules/string_decoder/package.json b/node_modules/duplexify/node_modules/string_decoder/package.json new file mode 100644 index 00000000..b2bb1411 --- /dev/null +++ b/node_modules/duplexify/node_modules/string_decoder/package.json @@ -0,0 +1,34 @@ +{ + "name": "string_decoder", + "version": "1.3.0", + "description": "The string_decoder module from Node core", + "main": "lib/string_decoder.js", + "files": [ + "lib" + ], + "dependencies": { + "safe-buffer": "~5.2.0" + }, + "devDependencies": { + "babel-polyfill": "^6.23.0", + "core-util-is": "^1.0.2", + "inherits": "^2.0.3", + "tap": "~0.4.8" + }, + "scripts": { + "test": "tap test/parallel/*.js && node test/verify-dependencies", + "ci": "tap test/parallel/*.js test/ours/*.js --tap | tee test.tap && node test/verify-dependencies.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/nodejs/string_decoder.git" + }, + "homepage": "https://github.com/nodejs/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT" +} diff --git a/node_modules/duplexify/package.json b/node_modules/duplexify/package.json new file mode 100644 index 00000000..2758df93 --- /dev/null +++ b/node_modules/duplexify/package.json @@ -0,0 +1,39 @@ +{ + "name": "duplexify", + "version": "4.1.2", + "description": "Turn a writable and readable stream into a streams2 duplex stream with support for async initialization and streams1/streams2 input", + "main": "index.js", + "dependencies": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.0" + }, + "devDependencies": { + "concat-stream": "^1.5.2", + "tape": "^4.0.0", + "through2": "^2.0.0" + }, + "scripts": { + "test": "tape test.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/mafintosh/duplexify" + }, + "keywords": [ + "duplex", + "streams2", + "streams", + "stream", + "writable", + "readable", + "async" + ], + "author": "Mathias Buus", + "license": "MIT", + "bugs": { + "url": "https://github.com/mafintosh/duplexify/issues" + }, + "homepage": "https://github.com/mafintosh/duplexify" +} diff --git a/node_modules/duplexify/test.js b/node_modules/duplexify/test.js new file mode 100644 index 00000000..93411059 --- /dev/null +++ b/node_modules/duplexify/test.js @@ -0,0 +1,339 @@ +var tape = require('tape') +var through = require('through2') +var concat = require('concat-stream') +var stream = require('readable-stream') +var net = require('net') +var duplexify = require('./') + +var HELLO_WORLD = (Buffer.from && Buffer.from !== Uint8Array.from) + ? Buffer.from('hello world') + : new Buffer('hello world') + +tape('passthrough', function(t) { + t.plan(2) + + var pt = through() + var dup = duplexify(pt, pt) + + dup.end('hello world') + dup.on('finish', function() { + t.ok(true, 'should finish') + }) + dup.pipe(concat(function(data) { + t.same(data.toString(), 'hello world', 'same in as out') + })) +}) + +tape('passthrough + double end', function(t) { + t.plan(2) + + var pt = through() + var dup = duplexify(pt, pt) + + dup.end('hello world') + dup.end() + + dup.on('finish', function() { + t.ok(true, 'should finish') + }) + dup.pipe(concat(function(data) { + t.same(data.toString(), 'hello world', 'same in as out') + })) +}) + +tape('async passthrough + end', function(t) { + t.plan(2) + + var pt = through.obj({highWaterMark:1}, function(data, enc, cb) { + setTimeout(function() { + cb(null, data) + }, 100) + }) + + var dup = duplexify(pt, pt) + + dup.write('hello ') + dup.write('world') + dup.end() + + dup.on('finish', function() { + t.ok(true, 'should finish') + }) + dup.pipe(concat(function(data) { + t.same(data.toString(), 'hello world', 'same in as out') + })) +}) + +tape('duplex', function(t) { + var readExpected = ['read-a', 'read-b', 'read-c'] + var writeExpected = ['write-a', 'write-b', 'write-c'] + + t.plan(readExpected.length+writeExpected.length+2) + + var readable = through.obj() + var writable = through.obj(function(data, enc, cb) { + t.same(data, writeExpected.shift(), 'onwrite should match') + cb() + }) + + var dup = duplexify.obj(writable, readable) + + readExpected.slice().forEach(function(data) { + readable.write(data) + }) + readable.end() + + writeExpected.slice().forEach(function(data) { + dup.write(data) + }) + dup.end() + + dup.on('data', function(data) { + t.same(data, readExpected.shift(), 'ondata should match') + }) + dup.on('end', function() { + t.ok(true, 'should end') + }) + dup.on('finish', function() { + t.ok(true, 'should finish') + }) +}) + +tape('async', function(t) { + var dup = duplexify() + var pt = through() + + dup.pipe(concat(function(data) { + t.same(data.toString(), 'i was async', 'same in as out') + t.end() + })) + + dup.write('i') + dup.write(' was ') + dup.end('async') + + setTimeout(function() { + dup.setWritable(pt) + setTimeout(function() { + dup.setReadable(pt) + }, 50) + }, 50) +}) + +tape('destroy', function(t) { + t.plan(2) + + var write = through() + var read = through() + var dup = duplexify(write, read) + + write.destroy = function() { + t.ok(true, 'write destroyed') + } + + dup.on('close', function() { + t.ok(true, 'close emitted') + }) + + dup.destroy() + dup.destroy() // should only work once + dup.end() +}) + +tape('destroy both', function(t) { + t.plan(3) + + var write = through() + var read = through() + var dup = duplexify(write, read) + + write.destroy = function() { + t.ok(true, 'write destroyed') + } + + read.destroy = function() { + t.ok(true, 'read destroyed') + } + + dup.on('close', function() { + t.ok(true, 'close emitted') + }) + + dup.destroy() + dup.destroy() // should only work once +}) + +tape('bubble read errors', function(t) { + t.plan(2) + + var write = through() + var read = through() + var dup = duplexify(write, read) + + dup.on('error', function(err) { + t.same(err.message, 'read-error', 'received read error') + }) + dup.on('close', function() { + t.ok(true, 'close emitted') + }) + + read.emit('error', new Error('read-error')) + write.emit('error', new Error('write-error')) // only emit first error +}) + +tape('bubble write errors', function(t) { + t.plan(2) + + var write = through() + var read = through() + var dup = duplexify(write, read) + + dup.on('error', function(err) { + t.same(err.message, 'write-error', 'received write error') + }) + dup.on('close', function() { + t.ok(true, 'close emitted') + }) + + write.emit('error', new Error('write-error')) + read.emit('error', new Error('read-error')) // only emit first error +}) + +tape('bubble errors from write()', function(t) { + t.plan(3) + + var errored = false + var dup = duplexify(new stream.Writable({ + write: function(chunk, enc, next) { + next(new Error('write-error')) + } + })) + + dup.on('error', function(err) { + errored = true + t.same(err.message, 'write-error', 'received write error') + }) + dup.on('close', function() { + t.pass('close emitted') + t.ok(errored, 'error was emitted before close') + }) + dup.end('123') +}) + +tape('destroy while waiting for drain', function(t) { + t.plan(3) + + var errored = false + var dup = duplexify(new stream.Writable({ + highWaterMark: 0, + write: function() {} + })) + + dup.on('error', function(err) { + errored = true + t.same(err.message, 'destroy-error', 'received destroy error') + }) + dup.on('close', function() { + t.pass('close emitted') + t.ok(errored, 'error was emitted before close') + }) + dup.write('123') + dup.destroy(new Error('destroy-error')) +}) + +tape('reset writable / readable', function(t) { + t.plan(3) + + var toUpperCase = function(data, enc, cb) { + cb(null, data.toString().toUpperCase()) + } + + var passthrough = through() + var upper = through(toUpperCase) + var dup = duplexify(passthrough, passthrough) + + dup.once('data', function(data) { + t.same(data.toString(), 'hello') + dup.setWritable(upper) + dup.setReadable(upper) + dup.once('data', function(data) { + t.same(data.toString(), 'HELLO') + dup.once('data', function(data) { + t.same(data.toString(), 'HI') + t.end() + }) + }) + dup.write('hello') + dup.write('hi') + }) + dup.write('hello') +}) + +tape('cork', function(t) { + var passthrough = through() + var dup = duplexify(passthrough, passthrough) + var ok = false + + dup.on('prefinish', function() { + dup.cork() + setTimeout(function() { + ok = true + dup.uncork() + }, 100) + }) + dup.on('finish', function() { + t.ok(ok) + t.end() + }) + dup.end() +}) + +tape('prefinish not twice', function(t) { + var passthrough = through() + var dup = duplexify(passthrough, passthrough) + var prefinished = false + + dup.on('prefinish', function() { + t.ok(!prefinished, 'only prefinish once') + prefinished = true + }) + + dup.on('finish', function() { + t.end() + }) + + dup.end() +}) + +tape('close', function(t) { + var passthrough = through() + var dup = duplexify(passthrough, passthrough) + + passthrough.emit('close') + dup.on('close', function() { + t.ok(true, 'should forward close') + t.end() + }) +}) + +tape('works with node native streams (net)', function(t) { + t.plan(1) + + var server = net.createServer(function(socket) { + var dup = duplexify(socket, socket) + + dup.once('data', function(chunk) { + t.same(chunk, HELLO_WORLD) + server.close() + socket.end() + t.end() + }) + }) + + server.listen(0, function () { + var socket = net.connect(server.address().port) + var dup = duplexify(socket, socket) + + dup.write(HELLO_WORLD) + }) +}) diff --git a/node_modules/end-of-stream/LICENSE b/node_modules/end-of-stream/LICENSE new file mode 100644 index 00000000..757562ec --- /dev/null +++ b/node_modules/end-of-stream/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Mathias Buus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.
\ No newline at end of file diff --git a/node_modules/end-of-stream/README.md b/node_modules/end-of-stream/README.md new file mode 100644 index 00000000..857b14bd --- /dev/null +++ b/node_modules/end-of-stream/README.md @@ -0,0 +1,54 @@ +# end-of-stream + +A node module that calls a callback when a readable/writable/duplex stream has completed or failed. + + npm install end-of-stream + +[](https://travis-ci.org/mafintosh/end-of-stream) + +## Usage + +Simply pass a stream and a callback to the `eos`. +Both legacy streams, streams2 and stream3 are supported. + +``` js +var eos = require('end-of-stream'); + +eos(readableStream, function(err) { + // this will be set to the stream instance + if (err) return console.log('stream had an error or closed early'); + console.log('stream has ended', this === readableStream); +}); + +eos(writableStream, function(err) { + if (err) return console.log('stream had an error or closed early'); + console.log('stream has finished', this === writableStream); +}); + +eos(duplexStream, function(err) { + if (err) return console.log('stream had an error or closed early'); + console.log('stream has ended and finished', this === duplexStream); +}); + +eos(duplexStream, {readable:false}, function(err) { + if (err) return console.log('stream had an error or closed early'); + console.log('stream has finished but might still be readable'); +}); + +eos(duplexStream, {writable:false}, function(err) { + if (err) return console.log('stream had an error or closed early'); + console.log('stream has ended but might still be writable'); +}); + +eos(readableStream, {error:false}, function(err) { + // do not treat emit('error', err) as a end-of-stream +}); +``` + +## License + +MIT + +## Related + +`end-of-stream` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one. diff --git a/node_modules/end-of-stream/index.js b/node_modules/end-of-stream/index.js new file mode 100644 index 00000000..c77f0d5d --- /dev/null +++ b/node_modules/end-of-stream/index.js @@ -0,0 +1,94 @@ +var once = require('once'); + +var noop = function() {}; + +var isRequest = function(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +}; + +var isChildProcess = function(stream) { + return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3 +}; + +var eos = function(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + + callback = once(callback || noop); + + var ws = stream._writableState; + var rs = stream._readableState; + var readable = opts.readable || (opts.readable !== false && stream.readable); + var writable = opts.writable || (opts.writable !== false && stream.writable); + var cancelled = false; + + var onlegacyfinish = function() { + if (!stream.writable) onfinish(); + }; + + var onfinish = function() { + writable = false; + if (!readable) callback.call(stream); + }; + + var onend = function() { + readable = false; + if (!writable) callback.call(stream); + }; + + var onexit = function(exitCode) { + callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null); + }; + + var onerror = function(err) { + callback.call(stream, err); + }; + + var onclose = function() { + process.nextTick(onclosenexttick); + }; + + var onclosenexttick = function() { + if (cancelled) return; + if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close')); + if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close')); + }; + + var onrequest = function() { + stream.req.on('finish', onfinish); + }; + + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest(); + else stream.on('request', onrequest); + } else if (writable && !ws) { // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + + if (isChildProcess(stream)) stream.on('exit', onexit); + + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + + return function() { + cancelled = true; + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('exit', onexit); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +}; + +module.exports = eos; diff --git a/node_modules/end-of-stream/package.json b/node_modules/end-of-stream/package.json new file mode 100644 index 00000000..b75bbf0f --- /dev/null +++ b/node_modules/end-of-stream/package.json @@ -0,0 +1,37 @@ +{ + "name": "end-of-stream", + "version": "1.4.4", + "description": "Call a callback when a readable/writable/duplex stream has completed or failed.", + "repository": { + "type": "git", + "url": "git://github.com/mafintosh/end-of-stream.git" + }, + "dependencies": { + "once": "^1.4.0" + }, + "scripts": { + "test": "node test.js" + }, + "files": [ + "index.js" + ], + "keywords": [ + "stream", + "streams", + "callback", + "finish", + "close", + "end", + "wait" + ], + "bugs": { + "url": "https://github.com/mafintosh/end-of-stream/issues" + }, + "homepage": "https://github.com/mafintosh/end-of-stream", + "main": "index.js", + "author": "Mathias Buus <mathiasbuus@gmail.com>", + "license": "MIT", + "devDependencies": { + "tape": "^4.11.0" + } +} diff --git a/node_modules/isarray/README.md b/node_modules/isarray/README.md new file mode 100644 index 00000000..052a62b8 --- /dev/null +++ b/node_modules/isarray/README.md @@ -0,0 +1,54 @@ + +# isarray + +`Array#isArray` for older browsers. + +## Usage + +```js +var isArray = require('isarray'); + +console.log(isArray([])); // => true +console.log(isArray({})); // => false +``` + +## Installation + +With [npm](http://npmjs.org) do + +```bash +$ npm install isarray +``` + +Then bundle for the browser with +[browserify](https://github.com/substack/browserify). + +With [component](http://component.io) do + +```bash +$ component install juliangruber/isarray +``` + +## License + +(MIT) + +Copyright (c) 2013 Julian Gruber <julian@juliangruber.com> + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/isarray/build/build.js b/node_modules/isarray/build/build.js new file mode 100644 index 00000000..ec58596a --- /dev/null +++ b/node_modules/isarray/build/build.js @@ -0,0 +1,209 @@ + +/** + * Require the given path. + * + * @param {String} path + * @return {Object} exports + * @api public + */ + +function require(path, parent, orig) { + var resolved = require.resolve(path); + + // lookup failed + if (null == resolved) { + orig = orig || path; + parent = parent || 'root'; + var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); + err.path = orig; + err.parent = parent; + err.require = true; + throw err; + } + + var module = require.modules[resolved]; + + // perform real require() + // by invoking the module's + // registered function + if (!module.exports) { + module.exports = {}; + module.client = module.component = true; + module.call(this, module.exports, require.relative(resolved), module); + } + + return module.exports; +} + +/** + * Registered modules. + */ + +require.modules = {}; + +/** + * Registered aliases. + */ + +require.aliases = {}; + +/** + * Resolve `path`. + * + * Lookup: + * + * - PATH/index.js + * - PATH.js + * - PATH + * + * @param {String} path + * @return {String} path or null + * @api private + */ + +require.resolve = function(path) { + if (path.charAt(0) === '/') path = path.slice(1); + var index = path + '/index.js'; + + var paths = [ + path, + path + '.js', + path + '.json', + path + '/index.js', + path + '/index.json' + ]; + + for (var i = 0; i < paths.length; i++) { + var path = paths[i]; + if (require.modules.hasOwnProperty(path)) return path; + } + + if (require.aliases.hasOwnProperty(index)) { + return require.aliases[index]; + } +}; + +/** + * Normalize `path` relative to the current path. + * + * @param {String} curr + * @param {String} path + * @return {String} + * @api private + */ + +require.normalize = function(curr, path) { + var segs = []; + + if ('.' != path.charAt(0)) return path; + + curr = curr.split('/'); + path = path.split('/'); + + for (var i = 0; i < path.length; ++i) { + if ('..' == path[i]) { + curr.pop(); + } else if ('.' != path[i] && '' != path[i]) { + segs.push(path[i]); + } + } + + return curr.concat(segs).join('/'); +}; + +/** + * Register module at `path` with callback `definition`. + * + * @param {String} path + * @param {Function} definition + * @api private + */ + +require.register = function(path, definition) { + require.modules[path] = definition; +}; + +/** + * Alias a module definition. + * + * @param {String} from + * @param {String} to + * @api private + */ + +require.alias = function(from, to) { + if (!require.modules.hasOwnProperty(from)) { + throw new Error('Failed to alias "' + from + '", it does not exist'); + } + require.aliases[to] = from; +}; + +/** + * Return a require function relative to the `parent` path. + * + * @param {String} parent + * @return {Function} + * @api private + */ + +require.relative = function(parent) { + var p = require.normalize(parent, '..'); + + /** + * lastIndexOf helper. + */ + + function lastIndexOf(arr, obj) { + var i = arr.length; + while (i--) { + if (arr[i] === obj) return i; + } + return -1; + } + + /** + * The relative require() itself. + */ + + function localRequire(path) { + var resolved = localRequire.resolve(path); + return require(resolved, parent, path); + } + + /** + * Resolve relative to the parent. + */ + + localRequire.resolve = function(path) { + var c = path.charAt(0); + if ('/' == c) return path.slice(1); + if ('.' == c) return require.normalize(p, path); + + // resolve deps by returning + // the dep in the nearest "deps" + // directory + var segs = parent.split('/'); + var i = lastIndexOf(segs, 'deps') + 1; + if (!i) i = 0; + path = segs.slice(0, i + 1).join('/') + '/deps/' + path; + return path; + }; + + /** + * Check if module is defined at `path`. + */ + + localRequire.exists = function(path) { + return require.modules.hasOwnProperty(localRequire.resolve(path)); + }; + + return localRequire; +}; +require.register("isarray/index.js", function(exports, require, module){ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; + +}); +require.alias("isarray/index.js", "isarray/index.js"); + diff --git a/node_modules/isarray/component.json b/node_modules/isarray/component.json new file mode 100644 index 00000000..9e31b683 --- /dev/null +++ b/node_modules/isarray/component.json @@ -0,0 +1,19 @@ +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : "juliangruber/isarray", + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : [ + "index.js" + ], + "dependencies" : {}, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/node_modules/isarray/index.js b/node_modules/isarray/index.js new file mode 100644 index 00000000..5f5ad45d --- /dev/null +++ b/node_modules/isarray/index.js @@ -0,0 +1,3 @@ +module.exports = Array.isArray || function (arr) { + return Object.prototype.toString.call(arr) == '[object Array]'; +}; diff --git a/node_modules/isarray/package.json b/node_modules/isarray/package.json new file mode 100644 index 00000000..5a1e9c10 --- /dev/null +++ b/node_modules/isarray/package.json @@ -0,0 +1,25 @@ +{ + "name" : "isarray", + "description" : "Array#isArray for older browsers", + "version" : "0.0.1", + "repository" : { + "type" : "git", + "url" : "git://github.com/juliangruber/isarray.git" + }, + "homepage": "https://github.com/juliangruber/isarray", + "main" : "index.js", + "scripts" : { + "test" : "tap test/*.js" + }, + "dependencies" : {}, + "devDependencies" : { + "tap" : "*" + }, + "keywords": ["browser","isarray","array"], + "author": { + "name": "Julian Gruber", + "email": "mail@juliangruber.com", + "url": "http://juliangruber.com" + }, + "license": "MIT" +} diff --git a/node_modules/ldjson-stream/.npmignore b/node_modules/ldjson-stream/.npmignore new file mode 100644 index 00000000..b512c09d --- /dev/null +++ b/node_modules/ldjson-stream/.npmignore @@ -0,0 +1 @@ +node_modules
\ No newline at end of file diff --git a/node_modules/ldjson-stream/index.js b/node_modules/ldjson-stream/index.js new file mode 100644 index 00000000..d827fb4f --- /dev/null +++ b/node_modules/ldjson-stream/index.js @@ -0,0 +1,32 @@ +var through = require('through2') +var split = require('split2') +var EOL = require('os').EOL + +module.exports = parse +module.exports.serialize = serialize +module.exports.parse = parse + +function parse(opts) { + opts = opts || {} + opts.strict = opts.strict !== false + + function strict(row) { + if (row) return JSON.parse(row) + } + + function nonStrict(row) { + try { + if (row) return JSON.parse(row) + } catch(e) { + // ignore + } + } + + return opts.strict ? split(strict) : split(nonStrict) +} + +function serialize() { + return through.obj(function(obj, enc, cb) { + cb(null, JSON.stringify(obj) + EOL) + }) +} diff --git a/node_modules/ldjson-stream/package.json b/node_modules/ldjson-stream/package.json new file mode 100644 index 00000000..ba64dbf0 --- /dev/null +++ b/node_modules/ldjson-stream/package.json @@ -0,0 +1,25 @@ +{ + "name": "ldjson-stream", + "version": "1.2.1", + "description": "streaming line delimited json parser + serializer", + "main": "index.js", + "scripts": { + "test": "tape test.js" + }, + "author": "max ogden", + "license": "BSD", + "dependencies": { + "split2": "^0.2.1", + "through2": "^0.6.1" + }, + "devDependencies": { + "tape": "^2.13.3" + }, + "repository": { + "type": "git", + "url": "git://github.com/maxogden/ldjson-stream.git" + }, + "bugs": { + "url": "https://github.com/maxogden/ldjson-stream/issues" + } +} diff --git a/node_modules/ldjson-stream/readme.md b/node_modules/ldjson-stream/readme.md new file mode 100644 index 00000000..d6a99c55 --- /dev/null +++ b/node_modules/ldjson-stream/readme.md @@ -0,0 +1,55 @@ +# ldjson-stream + +#### streaming line delimited json parser + serializer + +[](https://nodei.co/npm/ldjson-stream/) + +## usage + +``` +var ldj = require('ldjson-stream') +``` + +#### ldj.parse() + +returns a transform stream that accepts newline delimited json and emits objects + +example newline delimited json: + +`data.txt`: + +``` +{"foo": "bar"} +{"hello": "world"} +``` + +If you want to discard non-valid JSON messages, you can call `ldj.parse({strict: false})` + +usage: + +```js +fs.createReadStream('data.txt') + .pipe(ldj.parse()) + .on('data', function(obj) { + // obj is a javascript object + }) +``` + +#### ldj.serialize() + +returns a transform stream that accepts json objects and emits newline delimited json + +example usage: + +```js +var serialize = ldj.serialize() +serialize.on('data', function(line) { + // line is a line of stringified JSON with a newline delimiter at the end +}) +serialize.write({"foo": "bar"}) +serialize.end() +``` + +### license + +BSD diff --git a/node_modules/ldjson-stream/test.js b/node_modules/ldjson-stream/test.js new file mode 100644 index 00000000..9a2da0e1 --- /dev/null +++ b/node_modules/ldjson-stream/test.js @@ -0,0 +1,35 @@ +var test = require('tape') +var ldj = require('./') +var os = require('os') + +test('.parse', function(t) { + var parser = ldj.parse() + parser.on('data', function(obj) { + t.equal(obj.hello, 'world') + t.end() + }) + + parser.write('{"hello": "world"}\n') +}) + +test('.parse twice', function(t) { + var parser = ldj.parse() + parser.once('data', function(obj) { + t.equal(obj.hello, 'world') + parser.once('data', function(obj) { + t.equal(obj.hola, 'mundo') + t.end() + }) + }) + + parser.write('{"hello": "world"}\n{"hola": "mundo"}\n') +}) + +test('.serialize', function(t) { + var serializer = ldj.serialize() + serializer.on('data', function(data) { + t.equal(data, '{"hello":"world"}' + os.EOL) + t.end() + }) + serializer.write({hello: 'world'}) +}) diff --git a/node_modules/multimatch/index.d.ts b/node_modules/multimatch/index.d.ts new file mode 100644 index 00000000..ecddcdc5 --- /dev/null +++ b/node_modules/multimatch/index.d.ts @@ -0,0 +1,28 @@ +import {IOptions} from 'minimatch'; + +declare namespace multimatch { + type Options = Readonly<IOptions>; +} + +/** +Extends [`minimatch.match()`](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options) with support for multiple patterns. + +@param paths - Paths to match against. +@param patterns - Globbing patterns to use. For example: `['*', '!cake']`. See supported [`minimatch` patterns](https://github.com/isaacs/minimatch#usage). +@returns The matching paths in the order of input paths. + +@example +``` +import multimatch = require('multimatch'); + +multimatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']); +//=> ['unicorn', 'rainbows'] +``` +*/ +declare function multimatch( + paths: string | readonly string[], + patterns: string | readonly string[], + options?: multimatch.Options +): string[]; + +export = multimatch; diff --git a/node_modules/multimatch/index.js b/node_modules/multimatch/index.js new file mode 100644 index 00000000..a0833b52 --- /dev/null +++ b/node_modules/multimatch/index.js @@ -0,0 +1,30 @@ +'use strict'; +const minimatch = require('minimatch'); +const arrayUnion = require('array-union'); +const arrayDiffer = require('array-differ'); +const arrify = require('arrify'); + +module.exports = (list, patterns, options = {}) => { + list = arrify(list); + patterns = arrify(patterns); + + if (list.length === 0 || patterns.length === 0) { + return []; + } + + let result = []; + for (const item of list) { + for (let pattern of patterns) { + let process = arrayUnion; + + if (pattern[0] === '!') { + pattern = pattern.slice(1); + process = arrayDiffer; + } + + result = process(result, minimatch.match([item], pattern, options)); + } + } + + return result; +}; diff --git a/node_modules/multimatch/license b/node_modules/multimatch/license new file mode 100644 index 00000000..fa7ceba3 --- /dev/null +++ b/node_modules/multimatch/license @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/multimatch/package.json b/node_modules/multimatch/package.json new file mode 100644 index 00000000..15ef68bf --- /dev/null +++ b/node_modules/multimatch/package.json @@ -0,0 +1,48 @@ +{ + "name": "multimatch", + "version": "5.0.0", + "description": "Extends `minimatch.match()` with support for multiple patterns", + "license": "MIT", + "repository": "sindresorhus/multimatch", + "funding": "https://github.com/sponsors/sindresorhus", + "author": { + "name": "Sindre Sorhus", + "email": "sindresorhus@gmail.com", + "url": "https://sindresorhus.com" + }, + "engines": { + "node": ">=10" + }, + "scripts": { + "test": "xo && ava && tsd" + }, + "files": [ + "index.js", + "index.d.ts" + ], + "keywords": [ + "expand", + "find", + "glob", + "globbing", + "globs", + "match", + "matcher", + "minimatch", + "pattern", + "patterns", + "wildcard" + ], + "dependencies": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "devDependencies": { + "ava": "^2.4.0", + "tsd": "^0.13.1", + "xo": "^0.33.1" + } +} diff --git a/node_modules/multimatch/readme.md b/node_modules/multimatch/readme.md new file mode 100644 index 00000000..6426d2e3 --- /dev/null +++ b/node_modules/multimatch/readme.md @@ -0,0 +1,80 @@ +# multimatch [](https://travis-ci.com/github/sindresorhus/multimatch) + +> Extends [`minimatch.match()`](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options) with support for multiple patterns + +## Install + +``` +$ npm install multimatch +``` + +## Usage + +```js +const multimatch = require('multimatch'); + +multimatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']); +//=> ['unicorn', 'rainbows'] +``` + +See the [tests](https://github.com/sindresorhus/multimatch/tree/master/test) for more usage examples and expected matches. + +## API + +### multimatch(paths, patterns, options?) + +Returns an array of matching paths in the order of input paths. + +#### paths + +Type: `string | string[]` + +Paths to match against. + +#### patterns + +Type: `string | string[]` + +Globbing patterns to use. For example: `['*', '!cake']`. See supported [`minimatch` patterns](https://github.com/isaacs/minimatch#usage). + +- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js) +- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) + +#### options + +Type: `object` + +See the [`minimatch` options](https://github.com/isaacs/minimatch#options). + +## How multiple patterns work + +Positive patterns (e.g. `foo` or `*`) add to the results, while negative patterns (e.g. `!foo`) subtract from the results. + +Therefore a lone negation (e.g. `['!foo']`) will never match anything – use `['*', '!foo']` instead. + +## Globbing patterns + +Just a quick overview. + +- `*` matches any number of characters, but not `/` +- `?` matches a single character, but not `/` +- `**` matches any number of characters, including `/`, as long as it's the only thing in a path part +- `{}` allows for a comma-separated list of "or" expressions +- `!` at the beginning of a pattern will negate the match + +## Related + +- [globby](https://github.com/sindresorhus/globby) - Match against the filesystem instead of a list +- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching + +--- + +<div align="center"> + <b> + <a href="https://tidelift.com/subscription/pkg/npm-multimatch?utm_source=npm-multimatch&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a> + </b> + <br> + <sub> + Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies. + </sub> +</div> diff --git a/node_modules/readable-stream/.npmignore b/node_modules/readable-stream/.npmignore new file mode 100644 index 00000000..38344f87 --- /dev/null +++ b/node_modules/readable-stream/.npmignore @@ -0,0 +1,5 @@ +build/ +test/ +examples/ +fs.js +zlib.js
\ No newline at end of file diff --git a/node_modules/readable-stream/LICENSE b/node_modules/readable-stream/LICENSE new file mode 100644 index 00000000..e3d4e695 --- /dev/null +++ b/node_modules/readable-stream/LICENSE @@ -0,0 +1,18 @@ +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/node_modules/readable-stream/README.md b/node_modules/readable-stream/README.md new file mode 100644 index 00000000..e46b8239 --- /dev/null +++ b/node_modules/readable-stream/README.md @@ -0,0 +1,15 @@ +# readable-stream + +***Node-core streams for userland*** + +[](https://nodei.co/npm/readable-stream/) +[](https://nodei.co/npm/readable-stream/) + +This package is a mirror of the Streams2 and Streams3 implementations in Node-core. + +If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core. + +**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12. + +**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"` + diff --git a/node_modules/readable-stream/duplex.js b/node_modules/readable-stream/duplex.js new file mode 100644 index 00000000..ca807af8 --- /dev/null +++ b/node_modules/readable-stream/duplex.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_duplex.js") diff --git a/node_modules/readable-stream/float.patch b/node_modules/readable-stream/float.patch new file mode 100644 index 00000000..b984607a --- /dev/null +++ b/node_modules/readable-stream/float.patch @@ -0,0 +1,923 @@ +diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js +index c5a741c..a2e0d8e 100644 +--- a/lib/_stream_duplex.js ++++ b/lib/_stream_duplex.js +@@ -26,8 +26,8 @@ + + module.exports = Duplex; + var util = require('util'); +-var Readable = require('_stream_readable'); +-var Writable = require('_stream_writable'); ++var Readable = require('./_stream_readable'); ++var Writable = require('./_stream_writable'); + + util.inherits(Duplex, Readable); + +diff --git a/lib/_stream_passthrough.js b/lib/_stream_passthrough.js +index a5e9864..330c247 100644 +--- a/lib/_stream_passthrough.js ++++ b/lib/_stream_passthrough.js +@@ -25,7 +25,7 @@ + + module.exports = PassThrough; + +-var Transform = require('_stream_transform'); ++var Transform = require('./_stream_transform'); + var util = require('util'); + util.inherits(PassThrough, Transform); + +diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js +index 0c3fe3e..90a8298 100644 +--- a/lib/_stream_readable.js ++++ b/lib/_stream_readable.js +@@ -23,10 +23,34 @@ module.exports = Readable; + Readable.ReadableState = ReadableState; + + var EE = require('events').EventEmitter; ++if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { ++ return emitter.listeners(type).length; ++}; ++ ++if (!global.setImmediate) global.setImmediate = function setImmediate(fn) { ++ return setTimeout(fn, 0); ++}; ++if (!global.clearImmediate) global.clearImmediate = function clearImmediate(i) { ++ return clearTimeout(i); ++}; ++ + var Stream = require('stream'); + var util = require('util'); ++if (!util.isUndefined) { ++ var utilIs = require('core-util-is'); ++ for (var f in utilIs) { ++ util[f] = utilIs[f]; ++ } ++} + var StringDecoder; +-var debug = util.debuglog('stream'); ++var debug; ++if (util.debuglog) ++ debug = util.debuglog('stream'); ++else try { ++ debug = require('debuglog')('stream'); ++} catch (er) { ++ debug = function() {}; ++} + + util.inherits(Readable, Stream); + +@@ -380,7 +404,7 @@ function chunkInvalid(state, chunk) { + + + function onEofChunk(stream, state) { +- if (state.decoder && !state.ended) { ++ if (state.decoder && !state.ended && state.decoder.end) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); +diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js +index b1f9fcc..b0caf57 100644 +--- a/lib/_stream_transform.js ++++ b/lib/_stream_transform.js +@@ -64,8 +64,14 @@ + + module.exports = Transform; + +-var Duplex = require('_stream_duplex'); ++var Duplex = require('./_stream_duplex'); + var util = require('util'); ++if (!util.isUndefined) { ++ var utilIs = require('core-util-is'); ++ for (var f in utilIs) { ++ util[f] = utilIs[f]; ++ } ++} + util.inherits(Transform, Duplex); + + +diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js +index ba2e920..f49288b 100644 +--- a/lib/_stream_writable.js ++++ b/lib/_stream_writable.js +@@ -27,6 +27,12 @@ module.exports = Writable; + Writable.WritableState = WritableState; + + var util = require('util'); ++if (!util.isUndefined) { ++ var utilIs = require('core-util-is'); ++ for (var f in utilIs) { ++ util[f] = utilIs[f]; ++ } ++} + var Stream = require('stream'); + + util.inherits(Writable, Stream); +@@ -119,7 +125,7 @@ function WritableState(options, stream) { + function Writable(options) { + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. +- if (!(this instanceof Writable) && !(this instanceof Stream.Duplex)) ++ if (!(this instanceof Writable) && !(this instanceof require('./_stream_duplex'))) + return new Writable(options); + + this._writableState = new WritableState(options, this); +diff --git a/test/simple/test-stream-big-push.js b/test/simple/test-stream-big-push.js +index e3787e4..8cd2127 100644 +--- a/test/simple/test-stream-big-push.js ++++ b/test/simple/test-stream-big-push.js +@@ -21,7 +21,7 @@ + + var common = require('../common'); + var assert = require('assert'); +-var stream = require('stream'); ++var stream = require('../../'); + var str = 'asdfasdfasdfasdfasdf'; + + var r = new stream.Readable({ +diff --git a/test/simple/test-stream-end-paused.js b/test/simple/test-stream-end-paused.js +index bb73777..d40efc7 100644 +--- a/test/simple/test-stream-end-paused.js ++++ b/test/simple/test-stream-end-paused.js +@@ -25,7 +25,7 @@ var gotEnd = false; + + // Make sure we don't miss the end event for paused 0-length streams + +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + var stream = new Readable(); + var calledRead = false; + stream._read = function() { +diff --git a/test/simple/test-stream-pipe-after-end.js b/test/simple/test-stream-pipe-after-end.js +index b46ee90..0be8366 100644 +--- a/test/simple/test-stream-pipe-after-end.js ++++ b/test/simple/test-stream-pipe-after-end.js +@@ -22,8 +22,8 @@ + var common = require('../common'); + var assert = require('assert'); + +-var Readable = require('_stream_readable'); +-var Writable = require('_stream_writable'); ++var Readable = require('../../lib/_stream_readable'); ++var Writable = require('../../lib/_stream_writable'); + var util = require('util'); + + util.inherits(TestReadable, Readable); +diff --git a/test/simple/test-stream-pipe-cleanup.js b/test/simple/test-stream-pipe-cleanup.js +deleted file mode 100644 +index f689358..0000000 +--- a/test/simple/test-stream-pipe-cleanup.js ++++ /dev/null +@@ -1,122 +0,0 @@ +-// Copyright Joyent, Inc. and other Node contributors. +-// +-// Permission is hereby granted, free of charge, to any person obtaining a +-// copy of this software and associated documentation files (the +-// "Software"), to deal in the Software without restriction, including +-// without limitation the rights to use, copy, modify, merge, publish, +-// distribute, sublicense, and/or sell copies of the Software, and to permit +-// persons to whom the Software is furnished to do so, subject to the +-// following conditions: +-// +-// The above copyright notice and this permission notice shall be included +-// in all copies or substantial portions of the Software. +-// +-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +-// USE OR OTHER DEALINGS IN THE SOFTWARE. +- +-// This test asserts that Stream.prototype.pipe does not leave listeners +-// hanging on the source or dest. +- +-var common = require('../common'); +-var stream = require('stream'); +-var assert = require('assert'); +-var util = require('util'); +- +-function Writable() { +- this.writable = true; +- this.endCalls = 0; +- stream.Stream.call(this); +-} +-util.inherits(Writable, stream.Stream); +-Writable.prototype.end = function() { +- this.endCalls++; +-}; +- +-Writable.prototype.destroy = function() { +- this.endCalls++; +-}; +- +-function Readable() { +- this.readable = true; +- stream.Stream.call(this); +-} +-util.inherits(Readable, stream.Stream); +- +-function Duplex() { +- this.readable = true; +- Writable.call(this); +-} +-util.inherits(Duplex, Writable); +- +-var i = 0; +-var limit = 100; +- +-var w = new Writable(); +- +-var r; +- +-for (i = 0; i < limit; i++) { +- r = new Readable(); +- r.pipe(w); +- r.emit('end'); +-} +-assert.equal(0, r.listeners('end').length); +-assert.equal(limit, w.endCalls); +- +-w.endCalls = 0; +- +-for (i = 0; i < limit; i++) { +- r = new Readable(); +- r.pipe(w); +- r.emit('close'); +-} +-assert.equal(0, r.listeners('close').length); +-assert.equal(limit, w.endCalls); +- +-w.endCalls = 0; +- +-r = new Readable(); +- +-for (i = 0; i < limit; i++) { +- w = new Writable(); +- r.pipe(w); +- w.emit('close'); +-} +-assert.equal(0, w.listeners('close').length); +- +-r = new Readable(); +-w = new Writable(); +-var d = new Duplex(); +-r.pipe(d); // pipeline A +-d.pipe(w); // pipeline B +-assert.equal(r.listeners('end').length, 2); // A.onend, A.cleanup +-assert.equal(r.listeners('close').length, 2); // A.onclose, A.cleanup +-assert.equal(d.listeners('end').length, 2); // B.onend, B.cleanup +-assert.equal(d.listeners('close').length, 3); // A.cleanup, B.onclose, B.cleanup +-assert.equal(w.listeners('end').length, 0); +-assert.equal(w.listeners('close').length, 1); // B.cleanup +- +-r.emit('end'); +-assert.equal(d.endCalls, 1); +-assert.equal(w.endCalls, 0); +-assert.equal(r.listeners('end').length, 0); +-assert.equal(r.listeners('close').length, 0); +-assert.equal(d.listeners('end').length, 2); // B.onend, B.cleanup +-assert.equal(d.listeners('close').length, 2); // B.onclose, B.cleanup +-assert.equal(w.listeners('end').length, 0); +-assert.equal(w.listeners('close').length, 1); // B.cleanup +- +-d.emit('end'); +-assert.equal(d.endCalls, 1); +-assert.equal(w.endCalls, 1); +-assert.equal(r.listeners('end').length, 0); +-assert.equal(r.listeners('close').length, 0); +-assert.equal(d.listeners('end').length, 0); +-assert.equal(d.listeners('close').length, 0); +-assert.equal(w.listeners('end').length, 0); +-assert.equal(w.listeners('close').length, 0); +diff --git a/test/simple/test-stream-pipe-error-handling.js b/test/simple/test-stream-pipe-error-handling.js +index c5d724b..c7d6b7d 100644 +--- a/test/simple/test-stream-pipe-error-handling.js ++++ b/test/simple/test-stream-pipe-error-handling.js +@@ -21,7 +21,7 @@ + + var common = require('../common'); + var assert = require('assert'); +-var Stream = require('stream').Stream; ++var Stream = require('../../').Stream; + + (function testErrorListenerCatches() { + var source = new Stream(); +diff --git a/test/simple/test-stream-pipe-event.js b/test/simple/test-stream-pipe-event.js +index cb9d5fe..56f8d61 100644 +--- a/test/simple/test-stream-pipe-event.js ++++ b/test/simple/test-stream-pipe-event.js +@@ -20,7 +20,7 @@ + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + var common = require('../common'); +-var stream = require('stream'); ++var stream = require('../../'); + var assert = require('assert'); + var util = require('util'); + +diff --git a/test/simple/test-stream-push-order.js b/test/simple/test-stream-push-order.js +index f2e6ec2..a5c9bf9 100644 +--- a/test/simple/test-stream-push-order.js ++++ b/test/simple/test-stream-push-order.js +@@ -20,7 +20,7 @@ + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + var common = require('../common.js'); +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + var assert = require('assert'); + + var s = new Readable({ +diff --git a/test/simple/test-stream-push-strings.js b/test/simple/test-stream-push-strings.js +index 06f43dc..1701a9a 100644 +--- a/test/simple/test-stream-push-strings.js ++++ b/test/simple/test-stream-push-strings.js +@@ -22,7 +22,7 @@ + var common = require('../common'); + var assert = require('assert'); + +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + var util = require('util'); + + util.inherits(MyStream, Readable); +diff --git a/test/simple/test-stream-readable-event.js b/test/simple/test-stream-readable-event.js +index ba6a577..a8e6f7b 100644 +--- a/test/simple/test-stream-readable-event.js ++++ b/test/simple/test-stream-readable-event.js +@@ -22,7 +22,7 @@ + var common = require('../common'); + var assert = require('assert'); + +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + + (function first() { + // First test, not reading when the readable is added. +diff --git a/test/simple/test-stream-readable-flow-recursion.js b/test/simple/test-stream-readable-flow-recursion.js +index 2891ad6..11689ba 100644 +--- a/test/simple/test-stream-readable-flow-recursion.js ++++ b/test/simple/test-stream-readable-flow-recursion.js +@@ -27,7 +27,7 @@ var assert = require('assert'); + // more data continuously, but without triggering a nextTick + // warning or RangeError. + +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + + // throw an error if we trigger a nextTick warning. + process.throwDeprecation = true; +diff --git a/test/simple/test-stream-unshift-empty-chunk.js b/test/simple/test-stream-unshift-empty-chunk.js +index 0c96476..7827538 100644 +--- a/test/simple/test-stream-unshift-empty-chunk.js ++++ b/test/simple/test-stream-unshift-empty-chunk.js +@@ -24,7 +24,7 @@ var assert = require('assert'); + + // This test verifies that stream.unshift(Buffer(0)) or + // stream.unshift('') does not set state.reading=false. +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + + var r = new Readable(); + var nChunks = 10; +diff --git a/test/simple/test-stream-unshift-read-race.js b/test/simple/test-stream-unshift-read-race.js +index 83fd9fa..17c18aa 100644 +--- a/test/simple/test-stream-unshift-read-race.js ++++ b/test/simple/test-stream-unshift-read-race.js +@@ -29,7 +29,7 @@ var assert = require('assert'); + // 3. push() after the EOF signaling null is an error. + // 4. _read() is not called after pushing the EOF null chunk. + +-var stream = require('stream'); ++var stream = require('../../'); + var hwm = 10; + var r = stream.Readable({ highWaterMark: hwm }); + var chunks = 10; +@@ -51,7 +51,14 @@ r._read = function(n) { + + function push(fast) { + assert(!pushedNull, 'push() after null push'); +- var c = pos >= data.length ? null : data.slice(pos, pos + n); ++ var c; ++ if (pos >= data.length) ++ c = null; ++ else { ++ if (n + pos > data.length) ++ n = data.length - pos; ++ c = data.slice(pos, pos + n); ++ } + pushedNull = c === null; + if (fast) { + pos += n; +diff --git a/test/simple/test-stream-writev.js b/test/simple/test-stream-writev.js +index 5b49e6e..b5321f3 100644 +--- a/test/simple/test-stream-writev.js ++++ b/test/simple/test-stream-writev.js +@@ -22,7 +22,7 @@ + var common = require('../common'); + var assert = require('assert'); + +-var stream = require('stream'); ++var stream = require('../../'); + + var queue = []; + for (var decode = 0; decode < 2; decode++) { +diff --git a/test/simple/test-stream2-basic.js b/test/simple/test-stream2-basic.js +index 3814bf0..248c1be 100644 +--- a/test/simple/test-stream2-basic.js ++++ b/test/simple/test-stream2-basic.js +@@ -21,7 +21,7 @@ + + + var common = require('../common.js'); +-var R = require('_stream_readable'); ++var R = require('../../lib/_stream_readable'); + var assert = require('assert'); + + var util = require('util'); +diff --git a/test/simple/test-stream2-compatibility.js b/test/simple/test-stream2-compatibility.js +index 6cdd4e9..f0fa84b 100644 +--- a/test/simple/test-stream2-compatibility.js ++++ b/test/simple/test-stream2-compatibility.js +@@ -21,7 +21,7 @@ + + + var common = require('../common.js'); +-var R = require('_stream_readable'); ++var R = require('../../lib/_stream_readable'); + var assert = require('assert'); + + var util = require('util'); +diff --git a/test/simple/test-stream2-finish-pipe.js b/test/simple/test-stream2-finish-pipe.js +index 39b274f..006a19b 100644 +--- a/test/simple/test-stream2-finish-pipe.js ++++ b/test/simple/test-stream2-finish-pipe.js +@@ -20,7 +20,7 @@ + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + var common = require('../common.js'); +-var stream = require('stream'); ++var stream = require('../../'); + var Buffer = require('buffer').Buffer; + + var r = new stream.Readable(); +diff --git a/test/simple/test-stream2-fs.js b/test/simple/test-stream2-fs.js +deleted file mode 100644 +index e162406..0000000 +--- a/test/simple/test-stream2-fs.js ++++ /dev/null +@@ -1,72 +0,0 @@ +-// Copyright Joyent, Inc. and other Node contributors. +-// +-// Permission is hereby granted, free of charge, to any person obtaining a +-// copy of this software and associated documentation files (the +-// "Software"), to deal in the Software without restriction, including +-// without limitation the rights to use, copy, modify, merge, publish, +-// distribute, sublicense, and/or sell copies of the Software, and to permit +-// persons to whom the Software is furnished to do so, subject to the +-// following conditions: +-// +-// The above copyright notice and this permission notice shall be included +-// in all copies or substantial portions of the Software. +-// +-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +-// USE OR OTHER DEALINGS IN THE SOFTWARE. +- +- +-var common = require('../common.js'); +-var R = require('_stream_readable'); +-var assert = require('assert'); +- +-var fs = require('fs'); +-var FSReadable = fs.ReadStream; +- +-var path = require('path'); +-var file = path.resolve(common.fixturesDir, 'x1024.txt'); +- +-var size = fs.statSync(file).size; +- +-var expectLengths = [1024]; +- +-var util = require('util'); +-var Stream = require('stream'); +- +-util.inherits(TestWriter, Stream); +- +-function TestWriter() { +- Stream.apply(this); +- this.buffer = []; +- this.length = 0; +-} +- +-TestWriter.prototype.write = function(c) { +- this.buffer.push(c.toString()); +- this.length += c.length; +- return true; +-}; +- +-TestWriter.prototype.end = function(c) { +- if (c) this.buffer.push(c.toString()); +- this.emit('results', this.buffer); +-} +- +-var r = new FSReadable(file); +-var w = new TestWriter(); +- +-w.on('results', function(res) { +- console.error(res, w.length); +- assert.equal(w.length, size); +- var l = 0; +- assert.deepEqual(res.map(function (c) { +- return c.length; +- }), expectLengths); +- console.log('ok'); +-}); +- +-r.pipe(w); +diff --git a/test/simple/test-stream2-httpclient-response-end.js b/test/simple/test-stream2-httpclient-response-end.js +deleted file mode 100644 +index 15cffc2..0000000 +--- a/test/simple/test-stream2-httpclient-response-end.js ++++ /dev/null +@@ -1,52 +0,0 @@ +-// Copyright Joyent, Inc. and other Node contributors. +-// +-// Permission is hereby granted, free of charge, to any person obtaining a +-// copy of this software and associated documentation files (the +-// "Software"), to deal in the Software without restriction, including +-// without limitation the rights to use, copy, modify, merge, publish, +-// distribute, sublicense, and/or sell copies of the Software, and to permit +-// persons to whom the Software is furnished to do so, subject to the +-// following conditions: +-// +-// The above copyright notice and this permission notice shall be included +-// in all copies or substantial portions of the Software. +-// +-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +-// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +-// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +-// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +-// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +-// USE OR OTHER DEALINGS IN THE SOFTWARE. +- +-var common = require('../common.js'); +-var assert = require('assert'); +-var http = require('http'); +-var msg = 'Hello'; +-var readable_event = false; +-var end_event = false; +-var server = http.createServer(function(req, res) { +- res.writeHead(200, {'Content-Type': 'text/plain'}); +- res.end(msg); +-}).listen(common.PORT, function() { +- http.get({port: common.PORT}, function(res) { +- var data = ''; +- res.on('readable', function() { +- console.log('readable event'); +- readable_event = true; +- data += res.read(); +- }); +- res.on('end', function() { +- console.log('end event'); +- end_event = true; +- assert.strictEqual(msg, data); +- server.close(); +- }); +- }); +-}); +- +-process.on('exit', function() { +- assert(readable_event); +- assert(end_event); +-}); +- +diff --git a/test/simple/test-stream2-large-read-stall.js b/test/simple/test-stream2-large-read-stall.js +index 2fbfbca..667985b 100644 +--- a/test/simple/test-stream2-large-read-stall.js ++++ b/test/simple/test-stream2-large-read-stall.js +@@ -30,7 +30,7 @@ var PUSHSIZE = 20; + var PUSHCOUNT = 1000; + var HWM = 50; + +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + var r = new Readable({ + highWaterMark: HWM + }); +@@ -39,23 +39,23 @@ var rs = r._readableState; + r._read = push; + + r.on('readable', function() { +- console.error('>> readable'); ++ //console.error('>> readable'); + do { +- console.error(' > read(%d)', READSIZE); ++ //console.error(' > read(%d)', READSIZE); + var ret = r.read(READSIZE); +- console.error(' < %j (%d remain)', ret && ret.length, rs.length); ++ //console.error(' < %j (%d remain)', ret && ret.length, rs.length); + } while (ret && ret.length === READSIZE); + +- console.error('<< after read()', +- ret && ret.length, +- rs.needReadable, +- rs.length); ++ //console.error('<< after read()', ++ // ret && ret.length, ++ // rs.needReadable, ++ // rs.length); + }); + + var endEmitted = false; + r.on('end', function() { + endEmitted = true; +- console.error('end'); ++ //console.error('end'); + }); + + var pushes = 0; +@@ -64,11 +64,11 @@ function push() { + return; + + if (pushes++ === PUSHCOUNT) { +- console.error(' push(EOF)'); ++ //console.error(' push(EOF)'); + return r.push(null); + } + +- console.error(' push #%d', pushes); ++ //console.error(' push #%d', pushes); + if (r.push(new Buffer(PUSHSIZE))) + setTimeout(push); + } +diff --git a/test/simple/test-stream2-objects.js b/test/simple/test-stream2-objects.js +index 3e6931d..ff47d89 100644 +--- a/test/simple/test-stream2-objects.js ++++ b/test/simple/test-stream2-objects.js +@@ -21,8 +21,8 @@ + + + var common = require('../common.js'); +-var Readable = require('_stream_readable'); +-var Writable = require('_stream_writable'); ++var Readable = require('../../lib/_stream_readable'); ++var Writable = require('../../lib/_stream_writable'); + var assert = require('assert'); + + // tiny node-tap lookalike. +diff --git a/test/simple/test-stream2-pipe-error-handling.js b/test/simple/test-stream2-pipe-error-handling.js +index cf7531c..e3f3e4e 100644 +--- a/test/simple/test-stream2-pipe-error-handling.js ++++ b/test/simple/test-stream2-pipe-error-handling.js +@@ -21,7 +21,7 @@ + + var common = require('../common'); + var assert = require('assert'); +-var stream = require('stream'); ++var stream = require('../../'); + + (function testErrorListenerCatches() { + var count = 1000; +diff --git a/test/simple/test-stream2-pipe-error-once-listener.js b/test/simple/test-stream2-pipe-error-once-listener.js +index 5e8e3cb..53b2616 100755 +--- a/test/simple/test-stream2-pipe-error-once-listener.js ++++ b/test/simple/test-stream2-pipe-error-once-listener.js +@@ -24,7 +24,7 @@ var common = require('../common.js'); + var assert = require('assert'); + + var util = require('util'); +-var stream = require('stream'); ++var stream = require('../../'); + + + var Read = function() { +diff --git a/test/simple/test-stream2-push.js b/test/simple/test-stream2-push.js +index b63edc3..eb2b0e9 100644 +--- a/test/simple/test-stream2-push.js ++++ b/test/simple/test-stream2-push.js +@@ -20,7 +20,7 @@ + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + var common = require('../common.js'); +-var stream = require('stream'); ++var stream = require('../../'); + var Readable = stream.Readable; + var Writable = stream.Writable; + var assert = require('assert'); +diff --git a/test/simple/test-stream2-read-sync-stack.js b/test/simple/test-stream2-read-sync-stack.js +index e8a7305..9740a47 100644 +--- a/test/simple/test-stream2-read-sync-stack.js ++++ b/test/simple/test-stream2-read-sync-stack.js +@@ -21,7 +21,7 @@ + + var common = require('../common'); + var assert = require('assert'); +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + var r = new Readable(); + var N = 256 * 1024; + +diff --git a/test/simple/test-stream2-readable-empty-buffer-no-eof.js b/test/simple/test-stream2-readable-empty-buffer-no-eof.js +index cd30178..4b1659d 100644 +--- a/test/simple/test-stream2-readable-empty-buffer-no-eof.js ++++ b/test/simple/test-stream2-readable-empty-buffer-no-eof.js +@@ -22,10 +22,9 @@ + var common = require('../common'); + var assert = require('assert'); + +-var Readable = require('stream').Readable; ++var Readable = require('../../').Readable; + + test1(); +-test2(); + + function test1() { + var r = new Readable(); +@@ -88,31 +87,3 @@ function test1() { + console.log('ok'); + }); + } +- +-function test2() { +- var r = new Readable({ encoding: 'base64' }); +- var reads = 5; +- r._read = function(n) { +- if (!reads--) +- return r.push(null); // EOF +- else +- return r.push(new Buffer('x')); +- }; +- +- var results = []; +- function flow() { +- var chunk; +- while (null !== (chunk = r.read())) +- results.push(chunk + ''); +- } +- r.on('readable', flow); +- r.on('end', function() { +- results.push('EOF'); +- }); +- flow(); +- +- process.on('exit', function() { +- assert.deepEqual(results, [ 'eHh4', 'eHg=', 'EOF' ]); +- console.log('ok'); +- }); +-} +diff --git a/test/simple/test-stream2-readable-from-list.js b/test/simple/test-stream2-readable-from-list.js +index 7c96ffe..04a96f5 100644 +--- a/test/simple/test-stream2-readable-from-list.js ++++ b/test/simple/test-stream2-readable-from-list.js +@@ -21,7 +21,7 @@ + + var assert = require('assert'); + var common = require('../common.js'); +-var fromList = require('_stream_readable')._fromList; ++var fromList = require('../../lib/_stream_readable')._fromList; + + // tiny node-tap lookalike. + var tests = []; +diff --git a/test/simple/test-stream2-readable-legacy-drain.js b/test/simple/test-stream2-readable-legacy-drain.js +index 675da8e..51fd3d5 100644 +--- a/test/simple/test-stream2-readable-legacy-drain.js ++++ b/test/simple/test-stream2-readable-legacy-drain.js +@@ -22,7 +22,7 @@ + var common = require('../common'); + var assert = require('assert'); + +-var Stream = require('stream'); ++var Stream = require('../../'); + var Readable = Stream.Readable; + + var r = new Readable(); +diff --git a/test/simple/test-stream2-readable-non-empty-end.js b/test/simple/test-stream2-readable-non-empty-end.js +index 7314ae7..c971898 100644 +--- a/test/simple/test-stream2-readable-non-empty-end.js ++++ b/test/simple/test-stream2-readable-non-empty-end.js +@@ -21,7 +21,7 @@ + + var assert = require('assert'); + var common = require('../common.js'); +-var Readable = require('_stream_readable'); ++var Readable = require('../../lib/_stream_readable'); + + var len = 0; + var chunks = new Array(10); +diff --git a/test/simple/test-stream2-readable-wrap-empty.js b/test/simple/test-stream2-readable-wrap-empty.js +index 2e5cf25..fd8a3dc 100644 +--- a/test/simple/test-stream2-readable-wrap-empty.js ++++ b/test/simple/test-stream2-readable-wrap-empty.js +@@ -22,7 +22,7 @@ + var common = require('../common'); + var assert = require('assert'); + +-var Readable = require('_stream_readable'); ++var Readable = require('../../lib/_stream_readable'); + var EE = require('events').EventEmitter; + + var oldStream = new EE(); +diff --git a/test/simple/test-stream2-readable-wrap.js b/test/simple/test-stream2-readable-wrap.js +index 90eea01..6b177f7 100644 +--- a/test/simple/test-stream2-readable-wrap.js ++++ b/test/simple/test-stream2-readable-wrap.js +@@ -22,8 +22,8 @@ + var common = require('../common'); + var assert = require('assert'); + +-var Readable = require('_stream_readable'); +-var Writable = require('_stream_writable'); ++var Readable = require('../../lib/_stream_readable'); ++var Writable = require('../../lib/_stream_writable'); + var EE = require('events').EventEmitter; + + var testRuns = 0, completedRuns = 0; +diff --git a/test/simple/test-stream2-set-encoding.js b/test/simple/test-stream2-set-encoding.js +index 5d2c32a..685531b 100644 +--- a/test/simple/test-stream2-set-encoding.js ++++ b/test/simple/test-stream2-set-encoding.js +@@ -22,7 +22,7 @@ + + var common = require('../common.js'); + var assert = require('assert'); +-var R = require('_stream_readable'); ++var R = require('../../lib/_stream_readable'); + var util = require('util'); + + // tiny node-tap lookalike. +diff --git a/test/simple/test-stream2-transform.js b/test/simple/test-stream2-transform.js +index 9c9ddd8..a0cacc6 100644 +--- a/test/simple/test-stream2-transform.js ++++ b/test/simple/test-stream2-transform.js +@@ -21,8 +21,8 @@ + + var assert = require('assert'); + var common = require('../common.js'); +-var PassThrough = require('_stream_passthrough'); +-var Transform = require('_stream_transform'); ++var PassThrough = require('../../').PassThrough; ++var Transform = require('../../').Transform; + + // tiny node-tap lookalike. + var tests = []; +diff --git a/test/simple/test-stream2-unpipe-drain.js b/test/simple/test-stream2-unpipe-drain.js +index d66dc3c..365b327 100644 +--- a/test/simple/test-stream2-unpipe-drain.js ++++ b/test/simple/test-stream2-unpipe-drain.js +@@ -22,7 +22,7 @@ + + var common = require('../common.js'); + var assert = require('assert'); +-var stream = require('stream'); ++var stream = require('../../'); + var crypto = require('crypto'); + + var util = require('util'); +diff --git a/test/simple/test-stream2-unpipe-leak.js b/test/simple/test-stream2-unpipe-leak.js +index 99f8746..17c92ae 100644 +--- a/test/simple/test-stream2-unpipe-leak.js ++++ b/test/simple/test-stream2-unpipe-leak.js +@@ -22,7 +22,7 @@ + + var common = require('../common.js'); + var assert = require('assert'); +-var stream = require('stream'); ++var stream = require('../../'); + + var chunk = new Buffer('hallo'); + +diff --git a/test/simple/test-stream2-writable.js b/test/simple/test-stream2-writable.js +index 704100c..209c3a6 100644 +--- a/test/simple/test-stream2-writable.js ++++ b/test/simple/test-stream2-writable.js +@@ -20,8 +20,8 @@ + // USE OR OTHER DEALINGS IN THE SOFTWARE. + + var common = require('../common.js'); +-var W = require('_stream_writable'); +-var D = require('_stream_duplex'); ++var W = require('../../').Writable; ++var D = require('../../').Duplex; + var assert = require('assert'); + + var util = require('util'); +diff --git a/test/simple/test-stream3-pause-then-read.js b/test/simple/test-stream3-pause-then-read.js +index b91bde3..2f72c15 100644 +--- a/test/simple/test-stream3-pause-then-read.js ++++ b/test/simple/test-stream3-pause-then-read.js +@@ -22,7 +22,7 @@ + var common = require('../common'); + var assert = require('assert'); + +-var stream = require('stream'); ++var stream = require('../../'); + var Readable = stream.Readable; + var Writable = stream.Writable; + diff --git a/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 00000000..b513d61a --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,89 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +module.exports = Duplex; + +/*<replacement>*/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} +/*</replacement>*/ + + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +forEach(objectKeys(Writable.prototype), function(method) { + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; +}); + +function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) + this.readable = false; + + if (options && options.writable === false) + this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) + this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) + return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(this.end.bind(this)); +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} diff --git a/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 00000000..895ca50a --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,46 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); +}; diff --git a/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 00000000..19ab3588 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,951 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Readable; + +/*<replacement>*/ +var isArray = require('isarray'); +/*</replacement>*/ + + +/*<replacement>*/ +var Buffer = require('buffer').Buffer; +/*</replacement>*/ + +Readable.ReadableState = ReadableState; + +var EE = require('events').EventEmitter; + +/*<replacement>*/ +if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { + return emitter.listeners(type).length; +}; +/*</replacement>*/ + +var Stream = require('stream'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var StringDecoder; + + +/*<replacement>*/ +var debug = require('util'); +if (debug && debug.debuglog) { + debug = debug.debuglog('stream'); +} else { + debug = function () {}; +} +/*</replacement>*/ + + +util.inherits(Readable, Stream); + +function ReadableState(options, stream) { + var Duplex = require('./_stream_duplex'); + + options = options || {}; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + var defaultHwm = options.objectMode ? 16 : 16 * 1024; + this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.buffer = []; + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) + this.objectMode = this.objectMode || !!options.readableObjectMode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + var Duplex = require('./_stream_duplex'); + + if (!(this instanceof Readable)) + return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + + if (util.isString(chunk) && !state.objectMode) { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = new Buffer(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function(chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (util.isNullOrUndefined(chunk)) { + state.reading = false; + if (!state.ended) + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var e = new Error('stream.unshift() after end event'); + stream.emit('error', e); + } else { + if (state.decoder && !addToFront && !encoding) + chunk = state.decoder.write(chunk); + + if (!addToFront) + state.reading = false; + + // if we want the data now, just emit it. + if (state.flowing && state.length === 0 && !state.sync) { + stream.emit('data', chunk); + stream.read(0); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) + state.buffer.unshift(chunk); + else + state.buffer.push(chunk); + + if (state.needReadable) + emitReadable(stream); + } + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + + + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && + (state.needReadable || + state.length < state.highWaterMark || + state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; + return this; +}; + +// Don't raise the hwm > 128MB +var MAX_HWM = 0x800000; +function roundUpToNextPowerOf2(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 + n--; + for (var p = 1; p < 32; p <<= 1) n |= n >> p; + n++; + } + return n; +} + +function howMuchToRead(n, state) { + if (state.length === 0 && state.ended) + return 0; + + if (state.objectMode) + return n === 0 ? 0 : 1; + + if (isNaN(n) || util.isNull(n)) { + // only flow one buffer at a time + if (state.flowing && state.buffer.length) + return state.buffer[0].length; + else + return state.length; + } + + if (n <= 0) + return 0; + + // If we're asking for more than the target buffer level, + // then raise the water mark. Bump up to the next highest + // power of 2, to prevent increasing it excessively in tiny + // amounts. + if (n > state.highWaterMark) + state.highWaterMark = roundUpToNextPowerOf2(n); + + // don't have that much. return null, unless we've ended. + if (n > state.length) { + if (!state.ended) { + state.needReadable = true; + return 0; + } else + return state.length; + } + + return n; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function(n) { + debug('read', n); + var state = this._readableState; + var nOrig = n; + + if (!util.isNumber(n) || n > 0) + state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && + state.needReadable && + (state.length >= state.highWaterMark || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) + endReadable(this); + else + emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) + endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } + + if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) + state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + } + + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (doRead && !state.reading) + n = howMuchToRead(nOrig, state); + + var ret; + if (n > 0) + ret = fromList(n, state); + else + ret = null; + + if (util.isNull(ret)) { + state.needReadable = true; + n = 0; + } + + state.length -= n; + + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (state.length === 0 && !state.ended) + state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended && state.length === 0) + endReadable(this); + + if (!util.isNull(ret)) + this.emit('data', ret); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!util.isBuffer(chunk) && + !util.isString(chunk) && + !util.isNullOrUndefined(chunk) && + !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + + +function onEofChunk(stream, state) { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // emit 'readable' now to make sure it gets picked up. + emitReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + if (state.sync) + process.nextTick(function() { + emitReadable_(stream); + }); + else + emitReadable_(stream); + } +} + +function emitReadable_(stream) { + debug('emit readable'); + stream.emit('readable'); + flow(stream); +} + + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(function() { + maybeReadMore_(stream, state); + }); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && + state.length < state.highWaterMark) { + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + else + len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function(n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && + dest !== process.stdout && + dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) + process.nextTick(endFn); + else + src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + debug('onunpipe'); + if (readable === src) { + cleanup(); + } + } + + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + src.removeListener('data', ondata); + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && + (!dest._writableState || dest._writableState.needDrain)) + ondrain(); + } + + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + if (false === ret) { + debug('false write response, pause', + src._readableState.awaitDrain); + src._readableState.awaitDrain++; + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EE.listenerCount(dest, 'error') === 0) + dest.emit('error', er); + } + // This is a brutally ugly hack to make sure that our error handler + // is attached before any userland ones. NEVER DO THIS. + if (!dest._events || !dest._events.error) + dest.on('error', onerror); + else if (isArray(dest._events.error)) + dest._events.error.unshift(onerror); + else + dest._events.error = [onerror, dest._events.error]; + + + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) + state.awaitDrain--; + if (state.awaitDrain === 0 && EE.listenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} + + +Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) + return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) + return this; + + if (!dest) + dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) + dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + + for (var i = 0; i < len; i++) + dests[i].emit('unpipe', this); + return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) + return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + // If listening to data, and it has not explicitly been paused, + // then call resume to start the flow of data on the next tick. + if (ev === 'data' && false !== this._readableState.flowing) { + this.resume(); + } + + if (ev === 'readable' && this.readable) { + var state = this._readableState; + if (!state.readableListening) { + state.readableListening = true; + state.emittedReadable = false; + state.needReadable = true; + if (!state.reading) { + var self = this; + process.nextTick(function() { + debug('readable nexttick read 0'); + self.read(0); + }); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function() { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + state.flowing = true; + if (!state.reading) { + debug('resume read 0'); + this.read(0); + } + resume(this, state); + } + return this; +}; + +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(function() { + resume_(stream, state); + }); + } +} + +function resume_(stream, state) { + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) + stream.read(0); +} + +Readable.prototype.pause = function() { + debug('call pause flowing=%j', this._readableState.flowing); + if (false !== this._readableState.flowing) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + return this; +}; + +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + if (state.flowing) { + do { + var chunk = stream.read(); + } while (null !== chunk && state.flowing); + } +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function(stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function() { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function(chunk) { + debug('wrapped data'); + if (state.decoder) + chunk = state.decoder.write(chunk); + if (!chunk || !state.objectMode && !chunk.length) + return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (util.isFunction(stream[i]) && util.isUndefined(this[i])) { + this[i] = function(method) { return function() { + return stream[method].apply(stream, arguments); + }}(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function(ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function(n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + + + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +function fromList(n, state) { + var list = state.buffer; + var length = state.length; + var stringMode = !!state.decoder; + var objectMode = !!state.objectMode; + var ret; + + // nothing in the list, definitely empty. + if (list.length === 0) + return null; + + if (length === 0) + ret = null; + else if (objectMode) + ret = list.shift(); + else if (!n || n >= length) { + // read it all, truncate the array. + if (stringMode) + ret = list.join(''); + else + ret = Buffer.concat(list, length); + list.length = 0; + } else { + // read just some of it. + if (n < list[0].length) { + // just take a part of the first list item. + // slice is the same for buffers and strings. + var buf = list[0]; + ret = buf.slice(0, n); + list[0] = buf.slice(n); + } else if (n === list[0].length) { + // first list is a perfect match + ret = list.shift(); + } else { + // complex case. + // we have enough to cover it, but it spans past the first buffer. + if (stringMode) + ret = ''; + else + ret = new Buffer(n); + + var c = 0; + for (var i = 0, l = list.length; i < l && c < n; i++) { + var buf = list[0]; + var cpy = Math.min(n - c, buf.length); + + if (stringMode) + ret += buf.slice(0, cpy); + else + buf.copy(ret, c, 0, cpy); + + if (cpy < buf.length) + list[0] = buf.slice(cpy); + else + list.shift(); + + c += cpy; + } + } + } + + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) + throw new Error('endReadable called on non-empty stream'); + + if (!state.endEmitted) { + state.ended = true; + process.nextTick(function() { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } + }); + } +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf (xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} diff --git a/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 00000000..905c5e45 --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,209 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +module.exports = Transform; + +var Duplex = require('./_stream_duplex'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +util.inherits(Transform, Duplex); + + +function TransformState(options, stream) { + this.afterTransform = function(er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) + return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (!util.isNullOrUndefined(data)) + stream.push(data); + + if (cb) + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + + +function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + + Duplex.call(this, options); + + this._transformState = new TransformState(options, this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + this.once('prefinish', function() { + if (util.isFunction(this._flush)) + this._flush(function(er) { + done(stream, er); + }); + else + done(stream); + }); +} + +Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function(chunk, encoding, cb) { + throw new Error('not implemented'); +}; + +Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || + rs.needReadable || + rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function(n) { + var ts = this._transformState; + + if (!util.isNull(ts.writechunk) && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + + +function done(stream, er) { + if (er) + return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var ts = stream._transformState; + + if (ws.length) + throw new Error('calling transform done when ws.length != 0'); + + if (ts.transforming) + throw new Error('calling transform done when still transforming'); + + return stream.push(null); +} diff --git a/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 00000000..db8539cd --- /dev/null +++ b/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,477 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, cb), and it'll handle all +// the drain event emission and buffering. + +module.exports = Writable; + +/*<replacement>*/ +var Buffer = require('buffer').Buffer; +/*</replacement>*/ + +Writable.WritableState = WritableState; + + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var Stream = require('stream'); + +util.inherits(Writable, Stream); + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; +} + +function WritableState(options, stream) { + var Duplex = require('./_stream_duplex'); + + options = options || {}; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + var defaultHwm = options.objectMode ? 16 : 16 * 1024; + this.highWaterMark = (hwm || hwm === 0) ? hwm : defaultHwm; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + if (stream instanceof Duplex) + this.objectMode = this.objectMode || !!options.writableObjectMode; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function(er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.buffer = []; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; +} + +function Writable(options) { + var Duplex = require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) + return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function() { + this.emit('error', new Error('Cannot pipe. Not readable.')); +}; + + +function writeAfterEnd(stream, state, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + if (!util.isBuffer(chunk) && + !util.isString(chunk) && + !util.isNullOrUndefined(chunk) && + !state.objectMode) { + var er = new TypeError('Invalid non-string/buffer chunk'); + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); + valid = false; + } + return valid; +} + +Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (util.isFunction(encoding)) { + cb = encoding; + encoding = null; + } + + if (util.isBuffer(chunk)) + encoding = 'buffer'; + else if (!encoding) + encoding = state.defaultEncoding; + + if (!util.isFunction(cb)) + cb = function() {}; + + if (state.ended) + writeAfterEnd(this, state, cb); + else if (validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, chunk, encoding, cb); + } + + return ret; +}; + +Writable.prototype.cork = function() { + var state = this._writableState; + + state.corked++; +}; + +Writable.prototype.uncork = function() { + var state = this._writableState; + + if (state.corked) { + state.corked--; + + if (!state.writing && + !state.corked && + !state.finished && + !state.bufferProcessing && + state.buffer.length) + clearBuffer(this, state); + } +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && + state.decodeStrings !== false && + util.isString(chunk)) { + chunk = new Buffer(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + if (util.isBuffer(chunk)) + encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) + state.needDrain = true; + + if (state.writing || state.corked) + state.buffer.push(new WriteReq(chunk, encoding, cb)); + else + doWrite(stream, state, false, len, chunk, encoding, cb); + + return ret; +} + +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (writev) + stream._writev(chunk, state.onwrite); + else + stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + if (sync) + process.nextTick(function() { + state.pendingcb--; + cb(er); + }); + else { + state.pendingcb--; + cb(er); + } + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) + onwriteError(stream, state, sync, er, cb); + else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(stream, state); + + if (!finished && + !state.corked && + !state.bufferProcessing && + state.buffer.length) { + clearBuffer(stream, state); + } + + if (sync) { + process.nextTick(function() { + afterWrite(stream, state, finished, cb); + }); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + + if (stream._writev && state.buffer.length > 1) { + // Fast case, write everything using _writev() + var cbs = []; + for (var c = 0; c < state.buffer.length; c++) + cbs.push(state.buffer[c].callback); + + // count the one we are adding, as well. + // TODO(isaacs) clean this up + state.pendingcb++; + doWrite(stream, state, true, state.length, state.buffer, '', function(err) { + for (var i = 0; i < cbs.length; i++) { + state.pendingcb--; + cbs[i](err); + } + }); + + // Clear buffer + state.buffer = []; + } else { + // Slow case, write chunks one-by-one + for (var c = 0; c < state.buffer.length; c++) { + var entry = state.buffer[c]; + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, false, len, chunk, encoding, cb); + + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + c++; + break; + } + } + + if (c < state.buffer.length) + state.buffer = state.buffer.slice(c); + else + state.buffer.length = 0; + } + + state.bufferProcessing = false; +} + +Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error('not implemented')); + +}; + +Writable.prototype._writev = null; + +Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + + if (util.isFunction(chunk)) { + cb = chunk; + chunk = null; + encoding = null; + } else if (util.isFunction(encoding)) { + cb = encoding; + encoding = null; + } + + if (!util.isNullOrUndefined(chunk)) + this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) + endWritable(this, state, cb); +}; + + +function needFinish(stream, state) { + return (state.ending && + state.length === 0 && + !state.finished && + !state.writing); +} + +function prefinish(stream, state) { + if (!state.prefinished) { + state.prefinished = true; + stream.emit('prefinish'); + } +} + +function finishMaybe(stream, state) { + var need = needFinish(stream, state); + if (need) { + if (state.pendingcb === 0) { + prefinish(stream, state); + state.finished = true; + stream.emit('finish'); + } else + prefinish(stream, state); + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once('finish', cb); + } + state.ended = true; +} diff --git a/node_modules/readable-stream/package.json b/node_modules/readable-stream/package.json new file mode 100644 index 00000000..0bb83ed0 --- /dev/null +++ b/node_modules/readable-stream/package.json @@ -0,0 +1,32 @@ +{ + "name": "readable-stream", + "version": "1.1.14", + "description": "Streams3, a user-land copy of the stream library from Node.js v0.11.x", + "main": "readable.js", + "dependencies": { + "core-util-is": "~1.0.0", + "isarray": "0.0.1", + "string_decoder": "~0.10.x", + "inherits": "~2.0.1" + }, + "devDependencies": { + "tap": "~0.2.6" + }, + "scripts": { + "test": "tap test/simple/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/readable-stream" + }, + "keywords": [ + "readable", + "stream", + "pipe" + ], + "browser": { + "util": false + }, + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "license": "MIT" +} diff --git a/node_modules/readable-stream/passthrough.js b/node_modules/readable-stream/passthrough.js new file mode 100644 index 00000000..27e8d8a5 --- /dev/null +++ b/node_modules/readable-stream/passthrough.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_passthrough.js") diff --git a/node_modules/readable-stream/readable.js b/node_modules/readable-stream/readable.js new file mode 100644 index 00000000..2a8b5c6b --- /dev/null +++ b/node_modules/readable-stream/readable.js @@ -0,0 +1,10 @@ +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = require('stream'); +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); +if (!process.browser && process.env.READABLE_STREAM === 'disable') { + module.exports = require('stream'); +} diff --git a/node_modules/readable-stream/transform.js b/node_modules/readable-stream/transform.js new file mode 100644 index 00000000..5d482f07 --- /dev/null +++ b/node_modules/readable-stream/transform.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_transform.js") diff --git a/node_modules/readable-stream/writable.js b/node_modules/readable-stream/writable.js new file mode 100644 index 00000000..e1e9efdf --- /dev/null +++ b/node_modules/readable-stream/writable.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_writable.js") diff --git a/node_modules/safe-buffer/LICENSE b/node_modules/safe-buffer/LICENSE new file mode 100644 index 00000000..0c068cee --- /dev/null +++ b/node_modules/safe-buffer/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) Feross Aboukhadijeh + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/safe-buffer/README.md b/node_modules/safe-buffer/README.md new file mode 100644 index 00000000..e9a81afd --- /dev/null +++ b/node_modules/safe-buffer/README.md @@ -0,0 +1,584 @@ +# safe-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url] + +[travis-image]: https://img.shields.io/travis/feross/safe-buffer/master.svg +[travis-url]: https://travis-ci.org/feross/safe-buffer +[npm-image]: https://img.shields.io/npm/v/safe-buffer.svg +[npm-url]: https://npmjs.org/package/safe-buffer +[downloads-image]: https://img.shields.io/npm/dm/safe-buffer.svg +[downloads-url]: https://npmjs.org/package/safe-buffer +[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg +[standard-url]: https://standardjs.com + +#### Safer Node.js Buffer API + +**Use the new Node.js Buffer APIs (`Buffer.from`, `Buffer.alloc`, +`Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** + +**Uses the built-in implementation when available.** + +## install + +``` +npm install safe-buffer +``` + +## usage + +The goal of this package is to provide a safe replacement for the node.js `Buffer`. + +It's a drop-in replacement for `Buffer`. You can use it by adding one `require` line to +the top of your node.js modules: + +```js +var Buffer = require('safe-buffer').Buffer + +// Existing buffer code will continue to work without issues: + +new Buffer('hey', 'utf8') +new Buffer([1, 2, 3], 'utf8') +new Buffer(obj) +new Buffer(16) // create an uninitialized buffer (potentially unsafe) + +// But you can use these new explicit APIs to make clear what you want: + +Buffer.from('hey', 'utf8') // convert from many types to a Buffer +Buffer.alloc(16) // create a zero-filled buffer (safe) +Buffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe) +``` + +## api + +### Class Method: Buffer.from(array) +<!-- YAML +added: v3.0.0 +--> + +* `array` {Array} + +Allocates a new `Buffer` using an `array` of octets. + +```js +const buf = Buffer.from([0x62,0x75,0x66,0x66,0x65,0x72]); + // creates a new Buffer containing ASCII bytes + // ['b','u','f','f','e','r'] +``` + +A `TypeError` will be thrown if `array` is not an `Array`. + +### Class Method: Buffer.from(arrayBuffer[, byteOffset[, length]]) +<!-- YAML +added: v5.10.0 +--> + +* `arrayBuffer` {ArrayBuffer} The `.buffer` property of a `TypedArray` or + a `new ArrayBuffer()` +* `byteOffset` {Number} Default: `0` +* `length` {Number} Default: `arrayBuffer.length - byteOffset` + +When passed a reference to the `.buffer` property of a `TypedArray` instance, +the newly created `Buffer` will share the same allocated memory as the +TypedArray. + +```js +const arr = new Uint16Array(2); +arr[0] = 5000; +arr[1] = 4000; + +const buf = Buffer.from(arr.buffer); // shares the memory with arr; + +console.log(buf); + // Prints: <Buffer 88 13 a0 0f> + +// changing the TypedArray changes the Buffer also +arr[1] = 6000; + +console.log(buf); + // Prints: <Buffer 88 13 70 17> +``` + +The optional `byteOffset` and `length` arguments specify a memory range within +the `arrayBuffer` that will be shared by the `Buffer`. + +```js +const ab = new ArrayBuffer(10); +const buf = Buffer.from(ab, 0, 2); +console.log(buf.length); + // Prints: 2 +``` + +A `TypeError` will be thrown if `arrayBuffer` is not an `ArrayBuffer`. + +### Class Method: Buffer.from(buffer) +<!-- YAML +added: v3.0.0 +--> + +* `buffer` {Buffer} + +Copies the passed `buffer` data onto a new `Buffer` instance. + +```js +const buf1 = Buffer.from('buffer'); +const buf2 = Buffer.from(buf1); + +buf1[0] = 0x61; +console.log(buf1.toString()); + // 'auffer' +console.log(buf2.toString()); + // 'buffer' (copy is not changed) +``` + +A `TypeError` will be thrown if `buffer` is not a `Buffer`. + +### Class Method: Buffer.from(str[, encoding]) +<!-- YAML +added: v5.10.0 +--> + +* `str` {String} String to encode. +* `encoding` {String} Encoding to use, Default: `'utf8'` + +Creates a new `Buffer` containing the given JavaScript string `str`. If +provided, the `encoding` parameter identifies the character encoding. +If not provided, `encoding` defaults to `'utf8'`. + +```js +const buf1 = Buffer.from('this is a tést'); +console.log(buf1.toString()); + // prints: this is a tést +console.log(buf1.toString('ascii')); + // prints: this is a tC)st + +const buf2 = Buffer.from('7468697320697320612074c3a97374', 'hex'); +console.log(buf2.toString()); + // prints: this is a tést +``` + +A `TypeError` will be thrown if `str` is not a string. + +### Class Method: Buffer.alloc(size[, fill[, encoding]]) +<!-- YAML +added: v5.10.0 +--> + +* `size` {Number} +* `fill` {Value} Default: `undefined` +* `encoding` {String} Default: `utf8` + +Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the +`Buffer` will be *zero-filled*. + +```js +const buf = Buffer.alloc(5); +console.log(buf); + // <Buffer 00 00 00 00 00> +``` + +The `size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +If `fill` is specified, the allocated `Buffer` will be initialized by calling +`buf.fill(fill)`. See [`buf.fill()`][] for more information. + +```js +const buf = Buffer.alloc(5, 'a'); +console.log(buf); + // <Buffer 61 61 61 61 61> +``` + +If both `fill` and `encoding` are specified, the allocated `Buffer` will be +initialized by calling `buf.fill(fill, encoding)`. For example: + +```js +const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); +console.log(buf); + // <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64> +``` + +Calling `Buffer.alloc(size)` can be significantly slower than the alternative +`Buffer.allocUnsafe(size)` but ensures that the newly created `Buffer` instance +contents will *never contain sensitive data*. + +A `TypeError` will be thrown if `size` is not a number. + +### Class Method: Buffer.allocUnsafe(size) +<!-- YAML +added: v5.10.0 +--> + +* `size` {Number} + +Allocates a new *non-zero-filled* `Buffer` of `size` bytes. The `size` must +be less than or equal to the value of `require('buffer').kMaxLength` (on 64-bit +architectures, `kMaxLength` is `(2^31)-1`). Otherwise, a [`RangeError`][] is +thrown. A zero-length Buffer will be created if a `size` less than or equal to +0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +```js +const buf = Buffer.allocUnsafe(5); +console.log(buf); + // <Buffer 78 e0 82 02 01> + // (octets will be different, every time) +buf.fill(0); +console.log(buf); + // <Buffer 00 00 00 00 00> +``` + +A `TypeError` will be thrown if `size` is not a number. + +Note that the `Buffer` module pre-allocates an internal `Buffer` instance of +size `Buffer.poolSize` that is used as a pool for the fast allocation of new +`Buffer` instances created using `Buffer.allocUnsafe(size)` (and the deprecated +`new Buffer(size)` constructor) only when `size` is less than or equal to +`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). The default +value of `Buffer.poolSize` is `8192` but can be modified. + +Use of this pre-allocated internal memory pool is a key difference between +calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. +Specifically, `Buffer.alloc(size, fill)` will *never* use the internal Buffer +pool, while `Buffer.allocUnsafe(size).fill(fill)` *will* use the internal +Buffer pool if `size` is less than or equal to half `Buffer.poolSize`. The +difference is subtle but can be important when an application requires the +additional performance that `Buffer.allocUnsafe(size)` provides. + +### Class Method: Buffer.allocUnsafeSlow(size) +<!-- YAML +added: v5.10.0 +--> + +* `size` {Number} + +Allocates a new *non-zero-filled* and non-pooled `Buffer` of `size` bytes. The +`size` must be less than or equal to the value of +`require('buffer').kMaxLength` (on 64-bit architectures, `kMaxLength` is +`(2^31)-1`). Otherwise, a [`RangeError`][] is thrown. A zero-length Buffer will +be created if a `size` less than or equal to 0 is specified. + +The underlying memory for `Buffer` instances created in this way is *not +initialized*. The contents of the newly created `Buffer` are unknown and +*may contain sensitive data*. Use [`buf.fill(0)`][] to initialize such +`Buffer` instances to zeroes. + +When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, +allocations under 4KB are, by default, sliced from a single pre-allocated +`Buffer`. This allows applications to avoid the garbage collection overhead of +creating many individually allocated Buffers. This approach improves both +performance and memory usage by eliminating the need to track and cleanup as +many `Persistent` objects. + +However, in the case where a developer may need to retain a small chunk of +memory from a pool for an indeterminate amount of time, it may be appropriate +to create an un-pooled Buffer instance using `Buffer.allocUnsafeSlow()` then +copy out the relevant bits. + +```js +// need to keep around a few small chunks of memory +const store = []; + +socket.on('readable', () => { + const data = socket.read(); + // allocate for retained data + const sb = Buffer.allocUnsafeSlow(10); + // copy the data into the new allocation + data.copy(sb, 0, 0, 10); + store.push(sb); +}); +``` + +Use of `Buffer.allocUnsafeSlow()` should be used only as a last resort *after* +a developer has observed undue memory retention in their applications. + +A `TypeError` will be thrown if `size` is not a number. + +### All the Rest + +The rest of the `Buffer` API is exactly the same as in node.js. +[See the docs](https://nodejs.org/api/buffer.html). + + +## Related links + +- [Node.js issue: Buffer(number) is unsafe](https://github.com/nodejs/node/issues/4660) +- [Node.js Enhancement Proposal: Buffer.from/Buffer.alloc/Buffer.zalloc/Buffer() soft-deprecate](https://github.com/nodejs/node-eps/pull/4) + +## Why is `Buffer` unsafe? + +Today, the node.js `Buffer` constructor is overloaded to handle many different argument +types like `String`, `Array`, `Object`, `TypedArrayView` (`Uint8Array`, etc.), +`ArrayBuffer`, and also `Number`. + +The API is optimized for convenience: you can throw any type at it, and it will try to do +what you want. + +Because the Buffer constructor is so powerful, you often see code like this: + +```js +// Convert UTF-8 strings to hex +function toHex (str) { + return new Buffer(str).toString('hex') +} +``` + +***But what happens if `toHex` is called with a `Number` argument?*** + +### Remote Memory Disclosure + +If an attacker can make your program call the `Buffer` constructor with a `Number` +argument, then they can make it allocate uninitialized memory from the node.js process. +This could potentially disclose TLS private keys, user data, or database passwords. + +When the `Buffer` constructor is passed a `Number` argument, it returns an +**UNINITIALIZED** block of memory of the specified `size`. When you create a `Buffer` like +this, you **MUST** overwrite the contents before returning it to the user. + +From the [node.js docs](https://nodejs.org/api/buffer.html#buffer_new_buffer_size): + +> `new Buffer(size)` +> +> - `size` Number +> +> The underlying memory for `Buffer` instances created in this way is not initialized. +> **The contents of a newly created `Buffer` are unknown and could contain sensitive +> data.** Use `buf.fill(0)` to initialize a Buffer to zeroes. + +(Emphasis our own.) + +Whenever the programmer intended to create an uninitialized `Buffer` you often see code +like this: + +```js +var buf = new Buffer(16) + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### Would this ever be a problem in real code? + +Yes. It's surprisingly common to forget to check the type of your variables in a +dynamically-typed language like JavaScript. + +Usually the consequences of assuming the wrong type is that your program crashes with an +uncaught exception. But the failure mode for forgetting to check the type of arguments to +the `Buffer` constructor is more catastrophic. + +Here's an example of a vulnerable service that takes a JSON payload and converts it to +hex: + +```js +// Take a JSON payload {str: "some string"} and convert it to hex +var server = http.createServer(function (req, res) { + var data = '' + req.setEncoding('utf8') + req.on('data', function (chunk) { + data += chunk + }) + req.on('end', function () { + var body = JSON.parse(data) + res.end(new Buffer(body.str).toString('hex')) + }) +}) + +server.listen(8080) +``` + +In this example, an http client just has to send: + +```json +{ + "str": 1000 +} +``` + +and it will get back 1,000 bytes of uninitialized memory from the server. + +This is a very serious bug. It's similar in severity to the +[the Heartbleed bug](http://heartbleed.com/) that allowed disclosure of OpenSSL process +memory by remote attackers. + + +### Which real-world packages were vulnerable? + +#### [`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht) + +[Mathias Buus](https://github.com/mafintosh) and I +([Feross Aboukhadijeh](http://feross.org/)) found this issue in one of our own packages, +[`bittorrent-dht`](https://www.npmjs.com/package/bittorrent-dht). The bug would allow +anyone on the internet to send a series of messages to a user of `bittorrent-dht` and get +them to reveal 20 bytes at a time of uninitialized memory from the node.js process. + +Here's +[the commit](https://github.com/feross/bittorrent-dht/commit/6c7da04025d5633699800a99ec3fbadf70ad35b8) +that fixed it. We released a new fixed version, created a +[Node Security Project disclosure](https://nodesecurity.io/advisories/68), and deprecated all +vulnerable versions on npm so users will get a warning to upgrade to a newer version. + +#### [`ws`](https://www.npmjs.com/package/ws) + +That got us wondering if there were other vulnerable packages. Sure enough, within a short +period of time, we found the same issue in [`ws`](https://www.npmjs.com/package/ws), the +most popular WebSocket implementation in node.js. + +If certain APIs were called with `Number` parameters instead of `String` or `Buffer` as +expected, then uninitialized server memory would be disclosed to the remote peer. + +These were the vulnerable methods: + +```js +socket.send(number) +socket.ping(number) +socket.pong(number) +``` + +Here's a vulnerable socket server with some echo functionality: + +```js +server.on('connection', function (socket) { + socket.on('message', function (message) { + message = JSON.parse(message) + if (message.type === 'echo') { + socket.send(message.data) // send back the user's message + } + }) +}) +``` + +`socket.send(number)` called on the server, will disclose server memory. + +Here's [the release](https://github.com/websockets/ws/releases/tag/1.0.1) where the issue +was fixed, with a more detailed explanation. Props to +[Arnout Kazemier](https://github.com/3rd-Eden) for the quick fix. Here's the +[Node Security Project disclosure](https://nodesecurity.io/advisories/67). + + +### What's the solution? + +It's important that node.js offers a fast way to get memory otherwise performance-critical +applications would needlessly get a lot slower. + +But we need a better way to *signal our intent* as programmers. **When we want +uninitialized memory, we should request it explicitly.** + +Sensitive functionality should not be packed into a developer-friendly API that loosely +accepts many different types. This type of API encourages the lazy practice of passing +variables in without checking the type very carefully. + +#### A new API: `Buffer.allocUnsafe(number)` + +The functionality of creating buffers with uninitialized memory should be part of another +API. We propose `Buffer.allocUnsafe(number)`. This way, it's not part of an API that +frequently gets user input of all sorts of different types passed into it. + +```js +var buf = Buffer.allocUnsafe(16) // careful, uninitialized memory! + +// Immediately overwrite the uninitialized buffer with data from another buffer +for (var i = 0; i < buf.length; i++) { + buf[i] = otherBuf[i] +} +``` + + +### How do we fix node.js core? + +We sent [a PR to node.js core](https://github.com/nodejs/node/pull/4514) (merged as +`semver-major`) which defends against one case: + +```js +var str = 16 +new Buffer(str, 'utf8') +``` + +In this situation, it's implied that the programmer intended the first argument to be a +string, since they passed an encoding as a second argument. Today, node.js will allocate +uninitialized memory in the case of `new Buffer(number, encoding)`, which is probably not +what the programmer intended. + +But this is only a partial solution, since if the programmer does `new Buffer(variable)` +(without an `encoding` parameter) there's no way to know what they intended. If `variable` +is sometimes a number, then uninitialized memory will sometimes be returned. + +### What's the real long-term fix? + +We could deprecate and remove `new Buffer(number)` and use `Buffer.allocUnsafe(number)` when +we need uninitialized memory. But that would break 1000s of packages. + +~~We believe the best solution is to:~~ + +~~1. Change `new Buffer(number)` to return safe, zeroed-out memory~~ + +~~2. Create a new API for creating uninitialized Buffers. We propose: `Buffer.allocUnsafe(number)`~~ + +#### Update + +We now support adding three new APIs: + +- `Buffer.from(value)` - convert from any type to a buffer +- `Buffer.alloc(size)` - create a zero-filled buffer +- `Buffer.allocUnsafe(size)` - create an uninitialized buffer with given size + +This solves the core problem that affected `ws` and `bittorrent-dht` which is +`Buffer(variable)` getting tricked into taking a number argument. + +This way, existing code continues working and the impact on the npm ecosystem will be +minimal. Over time, npm maintainers can migrate performance-critical code to use +`Buffer.allocUnsafe(number)` instead of `new Buffer(number)`. + + +### Conclusion + +We think there's a serious design issue with the `Buffer` API as it exists today. It +promotes insecure software by putting high-risk functionality into a convenient API +with friendly "developer ergonomics". + +This wasn't merely a theoretical exercise because we found the issue in some of the +most popular npm packages. + +Fortunately, there's an easy fix that can be applied today. Use `safe-buffer` in place of +`buffer`. + +```js +var Buffer = require('safe-buffer').Buffer +``` + +Eventually, we hope that node.js core can switch to this new, safer behavior. We believe +the impact on the ecosystem would be minimal since it's not a breaking change. +Well-maintained, popular packages would be updated to use `Buffer.alloc` quickly, while +older, insecure packages would magically become safe from this attack vector. + + +## links + +- [Node.js PR: buffer: throw if both length and enc are passed](https://github.com/nodejs/node/pull/4514) +- [Node Security Project disclosure for `ws`](https://nodesecurity.io/advisories/67) +- [Node Security Project disclosure for`bittorrent-dht`](https://nodesecurity.io/advisories/68) + + +## credit + +The original issues in `bittorrent-dht` +([disclosure](https://nodesecurity.io/advisories/68)) and +`ws` ([disclosure](https://nodesecurity.io/advisories/67)) were discovered by +[Mathias Buus](https://github.com/mafintosh) and +[Feross Aboukhadijeh](http://feross.org/). + +Thanks to [Adam Baldwin](https://github.com/evilpacket) for helping disclose these issues +and for his work running the [Node Security Project](https://nodesecurity.io/). + +Thanks to [John Hiesey](https://github.com/jhiesey) for proofreading this README and +auditing the code. + + +## license + +MIT. Copyright (C) [Feross Aboukhadijeh](http://feross.org) diff --git a/node_modules/safe-buffer/index.d.ts b/node_modules/safe-buffer/index.d.ts new file mode 100644 index 00000000..e9fed809 --- /dev/null +++ b/node_modules/safe-buffer/index.d.ts @@ -0,0 +1,187 @@ +declare module "safe-buffer" { + export class Buffer { + length: number + write(string: string, offset?: number, length?: number, encoding?: string): number; + toString(encoding?: string, start?: number, end?: number): string; + toJSON(): { type: 'Buffer', data: any[] }; + equals(otherBuffer: Buffer): boolean; + compare(otherBuffer: Buffer, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): number; + copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; + slice(start?: number, end?: number): Buffer; + writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number; + readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntLE(offset: number, byteLength: number, noAssert?: boolean): number; + readIntBE(offset: number, byteLength: number, noAssert?: boolean): number; + readUInt8(offset: number, noAssert?: boolean): number; + readUInt16LE(offset: number, noAssert?: boolean): number; + readUInt16BE(offset: number, noAssert?: boolean): number; + readUInt32LE(offset: number, noAssert?: boolean): number; + readUInt32BE(offset: number, noAssert?: boolean): number; + readInt8(offset: number, noAssert?: boolean): number; + readInt16LE(offset: number, noAssert?: boolean): number; + readInt16BE(offset: number, noAssert?: boolean): number; + readInt32LE(offset: number, noAssert?: boolean): number; + readInt32BE(offset: number, noAssert?: boolean): number; + readFloatLE(offset: number, noAssert?: boolean): number; + readFloatBE(offset: number, noAssert?: boolean): number; + readDoubleLE(offset: number, noAssert?: boolean): number; + readDoubleBE(offset: number, noAssert?: boolean): number; + swap16(): Buffer; + swap32(): Buffer; + swap64(): Buffer; + writeUInt8(value: number, offset: number, noAssert?: boolean): number; + writeUInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeUInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeInt8(value: number, offset: number, noAssert?: boolean): number; + writeInt16LE(value: number, offset: number, noAssert?: boolean): number; + writeInt16BE(value: number, offset: number, noAssert?: boolean): number; + writeInt32LE(value: number, offset: number, noAssert?: boolean): number; + writeInt32BE(value: number, offset: number, noAssert?: boolean): number; + writeFloatLE(value: number, offset: number, noAssert?: boolean): number; + writeFloatBE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleLE(value: number, offset: number, noAssert?: boolean): number; + writeDoubleBE(value: number, offset: number, noAssert?: boolean): number; + fill(value: any, offset?: number, end?: number): this; + indexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + lastIndexOf(value: string | number | Buffer, byteOffset?: number, encoding?: string): number; + includes(value: string | number | Buffer, byteOffset?: number, encoding?: string): boolean; + + /** + * Allocates a new buffer containing the given {str}. + * + * @param str String to store in buffer. + * @param encoding encoding to use, optional. Default is 'utf8' + */ + constructor (str: string, encoding?: string); + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + */ + constructor (size: number); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: Uint8Array); + /** + * Produces a Buffer backed by the same allocated memory as + * the given {ArrayBuffer}. + * + * + * @param arrayBuffer The ArrayBuffer with which to share memory. + */ + constructor (arrayBuffer: ArrayBuffer); + /** + * Allocates a new buffer containing the given {array} of octets. + * + * @param array The octets to store. + */ + constructor (array: any[]); + /** + * Copies the passed {buffer} data onto a new {Buffer} instance. + * + * @param buffer The buffer to copy. + */ + constructor (buffer: Buffer); + prototype: Buffer; + /** + * Allocates a new Buffer using an {array} of octets. + * + * @param array + */ + static from(array: any[]): Buffer; + /** + * When passed a reference to the .buffer property of a TypedArray instance, + * the newly created Buffer will share the same allocated memory as the TypedArray. + * The optional {byteOffset} and {length} arguments specify a memory range + * within the {arrayBuffer} that will be shared by the Buffer. + * + * @param arrayBuffer The .buffer property of a TypedArray or a new ArrayBuffer() + * @param byteOffset + * @param length + */ + static from(arrayBuffer: ArrayBuffer, byteOffset?: number, length?: number): Buffer; + /** + * Copies the passed {buffer} data onto a new Buffer instance. + * + * @param buffer + */ + static from(buffer: Buffer): Buffer; + /** + * Creates a new Buffer containing the given JavaScript string {str}. + * If provided, the {encoding} parameter identifies the character encoding. + * If not provided, {encoding} defaults to 'utf8'. + * + * @param str + */ + static from(str: string, encoding?: string): Buffer; + /** + * Returns true if {obj} is a Buffer + * + * @param obj object to test. + */ + static isBuffer(obj: any): obj is Buffer; + /** + * Returns true if {encoding} is a valid encoding argument. + * Valid string encodings in Node 0.12: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex' + * + * @param encoding string to test. + */ + static isEncoding(encoding: string): boolean; + /** + * Gives the actual byte length of a string. encoding defaults to 'utf8'. + * This is not the same as String.prototype.length since that returns the number of characters in a string. + * + * @param string string to test. + * @param encoding encoding used to evaluate (defaults to 'utf8') + */ + static byteLength(string: string, encoding?: string): number; + /** + * Returns a buffer which is the result of concatenating all the buffers in the list together. + * + * If the list has no items, or if the totalLength is 0, then it returns a zero-length buffer. + * If the list has exactly one item, then the first item of the list is returned. + * If the list has more than one item, then a new Buffer is created. + * + * @param list An array of Buffer objects to concatenate + * @param totalLength Total length of the buffers when concatenated. + * If totalLength is not provided, it is read from the buffers in the list. However, this adds an additional loop to the function, so it is faster to provide the length explicitly. + */ + static concat(list: Buffer[], totalLength?: number): Buffer; + /** + * The same as buf1.compare(buf2). + */ + static compare(buf1: Buffer, buf2: Buffer): number; + /** + * Allocates a new buffer of {size} octets. + * + * @param size count of octets to allocate. + * @param fill if specified, buffer will be initialized by calling buf.fill(fill). + * If parameter is omitted, buffer will be filled with zeros. + * @param encoding encoding used for call to buf.fill while initalizing + */ + static alloc(size: number, fill?: string | Buffer | number, encoding?: string): Buffer; + /** + * Allocates a new buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafe(size: number): Buffer; + /** + * Allocates a new non-pooled buffer of {size} octets, leaving memory not initialized, so the contents + * of the newly created Buffer are unknown and may contain sensitive data. + * + * @param size count of octets to allocate + */ + static allocUnsafeSlow(size: number): Buffer; + } +}
\ No newline at end of file diff --git a/node_modules/safe-buffer/index.js b/node_modules/safe-buffer/index.js new file mode 100644 index 00000000..f8d3ec98 --- /dev/null +++ b/node_modules/safe-buffer/index.js @@ -0,0 +1,65 @@ +/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */ +/* eslint-disable node/no-deprecated-api */ +var buffer = require('buffer') +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} diff --git a/node_modules/safe-buffer/package.json b/node_modules/safe-buffer/package.json new file mode 100644 index 00000000..f2869e25 --- /dev/null +++ b/node_modules/safe-buffer/package.json @@ -0,0 +1,51 @@ +{ + "name": "safe-buffer", + "description": "Safer Node.js Buffer API", + "version": "5.2.1", + "author": { + "name": "Feross Aboukhadijeh", + "email": "feross@feross.org", + "url": "https://feross.org" + }, + "bugs": { + "url": "https://github.com/feross/safe-buffer/issues" + }, + "devDependencies": { + "standard": "*", + "tape": "^5.0.0" + }, + "homepage": "https://github.com/feross/safe-buffer", + "keywords": [ + "buffer", + "buffer allocate", + "node security", + "safe", + "safe-buffer", + "security", + "uninitialized" + ], + "license": "MIT", + "main": "index.js", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "git://github.com/feross/safe-buffer.git" + }, + "scripts": { + "test": "standard && tape test/*.js" + }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] +} diff --git a/node_modules/split2/.README.md.un~ b/node_modules/split2/.README.md.un~ Binary files differnew file mode 100644 index 00000000..8e126090 --- /dev/null +++ b/node_modules/split2/.README.md.un~ diff --git a/node_modules/split2/.index.js.un~ b/node_modules/split2/.index.js.un~ Binary files differnew file mode 100644 index 00000000..b5c967a4 --- /dev/null +++ b/node_modules/split2/.index.js.un~ diff --git a/node_modules/split2/.npmignore b/node_modules/split2/.npmignore new file mode 100644 index 00000000..73734ed3 --- /dev/null +++ b/node_modules/split2/.npmignore @@ -0,0 +1,7 @@ +node_modules/ +build/ +libleveldb.so +libleveldb.a +test-data/ +_benchdb_* +*.sw* diff --git a/node_modules/split2/.package.json.un~ b/node_modules/split2/.package.json.un~ Binary files differnew file mode 100644 index 00000000..e9f0aec3 --- /dev/null +++ b/node_modules/split2/.package.json.un~ diff --git a/node_modules/split2/.test.js.un~ b/node_modules/split2/.test.js.un~ Binary files differnew file mode 100644 index 00000000..cce9293a --- /dev/null +++ b/node_modules/split2/.test.js.un~ diff --git a/node_modules/split2/.travis.yml b/node_modules/split2/.travis.yml new file mode 100644 index 00000000..6e5919de --- /dev/null +++ b/node_modules/split2/.travis.yml @@ -0,0 +1,3 @@ +language: node_js +node_js: + - "0.10" diff --git a/node_modules/split2/LICENSE b/node_modules/split2/LICENSE new file mode 100644 index 00000000..ed176567 --- /dev/null +++ b/node_modules/split2/LICENSE @@ -0,0 +1,13 @@ +Copyright (c) 2014, Matteo Collina <hello@matteocollina.com> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/split2/README.md b/node_modules/split2/README.md new file mode 100644 index 00000000..66fc9590 --- /dev/null +++ b/node_modules/split2/README.md @@ -0,0 +1,74 @@ +# Split2(matcher, mapper, options) + +[](http://travis-ci.org/mcollina/split2) + +Break up a stream and reassemble it so that each line is a chunk. +`split2` is inspired by [@dominictarr](https://github.com/dominictarr) [`split`](https://github.com/dominictarr) module, +and it is totally API compatible with it. +However, it is based on [`through2`](https://github.com/rvagg/through2) by [@rvagg](https://github.com/rvagg) and it is fully based on Stream2. + +`matcher` may be a `String`, or a `RegExp`. Example, read every line in a file ... + +``` js + fs.createReadStream(file) + .pipe(split2()) + .on('data', function (line) { + //each chunk now is a seperate line! + }) + +``` + +`split` takes the same arguments as `string.split` except it defaults to '/\r?\n/' instead of ',', and the optional `limit` paremeter is ignored. +[String#split](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String/split) + +`split` takes an optional options object on it's third argument, which +is directly passed as a +[Transform](http://nodejs.org/api/stream.html#stream_class_stream_transform_1) +option. + +Calling `.destroy` will make the stream emit `close`. Use this to perform cleanup logic + +``` js +var splitFile = function(filename) { + var file = fs.createReadStream(filename) + + return file + .pipe(split2()) + .on('close', function() { + // destroy the file stream in case the split stream was destroyed + file.destroy() + }) +} + +var stream = splitFile('my-file.txt') + +stream.destroy() // will destroy the input file stream +``` + +# NDJ - Newline Delimited Json + +`split2` accepts a function which transforms each line. + +``` js +fs.createReadStream(file) + .pipe(split2(JSON.parse)) + .on('data', function (obj) { + //each chunk now is a a js object + }) +``` + +# License + +Copyright (c) 2014, Matteo Collina <hello@matteocollina.com> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/node_modules/split2/index.js b/node_modules/split2/index.js new file mode 100644 index 00000000..b9682e04 --- /dev/null +++ b/node_modules/split2/index.js @@ -0,0 +1,83 @@ +/* +Copyright (c) 2014, Matteo Collina <hello@matteocollina.com> + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR +IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +*/ + +'use strict'; + +var through = require('through2') + +function transform(chunk, enc, cb) { + var list = chunk.toString('utf8').split(this.matcher) + , remaining = list.pop() + , i + + if (list.length >= 1) { + push(this, this.mapper((this._last + list.shift()))) + } else { + remaining = this._last + remaining + } + + for (i = 0; i < list.length; i++) { + push(this, this.mapper(list[i])) + } + + this._last = remaining + + cb() +} + +function flush(cb) { + if (this._last) + push(this, this.mapper(this._last)) + + cb() +} + +function push(self, val) { + if (val !== undefined) + self.push(val) +} + +function noop(incoming) { + return incoming +} + +function split(matcher, mapper, options) { + + if (typeof matcher === 'object' && !(matcher instanceof RegExp)) { + options = matcher + matcher = null + } + + if (typeof matcher === 'function') { + mapper = matcher + matcher = null + } + + options = options || {} + + var stream = through(options, transform, flush) + + // this stream is in objectMode only in the readable part + stream._readableState.objectMode = true; + + stream._last = '' + stream.matcher = matcher || /\r?\n/ + stream.mapper = mapper || noop + + return stream +} + +module.exports = split diff --git a/node_modules/split2/package.json b/node_modules/split2/package.json new file mode 100644 index 00000000..f4d22fe8 --- /dev/null +++ b/node_modules/split2/package.json @@ -0,0 +1,30 @@ +{ + "name": "split2", + "version": "0.2.1", + "description": "split a Text Stream into a Line Stream, using Stream 2", + "main": "index.js", + "scripts": { + "test": "tap test.js" + }, + "pre-commit": [ + "test" + ], + "website": "https://github.com/mcollina/split2", + "repository": { + "type": "git", + "url": "https://github.com/mcollina/split2.git" + }, + "bugs": { + "url": "http://github.com/mcollina/split2/issues" + }, + "author": "Matteo Collina <hello@matteocollina.com>", + "license": "ISC", + "devDependencies": { + "tap": "~0.4.12", + "pre-commit": "0.0.9", + "callback-stream": "~1.0.2" + }, + "dependencies": { + "through2": "~0.6.1" + } +} diff --git a/node_modules/split2/test.js b/node_modules/split2/test.js new file mode 100644 index 00000000..d227d4ac --- /dev/null +++ b/node_modules/split2/test.js @@ -0,0 +1,149 @@ + +var test = require('tap').test + , split = require('./') + , callback = require('callback-stream') + , strcb = callback.bind(null, { decodeStrings: false }) + , objcb = callback.bind(null, { objectMode: true }) + +test('split two lines on end', function(t) { + t.plan(1) + + var input = split() + + input.pipe(strcb(function(err, list) { + t.deepEqual(list, ['hello', 'world']) + })) + + input.end('hello\nworld') +}) + +test('split two lines on two writes', function(t) { + t.plan(1) + + var input = split() + + input.pipe(strcb(function(err, list) { + t.deepEqual(list, ['hello', 'world']) + })) + + input.write('hello') + input.write('\nworld') + input.end() +}) + +test('accumulate multiple writes', function(t) { + t.plan(1) + + var input = split() + + input.pipe(strcb(function(err, list) { + t.deepEqual(list, ['helloworld']) + })) + + input.write('hello') + input.write('world') + input.end() +}) + +test('split using a custom string matcher', function(t) { + t.plan(1) + + var input = split('~') + + input.pipe(strcb(function(err, list) { + t.deepEqual(list, ['hello', 'world']) + })) + + input.end('hello~world') +}) + +test('split using a custom regexp matcher', function(t) { + t.plan(1) + + var input = split(/~/) + + input.pipe(strcb(function(err, list) { + t.deepEqual(list, ['hello', 'world']) + })) + + input.end('hello~world') +}) + +test('support an option argument', function(t) { + t.plan(2) + + var input = split({ highWatermark: 2 }) + + input.pipe(strcb(function(err, list) { + t.notOk(err, 'no errors') + t.deepEqual(list, ['hello', 'world']) + })) + + input.end('hello\nworld') +}) + +test('support a mapper function', function(t) { + t.plan(2) + + var a = { a: '42' } + , b = { b: '24' } + var input = split(JSON.parse) + + input.pipe(objcb(function(err, list) { + t.notOk(err, 'no errors') + t.deepEqual(list, [a, b]) + })) + + input.write(JSON.stringify(a)) + input.write('\n') + input.end(JSON.stringify(b)) +}) + +test('split lines windows-style', function(t) { + t.plan(1) + + var input = split() + + input.pipe(strcb(function(err, list) { + t.deepEqual(list, ['hello', 'world']) + })) + + input.end('hello\r\nworld') +}) + +test('splits a buffer', function(t) { + t.plan(1) + + var input = split() + + input.pipe(strcb(function(err, list) { + t.deepEqual(list, ['hello', 'world']) + })) + + input.end(new Buffer('hello\nworld')) +}) + +test('do not end on undefined', function(t) { + t.plan(1) + + var input = split(function(line) {}) + + input.pipe(strcb(function(err, list) { + t.deepEqual(list, []) + })) + + input.end(new Buffer('hello\nworld')) +}) + +test('has destroy method', function(t) { + t.plan(1) + + var input = split(function(line) {}) + + input.on('close', function() { + t.ok(true, 'close emitted') + t.end() + }) + + input.destroy() +})
\ No newline at end of file diff --git a/node_modules/stream-shift/.travis.yml b/node_modules/stream-shift/.travis.yml new file mode 100644 index 00000000..ecd4193f --- /dev/null +++ b/node_modules/stream-shift/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: + - "0.10" + - "0.12" + - "4" + - "6" diff --git a/node_modules/stream-shift/LICENSE b/node_modules/stream-shift/LICENSE new file mode 100644 index 00000000..bae9da7b --- /dev/null +++ b/node_modules/stream-shift/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016 Mathias Buus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/stream-shift/README.md b/node_modules/stream-shift/README.md new file mode 100644 index 00000000..d9cc2d94 --- /dev/null +++ b/node_modules/stream-shift/README.md @@ -0,0 +1,25 @@ +# stream-shift + +Returns the next buffer/object in a stream's readable queue + +``` +npm install stream-shift +``` + +[](http://travis-ci.org/mafintosh/stream-shift) + +## Usage + +``` js +var shift = require('stream-shift') + +console.log(shift(someStream)) // first item in its buffer +``` + +## Credit + +Thanks [@dignifiedquire](https://github.com/dignifiedquire) for making this work on node 6 + +## License + +MIT diff --git a/node_modules/stream-shift/index.js b/node_modules/stream-shift/index.js new file mode 100644 index 00000000..33cc4d74 --- /dev/null +++ b/node_modules/stream-shift/index.js @@ -0,0 +1,20 @@ +module.exports = shift + +function shift (stream) { + var rs = stream._readableState + if (!rs) return null + return (rs.objectMode || typeof stream._duplexState === 'number') ? stream.read() : stream.read(getStateLength(rs)) +} + +function getStateLength (state) { + if (state.buffer.length) { + // Since node 6.3.0 state.buffer is a BufferList not an array + if (state.buffer.head) { + return state.buffer.head.data.length + } + + return state.buffer[0].length + } + + return state.length +} diff --git a/node_modules/stream-shift/package.json b/node_modules/stream-shift/package.json new file mode 100644 index 00000000..fe7347a0 --- /dev/null +++ b/node_modules/stream-shift/package.json @@ -0,0 +1,25 @@ +{ + "name": "stream-shift", + "version": "1.0.1", + "description": "Returns the next buffer/object in a stream's readable queue", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "standard": "^7.1.2", + "tape": "^4.6.0", + "through2": "^2.0.1" + }, + "scripts": { + "test": "standard && tape test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/mafintosh/stream-shift.git" + }, + "author": "Mathias Buus (@mafintosh)", + "license": "MIT", + "bugs": { + "url": "https://github.com/mafintosh/stream-shift/issues" + }, + "homepage": "https://github.com/mafintosh/stream-shift" +} diff --git a/node_modules/stream-shift/test.js b/node_modules/stream-shift/test.js new file mode 100644 index 00000000..c0222c37 --- /dev/null +++ b/node_modules/stream-shift/test.js @@ -0,0 +1,48 @@ +var tape = require('tape') +var through = require('through2') +var stream = require('stream') +var shift = require('./') + +tape('shifts next', function (t) { + var passthrough = through() + + passthrough.write('hello') + passthrough.write('world') + + t.same(shift(passthrough), Buffer('hello')) + t.same(shift(passthrough), Buffer('world')) + t.end() +}) + +tape('shifts next with core', function (t) { + var passthrough = stream.PassThrough() + + passthrough.write('hello') + passthrough.write('world') + + t.same(shift(passthrough), Buffer('hello')) + t.same(shift(passthrough), Buffer('world')) + t.end() +}) + +tape('shifts next with object mode', function (t) { + var passthrough = through({objectMode: true}) + + passthrough.write({hello: 1}) + passthrough.write({world: 1}) + + t.same(shift(passthrough), {hello: 1}) + t.same(shift(passthrough), {world: 1}) + t.end() +}) + +tape('shifts next with object mode with core', function (t) { + var passthrough = stream.PassThrough({objectMode: true}) + + passthrough.write({hello: 1}) + passthrough.write({world: 1}) + + t.same(shift(passthrough), {hello: 1}) + t.same(shift(passthrough), {world: 1}) + t.end() +}) diff --git a/node_modules/string_decoder/.npmignore b/node_modules/string_decoder/.npmignore new file mode 100644 index 00000000..206320cc --- /dev/null +++ b/node_modules/string_decoder/.npmignore @@ -0,0 +1,2 @@ +build +test diff --git a/node_modules/string_decoder/LICENSE b/node_modules/string_decoder/LICENSE new file mode 100644 index 00000000..6de584a4 --- /dev/null +++ b/node_modules/string_decoder/LICENSE @@ -0,0 +1,20 @@ +Copyright Joyent, Inc. and other Node contributors. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the +following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/string_decoder/README.md b/node_modules/string_decoder/README.md new file mode 100644 index 00000000..4d2aa001 --- /dev/null +++ b/node_modules/string_decoder/README.md @@ -0,0 +1,7 @@ +**string_decoder.js** (`require('string_decoder')`) from Node.js core + +Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details. + +Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.** + +The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version.
\ No newline at end of file diff --git a/node_modules/string_decoder/index.js b/node_modules/string_decoder/index.js new file mode 100644 index 00000000..b00e54fb --- /dev/null +++ b/node_modules/string_decoder/index.js @@ -0,0 +1,221 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +var Buffer = require('buffer').Buffer; + +var isBufferEncoding = Buffer.isEncoding + || function(encoding) { + switch (encoding && encoding.toLowerCase()) { + case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; + default: return false; + } + } + + +function assertEncoding(encoding) { + if (encoding && !isBufferEncoding(encoding)) { + throw new Error('Unknown encoding: ' + encoding); + } +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. CESU-8 is handled as part of the UTF-8 encoding. +// +// @TODO Handling all encodings inside a single object makes it very difficult +// to reason about this code, so it should be split up in the future. +// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code +// points as used by CESU-8. +var StringDecoder = exports.StringDecoder = function(encoding) { + this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); + assertEncoding(encoding); + switch (this.encoding) { + case 'utf8': + // CESU-8 represents each of Surrogate Pair by 3-bytes + this.surrogateSize = 3; + break; + case 'ucs2': + case 'utf16le': + // UTF-16 represents each of Surrogate Pair by 2-bytes + this.surrogateSize = 2; + this.detectIncompleteChar = utf16DetectIncompleteChar; + break; + case 'base64': + // Base-64 stores 3 bytes in 4 chars, and pads the remainder. + this.surrogateSize = 3; + this.detectIncompleteChar = base64DetectIncompleteChar; + break; + default: + this.write = passThroughWrite; + return; + } + + // Enough space to store all bytes of a single character. UTF-8 needs 4 + // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). + this.charBuffer = new Buffer(6); + // Number of bytes received for the current incomplete multi-byte character. + this.charReceived = 0; + // Number of bytes expected for the current incomplete multi-byte character. + this.charLength = 0; +}; + + +// write decodes the given buffer and returns it as JS string that is +// guaranteed to not contain any partial multi-byte characters. Any partial +// character found at the end of the buffer is buffered up, and will be +// returned when calling write again with the remaining bytes. +// +// Note: Converting a Buffer containing an orphan surrogate to a String +// currently works, but converting a String to a Buffer (via `new Buffer`, or +// Buffer#write) will replace incomplete surrogates with the unicode +// replacement character. See https://codereview.chromium.org/121173009/ . +StringDecoder.prototype.write = function(buffer) { + var charStr = ''; + // if our last write ended with an incomplete multibyte character + while (this.charLength) { + // determine how many remaining bytes this buffer has to offer for this char + var available = (buffer.length >= this.charLength - this.charReceived) ? + this.charLength - this.charReceived : + buffer.length; + + // add the new bytes to the char buffer + buffer.copy(this.charBuffer, this.charReceived, 0, available); + this.charReceived += available; + + if (this.charReceived < this.charLength) { + // still not enough chars in this buffer? wait for more ... + return ''; + } + + // remove bytes belonging to the current character from the buffer + buffer = buffer.slice(available, buffer.length); + + // get the character that was split + charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); + + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + var charCode = charStr.charCodeAt(charStr.length - 1); + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + this.charLength += this.surrogateSize; + charStr = ''; + continue; + } + this.charReceived = this.charLength = 0; + + // if there are no more bytes in this buffer, just emit our char + if (buffer.length === 0) { + return charStr; + } + break; + } + + // determine and set charLength / charReceived + this.detectIncompleteChar(buffer); + + var end = buffer.length; + if (this.charLength) { + // buffer the incomplete character bytes we got + buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); + end -= this.charReceived; + } + + charStr += buffer.toString(this.encoding, 0, end); + + var end = charStr.length - 1; + var charCode = charStr.charCodeAt(end); + // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character + if (charCode >= 0xD800 && charCode <= 0xDBFF) { + var size = this.surrogateSize; + this.charLength += size; + this.charReceived += size; + this.charBuffer.copy(this.charBuffer, size, 0, size); + buffer.copy(this.charBuffer, 0, 0, size); + return charStr.substring(0, end); + } + + // or just emit the charStr + return charStr; +}; + +// detectIncompleteChar determines if there is an incomplete UTF-8 character at +// the end of the given buffer. If so, it sets this.charLength to the byte +// length that character, and sets this.charReceived to the number of bytes +// that are available for this character. +StringDecoder.prototype.detectIncompleteChar = function(buffer) { + // determine how many bytes we have to check at the end of this buffer + var i = (buffer.length >= 3) ? 3 : buffer.length; + + // Figure out if one of the last i bytes of our buffer announces an + // incomplete char. + for (; i > 0; i--) { + var c = buffer[buffer.length - i]; + + // See http://en.wikipedia.org/wiki/UTF-8#Description + + // 110XXXXX + if (i == 1 && c >> 5 == 0x06) { + this.charLength = 2; + break; + } + + // 1110XXXX + if (i <= 2 && c >> 4 == 0x0E) { + this.charLength = 3; + break; + } + + // 11110XXX + if (i <= 3 && c >> 3 == 0x1E) { + this.charLength = 4; + break; + } + } + this.charReceived = i; +}; + +StringDecoder.prototype.end = function(buffer) { + var res = ''; + if (buffer && buffer.length) + res = this.write(buffer); + + if (this.charReceived) { + var cr = this.charReceived; + var buf = this.charBuffer; + var enc = this.encoding; + res += buf.slice(0, cr).toString(enc); + } + + return res; +}; + +function passThroughWrite(buffer) { + return buffer.toString(this.encoding); +} + +function utf16DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 2; + this.charLength = this.charReceived ? 2 : 0; +} + +function base64DetectIncompleteChar(buffer) { + this.charReceived = buffer.length % 3; + this.charLength = this.charReceived ? 3 : 0; +} diff --git a/node_modules/string_decoder/package.json b/node_modules/string_decoder/package.json new file mode 100644 index 00000000..f2dd499c --- /dev/null +++ b/node_modules/string_decoder/package.json @@ -0,0 +1,25 @@ +{ + "name": "string_decoder", + "version": "0.10.31", + "description": "The string_decoder module from Node core", + "main": "index.js", + "dependencies": {}, + "devDependencies": { + "tap": "~0.4.8" + }, + "scripts": { + "test": "tap test/simple/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/rvagg/string_decoder.git" + }, + "homepage": "https://github.com/rvagg/string_decoder", + "keywords": [ + "string", + "decoder", + "browser", + "browserify" + ], + "license": "MIT" +} diff --git a/node_modules/through2/.npmignore b/node_modules/through2/.npmignore new file mode 100644 index 00000000..1e1dcab3 --- /dev/null +++ b/node_modules/through2/.npmignore @@ -0,0 +1,3 @@ +test +.jshintrc +.travis.yml
\ No newline at end of file diff --git a/node_modules/through2/LICENSE b/node_modules/through2/LICENSE new file mode 100644 index 00000000..f6a0029d --- /dev/null +++ b/node_modules/through2/LICENSE @@ -0,0 +1,39 @@ +Copyright 2013, Rod Vagg (the "Original Author") +All rights reserved. + +MIT +no-false-attribs License + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +Distributions of all or part of the Software intended to be used +by the recipients as they would use the unmodified Software, +containing modifications that substantially alter, remove, or +disable functionality of the Software, outside of the documented +configuration mechanisms provided by the Software, shall be +modified such that the Original Author's bug reporting email +addresses and urls are either replaced with the contact information +of the parties responsible for the changes, or removed entirely. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + + +Except where noted, this license applies to any and all software +programs and associated documentation files created by the +Original Author, when distributed with the Software.
\ No newline at end of file diff --git a/node_modules/through2/README.md b/node_modules/through2/README.md new file mode 100644 index 00000000..11259a5f --- /dev/null +++ b/node_modules/through2/README.md @@ -0,0 +1,132 @@ +# through2 + +[](https://nodei.co/npm/through2/) + +**A tiny wrapper around Node streams.Transform (Streams2) to avoid explicit subclassing noise** + +Inspired by [Dominic Tarr](https://github.com/dominictarr)'s [through](https://github.com/dominictarr/through) in that it's so much easier to make a stream out of a function than it is to set up the prototype chain properly: `through(function (chunk) { ... })`. + +Note: A **Streams3** version of through2 is available in npm with the tag `"1.0"` rather than `"latest"` so an `npm install through2` will get you the current Streams2 version (version number is 0.x.x). To use a Streams3 version use `npm install through2@1` to fetch the latest version 1.x.x. More information about Streams2 vs Streams3 and recommendations see the article **[Why I don't use Node's core 'stream' module](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html)**. + +```js +fs.createReadStream('ex.txt') + .pipe(through2(function (chunk, enc, callback) { + for (var i = 0; i < chunk.length; i++) + if (chunk[i] == 97) + chunk[i] = 122 // swap 'a' for 'z' + + this.push(chunk) + + callback() + })) + .pipe(fs.createWriteStream('out.txt')) +``` + +Or object streams: + +```js +var all = [] + +fs.createReadStream('data.csv') + .pipe(csv2()) + .pipe(through2.obj(function (chunk, enc, callback) { + var data = { + name : chunk[0] + , address : chunk[3] + , phone : chunk[10] + } + this.push(data) + + callback() + })) + .on('data', function (data) { + all.push(data) + }) + .on('end', function () { + doSomethingSpecial(all) + }) +``` + +Note that `through2.obj(fn)` is a convenience wrapper around `through2({ objectMode: true }, fn)`. + +## API + +<b><code>through2([ options, ] [ transformFunction ] [, flushFunction ])</code></b> + +Consult the **[stream.Transform](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_transform)** documentation for the exact rules of the `transformFunction` (i.e. `this._transform`) and the optional `flushFunction` (i.e. `this._flush`). + +### options + +The options argument is optional and is passed straight through to `stream.Transform`. So you can use `objectMode:true` if you are processing non-binary streams (or just use `through2.obj()`). + +The `options` argument is first, unlike standard convention, because if I'm passing in an anonymous function then I'd prefer for the options argument to not get lost at the end of the call: + +```js +fs.createReadStream('/tmp/important.dat') + .pipe(through2({ objectMode: true, allowHalfOpen: false }, + function (chunk, enc, cb) { + cb(null, 'wut?') // note we can use the second argument on the callback + // to provide data as an alternative to this.push('wut?') + } + ) + .pipe(fs.createWriteStream('/tmp/wut.txt')) +``` + +### transformFunction + +The `transformFunction` must have the following signature: `function (chunk, encoding, callback) {}`. A minimal implementation should call the `callback` function to indicate that the transformation is done, even if that transformation means discarding the chunk. + +To queue a new chunk, call `this.push(chunk)`—this can be called as many times as required before the `callback()` if you have multiple pieces to send on. + +Alternatively, you may use `callback(err, chunk)` as shorthand for emitting a single chunk or an error. + +If you **do not provide a `transformFunction`** then you will get a simple pass-through stream. + +### flushFunction + +The optional `flushFunction` is provided as the last argument (2nd or 3rd, depending on whether you've supplied options) is called just prior to the stream ending. Can be used to finish up any processing that may be in progress. + +```js +fs.createReadStream('/tmp/important.dat') + .pipe(through2( + function (chunk, enc, cb) { cb(null, chunk) }, // transform is a noop + function (cb) { // flush function + this.push('tacking on an extra buffer to the end'); + cb(); + } + )) + .pipe(fs.createWriteStream('/tmp/wut.txt')); +``` + +<b><code>through2.ctor([ options, ] transformFunction[, flushFunction ])</code></b> + +Instead of returning a `stream.Transform` instance, `through2.ctor()` returns a **constructor** for a custom Transform. This is useful when you want to use the same transform logic in multiple instances. + +```js +var FToC = through2.ctor({objectMode: true}, function (record, encoding, callback) { + if (record.temp != null && record.unit = "F") { + record.temp = ( ( record.temp - 32 ) * 5 ) / 9 + record.unit = "C" + } + this.push(record) + callback() +}) + +// Create instances of FToC like so: +var converter = new FToC() +// Or: +var converter = FToC() +// Or specify/override options when you instantiate, if you prefer: +var converter = FToC({objectMode: true}) +``` + +## See Also + + - [through2-map](https://github.com/brycebaril/through2-map) - Array.prototype.map analog for streams. + - [through2-filter](https://github.com/brycebaril/through2-filter) - Array.prototype.filter analog for streams. + - [through2-reduce](https://github.com/brycebaril/through2-reduce) - Array.prototype.reduce analog for streams. + - [through2-spy](https://github.com/brycebaril/through2-spy) - Wrapper for simple stream.PassThrough spies. + +## License + +**through2** is Copyright (c) 2013 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/node_modules/through2/node_modules/readable-stream/.npmignore b/node_modules/through2/node_modules/readable-stream/.npmignore new file mode 100644 index 00000000..38344f87 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/.npmignore @@ -0,0 +1,5 @@ +build/ +test/ +examples/ +fs.js +zlib.js
\ No newline at end of file diff --git a/node_modules/through2/node_modules/readable-stream/LICENSE b/node_modules/through2/node_modules/readable-stream/LICENSE new file mode 100644 index 00000000..e3d4e695 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/LICENSE @@ -0,0 +1,18 @@ +Copyright Joyent, Inc. and other Node contributors. All rights reserved. +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. diff --git a/node_modules/through2/node_modules/readable-stream/README.md b/node_modules/through2/node_modules/readable-stream/README.md new file mode 100644 index 00000000..3fb3e802 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/README.md @@ -0,0 +1,15 @@ +# readable-stream + +***Node-core streams for userland*** + +[](https://nodei.co/npm/readable-stream/) +[](https://nodei.co/npm/readable-stream/) + +This package is a mirror of the Streams2 and Streams3 implementations in Node-core. + +If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core. + +**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12. + +**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"` + diff --git a/node_modules/through2/node_modules/readable-stream/duplex.js b/node_modules/through2/node_modules/readable-stream/duplex.js new file mode 100644 index 00000000..ca807af8 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/duplex.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_duplex.js") diff --git a/node_modules/through2/node_modules/readable-stream/lib/_stream_duplex.js b/node_modules/through2/node_modules/readable-stream/lib/_stream_duplex.js new file mode 100644 index 00000000..b513d61a --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/lib/_stream_duplex.js @@ -0,0 +1,89 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + +module.exports = Duplex; + +/*<replacement>*/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +} +/*</replacement>*/ + + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var Readable = require('./_stream_readable'); +var Writable = require('./_stream_writable'); + +util.inherits(Duplex, Readable); + +forEach(objectKeys(Writable.prototype), function(method) { + if (!Duplex.prototype[method]) + Duplex.prototype[method] = Writable.prototype[method]; +}); + +function Duplex(options) { + if (!(this instanceof Duplex)) + return new Duplex(options); + + Readable.call(this, options); + Writable.call(this, options); + + if (options && options.readable === false) + this.readable = false; + + if (options && options.writable === false) + this.writable = false; + + this.allowHalfOpen = true; + if (options && options.allowHalfOpen === false) + this.allowHalfOpen = false; + + this.once('end', onend); +} + +// the no-half-open enforcer +function onend() { + // if we allow half-open state, or if the writable side ended, + // then we're ok. + if (this.allowHalfOpen || this._writableState.ended) + return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(this.end.bind(this)); +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} diff --git a/node_modules/through2/node_modules/readable-stream/lib/_stream_passthrough.js b/node_modules/through2/node_modules/readable-stream/lib/_stream_passthrough.js new file mode 100644 index 00000000..895ca50a --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/lib/_stream_passthrough.js @@ -0,0 +1,46 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + +module.exports = PassThrough; + +var Transform = require('./_stream_transform'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +util.inherits(PassThrough, Transform); + +function PassThrough(options) { + if (!(this instanceof PassThrough)) + return new PassThrough(options); + + Transform.call(this, options); +} + +PassThrough.prototype._transform = function(chunk, encoding, cb) { + cb(null, chunk); +}; diff --git a/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js b/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js new file mode 100644 index 00000000..63072209 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/lib/_stream_readable.js @@ -0,0 +1,982 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +module.exports = Readable; + +/*<replacement>*/ +var isArray = require('isarray'); +/*</replacement>*/ + + +/*<replacement>*/ +var Buffer = require('buffer').Buffer; +/*</replacement>*/ + +Readable.ReadableState = ReadableState; + +var EE = require('events').EventEmitter; + +/*<replacement>*/ +if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { + return emitter.listeners(type).length; +}; +/*</replacement>*/ + +var Stream = require('stream'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var StringDecoder; + +util.inherits(Readable, Stream); + +function ReadableState(options, stream) { + options = options || {}; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.buffer = []; + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = false; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // In streams that never have any data, and do push(null) right away, + // the consumer can miss the 'end' event if they do some I/O before + // consuming the stream. So, we don't emit('end') until some reading + // happens. + this.calledRead = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // when piping, we only care about 'readable' events that happen + // after read()ing all the bytes and not getting any pushback. + this.ranOut = false; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) + StringDecoder = require('string_decoder/').StringDecoder; + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} + +function Readable(options) { + if (!(this instanceof Readable)) + return new Readable(options); + + this._readableState = new ReadableState(options, this); + + // legacy + this.readable = true; + + Stream.call(this); +} + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function(chunk, encoding) { + var state = this._readableState; + + if (typeof chunk === 'string' && !state.objectMode) { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = new Buffer(chunk, encoding); + encoding = ''; + } + } + + return readableAddChunk(this, state, chunk, encoding, false); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function(chunk) { + var state = this._readableState; + return readableAddChunk(this, state, chunk, '', true); +}; + +function readableAddChunk(stream, state, chunk, encoding, addToFront) { + var er = chunkInvalid(state, chunk); + if (er) { + stream.emit('error', er); + } else if (chunk === null || chunk === undefined) { + state.reading = false; + if (!state.ended) + onEofChunk(stream, state); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (state.ended && !addToFront) { + var e = new Error('stream.push() after EOF'); + stream.emit('error', e); + } else if (state.endEmitted && addToFront) { + var e = new Error('stream.unshift() after end event'); + stream.emit('error', e); + } else { + if (state.decoder && !addToFront && !encoding) + chunk = state.decoder.write(chunk); + + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) { + state.buffer.unshift(chunk); + } else { + state.reading = false; + state.buffer.push(chunk); + } + + if (state.needReadable) + emitReadable(stream); + + maybeReadMore(stream, state); + } + } else if (!addToFront) { + state.reading = false; + } + + return needMoreData(state); +} + + + +// if it's past the high water mark, we can push in some more. +// Also, if we have no data yet, we can stand some +// more bytes. This is to work around cases where hwm=0, +// such as the repl. Also, if the push() triggered a +// readable event, and the user called read(largeNumber) such that +// needReadable was set, then we ought to push more, so that another +// 'readable' event will be triggered. +function needMoreData(state) { + return !state.ended && + (state.needReadable || + state.length < state.highWaterMark || + state.length === 0); +} + +// backwards compatibility. +Readable.prototype.setEncoding = function(enc) { + if (!StringDecoder) + StringDecoder = require('string_decoder/').StringDecoder; + this._readableState.decoder = new StringDecoder(enc); + this._readableState.encoding = enc; +}; + +// Don't raise the hwm > 128MB +var MAX_HWM = 0x800000; +function roundUpToNextPowerOf2(n) { + if (n >= MAX_HWM) { + n = MAX_HWM; + } else { + // Get the next highest power of 2 + n--; + for (var p = 1; p < 32; p <<= 1) n |= n >> p; + n++; + } + return n; +} + +function howMuchToRead(n, state) { + if (state.length === 0 && state.ended) + return 0; + + if (state.objectMode) + return n === 0 ? 0 : 1; + + if (n === null || isNaN(n)) { + // only flow one buffer at a time + if (state.flowing && state.buffer.length) + return state.buffer[0].length; + else + return state.length; + } + + if (n <= 0) + return 0; + + // If we're asking for more than the target buffer level, + // then raise the water mark. Bump up to the next highest + // power of 2, to prevent increasing it excessively in tiny + // amounts. + if (n > state.highWaterMark) + state.highWaterMark = roundUpToNextPowerOf2(n); + + // don't have that much. return null, unless we've ended. + if (n > state.length) { + if (!state.ended) { + state.needReadable = true; + return 0; + } else + return state.length; + } + + return n; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function(n) { + var state = this._readableState; + state.calledRead = true; + var nOrig = n; + var ret; + + if (typeof n !== 'number' || n > 0) + state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && + state.needReadable && + (state.length >= state.highWaterMark || state.ended)) { + emitReadable(this); + return null; + } + + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + ret = null; + + // In cases where the decoder did not receive enough data + // to produce a full chunk, then immediately received an + // EOF, state.buffer will contain [<Buffer >, <Buffer 00 ...>]. + // howMuchToRead will see this and coerce the amount to + // read to zero (because it's looking at the length of the + // first <Buffer > in state.buffer), and we'll end up here. + // + // This can only happen via state.decoder -- no other venue + // exists for pushing a zero-length chunk into state.buffer + // and triggering this behavior. In this case, we return our + // remaining data and end the stream, if appropriate. + if (state.length > 0 && state.decoder) { + ret = fromList(n, state); + state.length -= ret.length; + } + + if (state.length === 0) + endReadable(this); + + return ret; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + + // if we currently have less than the highWaterMark, then also read some + if (state.length - n <= state.highWaterMark) + doRead = true; + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) + doRead = false; + + if (doRead) { + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) + state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + } + + // If _read called its callback synchronously, then `reading` + // will be false, and we need to re-evaluate how much data we + // can return to the user. + if (doRead && !state.reading) + n = howMuchToRead(nOrig, state); + + if (n > 0) + ret = fromList(n, state); + else + ret = null; + + if (ret === null) { + state.needReadable = true; + n = 0; + } + + state.length -= n; + + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (state.length === 0 && !state.ended) + state.needReadable = true; + + // If we happened to read() exactly the remaining amount in the + // buffer, and the EOF has been seen at this point, then make sure + // that we emit 'end' on the very next tick. + if (state.ended && !state.endEmitted && state.length === 0) + endReadable(this); + + return ret; +}; + +function chunkInvalid(state, chunk) { + var er = null; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + er = new TypeError('Invalid non-string/buffer chunk'); + } + return er; +} + + +function onEofChunk(stream, state) { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + + // if we've ended and we have some data left, then emit + // 'readable' now to make sure it gets picked up. + if (state.length > 0) + emitReadable(stream); + else + endReadable(stream); +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + state.needReadable = false; + if (state.emittedReadable) + return; + + state.emittedReadable = true; + if (state.sync) + process.nextTick(function() { + emitReadable_(stream); + }); + else + emitReadable_(stream); +} + +function emitReadable_(stream) { + stream.emit('readable'); +} + + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(function() { + maybeReadMore_(stream, state); + }); + } +} + +function maybeReadMore_(stream, state) { + var len = state.length; + while (!state.reading && !state.flowing && !state.ended && + state.length < state.highWaterMark) { + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + else + len = state.length; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function(n) { + this.emit('error', new Error('not implemented')); +}; + +Readable.prototype.pipe = function(dest, pipeOpts) { + var src = this; + var state = this._readableState; + + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + + var doEnd = (!pipeOpts || pipeOpts.end !== false) && + dest !== process.stdout && + dest !== process.stderr; + + var endFn = doEnd ? onend : cleanup; + if (state.endEmitted) + process.nextTick(endFn); + else + src.once('end', endFn); + + dest.on('unpipe', onunpipe); + function onunpipe(readable) { + if (readable !== src) return; + cleanup(); + } + + function onend() { + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + + function cleanup() { + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', cleanup); + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (!dest._writableState || dest._writableState.needDrain) + ondrain(); + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + unpipe(); + dest.removeListener('error', onerror); + if (EE.listenerCount(dest, 'error') === 0) + dest.emit('error', er); + } + // This is a brutally ugly hack to make sure that our error handler + // is attached before any userland ones. NEVER DO THIS. + if (!dest._events || !dest._events.error) + dest.on('error', onerror); + else if (isArray(dest._events.error)) + dest._events.error.unshift(onerror); + else + dest._events.error = [onerror, dest._events.error]; + + + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + + function unpipe() { + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + // the handler that waits for readable events after all + // the data gets sucked out in flow. + // This would be easier to follow with a .once() handler + // in flow(), but that is too slow. + this.on('readable', pipeOnReadable); + + state.flowing = true; + process.nextTick(function() { + flow(src); + }); + } + + return dest; +}; + +function pipeOnDrain(src) { + return function() { + var dest = this; + var state = src._readableState; + state.awaitDrain--; + if (state.awaitDrain === 0) + flow(src); + }; +} + +function flow(src) { + var state = src._readableState; + var chunk; + state.awaitDrain = 0; + + function write(dest, i, list) { + var written = dest.write(chunk); + if (false === written) { + state.awaitDrain++; + } + } + + while (state.pipesCount && null !== (chunk = src.read())) { + + if (state.pipesCount === 1) + write(state.pipes, 0, null); + else + forEach(state.pipes, write); + + src.emit('data', chunk); + + // if anyone needs a drain, then we have to wait for that. + if (state.awaitDrain > 0) + return; + } + + // if every destination was unpiped, either before entering this + // function, or in the while loop, then stop flowing. + // + // NB: This is a pretty rare edge case. + if (state.pipesCount === 0) { + state.flowing = false; + + // if there were data event listeners added, then switch to old mode. + if (EE.listenerCount(src, 'data') > 0) + emitDataEvents(src); + return; + } + + // at this point, no one needed a drain, so we just ran out of data + // on the next readable event, start it over again. + state.ranOut = true; +} + +function pipeOnReadable() { + if (this._readableState.ranOut) { + this._readableState.ranOut = false; + flow(this); + } +} + + +Readable.prototype.unpipe = function(dest) { + var state = this._readableState; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) + return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) + return this; + + if (!dest) + dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); + state.flowing = false; + if (dest) + dest.emit('unpipe', this); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + this.removeListener('readable', pipeOnReadable); + state.flowing = false; + + for (var i = 0; i < len; i++) + dests[i].emit('unpipe', this); + return this; + } + + // try to find the right one. + var i = indexOf(state.pipes, dest); + if (i === -1) + return this; + + state.pipes.splice(i, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) + state.pipes = state.pipes[0]; + + dest.emit('unpipe', this); + + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function(ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + + if (ev === 'data' && !this._readableState.flowing) + emitDataEvents(this); + + if (ev === 'readable' && this.readable) { + var state = this._readableState; + if (!state.readableListening) { + state.readableListening = true; + state.emittedReadable = false; + state.needReadable = true; + if (!state.reading) { + this.read(0); + } else if (state.length) { + emitReadable(this, state); + } + } + } + + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function() { + emitDataEvents(this); + this.read(0); + this.emit('resume'); +}; + +Readable.prototype.pause = function() { + emitDataEvents(this, true); + this.emit('pause'); +}; + +function emitDataEvents(stream, startPaused) { + var state = stream._readableState; + + if (state.flowing) { + // https://github.com/isaacs/readable-stream/issues/16 + throw new Error('Cannot switch to old mode now.'); + } + + var paused = startPaused || false; + var readable = false; + + // convert to an old-style stream. + stream.readable = true; + stream.pipe = Stream.prototype.pipe; + stream.on = stream.addListener = Stream.prototype.on; + + stream.on('readable', function() { + readable = true; + + var c; + while (!paused && (null !== (c = stream.read()))) + stream.emit('data', c); + + if (c === null) { + readable = false; + stream._readableState.needReadable = true; + } + }); + + stream.pause = function() { + paused = true; + this.emit('pause'); + }; + + stream.resume = function() { + paused = false; + if (readable) + process.nextTick(function() { + stream.emit('readable'); + }); + else + this.read(0); + this.emit('resume'); + }; + + // now make it start, just in case it hadn't already. + stream.emit('readable'); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function(stream) { + var state = this._readableState; + var paused = false; + + var self = this; + stream.on('end', function() { + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) + self.push(chunk); + } + + self.push(null); + }); + + stream.on('data', function(chunk) { + if (state.decoder) + chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + //if (state.objectMode && util.isNullOrUndefined(chunk)) + if (state.objectMode && (chunk === null || chunk === undefined)) + return; + else if (!state.objectMode && (!chunk || !chunk.length)) + return; + + var ret = self.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (typeof stream[i] === 'function' && + typeof this[i] === 'undefined') { + this[i] = function(method) { return function() { + return stream[method].apply(stream, arguments); + }}(i); + } + } + + // proxy certain important events. + var events = ['error', 'close', 'destroy', 'pause', 'resume']; + forEach(events, function(ev) { + stream.on(ev, self.emit.bind(self, ev)); + }); + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + self._read = function(n) { + if (paused) { + paused = false; + stream.resume(); + } + }; + + return self; +}; + + + +// exposed for testing purposes only. +Readable._fromList = fromList; + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +function fromList(n, state) { + var list = state.buffer; + var length = state.length; + var stringMode = !!state.decoder; + var objectMode = !!state.objectMode; + var ret; + + // nothing in the list, definitely empty. + if (list.length === 0) + return null; + + if (length === 0) + ret = null; + else if (objectMode) + ret = list.shift(); + else if (!n || n >= length) { + // read it all, truncate the array. + if (stringMode) + ret = list.join(''); + else + ret = Buffer.concat(list, length); + list.length = 0; + } else { + // read just some of it. + if (n < list[0].length) { + // just take a part of the first list item. + // slice is the same for buffers and strings. + var buf = list[0]; + ret = buf.slice(0, n); + list[0] = buf.slice(n); + } else if (n === list[0].length) { + // first list is a perfect match + ret = list.shift(); + } else { + // complex case. + // we have enough to cover it, but it spans past the first buffer. + if (stringMode) + ret = ''; + else + ret = new Buffer(n); + + var c = 0; + for (var i = 0, l = list.length; i < l && c < n; i++) { + var buf = list[0]; + var cpy = Math.min(n - c, buf.length); + + if (stringMode) + ret += buf.slice(0, cpy); + else + buf.copy(ret, c, 0, cpy); + + if (cpy < buf.length) + list[0] = buf.slice(cpy); + else + list.shift(); + + c += cpy; + } + } + } + + return ret; +} + +function endReadable(stream) { + var state = stream._readableState; + + // If we get here before consuming all the bytes, then that is a + // bug in node. Should never happen. + if (state.length > 0) + throw new Error('endReadable called on non-empty stream'); + + if (!state.endEmitted && state.calledRead) { + state.ended = true; + process.nextTick(function() { + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + } + }); + } +} + +function forEach (xs, f) { + for (var i = 0, l = xs.length; i < l; i++) { + f(xs[i], i); + } +} + +function indexOf (xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} diff --git a/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js b/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js new file mode 100644 index 00000000..eb188df3 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/lib/_stream_transform.js @@ -0,0 +1,210 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + +module.exports = Transform; + +var Duplex = require('./_stream_duplex'); + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +util.inherits(Transform, Duplex); + + +function TransformState(options, stream) { + this.afterTransform = function(er, data) { + return afterTransform(stream, er, data); + }; + + this.needTransform = false; + this.transforming = false; + this.writecb = null; + this.writechunk = null; +} + +function afterTransform(stream, er, data) { + var ts = stream._transformState; + ts.transforming = false; + + var cb = ts.writecb; + + if (!cb) + return stream.emit('error', new Error('no writecb in Transform class')); + + ts.writechunk = null; + ts.writecb = null; + + if (data !== null && data !== undefined) + stream.push(data); + + if (cb) + cb(er); + + var rs = stream._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + stream._read(rs.highWaterMark); + } +} + + +function Transform(options) { + if (!(this instanceof Transform)) + return new Transform(options); + + Duplex.call(this, options); + + var ts = this._transformState = new TransformState(options, this); + + // when the writable side finishes, then flush out anything remaining. + var stream = this; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + + this.once('finish', function() { + if ('function' === typeof this._flush) + this._flush(function(er) { + done(stream, er); + }); + else + done(stream); + }); +} + +Transform.prototype.push = function(chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function(chunk, encoding, cb) { + throw new Error('not implemented'); +}; + +Transform.prototype._write = function(chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || + rs.needReadable || + rs.length < rs.highWaterMark) + this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function(n) { + var ts = this._transformState; + + if (ts.writechunk !== null && ts.writecb && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; + + +function done(stream, er) { + if (er) + return stream.emit('error', er); + + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + var ws = stream._writableState; + var rs = stream._readableState; + var ts = stream._transformState; + + if (ws.length) + throw new Error('calling transform done when ws.length != 0'); + + if (ts.transforming) + throw new Error('calling transform done when still transforming'); + + return stream.push(null); +} diff --git a/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js b/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js new file mode 100644 index 00000000..4bdaa4fa --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/lib/_stream_writable.js @@ -0,0 +1,386 @@ +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, cb), and it'll handle all +// the drain event emission and buffering. + +module.exports = Writable; + +/*<replacement>*/ +var Buffer = require('buffer').Buffer; +/*</replacement>*/ + +Writable.WritableState = WritableState; + + +/*<replacement>*/ +var util = require('core-util-is'); +util.inherits = require('inherits'); +/*</replacement>*/ + +var Stream = require('stream'); + +util.inherits(Writable, Stream); + +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; +} + +function WritableState(options, stream) { + options = options || {}; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + var hwm = options.highWaterMark; + this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + + // cast to ints. + this.highWaterMark = ~~this.highWaterMark; + + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, becuase any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function(er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + + this.buffer = []; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; +} + +function Writable(options) { + var Duplex = require('./_stream_duplex'); + + // Writable ctor is applied to Duplexes, though they're not + // instanceof Writable, they're instanceof Readable. + if (!(this instanceof Writable) && !(this instanceof Duplex)) + return new Writable(options); + + this._writableState = new WritableState(options, this); + + // legacy. + this.writable = true; + + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function() { + this.emit('error', new Error('Cannot pipe. Not readable.')); +}; + + +function writeAfterEnd(stream, state, cb) { + var er = new Error('write after end'); + // TODO: defer error events consistently everywhere, not just the cb + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); +} + +// If we get something that is not a buffer, string, null, or undefined, +// and we're not in objectMode, then that's an error. +// Otherwise stream chunks are all considered to be of length=1, and the +// watermarks determine how many objects to keep in the buffer, rather than +// how many bytes or characters. +function validChunk(stream, state, chunk, cb) { + var valid = true; + if (!Buffer.isBuffer(chunk) && + 'string' !== typeof chunk && + chunk !== null && + chunk !== undefined && + !state.objectMode) { + var er = new TypeError('Invalid non-string/buffer chunk'); + stream.emit('error', er); + process.nextTick(function() { + cb(er); + }); + valid = false; + } + return valid; +} + +Writable.prototype.write = function(chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + else if (!encoding) + encoding = state.defaultEncoding; + + if (typeof cb !== 'function') + cb = function() {}; + + if (state.ended) + writeAfterEnd(this, state, cb); + else if (validChunk(this, state, chunk, cb)) + ret = writeOrBuffer(this, state, chunk, encoding, cb); + + return ret; +}; + +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && + state.decodeStrings !== false && + typeof chunk === 'string') { + chunk = new Buffer(chunk, encoding); + } + return chunk; +} + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, chunk, encoding, cb) { + chunk = decodeChunk(state, chunk, encoding); + if (Buffer.isBuffer(chunk)) + encoding = 'buffer'; + var len = state.objectMode ? 1 : chunk.length; + + state.length += len; + + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) + state.needDrain = true; + + if (state.writing) + state.buffer.push(new WriteReq(chunk, encoding, cb)); + else + doWrite(stream, state, len, chunk, encoding, cb); + + return ret; +} + +function doWrite(stream, state, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} + +function onwriteError(stream, state, sync, er, cb) { + if (sync) + process.nextTick(function() { + cb(er); + }); + else + cb(er); + + stream._writableState.errorEmitted = true; + stream.emit('error', er); +} + +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} + +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + + onwriteStateUpdate(state); + + if (er) + onwriteError(stream, state, sync, er, cb); + else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(stream, state); + + if (!finished && !state.bufferProcessing && state.buffer.length) + clearBuffer(stream, state); + + if (sync) { + process.nextTick(function() { + afterWrite(stream, state, finished, cb); + }); + } else { + afterWrite(stream, state, finished, cb); + } + } +} + +function afterWrite(stream, state, finished, cb) { + if (!finished) + onwriteDrain(stream, state); + cb(); + if (finished) + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + + for (var c = 0; c < state.buffer.length; c++) { + var entry = state.buffer[c]; + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + + doWrite(stream, state, len, chunk, encoding, cb); + + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + c++; + break; + } + } + + state.bufferProcessing = false; + if (c < state.buffer.length) + state.buffer = state.buffer.slice(c); + else + state.buffer.length = 0; +} + +Writable.prototype._write = function(chunk, encoding, cb) { + cb(new Error('not implemented')); +}; + +Writable.prototype.end = function(chunk, encoding, cb) { + var state = this._writableState; + + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + + if (typeof chunk !== 'undefined' && chunk !== null) + this.write(chunk, encoding); + + // ignore unnecessary end() calls. + if (!state.ending && !state.finished) + endWritable(this, state, cb); +}; + + +function needFinish(stream, state) { + return (state.ending && + state.length === 0 && + !state.finished && + !state.writing); +} + +function finishMaybe(stream, state) { + var need = needFinish(stream, state); + if (need) { + state.finished = true; + stream.emit('finish'); + } + return need; +} + +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) + process.nextTick(cb); + else + stream.once('finish', cb); + } + state.ended = true; +} diff --git a/node_modules/through2/node_modules/readable-stream/package.json b/node_modules/through2/node_modules/readable-stream/package.json new file mode 100644 index 00000000..b550f6ce --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/package.json @@ -0,0 +1,32 @@ +{ + "name": "readable-stream", + "version": "1.0.34", + "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x", + "main": "readable.js", + "dependencies": { + "core-util-is": "~1.0.0", + "isarray": "0.0.1", + "string_decoder": "~0.10.x", + "inherits": "~2.0.1" + }, + "devDependencies": { + "tap": "~0.2.6" + }, + "scripts": { + "test": "tap test/simple/*.js" + }, + "repository": { + "type": "git", + "url": "git://github.com/isaacs/readable-stream" + }, + "keywords": [ + "readable", + "stream", + "pipe" + ], + "browser": { + "util": false + }, + "author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)", + "license": "MIT" +} diff --git a/node_modules/through2/node_modules/readable-stream/passthrough.js b/node_modules/through2/node_modules/readable-stream/passthrough.js new file mode 100644 index 00000000..27e8d8a5 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/passthrough.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_passthrough.js") diff --git a/node_modules/through2/node_modules/readable-stream/readable.js b/node_modules/through2/node_modules/readable-stream/readable.js new file mode 100644 index 00000000..26511e87 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/readable.js @@ -0,0 +1,11 @@ +var Stream = require('stream'); // hack to fix a circular dependency issue when used with browserify +exports = module.exports = require('./lib/_stream_readable.js'); +exports.Stream = Stream; +exports.Readable = exports; +exports.Writable = require('./lib/_stream_writable.js'); +exports.Duplex = require('./lib/_stream_duplex.js'); +exports.Transform = require('./lib/_stream_transform.js'); +exports.PassThrough = require('./lib/_stream_passthrough.js'); +if (!process.browser && process.env.READABLE_STREAM === 'disable') { + module.exports = require('stream'); +} diff --git a/node_modules/through2/node_modules/readable-stream/transform.js b/node_modules/through2/node_modules/readable-stream/transform.js new file mode 100644 index 00000000..5d482f07 --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/transform.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_transform.js") diff --git a/node_modules/through2/node_modules/readable-stream/writable.js b/node_modules/through2/node_modules/readable-stream/writable.js new file mode 100644 index 00000000..e1e9efdf --- /dev/null +++ b/node_modules/through2/node_modules/readable-stream/writable.js @@ -0,0 +1 @@ +module.exports = require("./lib/_stream_writable.js") diff --git a/node_modules/through2/package.json b/node_modules/through2/package.json new file mode 100644 index 00000000..8c4439a9 --- /dev/null +++ b/node_modules/through2/package.json @@ -0,0 +1,31 @@ +{ + "name": "through2", + "version": "0.6.5", + "description": "A tiny wrapper around Node streams2 Transform to avoid explicit subclassing noise", + "main": "through2.js", + "scripts": { + "test": "node test/test.js", + "test-local": "brtapsauce-local test/basic-test.js" + }, + "repository": { + "type": "git", + "url": "https://github.com/rvagg/through2.git" + }, + "keywords": [ + "stream", + "streams2", + "through", + "transform" + ], + "author": "Rod Vagg <r@va.gg> (https://github.com/rvagg)", + "license": "MIT", + "dependencies": { + "readable-stream": ">=1.0.33-1 <1.1.0-0", + "xtend": ">=4.0.0 <4.1.0-0" + }, + "devDependencies": { + "bl": ">=0.9.0 <0.10.0-0", + "stream-spigot": ">=3.0.4 <3.1.0-0", + "tape": ">=2.14.0 <2.15.0-0" + } +} diff --git a/node_modules/through2/through2.js b/node_modules/through2/through2.js new file mode 100644 index 00000000..5b7a880e --- /dev/null +++ b/node_modules/through2/through2.js @@ -0,0 +1,96 @@ +var Transform = require('readable-stream/transform') + , inherits = require('util').inherits + , xtend = require('xtend') + +function DestroyableTransform(opts) { + Transform.call(this, opts) + this._destroyed = false +} + +inherits(DestroyableTransform, Transform) + +DestroyableTransform.prototype.destroy = function(err) { + if (this._destroyed) return + this._destroyed = true + + var self = this + process.nextTick(function() { + if (err) + self.emit('error', err) + self.emit('close') + }) +} + +// a noop _transform function +function noop (chunk, enc, callback) { + callback(null, chunk) +} + + +// create a new export function, used by both the main export and +// the .ctor export, contains common logic for dealing with arguments +function through2 (construct) { + return function (options, transform, flush) { + if (typeof options == 'function') { + flush = transform + transform = options + options = {} + } + + if (typeof transform != 'function') + transform = noop + + if (typeof flush != 'function') + flush = null + + return construct(options, transform, flush) + } +} + + +// main export, just make me a transform stream! +module.exports = through2(function (options, transform, flush) { + var t2 = new DestroyableTransform(options) + + t2._transform = transform + + if (flush) + t2._flush = flush + + return t2 +}) + + +// make me a reusable prototype that I can `new`, or implicitly `new` +// with a constructor call +module.exports.ctor = through2(function (options, transform, flush) { + function Through2 (override) { + if (!(this instanceof Through2)) + return new Through2(override) + + this.options = xtend(options, override) + + DestroyableTransform.call(this, this.options) + } + + inherits(Through2, DestroyableTransform) + + Through2.prototype._transform = transform + + if (flush) + Through2.prototype._flush = flush + + return Through2 +}) + + +module.exports.obj = through2(function (options, transform, flush) { + var t2 = new DestroyableTransform(xtend({ objectMode: true, highWaterMark: 16 }, options)) + + t2._transform = transform + + if (flush) + t2._flush = flush + + return t2 +}) diff --git a/node_modules/xtend/.jshintrc b/node_modules/xtend/.jshintrc new file mode 100644 index 00000000..77887b5f --- /dev/null +++ b/node_modules/xtend/.jshintrc @@ -0,0 +1,30 @@ +{ + "maxdepth": 4, + "maxstatements": 200, + "maxcomplexity": 12, + "maxlen": 80, + "maxparams": 5, + + "curly": true, + "eqeqeq": true, + "immed": true, + "latedef": false, + "noarg": true, + "noempty": true, + "nonew": true, + "undef": true, + "unused": "vars", + "trailing": true, + + "quotmark": true, + "expr": true, + "asi": true, + + "browser": false, + "esnext": true, + "devel": false, + "node": false, + "nonstandard": false, + + "predef": ["require", "module", "__dirname", "__filename"] +} diff --git a/node_modules/xtend/LICENSE b/node_modules/xtend/LICENSE new file mode 100644 index 00000000..0099f4f6 --- /dev/null +++ b/node_modules/xtend/LICENSE @@ -0,0 +1,20 @@ +The MIT License (MIT) +Copyright (c) 2012-2014 Raynos. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/node_modules/xtend/README.md b/node_modules/xtend/README.md new file mode 100644 index 00000000..4a2703cf --- /dev/null +++ b/node_modules/xtend/README.md @@ -0,0 +1,32 @@ +# xtend + +[![browser support][3]][4] + +[](http://github.com/badges/stability-badges) + +Extend like a boss + +xtend is a basic utility library which allows you to extend an object by appending all of the properties from each object in a list. When there are identical properties, the right-most property takes precedence. + +## Examples + +```js +var extend = require("xtend") + +// extend returns a new object. Does not mutate arguments +var combination = extend({ + a: "a", + b: "c" +}, { + b: "b" +}) +// { a: "a", b: "b" } +``` + +## Stability status: Locked + +## MIT Licensed + + + [3]: http://ci.testling.com/Raynos/xtend.png + [4]: http://ci.testling.com/Raynos/xtend diff --git a/node_modules/xtend/immutable.js b/node_modules/xtend/immutable.js new file mode 100644 index 00000000..94889c9d --- /dev/null +++ b/node_modules/xtend/immutable.js @@ -0,0 +1,19 @@ +module.exports = extend + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend() { + var target = {} + + for (var i = 0; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/xtend/mutable.js b/node_modules/xtend/mutable.js new file mode 100644 index 00000000..72debede --- /dev/null +++ b/node_modules/xtend/mutable.js @@ -0,0 +1,17 @@ +module.exports = extend + +var hasOwnProperty = Object.prototype.hasOwnProperty; + +function extend(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] + + for (var key in source) { + if (hasOwnProperty.call(source, key)) { + target[key] = source[key] + } + } + } + + return target +} diff --git a/node_modules/xtend/package.json b/node_modules/xtend/package.json new file mode 100644 index 00000000..f7a39d10 --- /dev/null +++ b/node_modules/xtend/package.json @@ -0,0 +1,55 @@ +{ + "name": "xtend", + "version": "4.0.2", + "description": "extend like a boss", + "keywords": [ + "extend", + "merge", + "options", + "opts", + "object", + "array" + ], + "author": "Raynos <raynos2@gmail.com>", + "repository": "git://github.com/Raynos/xtend.git", + "main": "immutable", + "scripts": { + "test": "node test" + }, + "dependencies": {}, + "devDependencies": { + "tape": "~1.1.0" + }, + "homepage": "https://github.com/Raynos/xtend", + "contributors": [ + { + "name": "Jake Verbaten" + }, + { + "name": "Matt Esch" + } + ], + "bugs": { + "url": "https://github.com/Raynos/xtend/issues", + "email": "raynos2@gmail.com" + }, + "license": "MIT", + "testling": { + "files": "test.js", + "browsers": [ + "ie/7..latest", + "firefox/16..latest", + "firefox/nightly", + "chrome/22..latest", + "chrome/canary", + "opera/12..latest", + "opera/next", + "safari/5.1..latest", + "ipad/6.0..latest", + "iphone/6.0..latest" + ] + }, + "engines": { + "node": ">=0.4" + } +} diff --git a/node_modules/xtend/test.js b/node_modules/xtend/test.js new file mode 100644 index 00000000..b895b42b --- /dev/null +++ b/node_modules/xtend/test.js @@ -0,0 +1,103 @@ +var test = require("tape") +var extend = require("./") +var mutableExtend = require("./mutable") + +test("merge", function(assert) { + var a = { a: "foo" } + var b = { b: "bar" } + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("replace", function(assert) { + var a = { a: "foo" } + var b = { a: "bar" } + + assert.deepEqual(extend(a, b), { a: "bar" }) + assert.end() +}) + +test("undefined", function(assert) { + var a = { a: undefined } + var b = { b: "foo" } + + assert.deepEqual(extend(a, b), { a: undefined, b: "foo" }) + assert.deepEqual(extend(b, a), { a: undefined, b: "foo" }) + assert.end() +}) + +test("handle 0", function(assert) { + var a = { a: "default" } + var b = { a: 0 } + + assert.deepEqual(extend(a, b), { a: 0 }) + assert.deepEqual(extend(b, a), { a: "default" }) + assert.end() +}) + +test("is immutable", function (assert) { + var record = {} + + extend(record, { foo: "bar" }) + assert.equal(record.foo, undefined) + assert.end() +}) + +test("null as argument", function (assert) { + var a = { foo: "bar" } + var b = null + var c = void 0 + + assert.deepEqual(extend(b, a, c), { foo: "bar" }) + assert.end() +}) + +test("mutable", function (assert) { + var a = { foo: "bar" } + + mutableExtend(a, { bar: "baz" }) + + assert.equal(a.bar, "baz") + assert.end() +}) + +test("null prototype", function(assert) { + var a = { a: "foo" } + var b = Object.create(null) + b.b = "bar"; + + assert.deepEqual(extend(a, b), { a: "foo", b: "bar" }) + assert.end() +}) + +test("null prototype mutable", function (assert) { + var a = { foo: "bar" } + var b = Object.create(null) + b.bar = "baz"; + + mutableExtend(a, b) + + assert.equal(a.bar, "baz") + assert.end() +}) + +test("prototype pollution", function (assert) { + var a = {} + var maliciousPayload = '{"__proto__":{"oops":"It works!"}}' + + assert.strictEqual(a.oops, undefined) + extend({}, maliciousPayload) + assert.strictEqual(a.oops, undefined) + assert.end() +}) + +test("prototype pollution mutable", function (assert) { + var a = {} + var maliciousPayload = '{"__proto__":{"oops":"It works!"}}' + + assert.strictEqual(a.oops, undefined) + mutableExtend({}, maliciousPayload) + assert.strictEqual(a.oops, undefined) + assert.end() +}) |
