diff --git a/node_modules/.package-lock.json b/node_modules/.package-lock.json index 46cb43e899..222ddcee3f 100644 --- a/node_modules/.package-lock.json +++ b/node_modules/.package-lock.json @@ -1752,6 +1752,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "node_modules/colord": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", + "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "dev": true + }, "node_modules/colorette": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", @@ -4553,9 +4559,9 @@ } }, "node_modules/known-css-properties": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.23.0.tgz", - "integrity": "sha512-h9ivI88e1lFNmTT4HovBN33Ysn0OIJG7IPG2mkpx2uniQXFWqo35QdiX7w0TovlUFXfW8aPFblP5/q0jlOr2sA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.24.0.tgz", + "integrity": "sha512-RTSoaUAfLvpR357vWzAz/50Q/BmHfmE6ETSWfutT0AJiw10e6CmcdYRQJlLRd95B53D0Y2aD1jSxD3V3ySF+PA==", "dev": true }, "node_modules/levn": { @@ -4625,12 +4631,6 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, - "node_modules/lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -5720,14 +5720,14 @@ } }, "node_modules/postcss": { - "version": "8.3.11", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz", - "integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==", + "version": "8.4.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", + "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==", "dev": true, "dependencies": { "nanoid": "^3.1.30", "picocolors": "^1.0.0", - "source-map-js": "^0.6.2" + "source-map-js": "^1.0.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -5766,9 +5766,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz", - "integrity": "sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==", + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.8.tgz", + "integrity": "sha512-D5PG53d209Z1Uhcc0qAZ5U3t5HagH3cxu+WLZ22jt3gLUpXM4eXXfiO14jiDWST3NNooX/E8wISfOhZ9eIjGTQ==", "dev": true, "dependencies": { "cssesc": "^3.0.0", @@ -6399,6 +6399,9 @@ }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, "node_modules/slice-ansi/node_modules/ansi-styles": { @@ -6411,6 +6414,9 @@ }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/slice-ansi/node_modules/color-convert": { @@ -6504,9 +6510,9 @@ } }, "node_modules/source-map-js": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", - "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", + "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", "dev": true, "engines": { "node": ">=0.10.0" @@ -6754,14 +6760,15 @@ "dev": true }, "node_modules/stylelint": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.0.1.tgz", - "integrity": "sha512-ZcAkmFLVCultmwkQUjxKzxW/o5+CzNmDk6TPJj/d4Y7ipTGGrewIWmNm+InjdSr04PR5/yynsAJeYJY/wisdMg==", + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.2.0.tgz", + "integrity": "sha512-i0DrmDXFNpDsWiwx6SPRs4/pyw4kvZgqpDGvsTslQMY7hpUl6r33aQvNSn6cnTg2wtZ9rreFElI7XAKpOWi1vQ==", "dev": true, "dependencies": { "balanced-match": "^2.0.0", + "colord": "^2.9.2", "cosmiconfig": "^7.0.1", - "debug": "^4.3.2", + "debug": "^4.3.3", "execall": "^2.0.0", "fast-glob": "^3.2.7", "fastest-levenshtein": "^1.0.12", @@ -6771,11 +6778,11 @@ "globby": "^11.0.4", "globjoin": "^0.1.4", "html-tags": "^3.1.0", - "ignore": "^5.1.8", + "ignore": "^5.2.0", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", - "known-css-properties": "^0.23.0", + "known-css-properties": "^0.24.0", "mathml-tag-names": "^2.1.3", "meow": "^9.0.0", "micromatch": "^4.0.4", @@ -6786,7 +6793,7 @@ "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.6", + "postcss-selector-parser": "^6.0.7", "postcss-value-parser": "^4.1.0", "resolve-from": "^5.0.0", "specificity": "^0.4.1", @@ -6794,7 +6801,7 @@ "strip-ansi": "^6.0.1", "style-search": "^0.1.0", "svg-tags": "^1.0.0", - "table": "^6.7.2", + "table": "^6.7.5", "v8-compile-cache": "^2.3.0", "write-file-atomic": "^3.0.3" }, @@ -6819,9 +6826,9 @@ } }, "node_modules/stylelint-config-standard": { - "version": "23.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-23.0.0.tgz", - "integrity": "sha512-8PDlk+nWuc1T66nVaODTdVodN0pjuE5TBlopi39Lt9EM36YJsRhqttMyUhnS78oc/59Q6n8iw2GJB4QcoFqtRg==", + "version": "24.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-24.0.0.tgz", + "integrity": "sha512-+RtU7fbNT+VlNbdXJvnjc3USNPZRiRVp/d2DxOF/vBDDTi0kH5RX2Ny6errdtZJH3boO+bmqIYEllEmok4jiuw==", "dev": true, "dependencies": { "stylelint-config-recommended": "^6.0.0" @@ -7002,13 +7009,12 @@ } }, "node_modules/table": { - "version": "6.7.2", - "resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz", - "integrity": "sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", + "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", "dev": true, "dependencies": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", diff --git a/node_modules/colord/CHANGELOG.md b/node_modules/colord/CHANGELOG.md new file mode 100644 index 0000000000..d2c8c874f6 --- /dev/null +++ b/node_modules/colord/CHANGELOG.md @@ -0,0 +1,184 @@ +### 2.9.2 + +- Fix: Add "package.json" to exports map + +### 2.9.1 + +- Fix: Make minification lossless +- Fix: Minify to name only if color is opaque + +### 2.9.0 + +- New plugin: Color string minification 🗜 + +### 2.8.0 + +- New `delta` method to calculate the perceived color difference between two colors ❤️ [@EricRovell](https://github.com/EricRovell) + +### 2.7.0 + +- Improve `mix` plugin by adding new `tints`, `tones` and `shades` methods ❤️ [@EricRovell](https://github.com/EricRovell) + +### 2.6.0 + +- Support "double split complementary" color harmony generation ❤️ [@EricRovell](https://github.com/EricRovell) & [@lbragile](https://github.com/lbragile) + +### 2.5.0 + +- New `closest` option of `toName` method allows you to find the closest color if there is no exact match + +### 2.4.0 + +- New plugin: Color harmonies generator ❤️ [@EricRovell](https://github.com/EricRovell) + +### 2.3.0 + +- Add new `isEqual` method ❤️ [@EricRovell](https://github.com/EricRovell) + +### 2.2.0 + +- New plugin: CMYK color space ❤️ [@EricRovell](https://github.com/EricRovell) + +### 2.1.0 + +- Add new `hue` and `rotate` methods + +### 2.0.1 + +- Improve the precision of alpha values + +### 2.0.0 + +- Strict string color parsing conforming to the CSS Color Level specifications + +### 1.7.2 + +- Simplify package "exports" field to improve different environments support + +### 1.7.1 + +- Parse a color name disregarding the case + +### 1.7.0 + +- New `getFormat` utility +- Support HWB color strings (CSS functional notation) +- Clamp LAB values as defined in CSS Color Level 4 specs + +### 1.6.0 + +- Improvement: You can now use every angle unit supported by CSS (`deg`, `rad`, `grad`, `turn`) + +### 1.5.0 + +- New utility: Random color generation + +### 1.4.1 + +- Mix colors through CIE LAB color space + +### 1.4.0 + +- New plugin: Color mixing +- Adjust XYZ, LAB and LCH conversions to the D50 white point ([according to the latest CSS specs](https://drafts.csswg.org/css-color-5/#color-spaces)). + +### 1.3.1 + +- Support modern CSS notations of RGB, HSL and LCH color functions + +### 1.3.0 + +- New plugin: CIE LCH color space + +### 1.2.1 + +- Fix: Do not treat 7-digit hex as a valid color ❤️ [@subzey](https://github.com/subzey) +- Parser update: Turn NaN input values into valid numbers ❤️ [@subzey](https://github.com/subzey) + +### 1.2.0 + +- New plugin: CIE LAB color space + +### 1.1.1 + +- Make bundle 1% lighter + +### 1.1.0 + +- Add `isValid` method + +### 1.0 + +- An official production-ready release + +### 0.10.2 + +- Sort named colors dictionary for better compression ❤️ [@subzey](https://github.com/subzey) + +### 0.10.1 + +- Ignore `null` input in the parsers + +### 0.10 + +- Shorten conversion method names (`toRgba` to `toRgb`, etc) + +### 0.9.3 + +- New plugin: HWB color model +- More accurate HSL and HSV conversions + +### 0.9.2 + +- Names plugin: Support "transparent" keyword + +### 0.9.1 + +- Improve package exports + +### 0.9 + +- Add CommonJS exports + +### 0.8 + +- New plugin: a11y (Accessibility) + +### 0.7 + +- New plugin: CIE XYZ color space + +### 0.6.2 + +- 20% speed improvement ❤️ [@jeetiss](https://github.com/jeetiss) + +### 0.6.1 + +- 100% code coverage + +### 0.6 + +- Make plugin available in Parcel which doesn't support exports map yet +- Fix names plugin TS declarations export +- Documentation + +### 0.5 + +- New plugin: CSS color names + +### 0.4 + +- Make the library ESM-first +- Add code coverage reports + +### 0.3 + +- Implement Plugin API + +### 0.2 + +- Support 4 and 8 digit Hex + +### 0.1 + +- Basic API diff --git a/node_modules/colord/LICENSE.md b/node_modules/colord/LICENSE.md new file mode 100644 index 0000000000..e437003733 --- /dev/null +++ b/node_modules/colord/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Vlad Shilov omgovich@ya.ru + +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/colord/README.md b/node_modules/colord/README.md new file mode 100644 index 0000000000..db36c6aa89 --- /dev/null +++ b/node_modules/colord/README.md @@ -0,0 +1,1053 @@ +
+ + colord + +
+ +
+ + npm + + + build + + + coverage + + + no dependencies + + + types included + +
+ +
+ Colord is a tiny yet powerful tool for high-performance color manipulations and conversions. +
+ +## Features + +- 📦 **Small**: Just **1.7 KB** gzipped ([3x+ lighter](#benchmarks) than **color** and **tinycolor2**) +- 🚀 **Fast**: [3x+ faster](#benchmarks) than **color** and **tinycolor2** +- 😍 **Simple**: Chainable API and familiar patterns +- 💪 **Immutable**: No need to worry about data mutations +- 🛡 **Bulletproof**: Written in strict TypeScript and has 100% test coverage +- 🗂 **Typed**: Ships with [types included](#types) +- 🏗 **Extendable**: Built-in [plugin system](#plugins) to add new functionality +- 📚 **CSS-compliant**: Strictly follows CSS Color Level specifications +- 👫 **Works everywhere**: Supports all browsers and Node.js +- 💨 **Dependency-free** + +
---
+ +## Benchmarks + +| Library | Operations/sec | Size
(minified) | Size
(gzipped) | Dependencies | Type declarations | +| ----------------------------- | ----------------------------- | --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------- | +| colord 👑 | 3,524,989 | [![](https://badgen.net/bundlephobia/min/colord?color=6ead0a&label=)](https://bundlephobia.com/result?p=colord) | [![](https://badgen.net/bundlephobia/minzip/colord?color=6ead0a&label=)](https://bundlephobia.com/result?p=colord) | [![](https://badgen.net/bundlephobia/dependency-count/colord?color=6ead0a&label=)](https://bundlephobia.com/result?p=colord) | [![](https://badgen.net/npm/types/colord?color=6ead0a&label=)](https://bundlephobia.com/result?p=colord) | +| color | 744,263 | [![](https://badgen.net/bundlephobia/min/color?color=red&label=)](https://bundlephobia.com/result?p=color) | [![](https://badgen.net/bundlephobia/minzip/color?color=red&label=)](https://bundlephobia.com/result?p=color) | [![](https://badgen.net/bundlephobia/dependency-count/color?color=red&label=)](https://bundlephobia.com/result?p=color) | [![](https://badgen.net/npm/types/color?color=e6591d&label=)](https://bundlephobia.com/result?p=color) | +| tinycolor2 | 971,312 | [![](https://badgen.net/bundlephobia/min/tinycolor2?color=red&label=)](https://bundlephobia.com/result?p=tinycolor2) | [![](https://badgen.net/bundlephobia/minzip/tinycolor2?color=red&label=)](https://bundlephobia.com/result?p=tinycolor2) | [![](https://badgen.net/bundlephobia/dependency-count/tinycolor2?color=6ead0a&label=)](https://bundlephobia.com/result?p=tinycolor2) | [![](https://badgen.net/npm/types/tinycolor2?color=e6591d&label=)](https://bundlephobia.com/result?p=tinycolor2) | +| ac-colors | 660,722 | [![](https://badgen.net/bundlephobia/min/ac-colors?color=e6591d&label=)](https://bundlephobia.com/result?p=ac-colors) | [![](https://badgen.net/bundlephobia/minzip/ac-colors?color=e6591d&label=)](https://bundlephobia.com/result?p=ac-colors) | [![](https://badgen.net/bundlephobia/dependency-count/ac-colors?color=6ead0a&label=)](https://bundlephobia.com/result?p=ac-colors) | [![](https://badgen.net/npm/types/ac-colors?color=red&label=)](https://bundlephobia.com/result?p=ac-colors) | +| chroma-js | 962,967 | [![](https://badgen.net/bundlephobia/min/chroma-js?color=red&label=)](https://bundlephobia.com/result?p=chroma-js) | [![](https://badgen.net/bundlephobia/minzip/chroma-js?color=red&label=)](https://bundlephobia.com/result?p=chroma-js) | [![](https://badgen.net/bundlephobia/dependency-count/chroma-js?color=red&label=)](https://bundlephobia.com/result?p=chroma-js) | [![](https://badgen.net/npm/types/chroma-js?color=e6591d&label=)](https://bundlephobia.com/result?p=chroma-js) | + +The performance results were generated on a MBP 2019, 2,6 GHz Intel Core i7 by running `npm run benchmark` in the library folder. See [tests/benchmark.ts](https://github.com/omgovich/colord/blob/master/tests/benchmark.ts). + +
---
+ +## Getting Started + +``` +npm i colord +``` + +```js +import { colord } from "colord"; + +colord("#ff0000").grayscale().alpha(0.25).toRgbString(); // "rgba(128, 128, 128, 0.25)" +colord("rgb(192, 192, 192)").isLight(); // true +colord("hsl(0, 50%, 50%)").darken(0.25).toHex(); // "#602020" +``` + +
---
+ +## Supported Color Models + +- Hexadecimal strings (including 3, 4 and 8 digit notations) +- RGB strings and objects +- HSL strings and objects +- HSV objects +- Color names ([via plugin](#plugins)) +- HWB objects and strings ([via plugin](#plugins)) +- CMYK objects and strings ([via plugin](#plugins)) +- LCH objects and strings ([via plugin](#plugins)) +- LAB objects ([via plugin](#plugins)) +- XYZ objects ([via plugin](#plugins)) + +
---
+ +## API + +### Color parsing + +
+ colord(input) + +Parses the given input and creates a new Colord instance. String parsing strictly conforms to [CSS Color Level Specifications](https://www.w3.org/TR/css-color-4/#color-type). + +```js +import { colord } from "colord"; + +// String input examples +colord("#FFF"); +colord("#ffffff"); +colord("#ffffffff"); +colord("rgb(255, 255, 255)"); +colord("rgba(255, 255, 255, 0.5)"); +colord("rgba(100% 100% 100% / 50%)"); +colord("hsl(90, 100%, 100%)"); +colord("hsla(90, 100%, 100%, 0.5)"); +colord("hsla(90deg 100% 100% / 50%)"); +colord("tomato"); // requires "names" plugin + +// Object input examples +colord({ r: 255, g: 255, b: 255 }); +colord({ r: 255, g: 255, b: 255, a: 1 }); +colord({ h: 360, s: 100, l: 100 }); +colord({ h: 360, s: 100, l: 100, a: 1 }); +colord({ h: 360, s: 100, v: 100 }); +colord({ h: 360, s: 100, v: 100, a: 1 }); +``` + +Check out the ["Plugins"](#plugins) section for more input format examples. + +
+ +
+ getFormat(input) + +Returns a color model name for the input passed to the function. Uses the same parsing system as `colord` function. + +```js +import { getFormat } from "colord"; + +getFormat("#aabbcc"); // "hex" +getFormat({ r: 13, g: 237, b: 162, a: 0.5 }); // "rgb" +getFormat("hsl(180deg, 50%, 50%)"); // "hsl" +getFormat("WUT?"); // undefined +``` + +
+ +### Color conversion + +
+ .toHex() + +Returns the [hexadecimal representation](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#rgb_colors) of a color. When the alpha channel value of the color is less than 1, it outputs `#rrggbbaa` format instead of `#rrggbb`. + +```js +colord("rgb(0, 255, 0)").toHex(); // "#00ff00" +colord({ h: 300, s: 100, l: 50 }).toHex(); // "#ff00ff" +colord({ r: 255, g: 255, b: 255, a: 0 }).toHex(); // "#ffffff00" +``` + +
+ +
+ .toRgb() + +```js +colord("#ff0000").toRgb(); // { r: 255, g: 0, b: 0, a: 1 } +colord({ h: 180, s: 100, l: 50, a: 0.5 }).toRgb(); // { r: 0, g: 255, b: 255, a: 0.5 } +``` + +
+ +
+ .toRgbString() + +```js +colord("#ff0000").toRgbString(); // "rgb(255, 0, 0)" +colord({ h: 180, s: 100, l: 50, a: 0.5 }).toRgbString(); // "rgba(0, 255, 255, 0.5)" +``` + +
+ +
+ .toHsl() + +Converts a color to [HSL color space](https://en.wikipedia.org/wiki/HSL_and_HSV) and returns an object. + +```js +colord("#ffff00").toHsl(); // { h: 60, s: 100, l: 50, a: 1 } +colord("rgba(0, 0, 255, 0.5) ").toHsl(); // { h: 240, s: 100, l: 50, a: 0.5 } +``` + +
+ +
+ .toHslString() + +Converts a color to [HSL color space](https://en.wikipedia.org/wiki/HSL_and_HSV) and expresses it through the [functional notation](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#hsl_colors). + +```js +colord("#ffff00").toHslString(); // "hsl(60, 100%, 50%)" +colord("rgba(0, 0, 255, 0.5)").toHslString(); // "hsla(240, 100%, 50%, 0.5)" +``` + +
+ +
+ .toHsv() + +Converts a color to [HSV color space](https://en.wikipedia.org/wiki/HSL_and_HSV) and returns an object. + +```js +colord("#ffff00").toHsv(); // { h: 60, s: 100, v: 100, a: 1 } +colord("rgba(0, 255, 255, 0.5) ").toHsv(); // { h: 180, s: 100, v: 100, a: 1 } +``` + +
+ +
+ .toName(options?) (names plugin) + +Converts a color to a [CSS keyword](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#color_keywords). Returns `undefined` if the color is not specified in the specs. + +```js +import { colord, extend } from "colord"; +import namesPlugin from "colord/plugins/names"; + +extend([namesPlugin]); + +colord("#ff6347").toName(); // "tomato" +colord("#00ffff").toName(); // "cyan" +colord("rgba(0, 0, 0, 0)").toName(); // "transparent" + +colord("#fe0000").toName(); // undefined (the color is not specified in CSS specs) +colord("#fe0000").toName({ closest: true }); // "red" (closest color available) +``` + +
+ +
+ .toCmyk() (cmyk plugin) + +Converts a color to [CMYK](https://en.wikipedia.org/wiki/CMYK_color_model) color space. + +```js +import { colord, extend } from "colord"; +import cmykPlugin from "colord/plugins/cmyk"; + +extend([cmykPlugin]); + +colord("#ffffff").toCmyk(); // { c: 0, m: 0, y: 0, k: 0, a: 1 } +colord("#555aaa").toCmyk(); // { c: 50, m: 47, y: 0, k: 33, a: 1 } +``` + +
+ +
+ .toCmykString() (cmyk plugin) + +Converts a color to color space. + +Converts a color to [CMYK](https://en.wikipedia.org/wiki/CMYK_color_model) color space and expresses it through the [functional notation](https://www.w3.org/TR/css-color-4/#device-cmyk) + +```js +import { colord, extend } from "colord"; +import cmykPlugin from "colord/plugins/cmyk"; + +extend([cmykPlugin]); + +colord("#99ffff").toCmykString(); // "device-cmyk(40% 0% 0% 0%)" +colord("#00336680").toCmykString(); // "device-cmyk(100% 50% 0% 60% / 0.5)" +``` + +
+ +
+ .toHwb() (hwb plugin) + +Converts a color to [HWB (Hue-Whiteness-Blackness)](https://en.wikipedia.org/wiki/HWB_color_model) color space. + +```js +import { colord, extend } from "colord"; +import hwbPlugin from "colord/plugins/hwb"; + +extend([hwbPlugin]); + +colord("#ffffff").toHwb(); // { h: 0, w: 100, b: 0, a: 1 } +colord("#555aaa").toHwb(); // { h: 236, w: 33, b: 33, a: 1 } +``` + +
+ +
+ .toHwbString() (hwb plugin) + +Converts a color to [HWB (Hue-Whiteness-Blackness)](https://en.wikipedia.org/wiki/HWB_color_model) color space and expresses it through the [functional notation](https://www.w3.org/TR/css-color-4/#the-hwb-notation). + +```js +import { colord, extend } from "colord"; +import hwbPlugin from "colord/plugins/hwb"; + +extend([hwbPlugin]); + +colord("#999966").toHwbString(); // "hwb(60 40% 40%)" +colord("#99ffff").toHwbString(); // "hwb(180 60% 0%)" +colord("#003366").alpha(0.5).toHwbString(); // "hwb(210 0% 60% / 0.5)" +``` + +
+ +
+ .toLab() (lab plugin) + +Converts a color to [CIE LAB](https://en.wikipedia.org/wiki/CIELAB_color_space) color space. The conversion logic is ported from [CSS Color Module Level 4 Specification](https://www.w3.org/TR/css-color-4/#color-conversion-code). + +```js +import { colord, extend } from "colord"; +import labPlugin from "colord/plugins/lab"; + +extend([labPlugin]); + +colord("#ffffff").toLab(); // { l: 100, a: 0, b: 0, alpha: 1 } +colord("#33221180").toLab(); // { l: 14.89, a: 5.77, b: 14.41, alpha: 0.5 } +``` + +
+ +
+ .toLch() (lch plugin) + +Converts a color to [CIE LCH](https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/) color space. The conversion logic is ported from [CSS Color Module Level 4 Specification](https://www.w3.org/TR/css-color-4/#color-conversion-code). + +```js +import { colord, extend } from "colord"; +import lchPlugin from "colord/plugins/lch"; + +extend([lchPlugin]); + +colord("#ffffff").toLch(); // { l: 100, c: 0, h: 0, a: 1 } +colord("#213b0b").toLch(); // { l: 21.85, c: 31.95, h: 127.77, a: 1 } +``` + +
+ +
+ .toLchString() (lch plugin) + +Converts a color to [CIE LCH](https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/) color space and expresses it through the [functional notation](https://www.w3.org/TR/css-color-4/#specifying-lab-lch). + +```js +import { colord, extend } from "colord"; +import lchPlugin from "colord/plugins/lch"; + +extend([lchPlugin]); + +colord("#ffffff").toLchString(); // "lch(100% 0 0)" +colord("#213b0b").alpha(0.5).toLchString(); // "lch(21.85% 31.95 127.77 / 0.5)" +``` + +
+ +
+ .toXyz() (xyz plugin) + +Converts a color to [CIE XYZ](https://www.sttmedia.com/colormodel-xyz) color space. The conversion logic is ported from [CSS Color Module Level 4 Specification](https://www.w3.org/TR/css-color-4/#color-conversion-code). + +```js +import { colord, extend } from "colord"; +import xyzPlugin from "colord/plugins/xyz"; + +extend([xyzPlugin]); + +colord("#ffffff").toXyz(); // { x: 95.047, y: 100, z: 108.883, a: 1 } +``` + +
+ +### Color manipulation + +
+ .alpha(value) + +Changes the alpha channel value and returns a new `Colord` instance. + +```js +colord("rgb(0, 0, 0)").alpha(0.5).toRgbString(); // "rgba(0, 0, 0, 0.5)" +``` + +
+ +
+ .invert() + +Creates a new `Colord` instance containing an inverted (opposite) version of the color. + +```js +colord("#ffffff").invert().toHex(); // "#000000" +colord("#aabbcc").invert().toHex(); // "#554433" +``` + +
+ +
+ .saturate(amount = 0.1) + +Increases the [HSL saturation](https://en.wikipedia.org/wiki/HSL_and_HSV) of a color by the given amount. + +```js +colord("#bf4040").saturate(0.25).toHex(); // "#df2020" +colord("hsl(0, 50%, 50%)").saturate(0.5).toHslString(); // "hsl(0, 100%, 50%)" +``` + +
+ +
+ .desaturate(amount = 0.1) + +Decreases the [HSL saturation](https://en.wikipedia.org/wiki/HSL_and_HSV) of a color by the given amount. + +```js +colord("#df2020").saturate(0.25).toHex(); // "#bf4040" +colord("hsl(0, 100%, 50%)").saturate(0.5).toHslString(); // "hsl(0, 50%, 50%)" +``` + +
+ +
+ .grayscale() + +Makes a gray color with the same lightness as a source color. Same as calling `desaturate(1)`. + +```js +colord("#bf4040").grayscale().toHex(); // "#808080" +colord("hsl(0, 100%, 50%)").grayscale().toHslString(); // "hsl(0, 0%, 50%)" +``` + +
+ +
+ .lighten(amount = 0.1) + +Increases the [HSL lightness](https://en.wikipedia.org/wiki/HSL_and_HSV) of a color by the given amount. + +```js +colord("#000000").lighten(0.5).toHex(); // "#808080" +colord("#223344").lighten(0.3).toHex(); // "#5580aa" +colord("hsl(0, 50%, 50%)").lighten(0.5).toHslString(); // "hsl(0, 50%, 100%)" +``` + +
+ +
+ .darken(amount = 0.1) + +Decreases the [HSL lightness](https://en.wikipedia.org/wiki/HSL_and_HSV) of a color by the given amount. + +```js +colord("#ffffff").darken(0.5).toHex(); // "#808080" +colord("#5580aa").darken(0.3).toHex(); // "#223344" +colord("hsl(0, 50%, 100%)").lighten(0.5).toHslString(); // "hsl(0, 50%, 50%)" +``` + +
+ +
+ .hue(value) + +Changes the hue value and returns a new `Colord` instance. + +```js +colord("hsl(90, 50%, 50%)").hue(180).toHslString(); // "hsl(180, 50%, 50%)" +colord("hsl(90, 50%, 50%)").hue(370).toHslString(); // "hsl(10, 50%, 50%)" +``` + +
+ +
+ .rotate(amount = 15) + +Increases the [HSL](https://en.wikipedia.org/wiki/HSL_and_HSV) hue value of a color by the given amount. + +```js +colord("hsl(90, 50%, 50%)").rotate(90).toHslString(); // "hsl(180, 50%, 50%)" +colord("hsl(90, 50%, 50%)").rotate(-180).toHslString(); // "hsl(270, 50%, 50%)" +``` + +
+ +
+ .mix(color2, ratio = 0.5) (mix plugin) + +Produces a mixture of two colors and returns the result of mixing them (new Colord instance). + +In contrast to other libraries that perform RGB values mixing, Colord mixes colors through [LAB color space](https://en.wikipedia.org/wiki/CIELAB_color_space). This approach produces better results and doesn't have the drawbacks the legacy way has. + +→ [Online demo](https://3cg7o.csb.app/) + +```js +import { colord, extend } from "colord"; +import mixPlugin from "colord/plugins/mix"; + +extend([mixPlugin]); + +colord("#ffffff").mix("#000000").toHex(); // "#777777" +colord("#800080").mix("#dda0dd").toHex(); // "#af5cae" +colord("#cd853f").mix("#eee8aa", 0.6).toHex(); // "#e3c07e" +colord("#008080").mix("#808000", 0.35).toHex(); // "#50805d" +``` + +
+ +
+ .tints(count = 5) (mix plugin) + +Provides functionality to generate [tints](https://en.wikipedia.org/wiki/Tints_and_shades) of a color. Returns an array of `Colord` instances, including the original color. + +```js +import { colord, extend } from "colord"; +import mixPlugin from "colord/plugins/mix"; + +extend([mixPlugin]); + +const color = colord("#ff0000"); +color.tints(3).map((c) => c.toHex()); // ["#ff0000", "#ff9f80", "#ffffff"]; +``` + +
+ +
+ .shades(count = 5) (mix plugin) + +Provides functionality to generate [shades](https://en.wikipedia.org/wiki/Tints_and_shades) of a color. Returns an array of `Colord` instances, including the original color. + +```js +import { colord, extend } from "colord"; +import mixPlugin from "colord/plugins/mix"; + +extend([mixPlugin]); + +const color = colord("#ff0000"); +color.shades(3).map((c) => c.toHex()); // ["#ff0000", "#7a1b0b", "#000000"]; +``` + +
+ +
+ .tones(count = 5) (mix plugin) + +Provides functionality to generate [tones](https://en.wikipedia.org/wiki/Tints_and_shades) of a color. Returns an array of `Colord` instances, including the original color. + +```js +import { colord, extend } from "colord"; +import mixPlugin from "colord/plugins/mix"; + +extend([mixPlugin]); + +const color = colord("#ff0000"); +color.tones(3).map((c) => c.toHex()); // ["#ff0000", "#c86147", "#808080"]; +``` + +
+ +
+ .harmonies(type = "complementary") (harmonies plugin) + +Provides functionality to generate [harmony colors](). Returns an array of `Colord` instances. + +```js +import { colord, extend } from "colord"; +import harmoniesPlugin from "colord/plugins/harmonies"; + +extend([harmoniesPlugin]); + +const color = colord("#ff0000"); +color.harmonies("analogous").map((c) => c.toHex()); // ["#ff0080", "#ff0000", "#ff8000"] +color.harmonies("complementary").map((c) => c.toHex()); // ["#ff0000", "#00ffff"] +color.harmonies("double-split-complementary").map((c) => c.toHex()); // ["#ff0080", "#ff0000", "#ff8000", "#00ff80", "#0080ff"] +color.harmonies("rectangle").map((c) => c.toHex()); // ["#ff0000", "#ffff00", "#00ffff", "#0000ff"] +color.harmonies("split-complementary").map((c) => c.toHex()); // ["#ff0000", "#00ff80", "#0080ff"] +color.harmonies("tetradic").map((c) => c.toHex()); // ["#ff0000", "#80ff00", "#00ffff", "#8000ff"] +color.harmonies("triadic").map((c) => c.toHex()); // ["#ff0000", "#00ff00", "#0000ff"] +``` + +
+ +### Color analysis + +
+ .isValid() + +Returns a boolean indicating whether or not an input has been parsed successfully. +Note: If parsing is unsuccessful, Colord defaults to black (does not throws an error). + +```js +colord("#ffffff").isValid(); // true +colord("#wwuutt").isValid(); // false +colord("abracadabra").isValid(); // false +colord({ r: 0, g: 0, b: 0 }).isValid(); // true +colord({ r: 0, g: 0, v: 0 }).isValid(); // false +``` + +
+ +
+ .isEqual(color2) + +Determines whether two values are the same color. + +```js +colord("#000000").isEqual("rgb(0, 0, 0)"); // true +colord("#000000").isEqual("rgb(255, 255, 255)"); // false +``` + +
+ +
+ .alpha() + +```js +colord("#ffffff").alpha(); // 1 +colord("rgba(50, 100, 150, 0.5)").alpha(); // 0.5 +``` + +
+ +
+ .hue() + +```js +colord("hsl(90, 50%, 50%)").hue(); // 90 +colord("hsl(-10, 50%, 50%)").hue(); // 350 +``` + +
+ +
+ .brightness() + +Returns the brightness of a color (from 0 to 1). The calculation logic is modified from [Web Content Accessibility Guidelines](https://www.w3.org/TR/AERT/#color-contrast). + +```js +colord("#000000").brightness(); // 0 +colord("#808080").brightness(); // 0.5 +colord("#ffffff").brightness(); // 1 +``` + +
+ +
+ .isLight() + +Same as calling `brightness() >= 0.5`. + +```js +colord("#111111").isLight(); // false +colord("#aabbcc").isLight(); // true +colord("#ffffff").isLight(); // true +``` + +
+ +
+ .isDark() + +Same as calling `brightness() < 0.5`. + +```js +colord("#111111").isDark(); // true +colord("#aabbcc").isDark(); // false +colord("#ffffff").isDark(); // false +``` + +
+ +
+ .luminance() (a11y plugin) + +Returns the relative luminance of a color, normalized to 0 for darkest black and 1 for lightest white as defined by [WCAG 2.0](https://www.w3.org/TR/WCAG20/#relativeluminancedef). + +```js +colord("#000000").luminance(); // 0 +colord("#808080").luminance(); // 0.22 +colord("#ccddee").luminance(); // 0.71 +colord("#ffffff").luminance(); // 1 +``` + +
+ +
+ .contrast(color2 = "#FFF") (a11y plugin) + +Calculates a contrast ratio for a color pair. This luminance difference is expressed as a ratio ranging from 1 (e.g. white on white) to 21 (e.g., black on a white). [WCAG Accessibility Level AA requires](https://webaim.org/articles/contrast/) a ratio of at least 4.5 for normal text and 3 for large text. + +```js +colord("#000000").contrast(); // 21 (black on white) +colord("#ffffff").contrast("#000000"); // 21 (white on black) +colord("#777777").contrast(); // 4.47 (gray on white) +colord("#ff0000").contrast(); // 3.99 (red on white) +colord("#0000ff").contrast("#ff000"); // 2.14 (blue on red) +``` + +
+ +
+ .isReadable(color2 = "#FFF", options?) (a11y plugin) + +Checks that a background and text color pair is readable according to [WCAG 2.0 Contrast and Color Requirements](https://webaim.org/articles/contrast/). + +```js +colord("#000000").isReadable(); // true (normal black text on white bg conforms to WCAG AA) +colord("#777777").isReadable(); // false (normal gray text on white bg conforms to WCAG AA) +colord("#ffffff").isReadable("#000000"); // true (normal white text on black bg conforms to WCAG AA) +colord("#e60000").isReadable("#ffff47"); // true (normal red text on yellow bg conforms to WCAG AA) +colord("#e60000").isReadable("#ffff47", { level: "AAA" }); // false (normal red text on yellow bg does not conform to WCAG AAA) +colord("#e60000").isReadable("#ffff47", { level: "AAA", size: "large" }); // true (large red text on yellow bg conforms to WCAG AAA) +``` + +
+ +
+ .delta(color2 = "#FFF") (lab plugin) + +Calculates the perceived color difference between two colors. +The difference calculated according to [Delta E2000](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000). +The return value is `0` if the colors are equal, `1` if they are entirely different. + +```js +colord("#3296fa").delta("#197dc8"); // 0.099 +colord("#faf0c8").delta("#ffffff"); // 0.148 +colord("#afafaf").delta("#b4b4b4"); // 0.014 +colord("#000000").delta("#ffffff"); // 1 +``` + +
+ +### Color utilities + +
+ random() + +Returns a new Colord instance with a random color value inside. + +```js +import { random } from "colord"; + +random().toHex(); // "#01c8ec" +random().alpha(0.5).toRgb(); // { r: 13, g: 237, b: 162, a: 0.5 } +``` + +
+ +
+ .minify(options?) + +Converts a color to its shortest string representation. + +```js +import { colord, extend } from "colord"; +import minifyPlugin from "colord/plugins/minify"; + +extend([minifyPlugin]); + +colord("black").minify(); // "#000" +colord("#112233").minify(); // "#123" +colord("darkgray").minify(); // "#a9a9a9" +colord("rgba(170,170,170,0.4)").minify(); // "hsla(0,0%,67%,.4)" +colord("rgba(170,170,170,0.4)").minify({ alphaHex: true }); // "#aaa6" +``` + +| Option | Default | Description | +| ------------- | ------- | ------------------------------------------------------------ | +| `hex` | `true` | Enable `#rrggbb` and `#rgb` notations | +| `alphaHex` | `false` | Enable `#rrggbbaa` and `#rgba` notations | +| `rgb` | `true` | Enable `rgb()` and `rgba()` functional notations | +| `hsl` | `true` | Enable `hsl()` and `hsla()` functional notations | +| `name` | `false` | Enable CSS color keywords. Requires `names` plugin installed | +| `transparent` | `false` | Enable `"transparent"` color keyword | + +
+ +
---
+ +## Plugins + +**Colord** has a built-in plugin system that allows new features and functionality to be easily added. + +
+ a11y (Accessibility) 0.38 KB + +Adds accessibility and color contrast utilities working according to [Web Content Accessibility Guidelines 2.0](https://www.w3.org/TR/WCAG20/). + +```js +import { colord, extend } from "colord"; +import a11yPlugin from "colord/plugins/a11y"; + +extend([a11yPlugin]); + +colord("#000000").luminance(); // 0 +colord("#ccddee").luminance(); // 0.71 +colord("#ffffff").luminance(); // 1 + +colord("#000000").contrast(); // 21 (black on white) +colord("#ffffff").contrast("#000000"); // 21 (white on black) +colord("#0000ff").contrast("#ff000"); // 2.14 (blue on red) + +colord("#000000").isReadable(); // true (black on white) +colord("#ffffff").isReadable("#000000"); // true (white on black) +colord("#777777").isReadable(); // false (gray on white) +colord("#e60000").isReadable("#ffff47"); // true (normal red text on yellow bg conforms to WCAG AA) +colord("#e60000").isReadable("#ffff47", { level: "AAA" }); // false (normal red text on yellow bg does not conform to WCAG AAA) +colord("#e60000").isReadable("#ffff47", { level: "AAA", size: "large" }); // true (large red text on yellow bg conforms to WCAG AAA) +``` + +
+ +
+ cmyk (CMYK color space) 0.6 KB + +Adds support of [CMYK](https://www.sttmedia.com/colormodel-cmyk) color model. + +```js +import { colord, extend } from "colord"; +import cmykPlugin from "colord/plugins/cmyk"; + +extend([cmykPlugin]); + +colord("#ffffff").toCmyk(); // { c: 0, m: 0, y: 0, k: 0, a: 1 } +colord("#999966").toCmykString(); // "device-cmyk(0% 0% 33% 40%)" +colord({ c: 0, m: 0, y: 0, k: 100, a: 1 }).toHex(); // "#000000" +colord("device-cmyk(0% 61% 72% 0% / 50%)").toHex(); // "#ff634780" +``` + +
+ +
+ harmonies (Color harmonies) 0.15 KB + +Provides functionality to generate [harmony colors](). + +```js +import { colord, extend } from "colord"; +import harmonies from "colord/plugins/harmonies"; + +extend([harmonies]); + +const color = colord("#ff0000"); +color.harmonies("analogous").map((c) => c.toHex()); // ["#ff0080", "#ff0000", "#ff8000"] +color.harmonies("complementary").map((c) => c.toHex()); // ["#ff0000", "#00ffff"] +color.harmonies("double-split-complementary").map((c) => c.toHex()); // ["#ff0080", "#ff0000", "#ff8000", "#00ff80", "#0080ff"] +color.harmonies("rectangle").map((c) => c.toHex()); // ["#ff0000", "#ffff00", "#00ffff", "#0000ff"] +color.harmonies("split-complementary").map((c) => c.toHex()); // ["#ff0000", "#00ff80", "#0080ff"] +color.harmonies("tetradic").map((c) => c.toHex()); // ["#ff0000", "#80ff00", "#00ffff", "#8000ff"] +color.harmonies("triadic").map((c) => c.toHex()); // ["#ff0000", "#00ff00", "#0000ff"] +``` + +
+ +
+ hwb (HWB color model) 0.8 KB + +Adds support of [Hue-Whiteness-Blackness](https://en.wikipedia.org/wiki/HWB_color_model) color model. + +```js +import { colord, extend } from "colord"; +import hwbPlugin from "colord/plugins/hwb"; + +extend([hwbPlugin]); + +colord("#999966").toHwb(); // { h: 60, w: 40, b: 40, a: 1 } +colord("#003366").toHwbString(); // "hwb(210 0% 60%)" + +colord({ h: 60, w: 40, b: 40 }).toHex(); // "#999966" +colord("hwb(210 0% 60% / 50%)").toHex(); // "#00336680" +``` + +
+ +
+ lab (CIE LAB color space) 1.4 KB + +Adds support of [CIE LAB](https://en.wikipedia.org/wiki/CIELAB_color_space) color model. The conversion logic is ported from [CSS Color Module Level 4 Specification](https://www.w3.org/TR/css-color-4/#color-conversion-code). + +Also plugin provides `.delta` method for [perceived color difference calculations](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000). + +```js +import { colord, extend } from "colord"; +import labPlugin from "colord/plugins/lab"; + +extend([labPlugin]); + +colord({ l: 53.24, a: 80.09, b: 67.2 }).toHex(); // "#ff0000" +colord("#ffffff").toLab(); // { l: 100, a: 0, b: 0, alpha: 1 } + +colord("#afafaf").delta("#b4b4b4"); // 0.014 +colord("#000000").delta("#ffffff"); // 1 +``` + +
+ +
+ lch (CIE LCH color space) 1.3 KB + +Adds support of [CIE LCH](https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/) color space. The conversion logic is ported from [CSS Color Module Level 4 Specification](https://www.w3.org/TR/css-color-4/#color-conversion-code). + +```js +import { colord, extend } from "colord"; +import lchPlugin from "colord/plugins/lch"; + +extend([lchPlugin]); + +colord({ l: 100, c: 0, h: 0 }).toHex(); // "#ffffff" +colord("lch(48.25% 30.07 196.38)").toHex(); // "#008080" + +colord("#646464").toLch(); // { l: 42.37, c: 0, h: 0, a: 1 } +colord("#646464").alpha(0.5).toLchString(); // "lch(42.37% 0 0 / 0.5)" +``` + +
+ +
+ minify (Color string minification) 0.5 KB + +A plugin adding color string minification utilities. + +```js +import { colord, extend } from "colord"; +import minifyPlugin from "colord/plugins/minify"; + +extend([minifyPlugin]); + +colord("black").minify(); // "#000" +colord("#112233").minify(); // "#123" +colord("darkgray").minify(); // "#a9a9a9" +colord("rgba(170,170,170,0.4)").minify(); // "hsla(0,0%,67%,.4)" +colord("rgba(170,170,170,0.4)").minify({ alphaHex: true }); // "#aaa6" +``` + +
+ +
+ mix (Color mixing) 0.96 KB + +A plugin adding color mixing utilities. + +In contrast to other libraries that perform RGB values mixing, Colord mixes colors through [LAB color space](https://en.wikipedia.org/wiki/CIELAB_color_space). This approach produces better results and doesn't have the drawbacks the legacy way has. + +→ [Online demo](https://3cg7o.csb.app/) + +```js +import { colord, extend } from "colord"; +import mixPlugin from "colord/plugins/mix"; + +extend([mixPlugin]); + +colord("#ffffff").mix("#000000").toHex(); // "#777777" +colord("#800080").mix("#dda0dd").toHex(); // "#af5cae" +colord("#cd853f").mix("#eee8aa", 0.6).toHex(); // "#e3c07e" +colord("#008080").mix("#808000", 0.35).toHex(); // "#50805d" +``` + +Also, the plugin provides special mixtures such as [tints, shades, and tones](https://en.wikipedia.org/wiki/Tints_and_shades): + +
+tints, shades, and tones mixtures +
+ +```js +const color = colord("#ff0000"); +color.tints(3).map((c) => c.toHex()); // ["#ff0000", "#ff9f80", "#ffffff"]; +color.shades(3).map((c) => c.toHex()); // ["#ff0000", "#7a1b0b", "#000000"]; +color.tones(3).map((c) => c.toHex()); // ["#ff0000", "#c86147", "#808080"]; +``` + +
+ +
+ names (CSS color keywords) 1.45 KB + +Provides options to convert a color into a [CSS color keyword](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value#color_keywords) and vice versa. + +```js +import { colord, extend } from "colord"; +import namesPlugin from "colord/plugins/names"; + +extend([namesPlugin]); + +colord("tomato").toHex(); // "#ff6347" +colord("#00ffff").toName(); // "cyan" +colord("rgba(0, 0, 0, 0)").toName(); // "transparent" +colord("#fe0000").toName(); // undefined (the color is not specified in CSS specs) +colord("#fe0000").toName({ closest: true }); // "red" (closest color) +``` + +
+ +
+ xyz (CIE XYZ color space) 0.7 KB + +Adds support of [CIE XYZ](https://www.sttmedia.com/colormodel-xyz) color model. The conversion logic is ported from [CSS Color Module Level 4 Specification](https://www.w3.org/TR/css-color-4/#color-conversion-code). + +```js +import { colord, extend } from "colord"; +import xyzPlugin from "colord/plugins/xyz"; + +extend([xyzPlugin]); + +colord("#ffffff").toXyz(); // { x: 95.047, y: 100, z: 108.883, a: 1 } +colord({ x: 0, y: 0, z: 0 }).toHex(); // "#000000" +``` + +
+ +
---
+ +## Types + +**Colord** is written in strict TypeScript and ships with types in the library itself — no need for any other install. We provide everything you need in one tiny package. + +While not only typing its own functions and variables, **Colord** can also help you type yours. Depending on the color space you are using, you can also import and use the type that is associated with it. + +```ts +import { RgbColor, RgbaColor, HslColor, HslaColor, HsvColor, HsvaColor } from "colord"; + +const foo: HslColor = { h: 0, s: 0, l: 0 }; +const bar: RgbColor = { r: 0, g: 0, v: 0 }; // ERROR +``` + +
---
+ +## Projects using Colord + +- [cssnano](https://github.com/cssnano/cssnano) — the most popular CSS minification tool +- [Resume.io](https://resume.io/) — online resume builder with over 12,000,000 users worldwide +- [Leva](https://github.com/pmndrs/leva) — open source extensible GUI panel made for React +- [Qui Max](https://github.com/Qvant-lab/qui-max) — Vue.js design system and component library +- and [thousands more](https://github.com/omgovich/colord/network/dependents)... + +
---
+ +## Roadmap + +- [x] Parse and convert Hex, RGB(A), HSL(A), HSV(A) +- [x] Saturate, desaturate, grayscale +- [x] Trim an input value +- [x] Clamp input numbers to resolve edge cases (e.g. `rgb(256, -1, 999, 2)`) +- [x] `brightness`, `isDark`, `isLight` +- [x] Set and get `alpha` +- [x] Plugin API +- [x] 4 and 8 digit Hex +- [x] `lighten`, `darken` +- [x] `invert` +- [x] CSS color names (via plugin) +- [x] A11y and contrast utils (via plugin) +- [x] XYZ color space (via plugin) +- [x] [HWB](https://drafts.csswg.org/css-color/#the-hwb-notation) color space (via plugin) +- [x] [LAB](https://www.w3.org/TR/css-color-4/#resolving-lab-lch-values) color space (via plugin) +- [x] [LCH](https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/) color space (via plugin) +- [x] Mix colors (via plugin) +- [x] CMYK color space (via plugin) diff --git a/node_modules/colord/colord.d.ts b/node_modules/colord/colord.d.ts new file mode 100644 index 0000000000..bc96584443 --- /dev/null +++ b/node_modules/colord/colord.d.ts @@ -0,0 +1,103 @@ +import { AnyColor, RgbaColor, HslaColor, HsvaColor } from "./types"; +export declare class Colord { + private readonly parsed; + readonly rgba: RgbaColor; + constructor(input: AnyColor); + /** + * Returns a boolean indicating whether or not an input has been parsed successfully. + * Note: If parsing is unsuccessful, Colord defaults to black (does not throws an error). + */ + isValid(): boolean; + /** + * Returns the brightness of a color (from 0 to 1). + * The calculation logic is modified from WCAG. + * https://www.w3.org/TR/AERT/#color-contrast + */ + brightness(): number; + /** + * Same as calling `brightness() < 0.5`. + */ + isDark(): boolean; + /** + * Same as calling `brightness() >= 0.5`. + * */ + isLight(): boolean; + /** + * Returns the hexadecimal representation of a color. + * When the alpha channel value of the color is less than 1, + * it outputs #rrggbbaa format instead of #rrggbb. + */ + toHex(): string; + /** + * Converts a color to RGB color space and returns an object. + * Always includes an alpha value from 0 to 1. + */ + toRgb(): RgbaColor; + /** + * Converts a color to RGB color space and returns a string representation. + * Outputs an alpha value only if it is less than 1. + */ + toRgbString(): string; + /** + * Converts a color to HSL color space and returns an object. + * Always includes an alpha value from 0 to 1. + */ + toHsl(): HslaColor; + /** + * Converts a color to HSL color space and returns a string representation. + * Always includes an alpha value from 0 to 1. + */ + toHslString(): string; + /** + * Converts a color to HSV color space and returns an object. + * Always includes an alpha value from 0 to 1. + */ + toHsv(): HsvaColor; + /** + * Creates a new instance containing an inverted (opposite) version of the color. + */ + invert(): Colord; + /** + * Increases the HSL saturation of a color by the given amount. + */ + saturate(amount?: number): Colord; + /** + * Decreases the HSL saturation of a color by the given amount. + */ + desaturate(amount?: number): Colord; + /** + * Makes a gray color with the same lightness as a source color. + */ + grayscale(): Colord; + /** + * Increases the HSL lightness of a color by the given amount. + */ + lighten(amount?: number): Colord; + /** + * Increases the HSL lightness of a color by the given amount. + */ + darken(amount?: number): Colord; + /** + * Changes the HSL hue of a color by the given amount. + */ + rotate(amount?: number): Colord; + /** + * Allows to get or change an alpha channel value. + */ + alpha(): number; + alpha(value: number): Colord; + /** + * Allows to get or change a hue value. + */ + hue(): number; + hue(value: number): Colord; + /** + * Determines whether two values are the same color. + */ + isEqual(color: AnyColor | Colord): boolean; +} +/** + * Parses the given input color and creates a new `Colord` instance. + * See accepted input formats: https://github.com/omgovich/colord#color-parsing + */ +export declare const colord: (input: AnyColor | Colord) => Colord; diff --git a/node_modules/colord/constants.d.ts b/node_modules/colord/constants.d.ts new file mode 100644 index 0000000000..d4b42af80c --- /dev/null +++ b/node_modules/colord/constants.d.ts @@ -0,0 +1,10 @@ +/** + * We used to work with 2 digits after the decimal point, but it wasn't accurate enough, + * so the library produced colors that were perceived differently. + */ +export declare const ALPHA_PRECISION = 3; +/** + * Valid CSS units. + * https://developer.mozilla.org/en-US/docs/Web/CSS/angle + */ +export declare const ANGLE_UNITS: Record; diff --git a/node_modules/colord/extend.d.ts b/node_modules/colord/extend.d.ts new file mode 100644 index 0000000000..0ce9a7c438 --- /dev/null +++ b/node_modules/colord/extend.d.ts @@ -0,0 +1,4 @@ +import { Colord } from "./colord"; +import { Parsers } from "./types"; +export declare type Plugin = (ColordClass: typeof Colord, parsers: Parsers) => void; +export declare const extend: (plugins: Plugin[]) => void; diff --git a/node_modules/colord/helpers.d.ts b/node_modules/colord/helpers.d.ts new file mode 100644 index 0000000000..fd88be1be8 --- /dev/null +++ b/node_modules/colord/helpers.d.ts @@ -0,0 +1,20 @@ +export declare const isPresent: (value: unknown) => boolean; +export declare const round: (number: number, digits?: number, base?: number) => number; +export declare const floor: (number: number, digits?: number, base?: number) => number; +/** + * Clamps a value between an upper and lower bound. + * We use ternary operators because it makes the minified code + * is 2 times shorter then `Math.min(Math.max(a,b),c)` + * NaN is clamped to the lower bound + */ +export declare const clamp: (number: number, min?: number, max?: number) => number; +/** + * Processes and clamps a degree (angle) value properly. + * Any `NaN` or `Infinity` will be converted to `0`. + * Examples: -1 => 359, 361 => 1 + */ +export declare const clampHue: (degrees: number) => number; +/** + * Converts a hue value to degrees from 0 to 360 inclusive. + */ +export declare const parseHue: (value: string, unit?: string) => number; diff --git a/node_modules/colord/index.d.ts b/node_modules/colord/index.d.ts new file mode 100644 index 0000000000..c4e61c1bed --- /dev/null +++ b/node_modules/colord/index.d.ts @@ -0,0 +1,5 @@ +export { colord, Colord } from "./colord"; +export { extend, Plugin } from "./extend"; +export { getFormat } from "./parse"; +export { random } from "./random"; +export { HslColor, HslaColor, HsvColor, HsvaColor, HwbColor, HwbaColor, LabColor, LabaColor, LchColor, LchaColor, RgbColor, RgbaColor, XyzColor, XyzaColor, AnyColor, } from "./types"; diff --git a/node_modules/colord/index.js b/node_modules/colord/index.js new file mode 100644 index 0000000000..f7a26ef8bc --- /dev/null +++ b/node_modules/colord/index.js @@ -0,0 +1 @@ +Object.defineProperty(exports,"__esModule",{value:!0});var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},o=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},a=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},s=/^#([0-9a-f]{3,8})$/i,i=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,o=Math.max(t,n,e),a=o-Math.min(t,n,e),s=a?o===t?(n-e)/a:o===n?2+(e-t)/a:4+(t-n)/a:0;return{h:60*(s<0?s+6:s),s:o?a/o*100:0,v:o/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var o=Math.floor(t),a=e*(1-n),s=e*(1-(t-o)*n),i=e*(1-(1-t+o)*n),h=o%6;return{r:255*[e,s,a,a,i,e][h],g:255*[i,e,e,s,a,a][h],b:255*[a,a,i,e,e,s][h],a:u}},d=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},g=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},p=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,c=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=s.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:o({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||c.exec(t);if(!n)return null;var e,u,o=d({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(o)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,a=r.a,s=void 0===a?1:a;return t(n)&&t(e)&&t(u)?o({r:Number(n),g:Number(e),b:Number(u),a:Number(s)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,o=r.a,a=void 0===o?1:o;if(!t(n)||!t(e)||!t(u))return null;var s=d({h:Number(n),s:Number(e),l:Number(u),a:Number(a)});return f(s)},"hsl"],[function(r){var n=r.h,o=r.s,a=r.v,s=r.a,i=void 0===s?1:s;if(!t(n)||!t(o)||!t(a))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(o),v:Number(a),a:Number(i)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n=.5},r.prototype.toHex=function(){return r=a(this.rgba),t=r.r,e=r.g,u=r.b,s=(o=r.a)<1?i(n(255*o)):"","#"+i(t)+i(e)+i(u)+s;var r,t,e,u,o,s},r.prototype.toRgb=function(){return a(this.rgba)},r.prototype.toRgbString=function(){return r=a(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return g(p(this.rgba))},r.prototype.toHslString=function(){return r=g(p(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return j({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),j(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),j(M(this.rgba,-r))},r.prototype.grayscale=function(){return j(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),j(H(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),j(H(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?j({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=p(this.rgba);return"number"==typeof r?j({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===j(r).toHex()},r}(),j=function(r){return r instanceof $?r:new $(r)},w=[];exports.Colord=$,exports.colord=j,exports.extend=function(r){r.forEach(function(r){w.indexOf(r)<0&&(r($,y),w.push(r))})},exports.getFormat=function(r){return x(r)[1]},exports.random=function(){return new $({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})}; diff --git a/node_modules/colord/index.mjs b/node_modules/colord/index.mjs new file mode 100644 index 0000000000..73b6deef28 --- /dev/null +++ b/node_modules/colord/index.mjs @@ -0,0 +1 @@ +var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return{r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return{r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return{h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return{r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return{h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return{h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e},c=function(r){return{h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return{h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return"number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t},r.prototype.hue=function(r){var t=c(this.rgba);return"number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r))})},E=function(){return new j({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};export{j as Colord,w as colord,k as extend,I as getFormat,E as random}; diff --git a/node_modules/colord/package.json b/node_modules/colord/package.json new file mode 100644 index 0000000000..8be0bca638 --- /dev/null +++ b/node_modules/colord/package.json @@ -0,0 +1,199 @@ +{ + "name": "colord", + "version": "2.9.2", + "description": "\ud83d\udc51 A tiny yet powerful tool for high-performance color manipulations and conversions", + "keywords": [ + "color", + "parser", + "convert", + "tiny", + "hex", + "rgb", + "hsl", + "hsv", + "hwb", + "lab", + "lch", + "xyz", + "css", + "color-names", + "a11y", + "cmyk", + "mix", + "minify", + "harmonies" + ], + "repository": "omgovich/colord", + "author": "Vlad Shilov ", + "license": "MIT", + "sideEffects": false, + "main": "./index.js", + "module": "./index.mjs", + "exports": { + ".": { + "import": "./index.mjs", + "require": "./index.js", + "default": "./index.mjs" + }, + "./plugins/a11y": { + "import": "./plugins/a11y.mjs", + "require": "./plugins/a11y.js", + "default": "./plugins/a11y.mjs" + }, + "./plugins/cmyk": { + "import": "./plugins/cmyk.mjs", + "require": "./plugins/cmyk.js", + "default": "./plugins/cmyk.mjs" + }, + "./plugins/harmonies": { + "import": "./plugins/harmonies.mjs", + "require": "./plugins/harmonies.js", + "default": "./plugins/harmonies.mjs" + }, + "./plugins/hwb": { + "import": "./plugins/hwb.mjs", + "require": "./plugins/hwb.js", + "default": "./plugins/hwb.mjs" + }, + "./plugins/lab": { + "import": "./plugins/lab.mjs", + "require": "./plugins/lab.js", + "default": "./plugins/lab.mjs" + }, + "./plugins/lch": { + "import": "./plugins/lch.mjs", + "require": "./plugins/lch.js", + "default": "./plugins/lch.mjs" + }, + "./plugins/minify": { + "import": "./plugins/minify.mjs", + "require": "./plugins/minify.js", + "default": "./plugins/minify.mjs" + }, + "./plugins/mix": { + "import": "./plugins/mix.mjs", + "require": "./plugins/mix.js", + "default": "./plugins/mix.mjs" + }, + "./plugins/names": { + "import": "./plugins/names.mjs", + "require": "./plugins/names.js", + "default": "./plugins/names.mjs" + }, + "./plugins/xyz": { + "import": "./plugins/xyz.mjs", + "require": "./plugins/xyz.js", + "default": "./plugins/xyz.mjs" + }, + "./package.json": "./package.json" + }, + "files": [ + "*.{js,mjs,ts,map}", + "plugins/*.{js,mjs,ts,map}" + ], + "types": "index.d.ts", + "scripts": { + "lint": "eslint src/**/*.ts", + "size": "npm run build && size-limit", + "check-types": "tsc --noEmit true", + "test": "jest tests --coverage", + "benchmark": "tsc --outDir bench --skipLibCheck --esModuleInterop ./tests/benchmark.ts && node ./bench/tests/benchmark.js && rm -rf ./bench", + "build": "rm -rf ./dist/* && rollup --config", + "release": "npm run build && cp *.json dist && cp *.md dist && npm publish dist", + "check-release": "npm run release -- --dry-run" + }, + "dependencies": {}, + "devDependencies": { + "@size-limit/preset-small-lib": "^4.10.1", + "@types/jest": "^26.0.22", + "@typescript-eslint/eslint-plugin": "^4.19.0", + "@typescript-eslint/parser": "^4.19.0", + "ac-colors": "^1.4.2", + "benny": "^3.6.15", + "chroma-js": "^2.1.1", + "color": "^3.1.3", + "eslint": "^7.14.0", + "eslint-config-prettier": "^6.15.0", + "eslint-plugin-prettier": "^3.1.4", + "glob": "^7.1.6", + "jest": "^26.6.3", + "prettier": "^2.2.0", + "rollup": "^2.43.1", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-typescript2": "^0.30.0", + "size-limit": "^4.10.1", + "tinycolor2": "^1.4.2", + "ts-jest": "^26.5.4", + "ts-node": "^9.1.1", + "tslib": "^2.1.0", + "typescript": "^4.2.3" + }, + "jest": { + "verbose": true, + "transform": { + "^.+\\.ts$": "ts-jest" + } + }, + "eslintConfig": { + "plugins": [ + "prettier" + ], + "extends": [ + "eslint:recommended", + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended", + "plugin:prettier/recommended", + "prettier/@typescript-eslint" + ] + }, + "prettier": { + "printWidth": 100 + }, + "size-limit": [ + { + "path": "dist/index.mjs", + "import": "{ colord }", + "limit": "2 KB" + }, + { + "path": "dist/plugins/a11y.mjs", + "limit": "0.5 KB" + }, + { + "path": "dist/plugins/cmyk.mjs", + "limit": "1 KB" + }, + { + "path": "dist/plugins/harmonies.mjs", + "limit": "0.5 KB" + }, + { + "path": "dist/plugins/hwb.mjs", + "limit": "1 KB" + }, + { + "path": "dist/plugins/lab.mjs", + "limit": "1.5 KB" + }, + { + "path": "dist/plugins/lch.mjs", + "limit": "1.5 KB" + }, + { + "path": "dist/plugins/minify.mjs", + "limit": "0.6 KB" + }, + { + "path": "dist/plugins/mix.mjs", + "limit": "1 KB" + }, + { + "path": "dist/plugins/names.mjs", + "limit": "1.5 KB" + }, + { + "path": "dist/plugins/xyz.mjs", + "limit": "1 KB" + } + ] +} diff --git a/node_modules/colord/parse.d.ts b/node_modules/colord/parse.d.ts new file mode 100644 index 0000000000..41e8a4597b --- /dev/null +++ b/node_modules/colord/parse.d.ts @@ -0,0 +1,8 @@ +import { Parsers, ParseResult, Input, Format } from "./types"; +export declare const parsers: Parsers; +/** Tries to convert an incoming value into RGBA color by going through all color model parsers */ +export declare const parse: (input: Input) => ParseResult | [null, undefined]; +/** + * Returns a color model name for the input passed to the function. + */ +export declare const getFormat: (input: Input) => Format | undefined; diff --git a/node_modules/colord/plugins/a11y.d.ts b/node_modules/colord/plugins/a11y.d.ts new file mode 100644 index 0000000000..6ce2e8c219 --- /dev/null +++ b/node_modules/colord/plugins/a11y.d.ts @@ -0,0 +1,38 @@ +import { AnyColor } from "../types"; +import { Plugin } from "../extend"; +interface ReadabilityOptions { + level?: "AA" | "AAA"; + size?: "normal" | "large"; +} +declare module "../colord" { + interface Colord { + /** + * Returns the relative luminance of a color, + * normalized to 0 for darkest black and 1 for lightest white. + * https://www.w3.org/TR/WCAG20/#relativeluminancedef + * https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_Colors_and_Luminance + */ + luminance(): number; + /** + * Calculates a contrast ratio for a color pair. + * This luminance difference is expressed as a ratio ranging + * from 1 (e.g. white on white) to 21 (e.g., black on a white). + * WCAG requires a ratio of at least 4.5 for normal text and 3 for large text. + * https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html + * https://webaim.org/articles/contrast/ + */ + contrast(color2?: AnyColor | Colord): number; + /** + * Checks that a background and text color pair conforms to WCAG 2.0 requirements. + * https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html + */ + isReadable(color2?: AnyColor | Colord, options?: ReadabilityOptions): boolean; + } +} +/** + * A plugin adding accessibility and color contrast utilities. + * Follows Web Content Accessibility Guidelines 2.0. + * https://www.w3.org/TR/WCAG20/ + */ +declare const a11yPlugin: Plugin; +export default a11yPlugin; diff --git a/node_modules/colord/plugins/a11y.js b/node_modules/colord/plugins/a11y.js new file mode 100644 index 0000000000..d59f207f4a --- /dev/null +++ b/node_modules/colord/plugins/a11y.js @@ -0,0 +1 @@ +var o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},t=function(t){return.2126*o(t.r)+.7152*o(t.g)+.0722*o(t.b)};module.exports=function(o){o.prototype.luminance=function(){return o=t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,i,a,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=t(e),d=t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(i=2)&&(i=0),void 0===a&&(a=Math.pow(10,i)),Math.floor(a*n)/a+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(a=(r=t).size)?"normal":a,"AAA"===(i=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===i&&"large"===e?3:4.5);var r,n,i,a,e}}; diff --git a/node_modules/colord/plugins/a11y.mjs b/node_modules/colord/plugins/a11y.mjs new file mode 100644 index 0000000000..eef95c5e27 --- /dev/null +++ b/node_modules/colord/plugins/a11y.mjs @@ -0,0 +1 @@ +var o=function(o){var t=o/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},t=function(t){return.2126*o(t.r)+.7152*o(t.g)+.0722*o(t.b)};export default function(o){o.prototype.luminance=function(){return o=t(this.rgba),void 0===(r=2)&&(r=0),void 0===n&&(n=Math.pow(10,r)),Math.round(n*o)/n+0;var o,r,n},o.prototype.contrast=function(r){void 0===r&&(r="#FFF");var n,a,i,e,v,u,d,c=r instanceof o?r:new o(r);return e=this.rgba,v=c.toRgb(),u=t(e),d=t(v),n=u>d?(u+.05)/(d+.05):(d+.05)/(u+.05),void 0===(a=2)&&(a=0),void 0===i&&(i=Math.pow(10,a)),Math.floor(i*n)/i+0},o.prototype.isReadable=function(o,t){return void 0===o&&(o="#FFF"),void 0===t&&(t={}),this.contrast(o)>=(e=void 0===(i=(r=t).size)?"normal":i,"AAA"===(a=void 0===(n=r.level)?"AA":n)&&"normal"===e?7:"AA"===a&&"large"===e?3:4.5);var r,n,a,i,e}} diff --git a/node_modules/colord/plugins/cmyk.d.ts b/node_modules/colord/plugins/cmyk.d.ts new file mode 100644 index 0000000000..c0c11f42e7 --- /dev/null +++ b/node_modules/colord/plugins/cmyk.d.ts @@ -0,0 +1,24 @@ +import { CmykaColor } from "../types"; +import { Plugin } from "../extend"; +declare module "../colord" { + interface Colord { + /** + * Converts a color to CMYK color space and returns an object. + * https://drafts.csswg.org/css-color/#cmyk-colors + * https://lea.verou.me/2009/03/cmyk-colors-in-css-useful-or-useless/ + */ + toCmyk(): CmykaColor; + /** + * Converts a color to CMYK color space and returns a string. + * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/device-cmyk() + */ + toCmykString(): string; + } +} +/** + * A plugin adding support for CMYK color space. + * https://lea.verou.me/2009/03/cmyk-colors-in-css-useful-or-useless/ + * https://en.wikipedia.org/wiki/CMYK_color_model + */ +declare const cmykPlugin: Plugin; +export default cmykPlugin; diff --git a/node_modules/colord/plugins/cmyk.js b/node_modules/colord/plugins/cmyk.js new file mode 100644 index 0000000000..eb89c7b841 --- /dev/null +++ b/node_modules/colord/plugins/cmyk.js @@ -0,0 +1 @@ +var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t+0},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r>n?r:n},u=function(r){return{c:t(r.c,0,100),m:t(r.m,0,100),y:t(r.y,0,100),k:t(r.k,0,100),a:t(r.a)}},e=function(r){return{c:n(r.c,2),m:n(r.m,2),y:n(r.y,2),k:n(r.k,2),a:n(r.a,3)}};function c(r){return{r:n(255*(1-r.c/100)*(1-r.k/100)),g:n(255*(1-r.m/100)*(1-r.k/100)),b:n(255*(1-r.y/100)*(1-r.k/100)),a:r.a}}function o(r){var t=1-Math.max(r.r/255,r.g/255,r.b/255),u=(1-r.r/255-t)/(1-t),e=(1-r.g/255-t)/(1-t),c=(1-r.b/255-t)/(1-t);return{c:isNaN(u)?0:n(100*u),m:isNaN(e)?0:n(100*e),y:isNaN(c)?0:n(100*c),k:n(100*t),a:r.a}}function i(n){var t=n.c,e=n.m,o=n.y,i=n.k,m=n.a,a=void 0===m?1:m;return r(t)&&r(e)&&r(o)&&r(i)?c(u({c:Number(t),m:Number(e),y:Number(o),k:Number(i),a:Number(a)})):null}var m=/^device-cmyk\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,a=function(r){var n=m.exec(r);return n?c(u({c:Number(n[1])*(n[2]?1:100),m:Number(n[3])*(n[4]?1:100),y:Number(n[5])*(n[6]?1:100),k:Number(n[7])*(n[8]?1:100),a:void 0===n[9]?1:Number(n[9])/(n[10]?100:1)})):null};module.exports=function(r,n){r.prototype.toCmyk=function(){return e(o(this.rgba))},r.prototype.toCmykString=function(){return r=e(o(this.rgba)),n=r.c,t=r.m,u=r.y,c=r.k,(i=r.a)<1?"device-cmyk("+n+"% "+t+"% "+u+"% "+c+"% / "+i+")":"device-cmyk("+n+"% "+t+"% "+u+"% "+c+"%)";var r,n,t,u,c,i},n.object.push([i,"cmyk"]),n.string.push([a,"cmyk"])}; diff --git a/node_modules/colord/plugins/cmyk.mjs b/node_modules/colord/plugins/cmyk.mjs new file mode 100644 index 0000000000..febf50e213 --- /dev/null +++ b/node_modules/colord/plugins/cmyk.mjs @@ -0,0 +1 @@ +var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t+0},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r>n?r:n},u=function(r){return{c:t(r.c,0,100),m:t(r.m,0,100),y:t(r.y,0,100),k:t(r.k,0,100),a:t(r.a)}},e=function(r){return{c:n(r.c,2),m:n(r.m,2),y:n(r.y,2),k:n(r.k,2),a:n(r.a,3)}};function c(r){return{r:n(255*(1-r.c/100)*(1-r.k/100)),g:n(255*(1-r.m/100)*(1-r.k/100)),b:n(255*(1-r.y/100)*(1-r.k/100)),a:r.a}}function i(r){var t=1-Math.max(r.r/255,r.g/255,r.b/255),u=(1-r.r/255-t)/(1-t),e=(1-r.g/255-t)/(1-t),c=(1-r.b/255-t)/(1-t);return{c:isNaN(u)?0:n(100*u),m:isNaN(e)?0:n(100*e),y:isNaN(c)?0:n(100*c),k:n(100*t),a:r.a}}function o(n){var t=n.c,e=n.m,i=n.y,o=n.k,m=n.a,a=void 0===m?1:m;return r(t)&&r(e)&&r(i)&&r(o)?c(u({c:Number(t),m:Number(e),y:Number(i),k:Number(o),a:Number(a)})):null}var m=/^device-cmyk\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,a=function(r){var n=m.exec(r);return n?c(u({c:Number(n[1])*(n[2]?1:100),m:Number(n[3])*(n[4]?1:100),y:Number(n[5])*(n[6]?1:100),k:Number(n[7])*(n[8]?1:100),a:void 0===n[9]?1:Number(n[9])/(n[10]?100:1)})):null};export default function(r,n){r.prototype.toCmyk=function(){return e(i(this.rgba))},r.prototype.toCmykString=function(){return r=e(i(this.rgba)),n=r.c,t=r.m,u=r.y,c=r.k,(o=r.a)<1?"device-cmyk("+n+"% "+t+"% "+u+"% "+c+"% / "+o+")":"device-cmyk("+n+"% "+t+"% "+u+"% "+c+"%)";var r,n,t,u,c,o},n.object.push([o,"cmyk"]),n.string.push([a,"cmyk"])} diff --git a/node_modules/colord/plugins/harmonies.d.ts b/node_modules/colord/plugins/harmonies.d.ts new file mode 100644 index 0000000000..f9a3f51df2 --- /dev/null +++ b/node_modules/colord/plugins/harmonies.d.ts @@ -0,0 +1,16 @@ +import { Plugin } from "../extend"; +export declare type HarmonyType = "analogous" | "complementary" | "double-split-complementary" | "rectangle" | "split-complementary" | "tetradic" | "triadic"; +declare module "../colord" { + interface Colord { + /** + * Returns an array of harmony colors as `Colord` instances. + */ + harmonies(type?: HarmonyType): Colord[]; + } +} +/** + * A plugin adding functionality to generate harmony colors. + * https://en.wikipedia.org/wiki/Harmony_(color) + */ +declare const harmoniesPlugin: Plugin; +export default harmoniesPlugin; diff --git a/node_modules/colord/plugins/harmonies.js b/node_modules/colord/plugins/harmonies.js new file mode 100644 index 0000000000..4087b16d04 --- /dev/null +++ b/node_modules/colord/plugins/harmonies.js @@ -0,0 +1 @@ +module.exports=function(t){var e={analogous:[-30,0,30],complementary:[0,180],"double-split-complementary":[-30,0,30,150,210],rectangle:[0,60,180,240],tetradic:[0,90,180,270],triadic:[0,120,240],"split-complementary":[0,150,210]};t.prototype.harmonies=function(t){var o=this;return void 0===t&&(t="complementary"),e[t].map(function(t){return o.rotate(t)})}}; diff --git a/node_modules/colord/plugins/harmonies.mjs b/node_modules/colord/plugins/harmonies.mjs new file mode 100644 index 0000000000..c9fe61215d --- /dev/null +++ b/node_modules/colord/plugins/harmonies.mjs @@ -0,0 +1 @@ +export default function(t){var e={analogous:[-30,0,30],complementary:[0,180],"double-split-complementary":[-30,0,30,150,210],rectangle:[0,60,180,240],tetradic:[0,90,180,270],triadic:[0,120,240],"split-complementary":[0,150,210]};t.prototype.harmonies=function(t){var r=this;return void 0===t&&(t="complementary"),e[t].map(function(t){return r.rotate(t)})}} diff --git a/node_modules/colord/plugins/hwb.d.ts b/node_modules/colord/plugins/hwb.d.ts new file mode 100644 index 0000000000..da14e983d1 --- /dev/null +++ b/node_modules/colord/plugins/hwb.d.ts @@ -0,0 +1,23 @@ +import { HwbaColor } from "../types"; +import { Plugin } from "../extend"; +declare module "../colord" { + interface Colord { + /** + * Converts a color to HWB (Hue-Whiteness-Blackness) color space and returns an object. + * https://en.wikipedia.org/wiki/HWB_color_model + */ + toHwb(): HwbaColor; + /** + * Converts a color to HWB (Hue-Whiteness-Blackness) color space and returns a string. + * https://www.w3.org/TR/css-color-4/#the-hwb-notation + */ + toHwbString(): string; + } +} +/** + * A plugin adding support for HWB (Hue-Whiteness-Blackness) color model. + * https://en.wikipedia.org/wiki/HWB_color_model + * https://www.w3.org/TR/css-color-4/#the-hwb-notation + */ +declare const hwbPlugin: Plugin; +export default hwbPlugin; diff --git a/node_modules/colord/plugins/hwb.js b/node_modules/colord/plugins/hwb.js new file mode 100644 index 0000000000..90d65293c0 --- /dev/null +++ b/node_modules/colord/plugins/hwb.js @@ -0,0 +1 @@ +var r={grad:.9,turn:360,rad:360/(2*Math.PI)},n=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t+0},u=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r>n?r:n},a=function(r){return{h:(n=r.h,(n=isFinite(n)?n%360:0)>0?n:n+360),w:u(r.w,0,100),b:u(r.b,0,100),a:u(r.a)};var n},e=function(r){return{h:t(r.h),w:t(r.w),b:t(r.b),a:t(r.a,3)}},o=function(r){return{h:function(r){var n=r.r,t=r.g,u=r.b,a=r.a,e=Math.max(n,t,u),o=e-Math.min(n,t,u),b=o?e===n?(t-u)/o:e===t?2+(u-n)/o:4+(n-t)/o:0;return{h:60*(b<0?b+6:b),s:e?o/e*100:0,v:e/255*100,a:a}}(r).h,w:Math.min(r.r,r.g,r.b)/255*100,b:100-Math.max(r.r,r.g,r.b)/255*100,a:r.a}},b=function(r){return function(r){var n=r.h,t=r.s,u=r.v,a=r.a;n=n/360*6,t/=100,u/=100;var e=Math.floor(n),o=u*(1-t),b=u*(1-(n-e)*t),i=u*(1-(1-n+e)*t),h=e%6;return{r:255*[u,b,o,o,i,u][h],g:255*[i,u,u,b,o,o][h],b:255*[o,o,i,u,u,b][h],a:a}}({h:r.h,s:100===r.b?0:100-r.w/(100-r.b)*100,v:100-r.b,a:r.a})},i=function(r){var t=r.h,u=r.w,e=r.b,o=r.a,i=void 0===o?1:o;if(!n(t)||!n(u)||!n(e))return null;var h=a({h:Number(t),w:Number(u),b:Number(e),a:Number(i)});return b(h)},h=/^hwb\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,d=function(n){var t=h.exec(n);if(!t)return null;var u,e,o=a({h:(u=t[1],e=t[2],void 0===e&&(e="deg"),Number(u)*(r[e]||1)),w:Number(t[3]),b:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return b(o)};module.exports=function(r,n){r.prototype.toHwb=function(){return e(o(this.rgba))},r.prototype.toHwbString=function(){return r=e(o(this.rgba)),n=r.h,t=r.w,u=r.b,(a=r.a)<1?"hwb("+n+" "+t+"% "+u+"% / "+a+")":"hwb("+n+" "+t+"% "+u+"%)";var r,n,t,u,a},n.string.push([d,"hwb"]),n.object.push([i,"hwb"])}; diff --git a/node_modules/colord/plugins/hwb.mjs b/node_modules/colord/plugins/hwb.mjs new file mode 100644 index 0000000000..292bd9f0d5 --- /dev/null +++ b/node_modules/colord/plugins/hwb.mjs @@ -0,0 +1 @@ +var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},u=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},a=function(r){return{h:(t=r.h,(t=isFinite(t)?t%360:0)>0?t:t+360),w:u(r.w,0,100),b:u(r.b,0,100),a:u(r.a)};var t},e=function(r){return{h:n(r.h),w:n(r.w),b:n(r.b),a:n(r.a,3)}},b=function(r){return{h:function(r){var t=r.r,n=r.g,u=r.b,a=r.a,e=Math.max(t,n,u),b=e-Math.min(t,n,u),o=b?e===t?(n-u)/b:e===n?2+(u-t)/b:4+(t-n)/b:0;return{h:60*(o<0?o+6:o),s:e?b/e*100:0,v:e/255*100,a:a}}(r).h,w:Math.min(r.r,r.g,r.b)/255*100,b:100-Math.max(r.r,r.g,r.b)/255*100,a:r.a}},o=function(r){return function(r){var t=r.h,n=r.s,u=r.v,a=r.a;t=t/360*6,n/=100,u/=100;var e=Math.floor(t),b=u*(1-n),o=u*(1-(t-e)*n),i=u*(1-(1-t+e)*n),h=e%6;return{r:255*[u,o,b,b,i,u][h],g:255*[i,u,u,o,b,b][h],b:255*[b,b,i,u,u,o][h],a:a}}({h:r.h,s:100===r.b?0:100-r.w/(100-r.b)*100,v:100-r.b,a:r.a})},i=function(r){var n=r.h,u=r.w,e=r.b,b=r.a,i=void 0===b?1:b;if(!t(n)||!t(u)||!t(e))return null;var h=a({h:Number(n),w:Number(u),b:Number(e),a:Number(i)});return o(h)},h=/^hwb\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,d=function(t){var n=h.exec(t);if(!n)return null;var u,e,b=a({h:(u=n[1],e=n[2],void 0===e&&(e="deg"),Number(u)*(r[e]||1)),w:Number(n[3]),b:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return o(b)};export default function(r,t){r.prototype.toHwb=function(){return e(b(this.rgba))},r.prototype.toHwbString=function(){return r=e(b(this.rgba)),t=r.h,n=r.w,u=r.b,(a=r.a)<1?"hwb("+t+" "+n+"% "+u+"% / "+a+")":"hwb("+t+" "+n+"% "+u+"%)";var r,t,n,u,a},t.string.push([d,"hwb"]),t.object.push([i,"hwb"])} diff --git a/node_modules/colord/plugins/lab.d.ts b/node_modules/colord/plugins/lab.d.ts new file mode 100644 index 0000000000..76c1f5ff9b --- /dev/null +++ b/node_modules/colord/plugins/lab.d.ts @@ -0,0 +1,23 @@ +import { LabaColor, AnyColor } from "../types"; +import { Plugin } from "../extend"; +declare module "../colord" { + interface Colord { + /** + * Converts a color to CIELAB color space and returns an object. + * The object always includes `alpha` value [0, 1]. + */ + toLab(): LabaColor; + /** + * Calculates the perceived color difference for two colors according to + * [Delta E2000](https://en.wikipedia.org/wiki/Color_difference#CIEDE2000). + * Returns a value in [0, 1] range. + */ + delta(color?: AnyColor | Colord): number; + } +} +/** + * A plugin adding support for CIELAB color space. + * https://en.wikipedia.org/wiki/CIELAB_color_space + */ +declare const labPlugin: Plugin; +export default labPlugin; diff --git a/node_modules/colord/plugins/lab.js b/node_modules/colord/plugins/lab.js new file mode 100644 index 0000000000..267e6e0b03 --- /dev/null +++ b/node_modules/colord/plugins/lab.js @@ -0,0 +1 @@ +var a=function(a){return"string"==typeof a?a.length>0:"number"==typeof a},t=function(a,t,o){return void 0===t&&(t=0),void 0===o&&(o=Math.pow(10,t)),Math.round(o*a)/o+0},o=function(a,t,o){return void 0===t&&(t=0),void 0===o&&(o=1),a>o?o:a>t?a:t},r=function(a){var t=a/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},h=function(a){return 255*(a>.0031308?1.055*Math.pow(a,1/2.4)-.055:12.92*a)},n=96.422,p=100,M=82.521,u=function(a){var t,r,n={x:.9555766*(t=a).x+-.0230393*t.y+.0631636*t.z,y:-.0282895*t.x+1.0099416*t.y+.0210077*t.z,z:.0122982*t.x+-.020483*t.y+1.3299098*t.z};return r={r:h(.032404542*n.x-.015371385*n.y-.004985314*n.z),g:h(-.00969266*n.x+.018760108*n.y+41556e-8*n.z),b:h(556434e-9*n.x-.002040259*n.y+.010572252*n.z),a:a.a},{r:o(r.r,0,255),g:o(r.g,0,255),b:o(r.b,0,255),a:o(r.a)}},e=function(a){var t=r(a.r),h=r(a.g),u=r(a.b);return function(a){return{x:o(a.x,0,n),y:o(a.y,0,p),z:o(a.z,0,M),a:o(a.a)}}(function(a){return{x:1.0478112*a.x+.0228866*a.y+-.050127*a.z,y:.0295424*a.x+.9904844*a.y+-.0170491*a.z,z:-.0092345*a.x+.0150436*a.y+.7521316*a.z,a:a.a}}({x:100*(.4124564*t+.3575761*h+.1804375*u),y:100*(.2126729*t+.7151522*h+.072175*u),z:100*(.0193339*t+.119192*h+.9503041*u),a:a.a}))},w=216/24389,b=24389/27,i=function(t){var r=t.l,h=t.a,n=t.b,p=t.alpha,M=void 0===p?1:p;if(!a(r)||!a(h)||!a(n))return null;var u=function(a){return{l:o(a.l,0,400),a:a.a,b:a.b,alpha:o(a.alpha)}}({l:Number(r),a:Number(h),b:Number(n),alpha:Number(M)});return l(u)},l=function(a){var t=(a.l+16)/116,o=a.a/500+t,r=t-a.b/200;return u({x:(Math.pow(o,3)>w?Math.pow(o,3):(116*o-16)/b)*n,y:(a.l>8?Math.pow((a.l+16)/116,3):a.l/b)*p,z:(Math.pow(r,3)>w?Math.pow(r,3):(116*r-16)/b)*M,a:a.alpha})};module.exports=function(a,r){a.prototype.toLab=function(){return o=e(this.rgba),h=o.y/p,u=o.z/M,r=(r=o.x/n)>w?Math.cbrt(r):(b*r+16)/116,a={l:116*(h=h>w?Math.cbrt(h):(b*h+16)/116)-16,a:500*(r-h),b:200*(h-(u=u>w?Math.cbrt(u):(b*u+16)/116)),alpha:o.a},{l:t(a.l,2),a:t(a.a,2),b:t(a.b,2),alpha:t(a.alpha,3)};var a,o,r,h,u},a.prototype.delta=function(r){void 0===r&&(r="#FFF");var h=r instanceof a?r:new a(r),n=function(a,t){var o=a.l,r=a.a,h=a.b,n=t.l,p=t.a,M=t.b,u=180/Math.PI,e=Math.PI/180,w=Math.pow(Math.pow(r,2)+Math.pow(h,2),.5),b=Math.pow(Math.pow(p,2)+Math.pow(M,2),.5),i=(o+n)/2,l=Math.pow((w+b)/2,7),c=.5*(1-Math.pow(l/(l+Math.pow(25,7)),.5)),f=r*(1+c),y=p*(1+c),v=Math.pow(Math.pow(f,2)+Math.pow(h,2),.5),x=Math.pow(Math.pow(y,2)+Math.pow(M,2),.5),z=(v+x)/2,s=0===f&&0===h?0:Math.atan2(h,f)*u,d=0===y&&0===M?0:Math.atan2(M,y)*u;s<0&&(s+=360),d<0&&(d+=360);var g=d-s,m=Math.abs(d-s);m>180&&d<=s?g+=360:m>180&&d>s&&(g-=360);var N=s+d;m<=180?N/=2:N=(s+d<360?N+360:N-360)/2;var F=1-.17*Math.cos(e*(N-30))+.24*Math.cos(2*e*N)+.32*Math.cos(e*(3*N+6))-.2*Math.cos(e*(4*N-63)),L=n-o,I=x-v,P=2*Math.sin(e*g/2)*Math.pow(v*x,.5),j=1+.015*Math.pow(i-50,2)/Math.pow(20+Math.pow(i-50,2),.5),k=1+.045*z,q=1+.015*z*F,A=30*Math.exp(-1*Math.pow((N-275)/25,2)),B=-2*Math.pow(l/(l+Math.pow(25,7)),.5)*Math.sin(2*e*A);return Math.pow(Math.pow(L/1/j,2)+Math.pow(I/1/k,2)+Math.pow(P/1/q,2)+B*I*P/(1*k*1*q),.5)}(this.toLab(),h.toLab())/100;return o(t(n,3))},r.object.push([i,"lab"])}; diff --git a/node_modules/colord/plugins/lab.mjs b/node_modules/colord/plugins/lab.mjs new file mode 100644 index 0000000000..a852df368c --- /dev/null +++ b/node_modules/colord/plugins/lab.mjs @@ -0,0 +1 @@ +var a=function(a){return"string"==typeof a?a.length>0:"number"==typeof a},t=function(a,t,o){return void 0===t&&(t=0),void 0===o&&(o=Math.pow(10,t)),Math.round(o*a)/o+0},o=function(a,t,o){return void 0===t&&(t=0),void 0===o&&(o=1),a>o?o:a>t?a:t},r=function(a){var t=a/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},h=function(a){return 255*(a>.0031308?1.055*Math.pow(a,1/2.4)-.055:12.92*a)},n=96.422,p=100,M=82.521,u=function(a){var t,r,n={x:.9555766*(t=a).x+-.0230393*t.y+.0631636*t.z,y:-.0282895*t.x+1.0099416*t.y+.0210077*t.z,z:.0122982*t.x+-.020483*t.y+1.3299098*t.z};return r={r:h(.032404542*n.x-.015371385*n.y-.004985314*n.z),g:h(-.00969266*n.x+.018760108*n.y+41556e-8*n.z),b:h(556434e-9*n.x-.002040259*n.y+.010572252*n.z),a:a.a},{r:o(r.r,0,255),g:o(r.g,0,255),b:o(r.b,0,255),a:o(r.a)}},e=function(a){var t=r(a.r),h=r(a.g),u=r(a.b);return function(a){return{x:o(a.x,0,n),y:o(a.y,0,p),z:o(a.z,0,M),a:o(a.a)}}(function(a){return{x:1.0478112*a.x+.0228866*a.y+-.050127*a.z,y:.0295424*a.x+.9904844*a.y+-.0170491*a.z,z:-.0092345*a.x+.0150436*a.y+.7521316*a.z,a:a.a}}({x:100*(.4124564*t+.3575761*h+.1804375*u),y:100*(.2126729*t+.7151522*h+.072175*u),z:100*(.0193339*t+.119192*h+.9503041*u),a:a.a}))},w=216/24389,b=24389/27,i=function(t){var r=t.l,h=t.a,n=t.b,p=t.alpha,M=void 0===p?1:p;if(!a(r)||!a(h)||!a(n))return null;var u=function(a){return{l:o(a.l,0,400),a:a.a,b:a.b,alpha:o(a.alpha)}}({l:Number(r),a:Number(h),b:Number(n),alpha:Number(M)});return l(u)},l=function(a){var t=(a.l+16)/116,o=a.a/500+t,r=t-a.b/200;return u({x:(Math.pow(o,3)>w?Math.pow(o,3):(116*o-16)/b)*n,y:(a.l>8?Math.pow((a.l+16)/116,3):a.l/b)*p,z:(Math.pow(r,3)>w?Math.pow(r,3):(116*r-16)/b)*M,a:a.alpha})};export default function(a,r){a.prototype.toLab=function(){return o=e(this.rgba),h=o.y/p,u=o.z/M,r=(r=o.x/n)>w?Math.cbrt(r):(b*r+16)/116,a={l:116*(h=h>w?Math.cbrt(h):(b*h+16)/116)-16,a:500*(r-h),b:200*(h-(u=u>w?Math.cbrt(u):(b*u+16)/116)),alpha:o.a},{l:t(a.l,2),a:t(a.a,2),b:t(a.b,2),alpha:t(a.alpha,3)};var a,o,r,h,u},a.prototype.delta=function(r){void 0===r&&(r="#FFF");var h=r instanceof a?r:new a(r),n=function(a,t){var o=a.l,r=a.a,h=a.b,n=t.l,p=t.a,M=t.b,u=180/Math.PI,e=Math.PI/180,w=Math.pow(Math.pow(r,2)+Math.pow(h,2),.5),b=Math.pow(Math.pow(p,2)+Math.pow(M,2),.5),i=(o+n)/2,l=Math.pow((w+b)/2,7),c=.5*(1-Math.pow(l/(l+Math.pow(25,7)),.5)),f=r*(1+c),y=p*(1+c),v=Math.pow(Math.pow(f,2)+Math.pow(h,2),.5),x=Math.pow(Math.pow(y,2)+Math.pow(M,2),.5),z=(v+x)/2,s=0===f&&0===h?0:Math.atan2(h,f)*u,d=0===y&&0===M?0:Math.atan2(M,y)*u;s<0&&(s+=360),d<0&&(d+=360);var g=d-s,m=Math.abs(d-s);m>180&&d<=s?g+=360:m>180&&d>s&&(g-=360);var N=s+d;m<=180?N/=2:N=(s+d<360?N+360:N-360)/2;var F=1-.17*Math.cos(e*(N-30))+.24*Math.cos(2*e*N)+.32*Math.cos(e*(3*N+6))-.2*Math.cos(e*(4*N-63)),L=n-o,I=x-v,P=2*Math.sin(e*g/2)*Math.pow(v*x,.5),j=1+.015*Math.pow(i-50,2)/Math.pow(20+Math.pow(i-50,2),.5),k=1+.045*z,q=1+.015*z*F,A=30*Math.exp(-1*Math.pow((N-275)/25,2)),B=-2*Math.pow(l/(l+Math.pow(25,7)),.5)*Math.sin(2*e*A);return Math.pow(Math.pow(L/1/j,2)+Math.pow(I/1/k,2)+Math.pow(P/1/q,2)+B*I*P/(1*k*1*q),.5)}(this.toLab(),h.toLab())/100;return o(t(n,3))},r.object.push([i,"lab"])} diff --git a/node_modules/colord/plugins/lch.d.ts b/node_modules/colord/plugins/lch.d.ts new file mode 100644 index 0000000000..34dcfcc195 --- /dev/null +++ b/node_modules/colord/plugins/lch.d.ts @@ -0,0 +1,24 @@ +import { LchaColor } from "../types"; +import { Plugin } from "../extend"; +declare module "../colord" { + interface Colord { + /** + * Converts a color to CIELCH (Lightness-Chroma-Hue) color space and returns an object. + * https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/ + * https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_model + */ + toLch(): LchaColor; + /** + * Converts a color to CIELCH (Lightness-Chroma-Hue) color space and returns a string. + * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/lch() + */ + toLchString(): string; + } +} +/** + * A plugin adding support for CIELCH color space. + * https://lea.verou.me/2020/04/lch-colors-in-css-what-why-and-how/ + * https://en.wikipedia.org/wiki/CIELAB_color_space#Cylindrical_model + */ +declare const lchPlugin: Plugin; +export default lchPlugin; diff --git a/node_modules/colord/plugins/lch.js b/node_modules/colord/plugins/lch.js new file mode 100644 index 0000000000..955a596815 --- /dev/null +++ b/node_modules/colord/plugins/lch.js @@ -0,0 +1 @@ +var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},a=function(r,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*r)/a+0},n=function(r,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),r>a?a:r>t?r:t},u=function(r){var t=r/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},h=function(r){return 255*(r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r)},o=96.422,e=100,c=82.521,i=function(r){var t,a,u={x:.9555766*(t=r).x+-.0230393*t.y+.0631636*t.z,y:-.0282895*t.x+1.0099416*t.y+.0210077*t.z,z:.0122982*t.x+-.020483*t.y+1.3299098*t.z};return a={r:h(.032404542*u.x-.015371385*u.y-.004985314*u.z),g:h(-.00969266*u.x+.018760108*u.y+41556e-8*u.z),b:h(556434e-9*u.x-.002040259*u.y+.010572252*u.z),a:r.a},{r:n(a.r,0,255),g:n(a.g,0,255),b:n(a.b,0,255),a:n(a.a)}},l=function(r){var t=u(r.r),a=u(r.g),h=u(r.b);return function(r){return{x:n(r.x,0,o),y:n(r.y,0,e),z:n(r.z,0,c),a:n(r.a)}}(function(r){return{x:1.0478112*r.x+.0228866*r.y+-.050127*r.z,y:.0295424*r.x+.9904844*r.y+-.0170491*r.z,z:-.0092345*r.x+.0150436*r.y+.7521316*r.z,a:r.a}}({x:100*(.4124564*t+.3575761*a+.1804375*h),y:100*(.2126729*t+.7151522*a+.072175*h),z:100*(.0193339*t+.119192*a+.9503041*h),a:r.a}))},b=216/24389,d=24389/27,f=function(r){return{l:n(r.l,0,100),c:r.c,h:(t=r.h,(t=isFinite(t)?t%360:0)>0?t:t+360),a:r.a};var t},p=function(r){return{l:a(r.l,2),c:a(r.c,2),h:a(r.h,2),a:a(r.a,3)}},v=function(r){var a=r.l,n=r.c,u=r.h,h=r.a,o=void 0===h?1:h;if(!t(a)||!t(n)||!t(u))return null;var e=f({l:Number(a),c:Number(n),h:Number(u),a:Number(o)});return M(e)},y=function(r){var t=function(r){var t=l(r),a=t.x/o,n=t.y/e,u=t.z/c;return a=a>b?Math.cbrt(a):(d*a+16)/116,{l:116*(n=n>b?Math.cbrt(n):(d*n+16)/116)-16,a:500*(a-n),b:200*(n-(u=u>b?Math.cbrt(u):(d*u+16)/116)),alpha:t.a}}(r),n=a(t.a,3),u=a(t.b,3),h=Math.atan2(u,n)/Math.PI*180;return{l:t.l,c:Math.sqrt(n*n+u*u),h:h<0?h+360:h,a:t.alpha}},M=function(r){return t={l:r.l,a:r.c*Math.cos(r.h*Math.PI/180),b:r.c*Math.sin(r.h*Math.PI/180),alpha:r.a},n=t.a/500+(a=(t.l+16)/116),u=a-t.b/200,i({x:(Math.pow(n,3)>b?Math.pow(n,3):(116*n-16)/d)*o,y:(t.l>8?Math.pow((t.l+16)/116,3):t.l/d)*e,z:(Math.pow(u,3)>b?Math.pow(u,3):(116*u-16)/d)*c,a:t.alpha});var t,a,n,u},x=/^lch\(\s*([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,s=function(t){var a=x.exec(t);if(!a)return null;var n,u,h=f({l:Number(a[1]),c:Number(a[2]),h:(n=a[3],u=a[4],void 0===u&&(u="deg"),Number(n)*(r[u]||1)),a:void 0===a[5]?1:Number(a[5])/(a[6]?100:1)});return M(h)};module.exports=function(r,t){r.prototype.toLch=function(){return p(y(this.rgba))},r.prototype.toLchString=function(){return r=p(y(this.rgba)),t=r.l,a=r.c,n=r.h,(u=r.a)<1?"lch("+t+"% "+a+" "+n+" / "+u+")":"lch("+t+"% "+a+" "+n+")";var r,t,a,n,u},t.string.push([s,"lch"]),t.object.push([v,"lch"])}; diff --git a/node_modules/colord/plugins/lch.mjs b/node_modules/colord/plugins/lch.mjs new file mode 100644 index 0000000000..cd7624a270 --- /dev/null +++ b/node_modules/colord/plugins/lch.mjs @@ -0,0 +1 @@ +var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},a=function(r,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*r)/a+0},n=function(r,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),r>a?a:r>t?r:t},u=function(r){var t=r/255;return t<.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)},h=function(r){return 255*(r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r)},o=96.422,e=100,c=82.521,i=function(r){var t,a,u={x:.9555766*(t=r).x+-.0230393*t.y+.0631636*t.z,y:-.0282895*t.x+1.0099416*t.y+.0210077*t.z,z:.0122982*t.x+-.020483*t.y+1.3299098*t.z};return a={r:h(.032404542*u.x-.015371385*u.y-.004985314*u.z),g:h(-.00969266*u.x+.018760108*u.y+41556e-8*u.z),b:h(556434e-9*u.x-.002040259*u.y+.010572252*u.z),a:r.a},{r:n(a.r,0,255),g:n(a.g,0,255),b:n(a.b,0,255),a:n(a.a)}},l=function(r){var t=u(r.r),a=u(r.g),h=u(r.b);return function(r){return{x:n(r.x,0,o),y:n(r.y,0,e),z:n(r.z,0,c),a:n(r.a)}}(function(r){return{x:1.0478112*r.x+.0228866*r.y+-.050127*r.z,y:.0295424*r.x+.9904844*r.y+-.0170491*r.z,z:-.0092345*r.x+.0150436*r.y+.7521316*r.z,a:r.a}}({x:100*(.4124564*t+.3575761*a+.1804375*h),y:100*(.2126729*t+.7151522*a+.072175*h),z:100*(.0193339*t+.119192*a+.9503041*h),a:r.a}))},f=216/24389,b=24389/27,d=function(r){return{l:n(r.l,0,100),c:r.c,h:(t=r.h,(t=isFinite(t)?t%360:0)>0?t:t+360),a:r.a};var t},p=function(r){return{l:a(r.l,2),c:a(r.c,2),h:a(r.h,2),a:a(r.a,3)}},v=function(r){var a=r.l,n=r.c,u=r.h,h=r.a,o=void 0===h?1:h;if(!t(a)||!t(n)||!t(u))return null;var e=d({l:Number(a),c:Number(n),h:Number(u),a:Number(o)});return M(e)},y=function(r){var t=function(r){var t=l(r),a=t.x/o,n=t.y/e,u=t.z/c;return a=a>f?Math.cbrt(a):(b*a+16)/116,{l:116*(n=n>f?Math.cbrt(n):(b*n+16)/116)-16,a:500*(a-n),b:200*(n-(u=u>f?Math.cbrt(u):(b*u+16)/116)),alpha:t.a}}(r),n=a(t.a,3),u=a(t.b,3),h=Math.atan2(u,n)/Math.PI*180;return{l:t.l,c:Math.sqrt(n*n+u*u),h:h<0?h+360:h,a:t.alpha}},M=function(r){return t={l:r.l,a:r.c*Math.cos(r.h*Math.PI/180),b:r.c*Math.sin(r.h*Math.PI/180),alpha:r.a},n=t.a/500+(a=(t.l+16)/116),u=a-t.b/200,i({x:(Math.pow(n,3)>f?Math.pow(n,3):(116*n-16)/b)*o,y:(t.l>8?Math.pow((t.l+16)/116,3):t.l/b)*e,z:(Math.pow(u,3)>f?Math.pow(u,3):(116*u-16)/b)*c,a:t.alpha});var t,a,n,u},x=/^lch\(\s*([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)\s+([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,s=function(t){var a=x.exec(t);if(!a)return null;var n,u,h=d({l:Number(a[1]),c:Number(a[2]),h:(n=a[3],u=a[4],void 0===u&&(u="deg"),Number(n)*(r[u]||1)),a:void 0===a[5]?1:Number(a[5])/(a[6]?100:1)});return M(h)};export default function(r,t){r.prototype.toLch=function(){return p(y(this.rgba))},r.prototype.toLchString=function(){return r=p(y(this.rgba)),t=r.l,a=r.c,n=r.h,(u=r.a)<1?"lch("+t+"% "+a+" "+n+" / "+u+")":"lch("+t+"% "+a+" "+n+")";var r,t,a,n,u},t.string.push([s,"lch"]),t.object.push([v,"lch"])} diff --git a/node_modules/colord/plugins/minify.d.ts b/node_modules/colord/plugins/minify.d.ts new file mode 100644 index 0000000000..d54d19db0c --- /dev/null +++ b/node_modules/colord/plugins/minify.d.ts @@ -0,0 +1,20 @@ +import { Plugin } from "../extend"; +interface MinificationOptions { + hex?: boolean; + alphaHex?: boolean; + rgb?: boolean; + hsl?: boolean; + name?: boolean; + transparent?: boolean; +} +declare module "../colord" { + interface Colord { + /** Returns the shortest string representation of the color */ + minify(options?: MinificationOptions): string; + } +} +/** + * A plugin adding a color minification utilities. + */ +declare const minifyPlugin: Plugin; +export default minifyPlugin; diff --git a/node_modules/colord/plugins/minify.js b/node_modules/colord/plugins/minify.js new file mode 100644 index 0000000000..30dfdec85a --- /dev/null +++ b/node_modules/colord/plugins/minify.js @@ -0,0 +1 @@ +module.exports=function(t){var r=function(t){var r,n,e,i=t.toHex(),a=t.alpha(),h=i.split(""),s=h[1],o=h[2],u=h[3],l=h[4],p=h[5],f=h[6],g=h[7],v=h[8];if(a>0&&a<1&&(r=parseInt(g+v,16)/255,void 0===(n=2)&&(n=0),void 0===e&&(e=Math.pow(10,n)),Math.round(e*r)/e+0!==a))return null;if(s===o&&u===l&&p===f){if(1===a)return"#"+s+u+p;if(g===v)return"#"+s+u+p+g}return i},n=function(t){return t>0&&t<1?t.toString().replace("0.","."):t};t.prototype.minify=function(t){void 0===t&&(t={});var e=this.toRgb(),i=n(e.r),a=n(e.g),h=n(e.b),s=this.toHsl(),o=n(s.h),u=n(s.s),l=n(s.l),p=n(this.alpha()),f=Object.assign({hex:!0,rgb:!0,hsl:!0},t),g=[];if(f.hex&&(1===p||f.alphaHex)){var v=r(this);v&&g.push(v)}if(f.rgb&&g.push(1===p?"rgb("+i+","+a+","+h+")":"rgba("+i+","+a+","+h+","+p+")"),f.hsl&&g.push(1===p?"hsl("+o+","+u+"%,"+l+"%)":"hsla("+o+","+u+"%,"+l+"%,"+p+")"),f.transparent&&0===i&&0===a&&0===h&&0===p)g.push("transparent");else if(1===p&&f.name&&"function"==typeof this.toName){var c=this.toName();c&&g.push(c)}return function(t){for(var r=t[0],n=1;n0&&i<1&&(r=parseInt(g+v,16)/255,void 0===(n=2)&&(n=0),void 0===e&&(e=Math.pow(10,n)),Math.round(e*r)/e+0!==i))return null;if(s===o&&u===l&&p===f){if(1===i)return"#"+s+u+p;if(g===v)return"#"+s+u+p+g}return a},n=function(t){return t>0&&t<1?t.toString().replace("0.","."):t};t.prototype.minify=function(t){void 0===t&&(t={});var e=this.toRgb(),a=n(e.r),i=n(e.g),h=n(e.b),s=this.toHsl(),o=n(s.h),u=n(s.s),l=n(s.l),p=n(this.alpha()),f=Object.assign({hex:!0,rgb:!0,hsl:!0},t),g=[];if(f.hex&&(1===p||f.alphaHex)){var v=r(this);v&&g.push(v)}if(f.rgb&&g.push(1===p?"rgb("+a+","+i+","+h+")":"rgba("+a+","+i+","+h+","+p+")"),f.hsl&&g.push(1===p?"hsl("+o+","+u+"%,"+l+"%)":"hsla("+o+","+u+"%,"+l+"%,"+p+")"),f.transparent&&0===a&&0===i&&0===h&&0===p)g.push("transparent");else if(1===p&&f.name&&"function"==typeof this.toName){var c=this.toName();c&&g.push(c)}return function(t){for(var r=t[0],n=1;nn?n:t>a?t:a},a=function(t){var a=t/255;return a<.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)},n=function(t){return 255*(t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t)},r=96.422,o=100,u=82.521,e=function(a){var r,o,u={x:.9555766*(r=a).x+-.0230393*r.y+.0631636*r.z,y:-.0282895*r.x+1.0099416*r.y+.0210077*r.z,z:.0122982*r.x+-.020483*r.y+1.3299098*r.z};return o={r:n(.032404542*u.x-.015371385*u.y-.004985314*u.z),g:n(-.00969266*u.x+.018760108*u.y+41556e-8*u.z),b:n(556434e-9*u.x-.002040259*u.y+.010572252*u.z),a:a.a},{r:t(o.r,0,255),g:t(o.g,0,255),b:t(o.b,0,255),a:t(o.a)}},i=function(n){var e=a(n.r),i=a(n.g),p=a(n.b);return function(a){return{x:t(a.x,0,r),y:t(a.y,0,o),z:t(a.z,0,u),a:t(a.a)}}(function(t){return{x:1.0478112*t.x+.0228866*t.y+-.050127*t.z,y:.0295424*t.x+.9904844*t.y+-.0170491*t.z,z:-.0092345*t.x+.0150436*t.y+.7521316*t.z,a:t.a}}({x:100*(.4124564*e+.3575761*i+.1804375*p),y:100*(.2126729*e+.7151522*i+.072175*p),z:100*(.0193339*e+.119192*i+.9503041*p),a:n.a}))},p=216/24389,h=24389/27,f=function(t){var a=i(t),n=a.x/r,e=a.y/o,f=a.z/u;return n=n>p?Math.cbrt(n):(h*n+16)/116,{l:116*(e=e>p?Math.cbrt(e):(h*e+16)/116)-16,a:500*(n-e),b:200*(e-(f=f>p?Math.cbrt(f):(h*f+16)/116)),alpha:a.a}},c=function(a,n,i){var c,y=f(a),x=f(n);return function(t){var a=(t.l+16)/116,n=t.a/500+a,i=a-t.b/200;return e({x:(Math.pow(n,3)>p?Math.pow(n,3):(116*n-16)/h)*r,y:(t.l>8?Math.pow((t.l+16)/116,3):t.l/h)*o,z:(Math.pow(i,3)>p?Math.pow(i,3):(116*i-16)/h)*u,a:t.alpha})}({l:t((c={l:y.l*(1-i)+x.l*i,a:y.a*(1-i)+x.a*i,b:y.b*(1-i)+x.b*i,alpha:y.alpha*(1-i)+x.alpha*i}).l,0,400),a:c.a,b:c.b,alpha:t(c.alpha)})};module.exports=function(t){function a(t,a,n){void 0===n&&(n=5);for(var r=[],o=1/(n-1),u=0;u<=n-1;u++)r.push(t.mix(a,o*u));return r}t.prototype.mix=function(a,n){void 0===n&&(n=.5);var r=a instanceof t?a:new t(a),o=c(this.toRgb(),r.toRgb(),n);return new t(o)},t.prototype.tints=function(t){return a(this,"#fff",t)},t.prototype.shades=function(t){return a(this,"#000",t)},t.prototype.tones=function(t){return a(this,"#808080",t)}}; diff --git a/node_modules/colord/plugins/mix.mjs b/node_modules/colord/plugins/mix.mjs new file mode 100644 index 0000000000..d8841ccb48 --- /dev/null +++ b/node_modules/colord/plugins/mix.mjs @@ -0,0 +1 @@ +var t=function(t,a,n){return void 0===a&&(a=0),void 0===n&&(n=1),t>n?n:t>a?t:a},a=function(t){var a=t/255;return a<.04045?a/12.92:Math.pow((a+.055)/1.055,2.4)},n=function(t){return 255*(t>.0031308?1.055*Math.pow(t,1/2.4)-.055:12.92*t)},r=96.422,o=100,u=82.521,e=function(a){var r,o,u={x:.9555766*(r=a).x+-.0230393*r.y+.0631636*r.z,y:-.0282895*r.x+1.0099416*r.y+.0210077*r.z,z:.0122982*r.x+-.020483*r.y+1.3299098*r.z};return o={r:n(.032404542*u.x-.015371385*u.y-.004985314*u.z),g:n(-.00969266*u.x+.018760108*u.y+41556e-8*u.z),b:n(556434e-9*u.x-.002040259*u.y+.010572252*u.z),a:a.a},{r:t(o.r,0,255),g:t(o.g,0,255),b:t(o.b,0,255),a:t(o.a)}},i=function(n){var e=a(n.r),i=a(n.g),p=a(n.b);return function(a){return{x:t(a.x,0,r),y:t(a.y,0,o),z:t(a.z,0,u),a:t(a.a)}}(function(t){return{x:1.0478112*t.x+.0228866*t.y+-.050127*t.z,y:.0295424*t.x+.9904844*t.y+-.0170491*t.z,z:-.0092345*t.x+.0150436*t.y+.7521316*t.z,a:t.a}}({x:100*(.4124564*e+.3575761*i+.1804375*p),y:100*(.2126729*e+.7151522*i+.072175*p),z:100*(.0193339*e+.119192*i+.9503041*p),a:n.a}))},p=216/24389,h=24389/27,f=function(t){var a=i(t),n=a.x/r,e=a.y/o,f=a.z/u;return n=n>p?Math.cbrt(n):(h*n+16)/116,{l:116*(e=e>p?Math.cbrt(e):(h*e+16)/116)-16,a:500*(n-e),b:200*(e-(f=f>p?Math.cbrt(f):(h*f+16)/116)),alpha:a.a}},c=function(a,n,i){var c,y=f(a),x=f(n);return function(t){var a=(t.l+16)/116,n=t.a/500+a,i=a-t.b/200;return e({x:(Math.pow(n,3)>p?Math.pow(n,3):(116*n-16)/h)*r,y:(t.l>8?Math.pow((t.l+16)/116,3):t.l/h)*o,z:(Math.pow(i,3)>p?Math.pow(i,3):(116*i-16)/h)*u,a:t.alpha})}({l:t((c={l:y.l*(1-i)+x.l*i,a:y.a*(1-i)+x.a*i,b:y.b*(1-i)+x.b*i,alpha:y.alpha*(1-i)+x.alpha*i}).l,0,400),a:c.a,b:c.b,alpha:t(c.alpha)})};export default function(t){function a(t,a,n){void 0===n&&(n=5);for(var r=[],o=1/(n-1),u=0;u<=n-1;u++)r.push(t.mix(a,o*u));return r}t.prototype.mix=function(a,n){void 0===n&&(n=.5);var r=a instanceof t?a:new t(a),o=c(this.toRgb(),r.toRgb(),n);return new t(o)},t.prototype.tints=function(t){return a(this,"#fff",t)},t.prototype.shades=function(t){return a(this,"#000",t)},t.prototype.tones=function(t){return a(this,"#808080",t)}} diff --git a/node_modules/colord/plugins/names.d.ts b/node_modules/colord/plugins/names.d.ts new file mode 100644 index 0000000000..81b865fa49 --- /dev/null +++ b/node_modules/colord/plugins/names.d.ts @@ -0,0 +1,19 @@ +import { Plugin } from "../extend"; +interface ConvertOptions { + closest?: boolean; +} +declare module "../colord" { + interface Colord { + /** Finds CSS color keyword that matches with the color value */ + toName(options?: ConvertOptions): string | undefined; + } +} +/** + * Plugin to work with named colors. + * Adds a parser to read CSS color names and `toName` method. + * See https://www.w3.org/TR/css-color-4/#named-colors + * Supports 'transparent' string as defined in + * https://drafts.csswg.org/css-color/#transparent-color + */ +declare const namesPlugin: Plugin; +export default namesPlugin; diff --git a/node_modules/colord/plugins/names.js b/node_modules/colord/plugins/names.js new file mode 100644 index 0000000000..673b122e87 --- /dev/null +++ b/node_modules/colord/plugins/names.js @@ -0,0 +1 @@ +module.exports=function(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var d,i,o=r[this.toHex()];if(o)return o;if(null==f?void 0:f.closest){var n=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=n,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u0:"number"==typeof r},n=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t+0},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r>n?r:n},u=function(r){var n=r/255;return n<.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)},o=function(r){return 255*(r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r)},a=96.422,e=100,y=82.521,x=function(r){return{x:t(r.x,0,a),y:t(r.y,0,e),z:t(r.z,0,y),a:t(r.a)}},z=function(n){var t=n.x,u=n.y,o=n.z,a=n.a,e=void 0===a?1:a;if(!r(t)||!r(u)||!r(o))return null;var y=x({x:Number(t),y:Number(u),z:Number(o),a:Number(e)});return i(y)},i=function(r){var n,u,a={x:.9555766*(n=r).x+-.0230393*n.y+.0631636*n.z,y:-.0282895*n.x+1.0099416*n.y+.0210077*n.z,z:.0122982*n.x+-.020483*n.y+1.3299098*n.z};return u={r:o(.032404542*a.x-.015371385*a.y-.004985314*a.z),g:o(-.00969266*a.x+.018760108*a.y+41556e-8*a.z),b:o(556434e-9*a.x-.002040259*a.y+.010572252*a.z),a:r.a},{r:t(u.r,0,255),g:t(u.g,0,255),b:t(u.b,0,255),a:t(u.a)}};module.exports=function(r,t){r.prototype.toXyz=function(){return function(r){return{x:n(r.x,2),y:n(r.y,2),z:n(r.z,2),a:n(r.a,3)}}((t=u((r=this.rgba).r),o=u(r.g),a=u(r.b),x({x:1.0478112*(e={x:100*(.4124564*t+.3575761*o+.1804375*a),y:100*(.2126729*t+.7151522*o+.072175*a),z:100*(.0193339*t+.119192*o+.9503041*a),a:r.a}).x+.0228866*e.y+-.050127*e.z,y:.0295424*e.x+.9904844*e.y+-.0170491*e.z,z:-.0092345*e.x+.0150436*e.y+.7521316*e.z,a:e.a})));var r,t,o,a,e},t.object.push([z,"xyz"])}; diff --git a/node_modules/colord/plugins/xyz.mjs b/node_modules/colord/plugins/xyz.mjs new file mode 100644 index 0000000000..0c60d65109 --- /dev/null +++ b/node_modules/colord/plugins/xyz.mjs @@ -0,0 +1 @@ +var r=function(r){return"string"==typeof r?r.length>0:"number"==typeof r},n=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=Math.pow(10,n)),Math.round(t*r)/t+0},t=function(r,n,t){return void 0===n&&(n=0),void 0===t&&(t=1),r>t?t:r>n?r:n},u=function(r){var n=r/255;return n<.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)},o=function(r){return 255*(r>.0031308?1.055*Math.pow(r,1/2.4)-.055:12.92*r)},a=96.422,e=100,y=82.521,x=function(r){return{x:t(r.x,0,a),y:t(r.y,0,e),z:t(r.z,0,y),a:t(r.a)}},z=function(n){var t=n.x,u=n.y,o=n.z,a=n.a,e=void 0===a?1:a;if(!r(t)||!r(u)||!r(o))return null;var y=x({x:Number(t),y:Number(u),z:Number(o),a:Number(e)});return i(y)},i=function(r){var n,u,a={x:.9555766*(n=r).x+-.0230393*n.y+.0631636*n.z,y:-.0282895*n.x+1.0099416*n.y+.0210077*n.z,z:.0122982*n.x+-.020483*n.y+1.3299098*n.z};return u={r:o(.032404542*a.x-.015371385*a.y-.004985314*a.z),g:o(-.00969266*a.x+.018760108*a.y+41556e-8*a.z),b:o(556434e-9*a.x-.002040259*a.y+.010572252*a.z),a:r.a},{r:t(u.r,0,255),g:t(u.g,0,255),b:t(u.b,0,255),a:t(u.a)}};export default function(r,t){r.prototype.toXyz=function(){return function(r){return{x:n(r.x,2),y:n(r.y,2),z:n(r.z,2),a:n(r.a,3)}}((t=u((r=this.rgba).r),o=u(r.g),a=u(r.b),x({x:1.0478112*(e={x:100*(.4124564*t+.3575761*o+.1804375*a),y:100*(.2126729*t+.7151522*o+.072175*a),z:100*(.0193339*t+.119192*o+.9503041*a),a:r.a}).x+.0228866*e.y+-.050127*e.z,y:.0295424*e.x+.9904844*e.y+-.0170491*e.z,z:-.0092345*e.x+.0150436*e.y+.7521316*e.z,a:e.a})));var r,t,o,a,e},t.object.push([z,"xyz"])} diff --git a/node_modules/colord/random.d.ts b/node_modules/colord/random.d.ts new file mode 100644 index 0000000000..646d5fd5d2 --- /dev/null +++ b/node_modules/colord/random.d.ts @@ -0,0 +1,2 @@ +import { Colord } from "./colord"; +export declare const random: () => Colord; diff --git a/node_modules/colord/types.d.ts b/node_modules/colord/types.d.ts new file mode 100644 index 0000000000..dbd6fed446 --- /dev/null +++ b/node_modules/colord/types.d.ts @@ -0,0 +1,67 @@ +export declare type RgbColor = { + r: number; + g: number; + b: number; +}; +export declare type HslColor = { + h: number; + s: number; + l: number; +}; +export declare type HsvColor = { + h: number; + s: number; + v: number; +}; +export declare type HwbColor = { + h: number; + w: number; + b: number; +}; +export interface XyzColor { + x: number; + y: number; + z: number; +} +export interface LabColor { + l: number; + a: number; + b: number; +} +export interface LchColor { + l: number; + c: number; + h: number; +} +export interface CmykColor { + c: number; + m: number; + y: number; + k: number; +} +declare type WithAlpha = O & { + a: number; +}; +export declare type RgbaColor = WithAlpha; +export declare type HslaColor = WithAlpha; +export declare type HsvaColor = WithAlpha; +export declare type HwbaColor = WithAlpha; +export declare type XyzaColor = WithAlpha; +export declare type LabaColor = LabColor & { + alpha: number; +}; +export declare type LchaColor = WithAlpha; +export declare type CmykaColor = WithAlpha; +export declare type ObjectColor = RgbColor | RgbaColor | HslColor | HslaColor | HsvColor | HsvaColor | HwbColor | HwbaColor | XyzColor | XyzaColor | LabColor | LabaColor | LchColor | LchaColor | CmykColor | CmykaColor; +export declare type AnyColor = string | ObjectColor; +export declare type InputObject = Record; +export declare type Format = "name" | "hex" | "rgb" | "hsl" | "hsv" | "hwb" | "xyz" | "lab" | "lch" | "cmyk"; +export declare type Input = string | InputObject; +export declare type ParseResult = [RgbaColor, Format]; +export declare type ParseFunction = (input: I) => RgbaColor | null; +export declare type Parser = [ParseFunction, Format]; +export declare type Parsers = { + string: Array>; + object: Array>; +}; +export {}; diff --git a/node_modules/known-css-properties/README.md b/node_modules/known-css-properties/README.md index bc6b0fb114..fa9503ade5 100644 --- a/node_modules/known-css-properties/README.md +++ b/node_modules/known-css-properties/README.md @@ -19,23 +19,23 @@ List of standard and browser specific CSS properties. | Name | Versions | |---|--:| -| Chrome | 14 - 91 | -| Firefox | 6 - 89 | +| Chrome | 14 - 96 | +| Firefox | 6 - 95 | | Edge | 13 - 18 | -| Safari | 6, 6.2, 7 - 9, 9.1, 10.0, 11.0, 11.1, 12.0, 12.1, 13.0, 13.1, 14, 14.1 | +| Safari | 6, 6.2, 7 - 9, 9.1, 10.0, 11.0, 11.1, 12.0, 12.1, 13.0, 13.1, 14, 14.1, 15.1 | | Internet Explorer | 8 - 11 | | Opera | 12.10, 12.14, 12.15, 12.16, 36 - 40, 45, 56, 58 | ### Mobile | Name | Versions | |---|--:| -| iOS Safari | 6 - 8, 8.3, 9.0, 9.3, 10.0, 10.2, 10.3, 11.0, 11.2, 11.3, 11.4, 12.0 , 12.1, 13.1, 14, 14.1 | -| Chrome for Android | 30, 35, 37, 44, 46, 51, 55 - 62, 64, 66 - 76, 78 - 79, 81, 83 | -| Firefox for Android | 47, 52 - 54, 57, 58, 62 - 64, 66, 68, 81, 85 | +| iOS Safari | 6 - 8, 8.3, 9.0, 9.3, 10.0, 10.2, 10.3, 11.0, 11.2, 11.3, 11.4, 12.0 , 12.1, 13.1, 14, 14.1, 15.1 | +| Chrome for Android | 30, 35, 37, 44, 46, 51, 55 - 62, 64, 66 - 76, 78 - 79, 81, 83, 91, 94, 96 | +| Firefox for Android | 47, 52 - 54, 57, 58, 62 - 64, 66, 68, 81, 85, 91 | | IE mobile | 11 | | Opera Mobile | 42.7, 43, 47.1 | -| Samsung Internet | 4.0, 6.4, 7.4, 8.2 | -| UC Browser for Android | 11.2, 12.9, 13.1 | +| Samsung Internet | 4.0, 6.4, 7.4, 8.2, 9.0, 14.2 | +| UC Browser for Android | 11.2, 12.9, 12.10, 13.1, 13.4 | ## JavaScript API diff --git a/node_modules/known-css-properties/data/all.json b/node_modules/known-css-properties/data/all.json index 6d37ccf749..b29a57bdce 100644 --- a/node_modules/known-css-properties/data/all.json +++ b/node_modules/known-css-properties/data/all.json @@ -1,5 +1,16 @@ { "properties": [ + "-epub-caption-side", + "-epub-hyphens", + "-epub-text-combine", + "-epub-text-emphasis", + "-epub-text-emphasis-color", + "-epub-text-emphasis-style", + "-epub-text-orientation", + "-epub-text-transform", + "-epub-word-break", + "-epub-writing-mode", + "-internal-text-autosizing-status", "accelerator", "accent-color", "-wap-accesskey", @@ -51,6 +62,7 @@ "-webkit-animation-timing-function", "-webkit-animation-trigger", "-webkit-animation", + "app-region", "-webkit-app-region", "appearance", "-moz-appearance", @@ -264,6 +276,7 @@ "color", "color-adjust", "-webkit-color-correction", + "-apple-color-filter", "color-interpolation", "color-interpolation-filters", "color-profile", @@ -345,6 +358,16 @@ "elevation", "empty-cells", "enable-background", + "epub-caption-side", + "epub-hyphens", + "epub-text-combine", + "epub-text-emphasis", + "epub-text-emphasis-color", + "epub-text-emphasis-style", + "epub-text-orientation", + "epub-text-transform", + "epub-word-break", + "epub-writing-mode", "fallback", "fill", "fill-break", @@ -532,6 +555,7 @@ "justify-content", "-webkit-justify-content", "justify-items", + "-webkit-justify-items", "justify-self", "-webkit-justify-self", "kerning", @@ -766,6 +790,8 @@ "pause", "pause-after", "pause-before", + "-apple-pay-button-style", + "-apple-pay-button-type", "pen-action", "perspective", "-moz-perspective", @@ -897,6 +923,7 @@ "-webkit-shape-padding", "shape-rendering", "size", + "size-adjust", "snap-height", "solid-color", "solid-opacity", @@ -1043,6 +1070,7 @@ "-ms-touch-action", "-webkit-touch-callout", "-ms-touch-select", + "-apple-trailing-word", "transform", "transform-box", "-moz-transform", diff --git a/node_modules/known-css-properties/index.d.ts b/node_modules/known-css-properties/index.d.ts new file mode 100644 index 0000000000..f31ec7bfc2 --- /dev/null +++ b/node_modules/known-css-properties/index.d.ts @@ -0,0 +1,3 @@ +declare module "known-css-properties" { + export const all: string[]; +} diff --git a/node_modules/known-css-properties/package.json b/node_modules/known-css-properties/package.json index 302071d2ac..144f34e927 100644 --- a/node_modules/known-css-properties/package.json +++ b/node_modules/known-css-properties/package.json @@ -1,6 +1,6 @@ { "name": "known-css-properties", - "version": "0.23.0", + "version": "0.24.0", "description": "List of known CSS properties", "repository": "known-css/known-css-properties", "main": "index.js", @@ -47,9 +47,9 @@ }, "homepage": "https://github.com/known-css/known-css-properties#readme", "devDependencies": { - "axios": "0.21.1", - "eslint": "7.30.0", - "globby": "11.0.4", + "axios": "0.21.2", + "eslint": "8.4.1", + "globby": "12.0.2", "lodash.sortby": "4.7.0", "lodash.uniq": "4.5.0" } diff --git a/node_modules/lodash.clonedeep/LICENSE b/node_modules/lodash.clonedeep/LICENSE deleted file mode 100644 index e0c69d5603..0000000000 --- a/node_modules/lodash.clonedeep/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Copyright jQuery Foundation and other contributors - -Based on Underscore.js, copyright Jeremy Ashkenas, -DocumentCloud and Investigative Reporters & Editors - -This software consists of voluntary contributions made by many -individuals. For exact contribution history, see the revision history -available at https://github.com/lodash/lodash - -The following license applies to all parts of this software except as -documented below: - -==== - -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. - -==== - -Copyright and related rights for sample code are waived via CC0. Sample -code is defined as all source code displayed within the prose of the -documentation. - -CC0: http://creativecommons.org/publicdomain/zero/1.0/ - -==== - -Files located in the node_modules and vendor directories are externally -maintained libraries used by this software which have their own -licenses; we recommend you read them, as their terms may differ from the -terms above. diff --git a/node_modules/lodash.clonedeep/README.md b/node_modules/lodash.clonedeep/README.md deleted file mode 100644 index fee48e4706..0000000000 --- a/node_modules/lodash.clonedeep/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# lodash.clonedeep v4.5.0 - -The [lodash](https://lodash.com/) method `_.cloneDeep` exported as a [Node.js](https://nodejs.org/) module. - -## Installation - -Using npm: -```bash -$ {sudo -H} npm i -g npm -$ npm i --save lodash.clonedeep -``` - -In Node.js: -```js -var cloneDeep = require('lodash.clonedeep'); -``` - -See the [documentation](https://lodash.com/docs#cloneDeep) or [package source](https://github.com/lodash/lodash/blob/4.5.0-npm-packages/lodash.clonedeep) for more details. diff --git a/node_modules/lodash.clonedeep/index.js b/node_modules/lodash.clonedeep/index.js deleted file mode 100644 index 1b0e502982..0000000000 --- a/node_modules/lodash.clonedeep/index.js +++ /dev/null @@ -1,1748 +0,0 @@ -/** - * lodash (Custom Build) - * Build: `lodash modularize exports="npm" -o ./` - * Copyright jQuery Foundation and other contributors - * Released under MIT license - * Based on Underscore.js 1.8.3 - * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors - */ - -/** Used as the size to enable large array optimizations. */ -var LARGE_ARRAY_SIZE = 200; - -/** Used to stand-in for `undefined` hash values. */ -var HASH_UNDEFINED = '__lodash_hash_undefined__'; - -/** Used as references for various `Number` constants. */ -var MAX_SAFE_INTEGER = 9007199254740991; - -/** `Object#toString` result references. */ -var argsTag = '[object Arguments]', - arrayTag = '[object Array]', - boolTag = '[object Boolean]', - dateTag = '[object Date]', - errorTag = '[object Error]', - funcTag = '[object Function]', - genTag = '[object GeneratorFunction]', - mapTag = '[object Map]', - numberTag = '[object Number]', - objectTag = '[object Object]', - promiseTag = '[object Promise]', - regexpTag = '[object RegExp]', - setTag = '[object Set]', - stringTag = '[object String]', - symbolTag = '[object Symbol]', - weakMapTag = '[object WeakMap]'; - -var arrayBufferTag = '[object ArrayBuffer]', - dataViewTag = '[object DataView]', - float32Tag = '[object Float32Array]', - float64Tag = '[object Float64Array]', - int8Tag = '[object Int8Array]', - int16Tag = '[object Int16Array]', - int32Tag = '[object Int32Array]', - uint8Tag = '[object Uint8Array]', - uint8ClampedTag = '[object Uint8ClampedArray]', - uint16Tag = '[object Uint16Array]', - uint32Tag = '[object Uint32Array]'; - -/** - * Used to match `RegExp` - * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). - */ -var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; - -/** Used to match `RegExp` flags from their coerced string values. */ -var reFlags = /\w*$/; - -/** Used to detect host constructors (Safari). */ -var reIsHostCtor = /^\[object .+?Constructor\]$/; - -/** Used to detect unsigned integer values. */ -var reIsUint = /^(?:0|[1-9]\d*)$/; - -/** Used to identify `toStringTag` values supported by `_.clone`. */ -var cloneableTags = {}; -cloneableTags[argsTag] = cloneableTags[arrayTag] = -cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = -cloneableTags[boolTag] = cloneableTags[dateTag] = -cloneableTags[float32Tag] = cloneableTags[float64Tag] = -cloneableTags[int8Tag] = cloneableTags[int16Tag] = -cloneableTags[int32Tag] = cloneableTags[mapTag] = -cloneableTags[numberTag] = cloneableTags[objectTag] = -cloneableTags[regexpTag] = cloneableTags[setTag] = -cloneableTags[stringTag] = cloneableTags[symbolTag] = -cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = -cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; -cloneableTags[errorTag] = cloneableTags[funcTag] = -cloneableTags[weakMapTag] = false; - -/** Detect free variable `global` from Node.js. */ -var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; - -/** Detect free variable `self`. */ -var freeSelf = typeof self == 'object' && self && self.Object === Object && self; - -/** Used as a reference to the global object. */ -var root = freeGlobal || freeSelf || Function('return this')(); - -/** Detect free variable `exports`. */ -var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports; - -/** Detect free variable `module`. */ -var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; - -/** Detect the popular CommonJS extension `module.exports`. */ -var moduleExports = freeModule && freeModule.exports === freeExports; - -/** - * Adds the key-value `pair` to `map`. - * - * @private - * @param {Object} map The map to modify. - * @param {Array} pair The key-value pair to add. - * @returns {Object} Returns `map`. - */ -function addMapEntry(map, pair) { - // Don't return `map.set` because it's not chainable in IE 11. - map.set(pair[0], pair[1]); - return map; -} - -/** - * Adds `value` to `set`. - * - * @private - * @param {Object} set The set to modify. - * @param {*} value The value to add. - * @returns {Object} Returns `set`. - */ -function addSetEntry(set, value) { - // Don't return `set.add` because it's not chainable in IE 11. - set.add(value); - return set; -} - -/** - * A specialized version of `_.forEach` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns `array`. - */ -function arrayEach(array, iteratee) { - var index = -1, - length = array ? array.length : 0; - - while (++index < length) { - if (iteratee(array[index], index, array) === false) { - break; - } - } - return array; -} - -/** - * Appends the elements of `values` to `array`. - * - * @private - * @param {Array} array The array to modify. - * @param {Array} values The values to append. - * @returns {Array} Returns `array`. - */ -function arrayPush(array, values) { - var index = -1, - length = values.length, - offset = array.length; - - while (++index < length) { - array[offset + index] = values[index]; - } - return array; -} - -/** - * A specialized version of `_.reduce` for arrays without support for - * iteratee shorthands. - * - * @private - * @param {Array} [array] The array to iterate over. - * @param {Function} iteratee The function invoked per iteration. - * @param {*} [accumulator] The initial value. - * @param {boolean} [initAccum] Specify using the first element of `array` as - * the initial value. - * @returns {*} Returns the accumulated value. - */ -function arrayReduce(array, iteratee, accumulator, initAccum) { - var index = -1, - length = array ? array.length : 0; - - if (initAccum && length) { - accumulator = array[++index]; - } - while (++index < length) { - accumulator = iteratee(accumulator, array[index], index, array); - } - return accumulator; -} - -/** - * The base implementation of `_.times` without support for iteratee shorthands - * or max array length checks. - * - * @private - * @param {number} n The number of times to invoke `iteratee`. - * @param {Function} iteratee The function invoked per iteration. - * @returns {Array} Returns the array of results. - */ -function baseTimes(n, iteratee) { - var index = -1, - result = Array(n); - - while (++index < n) { - result[index] = iteratee(index); - } - return result; -} - -/** - * Gets the value at `key` of `object`. - * - * @private - * @param {Object} [object] The object to query. - * @param {string} key The key of the property to get. - * @returns {*} Returns the property value. - */ -function getValue(object, key) { - return object == null ? undefined : object[key]; -} - -/** - * Checks if `value` is a host object in IE < 9. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a host object, else `false`. - */ -function isHostObject(value) { - // Many host objects are `Object` objects that can coerce to strings - // despite having improperly defined `toString` methods. - var result = false; - if (value != null && typeof value.toString != 'function') { - try { - result = !!(value + ''); - } catch (e) {} - } - return result; -} - -/** - * Converts `map` to its key-value pairs. - * - * @private - * @param {Object} map The map to convert. - * @returns {Array} Returns the key-value pairs. - */ -function mapToArray(map) { - var index = -1, - result = Array(map.size); - - map.forEach(function(value, key) { - result[++index] = [key, value]; - }); - return result; -} - -/** - * Creates a unary function that invokes `func` with its argument transformed. - * - * @private - * @param {Function} func The function to wrap. - * @param {Function} transform The argument transform. - * @returns {Function} Returns the new function. - */ -function overArg(func, transform) { - return function(arg) { - return func(transform(arg)); - }; -} - -/** - * Converts `set` to an array of its values. - * - * @private - * @param {Object} set The set to convert. - * @returns {Array} Returns the values. - */ -function setToArray(set) { - var index = -1, - result = Array(set.size); - - set.forEach(function(value) { - result[++index] = value; - }); - return result; -} - -/** Used for built-in method references. */ -var arrayProto = Array.prototype, - funcProto = Function.prototype, - objectProto = Object.prototype; - -/** Used to detect overreaching core-js shims. */ -var coreJsData = root['__core-js_shared__']; - -/** Used to detect methods masquerading as native. */ -var maskSrcKey = (function() { - var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); - return uid ? ('Symbol(src)_1.' + uid) : ''; -}()); - -/** Used to resolve the decompiled source of functions. */ -var funcToString = funcProto.toString; - -/** Used to check objects for own properties. */ -var hasOwnProperty = objectProto.hasOwnProperty; - -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; - -/** Used to detect if a method is native. */ -var reIsNative = RegExp('^' + - funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') - .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' -); - -/** Built-in value references. */ -var Buffer = moduleExports ? root.Buffer : undefined, - Symbol = root.Symbol, - Uint8Array = root.Uint8Array, - getPrototype = overArg(Object.getPrototypeOf, Object), - objectCreate = Object.create, - propertyIsEnumerable = objectProto.propertyIsEnumerable, - splice = arrayProto.splice; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeGetSymbols = Object.getOwnPropertySymbols, - nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, - nativeKeys = overArg(Object.keys, Object); - -/* Built-in method references that are verified to be native. */ -var DataView = getNative(root, 'DataView'), - Map = getNative(root, 'Map'), - Promise = getNative(root, 'Promise'), - Set = getNative(root, 'Set'), - WeakMap = getNative(root, 'WeakMap'), - nativeCreate = getNative(Object, 'create'); - -/** Used to detect maps, sets, and weakmaps. */ -var dataViewCtorString = toSource(DataView), - mapCtorString = toSource(Map), - promiseCtorString = toSource(Promise), - setCtorString = toSource(Set), - weakMapCtorString = toSource(WeakMap); - -/** Used to convert symbols to primitives and strings. */ -var symbolProto = Symbol ? Symbol.prototype : undefined, - symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; - -/** - * Creates a hash object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Hash(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the hash. - * - * @private - * @name clear - * @memberOf Hash - */ -function hashClear() { - this.__data__ = nativeCreate ? nativeCreate(null) : {}; -} - -/** - * Removes `key` and its value from the hash. - * - * @private - * @name delete - * @memberOf Hash - * @param {Object} hash The hash to modify. - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function hashDelete(key) { - return this.has(key) && delete this.__data__[key]; -} - -/** - * Gets the hash value for `key`. - * - * @private - * @name get - * @memberOf Hash - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function hashGet(key) { - var data = this.__data__; - if (nativeCreate) { - var result = data[key]; - return result === HASH_UNDEFINED ? undefined : result; - } - return hasOwnProperty.call(data, key) ? data[key] : undefined; -} - -/** - * Checks if a hash value for `key` exists. - * - * @private - * @name has - * @memberOf Hash - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function hashHas(key) { - var data = this.__data__; - return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); -} - -/** - * Sets the hash `key` to `value`. - * - * @private - * @name set - * @memberOf Hash - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the hash instance. - */ -function hashSet(key, value) { - var data = this.__data__; - data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; - return this; -} - -// Add methods to `Hash`. -Hash.prototype.clear = hashClear; -Hash.prototype['delete'] = hashDelete; -Hash.prototype.get = hashGet; -Hash.prototype.has = hashHas; -Hash.prototype.set = hashSet; - -/** - * Creates an list cache object. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function ListCache(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the list cache. - * - * @private - * @name clear - * @memberOf ListCache - */ -function listCacheClear() { - this.__data__ = []; -} - -/** - * Removes `key` and its value from the list cache. - * - * @private - * @name delete - * @memberOf ListCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function listCacheDelete(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - return false; - } - var lastIndex = data.length - 1; - if (index == lastIndex) { - data.pop(); - } else { - splice.call(data, index, 1); - } - return true; -} - -/** - * Gets the list cache value for `key`. - * - * @private - * @name get - * @memberOf ListCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function listCacheGet(key) { - var data = this.__data__, - index = assocIndexOf(data, key); - - return index < 0 ? undefined : data[index][1]; -} - -/** - * Checks if a list cache value for `key` exists. - * - * @private - * @name has - * @memberOf ListCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function listCacheHas(key) { - return assocIndexOf(this.__data__, key) > -1; -} - -/** - * Sets the list cache `key` to `value`. - * - * @private - * @name set - * @memberOf ListCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the list cache instance. - */ -function listCacheSet(key, value) { - var data = this.__data__, - index = assocIndexOf(data, key); - - if (index < 0) { - data.push([key, value]); - } else { - data[index][1] = value; - } - return this; -} - -// Add methods to `ListCache`. -ListCache.prototype.clear = listCacheClear; -ListCache.prototype['delete'] = listCacheDelete; -ListCache.prototype.get = listCacheGet; -ListCache.prototype.has = listCacheHas; -ListCache.prototype.set = listCacheSet; - -/** - * Creates a map cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function MapCache(entries) { - var index = -1, - length = entries ? entries.length : 0; - - this.clear(); - while (++index < length) { - var entry = entries[index]; - this.set(entry[0], entry[1]); - } -} - -/** - * Removes all key-value entries from the map. - * - * @private - * @name clear - * @memberOf MapCache - */ -function mapCacheClear() { - this.__data__ = { - 'hash': new Hash, - 'map': new (Map || ListCache), - 'string': new Hash - }; -} - -/** - * Removes `key` and its value from the map. - * - * @private - * @name delete - * @memberOf MapCache - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function mapCacheDelete(key) { - return getMapData(this, key)['delete'](key); -} - -/** - * Gets the map value for `key`. - * - * @private - * @name get - * @memberOf MapCache - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function mapCacheGet(key) { - return getMapData(this, key).get(key); -} - -/** - * Checks if a map value for `key` exists. - * - * @private - * @name has - * @memberOf MapCache - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function mapCacheHas(key) { - return getMapData(this, key).has(key); -} - -/** - * Sets the map `key` to `value`. - * - * @private - * @name set - * @memberOf MapCache - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the map cache instance. - */ -function mapCacheSet(key, value) { - getMapData(this, key).set(key, value); - return this; -} - -// Add methods to `MapCache`. -MapCache.prototype.clear = mapCacheClear; -MapCache.prototype['delete'] = mapCacheDelete; -MapCache.prototype.get = mapCacheGet; -MapCache.prototype.has = mapCacheHas; -MapCache.prototype.set = mapCacheSet; - -/** - * Creates a stack cache object to store key-value pairs. - * - * @private - * @constructor - * @param {Array} [entries] The key-value pairs to cache. - */ -function Stack(entries) { - this.__data__ = new ListCache(entries); -} - -/** - * Removes all key-value entries from the stack. - * - * @private - * @name clear - * @memberOf Stack - */ -function stackClear() { - this.__data__ = new ListCache; -} - -/** - * Removes `key` and its value from the stack. - * - * @private - * @name delete - * @memberOf Stack - * @param {string} key The key of the value to remove. - * @returns {boolean} Returns `true` if the entry was removed, else `false`. - */ -function stackDelete(key) { - return this.__data__['delete'](key); -} - -/** - * Gets the stack value for `key`. - * - * @private - * @name get - * @memberOf Stack - * @param {string} key The key of the value to get. - * @returns {*} Returns the entry value. - */ -function stackGet(key) { - return this.__data__.get(key); -} - -/** - * Checks if a stack value for `key` exists. - * - * @private - * @name has - * @memberOf Stack - * @param {string} key The key of the entry to check. - * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. - */ -function stackHas(key) { - return this.__data__.has(key); -} - -/** - * Sets the stack `key` to `value`. - * - * @private - * @name set - * @memberOf Stack - * @param {string} key The key of the value to set. - * @param {*} value The value to set. - * @returns {Object} Returns the stack cache instance. - */ -function stackSet(key, value) { - var cache = this.__data__; - if (cache instanceof ListCache) { - var pairs = cache.__data__; - if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { - pairs.push([key, value]); - return this; - } - cache = this.__data__ = new MapCache(pairs); - } - cache.set(key, value); - return this; -} - -// Add methods to `Stack`. -Stack.prototype.clear = stackClear; -Stack.prototype['delete'] = stackDelete; -Stack.prototype.get = stackGet; -Stack.prototype.has = stackHas; -Stack.prototype.set = stackSet; - -/** - * Creates an array of the enumerable property names of the array-like `value`. - * - * @private - * @param {*} value The value to query. - * @param {boolean} inherited Specify returning inherited property names. - * @returns {Array} Returns the array of property names. - */ -function arrayLikeKeys(value, inherited) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - // Safari 9 makes `arguments.length` enumerable in strict mode. - var result = (isArray(value) || isArguments(value)) - ? baseTimes(value.length, String) - : []; - - var length = result.length, - skipIndexes = !!length; - - for (var key in value) { - if ((inherited || hasOwnProperty.call(value, key)) && - !(skipIndexes && (key == 'length' || isIndex(key, length)))) { - result.push(key); - } - } - return result; -} - -/** - * Assigns `value` to `key` of `object` if the existing value is not equivalent - * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * for equality comparisons. - * - * @private - * @param {Object} object The object to modify. - * @param {string} key The key of the property to assign. - * @param {*} value The value to assign. - */ -function assignValue(object, key, value) { - var objValue = object[key]; - if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || - (value === undefined && !(key in object))) { - object[key] = value; - } -} - -/** - * Gets the index at which the `key` is found in `array` of key-value pairs. - * - * @private - * @param {Array} array The array to inspect. - * @param {*} key The key to search for. - * @returns {number} Returns the index of the matched value, else `-1`. - */ -function assocIndexOf(array, key) { - var length = array.length; - while (length--) { - if (eq(array[length][0], key)) { - return length; - } - } - return -1; -} - -/** - * The base implementation of `_.assign` without support for multiple sources - * or `customizer` functions. - * - * @private - * @param {Object} object The destination object. - * @param {Object} source The source object. - * @returns {Object} Returns `object`. - */ -function baseAssign(object, source) { - return object && copyObject(source, keys(source), object); -} - -/** - * The base implementation of `_.clone` and `_.cloneDeep` which tracks - * traversed objects. - * - * @private - * @param {*} value The value to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @param {boolean} [isFull] Specify a clone including symbols. - * @param {Function} [customizer] The function to customize cloning. - * @param {string} [key] The key of `value`. - * @param {Object} [object] The parent object of `value`. - * @param {Object} [stack] Tracks traversed objects and their clone counterparts. - * @returns {*} Returns the cloned value. - */ -function baseClone(value, isDeep, isFull, customizer, key, object, stack) { - var result; - if (customizer) { - result = object ? customizer(value, key, object, stack) : customizer(value); - } - if (result !== undefined) { - return result; - } - if (!isObject(value)) { - return value; - } - var isArr = isArray(value); - if (isArr) { - result = initCloneArray(value); - if (!isDeep) { - return copyArray(value, result); - } - } else { - var tag = getTag(value), - isFunc = tag == funcTag || tag == genTag; - - if (isBuffer(value)) { - return cloneBuffer(value, isDeep); - } - if (tag == objectTag || tag == argsTag || (isFunc && !object)) { - if (isHostObject(value)) { - return object ? value : {}; - } - result = initCloneObject(isFunc ? {} : value); - if (!isDeep) { - return copySymbols(value, baseAssign(result, value)); - } - } else { - if (!cloneableTags[tag]) { - return object ? value : {}; - } - result = initCloneByTag(value, tag, baseClone, isDeep); - } - } - // Check for circular references and return its corresponding clone. - stack || (stack = new Stack); - var stacked = stack.get(value); - if (stacked) { - return stacked; - } - stack.set(value, result); - - if (!isArr) { - var props = isFull ? getAllKeys(value) : keys(value); - } - arrayEach(props || value, function(subValue, key) { - if (props) { - key = subValue; - subValue = value[key]; - } - // Recursively populate clone (susceptible to call stack limits). - assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); - }); - return result; -} - -/** - * The base implementation of `_.create` without support for assigning - * properties to the created object. - * - * @private - * @param {Object} prototype The object to inherit from. - * @returns {Object} Returns the new object. - */ -function baseCreate(proto) { - return isObject(proto) ? objectCreate(proto) : {}; -} - -/** - * The base implementation of `getAllKeys` and `getAllKeysIn` which uses - * `keysFunc` and `symbolsFunc` to get the enumerable property names and - * symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {Function} keysFunc The function to get the keys of `object`. - * @param {Function} symbolsFunc The function to get the symbols of `object`. - * @returns {Array} Returns the array of property names and symbols. - */ -function baseGetAllKeys(object, keysFunc, symbolsFunc) { - var result = keysFunc(object); - return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); -} - -/** - * The base implementation of `getTag`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -function baseGetTag(value) { - return objectToString.call(value); -} - -/** - * The base implementation of `_.isNative` without bad shim checks. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a native function, - * else `false`. - */ -function baseIsNative(value) { - if (!isObject(value) || isMasked(value)) { - return false; - } - var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; - return pattern.test(toSource(value)); -} - -/** - * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - */ -function baseKeys(object) { - if (!isPrototype(object)) { - return nativeKeys(object); - } - var result = []; - for (var key in Object(object)) { - if (hasOwnProperty.call(object, key) && key != 'constructor') { - result.push(key); - } - } - return result; -} - -/** - * Creates a clone of `buffer`. - * - * @private - * @param {Buffer} buffer The buffer to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Buffer} Returns the cloned buffer. - */ -function cloneBuffer(buffer, isDeep) { - if (isDeep) { - return buffer.slice(); - } - var result = new buffer.constructor(buffer.length); - buffer.copy(result); - return result; -} - -/** - * Creates a clone of `arrayBuffer`. - * - * @private - * @param {ArrayBuffer} arrayBuffer The array buffer to clone. - * @returns {ArrayBuffer} Returns the cloned array buffer. - */ -function cloneArrayBuffer(arrayBuffer) { - var result = new arrayBuffer.constructor(arrayBuffer.byteLength); - new Uint8Array(result).set(new Uint8Array(arrayBuffer)); - return result; -} - -/** - * Creates a clone of `dataView`. - * - * @private - * @param {Object} dataView The data view to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned data view. - */ -function cloneDataView(dataView, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; - return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); -} - -/** - * Creates a clone of `map`. - * - * @private - * @param {Object} map The map to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned map. - */ -function cloneMap(map, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map); - return arrayReduce(array, addMapEntry, new map.constructor); -} - -/** - * Creates a clone of `regexp`. - * - * @private - * @param {Object} regexp The regexp to clone. - * @returns {Object} Returns the cloned regexp. - */ -function cloneRegExp(regexp) { - var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); - result.lastIndex = regexp.lastIndex; - return result; -} - -/** - * Creates a clone of `set`. - * - * @private - * @param {Object} set The set to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned set. - */ -function cloneSet(set, isDeep, cloneFunc) { - var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set); - return arrayReduce(array, addSetEntry, new set.constructor); -} - -/** - * Creates a clone of the `symbol` object. - * - * @private - * @param {Object} symbol The symbol object to clone. - * @returns {Object} Returns the cloned symbol object. - */ -function cloneSymbol(symbol) { - return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; -} - -/** - * Creates a clone of `typedArray`. - * - * @private - * @param {Object} typedArray The typed array to clone. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the cloned typed array. - */ -function cloneTypedArray(typedArray, isDeep) { - var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; - return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); -} - -/** - * Copies the values of `source` to `array`. - * - * @private - * @param {Array} source The array to copy values from. - * @param {Array} [array=[]] The array to copy values to. - * @returns {Array} Returns `array`. - */ -function copyArray(source, array) { - var index = -1, - length = source.length; - - array || (array = Array(length)); - while (++index < length) { - array[index] = source[index]; - } - return array; -} - -/** - * Copies properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy properties from. - * @param {Array} props The property identifiers to copy. - * @param {Object} [object={}] The object to copy properties to. - * @param {Function} [customizer] The function to customize copied values. - * @returns {Object} Returns `object`. - */ -function copyObject(source, props, object, customizer) { - object || (object = {}); - - var index = -1, - length = props.length; - - while (++index < length) { - var key = props[index]; - - var newValue = customizer - ? customizer(object[key], source[key], key, object, source) - : undefined; - - assignValue(object, key, newValue === undefined ? source[key] : newValue); - } - return object; -} - -/** - * Copies own symbol properties of `source` to `object`. - * - * @private - * @param {Object} source The object to copy symbols from. - * @param {Object} [object={}] The object to copy symbols to. - * @returns {Object} Returns `object`. - */ -function copySymbols(source, object) { - return copyObject(source, getSymbols(source), object); -} - -/** - * Creates an array of own enumerable property names and symbols of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names and symbols. - */ -function getAllKeys(object) { - return baseGetAllKeys(object, keys, getSymbols); -} - -/** - * Gets the data for `map`. - * - * @private - * @param {Object} map The map to query. - * @param {string} key The reference key. - * @returns {*} Returns the map data. - */ -function getMapData(map, key) { - var data = map.__data__; - return isKeyable(key) - ? data[typeof key == 'string' ? 'string' : 'hash'] - : data.map; -} - -/** - * Gets the native function at `key` of `object`. - * - * @private - * @param {Object} object The object to query. - * @param {string} key The key of the method to get. - * @returns {*} Returns the function if it's native, else `undefined`. - */ -function getNative(object, key) { - var value = getValue(object, key); - return baseIsNative(value) ? value : undefined; -} - -/** - * Creates an array of the own enumerable symbol properties of `object`. - * - * @private - * @param {Object} object The object to query. - * @returns {Array} Returns the array of symbols. - */ -var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray; - -/** - * Gets the `toStringTag` of `value`. - * - * @private - * @param {*} value The value to query. - * @returns {string} Returns the `toStringTag`. - */ -var getTag = baseGetTag; - -// Fallback for data views, maps, sets, and weak maps in IE 11, -// for data views in Edge < 14, and promises in Node.js. -if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || - (Map && getTag(new Map) != mapTag) || - (Promise && getTag(Promise.resolve()) != promiseTag) || - (Set && getTag(new Set) != setTag) || - (WeakMap && getTag(new WeakMap) != weakMapTag)) { - getTag = function(value) { - var result = objectToString.call(value), - Ctor = result == objectTag ? value.constructor : undefined, - ctorString = Ctor ? toSource(Ctor) : undefined; - - if (ctorString) { - switch (ctorString) { - case dataViewCtorString: return dataViewTag; - case mapCtorString: return mapTag; - case promiseCtorString: return promiseTag; - case setCtorString: return setTag; - case weakMapCtorString: return weakMapTag; - } - } - return result; - }; -} - -/** - * Initializes an array clone. - * - * @private - * @param {Array} array The array to clone. - * @returns {Array} Returns the initialized clone. - */ -function initCloneArray(array) { - var length = array.length, - result = array.constructor(length); - - // Add properties assigned by `RegExp#exec`. - if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { - result.index = array.index; - result.input = array.input; - } - return result; -} - -/** - * Initializes an object clone. - * - * @private - * @param {Object} object The object to clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneObject(object) { - return (typeof object.constructor == 'function' && !isPrototype(object)) - ? baseCreate(getPrototype(object)) - : {}; -} - -/** - * Initializes an object clone based on its `toStringTag`. - * - * **Note:** This function only supports cloning values with tags of - * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. - * - * @private - * @param {Object} object The object to clone. - * @param {string} tag The `toStringTag` of the object to clone. - * @param {Function} cloneFunc The function to clone values. - * @param {boolean} [isDeep] Specify a deep clone. - * @returns {Object} Returns the initialized clone. - */ -function initCloneByTag(object, tag, cloneFunc, isDeep) { - var Ctor = object.constructor; - switch (tag) { - case arrayBufferTag: - return cloneArrayBuffer(object); - - case boolTag: - case dateTag: - return new Ctor(+object); - - case dataViewTag: - return cloneDataView(object, isDeep); - - case float32Tag: case float64Tag: - case int8Tag: case int16Tag: case int32Tag: - case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: - return cloneTypedArray(object, isDeep); - - case mapTag: - return cloneMap(object, isDeep, cloneFunc); - - case numberTag: - case stringTag: - return new Ctor(object); - - case regexpTag: - return cloneRegExp(object); - - case setTag: - return cloneSet(object, isDeep, cloneFunc); - - case symbolTag: - return cloneSymbol(object); - } -} - -/** - * Checks if `value` is a valid array-like index. - * - * @private - * @param {*} value The value to check. - * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. - * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. - */ -function isIndex(value, length) { - length = length == null ? MAX_SAFE_INTEGER : length; - return !!length && - (typeof value == 'number' || reIsUint.test(value)) && - (value > -1 && value % 1 == 0 && value < length); -} - -/** - * Checks if `value` is suitable for use as unique object key. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is suitable, else `false`. - */ -function isKeyable(value) { - var type = typeof value; - return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') - ? (value !== '__proto__') - : (value === null); -} - -/** - * Checks if `func` has its source masked. - * - * @private - * @param {Function} func The function to check. - * @returns {boolean} Returns `true` if `func` is masked, else `false`. - */ -function isMasked(func) { - return !!maskSrcKey && (maskSrcKey in func); -} - -/** - * Checks if `value` is likely a prototype object. - * - * @private - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. - */ -function isPrototype(value) { - var Ctor = value && value.constructor, - proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; - - return value === proto; -} - -/** - * Converts `func` to its source code. - * - * @private - * @param {Function} func The function to process. - * @returns {string} Returns the source code. - */ -function toSource(func) { - if (func != null) { - try { - return funcToString.call(func); - } catch (e) {} - try { - return (func + ''); - } catch (e) {} - } - return ''; -} - -/** - * This method is like `_.clone` except that it recursively clones `value`. - * - * @static - * @memberOf _ - * @since 1.0.0 - * @category Lang - * @param {*} value The value to recursively clone. - * @returns {*} Returns the deep cloned value. - * @see _.clone - * @example - * - * var objects = [{ 'a': 1 }, { 'b': 2 }]; - * - * var deep = _.cloneDeep(objects); - * console.log(deep[0] === objects[0]); - * // => false - */ -function cloneDeep(value) { - return baseClone(value, true, true); -} - -/** - * Performs a - * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) - * comparison between two values to determine if they are equivalent. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to compare. - * @param {*} other The other value to compare. - * @returns {boolean} Returns `true` if the values are equivalent, else `false`. - * @example - * - * var object = { 'a': 1 }; - * var other = { 'a': 1 }; - * - * _.eq(object, object); - * // => true - * - * _.eq(object, other); - * // => false - * - * _.eq('a', 'a'); - * // => true - * - * _.eq('a', Object('a')); - * // => false - * - * _.eq(NaN, NaN); - * // => true - */ -function eq(value, other) { - return value === other || (value !== value && other !== other); -} - -/** - * Checks if `value` is likely an `arguments` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an `arguments` object, - * else `false`. - * @example - * - * _.isArguments(function() { return arguments; }()); - * // => true - * - * _.isArguments([1, 2, 3]); - * // => false - */ -function isArguments(value) { - // Safari 8.1 makes `arguments.callee` enumerable in strict mode. - return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && - (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); -} - -/** - * Checks if `value` is classified as an `Array` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array, else `false`. - * @example - * - * _.isArray([1, 2, 3]); - * // => true - * - * _.isArray(document.body.children); - * // => false - * - * _.isArray('abc'); - * // => false - * - * _.isArray(_.noop); - * // => false - */ -var isArray = Array.isArray; - -/** - * Checks if `value` is array-like. A value is considered array-like if it's - * not a function and has a `value.length` that's an integer greater than or - * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is array-like, else `false`. - * @example - * - * _.isArrayLike([1, 2, 3]); - * // => true - * - * _.isArrayLike(document.body.children); - * // => true - * - * _.isArrayLike('abc'); - * // => true - * - * _.isArrayLike(_.noop); - * // => false - */ -function isArrayLike(value) { - return value != null && isLength(value.length) && !isFunction(value); -} - -/** - * This method is like `_.isArrayLike` except that it also checks if `value` - * is an object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an array-like object, - * else `false`. - * @example - * - * _.isArrayLikeObject([1, 2, 3]); - * // => true - * - * _.isArrayLikeObject(document.body.children); - * // => true - * - * _.isArrayLikeObject('abc'); - * // => false - * - * _.isArrayLikeObject(_.noop); - * // => false - */ -function isArrayLikeObject(value) { - return isObjectLike(value) && isArrayLike(value); -} - -/** - * Checks if `value` is a buffer. - * - * @static - * @memberOf _ - * @since 4.3.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. - * @example - * - * _.isBuffer(new Buffer(2)); - * // => true - * - * _.isBuffer(new Uint8Array(2)); - * // => false - */ -var isBuffer = nativeIsBuffer || stubFalse; - -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a function, else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8-9 which returns 'object' for typed array and other constructors. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -/** - * Checks if `value` is a valid array-like length. - * - * **Note:** This method is loosely based on - * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. - * @example - * - * _.isLength(3); - * // => true - * - * _.isLength(Number.MIN_VALUE); - * // => false - * - * _.isLength(Infinity); - * // => false - * - * _.isLength('3'); - * // => false - */ -function isLength(value) { - return typeof value == 'number' && - value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; -} - -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} - -/** - * Creates an array of the own enumerable property names of `object`. - * - * **Note:** Non-object values are coerced to objects. See the - * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) - * for more details. - * - * @static - * @since 0.1.0 - * @memberOf _ - * @category Object - * @param {Object} object The object to query. - * @returns {Array} Returns the array of property names. - * @example - * - * function Foo() { - * this.a = 1; - * this.b = 2; - * } - * - * Foo.prototype.c = 3; - * - * _.keys(new Foo); - * // => ['a', 'b'] (iteration order is not guaranteed) - * - * _.keys('hi'); - * // => ['0', '1'] - */ -function keys(object) { - return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); -} - -/** - * This method returns a new empty array. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {Array} Returns the new empty array. - * @example - * - * var arrays = _.times(2, _.stubArray); - * - * console.log(arrays); - * // => [[], []] - * - * console.log(arrays[0] === arrays[1]); - * // => false - */ -function stubArray() { - return []; -} - -/** - * This method returns `false`. - * - * @static - * @memberOf _ - * @since 4.13.0 - * @category Util - * @returns {boolean} Returns `false`. - * @example - * - * _.times(2, _.stubFalse); - * // => [false, false] - */ -function stubFalse() { - return false; -} - -module.exports = cloneDeep; diff --git a/node_modules/lodash.clonedeep/package.json b/node_modules/lodash.clonedeep/package.json deleted file mode 100644 index bc21c1cbab..0000000000 --- a/node_modules/lodash.clonedeep/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "lodash.clonedeep", - "version": "4.5.0", - "description": "The lodash method `_.cloneDeep` exported as a module.", - "homepage": "https://lodash.com/", - "icon": "https://lodash.com/icon.svg", - "license": "MIT", - "keywords": "lodash-modularized, clonedeep", - "author": "John-David Dalton (http://allyoucanleet.com/)", - "contributors": [ - "John-David Dalton (http://allyoucanleet.com/)", - "Blaine Bublitz (https://github.com/phated)", - "Mathias Bynens (https://mathiasbynens.be/)" - ], - "repository": "lodash/lodash", - "scripts": { - "test": "echo \"See https://travis-ci.org/lodash/lodash-cli for testing details.\"" - } -} diff --git a/node_modules/postcss-selector-parser/CHANGELOG.md b/node_modules/postcss-selector-parser/CHANGELOG.md index b19edd8576..b97f69af86 100644 --- a/node_modules/postcss-selector-parser/CHANGELOG.md +++ b/node_modules/postcss-selector-parser/CHANGELOG.md @@ -1,3 +1,11 @@ +# 6.0.8 + +- Fixed: reduced size + +# 6.0.7 + +- Fixed: parse animation percents + # 6.0.6 - Fixed: parse quoted attributes containing a newline correctly diff --git a/node_modules/postcss-selector-parser/dist/__tests__/attributes.js b/node_modules/postcss-selector-parser/dist/__tests__/attributes.js deleted file mode 100644 index 800a1a7bda..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/attributes.js +++ /dev/null @@ -1,489 +0,0 @@ -"use strict"; - -var _process = _interopRequireDefault(require("process")); - -var _attribute = _interopRequireDefault(require("../selectors/attribute")); - -var _helpers = require("./util/helpers"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -_process["default"].throwDeprecation = true; -(0, _helpers.test)('attribute selector', '[href]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'attribute'); - t.falsy(tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('attribute selector spaces (before)', '[ href]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.attribute.before, ' '); - t.deepEqual(tree.nodes[0].nodes[0].type, 'attribute'); - t.falsy(tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('attribute selector spaces (after)', '[href ]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.attribute.after, ' '); - t.deepEqual(tree.nodes[0].nodes[0].type, 'attribute'); - t.falsy(tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('attribute selector spaces with namespace (both)', '[ foo|bar ]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].ns, 'foo'); - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'bar'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.attribute.before, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.attribute.after, ' '); - t.deepEqual(tree.nodes[0].nodes[0].type, 'attribute'); - t.falsy(tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('attribute selector spaces (both)', '[ href ]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.attribute.before, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.attribute.after, ' '); - t.deepEqual(tree.nodes[0].nodes[0].type, 'attribute'); - t.falsy(tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('multiple attribute selectors', '[href][class][name]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[1].attribute, 'class'); - t.deepEqual(tree.nodes[0].nodes[2].attribute, 'name'); -}); -(0, _helpers.test)('select elements with or without a namespace', '[*|href]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, '*'); - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); -}); -(0, _helpers.test)('namespace with escapes', '[\\31 \\#\\32 |href]', function (t, tree) { - var attr = tree.nodes[0].nodes[0]; - t.deepEqual(attr.namespace, '1#2'); - t.deepEqual(attr.raws.namespace, '\\31 \\#\\32 '); - attr.namespace = "foo"; - t.deepEqual(attr.namespace, 'foo'); - t.deepEqual(attr.raws.namespace, undefined); - attr.namespace = "1"; - t.deepEqual(attr.namespace, '1'); - t.deepEqual(attr.raws.namespace, '\\31'); -}); -(0, _helpers.test)('attribute selector with a empty value', '[href=""]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, ''); - t["true"](tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('attribute selector with a value', '[name=james]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'name'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'james'); - t.falsy(tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('attribute selector with quoted value', '[name="james"]', function (t, tree) { - var attr = tree.nodes[0].nodes[0]; - t.deepEqual(attr.attribute, 'name'); - t.deepEqual(attr.operator, '='); - t.deepEqual(attr.value, 'james'); - t.deepEqual(attr.quoteMark, '"'); - t.truthy(attr.quoted); - t.deepEqual(attr.getQuotedValue(), '"james"'); -}); -(0, _helpers.test)('attribute selector with escaped quote', '[title="Something \\"weird\\""]', function (t, tree) { - var attr = tree.nodes[0].nodes[0]; - t.deepEqual(attr.value, 'Something "weird"'); - t.deepEqual(attr.getQuotedValue(), '\"Something \\"weird\\"\"'); - t.deepEqual(attr.getQuotedValue({ - smart: true - }), '\'Something "weird"\''); - t.deepEqual(attr.getQuotedValue({ - quoteMark: null - }), 'Something\\ \\"weird\\"'); - t.deepEqual(attr.quoteMark, '"'); - t.truthy(attr.quoted); - t.deepEqual(attr.raws.value, '"Something \\"weird\\""'); - t.deepEqual(tree.toString(), '[title="Something \\"weird\\""]'); -}); -(0, _helpers.test)('attribute selector with escaped colon', '[ng\\:cloak]', function (t, tree) { - t.deepEqual(tree.toString(), '[ng\\:cloak]'); - var attr = tree.nodes[0].nodes[0]; - t.deepEqual(attr.raws.attribute, 'ng\\:cloak'); - t.deepEqual(attr.attribute, 'ng:cloak'); -}); -(0, _helpers.test)('attribute selector with short hex escape', '[ng\\3a cloak]', function (t, tree) { - t.deepEqual(tree.toString(), '[ng\\3a cloak]'); - var attr = tree.nodes[0].nodes[0]; - t.deepEqual(attr.raws.attribute, 'ng\\3a cloak'); - t.deepEqual(attr.attribute, 'ng:cloak'); -}); -(0, _helpers.test)('attribute selector with hex escape', '[ng\\00003acloak]', function (t, tree) { - t.deepEqual(tree.toString(), '[ng\\00003acloak]'); - var attr = tree.nodes[0].nodes[0]; - t.deepEqual(attr.raws.attribute, 'ng\\00003acloak'); - t.deepEqual(attr.attribute, 'ng:cloak'); -}); -(0, _helpers.test)('assign attribute name requiring escape', '[ng\\:cloak]', function (t, tree) { - var attr = tree.nodes[0].nodes[0]; - attr.attribute = "ng:foo"; - t.deepEqual(attr.raws.attribute, 'ng\\:foo'); - t.deepEqual(attr.attribute, 'ng:foo'); - t.deepEqual(tree.toString(), '[ng\\:foo]'); -}); -(0, _helpers.test)('multiple attribute selectors + combinator', '[href][class][name] h1 > h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[2].attribute, 'name'); - t.deepEqual(tree.nodes[0].nodes[3].value, ' '); - t.deepEqual(tree.nodes[0].nodes[5].value, '>'); - t.deepEqual(tree.nodes[0].nodes[6].value, 'h2'); -}); -(0, _helpers.test)('attribute, class, combinator', '[href] > h2.test', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[1].value, '>'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h2'); - t.deepEqual(tree.nodes[0].nodes[3].value, 'test'); -}); -(0, _helpers.test)('attribute selector with quoted value & combinator', '[name="james"] > h1', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'james'); - t.deepEqual(tree.nodes[0].nodes[0].quoteMark, '"'); - t.deepEqual(tree.nodes[0].nodes[1].value, '>'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h1'); -}); -(0, _helpers.test)('multiple quoted attribute selectors', '[href*="test.com"][rel=\'external\'][id][class~="test"] > [name]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'test.com'); - t.is(tree.nodes[0].nodes[0].quoteMark, '"'); - t.deepEqual(tree.nodes[0].nodes[1].attribute, 'rel'); - t.deepEqual(tree.nodes[0].nodes[1].value, 'external'); - t.is(tree.nodes[0].nodes[1].quoteMark, "'"); - t.deepEqual(tree.nodes[0].nodes[2].attribute, 'id'); - t.falsy(tree.nodes[0].nodes[2].value, 'should not have a value'); - t.is(tree.nodes[0].nodes[2].quoteMark, undefined, 'should not have a quoteMark set'); - t.deepEqual(tree.nodes[0].nodes[3].attribute, 'class'); - t.deepEqual(tree.nodes[0].nodes[3].value, 'test'); - t.deepEqual(tree.nodes[0].nodes[3].quoteMark, '"'); - t.deepEqual(tree.nodes[0].nodes[4].value, '>'); - t.deepEqual(tree.nodes[0].nodes[5].attribute, 'name'); - t.falsy(tree.nodes[0].nodes[5].value, 'should not have a value'); - t.is(tree.nodes[0].nodes[5].quoteMark, undefined, 'should not have a quoteMark set'); -}); -(0, _helpers.test)('more attribute operators', '[href*=test],[href^=test],[href$=test],[href|=test]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].operator, '*='); - t.deepEqual(tree.nodes[1].nodes[0].operator, '^='); - t.deepEqual(tree.nodes[2].nodes[0].operator, '$='); - t.deepEqual(tree.nodes[3].nodes[0].operator, '|='); -}); -(0, _helpers.test)('attribute selector with quoted value containing "="', '[data-weird-attr="Something=weird"]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'Something=weird'); - t.is(tree.nodes[0].nodes[0].quoteMark, '"'); - t.deepEqual(tree.nodes[0].nodes[0].getQuotedValue(), '"Something=weird"'); -}); -var selector = '[data-weird-attr*="Something=weird"],' + '[data-weird-attr^="Something=weird"],' + '[data-weird-attr$="Something=weird"],' + '[data-weird-attr|="Something=weird"]'; -(0, _helpers.test)('more attribute selector with quoted value containing "="', selector, function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '*='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'Something=weird'); - t.deepEqual(tree.nodes[1].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[1].nodes[0].operator, '^='); - t.deepEqual(tree.nodes[1].nodes[0].value, 'Something=weird'); - t.deepEqual(tree.nodes[2].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[2].nodes[0].operator, '$='); - t.deepEqual(tree.nodes[2].nodes[0].value, 'Something=weird'); - t.deepEqual(tree.nodes[3].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[3].nodes[0].operator, '|='); - t.deepEqual(tree.nodes[3].nodes[0].value, 'Something=weird'); -}); -(0, _helpers.test)('attribute selector with quoted value containing multiple "="', '[data-weird-attr="Something=weird SomethingElse=weirder"]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'Something=weird SomethingElse=weirder'); -}); -selector = '[data-weird-attr*="Something=weird SomethingElse=weirder"],' + '[data-weird-attr^="Something=weird SomethingElse=weirder"],' + '[data-weird-attr$="Something=weird SomethingElse=weirder"],' + '[data-weird-attr|="Something=weird SomethingElse=weirder"]'; -(0, _helpers.test)('more attribute selector with quoted value containing multiple "="', selector, function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '*='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'Something=weird SomethingElse=weirder'); - t.deepEqual(tree.nodes[1].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[1].nodes[0].operator, '^='); - t.deepEqual(tree.nodes[1].nodes[0].value, 'Something=weird SomethingElse=weirder'); - t.deepEqual(tree.nodes[2].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[2].nodes[0].operator, '$='); - t.deepEqual(tree.nodes[2].nodes[0].value, 'Something=weird SomethingElse=weirder'); - t.deepEqual(tree.nodes[3].nodes[0].attribute, 'data-weird-attr'); - t.deepEqual(tree.nodes[3].nodes[0].operator, '|='); - t.deepEqual(tree.nodes[3].nodes[0].value, 'Something=weird SomethingElse=weirder'); -}); -(0, _helpers.test)('multiple attribute selectors with quoted value containing "="', '[data-weird-foo="foo=weird"][data-weird-bar="bar=weird"]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo=weird'); - t.deepEqual(tree.nodes[0].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[0].nodes[1].operator, '='); - t.deepEqual(tree.nodes[0].nodes[1].value, 'bar=weird'); -}); -(0, _helpers.test)('multiple attribute selectors with value containing escaped "="', '[data-weird-foo=foo\\=weird][data-weird-bar=bar\\3d weird]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo=weird'); - t.deepEqual(tree.nodes[0].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[0].nodes[1].operator, '='); - t.deepEqual(tree.nodes[0].nodes[1].value, 'bar=weird'); -}); -selector = '[data-weird-foo*="foo2=weirder"][data-weird-bar*="bar2=weirder"],' + '[data-weird-foo^="foo2=weirder"][data-weird-bar^="bar2=weirder"],' + '[data-weird-foo$="foo2=weirder"][data-weird-bar$="bar2=weirder"],' + '[data-weird-foo|="foo2=weirder"][data-weird-bar|="bar2=weirder"]'; -(0, _helpers.test)('more multiple attribute selectors with quoted value containing "="', selector, function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '*='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo2=weirder'); - t.deepEqual(tree.nodes[0].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[0].nodes[1].operator, '*='); - t.deepEqual(tree.nodes[0].nodes[1].value, 'bar2=weirder'); - t.deepEqual(tree.nodes[1].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[1].nodes[0].operator, '^='); - t.deepEqual(tree.nodes[1].nodes[0].value, 'foo2=weirder'); - t.deepEqual(tree.nodes[1].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[1].nodes[1].operator, '^='); - t.deepEqual(tree.nodes[1].nodes[1].value, 'bar2=weirder'); - t.deepEqual(tree.nodes[2].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[2].nodes[0].operator, '$='); - t.deepEqual(tree.nodes[2].nodes[0].value, 'foo2=weirder'); - t.deepEqual(tree.nodes[2].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[2].nodes[1].operator, '$='); - t.deepEqual(tree.nodes[2].nodes[1].value, 'bar2=weirder'); - t.deepEqual(tree.nodes[3].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[3].nodes[0].operator, '|='); - t.deepEqual(tree.nodes[3].nodes[0].value, 'foo2=weirder'); - t.deepEqual(tree.nodes[3].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[3].nodes[1].operator, '|='); - t.deepEqual(tree.nodes[3].nodes[1].value, 'bar2=weirder'); -}); -(0, _helpers.test)('multiple attribute selectors with quoted value containing multiple "="', '[data-weird-foo="foo1=weirder foo2=weirder"][data-weird-bar="bar1=weirder bar2=weirder"]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo1=weirder foo2=weirder'); - t.deepEqual(tree.nodes[0].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[0].nodes[1].operator, '='); - t.deepEqual(tree.nodes[0].nodes[1].value, 'bar1=weirder bar2=weirder'); -}); -selector = '[data-weird-foo*="foo1=weirder foo2=weirder"][data-weird-bar*="bar1=weirder bar2=weirder"],' + '[data-weird-foo^="foo1=weirder foo2=weirder"][data-weird-bar^="bar1=weirder bar2=weirder"],' + '[data-weird-foo$="foo1=weirder foo2=weirder"][data-weird-bar$="bar1=weirder bar2=weirder"],' + '[data-weird-foo|="foo1=weirder foo2=weirder"][data-weird-bar|="bar1=weirder bar2=weirder"]'; -(0, _helpers.test)('more multiple attribute selectors with quoted value containing multiple "="', selector, function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '*='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo1=weirder foo2=weirder'); - t.deepEqual(tree.nodes[0].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[0].nodes[1].operator, '*='); - t.deepEqual(tree.nodes[0].nodes[1].value, 'bar1=weirder bar2=weirder'); - t.deepEqual(tree.nodes[1].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[1].nodes[0].operator, '^='); - t.deepEqual(tree.nodes[1].nodes[0].value, 'foo1=weirder foo2=weirder'); - t.deepEqual(tree.nodes[1].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[1].nodes[1].operator, '^='); - t.deepEqual(tree.nodes[1].nodes[1].value, 'bar1=weirder bar2=weirder'); - t.deepEqual(tree.nodes[2].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[2].nodes[0].operator, '$='); - t.deepEqual(tree.nodes[2].nodes[0].value, 'foo1=weirder foo2=weirder'); - t.deepEqual(tree.nodes[2].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[2].nodes[1].operator, '$='); - t.deepEqual(tree.nodes[2].nodes[1].value, 'bar1=weirder bar2=weirder'); - t.deepEqual(tree.nodes[3].nodes[0].attribute, 'data-weird-foo'); - t.deepEqual(tree.nodes[3].nodes[0].operator, '|='); - t.deepEqual(tree.nodes[3].nodes[0].value, 'foo1=weirder foo2=weirder'); - t.deepEqual(tree.nodes[3].nodes[1].attribute, 'data-weird-bar'); - t.deepEqual(tree.nodes[3].nodes[1].operator, '|='); - t.deepEqual(tree.nodes[3].nodes[1].value, 'bar1=weirder bar2=weirder'); -}); -(0, _helpers.test)('spaces in attribute selectors', 'h1[ href *= "test" ]', function (t, tree) { - var attr = tree.nodes[0].nodes[1]; - t.deepEqual(attr.attribute, 'href'); - t.deepEqual(attr.spaces.attribute.before, ' '); - t.deepEqual(attr.spaces.attribute.after, ' '); - t.deepEqual(attr.operator, '*='); - t.deepEqual(attr.spaces.operator.after, ' '); - t.deepEqual(attr.value, 'test'); - t.deepEqual(attr.spaces.value.after, ' '); - t.truthy(tree.nodes[0].nodes[1].quoted); -}); -(0, _helpers.test)('insensitive attribute selector 1', '[href="test" i]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'test'); - t.deepEqual(tree.nodes[0].nodes[0].insensitive, true); - t.deepEqual(tree.nodes[0].nodes[0].insensitive, true); -}); -(0, _helpers.test)('insensitive attribute selector with a empty value', '[href="" i]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, ''); - t.deepEqual(tree.nodes[0].nodes[0].insensitive, true); - t["true"](tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('insensitive attribute selector 2', '[href=TEsT i ]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'TEsT'); - t.deepEqual(tree.nodes[0].nodes[0].insensitive, true); - t.deepEqual(tree.nodes[0].nodes[0].spaces.value.after, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.insensitive.after, ' '); -}); -(0, _helpers.test)('insensitive attribute selector 3', '[href=test i]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'test'); - t.deepEqual(tree.nodes[0].nodes[0].insensitive, true); -}); -(0, _helpers.test)('capitalized insensitive attribute selector 3', '[href=test I]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'test'); - t.deepEqual(tree.nodes[0].nodes[0].insensitive, true); -}); -(0, _helpers.test)('extraneous non-combinating whitespace', ' [href] , [class] ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.after, ' '); - t.deepEqual(tree.nodes[1].nodes[0].attribute, 'class'); - t.deepEqual(tree.nodes[1].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[1].nodes[0].spaces.after, ' '); -}); -(0, _helpers.test)('newline in attribute selector', '[class="woop \\\nwoop woop"]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'woop \nwoop woop'); - t["true"](tree.nodes[0].nodes[0].quoted); -}); -(0, _helpers.test)('comments within attribute selectors', '[href/* wow */=/* wow */test]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'test'); - t.deepEqual(tree.nodes[0].nodes[0].raws.attribute, 'href/* wow */'); - t.deepEqual(tree.nodes[0].nodes[0].raws.operator, '=/* wow */'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'test'); -}); -(0, _helpers.test)('comments within attribute selectors (2)', '[/* wow */href=test/* wow */]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].value, 'test'); - t.deepEqual(tree.nodes[0].nodes[0].raws.spaces.attribute.before, '/* wow */'); - t.deepEqual(tree.nodes[0].nodes[0].operator, '='); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'test/* wow */'); -}); -(0, _helpers.test)('comments within attribute selectors (3)', '[href=test/* wow */i]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'testi'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'test/* wow */i'); - t.falsy(tree.nodes[0].nodes[0].insensitive); -}); -(0, _helpers.test)('comments within attribute selectors (4)', '[ /*before*/ href /* after-attr */ = /* after-operator */ te/*inside-value*/st/* wow */ /*omg*/i/*bbq*/ /*whodoesthis*/]', function (t, tree) { - var attr = tree.nodes[0].nodes[0]; - t.deepEqual(attr.attribute, 'href'); - t.deepEqual(attr.value, 'test'); - t.deepEqual(attr.getQuotedValue(), 'test'); - t.deepEqual(attr.raws.value, 'te/*inside-value*/st'); - t.deepEqual(attr.raws.spaces.value.after, '/* wow */ /*omg*/'); - t.truthy(attr.insensitive); - t.deepEqual(attr.offsetOf("attribute"), 13); - t.deepEqual(attr.offsetOf("operator"), 35); - t.deepEqual(attr.offsetOf("insensitive"), 95); - t.deepEqual(attr.raws.spaces.insensitive.after, '/*bbq*/ /*whodoesthis*/'); - attr.value = "foo"; - t.is(attr.raws.value, undefined); -}); -(0, _helpers.test)('non standard modifiers', '[href="foo" y]', function (t, tree) { - var attr = tree.atPosition(1, 13); - t.deepEqual(attr.insensitive, false); - t.deepEqual(attr.insensitiveFlag, ''); - t.deepEqual(attr.raws.insensitiveFlag, 'y'); - t.deepEqual(tree.toString(), '[href="foo" y]'); -}); -(0, _helpers.test)('comment after insensitive(non space)', '[href="foo" i/**/]', function (t, tree) { - // https://github.com/postcss/postcss-selector-parser/issues/150 - var attr = tree.atPosition(1, 13); - t.deepEqual(attr.insensitive, true); - t.deepEqual(attr.insensitiveFlag, 'i'); - t.is(attr.raws.insensitiveFlag, undefined); - t.deepEqual(attr.raws.spaces.insensitive.after, '/**/'); - t.deepEqual(tree.toString(), '[href="foo" i/**/]'); -}); -(0, _helpers.test)('comment after insensitive(space after)', '[href="foo" i/**/ ]', function (t, tree) { - var attr = tree.atPosition(1, 13); - t.deepEqual(attr.insensitive, true); - t.deepEqual(attr.insensitiveFlag, 'i'); - t.deepEqual(attr.raws.spaces.insensitive.after, '/**/ '); - t.deepEqual(tree.toString(), '[href="foo" i/**/ ]'); -}); -(0, _helpers.test)('comment after insensitive(space before)', '[href="foo" i /**/]', function (t, tree) { - var attr = tree.atPosition(1, 13); - t.deepEqual(attr.insensitive, true); - t.deepEqual(attr.insensitiveFlag, 'i'); - t.deepEqual(attr.raws.spaces.insensitive.after, ' /**/'); - t.deepEqual(tree.toString(), '[href="foo" i /**/]'); -}); -var testDeprecation = (0, _helpers.nodeVersionAtLeast)('7.0.0') || (0, _helpers.nodeVersionBefore)('6.0.0') ? _helpers.test : _helpers.test.skip; -testDeprecation('deprecated constructor', '', function (t) { - t["throws"](function () { - return new _attribute["default"]({ - value: '"foo"', - attribute: "data-bar" - }); - }, { - message: "Constructing an Attribute selector with a value without specifying quoteMark is deprecated. Note: The value should be unescaped now." - }); -}); -testDeprecation('deprecated get of raws.unquoted ', '', function (t) { - t["throws"](function () { - var attr = new _attribute["default"]({ - value: 'foo', - quoteMark: '"', - attribute: "data-bar" - }); - return attr.raws.unquoted; - }, { - message: "attr.raws.unquoted is deprecated. Call attr.value instead." - }); -}); -testDeprecation('deprecated set of raws.unquoted ', '', function (t) { - t["throws"](function () { - var attr = new _attribute["default"]({ - value: 'foo', - quoteMark: '"', - attribute: "data-bar" - }); - attr.raws.unquoted = 'fooooo'; - }, { - message: "Setting attr.raws.unquoted is deprecated and has no effect. attr.value is unescaped by default now." - }); -}); -testDeprecation('smart quotes', '[data-foo=bar]', function (t, tree) { - var attr = tree.nodes[0].nodes[0]; - attr.setValue('changed', { - quoteMark: '"' - }); - t.deepEqual(attr.toString(), '[data-foo="changed"]'); - attr.setValue('changed again', { - quoteMark: "'", - preferCurrentQuoteMark: true - }); - t.deepEqual(attr.toString(), '[data-foo="changed again"]'); - attr.setValue('smart-ident', { - smart: true - }); - t.deepEqual(attr.toString(), '[data-foo=smart-ident]'); - attr.setValue('smart quoted', { - smart: true - }); - t.deepEqual(attr.toString(), '[data-foo=smart\\ quoted]'); - attr.setValue('smart quoted three spaces', { - smart: true - }); - t.deepEqual(attr.toString(), '[data-foo="smart quoted three spaces"]'); - attr.setValue('smart quoted three spaces', { - smart: true, - quoteMark: "'" - }); - t.deepEqual(attr.toString(), "[data-foo='smart quoted three spaces']"); - attr.setValue("smart with 'single quotes'", { - smart: true - }); - t.deepEqual(attr.toString(), "[data-foo=\"smart with 'single quotes'\"]"); - attr.setValue('smart with "double quotes"', { - smart: true - }); - t.deepEqual(attr.toString(), "[data-foo='smart with \"double quotes\"']"); -}); -testDeprecation('set Attribute#quoteMark', '[data-foo=bar]', function (t, tree) { - var attr = tree.nodes[0].nodes[0]; - attr.quoteMark = '"'; - t.deepEqual(attr.toString(), '[data-foo="bar"]'); - attr.quoteMark = "'"; - t.deepEqual(attr.toString(), "[data-foo='bar']"); - attr.quoteMark = null; - t.deepEqual(attr.toString(), "[data-foo=bar]"); - attr.value = "has space"; - t.deepEqual(attr.toString(), "[data-foo=has\\ space]"); - attr.quoteMark = '"'; - t.deepEqual(attr.toString(), '[data-foo="has space"]'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/classes.js b/node_modules/postcss-selector-parser/dist/__tests__/classes.js deleted file mode 100644 index 28526a5ed0..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/classes.js +++ /dev/null @@ -1,226 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('class name', '.one', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'one'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('multiple class names', '.one.two.three', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'one'); - t.deepEqual(tree.nodes[0].nodes[1].value, 'two'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'three'); -}); -(0, _helpers.test)('qualified class', 'button.btn-primary', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'class'); -}); -(0, _helpers.test)('escaped numbers in class name', '.\\31\\ 0', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].value, '1 0'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31\\ 0'); -}); -(0, _helpers.test)('extraneous non-combinating whitespace', ' .h1 , .h2 ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.after, ' '); - t.deepEqual(tree.nodes[1].nodes[0].value, 'h2'); - t.deepEqual(tree.nodes[1].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[1].nodes[0].spaces.after, ' '); -}); -(0, _helpers.test)('Less interpolation within a class', '.foo@{bar}', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes.length, 1); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo@{bar}'); -}); -(0, _helpers.test)('ClassName#set value', ".fo\\o", function (t, selectors) { - var className = selectors.first.first; - t.deepEqual(className.raws, { - value: "fo\\o" - }); - className.value = "bar"; - t.deepEqual(className.raws, {}); -}); -(0, _helpers.test)('escaped dot in class name', '.foo\\.bar', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo.bar'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'foo\\.bar'); -}); -(0, _helpers.test)('class selector with escaping', '.♥', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '♥'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('class selector with escaping (1)', '.©', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '©'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('class selector with escaping (2)', '.“‘’”', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '“‘’”'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('class selector with escaping (3)', '.☺☃', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '☺☃'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('class selector with escaping (4)', '.⌘⌥', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '⌘⌥'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('class selector with escaping (5)', '.𝄞♪♩♫♬', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '𝄞♪♩♫♬'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('class selector with escaping (6)', '.💩', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '💩'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('class selector with escaping (7)', '.\\?', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '?'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\?'); -}); -(0, _helpers.test)('class selector with escaping (8)', '.\\@', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '@'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\@'); -}); -(0, _helpers.test)('class selector with escaping (9)', '.\\.', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '.'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\.'); -}); -(0, _helpers.test)('class selector with escaping (10)', '.\\3A \\)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':)'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A \\)'); -}); -(0, _helpers.test)('class selector with escaping (11)', '.\\3A \\`\\(', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':`('); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A \\`\\('); -}); -(0, _helpers.test)('class selector with escaping (12)', '.\\31 23', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '123'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31 23'); -}); -(0, _helpers.test)('class selector with escaping (13)', '.\\31 a2b3c', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '1a2b3c'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31 a2b3c'); -}); -(0, _helpers.test)('class selector with escaping (14)', '.\\', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '

'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\'); -}); -(0, _helpers.test)('class selector with escaping (15)', '.\\<\\>\\<\\<\\<\\>\\>\\<\\>', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '<><<<>><>'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\<\\>\\<\\<\\<\\>\\>\\<\\>'); -}); -(0, _helpers.test)('class selector with escaping (16)', '.\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\.', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\.'); -}); -(0, _helpers.test)('class selector with escaping (17)', '.\\#', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '#'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#'); -}); -(0, _helpers.test)('class selector with escaping (18)', '.\\#\\#', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '##'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#\\#'); -}); -(0, _helpers.test)('class selector with escaping (19)', '.\\#\\.\\#\\.\\#', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '#.#.#'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#\\.\\#\\.\\#'); -}); -(0, _helpers.test)('class selector with escaping (20)', '.\\_', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '_'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\_'); -}); -(0, _helpers.test)('class selector with escaping (21)', '.\\{\\}', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '{}'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\{\\}'); -}); -(0, _helpers.test)('class selector with escaping (22)', '.\\#fake\\-id', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '#fake-id'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#fake\\-id'); -}); -(0, _helpers.test)('class selector with escaping (23)', '.foo\\.bar', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo.bar'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'foo\\.bar'); -}); -(0, _helpers.test)('class selector with escaping (24)', '.\\3A hover', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':hover'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A hover'); -}); -(0, _helpers.test)('class selector with escaping (25)', '.\\3A hover\\3A focus\\3A active', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':hover:focus:active'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A hover\\3A focus\\3A active'); -}); -(0, _helpers.test)('class selector with escaping (26)', '.\\[attr\\=value\\]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '[attr=value]'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\[attr\\=value\\]'); -}); -(0, _helpers.test)('class selector with escaping (27)', '.f\\/o\\/o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f/o/o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\/o\\/o'); -}); -(0, _helpers.test)('class selector with escaping (28)', '.f\\\\o\\\\o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f\\o\\o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\\\o\\\\o'); -}); -(0, _helpers.test)('class selector with escaping (29)', '.f\\*o\\*o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f*o*o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\*o\\*o'); -}); -(0, _helpers.test)('class selector with escaping (30)', '.f\\!o\\!o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f!o!o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\!o\\!o'); -}); -(0, _helpers.test)('class selector with escaping (31)', '.f\\\'o\\\'o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f\'o\'o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\\'o\\\'o'); -}); -(0, _helpers.test)('class selector with escaping (32)', '.f\\~o\\~o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f~o~o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\~o\\~o'); -}); -(0, _helpers.test)('class selector with escaping (33)', '.f\\+o\\+o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f+o+o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\+o\\+o'); -}); -(0, _helpers.test)('class selector with escaping (34)', '.\\1D306', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '𝌆'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\1D306'); -}); -(0, _helpers.test)('class selector with escaping (35)', '.not-pseudo\\:focus', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'not-pseudo:focus'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'not-pseudo\\:focus'); -}); -(0, _helpers.test)('class selector with escaping (36)', '.not-pseudo\\:\\:focus', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'not-pseudo::focus'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'not-pseudo\\:\\:focus'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/combinators.js b/node_modules/postcss-selector-parser/dist/__tests__/combinators.js deleted file mode 100644 index 93de971f1a..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/combinators.js +++ /dev/null @@ -1,148 +0,0 @@ -"use strict"; - -var _types = require("../selectors/types"); - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('multiple combinating spaces', 'h1 h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[1].value, ' '); - t.deepEqual(tree.nodes[0].nodes[1].toString(), ' '); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h2'); -}); -(0, _helpers.test)('column combinator', '.selected||td', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'selected'); - t.deepEqual(tree.nodes[0].nodes[1].value, '||'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'td'); -}); -(0, _helpers.test)('column combinator (2)', '.selected || td', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'selected'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[1].value, '||'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.after, ' '); - t.deepEqual(tree.nodes[0].nodes[2].value, 'td'); -}); -(0, _helpers.test)('descendant combinator', 'h1 h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[1].value, ' '); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h2'); -}); -(0, _helpers.test)('multiple descendant combinators', 'h1 h2 h3 h4', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, ' ', 'should have a combinator'); - t.deepEqual(tree.nodes[0].nodes[3].value, ' ', 'should have a combinator'); - t.deepEqual(tree.nodes[0].nodes[5].value, ' ', 'should have a combinator'); -}); -(0, _helpers.test)('adjacent sibling combinator', 'h1~h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[1].value, '~'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h2'); -}); -(0, _helpers.test)('adjacent sibling combinator (2)', 'h1 ~h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[1].value, '~'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h2'); -}); -(0, _helpers.test)('adjacent sibling combinator (3)', 'h1~ h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[1].value, '~'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.after, ' '); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h2'); -}); -(0, _helpers.test)('adjacent sibling combinator (4)', 'h1 ~ h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[1].value, '~'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.after, ' '); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h2'); -}); -(0, _helpers.test)('adjacent sibling combinator (5)', 'h1~h2~h3', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[1].value, '~'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'h2'); - t.deepEqual(tree.nodes[0].nodes[3].value, '~'); - t.deepEqual(tree.nodes[0].nodes[4].value, 'h3'); -}); -(0, _helpers.test)('piercing combinator', '.a >>> .b', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'a'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[1].value, '>>>'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.after, ' '); - t.deepEqual(tree.nodes[0].nodes[2].value, 'b'); -}); -(0, _helpers.test)('named combinators', 'a /deep/ b', function (t, tree) { - var nodes = tree.nodes[0].nodes; - t.deepEqual(nodes[0].value, 'a'); - t.deepEqual(nodes[1].type, _types.COMBINATOR); - t.deepEqual(nodes[1].toString(), ' /deep/ '); - t.deepEqual(nodes[1].value, '/deep/'); - t.deepEqual(nodes[2].value, 'b'); -}); -(0, _helpers.test)('named combinators with escapes', 'a /dee\\p/ b', function (t, tree) { - var nodes = tree.nodes[0].nodes; - t.deepEqual(nodes[0].value, 'a'); - t.deepEqual(nodes[1].type, _types.COMBINATOR); - t.deepEqual(nodes[1].toString(), ' /dee\\p/ '); - t.deepEqual(nodes[1].value, '/deep/'); - t.deepEqual(nodes[2].value, 'b'); -}); -(0, _helpers.test)('named combinators with escapes and uppercase', 'a /DeE\\p/ b', function (t, tree) { - var nodes = tree.nodes[0].nodes; - t.deepEqual(nodes[0].value, 'a'); - t.deepEqual(nodes[1].type, _types.COMBINATOR); - t.deepEqual(nodes[1].toString(), ' /DeE\\p/ '); - t.deepEqual(nodes[1].value, '/deep/'); - t.deepEqual(nodes[2].value, 'b'); -}); -(0, _helpers.test)('multiple combinators', 'h1~h2>h3', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, '~', 'should have a combinator'); - t.deepEqual(tree.nodes[0].nodes[3].value, '>', 'should have a combinator'); -}); -(0, _helpers.test)('multiple combinators with whitespaces', 'h1 + h2 > h3', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, '+', 'should have a combinator'); - t.deepEqual(tree.nodes[0].nodes[3].value, '>', 'should have a combinator'); -}); -(0, _helpers.test)('multiple combinators with whitespaces (2)', 'h1+ h2 >h3', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, '+', 'should have a combinator'); - t.deepEqual(tree.nodes[0].nodes[3].value, '>', 'should have a combinator'); -}); -(0, _helpers.test)('trailing combinator & spaces', 'p + ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'p', 'should be a paragraph'); - t.deepEqual(tree.nodes[0].nodes[1].value, '+', 'should have a combinator'); -}); -(0, _helpers.test)('trailing sibling combinator', 'p ~', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'p', 'should be a paragraph'); - t.deepEqual(tree.nodes[0].nodes[1].value, '~', 'should have a combinator'); -}); -(0, _helpers.test)('ending in comment has no trailing combinator', ".bar /* comment 3 */", function (t, tree) { - var nodeTypes = tree.nodes[0].map(function (n) { - return n.type; - }); - t.deepEqual(nodeTypes, ["class"]); -}); -(0, _helpers.test)('The combinating space is not a space character', ".bar\n.baz", function (t, tree) { - var nodeTypes = tree.nodes[0].map(function (n) { - return n.type; - }); - t.deepEqual(nodeTypes, ["class", "combinator", "class"]); - t.deepEqual(tree.nodes[0].nodes[1].value, ' ', 'should have a combinator'); - t.deepEqual(tree.nodes[0].nodes[1].raws.value, '\n', 'should have a raw combinator value'); -}); -(0, _helpers.test)('with spaces and a comment has only one combinator', ".bar /* comment 3 */ > .foo", function (t, tree) { - var nodeTypes = tree.nodes[0].map(function (n) { - return n.type; - }); - t.deepEqual(nodeTypes, ["class", "combinator", "class"]); -}); -(0, _helpers.test)('with a meaningful comment in the middle of a compound selector', "div/* wtf */.foo", function (t, tree) { - var nodeTypes = tree.nodes[0].map(function (n) { - return n.type; - }); - t.deepEqual(nodeTypes, ["tag", "comment", "class"]); -}); -(0, _helpers.test)('with a comment in the middle of a descendant selector', "div/* wtf */ .foo", function (t, tree) { - var nodeTypes = tree.nodes[0].map(function (n) { - return n.type; - }); - t.deepEqual(nodeTypes, ["tag", "comment", "combinator", "class"]); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/comments.js b/node_modules/postcss-selector-parser/dist/__tests__/comments.js deleted file mode 100644 index d317e8a9a2..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/comments.js +++ /dev/null @@ -1,81 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('comments', '/*test comment*/h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '/*test comment*/'); - t.deepEqual(tree.nodes[0].nodes[1].value, 'h2'); -}); -(0, _helpers.test)('comments (2)', '.a /*test comment*/label', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator'); - t.deepEqual(tree.nodes[0].nodes[1].value, ' '); - t.deepEqual(tree.nodes[0].nodes[1].spaces.after, ' '); - t.deepEqual(tree.nodes[0].nodes[1].rawSpaceAfter, ' /*test comment*/'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'tag'); -}); -(0, _helpers.test)('comments (3)', '.a /*test comment*/ label', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator'); - t.deepEqual(tree.nodes[0].nodes[1].value, ' '); - t.deepEqual(tree.nodes[0].nodes[1].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[1].rawSpaceBefore, ' /*test comment*/ '); - t.deepEqual(tree.nodes[0].nodes[2].type, 'tag'); -}); -(0, _helpers.test)('multiple comments and other things', 'h1/*test*/h2/*test*/.test/*test*/', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag', 'should have a tag'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'comment', 'should have a comment'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'tag', 'should have a tag'); - t.deepEqual(tree.nodes[0].nodes[3].type, 'comment', 'should have a comment'); - t.deepEqual(tree.nodes[0].nodes[4].type, 'class', 'should have a class name'); - t.deepEqual(tree.nodes[0].nodes[5].type, 'comment', 'should have a comment'); -}); -(0, _helpers.test)('ending in comment', ".bar /* comment 3 */", function (t, tree) { - var classname = tree.nodes[0].nodes[0]; - t.deepEqual(classname.type, 'class', 'should have a tag'); - t.deepEqual(classname.spaces.after, ' '); - t.deepEqual(classname.raws.spaces.after, ' /* comment 3 */'); -}); -(0, _helpers.test)('comments in selector list', 'h2, /*test*/ h4', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'h2'); - t.deepEqual(tree.nodes[1].nodes[0].rawSpaceBefore, ' '); - t.deepEqual(tree.nodes[1].nodes[0].type, 'comment'); - t.deepEqual(tree.nodes[1].nodes[0].value, '/*test*/'); - t.deepEqual(tree.nodes[1].nodes[1].rawSpaceBefore, ' '); - t.deepEqual(tree.nodes[1].nodes[1].type, 'tag'); - t.deepEqual(tree.nodes[1].nodes[1].value, 'h4'); -}); -(0, _helpers.test)('comments in selector list (2)', 'h2,/*test*/h4', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'h2'); - t.deepEqual(tree.nodes[1].nodes[0].rawSpaceBefore, ''); - t.deepEqual(tree.nodes[1].nodes[0].type, 'comment'); - t.deepEqual(tree.nodes[1].nodes[0].value, '/*test*/'); - t.deepEqual(tree.nodes[1].nodes[1].type, 'tag'); - t.deepEqual(tree.nodes[1].nodes[1].value, 'h4'); - t.deepEqual(tree.nodes[1].nodes[1].rawSpaceBefore, ''); -}); -(0, _helpers.test)('comments in selector list (3)', 'h2/*test*/, h4', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'h2'); - t.deepEqual(tree.nodes[0].nodes[1].rawSpaceBefore, ''); - t.deepEqual(tree.nodes[0].nodes[1].type, 'comment'); - t.deepEqual(tree.nodes[0].nodes[1].value, '/*test*/'); - t.deepEqual(tree.nodes[1].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[1].nodes[0].value, 'h4'); - t.deepEqual(tree.nodes[1].nodes[0].rawSpaceBefore, ' '); -}); -(0, _helpers.test)('comments in selector list (4)', 'h2, /*test*/ /*test*/ h4', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'h2'); - t.deepEqual(tree.nodes[1].nodes[0].rawSpaceBefore, ' '); - t.deepEqual(tree.nodes[1].nodes[0].type, 'comment'); - t.deepEqual(tree.nodes[1].nodes[0].value, '/*test*/'); - t.deepEqual(tree.nodes[1].nodes[1].rawSpaceBefore, ' '); - t.deepEqual(tree.nodes[1].nodes[1].type, 'comment'); - t.deepEqual(tree.nodes[1].nodes[1].value, '/*test*/'); - t.deepEqual(tree.nodes[1].nodes[2].rawSpaceBefore, ' '); - t.deepEqual(tree.nodes[1].nodes[2].type, 'tag'); - t.deepEqual(tree.nodes[1].nodes[2].value, 'h4'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/container.js b/node_modules/postcss-selector-parser/dist/__tests__/container.js deleted file mode 100644 index 6a99e9c19c..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/container.js +++ /dev/null @@ -1,393 +0,0 @@ -"use strict"; - -var _ava = _interopRequireDefault(require("ava")); - -var _ = _interopRequireDefault(require("..")); - -var _helpers = require("./util/helpers"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -(0, _ava["default"])('container#append', function (t) { - var out = (0, _helpers.parse)('h1', function (selectors) { - var selector = selectors.first; - var clone = selector.first.clone({ - value: 'h2' - }); - selectors.append(clone); - }); - t.deepEqual(out, 'h1,h2'); -}); -(0, _ava["default"])('container#prepend', function (t) { - var out = (0, _helpers.parse)('h2', function (selectors) { - var selector = selectors.first; - var clone = selector.first.clone({ - value: 'h1' - }); - selectors.prepend(clone); - }); - t.deepEqual(out, 'h1,h2'); -}); -(0, _ava["default"])('container#each', function (t) { - var str = ''; - (0, _helpers.parse)('h1, h2:not(h3, h4)', function (selectors) { - selectors.each(function (selector) { - if (selector.first.type === 'tag') { - str += selector.first.value; - } - }); - }); - t.deepEqual(str, 'h1h2'); -}); -(0, _ava["default"])('container#each (safe iteration)', function (t) { - var out = (0, _helpers.parse)('.x, .y', function (selectors) { - selectors.each(function (selector) { - selector.parent.insertBefore(selector, _["default"].className({ - value: 'b' - })); - selector.parent.insertAfter(selector, _["default"].className({ - value: 'a' - })); - }); - }); - t.deepEqual(out, '.b,.x,.a,.b, .y,.a'); -}); -(0, _ava["default"])('container#each (early exit)', function (t) { - var str = ''; - (0, _helpers.parse)('h1, h2, h3, h4', function (selectors) { - var eachReturn = selectors.each(function (selector) { - var tag = selector.first.value; - str += tag; - return tag !== 'h2'; - }); - t["false"](eachReturn); - }); - t.deepEqual(str, 'h1h2'); -}); -(0, _ava["default"])('container#walk', function (t) { - var str = ''; - (0, _helpers.parse)('h1, h2:not(h3, h4)', function (selectors) { - selectors.walk(function (selector) { - if (selector.type === 'tag') { - str += selector.value; - } - }); - }); - t.deepEqual(str, 'h1h2h3h4'); -}); -(0, _ava["default"])('container#walk (safe iteration)', function (t) { - var out = (0, _helpers.parse)('[class] + *[href] *:not(*.green)', function (selectors) { - selectors.walkUniversals(function (selector) { - var next = selector.next(); - - if (next && next.type !== 'combinator') { - selector.remove(); - } - }); - }); - t.deepEqual(out, '[class] + [href] :not(.green)'); -}); -(0, _ava["default"])('container#walk (early exit)', function (t) { - var str = ''; - (0, _helpers.parse)('h1, h2:not(h3, h4)', function (selectors) { - var walkReturn = selectors.walk(function (selector) { - if (selector.type === 'tag') { - var tag = selector.value; - str += tag; - return tag !== 'h3'; - } - }); - t["false"](walkReturn); - }); - t.deepEqual(str, 'h1h2h3'); -}); -(0, _ava["default"])('container#walkAttribute', function (t) { - var out = (0, _helpers.parse)('[href][class].class', function (selectors) { - selectors.walkAttributes(function (attr) { - if (attr.attribute === 'class') { - attr.remove(); - } - }); - }); - t.deepEqual(out, '[href].class'); -}); -(0, _ava["default"])('container#walkClass', function (t) { - var out = (0, _helpers.parse)('.one, .two, .three:not(.four, .five)', function (selectors) { - selectors.walkClasses(function (className) { - className.value = className.value.slice(0, 1); - }); - }); - t.deepEqual(out, '.o, .t, .t:not(.f, .f)'); -}); -(0, _ava["default"])('container#walkCombinator', function (t) { - var out = (0, _helpers.parse)('h1 h2 h3 h4', function (selectors) { - selectors.walkCombinators(function (comment) { - comment.remove(); - }); - }); - t.deepEqual(out, 'h1h2h3h4'); -}); -(0, _ava["default"])('container#walkComment', function (t) { - var out = (0, _helpers.parse)('.one/*test*/.two', function (selectors) { - selectors.walkComments(function (comment) { - comment.remove(); - }); - }); - t.deepEqual(out, '.one.two'); -}); -(0, _ava["default"])('container#walkId', function (t) { - var out = (0, _helpers.parse)('h1#one, h2#two', function (selectors) { - selectors.walkIds(function (id) { - id.value = id.value.slice(0, 1); - }); - }); - t.deepEqual(out, 'h1#o, h2#t'); -}); -(0, _ava["default"])('container#walkNesting', function (t) { - var out = (0, _helpers.parse)('& h1', function (selectors) { - selectors.walkNesting(function (node) { - node.replaceWith(_["default"].tag({ - value: 'body' - })); - }); - }); - t.deepEqual(out, 'body h1'); -}); -(0, _ava["default"])('container#walkPseudo', function (t) { - var out = (0, _helpers.parse)('a:before, a:after', function (selectors) { - selectors.walkPseudos(function (pseudo) { - pseudo.value = pseudo.value.slice(0, 2); - }); - }); - t.deepEqual(out, 'a:b, a:a'); -}); -(0, _ava["default"])('container#walkTag', function (t) { - var out = (0, _helpers.parse)('1 2 3', function (selectors) { - selectors.walkTags(function (tag) { - tag.value = 'h' + tag.value; - }); - }); - t.deepEqual(out, 'h1 h2 h3'); -}); -(0, _ava["default"])('container#walkUniversal', function (t) { - var out = (0, _helpers.parse)('*.class,*.class,*.class', function (selectors) { - selectors.walkUniversals(function (universal) { - universal.remove(); - }); - }); - t.deepEqual(out, '.class,.class,.class'); -}); -(0, _ava["default"])('container#map', function (t) { - (0, _helpers.parse)('1 2 3', function (selectors) { - var arr = selectors.first.map(function (selector) { - if (/[0-9]/.test(selector.value)) { - return 'h' + selector.value; - } - - return selector.value; - }); - t.deepEqual(arr, ['h1', ' ', 'h2', ' ', 'h3']); - }); -}); -(0, _ava["default"])('container#every', function (t) { - (0, _helpers.parse)('.one.two.three', function (selectors) { - var allClasses = selectors.first.every(function (selector) { - return selector.type === 'class'; - }); - t.truthy(allClasses); - }); -}); -(0, _ava["default"])('container#some', function (t) { - (0, _helpers.parse)('one#two.three', function (selectors) { - var someClasses = selectors.first.some(function (selector) { - return selector.type === 'class'; - }); - t.truthy(someClasses); - }); -}); -(0, _ava["default"])('container#reduce', function (t) { - (0, _helpers.parse)('h1, h2, h3, h4', function (selectors) { - var str = selectors.reduce(function (memo, selector) { - if (selector.first.type === 'tag') { - memo += selector.first.value; - } - - return memo; - }, ''); - t.deepEqual(str, 'h1h2h3h4'); - }); -}); -(0, _ava["default"])('container#filter', function (t) { - (0, _helpers.parse)('h1, h2, c1, c2', function (selectors) { - var ast = selectors.filter(function (selector) { - return ~selector.first.value.indexOf('h'); - }); - t.deepEqual(String(ast), 'h1, h2'); - }); -}); -(0, _ava["default"])('container#split', function (t) { - (0, _helpers.parse)('h1 h2 >> h3', function (selectors) { - var list = selectors.first.split(function (selector) { - return selector.value === '>>'; - }).map(function (group) { - return group.map(String); - }); - t.deepEqual(list, [['h1', ' ', 'h2', ' >> '], ['h3']]); - t.deepEqual(list.length, 2); - }); -}); -(0, _ava["default"])('container#sort', function (t) { - var out = (0, _helpers.parse)('h2,h3,h1,h4', function (selectors) { - selectors.sort(function (a, b) { - return a.first.value.slice(-1) - b.first.value.slice(-1); - }); - }); - t.deepEqual(out, 'h1,h2,h3,h4'); -}); -(0, _ava["default"])('container#at', function (t) { - (0, _helpers.parse)('h1, h2, h3', function (selectors) { - t.deepEqual(selectors.at(1).first.value, 'h2'); - }); -}); -(0, _ava["default"])('container#first, container#last', function (t) { - (0, _helpers.parse)('h1, h2, h3, h4', function (selectors) { - t.deepEqual(selectors.first.first.value, 'h1'); - t.deepEqual(selectors.last.last.value, 'h4'); - }); -}); -(0, _ava["default"])('container#index', function (t) { - (0, _helpers.parse)('h1 h2 h3', function (selectors) { - var middle = selectors.first.at(1); - t.deepEqual(selectors.first.index(middle), 1); - }); -}); -(0, _ava["default"])('container#length', function (t) { - (0, _helpers.parse)('h1, h2, h3', function (selectors) { - t.deepEqual(selectors.length, 3); - }); -}); -(0, _ava["default"])('container#removeChild', function (t) { - var out = (0, _helpers.parse)('h1.class h2.class h3.class', function (selectors) { - selectors.walk(function (selector) { - if (selector.type === 'class') { - selector.parent.removeChild(selector); - } - }); - }); - t.deepEqual(out, 'h1 h2 h3'); -}); -(0, _ava["default"])('container#removeAll, container#empty', function (t) { - var wipe = function wipe(method) { - return function (selectors) { - return selectors[method](); - }; - }; - - var out1 = (0, _helpers.parse)('h1 h2, h2 h3, h3 h4', wipe('empty')); - var out2 = (0, _helpers.parse)('h1 h2, h2 h3, h3 h4', wipe('removeAll')); - t.deepEqual(out1, ''); - t.deepEqual(out2, ''); -}); -(0, _ava["default"])('container#insertBefore', function (t) { - var out = (0, _helpers.parse)('h2', function (selectors) { - var selector = selectors.first; - var clone = selector.first.clone({ - value: 'h1' - }); - selectors.insertBefore(selector, clone); - }); - t.deepEqual(out, 'h1,h2'); -}); -(0, _ava["default"])('container#insertBefore and node#remove', function (t) { - var out = (0, _helpers.parse)('h2', function (selectors) { - var selector = selectors.first; - - var newSel = _["default"].tag({ - value: 'h1' - }); - - selectors.insertBefore(selector, newSel); - newSel.remove(); - }); - t.deepEqual(out, 'h2'); -}); -(0, _ava["default"])('container#insertAfter', function (t) { - var out = (0, _helpers.parse)('h1', function (selectors) { - var selector = selectors.first; - var clone = selector.first.clone({ - value: 'h2' - }); - selectors.insertAfter(selector, clone); - }); - t.deepEqual(out, 'h1,h2'); -}); -(0, _ava["default"])('container#insertAfter and node#remove', function (t) { - var out = (0, _helpers.parse)('h2', function (selectors) { - var selector = selectors.first; - - var newSel = _["default"].tag({ - value: 'h1' - }); - - selectors.insertAfter(selector, newSel); - newSel.remove(); - }); - t.deepEqual(out, 'h2'); -}); -(0, _ava["default"])('container#insertAfter (during iteration)', function (t) { - var out = (0, _helpers.parse)('h1, h2, h3', function (selectors) { - selectors.walkTags(function (selector) { - var attribute = _["default"].attribute({ - attribute: 'class' - }); - - selector.parent.insertAfter(selector, attribute); - }); - }); - t.deepEqual(out, 'h1[class], h2[class], h3[class]'); -}); -(0, _ava["default"])('Container#atPosition first pseudo', function (t) { - (0, _helpers.parse)(':not(.foo),\n#foo > :matches(ol, ul)', function (root) { - var node = root.atPosition(1, 1); - t.deepEqual(node.type, "pseudo"); - t.deepEqual(node.toString(), ":not(.foo)"); - }); -}); -(0, _ava["default"])('Container#atPosition class in pseudo', function (t) { - (0, _helpers.parse)(':not(.foo),\n#foo > :matches(ol, ul)', function (root) { - var node = root.atPosition(1, 6); - t.deepEqual(node.type, "class"); - t.deepEqual(node.toString(), ".foo"); - }); -}); -(0, _ava["default"])('Container#atPosition id in second selector', function (t) { - (0, _helpers.parse)(':not(.foo),\n#foo > :matches(ol, ul)', function (root) { - var node = root.atPosition(2, 1); - t.deepEqual(node.type, "id"); - t.deepEqual(node.toString(), "\n#foo"); - }); -}); -(0, _ava["default"])('Container#atPosition combinator in second selector', function (t) { - (0, _helpers.parse)(':not(.foo),\n#foo > :matches(ol, ul)', function (root) { - var node = root.atPosition(2, 6); - t.deepEqual(node.type, "combinator"); - t.deepEqual(node.toString(), " > "); - var nodeSpace = root.atPosition(2, 5); - t.deepEqual(nodeSpace.type, "selector"); - t.deepEqual(nodeSpace.toString(), "\n#foo > :matches(ol, ul)"); - }); -}); -(0, _ava["default"])('Container#atPosition tag in second selector pseudo', function (t) { - (0, _helpers.parse)(':not(.foo),\n#foo > :matches(ol, ul)', function (root) { - var node = root.atPosition(2, 17); - t.deepEqual(node.type, "tag"); - t.deepEqual(node.toString(), "ol"); - }); -}); -(0, _ava["default"])('Container#atPosition comma in second selector pseudo', function (t) { - (0, _helpers.parse)(':not(.foo),\n#foo > :matches(ol, ul)', function (root) { - var node = root.atPosition(2, 19); - t.deepEqual(node.type, "pseudo"); - t.deepEqual(node.toString(), ":matches(ol, ul)"); - }); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/escapes.js b/node_modules/postcss-selector-parser/dist/__tests__/escapes.js deleted file mode 100644 index cebabd92af..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/escapes.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('escaped semicolon in class', '.\\;', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ';'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\;'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); -}); -(0, _helpers.test)('escaped semicolon in id', '#\\;', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ';'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\;'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); // This is a side-effect of allowing media queries to be parsed. Not sure it shouldn't just be an error. - -(0, _helpers.test)('bare parens capture contents as a string', '(h1)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '(h1)'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'string'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/exceptions.js b/node_modules/postcss-selector-parser/dist/__tests__/exceptions.js deleted file mode 100644 index 85c3f837d1..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/exceptions.js +++ /dev/null @@ -1,24 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -// Unclosed elements -(0, _helpers["throws"])('unclosed string', 'a[href="wow]'); -(0, _helpers["throws"])('unclosed comment', '/* oops'); -(0, _helpers["throws"])('unclosed pseudo element', 'button::'); -(0, _helpers["throws"])('unclosed pseudo class', 'a:'); -(0, _helpers["throws"])('unclosed attribute selector', '[name="james"][href'); -(0, _helpers["throws"])('no opening parenthesis', ')'); -(0, _helpers["throws"])('no opening parenthesis (2)', ':global.foo)'); -(0, _helpers["throws"])('no opening parenthesis (3)', 'h1:not(h2:not(h3)))'); -(0, _helpers["throws"])('no opening square bracket', ']'); -(0, _helpers["throws"])('no opening square bracket (2)', ':global.foo]'); -(0, _helpers["throws"])('no opening square bracket (3)', '[global]]'); -(0, _helpers["throws"])('bad pseudo element', 'button::"after"'); -(0, _helpers["throws"])('missing closing parenthesis in pseudo', ':not([attr="test"]:not([attr="test"])'); -(0, _helpers["throws"])('bad syntax', '-moz-osx-font-smoothing: grayscale'); -(0, _helpers["throws"])('bad syntax (2)', '! .body'); -(0, _helpers["throws"])('missing backslash for semicolon', '.;'); -(0, _helpers["throws"])('missing backslash for semicolon (2)', '.\;'); -(0, _helpers["throws"])('unexpected / foo', '-Option\/root', "Unexpected '/'. Escaping special characters with \\ may help."); -(0, _helpers["throws"])('bang in selector', '.foo !optional', "Unexpected '!'. Escaping special characters with \\ may help."); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/guards.js b/node_modules/postcss-selector-parser/dist/__tests__/guards.js deleted file mode 100644 index 7cdec58d4f..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/guards.js +++ /dev/null @@ -1,127 +0,0 @@ -"use strict"; - -var _ = _interopRequireDefault(require("../")); - -var _helpers = require("./util/helpers"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var node = function node(tree, n) { - if (n === void 0) { - n = 0; - } - - return tree.nodes[0].nodes[n]; -}; - -(0, _helpers.test)('attribute guard', '[foo]', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isAttribute(undefined)); - t["true"](_["default"].isAttribute(n)); - t["false"](_["default"].isContainer(n)); - t["true"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('className guard', '.foo', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isClassName(undefined)); - t["true"](_["default"].isClassName(n)); - t["false"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('combinator guard', '.foo > .bar', function (t, tree) { - var n = node(tree, 1); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isCombinator(undefined)); - t["true"](_["default"].isCombinator(n)); - t["false"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('comment guard', '/* foo */.foo > .bar', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isComment(undefined)); - t["true"](_["default"].isComment(n)); - t["false"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('id guard', '#ident', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isIdentifier(undefined)); - t["true"](_["default"].isIdentifier(n)); - t["false"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('nesting guard', '&.foo', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isNesting(undefined)); - t["true"](_["default"].isNesting(n)); - t["false"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('pseudo class guard', ':hover', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isPseudo(undefined)); - t["true"](_["default"].isPseudo(n)); - t["true"](_["default"].isPseudoClass(n)); - t["false"](_["default"].isPseudoElement(n)); - t["true"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('pseudo element guard', '::first-line', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isPseudo(undefined)); - t["true"](_["default"].isPseudo(n)); - t["false"](_["default"].isPseudoClass(n)); - t["true"](_["default"].isPseudoElement(n)); - t["true"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('special pseudo element guard', ':before:after', function (t, tree) { - [node(tree), node(tree, 1)].forEach(function (n) { - t["true"](_["default"].isPseudo(n)); - t["false"](_["default"].isPseudoClass(n)); - t["true"](_["default"].isPseudoElement(n)); - t["true"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); - }); -}); -(0, _helpers.test)('special pseudo element guard (uppercase)', ':BEFORE:AFTER', function (t, tree) { - [node(tree), node(tree, 1)].forEach(function (n) { - t["true"](_["default"].isPseudo(n)); - t["false"](_["default"].isPseudoClass(n)); - t["true"](_["default"].isPseudoElement(n)); - t["true"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); - }); -}); -(0, _helpers.test)('string guard', '"string"', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isString(undefined)); - t["true"](_["default"].isString(n)); - t["false"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('tag guard', 'h1', function (t, tree) { - var n = node(tree); - t["false"](_["default"].isNode(undefined)); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isTag(undefined)); - t["true"](_["default"].isTag(n)); - t["false"](_["default"].isContainer(n)); - t["true"](_["default"].isNamespace(n)); -}); -(0, _helpers.test)('universal guard', '*', function (t, tree) { - var n = node(tree); - t["true"](_["default"].isNode(n)); - t["false"](_["default"].isUniversal(undefined)); - t["true"](_["default"].isUniversal(n)); - t["false"](_["default"].isContainer(n)); - t["false"](_["default"].isNamespace(n)); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/id.js b/node_modules/postcss-selector-parser/dist/__tests__/id.js deleted file mode 100644 index 87dc7460d3..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/id.js +++ /dev/null @@ -1,235 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('id selector', '#one', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'one'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with universal', '*#z98y ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'universal'); - t.deepEqual(tree.nodes[0].nodes[1].value, 'z98y'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'id'); -}); -(0, _helpers.test)('id hack', '#one#two', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'id'); -}); -(0, _helpers.test)('id and class names mixed', '#one.two.three', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'one'); - t.deepEqual(tree.nodes[0].nodes[1].value, 'two'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'three'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'class'); -}); -(0, _helpers.test)('qualified id', 'button#one', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'id'); -}); -(0, _helpers.test)('qualified id & class name', 'h1#one.two', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'class'); -}); -(0, _helpers.test)('extraneous non-combinating whitespace', ' #h1 , #h2 ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.after, ' '); - t.deepEqual(tree.nodes[1].nodes[0].value, 'h2'); - t.deepEqual(tree.nodes[1].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[1].nodes[0].spaces.after, ' '); -}); -(0, _helpers.test)('Sass interpolation within a class', '.#{foo}', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes.length, 1); - t.deepEqual(tree.nodes[0].nodes[0].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[0].value, '#{foo}'); -}); -(0, _helpers.test)('Sass interpolation within an id', '#foo#{bar}', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes.length, 1); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo#{bar}'); -}); -(0, _helpers.test)('Less interpolation within an id', '#foo@{bar}', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes.length, 1); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo@{bar}'); -}); -(0, _helpers.test)('id selector with escaping', '#\\#test', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '#test'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#test'); -}); -(0, _helpers.test)('id selector with escaping (2)', '#-a-b-c-', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '-a-b-c-'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with escaping (3)', '#u-m\\00002b', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'u-m+'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'u-m\\00002b'); -}); -(0, _helpers.test)('id selector with escaping (4)', '#♥', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '♥'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with escaping (5)', '#©', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '©'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with escaping (6)', '#“‘’”', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '“‘’”'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with escaping (7)', '#☺☃', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '☺☃'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with escaping (8)', '#⌘⌥', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '⌘⌥'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with escaping (9)', '#𝄞♪♩♫♬', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '𝄞♪♩♫♬'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with escaping (10)', '#💩', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '💩'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); -}); -(0, _helpers.test)('id selector with escaping (11)', '#\\?', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '?'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\?'); -}); -(0, _helpers.test)('id selector with escaping (12)', '#\\@', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '@'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\@'); -}); -(0, _helpers.test)('id selector with escaping (13)', '#\\.', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '.'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\.'); -}); -(0, _helpers.test)('id selector with escaping (14)', '#\\3A \\)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':)'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A \\)'); -}); -(0, _helpers.test)('id selector with escaping (15)', '#\\3A \\`\\(', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':`('); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A \\`\\('); -}); -(0, _helpers.test)('id selector with escaping (16)', '#\\31 23', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '123'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31 23'); -}); -(0, _helpers.test)('id selector with escaping (17)', '#\\31 a2b3c', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '1a2b3c'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\31 a2b3c'); -}); -(0, _helpers.test)('id selector with escaping (18)', '#\\', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '

'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\'); -}); -(0, _helpers.test)('id selector with escaping (19)', '#\\<\\>\\<\\<\\<\\>\\>\\<\\>', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '<><<<>><>'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\<\\>\\<\\<\\<\\>\\>\\<\\>'); -}); -(0, _helpers.test)('id selector with escaping (20)', '#\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\.', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\[\\>\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\>\\+\\+\\+\\>\\+\\<\\<\\<\\<\\-\\]\\>\\+\\+\\.\\>\\+\\.\\+\\+\\+\\+\\+\\+\\+\\.\\.\\+\\+\\+\\.\\>\\+\\+\\.\\<\\<\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\+\\.\\>\\.\\+\\+\\+\\.\\-\\-\\-\\-\\-\\-\\.\\-\\-\\-\\-\\-\\-\\-\\-\\.\\>\\+\\.\\>\\.'); -}); -(0, _helpers.test)('id selector with escaping (21)', '#\\#', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '#'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#'); -}); -(0, _helpers.test)('id selector with escaping (22)', '#\\#\\#', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '##'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#\\#'); -}); -(0, _helpers.test)('id selector with escaping (23)', '#\\#\\.\\#\\.\\#', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '#.#.#'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\#\\.\\#\\.\\#'); -}); -(0, _helpers.test)('id selector with escaping (24)', '#\\_', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '_'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\_'); -}); -(0, _helpers.test)('id selector with escaping (25)', '#\\{\\}', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '{}'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\{\\}'); -}); -(0, _helpers.test)('id selector with escaping (26)', '#\\.fake\\-class', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '.fake-class'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\.fake\\-class'); -}); -(0, _helpers.test)('id selector with escaping (27)', '#foo\\.bar', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo.bar'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'foo\\.bar'); -}); -(0, _helpers.test)('id selector with escaping (28)', '#\\3A hover', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':hover'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A hover'); -}); -(0, _helpers.test)('id selector with escaping (29)', '#\\3A hover\\3A focus\\3A active', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':hover:focus:active'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\3A hover\\3A focus\\3A active'); -}); -(0, _helpers.test)('id selector with escaping (30)', '#\\[attr\\=value\\]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '[attr=value]'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, '\\[attr\\=value\\]'); -}); -(0, _helpers.test)('id selector with escaping (31)', '#f\\/o\\/o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f/o/o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\/o\\/o'); -}); -(0, _helpers.test)('id selector with escaping (32)', '#f\\\\o\\\\o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f\\o\\o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\\\o\\\\o'); -}); -(0, _helpers.test)('id selector with escaping (33)', '#f\\*o\\*o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f*o*o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\*o\\*o'); -}); -(0, _helpers.test)('id selector with escaping (34)', '#f\\!o\\!o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f!o!o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\!o\\!o'); -}); -(0, _helpers.test)('id selector with escaping (35)', '#f\\\'o\\\'o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f\'o\'o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\\'o\\\'o'); -}); -(0, _helpers.test)('id selector with escaping (36)', '#f\\~o\\~o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f~o~o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\~o\\~o'); -}); -(0, _helpers.test)('id selector with escaping (37)', '#f\\+o\\+o', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'f+o+o'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'id'); - t.deepEqual(tree.nodes[0].nodes[0].raws.value, 'f\\+o\\+o'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/lossy.js b/node_modules/postcss-selector-parser/dist/__tests__/lossy.js deleted file mode 100644 index a59a93acfc..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/lossy.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.testLossy = exports.parse = void 0; - -var _ava = _interopRequireDefault(require("ava")); - -var _index = _interopRequireDefault(require("../index")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var parse = function parse(input, options, transform) { - return (0, _index["default"])(transform).processSync(input, options); -}; - -exports.parse = parse; - -var testLossy = function testLossy(t, input, expected) { - var result = parse(input, { - lossless: false - }); - t.deepEqual(result, expected); -}; - -exports.testLossy = testLossy; -(0, _ava["default"])('combinator, descendant - single', testLossy, '.one .two', '.one .two'); -(0, _ava["default"])('combinator, descendant - multiple', testLossy, '.one .two', '.one .two'); -(0, _ava["default"])('combinator, child - space before', testLossy, '.one >.two', '.one>.two'); -(0, _ava["default"])('combinator, child - space after', testLossy, '.one> .two', '.one>.two'); -(0, _ava["default"])('combinator, sibling - space before', testLossy, '.one ~.two', '.one~.two'); -(0, _ava["default"])('combinator, sibling - space after', testLossy, '.one~ .two', '.one~.two'); -(0, _ava["default"])('combinator, adj sibling - space before', testLossy, '.one +.two', '.one+.two'); -(0, _ava["default"])('combinator, adj sibling - space after', testLossy, '.one+ .two', '.one+.two'); -(0, _ava["default"])('classes, extraneous spaces', testLossy, ' .h1 , .h2 ', '.h1,.h2'); -(0, _ava["default"])('ids, extraneous spaces', testLossy, ' #h1 , #h2 ', '#h1,#h2'); -(0, _ava["default"])('attribute, spaces in selector', testLossy, 'h1[ href *= "test" ]', 'h1[href*="test"]'); -(0, _ava["default"])('attribute, insensitive flag 1', testLossy, '[href="test" i ]', '[href="test"i]'); -(0, _ava["default"])('attribute, insensitive flag 2', testLossy, '[href=TEsT i ]', '[href=TEsT i]'); -(0, _ava["default"])('attribute, insensitive flag 3', testLossy, '[href=test i ]', '[href=test i]'); -(0, _ava["default"])('attribute, extreneous whitespace', testLossy, ' [href] , [class] ', '[href],[class]'); -(0, _ava["default"])('namespace, space before', testLossy, ' postcss|button', 'postcss|button'); -(0, _ava["default"])('namespace, space after', testLossy, 'postcss|button ', 'postcss|button'); -(0, _ava["default"])('namespace - all elements, space before', testLossy, ' postcss|*', 'postcss|*'); -(0, _ava["default"])('namespace - all elements, space after', testLossy, 'postcss|* ', 'postcss|*'); -(0, _ava["default"])('namespace - all namespaces, space before', testLossy, ' *|button', '*|button'); -(0, _ava["default"])('namespace - all namespaces, space after', testLossy, '*|button ', '*|button'); -(0, _ava["default"])('namespace - all elements in all namespaces, space before', testLossy, ' *|*', '*|*'); -(0, _ava["default"])('namespace - all elements in all namespaces, space after', testLossy, '*|* ', '*|*'); -(0, _ava["default"])('namespace - all elements without namespace, space before', testLossy, ' |*', '|*'); -(0, _ava["default"])('namespace - all elements without namespace, space after', testLossy, '|* ', '|*'); -(0, _ava["default"])('namespace - tag with no namespace, space before', testLossy, ' |button', '|button'); -(0, _ava["default"])('namespace - tag with no namespace, space after', testLossy, '|button ', '|button'); -(0, _ava["default"])('namespace - inside attribute, space before', testLossy, ' [ postcss|href=test]', '[postcss|href=test]'); -(0, _ava["default"])('namespace - inside attribute, space after', testLossy, '[postcss|href= test ] ', '[postcss|href=test]'); -(0, _ava["default"])('namespace - inside attribute (2), space before', testLossy, ' [ postcss|href]', '[postcss|href]'); -(0, _ava["default"])('namespace - inside attribute (2), space after', testLossy, '[postcss|href ] ', '[postcss|href]'); -(0, _ava["default"])('namespace - inside attribute (3), space before', testLossy, ' [ *|href=test]', '[*|href=test]'); -(0, _ava["default"])('namespace - inside attribute (3), space after', testLossy, '[*|href= test ] ', '[*|href=test]'); -(0, _ava["default"])('namespace - inside attribute (4), space after', testLossy, '[|href= test ] ', '[|href=test]'); -(0, _ava["default"])('tag - extraneous whitespace', testLossy, ' h1 , h2 ', 'h1,h2'); -(0, _ava["default"])('tag - trailing comma', testLossy, 'h1, ', 'h1,'); -(0, _ava["default"])('tag - trailing comma (1)', testLossy, 'h1,', 'h1,'); -(0, _ava["default"])('tag - trailing comma (2)', testLossy, 'h1', 'h1'); -(0, _ava["default"])('tag - trailing slash (1)', testLossy, 'h1\\ ', 'h1\\ '); -(0, _ava["default"])('tag - trailing slash (2)', testLossy, 'h1\\ h2\\', 'h1\\ h2\\'); -(0, _ava["default"])('universal - combinator', testLossy, ' * + * ', '*+*'); -(0, _ava["default"])('universal - extraneous whitespace', testLossy, ' * , * ', '*,*'); -(0, _ava["default"])('universal - qualified universal selector', testLossy, '*[href] *:not(*.green)', '*[href] *:not(*.green)'); -(0, _ava["default"])('nesting - spacing before', testLossy, ' &.class', '&.class'); -(0, _ava["default"])('nesting - spacing after', testLossy, '&.class ', '&.class'); -(0, _ava["default"])('nesting - spacing between', testLossy, '& .class ', '& .class'); -(0, _ava["default"])('pseudo (single) - spacing before', testLossy, ' :after', ':after'); -(0, _ava["default"])('pseudo (single) - spacing after', testLossy, ':after ', ':after'); -(0, _ava["default"])('pseudo (double) - spacing before', testLossy, ' ::after', '::after'); -(0, _ava["default"])('pseudo (double) - spacing after', testLossy, '::after ', '::after'); -(0, _ava["default"])('pseudo - multiple', testLossy, ' *:target::before , a:after ', '*:target::before,a:after'); -(0, _ava["default"])('pseudo - negated', testLossy, 'h1:not( .heading )', 'h1:not(.heading)'); -(0, _ava["default"])('pseudo - negated with combinators (1)', testLossy, 'h1:not(.heading > .title) > h1', 'h1:not(.heading>.title)>h1'); -(0, _ava["default"])('pseudo - negated with combinators (2)', testLossy, '.foo:nth-child(2n + 1)', '.foo:nth-child(2n+1)'); -(0, _ava["default"])('pseudo - extra whitespace', testLossy, 'a:not( h2 )', 'a:not(h2)'); -(0, _ava["default"])('comments - comment inside descendant selector', testLossy, "div /* wtf */.foo", "div /* wtf */.foo"); -(0, _ava["default"])('comments - comment inside complex selector', testLossy, "div /* wtf */ > .foo", "div/* wtf */>.foo"); -(0, _ava["default"])('comments - comment inside compound selector with space', testLossy, "div /* wtf */ .foo", "div /* wtf */.foo"); -(0, _ava["default"])('@words - space before', testLossy, ' @media', '@media'); -(0, _ava["default"])('@words - space after', testLossy, '@media ', '@media'); -(0, _ava["default"])('@words - maintains space between', testLossy, '@media (min-width: 700px) and (orientation: landscape)', '@media (min-width: 700px) and (orientation: landscape)'); -(0, _ava["default"])('@words - extraneous space between', testLossy, '@media (min-width: 700px) and (orientation: landscape)', '@media (min-width: 700px) and (orientation: landscape)'); -(0, _ava["default"])('@words - multiple', testLossy, '@media (min-width: 700px), (min-height: 400px)', '@media (min-width: 700px),(min-height: 400px)'); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/namespaces.js b/node_modules/postcss-selector-parser/dist/__tests__/namespaces.js deleted file mode 100644 index 15333e64b4..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/namespaces.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('match tags in the postcss namespace', 'postcss|button', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, 'postcss'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'button'); -}); -(0, _helpers.test)('match everything in the postcss namespace', 'postcss|*', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, 'postcss'); - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); -}); -(0, _helpers.test)('match any namespace', '*|button', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, '*'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'button'); -}); -(0, _helpers.test)('match all elements within the postcss namespace', 'postcss|*', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, 'postcss'); - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); -}); -(0, _helpers.test)('match all elements in all namespaces', '*|*', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, '*'); - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); -}); -(0, _helpers.test)('match all elements without a namespace', '|*', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, true); - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); -}); -(0, _helpers.test)('match tags with no namespace', '|button', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, true); - t.deepEqual(tree.nodes[0].nodes[0].value, 'button'); -}); -(0, _helpers.test)('match namespace inside attribute selector', '[postcss|href=test]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, 'postcss'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'test'); -}); -(0, _helpers.test)('match namespace inside attribute selector (2)', '[postcss|href]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, 'postcss'); - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); -}); -(0, _helpers.test)('match namespace inside attribute selector (3)', '[*|href]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, '*'); - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); -}); -(0, _helpers.test)('match default namespace inside attribute selector', '[|href]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, true); - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); -}); -(0, _helpers.test)('match default namespace inside attribute selector with spaces', '[ |href ]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, true); - t.deepEqual(tree.nodes[0].nodes[0].attribute, 'href'); -}); -(0, _helpers.test)('namespace with qualified id selector', 'ns|h1#foo', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, 'ns'); -}); -(0, _helpers.test)('namespace with qualified class selector', 'ns|h1.foo', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].namespace, 'ns'); -}); -(0, _helpers.test)('ns alias for namespace', 'f\\oo|h1.foo', function (t, tree) { - var tag = tree.nodes[0].nodes[0]; - t.deepEqual(tag.namespace, 'foo'); - t.deepEqual(tag.ns, 'foo'); - tag.ns = "bar"; - t.deepEqual(tag.namespace, 'bar'); - t.deepEqual(tag.ns, 'bar'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/nesting.js b/node_modules/postcss-selector-parser/dist/__tests__/nesting.js deleted file mode 100644 index e3c164a516..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/nesting.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('nesting selector', '&', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '&'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'nesting'); -}); -(0, _helpers.test)('nesting selector followed by a class', '& .class', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '&'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'nesting'); - t.deepEqual(tree.nodes[0].nodes[1].value, ' '); - t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'class'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'class'); -}); -(0, _helpers.test)('&foo', '&foo', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '&'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'nesting'); - t.deepEqual(tree.nodes[0].nodes[1].value, 'foo'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'tag'); -}); -(0, _helpers.test)('&-foo', '&-foo', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '&'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'nesting'); - t.deepEqual(tree.nodes[0].nodes[1].value, '-foo'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'tag'); -}); -(0, _helpers.test)('&_foo', '&_foo', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '&'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'nesting'); - t.deepEqual(tree.nodes[0].nodes[1].value, '_foo'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'tag'); -}); -(0, _helpers.test)('&|foo', '&|foo', function (t, tree) { - var element = tree.nodes[0].nodes[0]; - t.deepEqual(element.value, 'foo'); - t.deepEqual(element.type, 'tag'); - t.deepEqual(element.namespace, '&'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/node.js b/node_modules/postcss-selector-parser/dist/__tests__/node.js deleted file mode 100644 index 7ed1fcc7ed..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/node.js +++ /dev/null @@ -1,139 +0,0 @@ -"use strict"; - -var _ava = _interopRequireDefault(require("ava")); - -var _ = _interopRequireDefault(require("..")); - -var _helpers = require("./util/helpers"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -(0, _ava["default"])('node#clone', function (t) { - (0, _helpers.parse)('[href="test"]', function (selectors) { - var selector = selectors.first.first; - var clone = selector.clone(); - delete selector.parent; - t.deepEqual(clone, selectors.first.first); - }); -}); -(0, _ava["default"])('node#clone of attribute', function (t) { - (0, _helpers.parse)('[href=test]', function (selectors) { - var selector = selectors.first.first; - var clone = selector.clone(); - delete selector.parent; - t.deepEqual(clone, selectors.first.first); - }); -}); -(0, _ava["default"])('node#replaceWith', function (t) { - var out = (0, _helpers.parse)('[href="test"]', function (selectors) { - var attr = selectors.first.first; - - var id = _["default"].id({ - value: 'test' - }); - - var className = _["default"].className({ - value: 'test' - }); - - attr.replaceWith(id, className); - }); - t.deepEqual(out, '#test.test'); -}); -(0, _ava["default"])('Node#appendToPropertyAndEscape', function (t) { - var out = (0, _helpers.parse)('.fo\\o', function (selectors) { - var className = selectors.first.first; - t.deepEqual(className.raws, { - value: "fo\\o" - }); - className.appendToPropertyAndEscape("value", "bar", "ba\\r"); - t.deepEqual(className.raws, { - value: "fo\\oba\\r" - }); - }); - t.deepEqual(out, '.fo\\oba\\r'); -}); -(0, _ava["default"])('Node#setPropertyAndEscape with existing raws', function (t) { - var out = (0, _helpers.parse)('.fo\\o', function (selectors) { - var className = selectors.first.first; - t.deepEqual(className.raws, { - value: "fo\\o" - }); - className.setPropertyAndEscape("value", "bar", "ba\\r"); - t.deepEqual(className.raws, { - value: "ba\\r" - }); - }); - t.deepEqual(out, '.ba\\r'); -}); -(0, _ava["default"])('Node#setPropertyAndEscape without existing raws', function (t) { - var out = (0, _helpers.parse)('.foo', function (selectors) { - var className = selectors.first.first; - t.deepEqual(className.raws, undefined); - className.setPropertyAndEscape("value", "bar", "ba\\r"); - t.deepEqual(className.raws, { - value: "ba\\r" - }); - }); - t.deepEqual(out, '.ba\\r'); -}); -(0, _ava["default"])('Node#setPropertyWithoutEscape with existing raws', function (t) { - var out = (0, _helpers.parse)('.fo\\o', function (selectors) { - var className = selectors.first.first; - t.deepEqual(className.raws, { - value: "fo\\o" - }); - className.setPropertyWithoutEscape("value", "w+t+f"); - t.deepEqual(className.raws, {}); - }); - t.deepEqual(out, '.w+t+f'); -}); -(0, _ava["default"])('Node#setPropertyWithoutEscape without existing raws', function (t) { - var out = (0, _helpers.parse)('.foo', function (selectors) { - var className = selectors.first.first; - t.deepEqual(className.raws, undefined); - className.setPropertyWithoutEscape("value", "w+t+f"); - t.deepEqual(className.raws, {}); - t.deepEqual(className.value, "w+t+f"); - }); - t.deepEqual(out, '.w+t+f'); -}); -(0, _ava["default"])('Node#isAtPosition', function (t) { - (0, _helpers.parse)(':not(.foo),\n#foo > :matches(ol, ul)', function (root) { - t.deepEqual(root.isAtPosition(1, 1), true); - t.deepEqual(root.isAtPosition(1, 10), true); - t.deepEqual(root.isAtPosition(2, 23), true); - t.deepEqual(root.isAtPosition(2, 24), false); - var selector = root.first; - t.deepEqual(selector.isAtPosition(1, 1), true); - t.deepEqual(selector.isAtPosition(1, 10), true); - t.deepEqual(selector.isAtPosition(1, 11), false); - var pseudoNot = selector.first; - t.deepEqual(pseudoNot.isAtPosition(1, 1), true); - t.deepEqual(pseudoNot.isAtPosition(1, 7), true); - t.deepEqual(pseudoNot.isAtPosition(1, 10), true); - t.deepEqual(pseudoNot.isAtPosition(1, 11), false); - var notSelector = pseudoNot.first; - t.deepEqual(notSelector.isAtPosition(1, 1), false); - t.deepEqual(notSelector.isAtPosition(1, 4), false); - t.deepEqual(notSelector.isAtPosition(1, 5), true); - t.deepEqual(notSelector.isAtPosition(1, 6), true); - t.deepEqual(notSelector.isAtPosition(1, 9), true); - t.deepEqual(notSelector.isAtPosition(1, 10), true); - t.deepEqual(notSelector.isAtPosition(1, 11), false); - var notClass = notSelector.first; - t.deepEqual(notClass.isAtPosition(1, 5), false); - t.deepEqual(notClass.isAtPosition(1, 6), true); - t.deepEqual(notClass.isAtPosition(1, 9), true); - t.deepEqual(notClass.isAtPosition(1, 10), false); - var secondSel = root.at(1); - t.deepEqual(secondSel.isAtPosition(1, 11), false); - t.deepEqual(secondSel.isAtPosition(2, 1), true); - t.deepEqual(secondSel.isAtPosition(2, 23), true); - t.deepEqual(secondSel.isAtPosition(2, 24), false); - var combinator = secondSel.at(1); - t.deepEqual(combinator.isAtPosition(2, 5), false); - t.deepEqual(combinator.isAtPosition(2, 6), true); - t.deepEqual(combinator.isAtPosition(2, 7), false); - }); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/nonstandard.js b/node_modules/postcss-selector-parser/dist/__tests__/nonstandard.js deleted file mode 100644 index d9786f21c8..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/nonstandard.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('non-standard selector', '.icon.is-$(network)', function (t, tree) { - var class1 = tree.nodes[0].nodes[0]; - t.deepEqual(class1.value, 'icon'); - t.deepEqual(class1.type, 'class'); - var class2 = tree.nodes[0].nodes[1]; - t.deepEqual(class2.value, 'is-$(network)'); - t.deepEqual(class2.type, 'class'); -}); -(0, _helpers.test)('at word in selector', 'em@il.com', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'em@il'); - t.deepEqual(tree.nodes[0].nodes[1].value, 'com'); -}); -(0, _helpers.test)('leading combinator', '> *', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '>'); - t.deepEqual(tree.nodes[0].nodes[1].value, '*'); -}); -(0, _helpers.test)('sass escapes', '.#{$classname}', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, "class"); - t.deepEqual(tree.nodes[0].nodes[0].value, "#{$classname}"); -}); -(0, _helpers.test)('sass escapes (2)', '[lang=#{$locale}]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, "attribute"); - t.deepEqual(tree.nodes[0].nodes[0].attribute, "lang"); - t.deepEqual(tree.nodes[0].nodes[0].operator, "="); - t.deepEqual(tree.nodes[0].nodes[0].value, "#{$locale}"); -}); -(0, _helpers.test)('placeholder', '%foo', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, "tag"); - t.deepEqual(tree.nodes[0].nodes[0].value, "%foo"); -}); -(0, _helpers.test)('styled selector', '${Step}', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, "tag"); - t.deepEqual(tree.nodes[0].nodes[0].value, "${Step}"); -}); -(0, _helpers.test)('styled selector (2)', '${Step}:nth-child(odd)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, "tag"); - t.deepEqual(tree.nodes[0].nodes[0].value, "${Step}"); - t.deepEqual(tree.nodes[0].nodes[1].type, "pseudo"); - t.deepEqual(tree.nodes[0].nodes[1].value, ":nth-child"); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, "tag"); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, "odd"); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/parser.js b/node_modules/postcss-selector-parser/dist/__tests__/parser.js deleted file mode 100644 index a0dd84d267..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/parser.js +++ /dev/null @@ -1,259 +0,0 @@ -"use strict"; - -var _ava = _interopRequireDefault(require("ava")); - -var _index = _interopRequireDefault(require("../index")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -// Node creation -var nodeTypes = [['attribute', '[href]', { - attribute: 'href' -}], ['className', '.classy', { - value: 'classy' -}], ['combinator', ' >> ', { - value: '>>', - spaces: { - before: ' ', - after: ' ' - } -}], ['comment', '/* comment */', { - value: '/* comment */' -}], ['id', '#test', { - value: 'test' -}], ['nesting', '&'], ['pseudo', '::before', { - value: '::before' -}], ['string', '"wow"', { - value: '"wow"' -}], ['tag', 'button', { - value: 'button' -}], ['universal', '*']]; -nodeTypes.forEach(function (type) { - (0, _ava["default"])("parser#" + type[0], function (t) { - var node = _index["default"][type[0]](type[2] || {}); - - t.deepEqual(String(node), type[1]); - }); -}); -(0, _ava["default"])('string constants', function (t) { - t.truthy(_index["default"].TAG); - t.truthy(_index["default"].STRING); - t.truthy(_index["default"].SELECTOR); - t.truthy(_index["default"].ROOT); - t.truthy(_index["default"].PSEUDO); - t.truthy(_index["default"].NESTING); - t.truthy(_index["default"].ID); - t.truthy(_index["default"].COMMENT); - t.truthy(_index["default"].COMBINATOR); - t.truthy(_index["default"].CLASS); - t.truthy(_index["default"].ATTRIBUTE); - t.truthy(_index["default"].UNIVERSAL); -}); -(0, _ava["default"])('construct a whole tree', function (t) { - var root = _index["default"].root(); - - var selector = _index["default"].selector(); - - selector.append(_index["default"].id({ - value: 'tree' - })); - root.append(selector); - t.deepEqual(String(root), '#tree'); -}); -(0, _ava["default"])('no operation', function (t) { - t.notThrows(function () { - return (0, _index["default"])().processSync('h1 h2 h3'); - }); -}); -(0, _ava["default"])('empty selector string', function (t) { - t.notThrows(function () { - return (0, _index["default"])(function (selectors) { - selectors.walk(function (selector) { - selector.type = 'tag'; - }); - }).processSync(''); - }); -}); -(0, _ava["default"])('async parser', function (t) { - return (0, _index["default"])(function (selectors) { - return new Promise(function (res) { - setTimeout(function () { - selectors.first.nodes[0].value = 'bar'; - res(); - }, 1); - }); - }).process('foo').then(function (result) { - t.deepEqual(result, 'bar'); - }); -}); -(0, _ava["default"])('parse errors with the async parser', function (t) { - return (0, _index["default"])(function (selectors) { - return new Promise(function (res) { - setTimeout(function () { - selectors.first.nodes[0].value = 'bar'; - res(); - }, 1); - }); - }).process('a b: c')["catch"](function (err) { - return t.truthy(err); - }); -}); -(0, _ava["default"])('parse errors within the async processor', function (t) { - return (0, _index["default"])(function (selectors) { - return new Promise(function (res, rej) { - setTimeout(function () { - rej(selectors.error("async error")); - }, 1); - }); - }).process('.foo')["catch"](function (err) { - return t.truthy(err); - }); -}); -(0, _ava["default"])('parse errors within the async processor before the promise returns', function (t) { - return (0, _index["default"])(function (selectors) { - throw selectors.error("async error"); - }).process('.foo')["catch"](function (err) { - return t.truthy(err); - }); -}); -(0, _ava["default"])('returning a promise to the sync processor fails', function (t) { - t["throws"](function () { - return (0, _index["default"])(function () { - return new Promise(function (res) { - setTimeout(function () { - res(); - }, 1); - }); - }).processSync('.foo'); - }); -}); -(0, _ava["default"])('Passing a rule works async', function (t) { - var rule = { - selector: '.foo' - }; - return (0, _index["default"])(function (root) { - return new Promise(function (res) { - setTimeout(function () { - root.walkClasses(function (node) { - node.value = "bar"; - }); - res(); - }, 1); - }); - }).process(rule).then(function (newSel) { - t.deepEqual(newSel, ".bar"); - t.deepEqual(rule.selector, ".bar"); - }); -}); -(0, _ava["default"])('Passing a rule with mutation disabled works async', function (t) { - var rule = { - selector: '.foo' - }; - return (0, _index["default"])(function (root) { - return new Promise(function (res) { - setTimeout(function () { - root.walkClasses(function (node) { - node.value = "bar"; - }); - res(); - }, 1); - }); - }).process(rule, { - updateSelector: false - }).then(function (newSel) { - t.deepEqual(newSel, ".bar"); - t.deepEqual(rule.selector, ".foo"); - }); -}); -(0, _ava["default"])('Passing a rule with mutation works sync', function (t) { - var rule = { - selector: '.foo' - }; - var newSel = (0, _index["default"])(function (root) { - root.walkClasses(function (node) { - node.value = "bar"; - }); - }).processSync(rule, { - updateSelector: true - }); - t.deepEqual(newSel, ".bar"); - t.deepEqual(rule.selector, ".bar"); -}); -(0, _ava["default"])('Transform a selector synchronously', function (t) { - var rule = { - selector: '.foo' - }; - var count = (0, _index["default"])(function (root) { - var classCount = 0; - root.walkClasses(function (node) { - classCount++; - node.value = "bar"; - }); - return classCount; - }).transformSync(rule, { - updateSelector: true - }); - t.deepEqual(count, 1); - t.deepEqual(rule.selector, ".bar"); -}); -(0, _ava["default"])('Transform a selector asynchronously', function (t) { - var rule = { - selector: '.foo' - }; - return (0, _index["default"])(function (root) { - return new Promise(function (res) { - setTimeout(function () { - var classCount = 0; - root.walkClasses(function (node) { - classCount++; - node.value = "bar"; - }); - res(classCount); - }, 1); - }); - }).transform(rule, { - updateSelector: true - }).then(function (count) { - t.deepEqual(count, 1); - t.deepEqual(rule.selector, ".bar"); - }); -}); -(0, _ava["default"])('get AST of a selector synchronously', function (t) { - var rule = { - selector: '.foo' - }; - var ast = (0, _index["default"])(function (root) { - var classCount = 0; - root.walkClasses(function (node) { - classCount++; - node.value = "bar"; - }); - return classCount; - }).astSync(rule, { - updateSelector: true - }); - t.deepEqual(ast.nodes[0].nodes[0].value, "bar"); - t.deepEqual(rule.selector, ".bar"); -}); -(0, _ava["default"])('get AST a selector asynchronously', function (t) { - var rule = { - selector: '.foo' - }; - return (0, _index["default"])(function (root) { - return new Promise(function (res) { - setTimeout(function () { - var classCount = 0; - root.walkClasses(function (node) { - classCount++; - node.value = "bar"; - }); - res(classCount); - }, 1); - }); - }).ast(rule, { - updateSelector: true - }).then(function (ast) { - t.deepEqual(ast.nodes[0].nodes[0].value, "bar"); - t.deepEqual(rule.selector, ".bar"); - }); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/postcss.js b/node_modules/postcss-selector-parser/dist/__tests__/postcss.js deleted file mode 100644 index 4c5bc4fca1..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/postcss.js +++ /dev/null @@ -1,46 +0,0 @@ -"use strict"; - -var _ava = _interopRequireDefault(require("ava")); - -var _postcss = _interopRequireDefault(require("postcss")); - -var _helpers = require("./util/helpers"); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var cse = 'CssSyntaxError'; - -function showCode(t, selector) { - var rule = _postcss["default"].parse(selector).first; - - try { - (0, _helpers.parse)(rule); - } catch (e) { - if (e.name !== cse) { - return; - } // Removes ANSI codes from snapshot tests as it makes them illegible. - // The formatting of this error is otherwise identical to e.toString() - - - t.snapshot(cse + ": " + e.message + "\n\n" + e.showSourceCode(false) + "\n"); - } -} - -(0, _ava["default"])('missing open square bracket', showCode, 'a b c] {}'); -(0, _ava["default"])('missing open parenthesis', showCode, 'a b c) {}'); -(0, _ava["default"])('missing pseudo class or pseudo element', showCode, 'a b c: {}'); -(0, _ava["default"])('space in between colon and word (incorrect pseudo)', showCode, 'a b: c {}'); -(0, _ava["default"])('string after colon (incorrect pseudo)', showCode, 'a b:"wow" {}'); // attribute selectors - -(0, _ava["default"])('bad string attribute', showCode, '["hello"] {}'); -(0, _ava["default"])('bad string attribute with value', showCode, '["foo"=bar] {}'); -(0, _ava["default"])('bad parentheses', showCode, '[foo=(bar)] {}'); -(0, _ava["default"])('bad lonely asterisk', showCode, '[*] {}'); -(0, _ava["default"])('bad lonely pipe', showCode, '[|] {}'); -(0, _ava["default"])('bad lonely caret', showCode, '[^] {}'); -(0, _ava["default"])('bad lonely dollar', showCode, '[$] {}'); -(0, _ava["default"])('bad lonely tilde', showCode, '[~] {}'); -(0, _ava["default"])('bad lonely equals', showCode, '[=] {}'); -(0, _ava["default"])('bad lonely operator', showCode, '[*=] {}'); -(0, _ava["default"])('bad lonely operator (2)', showCode, '[|=] {}'); -(0, _ava["default"])('bad doubled operator', showCode, '[href=foo=bar] {}'); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/pseudos.js b/node_modules/postcss-selector-parser/dist/__tests__/pseudos.js deleted file mode 100644 index 2dd64b170c..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/pseudos.js +++ /dev/null @@ -1,165 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('pseudo element (single colon)', 'h1:after', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].value, ':after'); -}); -(0, _helpers.test)('pseudo element (double colon)', 'h1::after', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].value, '::after'); -}); -(0, _helpers.test)('multiple pseudo elements', '*:target::before, a:after', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); - t.deepEqual(tree.nodes[0].nodes[1].value, ':target'); - t.deepEqual(tree.nodes[0].nodes[2].value, '::before'); - t.deepEqual(tree.nodes[1].nodes[1].value, ':after'); -}); -(0, _helpers.test)('negation pseudo element', 'h1:not(.heading)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, ':not'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, 'heading'); -}); -(0, _helpers.test)('negation pseudo element (2)', 'h1:not(.heading, .title, .content)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, ':not'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, 'heading'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].value, 'title'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[2].nodes[0].value, 'content'); -}); -(0, _helpers.test)('negation pseudo element (3)', 'h1:not(.heading > .title) > h1', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, 'heading'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].value, '>'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[2].value, 'title'); - t.deepEqual(tree.nodes[0].nodes[2].value, '>'); - t.deepEqual(tree.nodes[0].nodes[3].value, 'h1'); -}); -(0, _helpers.test)('negation pseudo element (4)', 'h1:not(h2:not(h3))', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].nodes[0].nodes[0].value, 'h3'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].nodes[0].nodes[0].parent.type, 'selector'); -}); -(0, _helpers.test)('pseudo class in the middle of a selector', 'a:link.external', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'a'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].value, ':link'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[2].value, 'external'); -}); -(0, _helpers.test)('extra whitespace inside parentheses', 'a:not( h2 )', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, 'h2'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].spaces.after, ' '); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].spaces.before, ' '); -}); -(0, _helpers.test)('escaped numbers in class name with pseudo', 'a:before.\\31\\ 0', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[2].type, 'class'); - t.deepEqual(tree.nodes[0].nodes[2].value, '1 0'); - t.deepEqual(tree.nodes[0].nodes[2].raws.value, '\\31\\ 0'); -}); -(0, _helpers.test)('nested pseudo', '.btn-group>.btn:last-child:not(:first-child)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[4].value, ':not'); -}); -(0, _helpers.test)('extraneous non-combinating whitespace', ' h1:after , h2:after ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[1].value, ':after'); - t.deepEqual(tree.nodes[0].nodes[1].spaces.after, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[1].nodes[1].value, ':after'); - t.deepEqual(tree.nodes[1].nodes[1].spaces.after, ' '); -}); -(0, _helpers.test)('negation pseudo element with quotes', 'h1:not(".heading")', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, ':not'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, '".heading"'); -}); -(0, _helpers.test)('negation pseudo element with single quotes', "h1:not('.heading')", function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, ':not'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, "'.heading'"); -}); -(0, _helpers.test)('Issue #116', "svg:not(:root)", function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].value, ':not'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, ':root'); -}); -(0, _helpers.test)('alone pseudo class', ':root', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[0].value, ':root'); -}); -(0, _helpers.test)('non standard pseudo (@custom-selector)', ":--foobar, a", function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, ':--foobar'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[1].nodes[0].value, 'a'); - t.deepEqual(tree.nodes[1].nodes[0].type, 'tag'); -}); -(0, _helpers.test)('non standard pseudo (@custom-selector) (1)', "a, :--foobar", function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'a'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[1].nodes[0].value, ':--foobar'); - t.deepEqual(tree.nodes[1].nodes[0].type, 'pseudo'); -}); -(0, _helpers.test)('current pseudo class', ':current(p, li, dt, dd)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[0].value, ':current'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[0].nodes[0].value, 'p'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[1].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[1].nodes[0].value, 'li'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[2].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[2].nodes[0].value, 'dt'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[3].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[3].nodes[0].value, 'dd'); -}); -(0, _helpers.test)('is pseudo class', ':is(p, li, dt, dd)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[0].value, ':is'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[0].nodes[0].value, 'p'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[1].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[1].nodes[0].value, 'li'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[2].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[2].nodes[0].value, 'dt'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[3].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].nodes[3].nodes[0].value, 'dd'); -}); -(0, _helpers.test)('is pseudo class with namespace', '*|*:is(:hover, :focus) ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'universal'); - t.deepEqual(tree.nodes[0].nodes[0].namespace, '*'); - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].value, ':is'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, ':hover'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].value, ':focus'); -}); -(0, _helpers.test)('has pseudo class', 'a:has(> img)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'a'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].value, ':has'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, 'combinator'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, '>'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[1].value, 'img'); -}); -(0, _helpers.test)('where pseudo class', 'a:where(:not(:hover))', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'a'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].value, ':where'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, ':not'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[0].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[0].nodes[0].value, ':hover'); -}); -(0, _helpers.test)('nested pseudo classes', "section:not( :has(h1, h2 ) )", function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[0].value, 'section'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].value, ':not'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].type, 'pseudo'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].value, ':has'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[1].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].nodes[1].nodes[0].value, 'h2'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/sourceIndex.js b/node_modules/postcss-selector-parser/dist/__tests__/sourceIndex.js deleted file mode 100644 index 766d59f55b..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/sourceIndex.js +++ /dev/null @@ -1,229 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('universal selector', '*', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); -}); -(0, _helpers.test)('lobotomized owl selector', ' * + * ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 2); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 2); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 1); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 4); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 4); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 3); - t.deepEqual(tree.nodes[0].nodes[2].source.start.column, 6); - t.deepEqual(tree.nodes[0].nodes[2].source.end.column, 6); - t.deepEqual(tree.nodes[0].nodes[2].sourceIndex, 5); -}); -(0, _helpers.test)('comment', '/**\n * Hello!\n */', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 3); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); -}); -(0, _helpers.test)('comment & universal selectors', '*/*test*/*', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 2); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 9); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 1); - t.deepEqual(tree.nodes[0].nodes[2].source.start.column, 10); - t.deepEqual(tree.nodes[0].nodes[2].source.end.column, 10); - t.deepEqual(tree.nodes[0].nodes[2].sourceIndex, 9); -}); -(0, _helpers.test)('tag selector', 'h1', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 2); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); -}); -(0, _helpers.test)('id selector', '#id', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 3); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); -}); -(0, _helpers.test)('tag selector followed by id selector', 'h1, #id', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 2); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); - t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 5); - t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 7); - t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 4); -}); -(0, _helpers.test)('multiple id selectors', '#one#two', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 4); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 5); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 8); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 4); -}); -(0, _helpers.test)('multiple id selectors (2)', '#one#two#three#four', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[2].source.start.column, 9); - t.deepEqual(tree.nodes[0].nodes[2].source.end.column, 14); - t.deepEqual(tree.nodes[0].nodes[2].sourceIndex, 8); - t.deepEqual(tree.nodes[0].nodes[3].source.start.column, 15); - t.deepEqual(tree.nodes[0].nodes[3].source.end.column, 19); - t.deepEqual(tree.nodes[0].nodes[3].sourceIndex, 14); -}); -(0, _helpers.test)('multiple id selectors (3)', '#one#two,#three#four', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 5); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 8); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 4); - t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 16); - t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 20); - t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 15); -}); -(0, _helpers.test)('multiple class selectors', '.one.two,.three.four', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 5); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 8); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 4); - t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 16); - t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 20); - t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 15); -}); -(0, _helpers.test)('attribute selector', '[name="james"]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 14); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); -}); -(0, _helpers.test)('multiple attribute selectors', '[name="james"][name="ed"],[name="snakeman"][name="a"]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.line, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 14); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); - t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 15); - t.deepEqual(tree.nodes[0].nodes[1].source.end.line, 1); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 25); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 14); - t.deepEqual(tree.nodes[1].nodes[0].source.start.line, 1); - t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 27); - t.deepEqual(tree.nodes[1].nodes[0].source.end.line, 1); - t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 43); - t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 26); - t.deepEqual(tree.nodes[1].nodes[1].source.start.line, 1); - t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 44); - t.deepEqual(tree.nodes[1].nodes[1].source.end.line, 1); - t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 53); - t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 43); -}); -(0, _helpers.test)('pseudo-class', 'h1:first-child', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 14); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2); -}); -(0, _helpers.test)('pseudo-class with argument', 'h1:not(.strudel, .food)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 23); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2); -}); -(0, _helpers.test)('pseudo-element', 'h1::before', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 10); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2); -}); -(0, _helpers.test)('multiple pseudos', 'h1:not(.food)::before, a:first-child', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 13); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2); - t.deepEqual(tree.nodes[0].nodes[2].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[2].source.start.column, 14); - t.deepEqual(tree.nodes[0].nodes[2].source.end.column, 21); - t.deepEqual(tree.nodes[0].nodes[2].sourceIndex, 13); - t.deepEqual(tree.nodes[1].nodes[1].source.start.line, 1); - t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 25); - t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 36); - t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 24); -}); -(0, _helpers.test)('combinators', 'div > h1 span', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1, "> start line"); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 5, "> start column"); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 5, "> end column"); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 4, "> sourceIndex"); - t.deepEqual(tree.nodes[0].nodes[3].source.start.line, 1, "' ' start line"); - t.deepEqual(tree.nodes[0].nodes[3].source.start.column, 9, "' ' start column"); - t.deepEqual(tree.nodes[0].nodes[3].source.end.column, 9, "' ' end column"); - t.deepEqual(tree.nodes[0].nodes[3].sourceIndex, 8, "' ' sourceIndex"); -}); -(0, _helpers.test)('combinators surrounded by superfluous spaces', 'div > h1 ~ span a', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1, "> start line"); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 7, "> start column"); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 7, "> end column"); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 6, "> sourceIndex"); - t.deepEqual(tree.nodes[0].nodes[3].source.start.line, 1, "~ start line"); - t.deepEqual(tree.nodes[0].nodes[3].source.start.column, 13, "~ start column"); - t.deepEqual(tree.nodes[0].nodes[3].source.end.column, 13, "~ end column"); - t.deepEqual(tree.nodes[0].nodes[3].sourceIndex, 12, "~ sourceIndex"); - t.deepEqual(tree.nodes[0].nodes[5].source.start.line, 1, "' ' start line"); - t.deepEqual(tree.nodes[0].nodes[5].source.start.column, 21, "' ' start column"); - t.deepEqual(tree.nodes[0].nodes[5].source.end.column, 23, "' ' end column"); - t.deepEqual(tree.nodes[0].nodes[5].sourceIndex, 20, "' ' sourceIndex"); -}); -(0, _helpers.test)('multiple id selectors on different lines', '#one,\n#two', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 4); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0); - t.deepEqual(tree.nodes[1].nodes[0].source.start.line, 2); - t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 1); - t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 4); - t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 6); -}); -(0, _helpers.test)('multiple id selectors on different CRLF lines', '#one,\r\n#two,\r\n#three', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1, '#one start line'); - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 1, '#one start column'); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 4, '#one end column'); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 0, '#one sourceIndex'); - t.deepEqual(tree.nodes[1].nodes[0].source.start.line, 2, '#two start line'); - t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 1, '#two start column'); - t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 4, '#two end column'); - t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 7, '#two sourceIndex'); - t.deepEqual(tree.nodes[2].nodes[0].source.start.line, 3, '#three start line'); - t.deepEqual(tree.nodes[2].nodes[0].source.start.column, 1, '#three start column'); - t.deepEqual(tree.nodes[2].nodes[0].source.end.column, 6, '#three end column'); - t.deepEqual(tree.nodes[2].nodes[0].sourceIndex, 14, '#three sourceIndex'); -}); -(0, _helpers.test)('id, tag, pseudo, and class selectors on different lines with indentation', '\t#one,\n\th1:after,\n\t\t.two', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].source.start.line, 1, '#one start line'); - t.deepEqual(tree.nodes[0].nodes[0].source.start.column, 2, '#one start column'); - t.deepEqual(tree.nodes[0].nodes[0].source.end.column, 5, '#one end column'); - t.deepEqual(tree.nodes[0].nodes[0].sourceIndex, 1, '#one sourceIndex'); - t.deepEqual(tree.nodes[1].nodes[0].source.start.line, 2, 'h1 start line'); - t.deepEqual(tree.nodes[1].nodes[0].source.start.column, 2, 'h1 start column'); - t.deepEqual(tree.nodes[1].nodes[0].source.end.column, 3, 'h1 end column'); - t.deepEqual(tree.nodes[1].nodes[0].sourceIndex, 8, 'h1 sourceIndex'); - t.deepEqual(tree.nodes[1].nodes[1].source.start.line, 2, ':after start line'); - t.deepEqual(tree.nodes[1].nodes[1].source.start.column, 4, ':after start column'); - t.deepEqual(tree.nodes[1].nodes[1].source.end.column, 9, ':after end column'); - t.deepEqual(tree.nodes[1].nodes[1].sourceIndex, 10, ':after sourceIndex'); - t.deepEqual(tree.nodes[2].nodes[0].source.start.line, 3, '.two start line'); - t.deepEqual(tree.nodes[2].nodes[0].source.start.column, 3, '.two start column'); - t.deepEqual(tree.nodes[2].nodes[0].source.end.column, 6, '.two end column'); - t.deepEqual(tree.nodes[2].nodes[0].sourceIndex, 20, '.two sourceIndex'); -}); -(0, _helpers.test)('pseudo with arguments spanning multiple lines', 'h1:not(\n\t.one,\n\t.two\n)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[1].source.start.line, 1, ':not start line'); - t.deepEqual(tree.nodes[0].nodes[1].source.start.column, 3, ':not start column'); - t.deepEqual(tree.nodes[0].nodes[1].source.end.line, 4, ':not end line'); - t.deepEqual(tree.nodes[0].nodes[1].source.end.column, 1, ':not end column'); - t.deepEqual(tree.nodes[0].nodes[1].sourceIndex, 2, ':not sourceIndex'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].source.start.line, 2, '.one start line'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].source.start.column, 2, '.one start column'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].source.end.line, 2, '.one end line'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].source.end.column, 5, '.one end column'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[0].nodes[0].sourceIndex, 9, '.one sourceIndex'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].source.start.line, 3, '.two start line'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].source.start.column, 2, '.two start column'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].source.end.line, 3, '.two end line'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].source.end.column, 5, '.two end column'); - t.deepEqual(tree.nodes[0].nodes[1].nodes[1].nodes[0].sourceIndex, 16, '.two sourceIndex'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/stripComments.js b/node_modules/postcss-selector-parser/dist/__tests__/stripComments.js deleted file mode 100644 index b7f315bbe7..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/stripComments.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; - -var _ava = _interopRequireDefault(require("ava")); - -var _stripComments = _interopRequireDefault(require("../../src/util/stripComments")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -(0, _ava["default"])("stripComments()", function (t) { - t.deepEqual((0, _stripComments["default"])("aaa/**/bbb"), "aaabbb"); - t.deepEqual((0, _stripComments["default"])("aaa/*bbb"), "aaa"); - t.deepEqual((0, _stripComments["default"])("aaa/*xxx*/bbb"), "aaabbb"); - t.deepEqual((0, _stripComments["default"])("aaa/*/xxx/*/bbb"), "aaabbb"); - t.deepEqual((0, _stripComments["default"])("aaa/*x*/bbb/**/"), "aaabbb"); - t.deepEqual((0, _stripComments["default"])("/**/aaa/*x*/bbb/**/"), "aaabbb"); - t.deepEqual((0, _stripComments["default"])("/**/"), ""); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/tags.js b/node_modules/postcss-selector-parser/dist/__tests__/tags.js deleted file mode 100644 index b6f5aa4320..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/tags.js +++ /dev/null @@ -1,35 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('tag selector', 'h1', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); -}); -(0, _helpers.test)('multiple tag selectors', 'h1, h2', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[1].nodes[0].value, 'h2'); -}); -(0, _helpers.test)('extraneous non-combinating whitespace', ' h1 , h2 ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.after, ' '); - t.deepEqual(tree.nodes[1].nodes[0].value, 'h2'); - t.deepEqual(tree.nodes[1].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[1].nodes[0].spaces.after, ' '); -}); -(0, _helpers.test)('tag with trailing comma', 'h1,', function (t, tree) { - t.deepEqual(tree.trailingComma, true); -}); -(0, _helpers.test)('tag with trailing slash', 'h1\\', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'h1\\'); -}); -(0, _helpers.test)('tag with attribute', 'label[for="email"]', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'label'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'tag'); - t.deepEqual(tree.nodes[0].nodes[1].value, 'email'); - t.deepEqual(tree.nodes[0].nodes[1].attribute, 'for'); - t.deepEqual(tree.nodes[0].nodes[1].operator, '='); - t.deepEqual(tree.nodes[0].nodes[1].type, 'attribute'); - t.deepEqual(tree.nodes[0].nodes[1].quoteMark, '"'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/universal.js b/node_modules/postcss-selector-parser/dist/__tests__/universal.js deleted file mode 100644 index c1d39b0269..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/universal.js +++ /dev/null @@ -1,42 +0,0 @@ -"use strict"; - -var _helpers = require("./util/helpers"); - -(0, _helpers.test)('universal selector', '*', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'universal'); -}); -(0, _helpers.test)('lobotomized owl', '* + *', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'universal'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'universal'); -}); -(0, _helpers.test)('universal selector with descendant combinator', '* *', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'universal'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'universal'); -}); -(0, _helpers.test)('universal selector with descendant combinator and extraneous non-combinating whitespace', '* *', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].type, 'universal'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'combinator'); - t.deepEqual(tree.nodes[0].nodes[2].type, 'universal'); -}); -(0, _helpers.test)('extraneous non-combinating whitespace', ' * , * ', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); - t.deepEqual(tree.nodes[0].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[0].nodes[0].spaces.after, ' '); - t.deepEqual(tree.nodes[1].nodes[0].value, '*'); - t.deepEqual(tree.nodes[1].nodes[0].spaces.before, ' '); - t.deepEqual(tree.nodes[1].nodes[0].spaces.after, ' '); -}); -(0, _helpers.test)('qualified universal selector', '*[href] *:not(*.green)', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); - t.deepEqual(tree.nodes[0].nodes[3].value, '*'); - t.deepEqual(tree.nodes[0].nodes[4].nodes[0].nodes[0].value, '*'); -}); -(0, _helpers.test)('universal selector with pseudo', '*::--webkit-media-controls-play-button', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '*'); - t.deepEqual(tree.nodes[0].nodes[0].type, 'universal'); - t.deepEqual(tree.nodes[0].nodes[1].value, '::--webkit-media-controls-play-button'); - t.deepEqual(tree.nodes[0].nodes[1].type, 'pseudo'); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/util/helpers.js b/node_modules/postcss-selector-parser/dist/__tests__/util/helpers.js deleted file mode 100644 index 5bf0301fbc..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/util/helpers.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; - -exports.__esModule = true; -exports.test = test; -exports.nodeVersionAtLeast = nodeVersionAtLeast; -exports.nodeVersionBefore = nodeVersionBefore; -exports["throws"] = exports.parse = void 0; - -var _process = _interopRequireDefault(require("process")); - -var _util = _interopRequireDefault(require("util")); - -var _ava = _interopRequireDefault(require("ava")); - -var _semver = _interopRequireDefault(require("semver")); - -var _index = _interopRequireDefault(require("../../index")); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - -var parse = function parse(input, transform) { - return (0, _index["default"])(transform).processSync(input); -}; - -exports.parse = parse; - -function test(spec, input, callback, only, disabled, serial) { - var _this = this; - - if (only === void 0) { - only = false; - } - - if (disabled === void 0) { - disabled = false; - } - - if (serial === void 0) { - serial = false; - } - - var tester = only ? _ava["default"].only : _ava["default"]; - tester = disabled ? tester.skip : tester; - tester = serial ? tester.serial : tester; - - if (callback) { - tester(spec + " (tree)", function (t) { - var tree = (0, _index["default"])().astSync(input); - - var debug = _util["default"].inspect(tree, false, null); - - return callback.call(_this, t, tree, debug); - }); - } - - tester(spec + " (toString)", function (t) { - var result = (0, _index["default"])().processSync(input); - t.deepEqual(result, input); - }); -} - -test.only = function (spec, input, callback) { - return test(spec, input, callback, true); -}; - -test.skip = function (spec, input, callback) { - return test(spec, input, callback, false, true); -}; - -test.serial = function (spec, input, callback) { - return test(spec, input, callback, false, false, true); -}; - -var _throws = function _throws(spec, input, validator) { - (0, _ava["default"])(spec + " (throws)", function (t) { - t["throws"](function () { - return (0, _index["default"])().processSync(input); - }, validator ? { - message: validator - } : { - instanceOf: Error - }); - }); -}; - -exports["throws"] = _throws; - -function nodeVersionAtLeast(version) { - return _semver["default"].gte(_process["default"].versions.node, version); -} - -function nodeVersionBefore(version) { - return _semver["default"].lt(_process["default"].versions.node, version); -} \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/__tests__/util/unesc.js b/node_modules/postcss-selector-parser/dist/__tests__/util/unesc.js deleted file mode 100644 index 779348aa32..0000000000 --- a/node_modules/postcss-selector-parser/dist/__tests__/util/unesc.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; - -var _helpers = require("../util/helpers"); - -(0, _helpers.test)('id selector', '#foo', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo'); -}); -(0, _helpers.test)('escaped special char', '#w\\+', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'w+'); -}); -(0, _helpers.test)('tailing escape', '#foo\\', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'foo\\'); -}); -(0, _helpers.test)('double escape', '#wow\\\\k', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'wow\\k'); -}); -(0, _helpers.test)('leading numeric', '.\\31 23', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '123'); -}); -(0, _helpers.test)('emoji', '.\\🐐', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '🐐'); -}); // https://www.w3.org/International/questions/qa-escapes#cssescapes - -(0, _helpers.test)('hex escape', '.\\E9motion', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'émotion'); -}); -(0, _helpers.test)('hex escape with space', '.\\E9 dition', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'édition'); -}); -(0, _helpers.test)('hex escape with hex number', '.\\0000E9dition', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'édition'); -}); -(0, _helpers.test)('class selector with escaping', '.\\1D306', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '𝌆'); -}); -(0, _helpers.test)('class selector with escaping with more chars', '.\\1D306k', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, '𝌆k'); -}); -(0, _helpers.test)('class selector with escaping with more chars with whitespace', '.wow\\1D306 k', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, 'wow𝌆k'); -}); -(0, _helpers.test)('handles 0 value hex', '\\0', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, String.fromCodePoint(0xFFFD)); -}); -(0, _helpers.test)('handles lone surrogate value hex', '\\DBFF', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, String.fromCodePoint(0xFFFD)); -}); -(0, _helpers.test)('handles out of bound values', '\\110000', function (t, tree) { - t.deepEqual(tree.nodes[0].nodes[0].value, String.fromCodePoint(0xFFFD)); -}); \ No newline at end of file diff --git a/node_modules/postcss-selector-parser/dist/parser.js b/node_modules/postcss-selector-parser/dist/parser.js index c0af9b6868..e0451de00f 100644 --- a/node_modules/postcss-selector-parser/dist/parser.js +++ b/node_modules/postcss-selector-parser/dist/parser.js @@ -963,7 +963,11 @@ var Parser = /*#__PURE__*/function () { } var hasClass = indexesOf(word, '.').filter(function (i) { - return word[i - 1] !== '\\'; + // Allow escaped dot within class name + var escapedDot = word[i - 1] === '\\'; // Allow decimal numbers percent in @keyframes + + var isKeyframesPercent = /^\d+\.\d+%$/.test(word); + return !escapedDot && !isKeyframesPercent; }); var hasId = indexesOf(word, '#').filter(function (i) { return word[i - 1] !== '\\'; diff --git a/node_modules/postcss-selector-parser/package.json b/node_modules/postcss-selector-parser/package.json index fe1f1cd1a1..59b630d602 100644 --- a/node_modules/postcss-selector-parser/package.json +++ b/node_modules/postcss-selector-parser/package.json @@ -1,6 +1,6 @@ { "name": "postcss-selector-parser", - "version": "6.0.6", + "version": "6.0.8", "devDependencies": { "@babel/cli": "^7.11.6", "@babel/core": "^7.11.6", @@ -29,7 +29,8 @@ "CHANGELOG.md", "LICENSE-MIT", "dist", - "postcss-selector-parser.d.ts" + "postcss-selector-parser.d.ts", + "!**/__tests__" ], "scripts": { "pretest": "eslint src && tsc --noEmit postcss-selector-parser.d.ts", diff --git a/node_modules/postcss/lib/at-rule.d.ts b/node_modules/postcss/lib/at-rule.d.ts index 09e1f17339..7a39b2f9f9 100644 --- a/node_modules/postcss/lib/at-rule.d.ts +++ b/node_modules/postcss/lib/at-rule.d.ts @@ -1,6 +1,6 @@ import Container, { ContainerProps } from './container.js' -interface AtRuleRaws { +interface AtRuleRaws extends Record { /** * The space symbols before the node. It also stores `*` * and `_` symbols before the declaration (IE hack). diff --git a/node_modules/postcss/lib/comment.d.ts b/node_modules/postcss/lib/comment.d.ts index 1d4fd459a1..8eaf3a2308 100644 --- a/node_modules/postcss/lib/comment.d.ts +++ b/node_modules/postcss/lib/comment.d.ts @@ -1,7 +1,7 @@ import Container from './container.js' import Node, { NodeProps } from './node.js' -interface CommentRaws { +interface CommentRaws extends Record { /** * The space symbols before the node. */ diff --git a/node_modules/postcss/lib/container.d.ts b/node_modules/postcss/lib/container.d.ts index 3005a16141..2b75e372f7 100644 --- a/node_modules/postcss/lib/container.d.ts +++ b/node_modules/postcss/lib/container.d.ts @@ -181,10 +181,10 @@ export default abstract class Container< */ walkRules( selectorFilter: string | RegExp, - callback: (atRule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void ): false | undefined walkRules( - callback: (atRule: Rule, index: number) => false | void + callback: (rule: Rule, index: number) => false | void ): false | undefined /** diff --git a/node_modules/postcss/lib/container.js b/node_modules/postcss/lib/container.js index 8b1d0f8647..a511a829d2 100644 --- a/node_modules/postcss/lib/container.js +++ b/node_modules/postcss/lib/container.js @@ -316,7 +316,7 @@ class Container extends Node { } let processed = nodes.map(i => { - // istanbul ignore next + /* c8 ignore next */ if (!i[my]) Container.rebuild(i) i = i.proxyOf if (i.parent) i.parent.removeChild(i) @@ -410,7 +410,7 @@ Container.registerAtRule = dependant => { module.exports = Container Container.default = Container -// istanbul ignore next +/* c8 ignore start */ Container.rebuild = node => { if (node.type === 'atrule') { Object.setPrototypeOf(node, AtRule.prototype) @@ -430,3 +430,4 @@ Container.rebuild = node => { }) } } +/* c8 ignore stop */ diff --git a/node_modules/postcss/lib/css-syntax-error.d.ts b/node_modules/postcss/lib/css-syntax-error.d.ts index 76d099a951..3fd0555287 100644 --- a/node_modules/postcss/lib/css-syntax-error.d.ts +++ b/node_modules/postcss/lib/css-syntax-error.d.ts @@ -1,5 +1,20 @@ import { FilePosition } from './input.js' +/** + * A position that is part of a range. + */ +export interface RangePosition { + /** + * The line number in the input. + */ + line: number + + /** + * The column number in the input. + */ + column: number +} + /** * The CSS parser throws this error for broken CSS. * @@ -31,17 +46,21 @@ import { FilePosition } from './input.js' */ export default class CssSyntaxError { /** - * @param message Error message. - * @param line Source line of the error. - * @param column Source column of the error. - * @param source Source code of the broken file. - * @param file Absolute path to the broken file. - * @param plugin PostCSS plugin name, if error came from plugin. + * Instantiates a CSS syntax error. Can be instantiated for a single position + * or for a range. + * @param message Error message. + * @param lineOrStartPos If for a single position, the line number, or if for + * a range, the inclusive start position of the error. + * @param columnOrEndPos If for a single position, the column number, or if for + * a range, the exclusive end position of the error. + * @param source Source code of the broken file. + * @param file Absolute path to the broken file. + * @param plugin PostCSS plugin name, if error came from plugin. */ constructor( message: string, - line?: number, - column?: number, + lineOrStartPos?: number | RangePosition, + columnOrEndPos?: number | RangePosition, source?: string, file?: string, plugin?: string @@ -121,6 +140,34 @@ export default class CssSyntaxError { */ column?: number + /** + * Source line of the error's end, exclusive. Provided if the error pertains + * to a range. + * + * ```js + * error.endLine //=> 3 + * error.input.endLine //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.endLine`. + */ + endLine?: number + + /** + * Source column of the error's end, exclusive. Provided if the error pertains + * to a range. + * + * ```js + * error.endColumn //=> 1 + * error.input.endColumn //=> 4 + * ``` + * + * PostCSS will use the input source map to detect the original location. + * If you need the position in the PostCSS input, use `error.input.endColumn`. + */ + endColumn?: number + /** * Source code of the broken file. * diff --git a/node_modules/postcss/lib/css-syntax-error.js b/node_modules/postcss/lib/css-syntax-error.js index 3161f21fbc..d6b369b8f0 100644 --- a/node_modules/postcss/lib/css-syntax-error.js +++ b/node_modules/postcss/lib/css-syntax-error.js @@ -20,8 +20,15 @@ class CssSyntaxError extends Error { this.plugin = plugin } if (typeof line !== 'undefined' && typeof column !== 'undefined') { - this.line = line - this.column = column + if (typeof line === 'number') { + this.line = line + this.column = column + } else { + this.line = line.line + this.column = line.column + this.endLine = column.line + this.endColumn = column.column + } } this.setMessage() diff --git a/node_modules/postcss/lib/declaration.d.ts b/node_modules/postcss/lib/declaration.d.ts index 56cfb46c02..4e92c901e3 100644 --- a/node_modules/postcss/lib/declaration.d.ts +++ b/node_modules/postcss/lib/declaration.d.ts @@ -1,7 +1,7 @@ import Container from './container.js' import Node from './node.js' -interface DeclarationRaws { +interface DeclarationRaws extends Record { /** * The space symbols before the node. It also stores `*` * and `_` symbols before the declaration (IE hack). diff --git a/node_modules/postcss/lib/input.d.ts b/node_modules/postcss/lib/input.d.ts index 399f434734..357910bd0e 100644 --- a/node_modules/postcss/lib/input.d.ts +++ b/node_modules/postcss/lib/input.d.ts @@ -13,15 +13,25 @@ export interface FilePosition { file?: string /** - * Line in source file. + * Line of inclusive start position in source file. */ line: number /** - * Column in source file. + * Column of inclusive start position in source file. */ column: number + /** + * Line of exclusive end position in source file. + */ + endLine?: number + + /** + * Column of exclusive end position in source file. + */ + endColumn?: number + /** * Source code. */ @@ -108,18 +118,28 @@ export default class Input { /** * Reads the input source map and returns a symbol position * in the input source (e.g., in a Sass file that was compiled - * to CSS before being passed to PostCSS). + * to CSS before being passed to PostCSS). Optionally takes an + * end position, exclusive. * * ```js * root.source.input.origin(1, 1) //=> { file: 'a.css', line: 3, column: 1 } + * root.source.input.origin(1, 1, 1, 4) + * //=> { file: 'a.css', line: 3, column: 1, endLine: 3, endColumn: 4 } * ``` * - * @param line Line in input CSS. - * @param column Column in input CSS. + * @param line Line for inclusive start position in input CSS. + * @param column Column for inclusive start position in input CSS. + * @param endLine Line for exclusive end position in input CSS. + * @param endColumn Column for exclusive end position in input CSS. * * @return Position in input source. */ - origin(line: number, column: number): FilePosition | false + origin( + line: number, + column: number, + endLine?: number, + endColumn?: number + ): FilePosition | false /** * Converts source offset to line and column. diff --git a/node_modules/postcss/lib/input.js b/node_modules/postcss/lib/input.js index 2a1d26b46b..0415b593a0 100644 --- a/node_modules/postcss/lib/input.js +++ b/node_modules/postcss/lib/input.js @@ -103,18 +103,43 @@ class Input { } error(message, line, column, opts = {}) { - let result - if (!column) { + let result, endLine, endColumn + + if (line && typeof line === 'object') { + let start = line + let end = column + if (typeof line.offset === 'number') { + let pos = this.fromOffset(start.offset) + line = pos.line + column = pos.col + } else { + line = start.line + column = start.column + } + if (typeof end.offset === 'number') { + let pos = this.fromOffset(end.offset) + endLine = pos.line + endColumn = pos.col + } else { + endLine = end.line + endColumn = end.column + } + } else if (!column) { let pos = this.fromOffset(line) line = pos.line column = pos.col } - let origin = this.origin(line, column) + + let origin = this.origin(line, column, endLine, endColumn) if (origin) { result = new CssSyntaxError( message, - origin.line, - origin.column, + origin.endLine === undefined + ? origin.line + : { line: origin.line, column: origin.column }, + origin.endLine === undefined + ? origin.column + : { line: origin.endLine, column: origin.endColumn }, origin.source, origin.file, opts.plugin @@ -122,15 +147,15 @@ class Input { } else { result = new CssSyntaxError( message, - line, - column, + endLine === undefined ? line : { line, column }, + endLine === undefined ? column : { line: endLine, column: endColumn }, this.css, this.file, opts.plugin ) } - result.input = { line, column, source: this.css } + result.input = { line, column, endLine, endColumn, source: this.css } if (this.file) { if (pathToFileURL) { result.input.url = pathToFileURL(this.file).toString() @@ -141,13 +166,18 @@ class Input { return result } - origin(line, column) { + origin(line, column, endLine, endColumn) { if (!this.map) return false let consumer = this.map.consumer() let from = consumer.originalPositionFor({ line, column }) if (!from.source) return false + let to + if (typeof endLine === 'number') { + to = consumer.originalPositionFor({ line: endLine, column: endColumn }) + } + let fromUrl if (isAbsolute(from.source)) { @@ -162,14 +192,16 @@ class Input { let result = { url: fromUrl.toString(), line: from.line, - column: from.column + column: from.column, + endLine: to && to.line, + endColumn: to && to.column } if (fromUrl.protocol === 'file:') { if (fileURLToPath) { result.file = fileURLToPath(fromUrl) } else { - // istanbul ignore next + /* c8 ignore next 2 */ throw new Error(`file: protocol is not available in this PostCSS build`) } } diff --git a/node_modules/postcss/lib/lazy-result.d.ts b/node_modules/postcss/lib/lazy-result.d.ts index 9da0fb5a1c..a5142345e4 100644 --- a/node_modules/postcss/lib/lazy-result.d.ts +++ b/node_modules/postcss/lib/lazy-result.d.ts @@ -89,8 +89,9 @@ export default class LazyResult implements PromiseLike { * * This property will only work with synchronous plugins. * If the processor contains any asynchronous plugins - * it will throw an error. This is why this method is only - * for debug purpose, you should always use `LazyResult#then`. + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. */ get css(): string @@ -100,8 +101,9 @@ export default class LazyResult implements PromiseLike { * * This property will only work with synchronous plugins. * If the processor contains any asynchronous plugins - * it will throw an error. This is why this method is only - * for debug purpose, you should always use `LazyResult#then`. + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. */ get content(): string @@ -111,8 +113,9 @@ export default class LazyResult implements PromiseLike { * * This property will only work with synchronous plugins. * If the processor contains any asynchronous plugins - * it will throw an error. This is why this method is only - * for debug purpose, you should always use `LazyResult#then`. + * it will throw an error. + * + * PostCSS runners should always use `LazyResult#then`. */ get map(): SourceMap @@ -123,8 +126,7 @@ export default class LazyResult implements PromiseLike { * This property will only work with synchronous plugins. If the processor * contains any asynchronous plugins it will throw an error. * - * This is why this method is only for debug purpose, - * you should always use `LazyResult#then`. + * PostCSS runners should always use `LazyResult#then`. */ get root(): Root @@ -135,8 +137,7 @@ export default class LazyResult implements PromiseLike { * This property will only work with synchronous plugins. If the processor * contains any asynchronous plugins it will throw an error. * - * This is why this method is only for debug purpose, - * you should always use `LazyResult#then`. + * PostCSS runners should always use `LazyResult#then`. */ get messages(): Message[] diff --git a/node_modules/postcss/lib/lazy-result.js b/node_modules/postcss/lib/lazy-result.js index 6069ba6904..584a95dc17 100644 --- a/node_modules/postcss/lib/lazy-result.js +++ b/node_modules/postcss/lib/lazy-result.js @@ -137,7 +137,7 @@ class LazyResult { } if (root && !root[my]) { - // istanbul ignore next + /* c8 ignore next 2 */ Container.rebuild(root) } } @@ -364,6 +364,7 @@ class LazyResult { let b = runtimeVer.split('.') if (a[0] !== b[0] || parseInt(a[1]) > parseInt(b[1])) { + // eslint-disable-next-line no-console console.error( 'Unknown error from PostCSS plugin. Your current PostCSS ' + 'version is ' + @@ -378,7 +379,8 @@ class LazyResult { } } } catch (err) { - // istanbul ignore next + /* c8 ignore next 3 */ + // eslint-disable-next-line no-console if (console && console.error) console.error(err) } return error diff --git a/node_modules/postcss/lib/map-generator.js b/node_modules/postcss/lib/map-generator.js index a86cc67a0c..49d638aaca 100644 --- a/node_modules/postcss/lib/map-generator.js +++ b/node_modules/postcss/lib/map-generator.js @@ -4,15 +4,18 @@ let { SourceMapConsumer, SourceMapGenerator } = require('source-map-js') let { dirname, resolve, relative, sep } = require('path') let { pathToFileURL } = require('url') +let Input = require('./input') + let sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator) let pathAvailable = Boolean(dirname && resolve && relative && sep) class MapGenerator { - constructor(stringify, root, opts) { + constructor(stringify, root, opts, cssString) { this.stringify = stringify this.mapOpts = opts.map || {} this.root = root this.opts = opts + this.css = cssString } isMap() { @@ -25,14 +28,19 @@ class MapGenerator { previous() { if (!this.previousMaps) { this.previousMaps = [] - this.root.walk(node => { - if (node.source && node.source.input.map) { - let map = node.source.input.map - if (!this.previousMaps.includes(map)) { - this.previousMaps.push(map) + if (this.root) { + this.root.walk(node => { + if (node.source && node.source.input.map) { + let map = node.source.input.map + if (!this.previousMaps.includes(map)) { + this.previousMaps.push(map) + } } - } - }) + }) + } else { + let input = new Input(this.css, this.opts) + if (input.map) this.previousMaps.push(input.map) + } } return this.previousMaps @@ -67,30 +75,41 @@ class MapGenerator { clearAnnotation() { if (this.mapOpts.annotation === false) return - let node - for (let i = this.root.nodes.length - 1; i >= 0; i--) { - node = this.root.nodes[i] - if (node.type !== 'comment') continue - if (node.text.indexOf('# sourceMappingURL=') === 0) { - this.root.removeChild(i) + if (this.root) { + let node + for (let i = this.root.nodes.length - 1; i >= 0; i--) { + node = this.root.nodes[i] + if (node.type !== 'comment') continue + if (node.text.indexOf('# sourceMappingURL=') === 0) { + this.root.removeChild(i) + } } + } else if (this.css) { + this.css = this.css.replace(/(\n)?\/\*#[\S\s]*?\*\/$/gm, '') } } setSourcesContent() { let already = {} - this.root.walk(node => { - if (node.source) { - let from = node.source.input.from - if (from && !already[from]) { - already[from] = true - this.map.setSourceContent( - this.toUrl(this.path(from)), - node.source.input.css - ) + if (this.root) { + this.root.walk(node => { + if (node.source) { + let from = node.source.input.from + if (from && !already[from]) { + already[from] = true + this.map.setSourceContent( + this.toUrl(this.path(from)), + node.source.input.css + ) + } } - } - }) + }) + } else if (this.css) { + let from = this.opts.from + ? this.toUrl(this.path(this.opts.from)) + : '' + this.map.setSourceContent(from, this.css) + } } applyPrevMaps() { @@ -129,7 +148,6 @@ class MapGenerator { if (Buffer) { return Buffer.from(str).toString('base64') } else { - // istanbul ignore next return window.btoa(unescape(encodeURIComponent(str))) } } @@ -147,7 +165,6 @@ class MapGenerator { } else { content = this.outputFile() + '.map' } - let eol = '\n' if (this.css.includes('\r\n')) eol = '\r\n' @@ -157,23 +174,40 @@ class MapGenerator { outputFile() { if (this.opts.to) { return this.path(this.opts.to) - } - if (this.opts.from) { + } else if (this.opts.from) { return this.path(this.opts.from) + } else { + return 'to.css' } - return 'to.css' } generateMap() { - this.generateString() + if (this.root) { + this.generateString() + } else if (this.previous().length === 1) { + let prev = this.previous()[0].consumer() + prev.file = this.outputFile() + this.map = SourceMapGenerator.fromSourceMap(prev) + } else { + this.map = new SourceMapGenerator({ file: this.outputFile() }) + this.map.addMapping({ + source: this.opts.from + ? this.toUrl(this.path(this.opts.from)) + : '', + generated: { line: 1, column: 0 }, + original: { line: 1, column: 0 } + }) + } + if (this.isSourcesContent()) this.setSourcesContent() - if (this.previous().length > 0) this.applyPrevMaps() + if (this.root && this.previous().length > 0) this.applyPrevMaps() if (this.isAnnotation()) this.addAnnotation() if (this.isInline()) { return [this.css] + } else { + return [this.css, this.map] } - return [this.css, this.map] } path(file) { @@ -193,7 +227,6 @@ class MapGenerator { toUrl(path) { if (sep === '\\') { - // istanbul ignore next path = path.replace(/\\/g, '/') } return encodeURI(path).replace(/[#?]/g, encodeURIComponent) @@ -206,7 +239,6 @@ class MapGenerator { if (pathToFileURL) { return pathToFileURL(node.source.input.from).toString() } else { - // istanbul ignore next throw new Error( '`map.absolute` option is not available in this PostCSS build' ) @@ -284,16 +316,15 @@ class MapGenerator { generate() { this.clearAnnotation() - if (pathAvailable && sourceMapAvailable && this.isMap()) { return this.generateMap() + } else { + let result = '' + this.stringify(this.root, i => { + result += i + }) + return [result] } - - let result = '' - this.stringify(this.root, i => { - result += i - }) - return [result] } } diff --git a/node_modules/postcss/lib/no-work-result.d.ts b/node_modules/postcss/lib/no-work-result.d.ts new file mode 100644 index 0000000000..7ba1462c57 --- /dev/null +++ b/node_modules/postcss/lib/no-work-result.d.ts @@ -0,0 +1,37 @@ +import Result, { Message, ResultOptions } from './result.js' +import { SourceMap } from './postcss.js' +import Processor from './processor.js' +import Warning from './warning.js' +import Root from './root.js' +import LazyResult from './lazy-result.js' + +/** + * A Promise proxy for the result of PostCSS transformations. + * This lazy result instance doesn't parse css unless `NoWorkResult#root` or `Result#root` + * are accessed. See the example below for details. + * A `NoWork` instance is returned by `Processor#process` ONLY when no plugins defined. + * + * ```js + * const noWorkResult = postcss().process(css) // No plugins are defined. + * // CSS is not parsed + * let root = noWorkResult.root // now css is parsed because we accessed the root + * ``` + */ +export default class NoWorkResult implements LazyResult { + then: Promise['then'] + catch: Promise['catch'] + finally: Promise['finally'] + constructor(processor: Processor, css: string, opts: ResultOptions) + get [Symbol.toStringTag](): string + get processor(): Processor + get opts(): ResultOptions + get css(): string + get content(): string + get map(): SourceMap + get root(): Root + get messages(): Message[] + warnings(): Warning[] + toString(): string + sync(): Result + async(): Promise +} diff --git a/node_modules/postcss/lib/no-work-result.js b/node_modules/postcss/lib/no-work-result.js new file mode 100644 index 0000000000..3dacb3a3c7 --- /dev/null +++ b/node_modules/postcss/lib/no-work-result.js @@ -0,0 +1,132 @@ +'use strict' + +let MapGenerator = require('./map-generator') +let stringify = require('./stringify') +let warnOnce = require('./warn-once') +let parse = require('./parse') +const Result = require('./result') + +class NoWorkResult { + constructor(processor, css, opts) { + css = css.toString() + this.stringified = false + + this._processor = processor + this._css = css + this._opts = opts + this._map = undefined + let root + + let str = stringify + this.result = new Result(this._processor, root, this._opts) + this.result.css = css + + let self = this + Object.defineProperty(this.result, 'root', { + get() { + return self.root + } + }) + + let map = new MapGenerator(str, root, this._opts, css) + if (map.isMap()) { + let [generatedCSS, generatedMap] = map.generate() + if (generatedCSS) { + this.result.css = generatedCSS + } + if (generatedMap) { + this.result.map = generatedMap + } + } + } + + get [Symbol.toStringTag]() { + return 'NoWorkResult' + } + + get processor() { + return this.result.processor + } + + get opts() { + return this.result.opts + } + + get css() { + return this.result.css + } + + get content() { + return this.result.css + } + + get map() { + return this.result.map + } + + get root() { + if (this._root) { + return this._root + } + + let root + let parser = parse + + try { + root = parser(this._css, this._opts) + } catch (error) { + this.error = error + } + + this._root = root + + return root + } + + get messages() { + return [] + } + + warnings() { + return [] + } + + toString() { + return this._css + } + + then(onFulfilled, onRejected) { + if (process.env.NODE_ENV !== 'production') { + if (!('from' in this._opts)) { + warnOnce( + 'Without `from` option PostCSS could generate wrong source map ' + + 'and will not find Browserslist config. Set it to CSS file path ' + + 'or to `undefined` to prevent this warning.' + ) + } + } + + return this.async().then(onFulfilled, onRejected) + } + + catch(onRejected) { + return this.async().catch(onRejected) + } + + finally(onFinally) { + return this.async().then(onFinally, onFinally) + } + + async() { + if (this.error) return Promise.reject(this.error) + return Promise.resolve(this.result) + } + + sync() { + if (this.error) throw this.error + return this.result + } +} + +module.exports = NoWorkResult +NoWorkResult.default = NoWorkResult diff --git a/node_modules/postcss/lib/node.d.ts b/node_modules/postcss/lib/node.d.ts index 9e46e87644..ded2dc0c80 100644 --- a/node_modules/postcss/lib/node.d.ts +++ b/node_modules/postcss/lib/node.d.ts @@ -38,17 +38,29 @@ export interface Position { line: number } +export interface Range { + /** + * Start position, inclusive. + */ + start: Position + + /** + * End position, exclusive. + */ + end: Position +} + export interface Source { /** * The file source of the node. */ input: Input /** - * The starting position of the node’s source. + * The inclusive starting position of the node’s source. */ start?: Position /** - * The ending position of the node's source. + * The inclusive ending position of the node's source. */ end?: Position } @@ -72,6 +84,11 @@ interface NodeErrorOptions { * of error. */ index?: number + /** + * An ending index inside a node's string that should be highlighted as + * source of error. + */ + endIndex?: number } /** @@ -441,4 +458,21 @@ export default abstract class Node { * @return Symbol position in file. */ positionInside(index: number): Position + + /** + * Get the position for a word or an index inside the node. + * + * @param opts Options. + * @return Position. + */ + positionBy(opts?: Pick): Position + + /** + * Get the range for a word or start and end index inside the node. + * The start index is inclusive; the end index is exclusive. + * + * @param opts Options. + * @return Range. + */ + rangeBy(opts?: Pick): Range } diff --git a/node_modules/postcss/lib/node.js b/node_modules/postcss/lib/node.js index d26ef1fdd0..bdcbac0e8a 100644 --- a/node_modules/postcss/lib/node.js +++ b/node_modules/postcss/lib/node.js @@ -10,7 +10,7 @@ function cloneNode(obj, parent) { for (let i in obj) { if (!Object.prototype.hasOwnProperty.call(obj, i)) { - // istanbul ignore next + /* c8 ignore next 2 */ continue } if (i === 'proxyCache') continue @@ -56,8 +56,13 @@ class Node { error(message, opts = {}) { if (this.source) { - let pos = this.positionBy(opts) - return this.source.input.error(message, pos.line, pos.column, opts) + let { start, end } = this.rangeBy(opts) + return this.source.input.error( + message, + { line: start.line, column: start.column }, + { line: end.line, column: end.column }, + opts + ) } return new CssSyntaxError(message) } @@ -184,7 +189,7 @@ class Node { for (let name in this) { if (!Object.prototype.hasOwnProperty.call(this, name)) { - // istanbul ignore next + /* c8 ignore next 2 */ continue } if (name === 'parent' || name === 'proxyCache') continue @@ -252,6 +257,59 @@ class Node { return pos } + rangeBy(opts) { + let start = { + line: this.source.start.line, + column: this.source.start.column + } + let end = this.source.end + ? { + line: this.source.end.line, + column: this.source.end.column + 1 + } + : { + line: start.line, + column: start.column + 1 + } + + if (opts.word) { + let index = this.toString().indexOf(opts.word) + if (index !== -1) { + start = this.positionInside(index) + end = this.positionInside(index + opts.word.length) + } + } else { + if (opts.start) { + start = { + line: opts.start.line, + column: opts.start.column + } + } else if (opts.index) { + start = this.positionInside(opts.index) + } + + if (opts.end) { + end = { + line: opts.end.line, + column: opts.end.column + } + } else if (opts.endIndex) { + end = this.positionInside(opts.endIndex) + } else if (opts.index) { + end = this.positionInside(opts.index + 1) + } + } + + if ( + end.line < start.line || + (end.line === start.line && end.column <= start.column) + ) { + end = { line: start.line, column: start.column + 1 } + } + + return { start, end } + } + getProxyProcessor() { return { set(node, prop, value) { @@ -263,6 +321,7 @@ class Node { prop === 'name' || prop === 'params' || prop === 'important' || + /* c8 ignore next */ prop === 'text' ) { node.markDirty() diff --git a/node_modules/postcss/lib/parser.js b/node_modules/postcss/lib/parser.js index 4144cc92d6..eb8fc41c69 100644 --- a/node_modules/postcss/lib/parser.js +++ b/node_modules/postcss/lib/parser.js @@ -511,15 +511,27 @@ class Parser { // Errors unclosedBracket(bracket) { - throw this.input.error('Unclosed bracket', bracket[2]) + throw this.input.error( + 'Unclosed bracket', + { offset: bracket[2] }, + { offset: bracket[2] + 1 } + ) } unknownWord(tokens) { - throw this.input.error('Unknown word', tokens[0][2]) + throw this.input.error( + 'Unknown word', + { offset: tokens[0][2] }, + { offset: tokens[0][2] + tokens[0][1].length } + ) } unexpectedClose(token) { - throw this.input.error('Unexpected }', token[2]) + throw this.input.error( + 'Unexpected }', + { offset: token[2] }, + { offset: token[2] + 1 } + ) } unclosedBlock() { @@ -528,11 +540,19 @@ class Parser { } doubleColon(token) { - throw this.input.error('Double colon', token[2]) + throw this.input.error( + 'Double colon', + { offset: token[2] }, + { offset: token[2] + token[1].length } + ) } unnamedAtrule(node, token) { - throw this.input.error('At-rule without name', token[2]) + throw this.input.error( + 'At-rule without name', + { offset: token[2] }, + { offset: token[2] + token[1].length } + ) } precheckMissedSemicolon(/* tokens */) { diff --git a/node_modules/postcss/lib/postcss.d.ts b/node_modules/postcss/lib/postcss.d.ts index 4458806632..30a0d08831 100644 --- a/node_modules/postcss/lib/postcss.d.ts +++ b/node_modules/postcss/lib/postcss.d.ts @@ -10,52 +10,53 @@ import Node, { AnyNode } from './node.js' import Declaration, { DeclarationProps } from './declaration.js' -import Root, { RootProps } from './root.js' +import Container, { ContainerProps } from './container.js' import Document, { DocumentProps } from './document.js' +import Warning, { WarningOptions } from './warning.js' import Comment, { CommentProps } from './comment.js' import AtRule, { AtRuleProps } from './at-rule.js' -import Result, { Message } from './result.js' -import LazyResult from './lazy-result.js' -import Rule, { RuleProps } from './rule.js' -import Container, { ContainerProps } from './container.js' -import Warning, { WarningOptions } from './warning.js' import Input, { FilePosition } from './input.js' +import Result, { Message } from './result.js' +import Root, { RootProps } from './root.js' +import Rule, { RuleProps } from './rule.js' import CssSyntaxError from './css-syntax-error.js' import list, { List } from './list.js' +import LazyResult from './lazy-result.js' import Processor from './processor.js' export { - WarningOptions, - FilePosition, - Position, - Source, - ChildNode, - AnyNode, - Message, NodeErrorOptions, - NodeProps, DeclarationProps, - ContainerProps, - CommentProps, - RuleProps, - ChildProps, - AtRuleProps, - RootProps, - DocumentProps, - Warning, CssSyntaxError, - Node, - Container, - list, + ContainerProps, + WarningOptions, + DocumentProps, + FilePosition, + CommentProps, + AtRuleProps, Declaration, - Comment, - AtRule, - Rule, - Root, - Document, - Result, + ChildProps, LazyResult, - Input + ChildNode, + NodeProps, + Processor, + RuleProps, + RootProps, + Container, + Position, + Document, + AnyNode, + Warning, + Message, + Comment, + Source, + AtRule, + Result, + Input, + Node, + list, + Rule, + Root } export type SourceMap = SourceMapGenerator & { @@ -221,7 +222,7 @@ export type AcceptedPlugin = } | Processor -export interface Parser { +export interface Parser { ( css: string | { toString(): string }, opts?: Pick @@ -245,7 +246,7 @@ export interface Syntax { /** * Function to generate AST by string. */ - parse?: Parser + parse?: Parser /** * Class to generate string by AST. @@ -378,7 +379,7 @@ export interface Postcss { * root1.append(root2).toResult().css * ``` */ - parse: Parser + parse: Parser /** * Rehydrate a JSON AST (from `Node#toJSON`) back into the AST classes. @@ -458,7 +459,7 @@ export interface Postcss { } export const stringify: Stringifier -export const parse: Parser +export const parse: Parser export const fromJSON: JSONHydrator export const comment: Postcss['comment'] diff --git a/node_modules/postcss/lib/postcss.js b/node_modules/postcss/lib/postcss.js index b03bb1803e..d3f640e4e7 100644 --- a/node_modules/postcss/lib/postcss.js +++ b/node_modules/postcss/lib/postcss.js @@ -27,14 +27,17 @@ function postcss(...plugins) { } postcss.plugin = function plugin(name, initializer) { + // eslint-disable-next-line no-console if (console && console.warn) { + // eslint-disable-next-line no-console console.warn( name + ': postcss.plugin was deprecated. Migration guide:\n' + 'https://evilmartians.com/chronicles/postcss-8-plugin-migration' ) if (process.env.LANG && process.env.LANG.startsWith('cn')) { - // istanbul ignore next + /* c8 ignore next 7 */ + // eslint-disable-next-line no-console console.warn( name + ': 里面 postcss.plugin 被弃用. 迁移指南:\n' + @@ -79,6 +82,7 @@ postcss.document = defaults => new Document(defaults) postcss.CssSyntaxError = CssSyntaxError postcss.Declaration = Declaration postcss.Container = Container +postcss.Processor = Processor postcss.Document = Document postcss.Comment = Comment postcss.Warning = Warning diff --git a/node_modules/postcss/lib/postcss.mjs b/node_modules/postcss/lib/postcss.mjs index 6ba7d11240..35075988c6 100644 --- a/node_modules/postcss/lib/postcss.mjs +++ b/node_modules/postcss/lib/postcss.mjs @@ -18,6 +18,7 @@ export const root = postcss.root export const CssSyntaxError = postcss.CssSyntaxError export const Declaration = postcss.Declaration export const Container = postcss.Container +export const Processor = postcss.Processor export const Document = postcss.Document export const Comment = postcss.Comment export const Warning = postcss.Warning diff --git a/node_modules/postcss/lib/previous-map.js b/node_modules/postcss/lib/previous-map.js index bcc378d5b7..d13a93a31c 100644 --- a/node_modules/postcss/lib/previous-map.js +++ b/node_modules/postcss/lib/previous-map.js @@ -8,7 +8,7 @@ function fromBase64(str) { if (Buffer) { return Buffer.from(str, 'base64').toString() } else { - // istanbul ignore next + /* c8 ignore next 2 */ return window.atob(str) } } diff --git a/node_modules/postcss/lib/processor.d.ts b/node_modules/postcss/lib/processor.d.ts index 1511f0100f..e1affa48ac 100644 --- a/node_modules/postcss/lib/processor.d.ts +++ b/node_modules/postcss/lib/processor.d.ts @@ -8,13 +8,14 @@ import { import LazyResult from './lazy-result.js' import Result from './result.js' import Root from './root.js' +import NoWorkResult from './no-work-result.js' /** * Contains plugins to process CSS. Create one `Processor` instance, * initialize its plugins, and then use that instance on numerous CSS files. * * ```js - * const processor = postcss([autoprefixer, precss]) + * const processor = postcss([autoprefixer, postcssNested]) * processor.process(css1).then(result => console.log(result.css)) * processor.process(css2).then(result => console.log(result.css)) * ``` @@ -35,7 +36,7 @@ export default class Processor { * Plugins added to this processor. * * ```js - * const processor = postcss([autoprefixer, precss]) + * const processor = postcss([autoprefixer, postcssNested]) * processor.plugins.length //=> 2 * ``` */ @@ -67,7 +68,7 @@ export default class Processor { * ```js * const processor = postcss() * .use(autoprefixer) - * .use(precss) + * .use(postcssNested) * ``` * * @param plugin PostCSS plugin or `Processor` with plugins. @@ -97,5 +98,5 @@ export default class Processor { process( css: string | { toString(): string } | Result | LazyResult | Root, options?: ProcessOptions - ): LazyResult + ): LazyResult | NoWorkResult } diff --git a/node_modules/postcss/lib/processor.js b/node_modules/postcss/lib/processor.js index e3e3bbe59c..82430a422c 100644 --- a/node_modules/postcss/lib/processor.js +++ b/node_modules/postcss/lib/processor.js @@ -1,12 +1,13 @@ 'use strict' +let NoWorkResult = require('./no-work-result') let LazyResult = require('./lazy-result') let Document = require('./document') let Root = require('./root') class Processor { constructor(plugins = []) { - this.version = '8.3.11' + this.version = '8.4.5' this.plugins = this.normalize(plugins) } @@ -20,20 +21,12 @@ class Processor { this.plugins.length === 0 && typeof opts.parser === 'undefined' && typeof opts.stringifier === 'undefined' && - typeof opts.syntax === 'undefined' && - !opts.hideNothingWarning + typeof opts.syntax === 'undefined' ) { - if (process.env.NODE_ENV !== 'production') { - if (typeof console !== 'undefined' && console.warn) { - console.warn( - 'You did not set any plugins, parser, or stringifier. ' + - 'Right now, PostCSS does nothing. Pick plugins for your case ' + - 'on https://www.postcss.parts/ and use them in postcss.config.js.' - ) - } - } + return new NoWorkResult(this, css, opts) + } else { + return new LazyResult(this, css, opts) } - return new LazyResult(this, css, opts) } normalize(plugins) { diff --git a/node_modules/postcss/lib/result.d.ts b/node_modules/postcss/lib/result.d.ts index 11e7bf4355..8a582b69ea 100644 --- a/node_modules/postcss/lib/result.d.ts +++ b/node_modules/postcss/lib/result.d.ts @@ -4,6 +4,7 @@ import { SourceMap, TransformCallback, Root, + Document, Node, Warning, WarningOptions @@ -94,7 +95,7 @@ export default class Result { * root.toResult().root === root * ``` */ - root: Root + root: Root | Document /** * Options from the `Processor#process` or `Root#toResult` call @@ -141,7 +142,7 @@ export default class Result { * @param root Root node after all transformations. * @param opts Options from the `Processor#process` or `Root#toResult`. */ - constructor(processor: Processor, root: Root, opts: ResultOptions) + constructor(processor: Processor, root: Root | Document, opts: ResultOptions) /** * An alias for the `Result#css` property. diff --git a/node_modules/postcss/lib/rule.d.ts b/node_modules/postcss/lib/rule.d.ts index 75ddf31ed7..ad6abb5ffb 100644 --- a/node_modules/postcss/lib/rule.d.ts +++ b/node_modules/postcss/lib/rule.d.ts @@ -1,6 +1,6 @@ import Container, { ContainerProps } from './container.js' -interface RuleRaws { +interface RuleRaws extends Record { /** * The space symbols before the node. It also stores `*` * and `_` symbols before the declaration (IE hack). diff --git a/node_modules/postcss/lib/stringifier.d.ts b/node_modules/postcss/lib/stringifier.d.ts new file mode 100644 index 0000000000..23289dfb59 --- /dev/null +++ b/node_modules/postcss/lib/stringifier.d.ts @@ -0,0 +1,37 @@ +import { + Document, + Root, + Comment, + Declaration, + Builder, + AnyNode, + Rule, + AtRule, + Container +} from './postcss.js' + +export default class Stringifier { + builder: Builder + constructor(builder: Builder) + stringify(node: AnyNode, semicolon?: boolean): void + document(node: Document): void + root(node: Root): void + comment(node: Comment): void + decl(node: Declaration, semicolon?: boolean): void + rule(node: Rule): void + atrule(node: AtRule, semicolon?: boolean): void + body(node: Container): void + block(node: AnyNode, start: string): void + raw(node: AnyNode, own: string | null, detect?: string): string + rawSemicolon(root: Root): boolean | undefined + rawEmptyBody(root: Root): string | undefined + rawIndent(root: Root): string | undefined + rawBeforeComment(root: Root, node: Comment): string | undefined + rawBeforeDecl(root: Root, node: Declaration): string | undefined + rawBeforeRule(root: Root): string | undefined + rawBeforeClose(root: Root): string | undefined + rawBeforeOpen(root: Root): string | undefined + rawColon(root: Root): string | undefined + beforeAfter(node: AnyNode, detect: 'before' | 'after'): string + rawValue(node: AnyNode, prop: string): string +} diff --git a/node_modules/postcss/lib/stringifier.js b/node_modules/postcss/lib/stringifier.js index 81e1251825..4065c47524 100644 --- a/node_modules/postcss/lib/stringifier.js +++ b/node_modules/postcss/lib/stringifier.js @@ -25,7 +25,7 @@ class Stringifier { } stringify(node, semicolon) { - /* istanbul ignore if */ + /* c8 ignore start */ if (!this[node.type]) { throw new Error( 'Unknown AST node type ' + @@ -34,6 +34,7 @@ class Stringifier { 'Maybe you need to change PostCSS stringifier.' ) } + /* c8 ignore stop */ this[node.type](node, semicolon) } @@ -349,3 +350,4 @@ class Stringifier { } module.exports = Stringifier +Stringifier.default = Stringifier diff --git a/node_modules/postcss/lib/warn-once.js b/node_modules/postcss/lib/warn-once.js index 6896b75858..316e1cf462 100644 --- a/node_modules/postcss/lib/warn-once.js +++ b/node_modules/postcss/lib/warn-once.js @@ -1,3 +1,4 @@ +/* eslint-disable no-console */ 'use strict' let printed = {} diff --git a/node_modules/postcss/lib/warning.d.ts b/node_modules/postcss/lib/warning.d.ts index a285367fe7..838bef1853 100644 --- a/node_modules/postcss/lib/warning.d.ts +++ b/node_modules/postcss/lib/warning.d.ts @@ -1,3 +1,4 @@ +import { RangePosition } from './css-syntax-error.js' import Node from './node.js' export interface WarningOptions { @@ -12,10 +13,25 @@ export interface WarningOptions { word?: string /** - * Index in CSS node string that caused the warning. + * Start index, inclusive, in CSS node string that caused the warning. */ index?: number + /** + * End index, exclusive, in CSS node string that caused the warning. + */ + endIndex?: number + + /** + * Start position, inclusive, in CSS node string that caused the warning. + */ + start?: RangePosition + + /** + * End position, exclusive, in CSS node string that caused the warning. + */ + end?: RangePosition + /** * Name of the plugin that created this warning. `Result#warn` fills * this property automatically. @@ -68,7 +84,7 @@ export default class Warning { node: Node /** - * Line in the input file with this warning’s source. + * Line for inclusive start position in the input file with this warning’s source. * * ```js * warning.line //=> 5 @@ -77,7 +93,7 @@ export default class Warning { line: number /** - * Column in the input file with this warning’s source. + * Column for inclusive start position in the input file with this warning’s source. * * ```js * warning.column //=> 6 @@ -85,6 +101,24 @@ export default class Warning { */ column: number + /** + * Line for exclusive end position in the input file with this warning’s source. + * + * ```js + * warning.endLine //=> 6 + * ``` + */ + endLine?: number + + /** + * Column for exclusive end position in the input file with this warning’s source. + * + * ```js + * warning.endColumn //=> 4 + * ``` + */ + endColumn?: number + /** * @param text Warning message. * @param opts Warning options. diff --git a/node_modules/postcss/lib/warning.js b/node_modules/postcss/lib/warning.js index cdb0281db7..65aa5252fe 100644 --- a/node_modules/postcss/lib/warning.js +++ b/node_modules/postcss/lib/warning.js @@ -6,9 +6,11 @@ class Warning { this.text = text if (opts.node && opts.node.source) { - let pos = opts.node.positionBy(opts) - this.line = pos.line - this.column = pos.column + let range = opts.node.rangeBy(opts) + this.line = range.start.line + this.column = range.start.column + this.endLine = range.end.line + this.endColumn = range.end.column } for (let opt in opts) this[opt] = opts[opt] diff --git a/node_modules/postcss/package.json b/node_modules/postcss/package.json old mode 100644 new mode 100755 index 042665a5ef..3adefb38d9 --- a/node_modules/postcss/package.json +++ b/node_modules/postcss/package.json @@ -1,6 +1,6 @@ { "name": "postcss", - "version": "8.3.11", + "version": "8.4.5", "description": "Tool for transforming styles with JS plugins", "engines": { "node": "^10 || ^12 || >=14" @@ -19,6 +19,7 @@ "./lib/fromJSON": "./lib/fromJSON.js", "./lib/input": "./lib/input.js", "./lib/lazy-result": "./lib/lazy-result.js", + "./lib/no-work-result": "./lib/no-work-result.js", "./lib/list": "./lib/list.js", "./lib/map-generator": "./lib/map-generator.js", "./lib/node": "./lib/node.js", @@ -66,7 +67,7 @@ "dependencies": { "nanoid": "^3.1.30", "picocolors": "^1.0.0", - "source-map-js": "^0.6.2" + "source-map-js": "^1.0.1" }, "browser": { "./lib/terminal-highlight": false, diff --git a/node_modules/source-map-js/CHANGELOG.md b/node_modules/source-map-js/CHANGELOG.md deleted file mode 100644 index 3a8c066c66..0000000000 --- a/node_modules/source-map-js/CHANGELOG.md +++ /dev/null @@ -1,301 +0,0 @@ -# Change Log - -## 0.5.6 - -* Fix for regression when people were using numbers as names in source maps. See - #236. - -## 0.5.5 - -* Fix "regression" of unsupported, implementation behavior that half the world - happens to have come to depend on. See #235. - -* Fix regression involving function hoisting in SpiderMonkey. See #233. - -## 0.5.4 - -* Large performance improvements to source-map serialization. See #228 and #229. - -## 0.5.3 - -* Do not include unnecessary distribution files. See - commit ef7006f8d1647e0a83fdc60f04f5a7ca54886f86. - -## 0.5.2 - -* Include browser distributions of the library in package.json's `files`. See - issue #212. - -## 0.5.1 - -* Fix latent bugs in IndexedSourceMapConsumer.prototype._parseMappings. See - ff05274becc9e6e1295ed60f3ea090d31d843379. - -## 0.5.0 - -* Node 0.8 is no longer supported. - -* Use webpack instead of dryice for bundling. - -* Big speedups serializing source maps. See pull request #203. - -* Fix a bug with `SourceMapConsumer.prototype.sourceContentFor` and sources that - explicitly start with the source root. See issue #199. - -## 0.4.4 - -* Fix an issue where using a `SourceMapGenerator` after having created a - `SourceMapConsumer` from it via `SourceMapConsumer.fromSourceMap` failed. See - issue #191. - -* Fix an issue with where `SourceMapGenerator` would mistakenly consider - different mappings as duplicates of each other and avoid generating them. See - issue #192. - -## 0.4.3 - -* A very large number of performance improvements, particularly when parsing - source maps. Collectively about 75% of time shaved off of the source map - parsing benchmark! - -* Fix a bug in `SourceMapConsumer.prototype.allGeneratedPositionsFor` and fuzzy - searching in the presence of a column option. See issue #177. - -* Fix a bug with joining a source and its source root when the source is above - the root. See issue #182. - -* Add the `SourceMapConsumer.prototype.hasContentsOfAllSources` method to - determine when all sources' contents are inlined into the source map. See - issue #190. - -## 0.4.2 - -* Add an `.npmignore` file so that the benchmarks aren't pulled down by - dependent projects. Issue #169. - -* Add an optional `column` argument to - `SourceMapConsumer.prototype.allGeneratedPositionsFor` and better handle lines - with no mappings. Issues #172 and #173. - -## 0.4.1 - -* Fix accidentally defining a global variable. #170. - -## 0.4.0 - -* The default direction for fuzzy searching was changed back to its original - direction. See #164. - -* There is now a `bias` option you can supply to `SourceMapConsumer` to control - the fuzzy searching direction. See #167. - -* About an 8% speed up in parsing source maps. See #159. - -* Added a benchmark for parsing and generating source maps. - -## 0.3.0 - -* Change the default direction that searching for positions fuzzes when there is - not an exact match. See #154. - -* Support for environments using json2.js for JSON serialization. See #156. - -## 0.2.0 - -* Support for consuming "indexed" source maps which do not have any remote - sections. See pull request #127. This introduces a minor backwards - incompatibility if you are monkey patching `SourceMapConsumer.prototype` - methods. - -## 0.1.43 - -* Performance improvements for `SourceMapGenerator` and `SourceNode`. See issue - #148 for some discussion and issues #150, #151, and #152 for implementations. - -## 0.1.42 - -* Fix an issue where `SourceNode`s from different versions of the source-map - library couldn't be used in conjunction with each other. See issue #142. - -## 0.1.41 - -* Fix a bug with getting the source content of relative sources with a "./" - prefix. See issue #145 and [Bug 1090768](bugzil.la/1090768). - -* Add the `SourceMapConsumer.prototype.computeColumnSpans` method to compute the - column span of each mapping. - -* Add the `SourceMapConsumer.prototype.allGeneratedPositionsFor` method to find - all generated positions associated with a given original source and line. - -## 0.1.40 - -* Performance improvements for parsing source maps in SourceMapConsumer. - -## 0.1.39 - -* Fix a bug where setting a source's contents to null before any source content - had been set before threw a TypeError. See issue #131. - -## 0.1.38 - -* Fix a bug where finding relative paths from an empty path were creating - absolute paths. See issue #129. - -## 0.1.37 - -* Fix a bug where if the source root was an empty string, relative source paths - would turn into absolute source paths. Issue #124. - -## 0.1.36 - -* Allow the `names` mapping property to be an empty string. Issue #121. - -## 0.1.35 - -* A third optional parameter was added to `SourceNode.fromStringWithSourceMap` - to specify a path that relative sources in the second parameter should be - relative to. Issue #105. - -* If no file property is given to a `SourceMapGenerator`, then the resulting - source map will no longer have a `null` file property. The property will - simply not exist. Issue #104. - -* Fixed a bug where consecutive newlines were ignored in `SourceNode`s. - Issue #116. - -## 0.1.34 - -* Make `SourceNode` work with windows style ("\r\n") newlines. Issue #103. - -* Fix bug involving source contents and the - `SourceMapGenerator.prototype.applySourceMap`. Issue #100. - -## 0.1.33 - -* Fix some edge cases surrounding path joining and URL resolution. - -* Add a third parameter for relative path to - `SourceMapGenerator.prototype.applySourceMap`. - -* Fix issues with mappings and EOLs. - -## 0.1.32 - -* Fixed a bug where SourceMapConsumer couldn't handle negative relative columns - (issue 92). - -* Fixed test runner to actually report number of failed tests as its process - exit code. - -* Fixed a typo when reporting bad mappings (issue 87). - -## 0.1.31 - -* Delay parsing the mappings in SourceMapConsumer until queried for a source - location. - -* Support Sass source maps (which at the time of writing deviate from the spec - in small ways) in SourceMapConsumer. - -## 0.1.30 - -* Do not join source root with a source, when the source is a data URI. - -* Extend the test runner to allow running single specific test files at a time. - -* Performance improvements in `SourceNode.prototype.walk` and - `SourceMapConsumer.prototype.eachMapping`. - -* Source map browser builds will now work inside Workers. - -* Better error messages when attempting to add an invalid mapping to a - `SourceMapGenerator`. - -## 0.1.29 - -* Allow duplicate entries in the `names` and `sources` arrays of source maps - (usually from TypeScript) we are parsing. Fixes github issue 72. - -## 0.1.28 - -* Skip duplicate mappings when creating source maps from SourceNode; github - issue 75. - -## 0.1.27 - -* Don't throw an error when the `file` property is missing in SourceMapConsumer, - we don't use it anyway. - -## 0.1.26 - -* Fix SourceNode.fromStringWithSourceMap for empty maps. Fixes github issue 70. - -## 0.1.25 - -* Make compatible with browserify - -## 0.1.24 - -* Fix issue with absolute paths and `file://` URIs. See - https://bugzilla.mozilla.org/show_bug.cgi?id=885597 - -## 0.1.23 - -* Fix issue with absolute paths and sourcesContent, github issue 64. - -## 0.1.22 - -* Ignore duplicate mappings in SourceMapGenerator. Fixes github issue 21. - -## 0.1.21 - -* Fixed handling of sources that start with a slash so that they are relative to - the source root's host. - -## 0.1.20 - -* Fixed github issue #43: absolute URLs aren't joined with the source root - anymore. - -## 0.1.19 - -* Using Travis CI to run tests. - -## 0.1.18 - -* Fixed a bug in the handling of sourceRoot. - -## 0.1.17 - -* Added SourceNode.fromStringWithSourceMap. - -## 0.1.16 - -* Added missing documentation. - -* Fixed the generating of empty mappings in SourceNode. - -## 0.1.15 - -* Added SourceMapGenerator.applySourceMap. - -## 0.1.14 - -* The sourceRoot is now handled consistently. - -## 0.1.13 - -* Added SourceMapGenerator.fromSourceMap. - -## 0.1.12 - -* SourceNode now generates empty mappings too. - -## 0.1.11 - -* Added name support to SourceNode. - -## 0.1.10 - -* Added sourcesContent support to the customer and generator. diff --git a/node_modules/source-map-js/README.md b/node_modules/source-map-js/README.md index 1605d1ea39..ba200e64c6 100644 --- a/node_modules/source-map-js/README.md +++ b/node_modules/source-map-js/README.md @@ -1,10 +1,8 @@ # Source Map JS - - [![NPM](https://nodei.co/npm/source-map-js.png?downloads=true&downloadRank=true)](https://www.npmjs.com/package/source-map-js) -## Difference between original [source-map](https://github.com/mozilla/source-map) +Difference between original [source-map](https://github.com/mozilla/source-map): > TL,DR: it's fork of original source-map@0.6, but with perfomance optimizations. @@ -27,734 +25,5 @@ This is a library to generate and consume the source map format [format]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit -## Use with Node - - $ npm install source-map-js - - - --------------------------------------------------------------------------------- - - - - - -## 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) - - [new SourceMapConsumer(rawSourceMap)](#new-sourcemapconsumerrawsourcemap) - - [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) - - - -## Examples - -### Consuming a source map - -```js -var 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' -}; - -var smc = new SourceMapConsumer(rawSourceMap); - -console.log(smc.sources); -// [ 'http://example.com/www/js/one.js', -// 'http://example.com/www/js/two.js' ] - -console.log(smc.originalPositionFor({ - line: 2, - column: 28 -})); -// { source: 'http://example.com/www/js/two.js', -// line: 2, -// column: 10, -// name: 'n' } - -console.log(smc.generatedPositionFor({ - source: 'http://example.com/www/js/two.js', - line: 2, - column: 10 -})); -// { line: 2, column: 28 } - -smc.eachMapping(function (m) { - // ... -}); -``` - -### 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. - -#### 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. - -```js -var consumer = new sourceMap.SourceMapConsumer(rawSourceMapJsonData); -``` - -#### 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 -var consumer = new SourceMapConsumer(fs.readFileSync("path/to/my-file.js.map", "utf8")); -var 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] } -``` \ No newline at end of file +## Docs +Read **[full docs](https://github.com/7rulnik/source-map#readme)** on GitHub. diff --git a/node_modules/source-map-js/dist/source-map.debug.js b/node_modules/source-map-js/dist/source-map.debug.js deleted file mode 100644 index 52a186a50e..0000000000 --- a/node_modules/source-map-js/dist/source-map.debug.js +++ /dev/null @@ -1,3391 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - /* - * 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 = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).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. - */ - function SourceMapGenerator(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; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var 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) { - var sourceRelative = sourceFile; - if (sourceRoot !== null) { - sourceRelative = util.relative(sourceRoot, sourceFile); - } - - if (!generator._sources.has(sourceRelative)) { - generator._sources.add(sourceRelative); - } - - var 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. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var 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: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var 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. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var 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; - } - var 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. - var newSources = new ArraySet(); - var 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. - var 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; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var 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 (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, 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. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_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. - return; - } - 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. - return; - } - 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. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var 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; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var 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. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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. - */ - - var base64 = __webpack_require__(3); - - // 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 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var 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 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var 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; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - /* -*- 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 - */ - - var 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); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - /* -*- 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; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var 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) { - var 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; - - var 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) { - var cache = []; - - return function(input) { - for (var i = 0; i < cache.length; i++) { - if (cache[i].input === input) { - var temp = cache[0]; - cache[0] = cache[i]; - cache[i] = temp; - return cache[0].result; - } - } - - var 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 '

/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - var normalize = lruMemoize(function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - // Split the path into parts between `/` characters. This is much faster than - // using `.split(/\/+/g)`. - var parts = []; - var start = 0; - var 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++; - } - } - } - - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - 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 = "."; - } - var aPathUrl = urlParse(aPath); - var 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); - } - - var 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. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var 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; - - var supportsNullProto = (function () { - var 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; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - 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; - } - - for (var 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) { - var 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; - - function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) { - var 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.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource; - - /** - * 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) { - var 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 compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) { - var 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.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine; - - 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) { - var 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) { - var parsed = urlParse(sourceMapURL); - if (!parsed) { - throw new Error("sourceMapURL could not be parsed"); - } - if (parsed.path) { - // Strip the last path component, but keep the "/". - var 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; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - var has = Object.prototype.hasOwnProperty; - var hasNativeMap = typeof Map !== "undefined"; - - /** - * 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. - */ - function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var 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 - */ - ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_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. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var 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 neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - 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. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_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. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) - : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__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. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * 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). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * 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`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var 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."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - return { - source: 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); - }; - - /** - * 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. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var 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. - var 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 []; - } - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var 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) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var 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) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - 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 referrenced 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# - */ - function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var 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. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var 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 != this._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. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this._absoluteSources = this._sources.toArray().map(function (s) { - return util.computeSourceURL(sourceRoot, s, aSourceMapURL); - }); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this._sourceMapURL = aSourceMapURL; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Utility function to find the index of a source. Returns -1 if not - * found. - */ - BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { - var 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. - var i; - for (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 - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - smc._sourceMapURL = aSourceMapURL; - smc._absoluteSources = smc._sources.toArray().map(function (s) { - return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); - }); - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._absoluteSources.slice(); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = 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). - */ - - const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine; - function sortGenerated(array, start) { - let l = array.length; - let n = array.length - start; - if (n <= 1) { - return; - } else if (n == 2) { - let a = array[start]; - let b = array[start + 1]; - if (compareGenerated(a, b) > 0) { - array[start] = b; - array[start + 1] = a; - } - } else if (n < 20) { - for (let i = start; i < l; i++) { - for (let j = i; j > start; j--) { - let a = array[j - 1]; - let b = array[j]; - if (compareGenerated(a, b) <= 0) { - break; - } - array[j - 1] = b; - array[j] = a; - } - } - } else { - quickSort(array, compareGenerated, start); - } - } - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - let subarrayStart = 0; - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - - sortGenerated(generatedMappings, subarrayStart); - subarrayStart = generatedMappings.length; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - let currentSource = mapping.source; - while (originalMappings.length <= currentSource) { - originalMappings.push(null); - } - if (originalMappings[currentSource] === null) { - originalMappings[currentSource] = []; - } - originalMappings[currentSource].push(mapping); - } - } - } - - sortGenerated(generatedMappings, subarrayStart); - this.__generatedMappings = generatedMappings; - - for (var i = 0; i < originalMappings.length; i++) { - if (originalMappings[i] != null) { - quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource); - } - } - this.__originalMappings = [].concat(...originalMappings); - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_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); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * 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. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: 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. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_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. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - var index = this._findSourceIndex(aSource); - if (index >= 0) { - return this.sourcesContent[index]; - } - - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - var 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. - var 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; - } - else { - 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. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - source = this._findSourceIndex(source); - if (source < 0) { - return { - line: null, - column: null, - lastColumn: null - }; - } - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - 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 - */ - function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (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.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var 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; - - 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: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var 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. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var 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. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var 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. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_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. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - 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. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var 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; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var 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). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = null; - if (mapping.name) { - name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(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. - var adjustedMapping = { - source: 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: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - - /* -*- 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. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var 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; - } else { - return mid; - } - } - else { - // 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; - } else { - 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; - } - - var 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; - }; - - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - - /* -*- 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 - */ - - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - function SortTemplate(comparator) { - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot, false) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - return doQuickSort; - } - - function cloneSort(comparator) { - let template = SortTemplate.toString(); - let templateFn = new Function(`return ${template}`)(); - return templateFn(comparator); - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - - let sortCache = new WeakMap(); - exports.quickSort = function (ary, comparator, start = 0) { - let doQuickSort = sortCache.get(comparator); - if (doQuickSort === void 0) { - doQuickSort = cloneSort(comparator); - sortCache.set(comparator, doQuickSort); - } - doQuickSort(ary, comparator, start, ary.length - 1); - }; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var 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! - var 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. - */ - function SourceNode(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. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var 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`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var 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. - var lastMapping = null; - - 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" - var nextLine = remainingLines[remainingLinesIndex] || ''; - var 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) { - var 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) { - var 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 { - var 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. - */ - SourceNode.prototype.add = function SourceNode_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. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var 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. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var 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. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var 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. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var 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 - */ - SourceNode.prototype.setSourceContent = - function SourceNode_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. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var 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. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var 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 (var 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: map }; - }; - - exports.SourceNode = SourceNode; - - -/***/ }) -/******/ ]) -}); -; -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vd2VicGFjay91bml2ZXJzYWxNb2R1bGVEZWZpbml0aW9uIiwid2VicGFjazovLy93ZWJwYWNrL2Jvb3RzdHJhcCA1ZjU4ZWYyOTdlOTNjNDBkOTE4MiIsIndlYnBhY2s6Ly8vLi9zb3VyY2UtbWFwLmpzIiwid2VicGFjazovLy8uL2xpYi9zb3VyY2UtbWFwLWdlbmVyYXRvci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LXZscS5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmFzZTY0LmpzIiwid2VicGFjazovLy8uL2xpYi91dGlsLmpzIiwid2VicGFjazovLy8uL2xpYi9hcnJheS1zZXQuanMiLCJ3ZWJwYWNrOi8vLy4vbGliL21hcHBpbmctbGlzdC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW1hcC1jb25zdW1lci5qcyIsIndlYnBhY2s6Ly8vLi9saWIvYmluYXJ5LXNlYXJjaC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvcXVpY2stc29ydC5qcyIsIndlYnBhY2s6Ly8vLi9saWIvc291cmNlLW5vZGUuanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0EsQ0FBQztBQUNELE87QUNWQTtBQUNBOztBQUVBO0FBQ0E7O0FBRUE7QUFDQTtBQUNBOztBQUVBO0FBQ0E7QUFDQ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2luYWwuc291cmNlICE9IG51bGwpIHtcbiAgICAgICAgICAvLyBDb3B5IG1hcHBpbmdcbiAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IG9yaWdpbmFsLnNvdXJjZTtcbiAgICAgICAgICBpZiAoYVNvdXJjZU1hcFBhdGggIT0gbnVsbCkge1xuICAgICAgICAgICAgbWFwcGluZy5zb3VyY2UgPSB1dGlsLmpvaW4oYVNvdXJjZU1hcFBhdGgsIG1hcHBpbmcuc291cmNlKVxuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAoc291cmNlUm9vdCAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLnNvdXJjZSA9IHV0aWwucmVsYXRpdmUoc291cmNlUm9vdCwgbWFwcGluZy5zb3VyY2UpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBtYXBwaW5nLm9yaWdpbmFsTGluZSA9IG9yaWdpbmFsLmxpbmU7XG4gICAgICAgICAgbWFwcGluZy5vcmlnaW5hbENvbHVtbiA9IG9yaWdpbmFsLmNvbHVtbjtcbiAgICAgICAgICBpZiAob3JpZ2luYWwubmFtZSAhPSBudWxsKSB7XG4gICAgICAgICAgICBtYXBwaW5nLm5hbWUgPSBvcmlnaW5hbC5uYW1lO1xuICAgICAgICAgIH1cbiAgICAgICAgfVxuICAgICAgfVxuXG4gICAgICB2YXIgc291cmNlID0gbWFwcGluZy5zb3VyY2U7XG4gICAgICBpZiAoc291cmNlICE9IG51bGwgJiYgIW5ld1NvdXJjZXMuaGFzKHNvdXJjZSkpIHtcbiAgICAgICAgbmV3U291cmNlcy5hZGQoc291cmNlKTtcbiAgICAgIH1cblxuICAgICAgdmFyIG5hbWUgPSBtYXBwaW5nLm5hbWU7XG4gICAgICBpZiAobmFtZSAhPSBudWxsICYmICFuZXdOYW1lcy5oYXMobmFtZSkpIHtcbiAgICAgICAgbmV3TmFtZXMuYWRkKG5hbWUpO1xuICAgICAgfVxuXG4gICAgfSwgdGhpcyk7XG4gICAgdGhpc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4gICAgdmFyIHNvdXJjZXMgPSBzbWMuX3NvdXJjZXMgPSBBcnJheVNldC5mcm9tQXJyYXkoYVNvdXJjZU1hcC5fc291cmNlcy50b0FycmF5KCksIHRydWUpO1xuICAgIHNtYy5zb3VyY2VSb290ID0gYVNvdXJjZU1hcC5fc291cmNlUm9vdDtcbiAgICBzbWMuc291cmNlc0NvbnRlbnQgPSBhU291cmNlTWFwLl9nZW5lcmF0ZVNvdXJjZXNDb250ZW50KHNtYy5fc291cmNlcy50b0FycmF5KCksXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzbWMuc291cmNlUm9vdCk7XG4gICAgc21jLmZpbGUgPSBhU291cmNlTWFwLl9maWxlO1xuICAgIHNtYy5fc291cmNlTWFwVVJMID0gYVNvdXJjZU1hcFVSTDtcbiAgICBzbWMuX2Fic29sdXRlU291cmNlcyA9IHNtYy5fc291cmNlcy50b0FycmF5KCkubWFwKGZ1bmN0aW9uIChzKSB7XG4gICAgICByZXR1cm4gdXRpbC5jb21wdXRlU291cmNlVVJMKHNtYy5zb3VyY2VSb290LCBzLCBhU291cmNlTWFwVVJMKTtcbiAgICB9KTtcblxuICAgIC8vIEJlY2F1c2Ugd2UgYXJlIG1vZGlmeWluZyB0aGUgZW50cmllcyAoYnkgY29udmVydGluZyBzdHJpbmcgc291cmNlcyBhbmRcbiAgICAvLyBuYW1lcyB0byBpbmRpY2VzIGludG8gdGhlIHNvdXJjZXMgYW5kIG5hbWVzIEFycmF5U2V0cyksIHdlIGhhdmUgdG8gbWFrZVxuICAgIC8vIGEgY29weSBvZiB0aGUgZW50cnkgb3IgZWxzZSBiYWQgdGhpbmdzIGhhcHBlbi4gU2hhcmVkIG11dGFibGUgc3RhdGVcbiAgICAvLyBzdHJpa2VzIGFnYWluISBTZWUgZ2l0aHViIGlzc3VlICMxOTEuXG5cbiAgICB2YXIgZ2VuZXJhdGVkTWFwcGluZ3MgPSBhU291cmNlTW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1xuICAgICAgICB2YXIgc291cmNlID0gdXRpbC5nZXRBcmcobWFwcGluZywgJ3NvdXJjZScsIG51bGwpO1xuICAgICAgICBpZiAoc291cmNlICE9PSBudWxsKSB7XG4gICAgICAgICAgc291cmNlID0gdGhpcy5fc291cmNlcy5hdChzb3VyY2UpO1xuICAgICAgICAgIHNvdXJjZSA9IHV0aWwuY29tcHV0ZVNvdXJjZVVSTCh0aGlzLnNvdXJjZVJvb3QsIHNvdXJjZSwgdGhpcy5fc291cmNlTWFwVVJMKTtcbiAgICAgICAgfVxuICAgICAgICB2YXIgbmFtZSA9IHV0aWwuZ2V0QXJnKG1hcHBpbmcsICduYW1lJywgbnVsbCk7XG4gICAgICAgIGlmIChuYW1lICE9PSBudWxsKSB7XG4gICAgICAgICAgbmFtZSA9IHRoaXMuX25hbWVzLmF0KG5hbWUpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiB7XG4gICAgICAgICAgc291cmNlOiBzb3VyY2UsXG4gICAgICAgICAgbGluZTogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsTGluZScsIG51bGwpLFxuICAgICAgICAgIGNvbHVtbjogdXRpbC5nZXRBcmcobWFwcGluZywgJ29yaWdpbmFsQ29sdW1uJywgbnVsbCksXG4gICAgICAgICAgbmFtZTogbmFtZVxuICAgICAgICB9O1xuICAgICAgfVxuICAgIH1cblxuICAgIHJldHVybiB7XG4gICAgICBzb3VyY2U6IG51bGwsXG4gICAgICBsaW5lOiBudWxsLFxuICAgICAgY29sdW1uOiBudWxsLFxuICAgICAgbmFtZTogbnVsbFxuICAgIH07XG4gIH07XG5cbi8qKlxuICogUmV0dXJuIHRydWUgaWYgd2UgaGF2ZSB0aGUgc291cmNlIGNvbnRlbnQgZm9yIGV2ZXJ5IHNvdXJjZSBpbiB0aGUgc291cmNlXG4gKiBtYXAsIGZhbHNlIG90aGVyd2lzZS5cbiAqL1xuQmFzaWNTb3VyY2VNYXBDb25zdW1lci5wcm90b3R5cGUuaG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VDb250ZW50KHNvdXJjZUZpbGUsIGNvbnRlbnQpO1xuICAgICAgfVxuICAgIH0pO1xuXG4gICAgcmV0dXJuIG5vZGU7XG5cbiAgICBmdW5jdGlvbiBhZGRNYXBwaW5nV2l0aENvZGUobWFwcGluZywgY29kZSkge1xuICAgICAgaWYgKG1hcHBpbmcgPT09IG51bGwgfHwgbWFwcGluZy5zb3VyY2UgPT09IHVuZGVmaW5lZCkge1xuICAgICAgICBub2RlLmFkZChjb2RlKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIHZhciBzb3VyY2UgPSBhUmVsYXRpdmVQYXRoXG4gICAgICAgICAgPyB1dGlsLmpvaW4oYVJlbGF0aXZlUGF0aCwgbWFwcGluZy5zb3VyY2UpXG4gICAgICAgICAgOiBtYXBwaW5nLnNvdXJjZTtcbiAgICAgICAgbm9kZS5hZGQobmV3IFNvdXJjZU5vZGUobWFwcGluZy5vcmlnaW5hbExpbmUsXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG1hcHBpbmcub3JpZ2luYWxDb2x1bW4sXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHNvdXJjZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29kZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbWFwcGluZy5uYW1lKSk7XG4gICAgICB9XG4gICAgfVxuICB9O1xuXG4vKipcbiAqIEFkZCBhIGNodW5rIG9mIGdlbmVyYXRlZCBKUyB0byB0aGlzIHNvdXJjZSBub2RlLlxuICpcbiAqIEBwYXJhbSBhQ2h1bmsgQSBzdHJpbmcgc25pcHBldCBvZiBnZW5lcmF0ZWQgSlMgY29kZSwgYW5vdGhlciBpbnN0YW5jZSBvZlxuICogICAgICAgIFNvdXJjZU5vZGUsIG9yIGFuIGFycmF5IHdoZXJlIGVhY2ggbWVtYmVyIGlzIG9uZSBvZiB0aG9zZSB0aGluZ3MuXG4gKi9cblNvdXJjZU5vZGUucHJvd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vdXJjZS1ub2RlLmpzXG4vLyBtb2R1bGUgaWQgPSAxMFxuLy8gbW9kdWxlIGNodW5rcyA9IDAiXSwic291cmNlUm9vdCI6IiJ9 \ No newline at end of file diff --git a/node_modules/source-map-js/dist/source-map.js b/node_modules/source-map-js/dist/source-map.js deleted file mode 100644 index bdee9d1afe..0000000000 --- a/node_modules/source-map-js/dist/source-map.js +++ /dev/null @@ -1,3390 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; - -/******/ // The require function -/******/ function __webpack_require__(moduleId) { - -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; - -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; - -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); - -/******/ // Flag the module as loaded -/******/ module.loaded = true; - -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } - - -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; - -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; - -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; - -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - /* - * 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 = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).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. - */ - function SourceMapGenerator(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; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var 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) { - var sourceRelative = sourceFile; - if (sourceRoot !== null) { - sourceRelative = util.relative(sourceRoot, sourceFile); - } - - if (!generator._sources.has(sourceRelative)) { - generator._sources.add(sourceRelative); - } - - var 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. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var 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: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var 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. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var 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; - } - var 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. - var newSources = new ArraySet(); - var 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. - var 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; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var 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 (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, 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. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_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. - return; - } - 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. - return; - } - 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. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var 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; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var 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. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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. - */ - - var base64 = __webpack_require__(3); - - // 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 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var 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 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var 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; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - /* -*- 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 - */ - - var 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); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - /* -*- 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; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var 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) { - var 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; - - var 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) { - var cache = []; - - return function(input) { - for (var i = 0; i < cache.length; i++) { - if (cache[i].input === input) { - var temp = cache[0]; - cache[0] = cache[i]; - cache[i] = temp; - return cache[0].result; - } - } - - var 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 '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - var normalize = lruMemoize(function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - // Split the path into parts between `/` characters. This is much faster than - // using `.split(/\/+/g)`. - var parts = []; - var start = 0; - var 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++; - } - } - } - - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - 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 = "."; - } - var aPathUrl = urlParse(aPath); - var 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); - } - - var 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. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var 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; - - var supportsNullProto = (function () { - var 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; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - 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; - } - - for (var 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) { - var 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; - - function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) { - var 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.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource; - - /** - * 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) { - var 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 compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) { - var 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.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine; - - 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) { - var 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) { - var parsed = urlParse(sourceMapURL); - if (!parsed) { - throw new Error("sourceMapURL could not be parsed"); - } - if (parsed.path) { - // Strip the last path component, but keep the "/". - var 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; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - var has = Object.prototype.hasOwnProperty; - var hasNativeMap = typeof Map !== "undefined"; - - /** - * 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. - */ - function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var 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 - */ - ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_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. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var 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 neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - 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. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_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. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) - : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__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. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * 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). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * 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`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var 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."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - return { - source: 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); - }; - - /** - * 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. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var 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. - var 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 []; - } - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var 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) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var 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) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - 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 referrenced 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# - */ - function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var 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. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var 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 != this._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. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this._absoluteSources = this._sources.toArray().map(function (s) { - return util.computeSourceURL(sourceRoot, s, aSourceMapURL); - }); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this._sourceMapURL = aSourceMapURL; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Utility function to find the index of a source. Returns -1 if not - * found. - */ - BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { - var 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. - var i; - for (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 - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - smc._sourceMapURL = aSourceMapURL; - smc._absoluteSources = smc._sources.toArray().map(function (s) { - return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); - }); - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._absoluteSources.slice(); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = 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). - */ - - const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine; - function sortGenerated(array, start) { - let l = array.length; - let n = array.length - start; - if (n <= 1) { - return; - } else if (n == 2) { - let a = array[start]; - let b = array[start + 1]; - if (compareGenerated(a, b) > 0) { - array[start] = b; - array[start + 1] = a; - } - } else if (n < 20) { - for (let i = start; i < l; i++) { - for (let j = i; j > start; j--) { - let a = array[j - 1]; - let b = array[j]; - if (compareGenerated(a, b) <= 0) { - break; - } - array[j - 1] = b; - array[j] = a; - } - } - } else { - quickSort(array, compareGenerated, start); - } - } - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - let subarrayStart = 0; - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - - sortGenerated(generatedMappings, subarrayStart); - subarrayStart = generatedMappings.length; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - let currentSource = mapping.source; - while (originalMappings.length <= currentSource) { - originalMappings.push(null); - } - if (originalMappings[currentSource] === null) { - originalMappings[currentSource] = []; - } - originalMappings[currentSource].push(mapping); - } - } - } - - sortGenerated(generatedMappings, subarrayStart); - this.__generatedMappings = generatedMappings; - - for (var i = 0; i < originalMappings.length; i++) { - if (originalMappings[i] != null) { - quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource); - } - } - this.__originalMappings = [].concat(...originalMappings); - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_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); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * 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. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: 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. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_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. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - var index = this._findSourceIndex(aSource); - if (index >= 0) { - return this.sourcesContent[index]; - } - - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - var 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. - var 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; - } - else { - 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. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - source = this._findSourceIndex(source); - if (source < 0) { - return { - line: null, - column: null, - lastColumn: null - }; - } - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - 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 - */ - function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (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.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var 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; - - 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: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var 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. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var 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. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var 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. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_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. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - 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. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var 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; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var 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). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = null; - if (mapping.name) { - name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(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. - var adjustedMapping = { - source: 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: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - - /* -*- 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. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var 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; - } else { - return mid; - } - } - else { - // 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; - } else { - 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; - } - - var 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; - }; - - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - - /* -*- 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 - */ - - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - function SortTemplate(comparator) { - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot, false) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - return doQuickSort; - } - - function cloneSort(comparator) { - let template = SortTemplate.toString(); - let templateFn = new Function(`return ${template}`)(); - return templateFn(comparator); - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - - let sortCache = new WeakMap(); - exports.quickSort = function (ary, comparator, start = 0) { - let doQuickSort = sortCache.get(comparator); - if (doQuickSort === void 0) { - doQuickSort = cloneSort(comparator); - sortCache.set(comparator, doQuickSort); - } - doQuickSort(ary, comparator, start, ary.length - 1); - }; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var 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! - var 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. - */ - function SourceNode(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. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var 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`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var 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. - var lastMapping = null; - - 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" - var nextLine = remainingLines[remainingLinesIndex] || ''; - var 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) { - var 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) { - var 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 { - var 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. - */ - SourceNode.prototype.add = function SourceNode_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. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var 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. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var 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. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var 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. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var 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 - */ - SourceNode.prototype.setSourceContent = - function SourceNode_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. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var 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. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var 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 (var 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: map }; - }; - - exports.SourceNode = SourceNode; - - -/***/ }) -/******/ ]) -}); -; \ No newline at end of file diff --git a/node_modules/source-map-js/dist/source-map.min.js b/node_modules/source-map-js/dist/source-map.min.js deleted file mode 100644 index 6335f5a718..0000000000 --- a/node_modules/source-map-js/dist/source-map.min.js +++ /dev/null @@ -1,3391 +0,0 @@ -(function webpackUniversalModuleDefinition(root, factory) { - if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(); - else if(typeof define === 'function' && define.amd) - define([], factory); - else if(typeof exports === 'object') - exports["sourceMap"] = factory(); - else - root["sourceMap"] = factory(); -})(this, function() { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) -/******/ return installedModules[moduleId].exports; -/******/ -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ exports: {}, -/******/ id: moduleId, -/******/ loaded: false -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.loaded = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(0); -/******/ }) -/************************************************************************/ -/******/ ([ -/* 0 */ -/***/ (function(module, exports, __webpack_require__) { - - /* - * 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 = __webpack_require__(1).SourceMapGenerator; - exports.SourceMapConsumer = __webpack_require__(7).SourceMapConsumer; - exports.SourceNode = __webpack_require__(10).SourceNode; - - -/***/ }), -/* 1 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var base64VLQ = __webpack_require__(2); - var util = __webpack_require__(4); - var ArraySet = __webpack_require__(5).ArraySet; - var MappingList = __webpack_require__(6).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. - */ - function SourceMapGenerator(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; - } - - SourceMapGenerator.prototype._version = 3; - - /** - * Creates a new SourceMapGenerator based on a SourceMapConsumer - * - * @param aSourceMapConsumer The SourceMap. - */ - SourceMapGenerator.fromSourceMap = - function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { - var sourceRoot = aSourceMapConsumer.sourceRoot; - var generator = new SourceMapGenerator({ - file: aSourceMapConsumer.file, - sourceRoot: sourceRoot - }); - aSourceMapConsumer.eachMapping(function (mapping) { - var 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) { - var sourceRelative = sourceFile; - if (sourceRoot !== null) { - sourceRelative = util.relative(sourceRoot, sourceFile); - } - - if (!generator._sources.has(sourceRelative)) { - generator._sources.add(sourceRelative); - } - - var 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. - */ - SourceMapGenerator.prototype.addMapping = - function SourceMapGenerator_addMapping(aArgs) { - var generated = util.getArg(aArgs, 'generated'); - var original = util.getArg(aArgs, 'original', null); - var source = util.getArg(aArgs, 'source', null); - var 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: source, - name: name - }); - }; - - /** - * Set the source content for a source file. - */ - SourceMapGenerator.prototype.setSourceContent = - function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { - var 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. - */ - SourceMapGenerator.prototype.applySourceMap = - function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { - var 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; - } - var 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. - var newSources = new ArraySet(); - var 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. - var 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; - } - } - } - - var source = mapping.source; - if (source != null && !newSources.has(source)) { - newSources.add(source); - } - - var 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 (sourceFile) { - var content = aSourceMapConsumer.sourceContentFor(sourceFile); - if (content != null) { - if (aSourceMapPath != null) { - sourceFile = util.join(aSourceMapPath, sourceFile); - } - if (sourceRoot != null) { - sourceFile = util.relative(sourceRoot, sourceFile); - } - this.setSourceContent(sourceFile, 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. - */ - SourceMapGenerator.prototype._validateMapping = - function SourceMapGenerator_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. - return; - } - 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. - return; - } - 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. - */ - SourceMapGenerator.prototype._serializeMappings = - function SourceMapGenerator_serializeMappings() { - var previousGeneratedColumn = 0; - var previousGeneratedLine = 1; - var previousOriginalColumn = 0; - var previousOriginalLine = 0; - var previousName = 0; - var previousSource = 0; - var result = ''; - var next; - var mapping; - var nameIdx; - var sourceIdx; - - var mappings = this._mappings.toArray(); - for (var 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; - }; - - SourceMapGenerator.prototype._generateSourcesContent = - function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { - return aSources.map(function (source) { - if (!this._sourcesContents) { - return null; - } - if (aSourceRoot != null) { - source = util.relative(aSourceRoot, source); - } - var key = util.toSetString(source); - return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) - ? this._sourcesContents[key] - : null; - }, this); - }; - - /** - * Externalize the source map. - */ - SourceMapGenerator.prototype.toJSON = - function SourceMapGenerator_toJSON() { - var 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. - */ - SourceMapGenerator.prototype.toString = - function SourceMapGenerator_toString() { - return JSON.stringify(this.toJSON()); - }; - - exports.SourceMapGenerator = SourceMapGenerator; - - -/***/ }), -/* 2 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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. - */ - - var base64 = __webpack_require__(3); - - // 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 - - var VLQ_BASE_SHIFT = 5; - - // binary: 100000 - var VLQ_BASE = 1 << VLQ_BASE_SHIFT; - - // binary: 011111 - var VLQ_BASE_MASK = VLQ_BASE - 1; - - // binary: 100000 - var 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 - */ - function fromVLQSigned(aValue) { - var isNegative = (aValue & 1) === 1; - var shifted = aValue >> 1; - return isNegative - ? -shifted - : shifted; - } - - /** - * Returns the base 64 VLQ encoded value. - */ - exports.encode = function base64VLQ_encode(aValue) { - var encoded = ""; - var digit; - - var 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; - }; - - /** - * Decodes the next base 64 VLQ value from the given string and returns the - * value and the rest of the string via the out parameter. - */ - exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { - var strLen = aStr.length; - var result = 0; - var shift = 0; - var continuation, digit; - - do { - if (aIndex >= strLen) { - throw new Error("Expected more digits in base 64 VLQ value."); - } - - digit = base64.decode(aStr.charCodeAt(aIndex++)); - if (digit === -1) { - throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); - } - - continuation = !!(digit & VLQ_CONTINUATION_BIT); - digit &= VLQ_BASE_MASK; - result = result + (digit << shift); - shift += VLQ_BASE_SHIFT; - } while (continuation); - - aOutParam.value = fromVLQSigned(result); - aOutParam.rest = aIndex; - }; - - -/***/ }), -/* 3 */ -/***/ (function(module, exports) { - - /* -*- 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 - */ - - var 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); - }; - - /** - * Decode a single base 64 character code digit to an integer. Returns -1 on - * failure. - */ - exports.decode = function (charCode) { - var bigA = 65; // 'A' - var bigZ = 90; // 'Z' - - var littleA = 97; // 'a' - var littleZ = 122; // 'z' - - var zero = 48; // '0' - var nine = 57; // '9' - - var plus = 43; // '+' - var slash = 47; // '/' - - var littleOffset = 26; - var numberOffset = 52; - - // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ - if (bigA <= charCode && charCode <= bigZ) { - return (charCode - bigA); - } - - // 26 - 51: abcdefghijklmnopqrstuvwxyz - if (littleA <= charCode && charCode <= littleZ) { - return (charCode - littleA + littleOffset); - } - - // 52 - 61: 0123456789 - if (zero <= charCode && charCode <= nine) { - return (charCode - zero + numberOffset); - } - - // 62: + - if (charCode == plus) { - return 62; - } - - // 63: / - if (charCode == slash) { - return 63; - } - - // Invalid base64 digit. - return -1; - }; - - -/***/ }), -/* 4 */ -/***/ (function(module, exports) { - - /* -*- 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; - } else { - throw new Error('"' + aName + '" is a required argument.'); - } - } - exports.getArg = getArg; - - var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; - var dataUrlRegexp = /^data:.+\,.+$/; - - function urlParse(aUrl) { - var 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) { - var 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; - - var 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) { - var cache = []; - - return function(input) { - for (var i = 0; i < cache.length; i++) { - if (cache[i].input === input) { - var temp = cache[0]; - cache[0] = cache[i]; - cache[i] = temp; - return cache[0].result; - } - } - - var 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 '/..' parts. - * - * Based on code in the Node.js 'path' core module. - * - * @param aPath The path or url to normalize. - */ - var normalize = lruMemoize(function normalize(aPath) { - var path = aPath; - var url = urlParse(aPath); - if (url) { - if (!url.path) { - return aPath; - } - path = url.path; - } - var isAbsolute = exports.isAbsolute(path); - // Split the path into parts between `/` characters. This is much faster than - // using `.split(/\/+/g)`. - var parts = []; - var start = 0; - var 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++; - } - } - } - - for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { - 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 = "."; - } - var aPathUrl = urlParse(aPath); - var 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); - } - - var 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. - var level = 0; - while (aPath.indexOf(aRoot + '/') !== 0) { - var 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; - - var supportsNullProto = (function () { - var 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; - } - - var length = s.length; - - if (length < 9 /* "__proto__".length */) { - return false; - } - - 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; - } - - for (var 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) { - var 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; - - function compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) { - var 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.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource; - - /** - * 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) { - var 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 compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) { - var 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.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine; - - 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) { - var 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) { - var parsed = urlParse(sourceMapURL); - if (!parsed) { - throw new Error("sourceMapURL could not be parsed"); - } - if (parsed.path) { - // Strip the last path component, but keep the "/". - var 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; - - -/***/ }), -/* 5 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - var has = Object.prototype.hasOwnProperty; - var hasNativeMap = typeof Map !== "undefined"; - - /** - * 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. - */ - function ArraySet() { - this._array = []; - this._set = hasNativeMap ? new Map() : Object.create(null); - } - - /** - * Static method for creating ArraySet instances from an existing array. - */ - ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { - var set = new ArraySet(); - for (var 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 - */ - ArraySet.prototype.size = function ArraySet_size() { - return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; - }; - - /** - * Add the given string to this set. - * - * @param String aStr - */ - ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { - var sStr = hasNativeMap ? aStr : util.toSetString(aStr); - var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); - var idx = this._array.length; - if (!isDuplicate || aAllowDuplicates) { - this._array.push(aStr); - } - if (!isDuplicate) { - if (hasNativeMap) { - this._set.set(aStr, idx); - } else { - this._set[sStr] = idx; - } - } - }; - - /** - * Is the given string a member of this set? - * - * @param String aStr - */ - ArraySet.prototype.has = function ArraySet_has(aStr) { - if (hasNativeMap) { - return this._set.has(aStr); - } else { - var sStr = util.toSetString(aStr); - return has.call(this._set, sStr); - } - }; - - /** - * What is the index of the given string in the array? - * - * @param String aStr - */ - ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { - if (hasNativeMap) { - var idx = this._set.get(aStr); - if (idx >= 0) { - return idx; - } - } else { - var sStr = util.toSetString(aStr); - if (has.call(this._set, sStr)) { - return this._set[sStr]; - } - } - - throw new Error('"' + aStr + '" is not in the set.'); - }; - - /** - * What is the element at the given index? - * - * @param Number aIdx - */ - ArraySet.prototype.at = function ArraySet_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. - */ - ArraySet.prototype.toArray = function ArraySet_toArray() { - return this._array.slice(); - }; - - exports.ArraySet = ArraySet; - - -/***/ }), -/* 6 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - - /** - * Determine whether mappingB is after mappingA with respect to generated - * position. - */ - function generatedPositionAfter(mappingA, mappingB) { - // Optimized for most common case - var lineA = mappingA.generatedLine; - var lineB = mappingB.generatedLine; - var columnA = mappingA.generatedColumn; - var 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 neglibable overhead in general - * case for a large speedup in case of mappings being added in order. - */ - function MappingList() { - 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. - */ - MappingList.prototype.unsortedForEach = - function MappingList_forEach(aCallback, aThisArg) { - this._array.forEach(aCallback, aThisArg); - }; - - /** - * Add the given source mapping. - * - * @param Object aMapping - */ - MappingList.prototype.add = function MappingList_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. - */ - MappingList.prototype.toArray = function MappingList_toArray() { - if (!this._sorted) { - this._array.sort(util.compareByGeneratedPositionsInflated); - this._sorted = true; - } - return this._array; - }; - - exports.MappingList = MappingList; - - -/***/ }), -/* 7 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var util = __webpack_require__(4); - var binarySearch = __webpack_require__(8); - var ArraySet = __webpack_require__(5).ArraySet; - var base64VLQ = __webpack_require__(2); - var quickSort = __webpack_require__(9).quickSort; - - function SourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - return sourceMap.sections != null - ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) - : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); - } - - SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { - return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); - } - - /** - * The version of the source mapping spec that we are consuming. - */ - SourceMapConsumer.prototype._version = 3; - - // `__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. - - SourceMapConsumer.prototype.__generatedMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__generatedMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__generatedMappings; - } - }); - - SourceMapConsumer.prototype.__originalMappings = null; - Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { - configurable: true, - enumerable: true, - get: function () { - if (!this.__originalMappings) { - this._parseMappings(this._mappings, this.sourceRoot); - } - - return this.__originalMappings; - } - }); - - SourceMapConsumer.prototype._charIsMappingSeparator = - function SourceMapConsumer_charIsMappingSeparator(aStr, index) { - var c = aStr.charAt(index); - return c === ";" || c === ","; - }; - - /** - * 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). - */ - SourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - throw new Error("Subclasses must implement _parseMappings"); - }; - - SourceMapConsumer.GENERATED_ORDER = 1; - SourceMapConsumer.ORIGINAL_ORDER = 2; - - SourceMapConsumer.GREATEST_LOWER_BOUND = 1; - SourceMapConsumer.LEAST_UPPER_BOUND = 2; - - /** - * 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`. - */ - SourceMapConsumer.prototype.eachMapping = - function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { - var context = aContext || null; - var order = aOrder || SourceMapConsumer.GENERATED_ORDER; - - var 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."); - } - - var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - return { - source: 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); - }; - - /** - * 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. - */ - SourceMapConsumer.prototype.allGeneratedPositionsFor = - function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { - var 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. - var 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 []; - } - - var mappings = []; - - var index = this._findMapping(needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - binarySearch.LEAST_UPPER_BOUND); - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (aArgs.column === undefined) { - var 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) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } else { - var 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) { - mappings.push({ - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }); - - mapping = this._originalMappings[++index]; - } - } - } - - return mappings; - }; - - 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 referrenced 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# - */ - function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var 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. - var names = util.getArg(sourceMap, 'names', []); - var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); - var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); - var mappings = util.getArg(sourceMap, 'mappings'); - var 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 != this._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. - this._names = ArraySet.fromArray(names.map(String), true); - this._sources = ArraySet.fromArray(sources, true); - - this._absoluteSources = this._sources.toArray().map(function (s) { - return util.computeSourceURL(sourceRoot, s, aSourceMapURL); - }); - - this.sourceRoot = sourceRoot; - this.sourcesContent = sourcesContent; - this._mappings = mappings; - this._sourceMapURL = aSourceMapURL; - this.file = file; - } - - BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; - - /** - * Utility function to find the index of a source. Returns -1 if not - * found. - */ - BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { - var 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. - var i; - for (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 - */ - BasicSourceMapConsumer.fromSourceMap = - function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { - var smc = Object.create(BasicSourceMapConsumer.prototype); - - var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); - var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); - smc.sourceRoot = aSourceMap._sourceRoot; - smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), - smc.sourceRoot); - smc.file = aSourceMap._file; - smc._sourceMapURL = aSourceMapURL; - smc._absoluteSources = smc._sources.toArray().map(function (s) { - return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); - }); - - // Because we are modifying the entries (by converting string sources and - // names to indices into the sources and names ArraySets), we have to make - // a copy of the entry or else bad things happen. Shared mutable state - // strikes again! See github issue #191. - - var generatedMappings = aSourceMap._mappings.toArray().slice(); - var destGeneratedMappings = smc.__generatedMappings = []; - var destOriginalMappings = smc.__originalMappings = []; - - for (var i = 0, length = generatedMappings.length; i < length; i++) { - var srcMapping = generatedMappings[i]; - var destMapping = new Mapping; - destMapping.generatedLine = srcMapping.generatedLine; - destMapping.generatedColumn = srcMapping.generatedColumn; - - if (srcMapping.source) { - destMapping.source = sources.indexOf(srcMapping.source); - destMapping.originalLine = srcMapping.originalLine; - destMapping.originalColumn = srcMapping.originalColumn; - - if (srcMapping.name) { - destMapping.name = names.indexOf(srcMapping.name); - } - - destOriginalMappings.push(destMapping); - } - - destGeneratedMappings.push(destMapping); - } - - quickSort(smc.__originalMappings, util.compareByOriginalPositions); - - return smc; - }; - - /** - * The version of the source mapping spec that we are consuming. - */ - BasicSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { - get: function () { - return this._absoluteSources.slice(); - } - }); - - /** - * Provide the JIT with a nice shape / hidden class. - */ - function Mapping() { - this.generatedLine = 0; - this.generatedColumn = 0; - this.source = null; - this.originalLine = null; - this.originalColumn = null; - this.name = 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). - */ - - const compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine; - function sortGenerated(array, start) { - let l = array.length; - let n = array.length - start; - if (n <= 1) { - return; - } else if (n == 2) { - let a = array[start]; - let b = array[start + 1]; - if (compareGenerated(a, b) > 0) { - array[start] = b; - array[start + 1] = a; - } - } else if (n < 20) { - for (let i = start; i < l; i++) { - for (let j = i; j > start; j--) { - let a = array[j - 1]; - let b = array[j]; - if (compareGenerated(a, b) <= 0) { - break; - } - array[j - 1] = b; - array[j] = a; - } - } - } else { - quickSort(array, compareGenerated, start); - } - } - BasicSourceMapConsumer.prototype._parseMappings = - function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { - var generatedLine = 1; - var previousGeneratedColumn = 0; - var previousOriginalLine = 0; - var previousOriginalColumn = 0; - var previousSource = 0; - var previousName = 0; - var length = aStr.length; - var index = 0; - var cachedSegments = {}; - var temp = {}; - var originalMappings = []; - var generatedMappings = []; - var mapping, str, segment, end, value; - - let subarrayStart = 0; - while (index < length) { - if (aStr.charAt(index) === ';') { - generatedLine++; - index++; - previousGeneratedColumn = 0; - - sortGenerated(generatedMappings, subarrayStart); - subarrayStart = generatedMappings.length; - } - else if (aStr.charAt(index) === ',') { - index++; - } - else { - mapping = new Mapping(); - mapping.generatedLine = generatedLine; - - for (end = index; end < length; end++) { - if (this._charIsMappingSeparator(aStr, end)) { - break; - } - } - str = aStr.slice(index, end); - - segment = []; - while (index < end) { - base64VLQ.decode(aStr, index, temp); - value = temp.value; - index = temp.rest; - segment.push(value); - } - - if (segment.length === 2) { - throw new Error('Found a source, but no line and column'); - } - - if (segment.length === 3) { - throw new Error('Found a source and line, but no column'); - } - - // Generated column. - mapping.generatedColumn = previousGeneratedColumn + segment[0]; - previousGeneratedColumn = mapping.generatedColumn; - - if (segment.length > 1) { - // Original source. - mapping.source = previousSource + segment[1]; - previousSource += segment[1]; - - // Original line. - mapping.originalLine = previousOriginalLine + segment[2]; - previousOriginalLine = mapping.originalLine; - // Lines are stored 0-based - mapping.originalLine += 1; - - // Original column. - mapping.originalColumn = previousOriginalColumn + segment[3]; - previousOriginalColumn = mapping.originalColumn; - - if (segment.length > 4) { - // Original name. - mapping.name = previousName + segment[4]; - previousName += segment[4]; - } - } - - generatedMappings.push(mapping); - if (typeof mapping.originalLine === 'number') { - let currentSource = mapping.source; - while (originalMappings.length <= currentSource) { - originalMappings.push(null); - } - if (originalMappings[currentSource] === null) { - originalMappings[currentSource] = []; - } - originalMappings[currentSource].push(mapping); - } - } - } - - sortGenerated(generatedMappings, subarrayStart); - this.__generatedMappings = generatedMappings; - - for (var i = 0; i < originalMappings.length; i++) { - if (originalMappings[i] != null) { - quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource); - } - } - this.__originalMappings = [].concat(...originalMappings); - }; - - /** - * Find the mapping that best matches the hypothetical "needle" mapping that - * we are searching for in the given "haystack" of mappings. - */ - BasicSourceMapConsumer.prototype._findMapping = - function SourceMapConsumer_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); - }; - - /** - * Compute the last column for each generated mapping. The last column is - * inclusive. - */ - BasicSourceMapConsumer.prototype.computeColumnSpans = - function SourceMapConsumer_computeColumnSpans() { - for (var index = 0; index < this._generatedMappings.length; ++index) { - var mapping = this._generatedMappings[index]; - - // Mappings do not contain a field for the last generated columnt. We - // can come up with an optimistic estimate, however, by assuming that - // mappings are contiguous (i.e. given two consecutive mappings, the - // first mapping ends where the second one starts). - if (index + 1 < this._generatedMappings.length) { - var nextMapping = this._generatedMappings[index + 1]; - - if (mapping.generatedLine === nextMapping.generatedLine) { - mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; - continue; - } - } - - // The last mapping for each line spans the entire line. - mapping.lastGeneratedColumn = Infinity; - } - }; - - /** - * 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. - */ - BasicSourceMapConsumer.prototype.originalPositionFor = - function SourceMapConsumer_originalPositionFor(aArgs) { - var needle = { - generatedLine: util.getArg(aArgs, 'line'), - generatedColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._generatedMappings, - "generatedLine", - "generatedColumn", - util.compareByGeneratedPositionsDeflated, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._generatedMappings[index]; - - if (mapping.generatedLine === needle.generatedLine) { - var source = util.getArg(mapping, 'source', null); - if (source !== null) { - source = this._sources.at(source); - source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); - } - var name = util.getArg(mapping, 'name', null); - if (name !== null) { - name = this._names.at(name); - } - return { - source: source, - line: util.getArg(mapping, 'originalLine', null), - column: util.getArg(mapping, 'originalColumn', null), - name: 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. - */ - BasicSourceMapConsumer.prototype.hasContentsOfAllSources = - function BasicSourceMapConsumer_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. - */ - BasicSourceMapConsumer.prototype.sourceContentFor = - function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - if (!this.sourcesContent) { - return null; - } - - var index = this._findSourceIndex(aSource); - if (index >= 0) { - return this.sourcesContent[index]; - } - - var relativeSource = aSource; - if (this.sourceRoot != null) { - relativeSource = util.relative(this.sourceRoot, relativeSource); - } - - var 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. - var 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; - } - else { - 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. - */ - BasicSourceMapConsumer.prototype.generatedPositionFor = - function SourceMapConsumer_generatedPositionFor(aArgs) { - var source = util.getArg(aArgs, 'source'); - source = this._findSourceIndex(source); - if (source < 0) { - return { - line: null, - column: null, - lastColumn: null - }; - } - - var needle = { - source: source, - originalLine: util.getArg(aArgs, 'line'), - originalColumn: util.getArg(aArgs, 'column') - }; - - var index = this._findMapping( - needle, - this._originalMappings, - "originalLine", - "originalColumn", - util.compareByOriginalPositions, - util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) - ); - - if (index >= 0) { - var mapping = this._originalMappings[index]; - - if (mapping.source === needle.source) { - return { - line: util.getArg(mapping, 'generatedLine', null), - column: util.getArg(mapping, 'generatedColumn', null), - lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) - }; - } - } - - return { - line: null, - column: null, - lastColumn: null - }; - }; - - 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 - */ - function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { - var sourceMap = aSourceMap; - if (typeof aSourceMap === 'string') { - sourceMap = util.parseSourceMapInput(aSourceMap); - } - - var version = util.getArg(sourceMap, 'version'); - var sections = util.getArg(sourceMap, 'sections'); - - if (version != this._version) { - throw new Error('Unsupported version: ' + version); - } - - this._sources = new ArraySet(); - this._names = new ArraySet(); - - var lastOffset = { - line: -1, - column: 0 - }; - this._sections = sections.map(function (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.'); - } - var offset = util.getArg(s, 'offset'); - var offsetLine = util.getArg(offset, 'line'); - var 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; - - 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: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) - } - }); - } - - IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); - IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; - - /** - * The version of the source mapping spec that we are consuming. - */ - IndexedSourceMapConsumer.prototype._version = 3; - - /** - * The list of original sources. - */ - Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { - get: function () { - var sources = []; - for (var i = 0; i < this._sections.length; i++) { - for (var 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. - */ - IndexedSourceMapConsumer.prototype.originalPositionFor = - function IndexedSourceMapConsumer_originalPositionFor(aArgs) { - var 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. - var sectionIndex = binarySearch.search(needle, this._sections, - function(needle, section) { - var cmp = needle.generatedLine - section.generatedOffset.generatedLine; - if (cmp) { - return cmp; - } - - return (needle.generatedColumn - - section.generatedOffset.generatedColumn); - }); - var 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. - */ - IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = - function IndexedSourceMapConsumer_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. - */ - IndexedSourceMapConsumer.prototype.sourceContentFor = - function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - - var content = section.consumer.sourceContentFor(aSource, true); - if (content) { - return content; - } - } - if (nullOnMissing) { - return null; - } - else { - 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. - */ - IndexedSourceMapConsumer.prototype.generatedPositionFor = - function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { - for (var i = 0; i < this._sections.length; i++) { - var 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; - } - var generatedPosition = section.consumer.generatedPositionFor(aArgs); - if (generatedPosition) { - var 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). - */ - IndexedSourceMapConsumer.prototype._parseMappings = - function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { - this.__generatedMappings = []; - this.__originalMappings = []; - for (var i = 0; i < this._sections.length; i++) { - var section = this._sections[i]; - var sectionMappings = section.consumer._generatedMappings; - for (var j = 0; j < sectionMappings.length; j++) { - var mapping = sectionMappings[j]; - - var source = section.consumer._sources.at(mapping.source); - source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); - this._sources.add(source); - source = this._sources.indexOf(source); - - var name = null; - if (mapping.name) { - name = section.consumer._names.at(mapping.name); - this._names.add(name); - name = this._names.indexOf(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. - var adjustedMapping = { - source: 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: name - }; - - this.__generatedMappings.push(adjustedMapping); - if (typeof adjustedMapping.originalLine === 'number') { - this.__originalMappings.push(adjustedMapping); - } - } - } - - quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); - quickSort(this.__originalMappings, util.compareByOriginalPositions); - }; - - exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer; - - -/***/ }), -/* 8 */ -/***/ (function(module, exports) { - - /* -*- 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. - var mid = Math.floor((aHigh - aLow) / 2) + aLow; - var 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; - } else { - return mid; - } - } - else { - // 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; - } else { - 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; - } - - var 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; - }; - - -/***/ }), -/* 9 */ -/***/ (function(module, exports) { - - /* -*- 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 - */ - - // It turns out that some (most?) JavaScript engines don't self-host - // `Array.prototype.sort`. This makes sense because C++ will likely remain - // faster than JS when doing raw CPU-intensive sorting. However, when using a - // custom comparator function, calling back and forth between the VM's C++ and - // JIT'd JS is rather slow *and* loses JIT type information, resulting in - // worse generated code for the comparator function than would be optimal. In - // fact, when sorting with a comparator, these costs outweigh the benefits of - // sorting in C++. By using our own JS-implemented Quick Sort (below), we get - // a ~3500ms mean speed-up in `bench/bench.html`. - - function SortTemplate(comparator) { - - /** - * Swap the elements indexed by `x` and `y` in the array `ary`. - * - * @param {Array} ary - * The array. - * @param {Number} x - * The index of the first item. - * @param {Number} y - * The index of the second item. - */ - function swap(ary, x, y) { - var temp = ary[x]; - ary[x] = ary[y]; - ary[y] = temp; - } - - /** - * Returns a random integer within the range `low .. high` inclusive. - * - * @param {Number} low - * The lower bound on the range. - * @param {Number} high - * The upper bound on the range. - */ - function randomIntInRange(low, high) { - return Math.round(low + (Math.random() * (high - low))); - } - - /** - * The Quick Sort algorithm. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - * @param {Number} p - * Start index of the array - * @param {Number} r - * End index of the array - */ - function doQuickSort(ary, comparator, p, r) { - // If our lower bound is less than our upper bound, we (1) partition the - // array into two pieces and (2) recurse on each half. If it is not, this is - // the empty array and our base case. - - if (p < r) { - // (1) Partitioning. - // - // The partitioning chooses a pivot between `p` and `r` and moves all - // elements that are less than or equal to the pivot to the before it, and - // all the elements that are greater than it after it. The effect is that - // once partition is done, the pivot is in the exact place it will be when - // the array is put in sorted order, and it will not need to be moved - // again. This runs in O(n) time. - - // Always choose a random pivot so that an input array which is reverse - // sorted does not cause O(n^2) running time. - var pivotIndex = randomIntInRange(p, r); - var i = p - 1; - - swap(ary, pivotIndex, r); - var pivot = ary[r]; - - // Immediately after `j` is incremented in this loop, the following hold - // true: - // - // * Every element in `ary[p .. i]` is less than or equal to the pivot. - // - // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. - for (var j = p; j < r; j++) { - if (comparator(ary[j], pivot, false) <= 0) { - i += 1; - swap(ary, i, j); - } - } - - swap(ary, i + 1, j); - var q = i + 1; - - // (2) Recurse on each half. - - doQuickSort(ary, comparator, p, q - 1); - doQuickSort(ary, comparator, q + 1, r); - } - } - - return doQuickSort; - } - - function cloneSort(comparator) { - let template = SortTemplate.toString(); - let templateFn = new Function(`return ${template}`)(); - return templateFn(comparator); - } - - /** - * Sort the given array in-place with the given comparator function. - * - * @param {Array} ary - * An array to sort. - * @param {function} comparator - * Function to use to compare two items. - */ - - let sortCache = new WeakMap(); - exports.quickSort = function (ary, comparator, start = 0) { - let doQuickSort = sortCache.get(comparator); - if (doQuickSort === void 0) { - doQuickSort = cloneSort(comparator); - sortCache.set(comparator, doQuickSort); - } - doQuickSort(ary, comparator, start, ary.length - 1); - }; - - -/***/ }), -/* 10 */ -/***/ (function(module, exports, __webpack_require__) { - - /* -*- 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 - */ - - var SourceMapGenerator = __webpack_require__(1).SourceMapGenerator; - var util = __webpack_require__(4); - - // Matches a Windows-style `\r\n` newline or a `\n` newline used by all other - // operating systems these days (capturing the result). - var REGEX_NEWLINE = /(\r?\n)/; - - // Newline character code for charCodeAt() comparisons - var 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! - var 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. - */ - function SourceNode(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. - */ - SourceNode.fromStringWithSourceMap = - function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { - // The SourceNode we want to fill with the generated code - // and the SourceMap - var 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`. - var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); - var remainingLinesIndex = 0; - var shiftNextLine = function() { - var lineContents = getNextLine(); - // The last line of a file might not have a newline. - var newLine = getNextLine() || ""; - return lineContents + newLine; - - function getNextLine() { - return remainingLinesIndex < remainingLines.length ? - remainingLines[remainingLinesIndex++] : undefined; - } - }; - - // We need to remember the position of "remainingLines" - var 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. - var lastMapping = null; - - 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" - var nextLine = remainingLines[remainingLinesIndex] || ''; - var 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) { - var 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) { - var 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 { - var 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. - */ - SourceNode.prototype.add = function SourceNode_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. - */ - SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { - if (Array.isArray(aChunk)) { - for (var 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. - */ - SourceNode.prototype.walk = function SourceNode_walk(aFn) { - var chunk; - for (var 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. - */ - SourceNode.prototype.join = function SourceNode_join(aSep) { - var newChildren; - var i; - var 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. - */ - SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { - var 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 - */ - SourceNode.prototype.setSourceContent = - function SourceNode_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. - */ - SourceNode.prototype.walkSourceContents = - function SourceNode_walkSourceContents(aFn) { - for (var i = 0, len = this.children.length; i < len; i++) { - if (this.children[i][isSourceNode]) { - this.children[i].walkSourceContents(aFn); - } - } - - var sources = Object.keys(this.sourceContents); - for (var 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. - */ - SourceNode.prototype.toString = function SourceNode_toString() { - var str = ""; - this.walk(function (chunk) { - str += chunk; - }); - return str; - }; - - /** - * Returns the string representation of this source node along with a source - * map. - */ - SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { - var generated = { - code: "", - line: 1, - column: 0 - }; - var map = new SourceMapGenerator(aArgs); - var sourceMappingActive = false; - var lastOriginalSource = null; - var lastOriginalLine = null; - var lastOriginalColumn = null; - var 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 (var 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: map }; - }; - - exports.SourceNode = SourceNode; - - -/***/ }) -/******/ ]) -}); -; -//# sourceMappingURL=source-map.min.js.map \ No newline at end of file diff --git a/node_modules/source-map-js/dist/source-map.min.js.map b/node_modules/source-map-js/dist/source-map.min.js.map deleted file mode 100644 index e8685c1f74..0000000000 --- a/node_modules/source-map-js/dist/source-map.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap e70d6d2fc15858a690e4","webpack:///./source-map.js","webpack:///./lib/source-map-generator.js","webpack:///./lib/base64-vlq.js","webpack:///./lib/base64.js","webpack:///./lib/util.js","webpack:///./lib/array-set.js","webpack:///./lib/mapping-list.js","webpack:///./lib/source-map-consumer.js","webpack:///./lib/binary-search.js","webpack:///./lib/quick-sort.js","webpack:///./lib/source-node.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD,O;ACVA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA,uBAAe;AACf;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACPA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA,MAAK;AACL;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,2CAA0C,SAAS;AACnD;AACA;;AAEA;AACA;AACA;AACA,qBAAoB;AACpB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxaA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4DAA2D;AAC3D,qBAAoB;AACpB;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,IAAG;;AAEH;AACA;AACA;;;;;;;AC3IA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB,iBAAgB;;AAEhB,oBAAmB;AACnB,qBAAoB;;AAEpB,iBAAgB;AAChB,iBAAgB;;AAEhB,iBAAgB;AAChB,kBAAiB;;AAEjB;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;AClEA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA,oBAAmB,kBAAkB;AACrC;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;;AAEA,+CAA8C,QAAQ;AACtD;AACA;AACA;AACA,MAAK;AACL;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,EAAC;AACD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,4BAA2B,QAAQ;AACnC;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA,cAAa;AACb;;AAEA;AACA,eAAc;AACd;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,uCAAsC;AACtC;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;;;;;;ACjlBA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,uCAAsC,SAAS;AAC/C;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;ACxHA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,iBAAgB;AAChB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;;;;;;AC9EA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA,oBAAmB;AACnB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;;AAEX;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;;AAEX;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA2B,MAAM;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,IAAG;;AAEH;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA,cAAa,kCAAkC;AAC/C;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,uDAAsD,YAAY;AAClE;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH,wBAAuB,OAAO;AAC9B,sBAAqB,WAAW;AAChC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,oCAAmC;AACnC;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,0BAAyB,cAAc;AACvC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA,oBAAmB,6BAA6B;AAChD;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAuB,wCAAwC;AAC/D;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAA+C,mBAAmB,EAAE;AACpE;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kBAAiB,oBAAoB;AACrC;AACA;AACA;AACA;AACA;AACA,8BAA6B,MAAM;AACnC;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA,IAAG;AACH;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAmB,2BAA2B;AAC9C,sBAAqB,+CAA+C;AACpE;AACA;AACA;AACA;AACA;AACA,EAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA,QAAO;AACP;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAmB,2BAA2B;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAmB,2BAA2B;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAmB,2BAA2B;AAC9C;AACA;AACA,sBAAqB,4BAA4B;AACjD;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;;AAEA;;;;;;;ACzpCA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;AC9GA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA,YAAW,OAAO;AAClB;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,OAAO;AAClB;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA,YAAW,SAAS;AACpB;AACA,YAAW,OAAO;AAClB;AACA,YAAW,OAAO;AAClB;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,oBAAmB,OAAO;AAC1B;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA,2CAA0C,SAAS;AACnD;AACA;;AAEA;AACA;AACA;AACA,YAAW,MAAM;AACjB;AACA,YAAW,SAAS;AACpB;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACnIA,iBAAgB,oBAAoB;AACpC;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;;AAEL;;AAEA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,kCAAiC,QAAQ;AACzC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,8CAA6C,SAAS;AACtD;AACA;AACA;AACA;AACA;AACA;AACA,qBAAoB;AACpB;AACA;AACA,uCAAsC;AACtC;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gBAAe,WAAW;AAC1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gDAA+C,SAAS;AACxD;AACA;AACA;AACA;;AAEA;AACA,0CAAyC,SAAS;AAClD;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAG;AACH;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,YAAW;AACX;AACA;AACA;AACA,YAAW;AACX;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA,MAAK;AACL;AACA;AACA;AACA;AACA;AACA,QAAO;AACP;AACA;AACA;AACA,6CAA4C,cAAc;AAC1D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAS;AACT;AACA;AACA;AACA;AACA;AACA,cAAa;AACb;AACA;AACA;AACA,cAAa;AACb;AACA,YAAW;AACX;AACA,QAAO;AACP;AACA;AACA;AACA,IAAG;AACH;AACA;AACA,IAAG;;AAEH,WAAU;AACV;;AAEA","file":"source-map.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"sourceMap\"] = factory();\n\telse\n\t\troot[\"sourceMap\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap e70d6d2fc15858a690e4","/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./source-map.js\n// module id = 0\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar MappingList = require('./mapping-list').MappingList;\n\n/**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\nfunction SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n}\n\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var sourceRelative = sourceFile;\n if (sourceRoot !== null) {\n sourceRelative = util.relative(sourceRoot, sourceFile);\n }\n\n if (!generator._sources.has(sourceRelative)) {\n generator._sources.add(sourceRelative);\n }\n\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n/**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\nSourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n this._validateMapping(generated, original, source, name);\n }\n\n if (source != null) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n/**\n * Set the source content for a source file.\n */\nSourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = Object.create(null);\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n/**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\nSourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n/**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n throw new Error('Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n }));\n }\n };\n\n/**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\nSourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var next;\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n/**\n * Render the source map being generated to a string.\n */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-generator.js\n// module id = 1\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n *\n * Based on the Base 64 VLQ implementation in Closure Compiler:\n * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java\n *\n * Copyright 2011 The Closure Compiler Authors. All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are\n * met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above\n * copyright notice, this list of conditions and the following\n * disclaimer in the documentation and/or other materials provided\n * with the distribution.\n * * Neither the name of Google Inc. nor the names of its\n * contributors may be used to endorse or promote products derived\n * from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\nvar base64 = require('./base64');\n\n// A single base 64 digit can contain 6 bits of data. For the base 64 variable\n// length quantities we use in the source map spec, the first bit is the sign,\n// the next four bits are the actual value, and the 6th bit is the\n// continuation bit. The continuation bit tells us whether there are more\n// digits in this value following this digit.\n//\n// Continuation\n// | Sign\n// | |\n// V V\n// 101011\n\nvar VLQ_BASE_SHIFT = 5;\n\n// binary: 100000\nvar VLQ_BASE = 1 << VLQ_BASE_SHIFT;\n\n// binary: 011111\nvar VLQ_BASE_MASK = VLQ_BASE - 1;\n\n// binary: 100000\nvar VLQ_CONTINUATION_BIT = VLQ_BASE;\n\n/**\n * Converts from a two-complement value to a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)\n * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)\n */\nfunction toVLQSigned(aValue) {\n return aValue < 0\n ? ((-aValue) << 1) + 1\n : (aValue << 1) + 0;\n}\n\n/**\n * Converts to a two-complement value from a value where the sign bit is\n * placed in the least significant bit. For example, as decimals:\n * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1\n * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2\n */\nfunction fromVLQSigned(aValue) {\n var isNegative = (aValue & 1) === 1;\n var shifted = aValue >> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64-vlq.js\n// module id = 2\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');\n\n/**\n * Encode an integer in the range of 0 to 63 to a single base 64 digit.\n */\nexports.encode = function (number) {\n if (0 <= number && number < intToCharMap.length) {\n return intToCharMap[number];\n }\n throw new TypeError(\"Must be between 0 and 63: \" + number);\n};\n\n/**\n * Decode a single base 64 character code digit to an integer. Returns -1 on\n * failure.\n */\nexports.decode = function (charCode) {\n var bigA = 65; // 'A'\n var bigZ = 90; // 'Z'\n\n var littleA = 97; // 'a'\n var littleZ = 122; // 'z'\n\n var zero = 48; // '0'\n var nine = 57; // '9'\n\n var plus = 43; // '+'\n var slash = 47; // '/'\n\n var littleOffset = 26;\n var numberOffset = 52;\n\n // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ\n if (bigA <= charCode && charCode <= bigZ) {\n return (charCode - bigA);\n }\n\n // 26 - 51: abcdefghijklmnopqrstuvwxyz\n if (littleA <= charCode && charCode <= littleZ) {\n return (charCode - littleA + littleOffset);\n }\n\n // 52 - 61: 0123456789\n if (zero <= charCode && charCode <= nine) {\n return (charCode - zero + numberOffset);\n }\n\n // 62: +\n if (charCode == plus) {\n return 62;\n }\n\n // 63: /\n if (charCode == slash) {\n return 63;\n }\n\n // Invalid base64 digit.\n return -1;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/base64.js\n// module id = 3\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.-]*)(?::(\\d+))?(.*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\nvar MAX_CACHED_INPUTS = 32;\n\n/**\n * Takes some function `f(input) -> result` and returns a memoized version of\n * `f`.\n *\n * We keep at most `MAX_CACHED_INPUTS` memoized results of `f` alive. The\n * memoization is a dumb-simple, linear least-recently-used cache.\n */\nfunction lruMemoize(f) {\n var cache = [];\n\n return function(input) {\n for (var i = 0; i < cache.length; i++) {\n if (cache[i].input === input) {\n var temp = cache[0];\n cache[0] = cache[i];\n cache[i] = temp;\n return cache[0].result;\n }\n }\n\n var result = f(input);\n\n cache.unshift({\n input,\n result,\n });\n\n if (cache.length > MAX_CACHED_INPUTS) {\n cache.pop();\n }\n\n return result;\n };\n}\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nvar normalize = lruMemoize(function normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n // Split the path into parts between `/` characters. This is much faster than\n // using `.split(/\\/+/g)`.\n var parts = [];\n var start = 0;\n var i = 0;\n while (true) {\n start = i;\n i = path.indexOf(\"/\", start);\n if (i === -1) {\n parts.push(path.slice(start));\n break;\n } else {\n parts.push(path.slice(start, i));\n while (i < path.length && path[i] === \"/\") {\n i++;\n }\n }\n }\n\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n});\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || urlRegexp.test(aPath);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\nfunction compareByOriginalPositionsNoSource(mappingA, mappingB, onlyCompareOriginal) {\n var cmp\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByOriginalPositionsNoSource = compareByOriginalPositionsNoSource;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction compareByGeneratedPositionsDeflatedNoLine(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsDeflatedNoLine = compareByGeneratedPositionsDeflatedNoLine;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 === null) {\n return 1; // aStr2 !== null\n }\n\n if (aStr2 === null) {\n return -1; // aStr1 !== null\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented\n * in the source maps specification), and then parse the string as\n * JSON.\n */\nfunction parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, ''));\n}\nexports.parseSourceMapInput = parseSourceMapInput;\n\n/**\n * Compute the URL of a source given the the source root, the source's\n * URL, and the source map's URL.\n */\nfunction computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {\n sourceURL = sourceURL || '';\n\n if (sourceRoot) {\n // This follows what Chrome does.\n if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {\n sourceRoot += '/';\n }\n // The spec says:\n // Line 4: An optional source root, useful for relocating source\n // files on a server or removing repeated values in the\n // “sources” entry. This value is prepended to the individual\n // entries in the “source” field.\n sourceURL = sourceRoot + sourceURL;\n }\n\n // Historically, SourceMapConsumer did not take the sourceMapURL as\n // a parameter. This mode is still somewhat supported, which is why\n // this code block is conditional. However, it's preferable to pass\n // the source map URL to SourceMapConsumer, so that this function\n // can implement the source URL resolution algorithm as outlined in\n // the spec. This block is basically the equivalent of:\n // new URL(sourceURL, sourceMapURL).toString()\n // ... except it avoids using URL, which wasn't available in the\n // older releases of node still supported by this library.\n //\n // The spec says:\n // If the sources are not absolute URLs after prepending of the\n // “sourceRoot”, the sources are resolved relative to the\n // SourceMap (like resolving script src in a html document).\n if (sourceMapURL) {\n var parsed = urlParse(sourceMapURL);\n if (!parsed) {\n throw new Error(\"sourceMapURL could not be parsed\");\n }\n if (parsed.path) {\n // Strip the last path component, but keep the \"/\".\n var index = parsed.path.lastIndexOf('/');\n if (index >= 0) {\n parsed.path = parsed.path.substring(0, index + 1);\n }\n }\n sourceURL = join(urlGenerate(parsed), sourceURL);\n }\n\n return normalize(sourceURL);\n}\nexports.computeSourceURL = computeSourceURL;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/util.js\n// module id = 4\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\n\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/array-set.js\n// module id = 5\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n}\n\n/**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\nfunction MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n}\n\n/**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\nMappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n/**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\nMappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n};\n\n/**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\nMappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n};\n\nexports.MappingList = MappingList;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/mapping-list.js\n// module id = 6\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)\n : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number is 1-based.\n * - column: Optional. the column number in the original source.\n * The column number is 0-based.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n needle.source = this._findSourceIndex(needle.source);\n if (needle.source < 0) {\n return [];\n }\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The first parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n if (sourceRoot) {\n sourceRoot = util.normalize(sourceRoot);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this._absoluteSources = this._sources.toArray().map(function (s) {\n return util.computeSourceURL(sourceRoot, s, aSourceMapURL);\n });\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this._sourceMapURL = aSourceMapURL;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Utility function to find the index of a source. Returns -1 if not\n * found.\n */\nBasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n if (this._sources.has(relativeSource)) {\n return this._sources.indexOf(relativeSource);\n }\n\n // Maybe aSource is an absolute URL as returned by |sources|. In\n // this case we can't simply undo the transform.\n var i;\n for (i = 0; i < this._absoluteSources.length; ++i) {\n if (this._absoluteSources[i] == aSource) {\n return i;\n }\n }\n\n return -1;\n};\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @param String aSourceMapURL\n * The URL at which the source map can be found (optional)\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n smc._sourceMapURL = aSourceMapURL;\n smc._absoluteSources = smc._sources.toArray().map(function (s) {\n return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);\n });\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._absoluteSources.slice();\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\n\nconst compareGenerated = util.compareByGeneratedPositionsDeflatedNoLine;\nfunction sortGenerated(array, start) {\n let l = array.length;\n let n = array.length - start;\n if (n <= 1) {\n return;\n } else if (n == 2) {\n let a = array[start];\n let b = array[start + 1];\n if (compareGenerated(a, b) > 0) {\n array[start] = b;\n array[start + 1] = a;\n }\n } else if (n < 20) {\n for (let i = start; i < l; i++) {\n for (let j = i; j > start; j--) {\n let a = array[j - 1];\n let b = array[j];\n if (compareGenerated(a, b) <= 0) {\n break;\n }\n array[j - 1] = b;\n array[j] = a;\n }\n }\n } else {\n quickSort(array, compareGenerated, start);\n }\n}\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n let subarrayStart = 0;\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n\n sortGenerated(generatedMappings, subarrayStart);\n subarrayStart = generatedMappings.length;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n let currentSource = mapping.source;\n while (originalMappings.length <= currentSource) {\n originalMappings.push(null);\n }\n if (originalMappings[currentSource] === null) {\n originalMappings[currentSource] = [];\n }\n originalMappings[currentSource].push(mapping);\n }\n }\n }\n\n sortGenerated(generatedMappings, subarrayStart);\n this.__generatedMappings = generatedMappings;\n\n for (var i = 0; i < originalMappings.length; i++) {\n if (originalMappings[i] != null) {\n quickSort(originalMappings[i], util.compareByOriginalPositionsNoSource);\n }\n }\n this.__originalMappings = [].concat(...originalMappings);\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n var index = this._findSourceIndex(aSource);\n if (index >= 0) {\n return this.sourcesContent[index];\n }\n\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = relativeSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + relativeSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + relativeSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + relativeSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n source = this._findSourceIndex(source);\n if (source < 0) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The first parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based. \n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = null;\n if (mapping.name) {\n name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n }\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-map-consumer.js\n// module id = 7\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/binary-search.js\n// module id = 8\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\nfunction SortTemplate(comparator) {\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot, false) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n return doQuickSort;\n}\n\nfunction cloneSort(comparator) {\n let template = SortTemplate.toString();\n let templateFn = new Function(`return ${template}`)();\n return templateFn(comparator);\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\n\nlet sortCache = new WeakMap();\nexports.quickSort = function (ary, comparator, start = 0) {\n let doQuickSort = sortCache.get(comparator);\n if (doQuickSort === void 0) {\n doQuickSort = cloneSort(comparator);\n sortCache.set(comparator, doQuickSort);\n }\n doQuickSort(ary, comparator, start, ary.length - 1);\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/quick-sort.js\n// module id = 9\n// module chunks = 0","/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar util = require('./util');\n\n// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n// operating systems these days (capturing the result).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar NEWLINE_CODE = 10;\n\n// Private symbol for identifying `SourceNode`s when multiple versions of\n// the source-map library are loaded. This MUST NOT CHANGE across\n// versions!\nvar isSourceNode = \"$$$isSourceNode$$$\";\n\n/**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\nfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n}\n\n/**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\nSourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[remainingLinesIndex] || '';\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[remainingLinesIndex] || '';\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n/**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n};\n\n/**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\nSourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n};\n\n/**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\nSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n};\n\n/**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\nSourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n/**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n/**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\nSourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n};\n\n/**\n * Returns the string representation of this source node along with a source\n * map.\n */\nSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n};\n\nexports.SourceNode = SourceNode;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./lib/source-node.js\n// module id = 10\n// module chunks = 0"],"sourceRoot":""} \ No newline at end of file diff --git a/node_modules/source-map-js/lib/source-map-consumer.js b/node_modules/source-map-js/lib/source-map-consumer.js index 17bd8c3fb8..4bd7a4a5d1 100644 --- a/node_modules/source-map-js/lib/source-map-consumer.js +++ b/node_modules/source-map-js/lib/source-map-consumer.js @@ -143,18 +143,24 @@ SourceMapConsumer.prototype.eachMapping = } var sourceRoot = this.sourceRoot; - mappings.map(function (mapping) { - var source = mapping.source === null ? null : this._sources.at(mapping.source); - source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); - return { + var boundCallback = aCallback.bind(context); + var names = this._names; + var sources = this._sources; + var sourceMapURL = this._sourceMapURL; + + for (var i = 0, n = mappings.length; i < n; i++) { + var mapping = mappings[i]; + var source = mapping.source === null ? null : sources.at(mapping.source); + source = util.computeSourceURL(sourceRoot, source, sourceMapURL); + boundCallback({ source: 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); + name: mapping.name === null ? null : names.at(mapping.name) + }); + } }; /** diff --git a/node_modules/source-map-js/package.json b/node_modules/source-map-js/package.json index 41a2131921..f708ca51bf 100644 --- a/node_modules/source-map-js/package.json +++ b/node_modules/source-map-js/package.json @@ -1,7 +1,7 @@ { "name": "source-map-js", "description": "Generates and consumes source maps", - "version": "0.6.2", + "version": "1.0.1", "homepage": "https://github.com/7rulnik/source-map", "author": "Valentin 7rulnik Semirulnik ", "contributors": [ @@ -43,32 +43,16 @@ "Gary Ye ", "Nicolas Laleve\u0301e " ], - "repository": { - "type": "git", - "url": "http://github.com/7rulnik/source-map.git" - }, + "repository": "7rulnik/source-map", "main": "./source-map.js", "files": [ "source-map.js", "source-map.d.ts", - "lib/", - "dist/source-map.debug.js", - "dist/source-map.js", - "dist/source-map.min.js", - "dist/source-map.min.js.map" + "lib/" ], "engines": { "node": ">=0.10.0" }, "license": "BSD-3-Clause", - "scripts": { - "test": "npm run build && node test/run-tests.js", - "build": "webpack --color", - "toc": "doctoc --title '## Table of Contents' README.md && doctoc --title '## Table of Contents' CONTRIBUTING.md" - }, - "devDependencies": { - "doctoc": "^0.15.0", - "webpack": "^1.12.0" - }, - "typings": "source-map" + "typings": "source-map.d.ts" } diff --git a/node_modules/stylelint-config-standard/README.md b/node_modules/stylelint-config-standard/README.md index 9da021c37f..b05618df2b 100644 --- a/node_modules/stylelint-config-standard/README.md +++ b/node_modules/stylelint-config-standard/README.md @@ -93,8 +93,8 @@ To see the rules that this config uses, please read the [config itself](./index. } @keyframes fade-in { - from { opacity: 0%; } - to { opacity: 100%; } + from { opacity: 0; } + to { opacity: 1; } } ``` @@ -177,53 +177,53 @@ A more complete example, to change the `at-rule-no-unknown` rule to use its `ign `stylelint-config-standard` is a great foundation for your own config. You can extend it to create a tailored and much stricter config: - Manage specificity using: - - [`max-nesting-depth`](https://github.com/stylelint/stylelint/blob/master/lib/rules/max-nesting-depth/README.md) - - [`selector-max-attribute`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-attribute/README.md) - - [`selector-max-class`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-class/README.md) - - [`selector-max-combinators`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-combinators/README.md) - - [`selector-max-compound-selectors`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-compound-selectors/README.md) - - [`selector-max-id`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-id/README.md) - - [`selector-max-pseudo-class`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-pseudo-class/README.md) - - [`selector-max-specificity`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-specificity/README.md) - - [`selector-max-type`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-type/README.md) - - [`selector-max-universal`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-max-universal/README.md) - - [`selector-no-qualifying-type`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-no-qualifying-type/README.md) + - [`max-nesting-depth`](https://github.com/stylelint/stylelint/blob/main/lib/rules/max-nesting-depth/README.md) + - [`selector-max-attribute`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-attribute/README.md) + - [`selector-max-class`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-class/README.md) + - [`selector-max-combinators`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-combinators/README.md) + - [`selector-max-compound-selectors`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-compound-selectors/README.md) + - [`selector-max-id`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-id/README.md) + - [`selector-max-pseudo-class`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-pseudo-class/README.md) + - [`selector-max-specificity`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-specificity/README.md) + - [`selector-max-type`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-type/README.md) + - [`selector-max-universal`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-max-universal/README.md) + - [`selector-no-qualifying-type`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-no-qualifying-type/README.md) - Specify acceptable selector types, units, properties, functions and words in comments using: - - [`at-rule-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/at-rule-disallowed-list/README.md) - - [`at-rule-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/at-rule-allowed-list/README.md) - - [`at-rule-property-required-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/at-rule-property-required-list/README.md) - - [`color-named`](https://github.com/stylelint/stylelint/blob/master/lib/rules/color-named/README.md) - - [`color-no-hex`](https://github.com/stylelint/stylelint/blob/master/lib/rules/color-no-hex/README.md) - - [`comment-word-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/comment-word-disallowed-list/README.md) - - [`declaration-no-important`](https://github.com/stylelint/stylelint/blob/master/lib/rules/declaration-no-important/README.md) - - [`declaration-property-unit-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/declaration-property-unit-disallowed-list/README.md) - - [`declaration-property-unit-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/declaration-property-unit-allowed-list/README.md) - - [`declaration-property-value-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/declaration-property-value-disallowed-list/README.md) - - [`declaration-property-value-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/declaration-property-value-allowed-list/README.md) - - [`function-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/function-disallowed-list/README.md) - - [`function-url-scheme-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/function-url-scheme-disallowed-list/README.md) - - [`function-url-scheme-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/function-url-scheme-allowed-list/README.md) - - [`function-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/function-allowed-list/README.md) - - [`media-feature-name-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/media-feature-name-disallowed-list/README.md) - - [`media-feature-name-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/media-feature-name-allowed-list/README.md) - - [`property-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/property-disallowed-list/README.md) - - [`property-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/property-allowed-list/README.md) - - [`selector-attribute-operator-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-attribute-operator-disallowed-list/README.md) - - [`selector-attribute-operator-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-attribute-operator-allowed-list/README.md) - - [`selector-combinator-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-combinator-disallowed-list/README.md) - - [`selector-combinator-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-combinator-allowed-list/README.md) - - [`selector-pseudo-class-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-pseudo-class-disallowed-list/README.md) - - [`selector-pseudo-class-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-pseudo-class-allowed-list/README.md) - - [`selector-pseudo-element-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-pseudo-element-disallowed-list/README.md) - - [`selector-pseudo-element-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-pseudo-element-allowed-list/README.md) - - [`unit-disallowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/unit-disallowed-list/README.md) - - [`unit-allowed-list`](https://github.com/stylelint/stylelint/blob/master/lib/rules/unit-allowed-list/README.md) + - [`at-rule-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/at-rule-disallowed-list/README.md) + - [`at-rule-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/at-rule-allowed-list/README.md) + - [`at-rule-property-required-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/at-rule-property-required-list/README.md) + - [`color-named`](https://github.com/stylelint/stylelint/blob/main/lib/rules/color-named/README.md) + - [`color-no-hex`](https://github.com/stylelint/stylelint/blob/main/lib/rules/color-no-hex/README.md) + - [`comment-word-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/comment-word-disallowed-list/README.md) + - [`declaration-no-important`](https://github.com/stylelint/stylelint/blob/main/lib/rules/declaration-no-important/README.md) + - [`declaration-property-unit-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/declaration-property-unit-disallowed-list/README.md) + - [`declaration-property-unit-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/declaration-property-unit-allowed-list/README.md) + - [`declaration-property-value-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/declaration-property-value-disallowed-list/README.md) + - [`declaration-property-value-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/declaration-property-value-allowed-list/README.md) + - [`function-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/function-disallowed-list/README.md) + - [`function-url-scheme-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/function-url-scheme-disallowed-list/README.md) + - [`function-url-scheme-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/function-url-scheme-allowed-list/README.md) + - [`function-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/function-allowed-list/README.md) + - [`media-feature-name-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/media-feature-name-disallowed-list/README.md) + - [`media-feature-name-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/media-feature-name-allowed-list/README.md) + - [`property-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/property-disallowed-list/README.md) + - [`property-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/property-allowed-list/README.md) + - [`selector-attribute-operator-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-attribute-operator-disallowed-list/README.md) + - [`selector-attribute-operator-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-attribute-operator-allowed-list/README.md) + - [`selector-combinator-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-combinator-disallowed-list/README.md) + - [`selector-combinator-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-combinator-allowed-list/README.md) + - [`selector-pseudo-class-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-pseudo-class-disallowed-list/README.md) + - [`selector-pseudo-class-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-pseudo-class-allowed-list/README.md) + - [`selector-pseudo-element-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-pseudo-element-disallowed-list/README.md) + - [`selector-pseudo-element-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-pseudo-element-allowed-list/README.md) + - [`unit-disallowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/unit-disallowed-list/README.md) + - [`unit-allowed-list`](https://github.com/stylelint/stylelint/blob/main/lib/rules/unit-allowed-list/README.md) - Specify acceptable patterns using: - - [`selector-nested-pattern`](https://github.com/stylelint/stylelint/blob/master/lib/rules/selector-nested-pattern/README.md) + - [`selector-nested-pattern`](https://github.com/stylelint/stylelint/blob/main/lib/rules/selector-nested-pattern/README.md) - Specify a notation for font weights using: - - [`font-weight-notation`](https://github.com/stylelint/stylelint/blob/master/lib/rules/font-weight-notation/README.md) + - [`font-weight-notation`](https://github.com/stylelint/stylelint/blob/main/lib/rules/font-weight-notation/README.md) - Specify what types of URLs are allowed using: - - [`function-url-no-scheme-relative`](https://github.com/stylelint/stylelint/blob/master/lib/rules/function-url-no-scheme-relative/README.md) + - [`function-url-no-scheme-relative`](https://github.com/stylelint/stylelint/blob/main/lib/rules/function-url-no-scheme-relative/README.md) ## [Changelog](CHANGELOG.md) diff --git a/node_modules/stylelint-config-standard/index.js b/node_modules/stylelint-config-standard/index.js index 44c7f807bb..cb0e51d80f 100644 --- a/node_modules/stylelint-config-standard/index.js +++ b/node_modules/stylelint-config-standard/index.js @@ -3,7 +3,12 @@ module.exports = { extends: 'stylelint-config-recommended', rules: { - 'alpha-value-notation': 'percentage', + 'alpha-value-notation': [ + 'percentage', + { + exceptProperties: ['opacity'], + }, + ], 'at-rule-empty-line-before': [ 'always', { diff --git a/node_modules/stylelint-config-standard/package.json b/node_modules/stylelint-config-standard/package.json index f339942d30..6dfaf07915 100644 --- a/node_modules/stylelint-config-standard/package.json +++ b/node_modules/stylelint-config-standard/package.json @@ -1,6 +1,6 @@ { "name": "stylelint-config-standard", - "version": "23.0.0", + "version": "24.0.0", "description": "Standard shareable config for Stylelint", "keywords": [ "stylelint", @@ -50,16 +50,16 @@ "devDependencies": { "@stylelint/prettier-config": "^2.0.0", "@stylelint/remark-preset": "^3.0.0", - "eslint": "^7.32.0", - "eslint-config-stylelint": "^14.0.0", - "husky": "^7.0.2", - "jest": "^27.1.0", - "lint-staged": "^11.1.2", + "eslint": "^8.2.0", + "eslint-config-stylelint": "^15.0.0", + "husky": "^7.0.4", + "jest": "^27.3.1", + "lint-staged": "^12.0.2", "np": "^7.5.0", "npm-run-all": "^4.1.5", - "prettier": "^2.3.2", + "prettier": "^2.4.1", "remark-cli": "^10.0.0", - "stylelint": "^14.0.0" + "stylelint": "^14.1.0" }, "peerDependencies": { "stylelint": "^14.0.0" diff --git a/node_modules/stylelint/README.md b/node_modules/stylelint/README.md index c6ee11204d..d5fe407d37 100644 --- a/node_modules/stylelint/README.md +++ b/node_modules/stylelint/README.md @@ -1,6 +1,6 @@ # Stylelint -[![NPM version](https://img.shields.io/npm/v/stylelint.svg)](https://www.npmjs.org/package/stylelint) [![Build Status](https://github.com/stylelint/stylelint/workflows/CI/badge.svg)](https://github.com/stylelint/stylelint/actions) [![NPM Downloads](https://img.shields.io/npm/dm/stylelint.svg)](https://npmcharts.com/compare/stylelint?minimal=true) +[![npm version](https://img.shields.io/npm/v/stylelint)](https://www.npmjs.com/package/stylelint) [![Build Status](https://img.shields.io/github/workflow/status/stylelint/stylelint/Testing/main?label=CI&logo=github)](https://github.com/stylelint/stylelint/actions/workflows/testing.yml?query=branch%3Amain) [![npm downloads](https://img.shields.io/npm/dm/stylelint)](https://npmcharts.com/compare/stylelint?minimal=true) A mighty, modern linter that helps you avoid errors and enforce conventions in your styles. @@ -24,7 +24,7 @@ And can be extended to: ## Example output -![Example](https://github.com/stylelint/stylelint/raw/main/example.png?raw=true) +![Example](example.png) ## Guides @@ -87,7 +87,7 @@ Thank you to all our backers! [Become a backer](https://opencollective.com/style ### Website hosting -Deploys by Netlify +[![Deploys by Netlify](https://www.netlify.com/img/global/badges/netlify-color-accent.svg)](https://www.netlify.com) ## License diff --git a/node_modules/stylelint/lib/assignDisabledRanges.js b/node_modules/stylelint/lib/assignDisabledRanges.js index 9d94c89807..30351abb4b 100644 --- a/node_modules/stylelint/lib/assignDisabledRanges.js +++ b/node_modules/stylelint/lib/assignDisabledRanges.js @@ -134,9 +134,9 @@ module.exports = function assignDisabledRanges(root, result) { const line = comment.source.start.line; const description = getDescription(comment.text); - getCommandRules(disableLineCommand, comment.text).forEach((ruleName) => { + for (const ruleName of getCommandRules(disableLineCommand, comment.text)) { disableLine(comment, line, ruleName, description); - }); + } } } @@ -148,9 +148,9 @@ module.exports = function assignDisabledRanges(root, result) { const line = comment.source.end.line; const description = getDescription(comment.text); - getCommandRules(disableNextLineCommand, comment.text).forEach((ruleName) => { + for (const ruleName of getCommandRules(disableNextLineCommand, comment.text)) { disableLine(comment, line + 1, ruleName, description); - }); + } } } @@ -168,14 +168,14 @@ module.exports = function assignDisabledRanges(root, result) { } if (ruleName === ALL_RULES) { - Object.keys(disabledRanges).forEach((disabledRuleName) => { - if (ruleIsDisabled(disabledRuleName)) return; + for (const disabledRuleName of Object.keys(disabledRanges)) { + if (ruleIsDisabled(disabledRuleName)) continue; const strict = disabledRuleName === ALL_RULES; startDisabledRange(comment, line, disabledRuleName, strict, description); endDisabledRange(line, disabledRuleName, strict); - }); + } } else { if (ruleIsDisabled(ruleName)) { throw comment.error(`"${ruleName}" has already been disabled`, { @@ -194,7 +194,7 @@ module.exports = function assignDisabledRanges(root, result) { function processDisableCommand(comment) { const description = getDescription(comment.text); - getCommandRules(disableCommand, comment.text).forEach((ruleToDisable) => { + for (const ruleToDisable of getCommandRules(disableCommand, comment.text)) { const isAllRules = ruleToDisable === ALL_RULES; if (ruleIsDisabled(ruleToDisable)) { @@ -212,21 +212,21 @@ module.exports = function assignDisabledRanges(root, result) { const line = comment.source.start.line; if (isAllRules) { - Object.keys(disabledRanges).forEach((ruleName) => { + for (const ruleName of Object.keys(disabledRanges)) { startDisabledRange(comment, line, ruleName, ruleName === ALL_RULES, description); - }); + } } else { startDisabledRange(comment, line, ruleToDisable, true, description); } } - }); + } } /** * @param {PostcssComment} comment */ function processEnableCommand(comment) { - getCommandRules(enableCommand, comment.text).forEach((ruleToEnable) => { + for (const ruleToEnable of getCommandRules(enableCommand, comment.text)) { // TODO TYPES // need fallback if endLine will be undefined const endLine = /** @type {number} */ ( @@ -244,15 +244,15 @@ module.exports = function assignDisabledRanges(root, result) { }); } - Object.entries(disabledRanges).forEach(([ruleName, ranges]) => { + for (const [ruleName, ranges] of Object.entries(disabledRanges)) { const lastRange = ranges[ranges.length - 1]; if (!lastRange || !lastRange.end) { endDisabledRange(endLine, ruleName, ruleName === ALL_RULES); } - }); + } - return; + continue; } if (ruleIsDisabled(ALL_RULES) && disabledRanges[ruleToEnable] === undefined) { @@ -272,19 +272,19 @@ module.exports = function assignDisabledRanges(root, result) { endDisabledRange(endLine, ruleToEnable, true); - return; + continue; } if (ruleIsDisabled(ruleToEnable)) { endDisabledRange(endLine, ruleToEnable, true); - return; + continue; } throw comment.error(`"${ruleToEnable}" has not been disabled`, { plugin: 'stylelint', }); - }); + } } /** diff --git a/node_modules/stylelint/lib/augmentConfig.js b/node_modules/stylelint/lib/augmentConfig.js index 337affc102..a06ad2d782 100644 --- a/node_modules/stylelint/lib/augmentConfig.js +++ b/node_modules/stylelint/lib/augmentConfig.js @@ -16,6 +16,8 @@ const path = require('path'); /** @typedef {import('stylelint').InternalApi} StylelintInternalApi */ /** @typedef {import('stylelint').Config} StylelintConfig */ /** @typedef {import('stylelint').CosmiconfigResult} StylelintCosmiconfigResult */ +/** @typedef {import('stylelint').CodeProcessor} StylelintCodeProcessor */ +/** @typedef {import('stylelint').ResultProcessor} StylelintResultProcessor */ /** * - Merges config and stylelint options @@ -24,50 +26,64 @@ const path = require('path'); * @param {StylelintInternalApi} stylelint * @param {StylelintConfig} config * @param {string} configDir - * @param {boolean} [allowOverrides] + * @param {boolean} allowOverrides + * @param {string} rootConfigDir * @param {string} [filePath] * @returns {Promise} */ -async function augmentConfigBasic(stylelint, config, configDir, allowOverrides, filePath) { +async function augmentConfigBasic( + stylelint, + config, + configDir, + allowOverrides, + rootConfigDir, + filePath, +) { let augmentedConfig = config; if (allowOverrides) { augmentedConfig = addOptions(stylelint, augmentedConfig); } - augmentedConfig = await extendConfig(stylelint, augmentedConfig, configDir); - if (filePath) { - while (augmentedConfig.overrides) { - augmentedConfig = applyOverrides(augmentedConfig, configDir, filePath); - augmentedConfig = await extendConfig(stylelint, augmentedConfig, configDir); - } + augmentedConfig = applyOverrides(augmentedConfig, rootConfigDir, filePath); } - return absolutizePaths(augmentedConfig, configDir); + augmentedConfig = await extendConfig( + stylelint, + augmentedConfig, + configDir, + rootConfigDir, + filePath, + ); + + const cwd = stylelint._options.cwd; + + return absolutizePaths(augmentedConfig, configDir, cwd); } /** * Extended configs need to be run through augmentConfigBasic * but do not need the full treatment. Things like pluginFunctions * will be resolved and added by the parent config. - * @param {StylelintInternalApi} stylelint - * @param {StylelintCosmiconfigResult} [cosmiconfigResult] - * @returns {Promise} + * @param {string} cwd + * @returns {(cosmiconfigResult?: StylelintCosmiconfigResult) => Promise} */ -async function augmentConfigExtended(stylelint, cosmiconfigResult) { - if (!cosmiconfigResult) { - return null; - } +function augmentConfigExtended(cwd) { + return async (cosmiconfigResult) => { + if (!cosmiconfigResult) { + return null; + } - const configDir = path.dirname(cosmiconfigResult.filepath || ''); - const { config } = cosmiconfigResult; + const configDir = path.dirname(cosmiconfigResult.filepath || ''); + const { config } = cosmiconfigResult; - const augmentedConfig = await augmentConfigBasic(stylelint, config, configDir); + const augmentedConfig = absolutizePaths(config, configDir, cwd); - return { - config: augmentedConfig, - filepath: cosmiconfigResult.filepath, + return { + config: augmentedConfig, + filepath: cosmiconfigResult.filepath, + }; }; } @@ -87,7 +103,14 @@ async function augmentConfigFull(stylelint, filePath, cosmiconfigResult) { const configDir = stylelint._options.configBasedir || path.dirname(filepath || ''); - let augmentedConfig = await augmentConfigBasic(stylelint, config, configDir, true, filePath); + let augmentedConfig = await augmentConfigBasic( + stylelint, + config, + configDir, + true, + configDir, + filePath, + ); augmentedConfig = addPluginFunctions(augmentedConfig); augmentedConfig = addProcessorFunctions(augmentedConfig); @@ -114,9 +137,10 @@ async function augmentConfigFull(stylelint, filePath, cosmiconfigResult) { * (extends handled elsewhere) * @param {StylelintConfig} config * @param {string} configDir + * @param {string} cwd * @returns {StylelintConfig} */ -function absolutizePaths(config, configDir) { +function absolutizePaths(config, configDir, cwd) { if (config.ignoreFiles) { config.ignoreFiles = [config.ignoreFiles].flat().map((glob) => { if (path.isAbsolute(glob.replace(/^!/, ''))) return glob; @@ -126,7 +150,7 @@ function absolutizePaths(config, configDir) { } if (config.plugins) { - config.plugins = [config.plugins].flat().map((lookup) => getModulePath(configDir, lookup)); + config.plugins = [config.plugins].flat().map((lookup) => getModulePath(configDir, lookup, cwd)); } if (config.processors) { @@ -159,9 +183,11 @@ function absolutizeProcessors(processors, configDir) { * @param {StylelintInternalApi} stylelint * @param {StylelintConfig} config * @param {string} configDir + * @param {string} rootConfigDir + * @param {string} [filePath] * @return {Promise} */ -async function extendConfig(stylelint, config, configDir) { +async function extendConfig(stylelint, config, configDir, rootConfigDir, filePath) { if (config.extends === undefined) { return config; } @@ -175,7 +201,19 @@ async function extendConfig(stylelint, config, configDir) { const extendResult = await loadExtendedConfig(stylelint, configDir, extendLookup); if (extendResult) { - resultConfig = mergeConfigs(resultConfig, extendResult.config); + let extendResultConfig = extendResult.config; + const extendConfigDir = path.dirname(extendResult.filepath || ''); + + extendResultConfig = await augmentConfigBasic( + stylelint, + extendResultConfig, + extendConfigDir, + false, + rootConfigDir, + filePath, + ); + + resultConfig = mergeConfigs(resultConfig, extendResultConfig); } } @@ -189,7 +227,7 @@ async function extendConfig(stylelint, config, configDir) { * @return {Promise} */ function loadExtendedConfig(stylelint, configDir, extendLookup) { - const extendPath = getModulePath(configDir, extendLookup); + const extendPath = getModulePath(configDir, extendLookup, stylelint._options.cwd); return stylelint._extendExplorer.load(extendPath); } @@ -293,7 +331,7 @@ function addPluginFunctions(config) { // or an array of them const normalizedPluginImport = [pluginImport].flat(); - normalizedPluginImport.forEach((pluginRuleDefinition) => { + for (const pluginRuleDefinition of normalizedPluginImport) { if (!pluginRuleDefinition.ruleName) { throw configurationError( `stylelint requires plugins to expose a ruleName. The plugin "${pluginLookup}" is not doing this, so will not work with stylelint. Please file an issue with the plugin.`, @@ -307,7 +345,7 @@ function addPluginFunctions(config) { } pluginFunctions[pluginRuleDefinition.ruleName] = pluginRuleDefinition.rule; - }); + } } config.pluginFunctions = pluginFunctions; @@ -337,12 +375,12 @@ const processorCache = new Map(); function addProcessorFunctions(config) { if (!config.processors) return config; - /** @type {Array} */ + /** @type {StylelintCodeProcessor[]} */ const codeProcessors = []; - /** @type {Array} */ + /** @type {StylelintResultProcessor[]} */ const resultProcessors = []; - [config.processors].flat().forEach((processorConfig) => { + for (const processorConfig of [config.processors].flat()) { const processorKey = JSON.stringify(processorConfig); let initializedProcessor; @@ -367,7 +405,7 @@ function addProcessorFunctions(config) { if (initializedProcessor && initializedProcessor.result) { resultProcessors.push(initializedProcessor.result); } - }); + } config.codeProcessors = codeProcessors; config.resultProcessors = resultProcessors; @@ -377,11 +415,11 @@ function addProcessorFunctions(config) { /** * @param {StylelintConfig} fullConfig - * @param {string} configDir + * @param {string} rootConfigDir * @param {string} filePath * @return {StylelintConfig} */ -function applyOverrides(fullConfig, configDir, filePath) { +function applyOverrides(fullConfig, rootConfigDir, filePath) { let { overrides, ...config } = fullConfig; if (!overrides) { @@ -410,7 +448,7 @@ function applyOverrides(fullConfig, configDir, filePath) { return glob; } - return globjoin(configDir, glob); + return globjoin(rootConfigDir, glob); }) // Glob patterns for micromatch should be in POSIX-style .map((s) => normalizePath(s)); diff --git a/node_modules/stylelint/lib/createStylelint.js b/node_modules/stylelint/lib/createStylelint.js index 4a0b48639d..ffe0a04582 100644 --- a/node_modules/stylelint/lib/createStylelint.js +++ b/node_modules/stylelint/lib/createStylelint.js @@ -22,12 +22,14 @@ const STOP_DIR = IS_TEST ? process.cwd() : undefined; * @returns {StylelintInternalApi} */ function createStylelint(options = {}) { + const cwd = options.cwd || process.cwd(); + /** @type {StylelintInternalApi} */ // @ts-expect-error -- TS2740: Type '{ _options: LinterOptions; }' is missing the following properties from type 'InternalApi' - const stylelint = { _options: options }; + const stylelint = { _options: { ...options, cwd } }; stylelint._extendExplorer = cosmiconfig('', { - transform: augmentConfig.augmentConfigExtended.bind(null, stylelint), + transform: augmentConfig.augmentConfigExtended(cwd), stopDir: STOP_DIR, }); diff --git a/node_modules/stylelint/lib/createStylelintResult.js b/node_modules/stylelint/lib/createStylelintResult.js index 25d9d3d9fe..a16401a1cb 100644 --- a/node_modules/stylelint/lib/createStylelintResult.js +++ b/node_modules/stylelint/lib/createStylelintResult.js @@ -26,7 +26,7 @@ module.exports = async function createStylelintResult( const file = stylelintResult.source || (cssSyntaxError && cssSyntaxError.file); if (config.resultProcessors) { - config.resultProcessors.forEach((resultProcessor) => { + for (const resultProcessor of config.resultProcessors) { // Result processors might just mutate the result object, // or might return a new one const returned = resultProcessor(stylelintResult, file); @@ -34,7 +34,7 @@ module.exports = async function createStylelintResult( if (returned) { stylelintResult = returned; } - }); + } } return stylelintResult; diff --git a/node_modules/stylelint/lib/descriptionlessDisables.js b/node_modules/stylelint/lib/descriptionlessDisables.js index 004120fe9b..3fc86fac22 100644 --- a/node_modules/stylelint/lib/descriptionlessDisables.js +++ b/node_modules/stylelint/lib/descriptionlessDisables.js @@ -12,13 +12,13 @@ const validateDisableSettings = require('./validateDisableSettings'); * @param {import('stylelint').LintResult[]} results */ module.exports = function descriptionlessDisables(results) { - results.forEach((result) => { + for (const result of results) { const settings = validateDisableSettings( result._postcssResult, 'reportDescriptionlessDisables', ); - if (!settings) return; + if (!settings) continue; const [enabled, options, stylelintResult] = settings; @@ -27,11 +27,11 @@ module.exports = function descriptionlessDisables(results) { /** @type {Set} */ const alreadyReported = new Set(); - Object.keys(rangeData).forEach((rule) => { - rangeData[rule].forEach((range) => { - if (range.description) return; + for (const rule of Object.keys(rangeData)) { + for (const range of rangeData[rule]) { + if (range.description) continue; - if (alreadyReported.has(range.comment)) return; + if (alreadyReported.has(range.comment)) continue; if (enabled === optionsMatches(options, 'except', rule)) { // An 'all' rule will get copied for each individual rule. If the @@ -40,14 +40,14 @@ module.exports = function descriptionlessDisables(results) { // the comment as already reported. if (!enabled && rule === 'all') alreadyReported.add(range.comment); - return; + continue; } alreadyReported.add(range.comment); // If the comment doesn't have a location, we can't report a useful error. // In practice we expect all comments to have locations, though. - if (!range.comment.source || !range.comment.source.start) return; + if (!range.comment.source || !range.comment.source.start) continue; result.warnings.push({ text: `Disable for "${rule}" is missing a description`, @@ -56,7 +56,7 @@ module.exports = function descriptionlessDisables(results) { column: range.comment.source.start.column, severity: options.severity, }); - }); - }); - }); + } + } + } }; diff --git a/node_modules/stylelint/lib/formatters/stringFormatter.js b/node_modules/stylelint/lib/formatters/stringFormatter.js index c394658236..4d3d804ee3 100644 --- a/node_modules/stylelint/lib/formatters/stringFormatter.js +++ b/node_modules/stylelint/lib/formatters/stringFormatter.js @@ -79,12 +79,13 @@ function invalidOptionsFormatter(results) { /** * @param {string} fromValue + * @param {string} cwd * @return {string} */ -function logFrom(fromValue) { +function logFrom(fromValue, cwd) { if (fromValue.startsWith('<')) return fromValue; - return path.relative(process.cwd(), fromValue).split(path.sep).join('/'); + return path.relative(cwd, fromValue).split(path.sep).join('/'); } /** @@ -110,9 +111,10 @@ function getMessageWidth(columnWidths) { /** * @param {import('stylelint').Warning[]} messages * @param {string} source + * @param {string} cwd * @return {string} */ -function formatter(messages, source) { +function formatter(messages, source, cwd) { if (!messages.length) return ''; const orderedMessages = [...messages].sort((a, b) => { @@ -157,7 +159,7 @@ function formatter(messages, source) { let output = '\n'; if (source) { - output += `${underline(logFrom(source))}\n`; + output += `${underline(logFrom(source, cwd))}\n`; } /** @@ -231,7 +233,7 @@ function formatter(messages, source) { /** * @type {import('stylelint').Formatter} */ -module.exports = function (results) { +module.exports = function (results, returnValue) { let output = invalidOptionsFormatter(results); output += deprecationsFormatter(results); @@ -239,18 +241,21 @@ module.exports = function (results) { output = results.reduce((accum, result) => { // Treat parseErrors as warnings if (result.parseErrors) { - result.parseErrors.forEach((error) => + for (const error of result.parseErrors) result.warnings.push({ line: error.line, column: error.column, rule: error.stylelintType, severity: 'error', text: `${error.text} (${error.stylelintType})`, - }), - ); + }); } - accum += formatter(result.warnings, result.source || ''); + accum += formatter( + result.warnings, + result.source || '', + (returnValue && returnValue.cwd) || process.cwd(), + ); return accum; }, output); diff --git a/node_modules/stylelint/lib/formatters/tapFormatter.js b/node_modules/stylelint/lib/formatters/tapFormatter.js index f7ade9f21f..fa73a04b79 100644 --- a/node_modules/stylelint/lib/formatters/tapFormatter.js +++ b/node_modules/stylelint/lib/formatters/tapFormatter.js @@ -6,7 +6,7 @@ const tapFormatter = (results) => { const lines = [`TAP version 13\n1..${results.length}`]; - results.forEach((result, index) => { + for (const [index, result] of results.entries()) { lines.push( `${result.errored ? 'not ok' : 'ok'} ${index + 1} - ${result.ignored ? 'ignored ' : ''}${ result.source @@ -16,7 +16,7 @@ const tapFormatter = (results) => { if (result.warnings.length > 0) { lines.push('---', 'messages:'); - result.warnings.forEach((warning) => { + for (const warning of result.warnings) { lines.push( ` - message: "${warning.text}"`, ` severity: ${warning.severity}`, @@ -25,11 +25,11 @@ const tapFormatter = (results) => { ` column: ${warning.column}`, ` ruleId: ${warning.rule}`, ); - }); + } lines.push('---'); } - }); + } lines.push(''); diff --git a/node_modules/stylelint/lib/formatters/verboseFormatter.js b/node_modules/stylelint/lib/formatters/verboseFormatter.js index bd59b5a196..d56af20cc1 100644 --- a/node_modules/stylelint/lib/formatters/verboseFormatter.js +++ b/node_modules/stylelint/lib/formatters/verboseFormatter.js @@ -9,8 +9,8 @@ const { underline, red, yellow, dim, green } = require('picocolors'); /** * @type {Formatter} */ -module.exports = function (results) { - let output = stringFormatter(results); +module.exports = function (results, returnValue) { + let output = stringFormatter(results, returnValue); if (output === '') { output = '\n'; @@ -23,7 +23,8 @@ module.exports = function (results) { : results.length; output += underline(`${checkedDisplay} ${sourceWord} checked\n`); - results.forEach((result) => { + + for (const result of results) { let formatting = green; if (result.errored) { @@ -41,7 +42,7 @@ module.exports = function (results) { } output += formatting(` ${sourceText}\n`); - }); + } const warnings = results.flatMap((r) => r.warnings); const warningsBySeverity = groupBy(warnings, (w) => w.severity); diff --git a/node_modules/stylelint/lib/getConfigForFile.js b/node_modules/stylelint/lib/getConfigForFile.js index d602fbdd48..1d843df103 100644 --- a/node_modules/stylelint/lib/getConfigForFile.js +++ b/node_modules/stylelint/lib/getConfigForFile.js @@ -18,8 +18,13 @@ const STOP_DIR = IS_TEST ? process.cwd() : undefined; * @param {string} [filePath] * @returns {Promise} */ -module.exports = async function getConfigForFile(stylelint, searchPath = process.cwd(), filePath) { +module.exports = async function getConfigForFile( + stylelint, + searchPath = stylelint._options.cwd, + filePath, +) { const optionsConfig = stylelint._options.config; + const cwd = stylelint._options.cwd; if (optionsConfig !== undefined) { const cached = stylelint._specifiedConfigCache.get(optionsConfig); @@ -34,7 +39,7 @@ module.exports = async function getConfigForFile(stylelint, searchPath = process config: optionsConfig, // Add the extra path part so that we can get the directory without being // confused - filepath: path.join(process.cwd(), 'argument-config'), + filepath: path.join(cwd, 'argument-config'), }); stylelint._specifiedConfigCache.set(optionsConfig, augmentedResult); @@ -52,7 +57,7 @@ module.exports = async function getConfigForFile(stylelint, searchPath = process : await configExplorer.search(searchPath); if (!config) { - config = await configExplorer.search(process.cwd()); + config = await configExplorer.search(cwd); } if (!config) { diff --git a/node_modules/stylelint/lib/getPostcssResult.js b/node_modules/stylelint/lib/getPostcssResult.js index 273dae48d6..4b00c5aa87 100644 --- a/node_modules/stylelint/lib/getPostcssResult.js +++ b/node_modules/stylelint/lib/getPostcssResult.js @@ -69,9 +69,9 @@ module.exports = async function getPostcssResult(stylelint, options = {}) { const sourceName = options.code ? options.codeFilename : options.filePath; - options.codeProcessors.forEach((codeProcessor) => { + for (const codeProcessor of options.codeProcessors) { getCode = codeProcessor(getCode, sourceName); - }); + } } const postcssResult = await new LazyResult(postcssProcessor, getCode, postcssOptions); @@ -94,10 +94,16 @@ function getCustomSyntax(customSyntax) { try { resolved = require(customSyntax); } catch (error) { - // @ts-expect-error -- TS2571: Object is of type 'unknown'. - if (error && typeof error === 'object' && error.code === 'MODULE_NOT_FOUND') { + if ( + error && + typeof error === 'object' && + // @ts-expect-error -- TS2571: Object is of type 'unknown'. + error.code === 'MODULE_NOT_FOUND' && + // @ts-expect-error -- TS2571: Object is of type 'unknown'. + error.message.includes(customSyntax) + ) { throw new Error( - `Cannot resolve custom syntax module "${customSyntax}". Check that module "${customSyntax}" is available and spelled correctly.`, + `Cannot resolve custom syntax module "${customSyntax}". Check that module "${customSyntax}" is available and spelled correctly.\n\nCaused by: ${error}`, ); } diff --git a/node_modules/stylelint/lib/index.js b/node_modules/stylelint/lib/index.js index f8bca2f451..5e6c736837 100644 --- a/node_modules/stylelint/lib/index.js +++ b/node_modules/stylelint/lib/index.js @@ -10,6 +10,7 @@ const ruleMessages = require('./utils/ruleMessages'); const rules = require('./rules'); const standalone = require('./standalone'); const validateOptions = require('./utils/validateOptions'); +const resolveConfig = require('./resolveConfig'); /** @type {import('stylelint').PublicApi} */ const stylelint = Object.assign(postcssPlugin, { @@ -17,6 +18,7 @@ const stylelint = Object.assign(postcssPlugin, { rules, formatters, createPlugin, + resolveConfig, createLinter: createStylelint, utils: { report, diff --git a/node_modules/stylelint/lib/invalidScopeDisables.js b/node_modules/stylelint/lib/invalidScopeDisables.js index dec9f829f7..4a0f816c4b 100644 --- a/node_modules/stylelint/lib/invalidScopeDisables.js +++ b/node_modules/stylelint/lib/invalidScopeDisables.js @@ -9,10 +9,10 @@ const validateDisableSettings = require('./validateDisableSettings'); * @param {import('stylelint').LintResult[]} results */ module.exports = function invalidScopeDisables(results) { - results.forEach((result) => { + for (const result of results) { const settings = validateDisableSettings(result._postcssResult, 'reportInvalidScopeDisables'); - if (!settings) return; + if (!settings) continue; const [enabled, options, stylelintResult] = settings; @@ -25,17 +25,17 @@ module.exports = function invalidScopeDisables(results) { const rangeData = stylelintResult.disabledRanges; const disabledRules = Object.keys(rangeData); - disabledRules.forEach((rule) => { - if (usedRules.has(rule)) return; + for (const rule of disabledRules) { + if (usedRules.has(rule)) continue; - if (enabled === optionsMatches(options, 'except', rule)) return; + if (enabled === optionsMatches(options, 'except', rule)) continue; - rangeData[rule].forEach((range) => { - if (!range.strictStart && !range.strictEnd) return; + for (const range of rangeData[rule]) { + if (!range.strictStart && !range.strictEnd) continue; // If the comment doesn't have a location, we can't report a useful error. // In practice we expect all comments to have locations, though. - if (!range.comment.source || !range.comment.source.start) return; + if (!range.comment.source || !range.comment.source.start) continue; result.warnings.push({ text: `Rule "${rule}" isn't enabled`, @@ -44,7 +44,7 @@ module.exports = function invalidScopeDisables(results) { column: range.comment.source.start.column, severity: options.severity, }); - }); - }); - }); + } + } + } }; diff --git a/node_modules/stylelint/lib/isPathIgnored.js b/node_modules/stylelint/lib/isPathIgnored.js index b3c05d3e27..13c006146a 100644 --- a/node_modules/stylelint/lib/isPathIgnored.js +++ b/node_modules/stylelint/lib/isPathIgnored.js @@ -19,7 +19,7 @@ module.exports = async function isPathIgnored(stylelint, filePath) { return false; } - const cwd = process.cwd(); + const cwd = stylelint._options.cwd; const ignorer = getFileIgnorer(stylelint._options); const result = await stylelint.getConfigForFile(filePath, filePath); @@ -33,9 +33,7 @@ module.exports = async function isPathIgnored(stylelint, filePath) { normalizePath(s), ); - const absoluteFilePath = path.isAbsolute(filePath) - ? filePath - : path.resolve(process.cwd(), filePath); + const absoluteFilePath = path.isAbsolute(filePath) ? filePath : path.resolve(cwd, filePath); if (micromatch([absoluteFilePath], ignoreFiles).length) { return true; diff --git a/node_modules/stylelint/lib/lintPostcssResult.js b/node_modules/stylelint/lib/lintPostcssResult.js index d55b01afaf..99e78f64f9 100644 --- a/node_modules/stylelint/lib/lintPostcssResult.js +++ b/node_modules/stylelint/lib/lintPostcssResult.js @@ -60,7 +60,7 @@ function lintPostcssResult(stylelintOptions, postcssResult, config) { ) : []; - rules.forEach((ruleName) => { + for (const ruleName of rules) { const ruleFunction = rulesOrder[ruleName] || (config.pluginFunctions && config.pluginFunctions[ruleName]); @@ -73,13 +73,13 @@ function lintPostcssResult(stylelintOptions, postcssResult, config) { ), ); - return; + continue; } const ruleSettings = config.rules && config.rules[ruleName]; if (ruleSettings === null || ruleSettings[0] === null) { - return; + continue; } const primaryOption = ruleSettings[0]; @@ -113,7 +113,7 @@ function lintPostcssResult(stylelintOptions, postcssResult, config) { ), ), ); - }); + } return Promise.all(performRules); } diff --git a/node_modules/stylelint/lib/lintSource.js b/node_modules/stylelint/lib/lintSource.js index 7682d52908..caf877b44b 100644 --- a/node_modules/stylelint/lib/lintSource.js +++ b/node_modules/stylelint/lib/lintSource.js @@ -49,12 +49,12 @@ module.exports = async function lintSource(stylelint, options = {}) { } const configSearchPath = stylelint._options.configFile || inputFilePath; + const cwd = stylelint._options.cwd; const configForFile = await stylelint .getConfigForFile(configSearchPath, inputFilePath) .catch((err) => { - if (isCodeNotFile && isPathNotFoundError(err)) - return stylelint.getConfigForFile(process.cwd()); + if (isCodeNotFile && isPathNotFoundError(err)) return stylelint.getConfigForFile(cwd); throw err; }); diff --git a/node_modules/stylelint/lib/needlessDisables.js b/node_modules/stylelint/lib/needlessDisables.js index ccd2bb9e12..fd6a917cf9 100644 --- a/node_modules/stylelint/lib/needlessDisables.js +++ b/node_modules/stylelint/lib/needlessDisables.js @@ -13,16 +13,16 @@ const validateDisableSettings = require('./validateDisableSettings'); * @param {import('stylelint').LintResult[]} results */ module.exports = function needlessDisables(results) { - results.forEach((result) => { + for (const result of results) { const settings = validateDisableSettings(result._postcssResult, 'reportNeedlessDisables'); - if (!settings) return; + if (!settings) continue; const [enabled, options, stylelintResult] = settings; const rangeData = stylelintResult.disabledRanges; - if (!rangeData) return; + if (!rangeData) continue; const disabledWarnings = stylelintResult.disabledWarnings || []; @@ -81,7 +81,7 @@ module.exports = function needlessDisables(results) { }); } } - }); + } }; /** diff --git a/node_modules/stylelint/lib/postcssPlugin.js b/node_modules/stylelint/lib/postcssPlugin.js index fed318110f..01ab5335dc 100644 --- a/node_modules/stylelint/lib/postcssPlugin.js +++ b/node_modules/stylelint/lib/postcssPlugin.js @@ -10,7 +10,9 @@ const path = require('path'); * @type {import('postcss').PluginCreator} * */ module.exports = (options = {}) => { - const tailoredOptions = isConfig(options) ? { config: options } : options; + const [cwd, tailoredOptions] = isConfig(options) + ? [process.cwd(), { config: options }] + : [options.cwd || process.cwd(), options]; const stylelint = createStylelint(tailoredOptions); return { @@ -19,7 +21,7 @@ module.exports = (options = {}) => { let filePath = root.source && root.source.input.file; if (filePath && !path.isAbsolute(filePath)) { - filePath = path.join(process.cwd(), filePath); + filePath = path.join(cwd, filePath); } return stylelint._lintSource({ diff --git a/node_modules/stylelint/lib/prepareReturnValue.js b/node_modules/stylelint/lib/prepareReturnValue.js index f97e311b48..c358dd3ae0 100644 --- a/node_modules/stylelint/lib/prepareReturnValue.js +++ b/node_modules/stylelint/lib/prepareReturnValue.js @@ -14,10 +14,11 @@ const reportDisables = require('./reportDisables'); * @param {StylelintResult[]} stylelintResults * @param {maxWarnings} maxWarnings * @param {Formatter} formatter + * @param {string} cwd * * @returns {LinterResult} */ -function prepareReturnValue(stylelintResults, maxWarnings, formatter) { +function prepareReturnValue(stylelintResults, maxWarnings, formatter, cwd) { reportDisables(stylelintResults); needlessDisables(stylelintResults); invalidScopeDisables(stylelintResults); @@ -32,6 +33,7 @@ function prepareReturnValue(stylelintResults, maxWarnings, formatter) { /** @type {LinterResult} */ const returnValue = { + cwd, errored, results: [], output: '', diff --git a/node_modules/stylelint/lib/printConfig.js b/node_modules/stylelint/lib/printConfig.js index ad25bdf9b6..dcd05e1367 100644 --- a/node_modules/stylelint/lib/printConfig.js +++ b/node_modules/stylelint/lib/printConfig.js @@ -1,8 +1,7 @@ 'use strict'; -const createStylelint = require('./createStylelint'); +const resolveConfig = require('./resolveConfig'); const globby = require('globby'); -const path = require('path'); /** @typedef {import('stylelint').Config} StylelintConfig */ @@ -10,7 +9,8 @@ const path = require('path'); * @param {import('stylelint').LinterOptions} options * @returns {Promise} */ -module.exports = function printConfig({ +module.exports = async function printConfig({ + cwd = process.cwd(), code, config, configBasedir, @@ -32,24 +32,12 @@ module.exports = function printConfig({ return Promise.reject(new Error('The --print-config option does not support globs.')); } - const stylelint = createStylelint({ - config, - configFile, - configBasedir, - }); - - const cwd = (globbyOptions && globbyOptions.cwd) || process.cwd(); - const absoluteFilePath = !path.isAbsolute(filePath) - ? path.join(cwd, filePath) - : path.normalize(filePath); - - const configSearchPath = stylelint._options.configFile || absoluteFilePath; - - return stylelint.getConfigForFile(configSearchPath, absoluteFilePath).then((result) => { - if (result === null) { - return result; - } - - return result.config; - }); + return ( + (await resolveConfig(filePath, { + cwd: (globbyOptions && globbyOptions.cwd) || cwd, + config, + configBasedir, + configFile, + })) || null + ); }; diff --git a/node_modules/stylelint/lib/reference/keywordSets.js b/node_modules/stylelint/lib/reference/keywordSets.js index 0b632a35a2..0232a76282 100644 --- a/node_modules/stylelint/lib/reference/keywordSets.js +++ b/node_modules/stylelint/lib/reference/keywordSets.js @@ -51,8 +51,6 @@ keywordSets.lengthUnits = new Set([ keywordSets.units = uniteSets(keywordSets.nonLengthUnits, keywordSets.lengthUnits); -keywordSets.colorFunctionNames = new Set(['rgb', 'rgba', 'hsl', 'hsla', 'hwb', 'gray']); - keywordSets.camelCaseFunctionNames = new Set([ 'translateX', 'translateY', @@ -679,6 +677,42 @@ keywordSets.nonStandardHtmlTags = new Set([ 'xmp', ]); +// extracted from https://developer.mozilla.org/en-US/docs/Web/SVG/Element +keywordSets.validMixedCaseSvgElements = new Set([ + 'animateMotion', + 'animateTransform', + 'clipPath', + 'feBlend', + 'feColorMatrix', + 'feComponentTransfer', + 'feComposite', + 'feConvolveMatrix', + 'feDiffuseLighting', + 'feDisplacementMap', + 'feDistantLight', + 'feDropShadow', + 'feFlood', + 'feFuncA', + 'feFuncB', + 'feFuncG', + 'feFuncR', + 'feGaussianBlur', + 'feImage', + 'feMerge', + 'feMergeNode', + 'feMorphology', + 'feOffset', + 'fePointLight', + 'feSpecularLighting', + 'feSpotLight', + 'feTile', + 'feTurbulence', + 'foreignObject', + 'linearGradient', + 'radialGradient', + 'textPath', +]); + /** * @param {(string[] | Set)[]} args */ diff --git a/node_modules/stylelint/lib/reference/namedColorData.js b/node_modules/stylelint/lib/reference/namedColorData.js deleted file mode 100644 index d9c85c0b85..0000000000 --- a/node_modules/stylelint/lib/reference/namedColorData.js +++ /dev/null @@ -1,153 +0,0 @@ -'use strict'; - -/** @type {Record} */ -module.exports = { - aliceblue: ['#f0f8ff', '#fff0f8ff'], - antiquewhite: ['#faebd7', '#fffaebd7'], - aqua: ['#00ffff', '#ff00ffff', '#0ff', '#f0ff'], - aquamarine: ['#7fffd4', '#ff7fffd4'], - azure: ['#f0ffff', '#fff0ffff'], - beige: ['#f5f5dc', '#fff5f5dc'], - bisque: ['#ffe4c4', '#ffffe4c4'], - black: ['#000000', '#ff000000', '#000', '#f000'], - blanchedalmond: ['#ffebcd', '#ffffebcd'], - blue: ['#0000ff', '#ff0000ff', '#00f', '#f00f'], - blueviolet: ['#8a2be2', '#ff8a2be2'], - brown: ['#a52a2a', '#ffa52a2a'], - burlywood: ['#deb887', '#ffdeb887'], - cadetblue: ['#5f9ea0', '#ff5f9ea0'], - chartreuse: ['#7fff00', '#ff7fff00'], - chocolate: ['#d2691e', '#ffd2691e'], - coral: ['#ff7f50', '#ffff7f50'], - cornflowerblue: ['#6495ed', '#ff6495ed'], - cornsilk: ['#fff8dc', '#fffff8dc'], - crimson: ['#dc143c', '#ffdc143c'], - cyan: ['#00ffff', '#ff00ffff', '#0ff', '#f0ff'], - darkblue: ['#00008b', '#ff00008b'], - darkcyan: ['#008b8b', '#ff008b8b'], - darkgoldenrod: ['#b8860b', '#ffb8860b'], - darkgray: ['#a9a9a9', '#ffa9a9a9'], - darkgreen: ['#006400', '#ff006400'], - darkgrey: ['#a9a9a9', '#ffa9a9a9'], - darkkhaki: ['#bdb76b', '#ffbdb76b'], - darkmagenta: ['#8b008b', '#ff8b008b'], - darkolivegreen: ['#556b2f', '#ff556b2f'], - darkorange: ['#ff8c00', '#ffff8c00'], - darkorchid: ['#9932cc', '#ff9932cc'], - darkred: ['#8b0000', '#ff8b0000'], - darksalmon: ['#e9967a', '#ffe9967a'], - darkseagreen: ['#8fbc8f', '#ff8fbc8f'], - darkslateblue: ['#483d8b', '#ff483d8b'], - darkslategray: ['#2f4f4f', '#ff2f4f4f'], - darkslategrey: ['#2f4f4f', '#ff2f4f4f'], - darkturquoise: ['#00ced1', '#ff00ced1'], - darkviolet: ['#9400d3', '#ff9400d3'], - deeppink: ['#ff1493', '#ffff1493'], - deepskyblue: ['#00bfff', '#ff00bfff'], - dimgray: ['#696969', '#ff696969'], - dimgrey: ['#696969', '#ff696969'], - dodgerblue: ['#1e90ff', '#ff1e90ff'], - firebrick: ['#b22222', '#ffb22222'], - floralwhite: ['#fffaf0', '#fffffaf0'], - forestgreen: ['#228b22', '#ff228b22'], - fuchsia: ['#ff00ff', '#ffff00ff', '#f0f', '#ff0f'], - gainsboro: ['#dcdcdc', '#ffdcdcdc'], - ghostwhite: ['#f8f8ff', '#fff8f8ff'], - gold: ['#ffd700', '#ffffd700'], - goldenrod: ['#daa520', '#ffdaa520'], - gray: ['#808080', '#ff808080'], - green: ['#008000', '#ff008000'], - greenyellow: ['#adff2f', '#ffadff2f'], - grey: ['#808080', '#ff808080'], - honeydew: ['#f0fff0', '#fff0fff0'], - hotpink: ['#ff69b4', '#ffff69b4'], - indianred: ['#cd5c5c', '#ffcd5c5c'], - indigo: ['#4b0082', '#ff4b0082'], - ivory: ['#fffff0', '#fffffff0'], - khaki: ['#f0e68c', '#fff0e68c'], - lavender: ['#e6e6fa', '#ffe6e6fa'], - lavenderblush: ['#fff0f5', '#fffff0f5'], - lawngreen: ['#7cfc00', '#ff7cfc00'], - lemonchiffon: ['#fffacd', '#fffffacd'], - lightblue: ['#add8e6', '#ffadd8e6'], - lightcoral: ['#f08080', '#fff08080'], - lightcyan: ['#e0ffff', '#ffe0ffff'], - lightgoldenrodyellow: ['#fafad2', '#fffafad2'], - lightgray: ['#d3d3d3', '#ffd3d3d3'], - lightgreen: ['#90ee90', '#ff90ee90'], - lightgrey: ['#d3d3d3', '#ffd3d3d3'], - lightpink: ['#ffb6c1', '#ffffb6c1'], - lightsalmon: ['#ffa07a', '#ffffa07a'], - lightseagreen: ['#20b2aa', '#ff20b2aa'], - lightskyblue: ['#87cefa', '#ff87cefa'], - lightslategray: ['#778899', '#ff778899', '#789', '#f789'], - lightslategrey: ['#778899', '#ff778899', '#789', '#f789'], - lightsteelblue: ['#b0c4de', '#ffb0c4de'], - lightyellow: ['#ffffe0', '#ffffffe0'], - lime: ['#00ff00', '#ff00ff00', '#0f0', '#f0f0'], - limegreen: ['#32cd32', '#ff32cd32'], - linen: ['#faf0e6', '#fffaf0e6'], - magenta: ['#ff00ff', '#ffff00ff', '#f0f', '#ff0f'], - maroon: ['#800000', '#ff800000'], - mediumaquamarine: ['#66cdaa', '#ff66cdaa'], - mediumblue: ['#0000cd', '#ff0000cd'], - mediumorchid: ['#ba55d3', '#ffba55d3'], - mediumpurple: ['#9370db', '#ff9370db'], - mediumseagreen: ['#3cb371', '#ff3cb371'], - mediumslateblue: ['#7b68ee', '#ff7b68ee'], - mediumspringgreen: ['#00fa9a', '#ff00fa9a'], - mediumturquoise: ['#48d1cc', '#ff48d1cc'], - mediumvioletred: ['#c71585', '#ffc71585'], - midnightblue: ['#191970', '#ff191970'], - mintcream: ['#f5fffa', '#fff5fffa'], - mistyrose: ['#ffe4e1', '#ffffe4e1'], - moccasin: ['#ffe4b5', '#ffffe4b5'], - navajowhite: ['#ffdead', '#ffffdead'], - navy: ['#000080', '#ff000080'], - oldlace: ['#fdf5e6', '#fffdf5e6'], - olive: ['#808000', '#ff808000'], - olivedrab: ['#6b8e23', '#ff6b8e23'], - orange: ['#ffa500', '#ffffa500'], - orangered: ['#ff4500', '#ffff4500'], - orchid: ['#da70d6', '#ffda70d6'], - palegoldenrod: ['#eee8aa', '#ffeee8aa'], - palegreen: ['#98fb98', '#ff98fb98'], - paleturquoise: ['#afeeee', '#ffafeeee'], - palevioletred: ['#db7093', '#ffdb7093'], - papayawhip: ['#ffefd5', '#ffffefd5'], - peachpuff: ['#ffdab9', '#ffffdab9'], - peru: ['#cd853f', '#ffcd853f'], - pink: ['#ffc0cb', '#ffffc0cb'], - plum: ['#dda0dd', '#ffdda0dd'], - powderblue: ['#b0e0e6', '#ffb0e0e6'], - purple: ['#800080', '#ff800080'], - rebeccapurple: ['#663399', '#ff663399', '#639', '#f639'], - red: ['#ff0000', '#ffff0000', '#f00', '#ff00'], - rosybrown: ['#bc8f8f', '#ffbc8f8f'], - royalblue: ['#4169e1', '#ff4169e1'], - saddlebrown: ['#8b4513', '#ff8b4513'], - salmon: ['#fa8072', '#fffa8072'], - sandybrown: ['#f4a460', '#fff4a460'], - seagreen: ['#2e8b57', '#ff2e8b57'], - seashell: ['#fff5ee', '#fffff5ee'], - sienna: ['#a0522d', '#ffa0522d'], - silver: ['#c0c0c0', '#ffc0c0c0'], - skyblue: ['#87ceeb', '#ff87ceeb'], - slateblue: ['#6a5acd', '#ff6a5acd'], - slategray: ['#708090', '#ff708090'], - slategrey: ['#708090', '#ff708090'], - snow: ['#fffafa', '#fffffafa'], - springgreen: ['#00ff7f', '#ff00ff7f'], - steelblue: ['#4682b4', '#ff4682b4'], - tan: ['#d2b48c', '#ffd2b48c'], - teal: ['#008080', '#ff008080'], - thistle: ['#d8bfd8', '#ffd8bfd8'], - tomato: ['#ff6347', '#ffff6347'], - turquoise: ['#40e0d0', '#ff40e0d0'], - violet: ['#ee82ee', '#ffee82ee'], - wheat: ['#f5deb3', '#fff5deb3'], - white: ['#ffffff', '#ffffffff', '#fff', '#ffff'], - whitesmoke: ['#f5f5f5', '#fff5f5f5'], - yellow: ['#ffff00', '#ffffff00', '#ff0', '#fff0'], - yellowgreen: ['#9acd32', '#ff9acd32'], -}; diff --git a/node_modules/stylelint/lib/reportDisables.js b/node_modules/stylelint/lib/reportDisables.js index 9e75d8fedf..15a115021f 100644 --- a/node_modules/stylelint/lib/reportDisables.js +++ b/node_modules/stylelint/lib/reportDisables.js @@ -12,25 +12,25 @@ * @param {StylelintResult[]} results */ module.exports = function (results) { - results.forEach((result) => { + for (const result of results) { // File with `CssSyntaxError` don't have `_postcssResult`s. if (!result._postcssResult) { - return; + continue; } /** @type {{[ruleName: string]: Array}} */ const rangeData = result._postcssResult.stylelint.disabledRanges; - if (!rangeData) return; + if (!rangeData) continue; const config = result._postcssResult.stylelint.config; - if (!config || !config.rules) return; + if (!config || !config.rules) continue; // If no rules actually disallow disables, don't bother looking for ranges // that correspond to disabled rules. - if (!Object.values(config.rules).some(reportDisablesForRule)) { - return; + if (!Object.values(config.rules).some((rule) => reportDisablesForRule(rule))) { + continue; } for (const [rule, ranges] of Object.entries(rangeData)) { @@ -50,7 +50,7 @@ module.exports = function (results) { }); } } - }); + } }; /** diff --git a/node_modules/stylelint/lib/reportUnknownRuleNames.js b/node_modules/stylelint/lib/reportUnknownRuleNames.js index e673bb6cad..3f5a1c07f4 100644 --- a/node_modules/stylelint/lib/reportUnknownRuleNames.js +++ b/node_modules/stylelint/lib/reportUnknownRuleNames.js @@ -17,13 +17,13 @@ function extractSuggestions(ruleName) { suggestions[i] = []; } - Object.keys(rules).forEach((existRuleName) => { + for (const existRuleName of Object.keys(rules)) { const distance = levenshtein.distance(existRuleName, ruleName); if (distance <= MAX_LEVENSHTEIN_DISTANCE) { suggestions[distance - 1].push(existRuleName); } - }); + } /** @type {string[]} */ let result = []; diff --git a/node_modules/stylelint/lib/resolveConfig.js b/node_modules/stylelint/lib/resolveConfig.js new file mode 100644 index 0000000000..3ff990ad57 --- /dev/null +++ b/node_modules/stylelint/lib/resolveConfig.js @@ -0,0 +1,47 @@ +'use strict'; + +const createStylelint = require('./createStylelint'); +const path = require('path'); + +/** + * Resolves the effective configuation for a given file. Resolves to `undefined` + * if no config is found. + * @param {string} filePath - The path to the file to get the config for. + * @param {Pick< + * import('stylelint').LinterOptions, + * | 'cwd' + * | 'config' + * | 'configBasedir' + * | 'configFile' + * >} [options] - The options to use when creating the Stylelint instance. + * @returns {Promise} + */ +module.exports = async function resolveConfig( + filePath, + { cwd = process.cwd(), config, configBasedir, configFile } = {}, +) { + if (!filePath) { + return undefined; + } + + const stylelint = createStylelint({ + config, + configFile, + configBasedir, + cwd, + }); + + const absoluteFilePath = !path.isAbsolute(filePath) + ? path.join(cwd, filePath) + : path.normalize(filePath); + + const configSearchPath = stylelint._options.configFile || absoluteFilePath; + + const resolved = await stylelint.getConfigForFile(configSearchPath, absoluteFilePath); + + if (!resolved) { + return undefined; + } + + return resolved.config; +}; diff --git a/node_modules/stylelint/lib/rules/at-rule-property-required-list/index.js b/node_modules/stylelint/lib/rules/at-rule-property-required-list/index.js index fd6afcd8cc..8f2441424d 100644 --- a/node_modules/stylelint/lib/rules/at-rule-property-required-list/index.js +++ b/node_modules/stylelint/lib/rules/at-rule-property-required-list/index.js @@ -39,7 +39,7 @@ const rule = (primary) => { return; } - list[atRuleName].forEach((property) => { + for (const property of list[atRuleName]) { const propertyName = property.toLowerCase(); const hasProperty = nodes.find( @@ -47,16 +47,17 @@ const rule = (primary) => { ); if (hasProperty) { - return; + continue; } - return report({ + report({ message: messages.expected(propertyName, atRuleName), node: atRule, result, ruleName, }); - }); + continue; + } }); }; }; diff --git a/node_modules/stylelint/lib/rules/block-opening-brace-newline-after/index.js b/node_modules/stylelint/lib/rules/block-opening-brace-newline-after/index.js index e7e8a88819..563a7247ba 100644 --- a/node_modules/stylelint/lib/rules/block-opening-brace-newline-after/index.js +++ b/node_modules/stylelint/lib/rules/block-opening-brace-newline-after/index.js @@ -105,9 +105,10 @@ const rule = (primary, _secondaryOptions, context) => { if (primary === 'never-multi-line') { // Restore the `before` of the node next to the comment node. - backupCommentNextBefores.forEach((before, node) => { + for (const [node, before] of backupCommentNextBefores.entries()) { node.raws.before = before; - }); + } + backupCommentNextBefores.clear(); // Fix @@ -147,9 +148,9 @@ const rule = (primary, _secondaryOptions, context) => { }); // Restore the `before` of the node next to the comment node. - backupCommentNextBefores.forEach((before, node) => { + for (const [node, before] of backupCommentNextBefores.entries()) { node.raws.before = before; - }); + } } }; }; diff --git a/node_modules/stylelint/lib/rules/color-function-notation/index.js b/node_modules/stylelint/lib/rules/color-function-notation/index.js index 5563c5317c..a797801985 100644 --- a/node_modules/stylelint/lib/rules/color-function-notation/index.js +++ b/node_modules/stylelint/lib/rules/color-function-notation/index.js @@ -4,9 +4,11 @@ const valueParser = require('postcss-value-parser'); const declarationValueIndex = require('../../utils/declarationValueIndex'); const getDeclarationValue = require('../../utils/getDeclarationValue'); +const isStandardSyntaxColorFunction = require('../../utils/isStandardSyntaxColorFunction'); const report = require('../../utils/report'); const ruleMessages = require('../../utils/ruleMessages'); const setDeclarationValue = require('../../utils/setDeclarationValue'); +const { isValueFunction } = require('../../utils/typeGuards'); const validateOptions = require('../../utils/validateOptions'); const ruleName = 'color-function-notation'; @@ -33,7 +35,9 @@ const rule = (primary, _secondaryOptions, context) => { const parsedValue = valueParser(getDeclarationValue(decl)); parsedValue.walk((node) => { - if (node.type !== 'function') return; + if (!isValueFunction(node)) return; + + if (!isStandardSyntaxColorFunction(node)) return; const { value, sourceIndex, nodes } = node; diff --git a/node_modules/stylelint/lib/rules/color-named/colordUtils.js b/node_modules/stylelint/lib/rules/color-named/colordUtils.js new file mode 100644 index 0000000000..7bb55f2a2d --- /dev/null +++ b/node_modules/stylelint/lib/rules/color-named/colordUtils.js @@ -0,0 +1,108 @@ +const { colord, extend } = require('colord'); +const valueParser = require('postcss-value-parser'); + +const namesPlugin = require('colord/plugins/names'); +const hwbPlugin = require('colord/plugins/hwb'); +const labPlugin = require('colord/plugins/lab'); +const lchPlugin = require('colord/plugins/lch'); + +extend([ + // Type definitions are not compatible with commonjs. + /** @type {any} */ (namesPlugin), + /** @type {any} */ (hwbPlugin), + /** @type {any} */ (labPlugin), + /** @type {any} */ (lchPlugin), + + /* Syntaxes that is removed in Color Module Level 4 specification. */ + + // hwb() with comma + (_colordClass, parsers) => { + parsers.string.push([parseHwbWithCommaString, /** @type {any} */ ('hwb-with-comma')]); + }, + // gray() + (_colordClass, parsers) => { + parsers.string.push([parseGrayString, /** @type {any} */ ('gray')]); + }, +]); + +module.exports = { + colord, +}; + +/** + * Parses a valid hwb with comma CSS color function + * https://developer.mozilla.org/en-US/docs/Web/CSS/color_value/hwb()#syntax + * @type {import('colord/types').ParseFunction} + */ +function parseHwbWithCommaString(input) { + input = input.toLowerCase(); + + if (!input.startsWith('hwb(') || !input.endsWith(')') || input.includes('/')) { + return null; + } + + const [hue, whiteness = '', blackness = '', alpha, ...extraArgs] = input.slice(4, -1).split(','); + + if (!hue.trim() || !whiteness.trim() || !blackness.trim() || extraArgs.length > 0) { + return null; + } + + // Change the delimiter and parse with colord. + const colordInstance = colord( + `hwb(${hue} ${whiteness} ${blackness}${alpha ? ` / ${alpha}` : ''})`, + ); + + if (!colordInstance.isValid()) { + return null; + } + + return colordInstance.rgba; +} + +/** + * Parses a valid gray() CSS color function + * @type {import('colord/types').ParseFunction} + */ +function parseGrayString(input) { + input = input.toLowerCase(); + + if (!input.startsWith('gray(') || !input.endsWith(')')) { + return null; + } + + const [lightness, alpha, ...extraArgs] = input.slice(5, -1).split(','); + + if (extraArgs.length > 0) { + return null; + } + + const lightnessWithUnit = valueParser.unit(lightness.trim()); + + if (!lightnessWithUnit || !['', '%'].includes(lightnessWithUnit.unit)) { + return null; + } + + /** + * @type {import('colord/types').LabColor | import('colord/types').LabaColor} + */ + let colorObject = { + l: Number(lightnessWithUnit.number), + a: 0, + b: 0, + }; + + if (alpha) { + const alphaWithUnit = valueParser.unit(alpha.trim()); + + if (!alphaWithUnit || !['', '%'].includes(alphaWithUnit.unit)) { + return null; + } + + colorObject = { + ...colorObject, + alpha: Number(alphaWithUnit.number) / (alphaWithUnit.unit ? 100 : 1), + }; + } + + return colord(colorObject).rgba; +} diff --git a/node_modules/stylelint/lib/rules/color-named/generateColorFuncs.js b/node_modules/stylelint/lib/rules/color-named/generateColorFuncs.js deleted file mode 100644 index 0a83f0a4ee..0000000000 --- a/node_modules/stylelint/lib/rules/color-named/generateColorFuncs.js +++ /dev/null @@ -1,233 +0,0 @@ -'use strict'; - -// these algorithms are sourced from https://drafts.csswg.org/css-color/#color-conversion-code - -/** - * @param {number[]} RGB - */ -function lin_sRGB(RGB) { - // convert an array of sRGB values in the range 0.0 - 1.0 - // to linear light (un-companded) form. - // https://en.wikipedia.org/wiki/SRGB - return RGB.map((val) => { - if (val < 0.04045) { - return val / 12.92; - } - - return ((val + 0.055) / 1.055) ** 2.4; - }); -} - -/** - * @param {number[][]} matrix - * @param {number[]} vector - */ -function matrixMultiple3d(matrix, vector) { - return [ - matrix[0][0] * vector[0] + matrix[0][1] * vector[1] + matrix[0][2] * vector[2], - matrix[1][0] * vector[0] + matrix[1][1] * vector[1] + matrix[1][2] * vector[2], - matrix[2][0] * vector[0] + matrix[2][1] * vector[1] + matrix[2][2] * vector[2], - ]; -} - -/** - * @param {number[]} srgb - */ -function srgb2xyz(srgb) { - return matrixMultiple3d( - [ - [0.4124564, 0.3575761, 0.1804375], - [0.2126729, 0.7151522, 0.072175], - [0.0193339, 0.119192, 0.9503041], - ], - srgb, - ); -} - -/** - * @param {number[]} xyz - */ -function chromaticAdaptationD65_D50(xyz) { - return matrixMultiple3d( - [ - [1.0478112, 0.0228866, -0.050127], - [0.0295424, 0.9904844, -0.0170491], - [-0.0092345, 0.0150436, 0.7521316], - ], - xyz, - ); -} - -/** - * @param {number[]} xyzIn - */ -function xyz2lab(xyzIn) { - // Assuming XYZ is relative to D50, convert to CIE Lab - // from CIE standard, which now defines these as a rational fraction - const ε = 216 / 24389; // 6^3/29^3 - const κ = 24389 / 27; // 29^3/3^3 - const white = [0.9642, 1.0, 0.8249]; // D50 reference white - - // compute xyz, which is XYZ scaled relative to reference white - const xyz = xyzIn.map((value, i) => value / white[i]); - - // now compute f - const f = xyz.map((value) => { - if (value > ε) { - return Math.cbrt(value); - } - - return (κ * value + 16) / 116; - }); - - return [ - 116 * f[1] - 16, // L - 500 * (f[0] - f[1]), // a - 200 * (f[1] - f[2]), // b - ]; -} - -/** - * @param {number} r - * @param {number} g - * @param {number} b - */ -function rgb2hsl(r, g, b) { - r /= 255; - g /= 255; - b /= 255; - let h; - let s; - let l; - const M = Math.max(r, g, b); - const m = Math.min(r, g, b); - const d = M - m; - - if (d === 0) { - h = 0; - } else if (M === r) { - h = ((g - b) / d) % 6; - } else if (M === g) { - h = (b - r) / d + 2; - } else { - h = (r - g) / d + 4; - } - - h *= 60; - - if (h < 0) { - h += 360; - } - - l = (M + m) / 2; - - s = d === 0 ? 0 : d / (1 - Math.abs(2 * l - 1)); - - s *= 100; - l *= 100; - - return [Math.round(h), Math.round(s), Math.round(l)]; -} - -/** - * @param {number} rgb_r - * @param {number} rgb_g - * @param {number} rgb_b - */ -function rgb2hwb(rgb_r, rgb_g, rgb_b) { - rgb_r /= 255; - rgb_g /= 255; - rgb_b /= 255; - - const w = Math.min(rgb_r, rgb_g, rgb_b); - const v = Math.max(rgb_r, rgb_g, rgb_b); - - const b = 1 - v; - - if (v === w) { - return [0, Math.round(w * 100), Math.round(b * 100)]; - } - - const f = rgb_r === w ? rgb_g - rgb_b : rgb_g === w ? rgb_b - rgb_r : rgb_r - rgb_g; - const i = rgb_r === w ? 3 : rgb_g === w ? 5 : 1; - - return [ - Math.round(((i - f / (v - w)) / 6) * 360) % 360, - Math.round(w * 100), - Math.round(b * 100), - ]; -} - -/** - * @param {number} value - */ -function perc255(value) { - return `${Math.round((value * 100) / 255)}%`; -} - -/** - * @param {string} hexString - * @returns {string[]} - */ -function generateColorFuncs(hexString) { - if (hexString.length !== 7) { - throw new Error( - `Invalid hex string color definition (${hexString}) - expected 6 character hex string`, - ); - } - - const rgb = [0, 0, 0]; - - for (let i = 0; i < 3; i += 1) { - rgb[i] = Number.parseInt(hexString.substr(2 * i + 1, 2), 16); - } - - const hsl = rgb2hsl(rgb[0], rgb[1], rgb[2]); - const hwb = rgb2hwb(rgb[0], rgb[1], rgb[2]); - const func = []; - const rgbStr = `${rgb[0]},${rgb[1]},${rgb[2]}`; - const rgbPercStr = `${perc255(rgb[0])},${perc255(rgb[1])},${perc255(rgb[2])}`; - const hslStr = `${hsl[0]},${hsl[1]}%,${hsl[2]}%`; - const hwbStr = `${hwb[0]},${hwb[1]}%,${hwb[2]}%`; - - // *very* convoluted process, just to be able to establish if the color - // is gray -- or not. - const linRgb = lin_sRGB([rgb[0] / 255, rgb[1] / 255, rgb[2] / 255]); - const xyz_d65 = srgb2xyz(linRgb); - const xyz_d50 = chromaticAdaptationD65_D50(xyz_d65); - const lab = xyz2lab(xyz_d50); - - func.push( - `rgb(${rgbStr})`, - `rgba(${rgbStr},1)`, - `rgba(${rgbStr},100%)`, - `rgb(${rgbPercStr})`, - `rgba(${rgbPercStr},1)`, - `rgba(${rgbPercStr},100%)`, - `hsl(${hslStr})`, - `hsla(${hslStr},1)`, - `hsla(${hslStr},100%)`, - `hwb(${hwbStr})`, - `hwb(${hwbStr},1)`, - `hwb(${hwbStr},100%)`, - ); - - // technically, this should be 0 - but then #808080 wouldn't even be gray - if (lab[1] * lab[1] < 0.01 && lab[2] * lab[2] < 0.01) { - // yay! gray! - const grayStr = Math.round(lab[0]); - - func.push( - `gray(${grayStr})`, - `gray(${grayStr},1)`, - `gray(${grayStr},100%)`, - `gray(${grayStr}%)`, - `gray(${grayStr}%,1)`, - `gray(${grayStr}%,100%)`, - ); - } - - return func; -} - -module.exports = generateColorFuncs; diff --git a/node_modules/stylelint/lib/rules/color-named/index.js b/node_modules/stylelint/lib/rules/color-named/index.js index a5f11527b5..29a080d9a8 100644 --- a/node_modules/stylelint/lib/rules/color-named/index.js +++ b/node_modules/stylelint/lib/rules/color-named/index.js @@ -3,8 +3,6 @@ const declarationValueIndex = require('../../utils/declarationValueIndex'); const isStandardSyntaxFunction = require('../../utils/isStandardSyntaxFunction'); const isStandardSyntaxValue = require('../../utils/isStandardSyntaxValue'); -const keywordSets = require('../../reference/keywordSets'); -const namedColorDataHex = require('../../reference/namedColorData'); const optionsMatches = require('../../utils/optionsMatches'); const propertySets = require('../../reference/propertySets'); const report = require('../../utils/report'); @@ -12,8 +10,7 @@ const ruleMessages = require('../../utils/ruleMessages'); const validateOptions = require('../../utils/validateOptions'); const valueParser = require('postcss-value-parser'); const { isRegExp, isString } = require('../../utils/validateTypes'); - -const generateColorFuncs = require('./generateColorFuncs'); +const { colord } = require('./colordUtils'); const ruleName = 'color-named'; @@ -49,20 +46,6 @@ const rule = (primary, secondaryOptions) => { return; } - const namedColors = Object.keys(namedColorDataHex); - - /** @type {Record} */ - const namedColorData = {}; - - namedColors.forEach((name) => { - const hex = namedColorDataHex[name]; - - namedColorData[name] = { - hex, - func: generateColorFuncs(hex[0]), - }; - }); - root.walkDecls((decl) => { if (propertySets.acceptCustomIdents.has(decl.prop)) { return; @@ -96,7 +79,13 @@ const rule = (primary, secondaryOptions) => { } // Check for named colors for "never" option - if (primary === 'never' && type === 'word' && namedColors.includes(value.toLowerCase())) { + if ( + primary === 'never' && + type === 'word' && + /^[a-z]+$/iu.test(value) && + value.toLowerCase() !== 'transparent' && + colord(value).isValid() + ) { complain(messages.rejected(value), decl, declarationValueIndex(decl) + sourceIndex); return; @@ -107,38 +96,36 @@ const rule = (primary, secondaryOptions) => { return; } - // First by checking for alternative color function representations ... - if (type === 'function' && keywordSets.colorFunctionNames.has(value.toLowerCase())) { + let colorString = null; + + if (type === 'function') { + // First by checking for alternative color function representations ... // Remove all spaces to match what's in `representations` - const normalizedFunctionString = valueParser.stringify(node).replace(/\s+/g, ''); - - for (const namedColor of namedColors) { - if (namedColorData[namedColor].func.includes(normalizedFunctionString.toLowerCase())) { - complain( - messages.expected(namedColor, normalizedFunctionString), - decl, - declarationValueIndex(decl) + sourceIndex, - ); - - return; // Exit as soon as a problem is found - } - } - + colorString = valueParser + .stringify(node) + .replace(/\s*([,/()])\s*/g, '$1') + .replace(/\s{2,}/g, ' '); + } else if (type === 'word' && value.startsWith('#')) { + // Then by checking for alternative hex representations + colorString = value; + } else { return; } - // Then by checking for alternative hex representations + const color = colord(colorString); - for (const namedColor of namedColors) { - if (namedColorData[namedColor].hex.includes(value.toLowerCase())) { - complain( - messages.expected(namedColor, value), - decl, - declarationValueIndex(decl) + sourceIndex, - ); + if (!color.isValid()) { + return; + } - return; // Exit as soon as a problem is found - } + const namedColor = color.toName(); + + if (namedColor && namedColor.toLowerCase() !== 'transparent') { + complain( + messages.expected(namedColor, colorString), + decl, + declarationValueIndex(decl) + sourceIndex, + ); } }); }); diff --git a/node_modules/stylelint/lib/rules/color-no-invalid-hex/index.js b/node_modules/stylelint/lib/rules/color-no-invalid-hex/index.js index 94fb9a2ad1..45db19fed7 100644 --- a/node_modules/stylelint/lib/rules/color-no-invalid-hex/index.js +++ b/node_modules/stylelint/lib/rules/color-no-invalid-hex/index.js @@ -1,6 +1,7 @@ 'use strict'; const declarationValueIndex = require('../../utils/declarationValueIndex'); +const isStandardSyntaxHexColor = require('../../utils/isStandardSyntaxHexColor'); const isValidHex = require('../../utils/isValidHex'); const report = require('../../utils/report'); const ruleMessages = require('../../utils/ruleMessages'); @@ -23,6 +24,10 @@ const rule = (primary) => { } root.walkDecls((decl) => { + if (!isStandardSyntaxHexColor(decl.value)) { + return; + } + valueParser(decl.value).walk(({ value, type, sourceIndex }) => { if (type === 'function' && value.endsWith('url')) return false; diff --git a/node_modules/stylelint/lib/rules/declaration-block-no-duplicate-properties/index.js b/node_modules/stylelint/lib/rules/declaration-block-no-duplicate-properties/index.js index b6a0ae4441..b7fea7e1a4 100644 --- a/node_modules/stylelint/lib/rules/declaration-block-no-duplicate-properties/index.js +++ b/node_modules/stylelint/lib/rules/declaration-block-no-duplicate-properties/index.js @@ -8,6 +8,7 @@ const report = require('../../utils/report'); const ruleMessages = require('../../utils/ruleMessages'); const validateOptions = require('../../utils/validateOptions'); const { isString } = require('../../utils/validateTypes'); +const vendor = require('../../utils/vendor'); const ruleName = 'declaration-block-no-duplicate-properties'; @@ -25,7 +26,11 @@ const rule = (primary, secondaryOptions) => { { actual: secondaryOptions, possible: { - ignore: ['consecutive-duplicates', 'consecutive-duplicates-with-different-values'], + ignore: [ + 'consecutive-duplicates', + 'consecutive-duplicates-with-different-values', + 'consecutive-duplicates-with-same-prefixless-values', + ], ignoreProperties: [isString], }, optional: true, @@ -36,6 +41,18 @@ const rule = (primary, secondaryOptions) => { return; } + const ignoreDuplicates = optionsMatches(secondaryOptions, 'ignore', 'consecutive-duplicates'); + const ignoreDiffValues = optionsMatches( + secondaryOptions, + 'ignore', + 'consecutive-duplicates-with-different-values', + ); + const ignorePrefixlessSameValues = optionsMatches( + secondaryOptions, + 'ignore', + 'consecutive-duplicates-with-same-prefixless-values', + ); + eachDeclarationBlock(root, (eachDecl) => { /** @type {string[]} */ const decls = []; @@ -67,14 +84,8 @@ const rule = (primary, secondaryOptions) => { const indexDuplicate = decls.indexOf(prop.toLowerCase()); if (indexDuplicate !== -1) { - if ( - optionsMatches( - secondaryOptions, - 'ignore', - 'consecutive-duplicates-with-different-values', - ) - ) { - // if duplicates are not consecutive + if (ignoreDiffValues || ignorePrefixlessSameValues) { + // fails if duplicates are not consecutive if (indexDuplicate !== decls.length - 1) { report({ message: messages.rejected(prop), @@ -86,10 +97,26 @@ const rule = (primary, secondaryOptions) => { return; } - // if values of consecutive duplicates are equal - if (value === values[indexDuplicate]) { + const duplicateValue = values[indexDuplicate]; + + if (ignorePrefixlessSameValues) { + // fails if values of consecutive, unprefixed duplicates are equal + if (vendor.unprefixed(value) !== vendor.unprefixed(duplicateValue)) { + report({ + message: messages.rejected(prop), + node: decl, + result, + ruleName, + }); + + return; + } + } + + // fails if values of consecutive duplicates are equal + if (value === duplicateValue) { report({ - message: messages.rejected(value), + message: messages.rejected(prop), node: decl, result, ruleName, @@ -101,10 +128,7 @@ const rule = (primary, secondaryOptions) => { return; } - if ( - optionsMatches(secondaryOptions, 'ignore', 'consecutive-duplicates') && - indexDuplicate === decls.length - 1 - ) { + if (ignoreDuplicates && indexDuplicate === decls.length - 1) { return; } diff --git a/node_modules/stylelint/lib/rules/declaration-block-no-redundant-longhand-properties/index.js b/node_modules/stylelint/lib/rules/declaration-block-no-redundant-longhand-properties/index.js index 2a1a359cc9..ca23ae667c 100644 --- a/node_modules/stylelint/lib/rules/declaration-block-no-redundant-longhand-properties/index.js +++ b/node_modules/stylelint/lib/rules/declaration-block-no-redundant-longhand-properties/index.js @@ -42,9 +42,9 @@ const rule = (primary, secondaryOptions) => { return longhandProps; } - values.forEach((value) => { + for (const value of values) { (longhandProps[value] || (longhandProps[value] = [])).push(key); - }); + } return longhandProps; }, @@ -66,7 +66,7 @@ const rule = (primary, secondaryOptions) => { return; } - shorthandProperties.forEach((shorthandProperty) => { + for (const shorthandProperty of shorthandProperties) { const prefixedShorthandProperty = prefix + shorthandProperty; if (!longhandDeclarations[prefixedShorthandProperty]) { @@ -85,7 +85,7 @@ const rule = (primary, secondaryOptions) => { longhandDeclarations[prefixedShorthandProperty].sort(), ) ) { - return; + continue; } report({ @@ -94,7 +94,7 @@ const rule = (primary, secondaryOptions) => { node: decl, message: messages.expected(prefixedShorthandProperty), }); - }); + } }); }); }; diff --git a/node_modules/stylelint/lib/rules/declaration-block-no-shorthand-property-overrides/index.js b/node_modules/stylelint/lib/rules/declaration-block-no-shorthand-property-overrides/index.js index bf27f2463b..1c5a8d2564 100644 --- a/node_modules/stylelint/lib/rules/declaration-block-no-shorthand-property-overrides/index.js +++ b/node_modules/stylelint/lib/rules/declaration-block-no-shorthand-property-overrides/index.js @@ -39,9 +39,9 @@ const rule = (primary) => { return; } - overrideables.forEach((longhandProp) => { + for (const longhandProp of overrideables) { if (!Object.prototype.hasOwnProperty.call(declarations, prefix + longhandProp)) { - return; + continue; } report({ @@ -50,7 +50,7 @@ const rule = (primary) => { node: decl, message: messages.rejected(prop, declarations[prefix + longhandProp]), }); - }); + } }); }); }; diff --git a/node_modules/stylelint/lib/rules/declaration-empty-line-before/index.js b/node_modules/stylelint/lib/rules/declaration-empty-line-before/index.js index 43e971c8e9..30e117584c 100644 --- a/node_modules/stylelint/lib/rules/declaration-empty-line-before/index.js +++ b/node_modules/stylelint/lib/rules/declaration-empty-line-before/index.js @@ -15,7 +15,7 @@ const removeEmptyLinesBefore = require('../../utils/removeEmptyLinesBefore'); const report = require('../../utils/report'); const ruleMessages = require('../../utils/ruleMessages'); const validateOptions = require('../../utils/validateOptions'); -const { isAtRule, isRule } = require('../../utils/typeGuards'); +const { isAtRule, isRule, isRoot } = require('../../utils/typeGuards'); const ruleName = 'declaration-empty-line-before'; @@ -66,7 +66,7 @@ const rule = (primary, secondaryOptions, context) => { return; } - if (!isAtRule(parent) && !isRule(parent)) { + if (!isAtRule(parent) && !isRule(parent) && !isRoot(parent)) { return; } diff --git a/node_modules/stylelint/lib/rules/font-family-name-quotes/index.js b/node_modules/stylelint/lib/rules/font-family-name-quotes/index.js index 9e507908e6..172c6bba20 100644 --- a/node_modules/stylelint/lib/rules/font-family-name-quotes/index.js +++ b/node_modules/stylelint/lib/rules/font-family-name-quotes/index.js @@ -75,7 +75,7 @@ const rule = (primary) => { return; } - fontFamilies.forEach((fontFamilyNode) => { + for (const fontFamilyNode of fontFamilies) { let rawFamily = fontFamilyNode.value; if ('quote' in fontFamilyNode) { @@ -83,7 +83,7 @@ const rule = (primary) => { } checkFamilyName(rawFamily, decl); - }); + } }); /** diff --git a/node_modules/stylelint/lib/rules/font-family-no-duplicate-names/index.js b/node_modules/stylelint/lib/rules/font-family-no-duplicate-names/index.js index 4e8b1af87b..b045566581 100644 --- a/node_modules/stylelint/lib/rules/font-family-no-duplicate-names/index.js +++ b/node_modules/stylelint/lib/rules/font-family-no-duplicate-names/index.js @@ -51,11 +51,11 @@ const rule = (primary, secondaryOptions) => { return; } - fontFamilies.forEach((fontFamilyNode) => { + for (const fontFamilyNode of fontFamilies) { const family = fontFamilyNode.value.trim(); if (optionsMatches(secondaryOptions, 'ignoreFontFamilyNames', family)) { - return; + continue; } if (isFamilyNameKeyword(fontFamilyNode)) { @@ -66,12 +66,12 @@ const rule = (primary, secondaryOptions) => { decl, ); - return; + continue; } keywords.add(family); - return; + continue; } if (familyNames.has(family)) { @@ -81,11 +81,11 @@ const rule = (primary, secondaryOptions) => { decl, ); - return; + continue; } familyNames.add(family); - }); + } }); /** diff --git a/node_modules/stylelint/lib/rules/font-family-no-missing-generic-family-keyword/index.js b/node_modules/stylelint/lib/rules/font-family-no-missing-generic-family-keyword/index.js index 02ddfe8a45..2066bd4b8c 100644 --- a/node_modules/stylelint/lib/rules/font-family-no-missing-generic-family-keyword/index.js +++ b/node_modules/stylelint/lib/rules/font-family-no-missing-generic-family-keyword/index.js @@ -78,7 +78,7 @@ const rule = (primary, secondaryOptions) => { return; } - if (fontFamilies.some(isFamilyNameKeyword)) { + if (fontFamilies.some((node) => isFamilyNameKeyword(node))) { return; } diff --git a/node_modules/stylelint/lib/rules/font-weight-notation/index.js b/node_modules/stylelint/lib/rules/font-weight-notation/index.js index c741f4db56..55c5206adf 100644 --- a/node_modules/stylelint/lib/rules/font-weight-notation/index.js +++ b/node_modules/stylelint/lib/rules/font-weight-notation/index.js @@ -65,7 +65,7 @@ const rule = (primary, secondaryOptions) => { // We do not need to more carefully distinguish font-weight // numbers from unitless line-heights because line-heights in // `font` values need to be part of a font-size/line-height pair - const hasNumericFontWeight = valueList.some(isNumbery); + const hasNumericFontWeight = valueList.some((value) => isNumbery(value)); for (const value of postcss.list.space(decl.value)) { if ( @@ -116,7 +116,7 @@ const rule = (primary, secondaryOptions) => { if (parent && isAtRule(parent) && parent.name.toLowerCase() === 'font-face') { const weightValueNumbers = postcss.list.space(weightValue); - if (!weightValueNumbers.every(isNumbery)) { + if (!weightValueNumbers.every((value) => isNumbery(value))) { return complain(messages.expected('numeric')); } diff --git a/node_modules/stylelint/lib/rules/function-calc-no-unspaced-operator/index.js b/node_modules/stylelint/lib/rules/function-calc-no-unspaced-operator/index.js index d902154c8a..0bfeee30f1 100644 --- a/node_modules/stylelint/lib/rules/function-calc-no-unspaced-operator/index.js +++ b/node_modules/stylelint/lib/rules/function-calc-no-unspaced-operator/index.js @@ -237,11 +237,9 @@ const rule = (primary, _secondaryOptions, context) => { * @param {import('postcss-value-parser').Node[]} nodes */ function checkWords(nodes) { - if (checkForOperatorInFirstNode(nodes)) return; + if (checkForOperatorInFirstNode(nodes) || checkForOperatorInLastNode(nodes)) return; - if (checkForOperatorInLastNode(nodes)) return; - - nodes.forEach((node, index) => { + for (const [index, node] of nodes.entries()) { const lastChar = node.value.slice(-1); const firstChar = node.value.slice(0, 1); @@ -250,7 +248,7 @@ const rule = (primary, _secondaryOptions, context) => { if (context.fix) { node.value = `${node.value.slice(0, -1)} ${lastChar}`; - return; + continue; } complain(messages.expectedBefore(lastChar), decl, node.sourceIndex); @@ -258,13 +256,13 @@ const rule = (primary, _secondaryOptions, context) => { if (context.fix) { node.value = `${firstChar} ${node.value.slice(1)}`; - return; + continue; } complain(messages.expectedOperatorBeforeSign(firstChar), decl, node.sourceIndex); } } - }); + } } parsedValue.walk((node) => { diff --git a/node_modules/stylelint/lib/rules/function-name-case/index.js b/node_modules/stylelint/lib/rules/function-name-case/index.js index e446046411..69716b6ab5 100644 --- a/node_modules/stylelint/lib/rules/function-name-case/index.js +++ b/node_modules/stylelint/lib/rules/function-name-case/index.js @@ -20,9 +20,9 @@ const messages = ruleMessages(ruleName, { const mapLowercaseFunctionNamesToCamelCase = new Map(); -keywordSets.camelCaseFunctionNames.forEach((func) => { +for (const func of keywordSets.camelCaseFunctionNames) { mapLowercaseFunctionNamesToCamelCase.set(func.toLowerCase(), func); -}); +} /** @type {import('stylelint').Rule} */ const rule = (primary, secondaryOptions, context) => { diff --git a/node_modules/stylelint/lib/rules/functionCommaSpaceChecker.js b/node_modules/stylelint/lib/rules/functionCommaSpaceChecker.js index 2d88c47e29..b64857b3fc 100644 --- a/node_modules/stylelint/lib/rules/functionCommaSpaceChecker.js +++ b/node_modules/stylelint/lib/rules/functionCommaSpaceChecker.js @@ -74,9 +74,9 @@ module.exports = function functionCommaSpaceChecker(opts) { /** @type {{ commaNode: ValueParserDivNode, checkIndex: number, nodeIndex: number }[]} */ const commaDataList = []; - valueNode.nodes.forEach((node, nodeIndex) => { + for (const [nodeIndex, node] of valueNode.nodes.entries()) { if (node.type !== 'div' || node.value !== ',') { - return; + continue; } const checkIndex = getCommaCheckIndex(node, nodeIndex); @@ -86,7 +86,7 @@ module.exports = function functionCommaSpaceChecker(opts) { checkIndex, nodeIndex, }); - }); + } for (const { commaNode, checkIndex, nodeIndex } of commaDataList) { opts.locationChecker({ diff --git a/node_modules/stylelint/lib/rules/indentation/index.js b/node_modules/stylelint/lib/rules/indentation/index.js index f5d7d4af6c..d77de82ecd 100644 --- a/node_modules/stylelint/lib/rules/indentation/index.js +++ b/node_modules/stylelint/lib/rules/indentation/index.js @@ -93,7 +93,9 @@ const rule = (primary, secondaryOptions = {}, context) => { // it is some other kind of separation, checked by some separate rule if ( (lastIndexOfNewline !== -1 || - (isFirstChild && (!getDocument(parent) || parent.raws.beforeStart.endsWith('\n')))) && + (isFirstChild && + (!getDocument(parent) || + (parent.raws.codeBefore && parent.raws.codeBefore.endsWith('\n'))))) && before.slice(lastIndexOfNewline + 1) !== expectedOpeningBraceIndentation ) { if (context.fix) { @@ -388,14 +390,14 @@ const rule = (primary, secondaryOptions = {}, context) => { if (fixPositions.length) { if (isRule(node)) { - fixPositions.forEach((fixPosition) => { + for (const fixPosition of fixPositions) { node.selector = replaceIndentation( node.selector, fixPosition.currentIndentation, fixPosition.expectedIndentation, fixPosition.startIndex, ); - }); + } } if (isDeclaration(node)) { @@ -406,7 +408,7 @@ const rule = (primary, secondaryOptions = {}, context) => { throw new TypeError('The `between` property must be a string'); } - fixPositions.forEach((fixPosition) => { + for (const fixPosition of fixPositions) { if (fixPosition.startIndex < declProp.length + declBetween.length) { node.raws.between = replaceIndentation( declBetween, @@ -422,7 +424,7 @@ const rule = (primary, secondaryOptions = {}, context) => { fixPosition.startIndex - declProp.length - declBetween.length, ); } - }); + } } if (isAtRule(node)) { @@ -434,7 +436,7 @@ const rule = (primary, secondaryOptions = {}, context) => { throw new TypeError('The `afterName` property must be a string'); } - fixPositions.forEach((fixPosition) => { + for (const fixPosition of fixPositions) { // 1 — it's a @ length if (fixPosition.startIndex < 1 + atRuleName.length + atRuleAfterName.length) { node.raws.afterName = replaceIndentation( @@ -451,7 +453,7 @@ const rule = (primary, secondaryOptions = {}, context) => { fixPosition.startIndex - atRuleName.length - atRuleAfterName.length - 1, ); } - }); + } } } } @@ -559,9 +561,9 @@ function inferDocIndentSize(document, space) { lastLeadingSpacesLength = leadingSpacesLength; }; - indents.forEach((leadingSpaces) => { + for (const leadingSpaces of indents) { vote(leadingSpaces.length); - }); + } let bestScore = 0; @@ -607,7 +609,7 @@ function inferRootIndentLevel(root, baseIndentLevel, indentSize) { let source = root.source.input.css; source = source.replace(/^[^\r\n]+/, (firstLine) => { - const match = /(?:^|\n)([ \t]*)$/.exec(root.raws.beforeStart); + const match = root.raws.codeBefore && /(?:^|\n)([ \t]*)$/.exec(root.raws.codeBefore); if (match) { return match[1] + firstLine; @@ -619,7 +621,7 @@ function inferRootIndentLevel(root, baseIndentLevel, indentSize) { const indents = source.match(/^[ \t]*(?=\S)/gm); if (indents) { - return Math.min(...indents.map(getIndentLevel)); + return Math.min(...indents.map((indent) => getIndentLevel(indent))); } newBaseIndentLevel = 1; @@ -628,7 +630,7 @@ function inferRootIndentLevel(root, baseIndentLevel, indentSize) { } const indents = []; - const foundIndents = /(?:^|\n)([ \t]*)\S/m.exec(root.raws.beforeStart); + const foundIndents = root.raws.codeBefore && /(?:^|\n)([ \t]*)\S/m.exec(root.raws.codeBefore); // The indent level of the CSS code block in non-CSS-like files is determined by the shortest indent of non-empty line. if (foundIndents) { @@ -664,7 +666,7 @@ function inferRootIndentLevel(root, baseIndentLevel, indentSize) { if (document) { const nextRoot = document.nodes[document.nodes.indexOf(root) + 1]; - afterEnd = nextRoot ? nextRoot.raws.beforeStart : document.raws.afterEnd; + afterEnd = nextRoot ? nextRoot.raws.codeBefore : document.raws.codeAfter; } else { // Nested root node in css-in-js lang const parent = root.parent; @@ -673,17 +675,17 @@ function inferRootIndentLevel(root, baseIndentLevel, indentSize) { const nextRoot = parent.nodes[parent.nodes.indexOf(root) + 1]; - afterEnd = nextRoot ? nextRoot.raws.beforeStart : root.raws.afterEnd; + afterEnd = nextRoot ? nextRoot.raws.codeBefore : root.raws.codeAfter; } } else { afterEnd = after; } - indents.push(afterEnd.match(/^[ \t]*/)[0]); + if (afterEnd) indents.push(afterEnd.match(/^[ \t]*/)[0]); } if (indents.length) { - return Math.max(...indents.map(getIndentLevel)) + newBaseIndentLevel; + return Math.max(...indents.map((indent) => getIndentLevel(indent))) + newBaseIndentLevel; } return newBaseIndentLevel; diff --git a/node_modules/stylelint/lib/rules/index.js b/node_modules/stylelint/lib/rules/index.js index 1a5cb09e28..2295815ebc 100644 --- a/node_modules/stylelint/lib/rules/index.js +++ b/node_modules/stylelint/lib/rules/index.js @@ -235,6 +235,9 @@ const rules = { 'property-no-unknown': importLazy(() => require('./property-no-unknown'))(), 'property-no-vendor-prefix': importLazy(() => require('./property-no-vendor-prefix'))(), 'rule-empty-line-before': importLazy(() => require('./rule-empty-line-before'))(), + 'rule-selector-property-disallowed-list': importLazy(() => + require('./rule-selector-property-disallowed-list'), + )(), 'selector-attribute-brackets-space-inside': importLazy(() => require('./selector-attribute-brackets-space-inside'), )(), diff --git a/node_modules/stylelint/lib/rules/max-empty-lines/index.js b/node_modules/stylelint/lib/rules/max-empty-lines/index.js index 6b37108f09..8d00993d2f 100644 --- a/node_modules/stylelint/lib/rules/max-empty-lines/index.js +++ b/node_modules/stylelint/lib/rules/max-empty-lines/index.js @@ -195,15 +195,15 @@ function isEofNode(document, root) { // @ts-expect-error -- TS2367: This condition will always return 'false' since the types 'Root' and 'ChildNode | undefined' have no overlap. if (root === document.last) { - after = document.raws && document.raws.afterEnd; + after = document.raws && document.raws.codeAfter; } else { // @ts-expect-error -- TS2345: Argument of type 'Root' is not assignable to parameter of type 'number | ChildNode'. const rootIndex = document.index(root); const nextNode = document.nodes[rootIndex + 1]; - // @ts-expect-error -- TS2339: Property 'beforeStart' does not exist on type 'AtRuleRaws | RuleRaws | DeclarationRaws | CommentRaws'. - after = nextNode && nextNode.raws && nextNode.raws.beforeStart; + // @ts-expect-error -- TS2339: Property 'codeBefore' does not exist on type 'CommentRaws'. + after = nextNode && nextNode.raws && nextNode.raws.codeBefore; } return !String(after).trim(); diff --git a/node_modules/stylelint/lib/rules/max-line-length/index.js b/node_modules/stylelint/lib/rules/max-line-length/index.js index ea22b10af3..2b6e3d8925 100644 --- a/node_modules/stylelint/lib/rules/max-line-length/index.js +++ b/node_modules/stylelint/lib/rules/max-line-length/index.js @@ -55,14 +55,14 @@ const rule = (primary, secondaryOptions, context) => { let skippedSubStrings = []; let skippedSubStringsIndex = 0; - EXCLUDED_PATTERNS.forEach((pattern) => - execall(pattern, rootString).forEach((match) => { + for (const pattern of EXCLUDED_PATTERNS) + for (const match of execall(pattern, rootString)) { const subMatch = match.subMatches[0] || ''; const startOfSubString = match.index + match.match.indexOf(subMatch); - return skippedSubStrings.push([startOfSubString, startOfSubString + subMatch.length]); - }), - ); + skippedSubStrings.push([startOfSubString, startOfSubString + subMatch.length]); + continue; + } skippedSubStrings = skippedSubStrings.sort((a, b) => a[0] - b[0]); diff --git a/node_modules/stylelint/lib/rules/max-nesting-depth/index.js b/node_modules/stylelint/lib/rules/max-nesting-depth/index.js index 0670c9aafa..63f94ea390 100644 --- a/node_modules/stylelint/lib/rules/max-nesting-depth/index.js +++ b/node_modules/stylelint/lib/rules/max-nesting-depth/index.js @@ -25,7 +25,7 @@ const rule = (primary, secondaryOptions) => { isAtRule(node) && optionsMatches(secondaryOptions, 'ignoreAtRules', node.name); return (root, result) => { - validateOptions( + const validOptions = validateOptions( result, ruleName, { @@ -38,10 +38,13 @@ const rule = (primary, secondaryOptions) => { possible: { ignore: ['blockless-at-rules', 'pseudo-classes'], ignoreAtRules: [isString, isRegExp], + ignorePseudoClasses: [isString, isRegExp], }, }, ); + if (!validOptions) return; + root.walkRules(checkStatement); root.walkAtRules(checkStatement); @@ -105,7 +108,23 @@ const rule = (primary, secondaryOptions) => { const normalized = parser().processSync(selector, { lossless: false }); const selectors = normalized.split(','); - return selectors.every((sel) => sel.startsWith('&:') && sel[2] !== ':'); + return selectors.every((sel) => extractPseudoRule(sel)); + } + + /** + * @param {string[]} selectors + * @returns {boolean} + */ + function containsIgnoredPseudoClassesOnly(selectors) { + if (!(secondaryOptions && secondaryOptions.ignorePseudoClasses)) return false; + + return selectors.every((selector) => { + const pseudoRule = extractPseudoRule(selector); + + if (!pseudoRule) return false; + + return optionsMatches(secondaryOptions, 'ignorePseudoClasses', pseudoRule); + }); } if ( @@ -114,7 +133,8 @@ const rule = (primary, secondaryOptions) => { node.every((child) => !isDeclaration(child))) || (optionsMatches(secondaryOptions, 'ignore', 'pseudo-classes') && isRule(node) && - containsPseudoClassesOnly(node.selector)) + containsPseudoClassesOnly(node.selector)) || + (isRule(node) && containsIgnoredPseudoClassesOnly(node.selectors)) ) { return nestingDepth(parent, level); } @@ -127,6 +147,14 @@ const rule = (primary, secondaryOptions) => { } }; +/** + * @param {string} selector + * @returns {string | undefined} + */ +function extractPseudoRule(selector) { + return selector.startsWith('&:') && selector[2] !== ':' ? selector.substr(2) : undefined; +} + rule.ruleName = ruleName; rule.messages = messages; module.exports = rule; diff --git a/node_modules/stylelint/lib/rules/media-feature-colon-space-after/index.js b/node_modules/stylelint/lib/rules/media-feature-colon-space-after/index.js index 987f1e0149..6ebec0dc46 100644 --- a/node_modules/stylelint/lib/rules/media-feature-colon-space-after/index.js +++ b/node_modules/stylelint/lib/rules/media-feature-colon-space-after/index.js @@ -51,28 +51,26 @@ const rule = (primary, _secondaryOptions, context) => { }); if (fixData) { - fixData.forEach((colonIndices, atRule) => { + for (const [atRule, colonIndices] of fixData.entries()) { let params = atRule.raws.params ? atRule.raws.params.raw : atRule.params; - colonIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeColon = params.slice(0, index + 1); - const afterColon = params.slice(index + 1); + for (const index of colonIndices.sort((a, b) => b - a)) { + const beforeColon = params.slice(0, index + 1); + const afterColon = params.slice(index + 1); - if (primary === 'always') { - params = beforeColon + afterColon.replace(/^\s*/, ' '); - } else if (primary === 'never') { - params = beforeColon + afterColon.replace(/^\s*/, ''); - } - }); + if (primary === 'always') { + params = beforeColon + afterColon.replace(/^\s*/, ' '); + } else if (primary === 'never') { + params = beforeColon + afterColon.replace(/^\s*/, ''); + } + } if (atRule.raws.params) { atRule.raws.params.raw = params; } else { atRule.params = params; } - }); + } } }; }; diff --git a/node_modules/stylelint/lib/rules/media-feature-colon-space-before/index.js b/node_modules/stylelint/lib/rules/media-feature-colon-space-before/index.js index ea7f5dde36..f7fadea78a 100644 --- a/node_modules/stylelint/lib/rules/media-feature-colon-space-before/index.js +++ b/node_modules/stylelint/lib/rules/media-feature-colon-space-before/index.js @@ -51,28 +51,26 @@ const rule = (primary, _secondaryOptions, context) => { }); if (fixData) { - fixData.forEach((colonIndices, atRule) => { + for (const [atRule, colonIndices] of fixData.entries()) { let params = atRule.raws.params ? atRule.raws.params.raw : atRule.params; - colonIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeColon = params.slice(0, index); - const afterColon = params.slice(index); + for (const index of colonIndices.sort((a, b) => b - a)) { + const beforeColon = params.slice(0, index); + const afterColon = params.slice(index); - if (primary === 'always') { - params = beforeColon.replace(/\s*$/, ' ') + afterColon; - } else if (primary === 'never') { - params = beforeColon.replace(/\s*$/, '') + afterColon; - } - }); + if (primary === 'always') { + params = beforeColon.replace(/\s*$/, ' ') + afterColon; + } else if (primary === 'never') { + params = beforeColon.replace(/\s*$/, '') + afterColon; + } + } if (atRule.raws.params) { atRule.raws.params.raw = params; } else { atRule.params = params; } - }); + } } }; }; diff --git a/node_modules/stylelint/lib/rules/media-feature-name-no-vendor-prefix/index.js b/node_modules/stylelint/lib/rules/media-feature-name-no-vendor-prefix/index.js index 9a4fe60aa1..f3f031aa75 100644 --- a/node_modules/stylelint/lib/rules/media-feature-name-no-vendor-prefix/index.js +++ b/node_modules/stylelint/lib/rules/media-feature-name-no-vendor-prefix/index.js @@ -39,7 +39,7 @@ const rule = (primary, _secondaryOptions, context) => { return; } - matches.forEach((match) => { + for (const match of matches) { report({ message: messages.rejected, node: atRule, @@ -47,7 +47,7 @@ const rule = (primary, _secondaryOptions, context) => { result, ruleName, }); - }); + } }); }; }; diff --git a/node_modules/stylelint/lib/rules/media-feature-parentheses-space-inside/index.js b/node_modules/stylelint/lib/rules/media-feature-parentheses-space-inside/index.js index 0719befad9..55d56ab0b1 100644 --- a/node_modules/stylelint/lib/rules/media-feature-parentheses-space-inside/index.js +++ b/node_modules/stylelint/lib/rules/media-feature-parentheses-space-inside/index.js @@ -86,7 +86,7 @@ const rule = (primary, _secondaryOptions, context) => { return; } - problems.forEach((err) => { + for (const err of problems) { report({ message: err.message, node: atRule, @@ -94,7 +94,7 @@ const rule = (primary, _secondaryOptions, context) => { result, ruleName, }); - }); + } } }); }; diff --git a/node_modules/stylelint/lib/rules/media-feature-range-operator-space-after/index.js b/node_modules/stylelint/lib/rules/media-feature-range-operator-space-after/index.js index 16036d6662..0d57f31b56 100644 --- a/node_modules/stylelint/lib/rules/media-feature-range-operator-space-after/index.js +++ b/node_modules/stylelint/lib/rules/media-feature-range-operator-space-after/index.js @@ -41,18 +41,16 @@ const rule = (primary, _secondaryOptions, context) => { if (fixOperatorIndices.length) { let params = atRule.raws.params ? atRule.raws.params.raw : atRule.params; - fixOperatorIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeOperator = params.slice(0, index + 1); - const afterOperator = params.slice(index + 1); + for (const index of fixOperatorIndices.sort((a, b) => b - a)) { + const beforeOperator = params.slice(0, index + 1); + const afterOperator = params.slice(index + 1); - if (primary === 'always') { - params = beforeOperator + afterOperator.replace(/^\s*/, ' '); - } else if (primary === 'never') { - params = beforeOperator + afterOperator.replace(/^\s*/, ''); - } - }); + if (primary === 'always') { + params = beforeOperator + afterOperator.replace(/^\s*/, ' '); + } else if (primary === 'never') { + params = beforeOperator + afterOperator.replace(/^\s*/, ''); + } + } if (atRule.raws.params) { atRule.raws.params.raw = params; diff --git a/node_modules/stylelint/lib/rules/media-feature-range-operator-space-before/index.js b/node_modules/stylelint/lib/rules/media-feature-range-operator-space-before/index.js index 2a2a5f6b91..8915f504c8 100644 --- a/node_modules/stylelint/lib/rules/media-feature-range-operator-space-before/index.js +++ b/node_modules/stylelint/lib/rules/media-feature-range-operator-space-before/index.js @@ -41,18 +41,16 @@ const rule = (primary, _secondaryOptions, context) => { if (fixOperatorIndices.length) { let params = atRule.raws.params ? atRule.raws.params.raw : atRule.params; - fixOperatorIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeOperator = params.slice(0, index); - const afterOperator = params.slice(index); + for (const index of fixOperatorIndices.sort((a, b) => b - a)) { + const beforeOperator = params.slice(0, index); + const afterOperator = params.slice(index); - if (primary === 'always') { - params = beforeOperator.replace(/\s*$/, ' ') + afterOperator; - } else if (primary === 'never') { - params = beforeOperator.replace(/\s*$/, '') + afterOperator; - } - }); + if (primary === 'always') { + params = beforeOperator.replace(/\s*$/, ' ') + afterOperator; + } else if (primary === 'never') { + params = beforeOperator.replace(/\s*$/, '') + afterOperator; + } + } if (atRule.raws.params) { atRule.raws.params.raw = params; diff --git a/node_modules/stylelint/lib/rules/media-query-list-comma-newline-after/index.js b/node_modules/stylelint/lib/rules/media-query-list-comma-newline-after/index.js index 01c627d3c4..6747578121 100644 --- a/node_modules/stylelint/lib/rules/media-query-list-comma-newline-after/index.js +++ b/node_modules/stylelint/lib/rules/media-query-list-comma-newline-after/index.js @@ -55,30 +55,28 @@ const rule = (primary, _secondaryOptions, context) => { }); if (fixData) { - fixData.forEach((commaIndices, atRule) => { + for (const [atRule, commaIndices] of fixData.entries()) { let params = atRule.raws.params ? atRule.raws.params.raw : atRule.params; - commaIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeComma = params.slice(0, index + 1); - const afterComma = params.slice(index + 1); + for (const index of commaIndices.sort((a, b) => b - a)) { + const beforeComma = params.slice(0, index + 1); + const afterComma = params.slice(index + 1); - if (primary.startsWith('always')) { - params = /^\s*\n/.test(afterComma) - ? beforeComma + afterComma.replace(/^[^\S\r\n]*/, '') - : beforeComma + context.newline + afterComma; - } else if (primary.startsWith('never')) { - params = beforeComma + afterComma.replace(/^\s*/, ''); - } - }); + if (primary.startsWith('always')) { + params = /^\s*\n/.test(afterComma) + ? beforeComma + afterComma.replace(/^[^\S\r\n]*/, '') + : beforeComma + context.newline + afterComma; + } else if (primary.startsWith('never')) { + params = beforeComma + afterComma.replace(/^\s*/, ''); + } + } if (atRule.raws.params) { atRule.raws.params.raw = params; } else { atRule.params = params; } - }); + } } }; }; diff --git a/node_modules/stylelint/lib/rules/media-query-list-comma-space-after/index.js b/node_modules/stylelint/lib/rules/media-query-list-comma-space-after/index.js index 94d82632f4..3ab9bffb2a 100644 --- a/node_modules/stylelint/lib/rules/media-query-list-comma-space-after/index.js +++ b/node_modules/stylelint/lib/rules/media-query-list-comma-space-after/index.js @@ -53,28 +53,26 @@ const rule = (primary, _secondaryOptions, context) => { }); if (fixData) { - fixData.forEach((commaIndices, atRule) => { + for (const [atRule, commaIndices] of fixData.entries()) { let params = atRule.raws.params ? atRule.raws.params.raw : atRule.params; - commaIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeComma = params.slice(0, index + 1); - const afterComma = params.slice(index + 1); + for (const index of commaIndices.sort((a, b) => b - a)) { + const beforeComma = params.slice(0, index + 1); + const afterComma = params.slice(index + 1); - if (primary.startsWith('always')) { - params = beforeComma + afterComma.replace(/^\s*/, ' '); - } else if (primary.startsWith('never')) { - params = beforeComma + afterComma.replace(/^\s*/, ''); - } - }); + if (primary.startsWith('always')) { + params = beforeComma + afterComma.replace(/^\s*/, ' '); + } else if (primary.startsWith('never')) { + params = beforeComma + afterComma.replace(/^\s*/, ''); + } + } if (atRule.raws.params) { atRule.raws.params.raw = params; } else { atRule.params = params; } - }); + } } }; }; diff --git a/node_modules/stylelint/lib/rules/media-query-list-comma-space-before/index.js b/node_modules/stylelint/lib/rules/media-query-list-comma-space-before/index.js index 04697cffaf..d0e879a7f4 100644 --- a/node_modules/stylelint/lib/rules/media-query-list-comma-space-before/index.js +++ b/node_modules/stylelint/lib/rules/media-query-list-comma-space-before/index.js @@ -53,28 +53,26 @@ const rule = (primary, _secondaryOptions, context) => { }); if (fixData) { - fixData.forEach((commaIndices, atRule) => { + for (const [atRule, commaIndices] of fixData.entries()) { let params = atRule.raws.params ? atRule.raws.params.raw : atRule.params; - commaIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeComma = params.slice(0, index); - const afterComma = params.slice(index); + for (const index of commaIndices.sort((a, b) => b - a)) { + const beforeComma = params.slice(0, index); + const afterComma = params.slice(index); - if (primary.startsWith('always')) { - params = beforeComma.replace(/\s*$/, ' ') + afterComma; - } else if (primary.startsWith('never')) { - params = beforeComma.replace(/\s*$/, '') + afterComma; - } - }); + if (primary.startsWith('always')) { + params = beforeComma.replace(/\s*$/, ' ') + afterComma; + } else if (primary.startsWith('never')) { + params = beforeComma.replace(/\s*$/, '') + afterComma; + } + } if (atRule.raws.params) { atRule.raws.params.raw = params; } else { atRule.params = params; } - }); + } } }; }; diff --git a/node_modules/stylelint/lib/rules/named-grid-areas-no-invalid/index.js b/node_modules/stylelint/lib/rules/named-grid-areas-no-invalid/index.js index 4e9bd08f8b..ada7a07682 100644 --- a/node_modules/stylelint/lib/rules/named-grid-areas-no-invalid/index.js +++ b/node_modules/stylelint/lib/rules/named-grid-areas-no-invalid/index.js @@ -62,9 +62,9 @@ const rule = (primary) => { const notContiguousOrRectangular = findNotContiguousOrRectangular(areas); - notContiguousOrRectangular.sort().forEach((name) => { + for (const name of notContiguousOrRectangular.sort()) { complain(messages.expectedRectangle(name)); - }); + } /** * @param {string} message diff --git a/node_modules/stylelint/lib/rules/no-descending-specificity/index.js b/node_modules/stylelint/lib/rules/no-descending-specificity/index.js index 75eb28534d..519432a6b9 100644 --- a/node_modules/stylelint/lib/rules/no-descending-specificity/index.js +++ b/node_modules/stylelint/lib/rules/no-descending-specificity/index.js @@ -62,19 +62,19 @@ const rule = (primary, secondaryOptions) => { findAtRuleContext(ruleNode), ); - ruleNode.selectors.forEach((selector) => { + for (const selector of ruleNode.selectors) { const trimSelector = selector.trim(); // Ignore `.selector, { }` if (trimSelector === '') { - return; + continue; } // The edge-case of duplicate selectors will act acceptably const index = ruleNode.selector.indexOf(trimSelector); // Resolve any nested selectors before checking - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { parseSelector(resolvedSelector, result, ruleNode, (s) => { if (!isStandardSyntaxSelector(resolvedSelector)) { return; @@ -82,8 +82,8 @@ const rule = (primary, secondaryOptions) => { checkSelector(s, ruleNode, index, comparisonContext); }); - }); - }); + } + } }); /** @@ -107,7 +107,7 @@ const rule = (primary, secondaryOptions) => { /** @type {Array<{ selector: string, specificity: import('specificity').SpecificityArray }>} */ const priorComparableSelectors = comparisonContext.get(referenceSelectorNode); - priorComparableSelectors.forEach((priorEntry) => { + for (const priorEntry of priorComparableSelectors) { if (specificity.compare(selectorSpecificity, priorEntry.specificity) === -1) { report({ ruleName, @@ -117,7 +117,7 @@ const rule = (primary, secondaryOptions) => { index: sourceIndex, }); } - }); + } priorComparableSelectors.push(entry); } diff --git a/node_modules/stylelint/lib/rules/no-duplicate-selectors/index.js b/node_modules/stylelint/lib/rules/no-duplicate-selectors/index.js index 6bdf52d0d4..78a117e090 100644 --- a/node_modules/stylelint/lib/rules/no-duplicate-selectors/index.js +++ b/node_modules/stylelint/lib/rules/no-duplicate-selectors/index.js @@ -60,7 +60,9 @@ const rule = (primary, secondaryOptions) => { ruleNode.selectors.flatMap((selector) => resolvedNestedSelector(selector, ruleNode)), ), ]; - const normalizedSelectorList = resolvedSelectorList.map(normalizeSelector); + const normalizedSelectorList = resolvedSelectorList.map((selector) => + normalizeSelector(selector), + ); // Sort the selectors list so that the order of the constituents // doesn't matter @@ -116,12 +118,12 @@ const rule = (primary, secondaryOptions) => { const reportedSelectors = new Set(); // Or complain if one selector list contains the same selector more than once - ruleNode.selectors.forEach((selector) => { + for (const selector of ruleNode.selectors) { const normalized = normalizeSelector(selector); if (presentedSelectors.has(normalized)) { if (reportedSelectors.has(normalized)) { - return; + continue; } report({ @@ -134,7 +136,7 @@ const rule = (primary, secondaryOptions) => { } else { presentedSelectors.add(normalized); } - }); + } if (shouldDisallowDuplicateInList) { for (const selector of selectorListParsed) { diff --git a/node_modules/stylelint/lib/rules/no-empty-first-line/index.js b/node_modules/stylelint/lib/rules/no-empty-first-line/index.js index c5bcb0f16d..094a4ccc55 100644 --- a/node_modules/stylelint/lib/rules/no-empty-first-line/index.js +++ b/node_modules/stylelint/lib/rules/no-empty-first-line/index.js @@ -1,5 +1,3 @@ -// @ts-nocheck - 'use strict'; const report = require('../../utils/report'); @@ -13,15 +11,17 @@ const messages = ruleMessages(ruleName, { rejected: 'Unexpected empty line', }); -function rule(actual, _, context) { +/** @type {import('stylelint').Rule} */ +const rule = (primary, _secondaryOptions, context) => { return (root, result) => { - const validOptions = validateOptions(result, ruleName, { actual }); + const validOptions = validateOptions(result, ruleName, { actual: primary }); + // @ts-expect-error -- TS2339: Property 'inline' does not exist on type 'Source'. Property 'lang' does not exist on type 'Source'. if (!validOptions || root.source.inline || root.source.lang === 'object-literal') { return; } - const rootString = context.fix ? root.toString() : root.source.input.css; + const rootString = context.fix ? root.toString() : (root.source && root.source.input.css) || ''; if (!rootString.trim()) { return; @@ -29,7 +29,15 @@ function rule(actual, _, context) { if (noEmptyFirstLineTest.test(rootString)) { if (context.fix) { - root.nodes[0].raws.before = root.first.raws.before.trimStart(); + if (root.first == null) { + throw new Error('The root node must have the first node.'); + } + + if (root.first.raws.before == null) { + throw new Error('The first node must have spaces before.'); + } + + root.first.raws.before = root.first.raws.before.trimStart(); return; } @@ -42,7 +50,7 @@ function rule(actual, _, context) { }); } }; -} +}; rule.ruleName = ruleName; rule.messages = messages; diff --git a/node_modules/stylelint/lib/rules/no-empty-source/index.js b/node_modules/stylelint/lib/rules/no-empty-source/index.js index 1400234d89..d7f0ae8498 100644 --- a/node_modules/stylelint/lib/rules/no-empty-source/index.js +++ b/node_modules/stylelint/lib/rules/no-empty-source/index.js @@ -1,5 +1,3 @@ -// @ts-nocheck - 'use strict'; const report = require('../../utils/report'); @@ -12,15 +10,16 @@ const messages = ruleMessages(ruleName, { rejected: 'Unexpected empty source', }); -function rule(actual, options, context) { +/** @type {import('stylelint').Rule} */ +const rule = (primary, _secondaryOptions, context) => { return (root, result) => { - const validOptions = validateOptions(result, ruleName, { actual }); + const validOptions = validateOptions(result, ruleName, { actual: primary }); if (!validOptions) { return; } - const rootString = context.fix ? root.toString() : root.source.input.css; + const rootString = context.fix ? root.toString() : (root.source && root.source.input.css) || ''; if (rootString.trim()) { return; @@ -33,7 +32,7 @@ function rule(actual, options, context) { ruleName, }); }; -} +}; rule.ruleName = ruleName; rule.messages = messages; diff --git a/node_modules/stylelint/lib/rules/no-eol-whitespace/index.js b/node_modules/stylelint/lib/rules/no-eol-whitespace/index.js index f5f75200d2..2c52ac616c 100644 --- a/node_modules/stylelint/lib/rules/no-eol-whitespace/index.js +++ b/node_modules/stylelint/lib/rules/no-eol-whitespace/index.js @@ -1,12 +1,13 @@ -// @ts-nocheck - 'use strict'; +const styleSearch = require('style-search'); + const isOnlyWhitespace = require('../../utils/isOnlyWhitespace'); +const isStandardSyntaxComment = require('../../utils/isStandardSyntaxComment'); const optionsMatches = require('../../utils/optionsMatches'); const report = require('../../utils/report'); const ruleMessages = require('../../utils/ruleMessages'); -const styleSearch = require('style-search'); +const { isAtRule, isComment, isDeclaration, isRule } = require('../../utils/typeGuards'); const validateOptions = require('../../utils/validateOptions'); const ruleName = 'no-eol-whitespace'; @@ -17,10 +18,20 @@ const messages = ruleMessages(ruleName, { const whitespacesToReject = new Set([' ', '\t']); +/** + * @param {string} str + * @returns {string} + */ function fixString(str) { return str.replace(/[ \t]+$/, ''); } +/** + * @param {number} lastEOLIndex + * @param {string} string + * @param {{ ignoreEmptyLines?: boolean, isRootFirst?: boolean }} [options] + * @returns {number} + */ function findErrorStartIndex( lastEOLIndex, string, @@ -53,17 +64,18 @@ function findErrorStartIndex( return eolWhitespaceIndex; } -function rule(on, options, context) { +/** @type {import('stylelint').Rule} */ +const rule = (primary, secondaryOptions, context) => { return (root, result) => { const validOptions = validateOptions( result, ruleName, { - actual: on, + actual: primary, }, { optional: true, - actual: options, + actual: secondaryOptions, possible: { ignore: ['empty-lines'], }, @@ -74,13 +86,17 @@ function rule(on, options, context) { return; } - const ignoreEmptyLines = optionsMatches(options, 'ignore', 'empty-lines'); + const ignoreEmptyLines = optionsMatches(secondaryOptions, 'ignore', 'empty-lines'); if (context.fix) { fix(root); } - const rootString = context.fix ? root.toString() : root.source.input.css; + const rootString = context.fix ? root.toString() : (root.source && root.source.input.css) || ''; + + /** + * @param {number} index + */ const reportFromIndex = (index) => { report({ message: messages.rejected, @@ -104,9 +120,9 @@ function rule(on, options, context) { /** * Iterate each whitespace at the end of each line of the given string. - * @param {string} string the source code string - * @param {Function} callback callback the whitespace index at the end of each line. - * @param {boolean} isRootFirst set `true` if the given string is the first token of the root. + * @param {string} string - the source code string + * @param {(index: number) => void} callback - callback the whitespace index at the end of each line. + * @param {boolean} isRootFirst - set `true` if the given string is the first token of the root. * @returns {void} */ function eachEolWhitespace(string, callback, isRootFirst) { @@ -129,6 +145,9 @@ function rule(on, options, context) { ); } + /** + * @param {import('postcss').Root} rootNode + */ function fix(rootNode) { let isRootFirst = true; @@ -142,68 +161,79 @@ function rule(on, options, context) { ); isRootFirst = false; - // AtRule - fixText(node.raws.afterName, (fixed) => { - node.raws.afterName = fixed; - }); - - if (node.raws.params) { - fixText(node.raws.params.raw, (fixed) => { - node.raws.params.raw = fixed; + if (isAtRule(node)) { + fixText(node.raws.afterName, (fixed) => { + node.raws.afterName = fixed; }); - } else { - fixText(node.params, (fixed) => { - node.params = fixed; + + const rawsParams = node.raws.params; + + if (rawsParams) { + fixText(rawsParams.raw, (fixed) => { + rawsParams.raw = fixed; + }); + } else { + fixText(node.params, (fixed) => { + node.params = fixed; + }); + } + } + + if (isRule(node)) { + const rawsSelector = node.raws.selector; + + if (rawsSelector) { + fixText(rawsSelector.raw, (fixed) => { + rawsSelector.raw = fixed; + }); + } else { + fixText(node.selector, (fixed) => { + node.selector = fixed; + }); + } + } + + if (isAtRule(node) || isRule(node) || isDeclaration(node)) { + fixText(node.raws.between, (fixed) => { + node.raws.between = fixed; }); } - // Rule - if (node.raws.selector) { - fixText(node.raws.selector.raw, (fixed) => { - node.raws.selector.raw = fixed; + if (isDeclaration(node)) { + if (node.raws.value) { + fixText(node.raws.value.raw, (fixed) => { + node.raws.value.raw = fixed; + }); + } else { + fixText(node.value, (fixed) => { + node.value = fixed; + }); + } + } + + if (isComment(node)) { + fixText(node.raws.left, (fixed) => { + node.raws.left = fixed; }); - } else { - fixText(node.selector, (fixed) => { - node.selector = fixed; + + if (!isStandardSyntaxComment(node)) { + node.raws.right = node.raws.right && fixString(node.raws.right); + } else { + fixText(node.raws.right, (fixed) => { + node.raws.right = fixed; + }); + } + + fixText(node.text, (fixed) => { + node.text = fixed; }); } - // AtRule or Rule or Decl - fixText(node.raws.between, (fixed) => { - node.raws.between = fixed; - }); - - // Decl - if (node.raws.value) { - fixText(node.raws.value.raw, (fixed) => { - node.raws.value.raw = fixed; - }); - } else { - fixText(node.value, (fixed) => { - node.value = fixed; + if (isAtRule(node) || isRule(node)) { + fixText(node.raws.after, (fixed) => { + node.raws.after = fixed; }); } - - // Comment - fixText(node.raws.left, (fixed) => { - node.raws.left = fixed; - }); - - if (node.raws.inline) { - node.raws.right = fixString(node.raws.right); - } else { - fixText(node.raws.right, (fixed) => { - node.raws.right = fixed; - }); - } - - fixText(node.text, (fixed) => { - node.text = fixed; - }); - - fixText(node.raws.after, (fixed) => { - node.raws.after = fixed; - }); }); fixText( @@ -228,7 +258,12 @@ function rule(on, options, context) { } } - function fixText(value, fixFn, isRootFirst) { + /** + * @param {string | undefined} value + * @param {(text: string) => void} fixFn + * @param {boolean} isRootFirst + */ + function fixText(value, fixFn, isRootFirst = false) { if (!value) { return; } @@ -253,7 +288,7 @@ function rule(on, options, context) { } } }; -} +}; rule.ruleName = ruleName; rule.messages = messages; diff --git a/node_modules/stylelint/lib/rules/no-extra-semicolons/index.js b/node_modules/stylelint/lib/rules/no-extra-semicolons/index.js index 52de368c18..341237d525 100644 --- a/node_modules/stylelint/lib/rules/no-extra-semicolons/index.js +++ b/node_modules/stylelint/lib/rules/no-extra-semicolons/index.js @@ -1,5 +1,3 @@ -// @ts-nocheck - 'use strict'; const isStandardSyntaxAtRule = require('../../utils/isStandardSyntaxAtRule'); @@ -15,12 +13,25 @@ const messages = ruleMessages(ruleName, { rejected: 'Unexpected extra semicolon', }); +/** + * @param {import('postcss').Node} node + * @returns {number} + */ function getOffsetByNode(node) { + // @ts-expect-error -- TS2339: Property 'document' does not exist on type 'Document | Container' if (node.parent && node.parent.document) { return 0; } - const string = node.root().source.input.css; + const root = node.root(); + + if (!root.source) throw new Error('The root node must have a source'); + + if (!node.source) throw new Error('The node must have a source'); + + if (!node.source.start) throw new Error('The source must have a start position'); + + const string = root.source.input.css; const nodeColumn = node.source.start.column; const nodeLine = node.source.start.line; let line = 1; @@ -44,17 +55,19 @@ function getOffsetByNode(node) { return index; } -function rule(actual, options, context) { +/** @type {import('stylelint').Rule} */ +const rule = (primary, _secondaryOptions, context) => { return (root, result) => { - const validOptions = validateOptions(result, ruleName, { actual }); + const validOptions = validateOptions(result, ruleName, { actual: primary }); if (!validOptions) { return; } - const rawAfterRoot = root.raws.after; + if (root.raws.after && root.raws.after.trim().length !== 0) { + const rawAfterRoot = root.raws.after; - if (rawAfterRoot && rawAfterRoot.trim().length !== 0) { + /** @type {number[]} */ const fixSemiIndices = []; styleSearch({ source: rawAfterRoot, target: ';' }, (match) => { @@ -64,6 +77,8 @@ function rule(actual, options, context) { return; } + if (!root.source) throw new Error('The root node must have a source'); + complain(root.source.input.css.length - rawAfterRoot.length + match.startIndex); }); @@ -82,13 +97,13 @@ function rule(actual, options, context) { return; } - const rawBeforeNode = node.raws.before; - - if (rawBeforeNode && rawBeforeNode.trim().length !== 0) { + if (node.raws.before && node.raws.before.trim().length !== 0) { + const rawBeforeNode = node.raws.before; const allowedSemi = 0; const rawBeforeIndexStart = 0; + /** @type {number[]} */ const fixSemiIndices = []; styleSearch({ source: rawBeforeNode, target: ';' }, (match, count) => { @@ -107,22 +122,28 @@ function rule(actual, options, context) { // fix if (fixSemiIndices.length) { - node.raws.before = removeIndices(node.raws.before, fixSemiIndices); + node.raws.before = removeIndices(rawBeforeNode, fixSemiIndices); } } - const rawAfterNode = node.raws.after; + if ('after' in node.raws && node.raws.after && node.raws.after.trim().length !== 0) { + const rawAfterNode = node.raws.after; - if (rawAfterNode && rawAfterNode.trim().length !== 0) { /** * If the last child is a Less mixin followed by more than one semicolon, * node.raws.after will be populated with that semicolon. * Since we ignore Less mixins, exit here */ - if (node.last && node.last.type === 'atrule' && !isStandardSyntaxAtRule(node.last)) { + if ( + 'last' in node && + node.last && + node.last.type === 'atrule' && + !isStandardSyntaxAtRule(node.last) + ) { return; } + /** @type {number[]} */ const fixSemiIndices = []; styleSearch({ source: rawAfterNode, target: ';' }, (match) => { @@ -148,11 +169,11 @@ function rule(actual, options, context) { } } - const rawOwnSemicolon = node.raws.ownSemicolon; - - if (rawOwnSemicolon) { + if ('ownSemicolon' in node.raws && node.raws.ownSemicolon) { + const rawOwnSemicolon = node.raws.ownSemicolon; const allowedSemi = 0; + /** @type {number[]} */ const fixSemiIndices = []; styleSearch({ source: rawOwnSemicolon, target: ';' }, (match, count) => { @@ -182,6 +203,9 @@ function rule(actual, options, context) { } }); + /** + * @param {number} index + */ function complain(index) { report({ message: messages.rejected, @@ -192,15 +216,20 @@ function rule(actual, options, context) { }); } + /** + * @param {string} str + * @param {number[]} indices + * @returns {string} + */ function removeIndices(str, indices) { - indices.reverse().forEach((index) => { + for (const index of indices.reverse()) { str = str.slice(0, index) + str.slice(index + 1); - }); + } return str; } }; -} +}; rule.ruleName = ruleName; rule.messages = messages; diff --git a/node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/index.js b/node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/index.js index 606d459dda..00120ddcda 100644 --- a/node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/index.js +++ b/node_modules/stylelint/lib/rules/no-invalid-double-slash-comments/index.js @@ -32,7 +32,7 @@ function rule(actual) { }); root.walkRules((ruleNode) => { - ruleNode.selectors.forEach((selector) => { + for (const selector of ruleNode.selectors) { if (selector.startsWith('//')) { report({ message: messages.rejected, @@ -41,7 +41,7 @@ function rule(actual) { ruleName, }); } - }); + } }); }; } diff --git a/node_modules/stylelint/lib/rules/no-irregular-whitespace/index.js b/node_modules/stylelint/lib/rules/no-irregular-whitespace/index.js index a0af350289..b9f636df0b 100644 --- a/node_modules/stylelint/lib/rules/no-irregular-whitespace/index.js +++ b/node_modules/stylelint/lib/rules/no-irregular-whitespace/index.js @@ -77,12 +77,12 @@ const generateNodeValidator = (nodeSchema, validator) => { const allKeys = Object.keys(nodeSchema); const validatorForKey = {}; - allKeys.forEach((key) => { + for (const key of allKeys) { if (typeof nodeSchema[key] === 'string') validatorForKey[key] = validator; if (typeof nodeSchema[key] === 'object') validatorForKey[key] = generateNodeValidator(nodeSchema[key], validator); - }); + } // This will be called many times, so it's optimized for performance and not readibility. // Surprisingly, this seem to be slightly faster then concatenating the params and running the validator once. diff --git a/node_modules/stylelint/lib/rules/no-unknown-animations/index.js b/node_modules/stylelint/lib/rules/no-unknown-animations/index.js index cd3d0a56bd..d1fd778bc8 100644 --- a/node_modules/stylelint/lib/rules/no-unknown-animations/index.js +++ b/node_modules/stylelint/lib/rules/no-unknown-animations/index.js @@ -37,13 +37,13 @@ function rule(actual) { return; } - animationNames.forEach((animationNameNode) => { + for (const animationNameNode of animationNames) { if (keywordSets.animationNameKeywords.has(animationNameNode.value.toLowerCase())) { - return; + continue; } if (declaredAnimations.has(animationNameNode.value)) { - return; + continue; } report({ @@ -53,7 +53,7 @@ function rule(actual) { node: decl, index: declarationValueIndex(decl) + animationNameNode.sourceIndex, }); - }); + } } }); }; diff --git a/node_modules/stylelint/lib/rules/number-leading-zero/index.js b/node_modules/stylelint/lib/rules/number-leading-zero/index.js index dcc17efd79..27e305853f 100644 --- a/node_modules/stylelint/lib/rules/number-leading-zero/index.js +++ b/node_modules/stylelint/lib/rules/number-leading-zero/index.js @@ -112,7 +112,7 @@ function rule(expectation, secondary, context) { }); if (alwaysFixPositions.length) { - alwaysFixPositions.forEach((fixPosition) => { + for (const fixPosition of alwaysFixPositions) { const index = fixPosition.index; if (node.type === 'atrule') { @@ -120,11 +120,11 @@ function rule(expectation, secondary, context) { } else { node.value = addLeadingZero(node.value, index); } - }); + } } if (neverFixPositions.length) { - neverFixPositions.forEach((fixPosition) => { + for (const fixPosition of neverFixPositions) { const startIndex = fixPosition.startIndex; const endIndex = fixPosition.endIndex; @@ -133,7 +133,7 @@ function rule(expectation, secondary, context) { } else { node.value = removeLeadingZeros(node.value, startIndex, endIndex); } - }); + } } } diff --git a/node_modules/stylelint/lib/rules/number-no-trailing-zeros/index.js b/node_modules/stylelint/lib/rules/number-no-trailing-zeros/index.js index 3e10e25d47..597ebca747 100644 --- a/node_modules/stylelint/lib/rules/number-no-trailing-zeros/index.js +++ b/node_modules/stylelint/lib/rules/number-no-trailing-zeros/index.js @@ -95,7 +95,7 @@ function rule(actual, secondary, context) { }); if (fixPositions.length) { - fixPositions.forEach((fixPosition) => { + for (const fixPosition of fixPositions) { const startIndex = fixPosition.startIndex; const endIndex = fixPosition.endIndex; @@ -104,7 +104,7 @@ function rule(actual, secondary, context) { } else { node.value = removeTrailingZeros(node.value, startIndex, endIndex); } - }); + } } } }; diff --git a/node_modules/stylelint/lib/rules/rule-selector-property-disallowed-list/index.js b/node_modules/stylelint/lib/rules/rule-selector-property-disallowed-list/index.js new file mode 100644 index 0000000000..ef5e0cf44d --- /dev/null +++ b/node_modules/stylelint/lib/rules/rule-selector-property-disallowed-list/index.js @@ -0,0 +1,66 @@ +'use strict'; + +const isStandardSyntaxRule = require('../../utils/isStandardSyntaxRule'); +const matchesStringOrRegExp = require('../../utils/matchesStringOrRegExp'); +const report = require('../../utils/report'); +const ruleMessages = require('../../utils/ruleMessages'); +const validateOptions = require('../../utils/validateOptions'); +const { isPlainObject } = require('is-plain-object'); + +const ruleName = 'rule-selector-property-disallowed-list'; + +const messages = ruleMessages(ruleName, { + rejected: (property, selector) => `Unexpected property "${property}" for selector "${selector}"`, +}); + +/** @type {import('stylelint').Rule} */ +const rule = (primary) => { + return (root, result) => { + const validOptions = validateOptions(result, ruleName, { + actual: primary, + possible: [isPlainObject], + }); + + if (!validOptions) { + return; + } + + const selectors = Object.keys(primary); + + root.walkRules((ruleNode) => { + if (!isStandardSyntaxRule(ruleNode)) { + return; + } + + const selectorKey = selectors.find((selector) => + matchesStringOrRegExp(ruleNode.selector, selector), + ); + + if (!selectorKey) { + return; + } + + const disallowedProperties = primary[selectorKey]; + + for (const node of ruleNode.nodes) { + const isDisallowedProperty = + node.type === 'decl' && matchesStringOrRegExp(node.prop, disallowedProperties); + + if (isDisallowedProperty) { + report({ + message: messages.rejected(node.prop, ruleNode.selector), + node, + result, + ruleName, + }); + } + } + }); + }; +}; + +rule.primaryOptionArray = true; + +rule.ruleName = ruleName; +rule.messages = messages; +module.exports = rule; diff --git a/node_modules/stylelint/lib/rules/selector-class-pattern/index.js b/node_modules/stylelint/lib/rules/selector-class-pattern/index.js index a194b37b41..735476e059 100644 --- a/node_modules/stylelint/lib/rules/selector-class-pattern/index.js +++ b/node_modules/stylelint/lib/rules/selector-class-pattern/index.js @@ -58,13 +58,13 @@ function rule(pattern, options) { // Only bother resolving selectors that have an interpolating & if (shouldResolveNestedSelectors && hasInterpolatingAmpersand(selector)) { - resolveNestedSelector(selector, ruleNode).forEach((nestedSelector) => { + for (const nestedSelector of resolveNestedSelector(selector, ruleNode)) { if (!isStandardSyntaxSelector(nestedSelector)) { - return; + continue; } parseSelector(nestedSelector, result, ruleNode, (s) => checkSelector(s, ruleNode)); - }); + } } else { parseSelector(selector, result, ruleNode, (s) => checkSelector(s, ruleNode)); } diff --git a/node_modules/stylelint/lib/rules/selector-list-comma-newline-after/index.js b/node_modules/stylelint/lib/rules/selector-list-comma-newline-after/index.js index 7a0a44445e..cb1bd4e713 100644 --- a/node_modules/stylelint/lib/rules/selector-list-comma-newline-after/index.js +++ b/node_modules/stylelint/lib/rules/selector-list-comma-newline-after/index.js @@ -87,20 +87,18 @@ function rule(expectation, options, context) { if (fixIndices.length) { let fixedSelector = selector; - fixIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeSelector = fixedSelector.slice(0, index); - let afterSelector = fixedSelector.slice(index); + for (const index of fixIndices.sort((a, b) => b - a)) { + const beforeSelector = fixedSelector.slice(0, index); + let afterSelector = fixedSelector.slice(index); - if (expectation.startsWith('always')) { - afterSelector = context.newline + afterSelector; - } else if (expectation.startsWith('never-multi-line')) { - afterSelector = afterSelector.replace(/^\s*/, ''); - } + if (expectation.startsWith('always')) { + afterSelector = context.newline + afterSelector; + } else if (expectation.startsWith('never-multi-line')) { + afterSelector = afterSelector.replace(/^\s*/, ''); + } - fixedSelector = beforeSelector + afterSelector; - }); + fixedSelector = beforeSelector + afterSelector; + } if (ruleNode.raws.selector) { ruleNode.raws.selector.raw = fixedSelector; diff --git a/node_modules/stylelint/lib/rules/selector-list-comma-newline-before/index.js b/node_modules/stylelint/lib/rules/selector-list-comma-newline-before/index.js index 6eab502e89..a63d992661 100644 --- a/node_modules/stylelint/lib/rules/selector-list-comma-newline-before/index.js +++ b/node_modules/stylelint/lib/rules/selector-list-comma-newline-before/index.js @@ -49,39 +49,37 @@ function rule(expectation, options, context) { }); if (fixData) { - fixData.forEach((commaIndices, ruleNode) => { + for (const [ruleNode, commaIndices] of fixData.entries()) { let selector = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector; - commaIndices - .sort((a, b) => b - a) - .forEach((index) => { - let beforeSelector = selector.slice(0, index); - const afterSelector = selector.slice(index); + for (const index of commaIndices.sort((a, b) => b - a)) { + let beforeSelector = selector.slice(0, index); + const afterSelector = selector.slice(index); - if (expectation.startsWith('always')) { - const spaceIndex = beforeSelector.search(/\s+$/); + if (expectation.startsWith('always')) { + const spaceIndex = beforeSelector.search(/\s+$/); - if (spaceIndex >= 0) { - beforeSelector = - beforeSelector.slice(0, spaceIndex) + - context.newline + - beforeSelector.slice(spaceIndex); - } else { - beforeSelector += context.newline; - } - } else if (expectation === 'never-multi-line') { - beforeSelector = beforeSelector.replace(/\s*$/, ''); + if (spaceIndex >= 0) { + beforeSelector = + beforeSelector.slice(0, spaceIndex) + + context.newline + + beforeSelector.slice(spaceIndex); + } else { + beforeSelector += context.newline; } + } else if (expectation === 'never-multi-line') { + beforeSelector = beforeSelector.replace(/\s*$/, ''); + } - selector = beforeSelector + afterSelector; - }); + selector = beforeSelector + afterSelector; + } if (ruleNode.raws.selector) { ruleNode.raws.selector.raw = selector; } else { ruleNode.selector = selector; } - }); + } } }; } diff --git a/node_modules/stylelint/lib/rules/selector-list-comma-space-after/index.js b/node_modules/stylelint/lib/rules/selector-list-comma-space-after/index.js index 4d61a97790..269947a071 100644 --- a/node_modules/stylelint/lib/rules/selector-list-comma-space-after/index.js +++ b/node_modules/stylelint/lib/rules/selector-list-comma-space-after/index.js @@ -50,30 +50,28 @@ function rule(expectation, options, context) { }); if (fixData) { - fixData.forEach((commaIndices, ruleNode) => { + for (const [ruleNode, commaIndices] of fixData.entries()) { let selector = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector; - commaIndices - .sort((a, b) => b - a) - .forEach((index) => { - const beforeSelector = selector.slice(0, index + 1); - let afterSelector = selector.slice(index + 1); + for (const index of commaIndices.sort((a, b) => b - a)) { + const beforeSelector = selector.slice(0, index + 1); + let afterSelector = selector.slice(index + 1); - if (expectation.startsWith('always')) { - afterSelector = afterSelector.replace(/^\s*/, ' '); - } else if (expectation.startsWith('never')) { - afterSelector = afterSelector.replace(/^\s*/, ''); - } + if (expectation.startsWith('always')) { + afterSelector = afterSelector.replace(/^\s*/, ' '); + } else if (expectation.startsWith('never')) { + afterSelector = afterSelector.replace(/^\s*/, ''); + } - selector = beforeSelector + afterSelector; - }); + selector = beforeSelector + afterSelector; + } if (ruleNode.raws.selector) { ruleNode.raws.selector.raw = selector; } else { ruleNode.selector = selector; } - }); + } } }; } diff --git a/node_modules/stylelint/lib/rules/selector-list-comma-space-before/index.js b/node_modules/stylelint/lib/rules/selector-list-comma-space-before/index.js index 8f24a63015..fe1c83166f 100644 --- a/node_modules/stylelint/lib/rules/selector-list-comma-space-before/index.js +++ b/node_modules/stylelint/lib/rules/selector-list-comma-space-before/index.js @@ -50,30 +50,28 @@ function rule(expectation, options, context) { }); if (fixData) { - fixData.forEach((commaIndices, ruleNode) => { + for (const [ruleNode, commaIndices] of fixData.entries()) { let selector = ruleNode.raws.selector ? ruleNode.raws.selector.raw : ruleNode.selector; - commaIndices - .sort((a, b) => b - a) - .forEach((index) => { - let beforeSelector = selector.slice(0, index); - const afterSelector = selector.slice(index); + for (const index of commaIndices.sort((a, b) => b - a)) { + let beforeSelector = selector.slice(0, index); + const afterSelector = selector.slice(index); - if (expectation.includes('always')) { - beforeSelector = beforeSelector.replace(/\s*$/, ' '); - } else if (expectation.includes('never')) { - beforeSelector = beforeSelector.replace(/\s*$/, ''); - } + if (expectation.includes('always')) { + beforeSelector = beforeSelector.replace(/\s*$/, ' '); + } else if (expectation.includes('never')) { + beforeSelector = beforeSelector.replace(/\s*$/, ''); + } - selector = beforeSelector + afterSelector; - }); + selector = beforeSelector + afterSelector; + } if (ruleNode.raws.selector) { ruleNode.raws.selector.raw = selector; } else { ruleNode.selector = selector; } - }); + } } }; } diff --git a/node_modules/stylelint/lib/rules/selector-max-attribute/index.js b/node_modules/stylelint/lib/rules/selector-max-attribute/index.js index 39ca04e375..c112ca15b2 100644 --- a/node_modules/stylelint/lib/rules/selector-max-attribute/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-attribute/index.js @@ -61,7 +61,9 @@ function rule(max, options) { return total; } - return (total += 1); + total += 1; + + return total; }, 0); if (selectorNode.type !== 'root' && selectorNode.type !== 'pseudo' && count > max) { @@ -80,13 +82,13 @@ function rule(max, options) { return; } - ruleNode.selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of ruleNode.selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { parseSelector(resolvedSelector, result, ruleNode, (container) => checkSelector(container, ruleNode), ); - }); - }); + } + } }); }; } diff --git a/node_modules/stylelint/lib/rules/selector-max-class/index.js b/node_modules/stylelint/lib/rules/selector-max-class/index.js index 696967a9ce..2024e77df2 100644 --- a/node_modules/stylelint/lib/rules/selector-max-class/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-class/index.js @@ -36,7 +36,9 @@ function rule(max) { checkSelector(childNode, ruleNode); } - return (total += childNode.type === 'class' ? 1 : 0); + if (childNode.type === 'class') total += 1; + + return total; }, 0); if (selectorNode.type !== 'root' && selectorNode.type !== 'pseudo' && count > max) { @@ -55,13 +57,13 @@ function rule(max) { return; } - ruleNode.selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of ruleNode.selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { parseSelector(resolvedSelector, result, ruleNode, (container) => checkSelector(container, ruleNode), ); - }); - }); + } + } }); }; } diff --git a/node_modules/stylelint/lib/rules/selector-max-combinators/index.js b/node_modules/stylelint/lib/rules/selector-max-combinators/index.js index 75a73ee5a7..55d30db2cf 100644 --- a/node_modules/stylelint/lib/rules/selector-max-combinators/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-combinators/index.js @@ -37,7 +37,9 @@ function rule(max) { checkSelector(childNode, ruleNode); } - return (total += childNode.type === 'combinator' ? 1 : 0); + if (childNode.type === 'combinator') total += 1; + + return total; }, 0); if (selectorNode.type !== 'root' && selectorNode.type !== 'pseudo' && count > max) { @@ -56,13 +58,13 @@ function rule(max) { return; } - ruleNode.selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of ruleNode.selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { parseSelector(resolvedSelector, result, ruleNode, (container) => checkSelector(container, ruleNode), ); - }); - }); + } + } }); }; } diff --git a/node_modules/stylelint/lib/rules/selector-max-compound-selectors/index.js b/node_modules/stylelint/lib/rules/selector-max-compound-selectors/index.js index ff6b8805ec..740376d9e1 100644 --- a/node_modules/stylelint/lib/rules/selector-max-compound-selectors/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-compound-selectors/index.js @@ -64,12 +64,12 @@ function rule(max) { } // Using `.selectors` gets us each selector if there is a comma separated set - ruleNode.selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of ruleNode.selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { // Process each resolved selector with `checkSelector` via postcss-selector-parser parseSelector(resolvedSelector, result, ruleNode, (s) => checkSelector(s, ruleNode)); - }); - }); + } + } }); }; } diff --git a/node_modules/stylelint/lib/rules/selector-max-id/index.js b/node_modules/stylelint/lib/rules/selector-max-id/index.js index a52cf58929..c329a19fb7 100644 --- a/node_modules/stylelint/lib/rules/selector-max-id/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-id/index.js @@ -53,7 +53,9 @@ function rule(max, options) { checkSelector(childNode, ruleNode); } - return (total += childNode.type === 'id' ? 1 : 0); + if (childNode.type === 'id') total += 1; + + return total; }, 0); if (selectorNode.type !== 'root' && selectorNode.type !== 'pseudo' && count > max) { @@ -79,13 +81,13 @@ function rule(max, options) { return; } - ruleNode.selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of ruleNode.selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { parseSelector(resolvedSelector, result, ruleNode, (container) => checkSelector(container, ruleNode), ); - }); - }); + } + } }); }; } diff --git a/node_modules/stylelint/lib/rules/selector-max-pseudo-class/index.js b/node_modules/stylelint/lib/rules/selector-max-pseudo-class/index.js index a485da38d9..42f63217b6 100644 --- a/node_modules/stylelint/lib/rules/selector-max-pseudo-class/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-pseudo-class/index.js @@ -47,7 +47,7 @@ function rule(max) { } if (childNode.type === 'pseudo') { - return (total += 1); + total += 1; } return total; @@ -69,13 +69,13 @@ function rule(max) { return; } - ruleNode.selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of ruleNode.selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { parseSelector(resolvedSelector, result, rule, (selectorTree) => { checkSelector(selectorTree, ruleNode); }); - }); - }); + } + } }); }; } diff --git a/node_modules/stylelint/lib/rules/selector-max-specificity/index.js b/node_modules/stylelint/lib/rules/selector-max-specificity/index.js index 595eec138e..6a9108a926 100755 --- a/node_modules/stylelint/lib/rules/selector-max-specificity/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-specificity/index.js @@ -27,11 +27,11 @@ const zeroSpecificity = () => [0, 0, 0, 0]; const specificitySum = (specificities) => { const sum = zeroSpecificity(); - specificities.forEach((specificityArray) => { - specificityArray.forEach((value, i) => { + for (const specificityArray of specificities) { + for (const [i, value] of specificityArray.entries()) { sum[i] += value; - }); - }); + } + } return sum; }; @@ -129,13 +129,13 @@ function rule(max, options) { return pseudoSpecificity(node); case 'selector': // Calculate the sum of all the direct children - return specificitySum(node.map(nodeSpecificity)); + return specificitySum(node.map((n) => nodeSpecificity(n))); default: return zeroSpecificity(); } }; - const maxSpecificityArray = `0,${max}`.split(',').map(parseFloat); + const maxSpecificityArray = `0,${max}`.split(',').map((s) => Number.parseFloat(s)); root.walkRules((ruleNode) => { if (!isStandardSyntaxRule(ruleNode)) { @@ -143,12 +143,12 @@ function rule(max, options) { } // Using `.selectors` gets us each selector in the eventuality we have a comma separated set - ruleNode.selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of ruleNode.selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { try { // Skip non-standard syntax selectors if (!isStandardSyntaxSelector(resolvedSelector)) { - return; + continue; } parseSelector(resolvedSelector, result, ruleNode, (selectorTree) => { @@ -171,8 +171,8 @@ function rule(max, options) { stylelintType: 'parseError', }); } - }); - }); + } + } }); }; } diff --git a/node_modules/stylelint/lib/rules/selector-max-type/index.js b/node_modules/stylelint/lib/rules/selector-max-type/index.js index 539870521c..c1d939ebfb 100644 --- a/node_modules/stylelint/lib/rules/selector-max-type/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-type/index.js @@ -110,17 +110,17 @@ function rule(max, options) { return; } - ruleNode.selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of ruleNode.selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { if (!isStandardSyntaxSelector(resolvedSelector)) { - return; + continue; } parseSelector(resolvedSelector, result, ruleNode, (container) => checkSelector(container, ruleNode), ); - }); - }); + } + } }); }; } @@ -128,13 +128,13 @@ function rule(max, options) { function hasDescendantCombinatorBefore(node) { const nodeIndex = node.parent.nodes.indexOf(node); - return node.parent.nodes.slice(0, nodeIndex).some(isDescendantCombinator); + return node.parent.nodes.slice(0, nodeIndex).some((n) => isDescendantCombinator(n)); } function hasChildCombinatorBefore(node) { const nodeIndex = node.parent.nodes.indexOf(node); - return node.parent.nodes.slice(0, nodeIndex).some(isChildCombinator); + return node.parent.nodes.slice(0, nodeIndex).some((n) => isChildCombinator(n)); } function hasCompoundSelector(node) { diff --git a/node_modules/stylelint/lib/rules/selector-max-universal/index.js b/node_modules/stylelint/lib/rules/selector-max-universal/index.js index 940f88c0a0..54d9cb795d 100644 --- a/node_modules/stylelint/lib/rules/selector-max-universal/index.js +++ b/node_modules/stylelint/lib/rules/selector-max-universal/index.js @@ -39,7 +39,9 @@ function rule(max) { checkSelector(childNode, ruleNode); } - return (total += childNode.type === 'universal' ? 1 : 0); + if (childNode.type === 'universal') total += 1; + + return total; }, 0); if (selectorNode.type !== 'root' && selectorNode.type !== 'pseudo' && count > max) { @@ -68,13 +70,13 @@ function rule(max) { } }); - selectors.forEach((selector) => { - resolvedNestedSelector(selector, ruleNode).forEach((resolvedSelector) => { + for (const selector of selectors) { + for (const resolvedSelector of resolvedNestedSelector(selector, ruleNode)) { parseSelector(resolvedSelector, result, ruleNode, (container) => checkSelector(container, ruleNode), ); - }); - }); + } + } }); }; } diff --git a/node_modules/stylelint/lib/rules/selector-no-qualifying-type/index.js b/node_modules/stylelint/lib/rules/selector-no-qualifying-type/index.js index 84feeeb8d5..8e3f8b722e 100644 --- a/node_modules/stylelint/lib/rules/selector-no-qualifying-type/index.js +++ b/node_modules/stylelint/lib/rules/selector-no-qualifying-type/index.js @@ -89,7 +89,7 @@ function rule(enabled, options) { const selectorNodes = getRightNodes(selector); const index = selector.sourceIndex; - selectorNodes.forEach((selectorNode) => { + for (const selectorNode of selectorNodes) { if (selectorNode.type === 'id' && !optionsMatches(options, 'ignore', 'id')) { complain(index); } @@ -104,17 +104,17 @@ function rule(enabled, options) { ) { complain(index); } - }); + } }); } - resolvedNestedSelector(ruleNode.selector, ruleNode).forEach((resolvedSelector) => { + for (const resolvedSelector of resolvedNestedSelector(ruleNode.selector, ruleNode)) { if (!isStandardSyntaxSelector(resolvedSelector)) { - return; + continue; } parseSelector(resolvedSelector, result, ruleNode, checkSelector); - }); + } function complain(index) { report({ diff --git a/node_modules/stylelint/lib/rules/selector-pseudo-class-parentheses-space-inside/index.js b/node_modules/stylelint/lib/rules/selector-pseudo-class-parentheses-space-inside/index.js index 5042514a34..b181b12bf0 100644 --- a/node_modules/stylelint/lib/rules/selector-pseudo-class-parentheses-space-inside/index.js +++ b/node_modules/stylelint/lib/rules/selector-pseudo-class-parentheses-space-inside/index.js @@ -45,7 +45,7 @@ function rule(expectation, options, context) { return; } - const paramString = pseudoNode.map(String).join(','); + const paramString = pseudoNode.map((node) => String(node)).join(','); const nextCharIsSpace = paramString.startsWith(' '); const openIndex = pseudoNode.sourceIndex + stringifyProperty(pseudoNode, 'value').length + 1; diff --git a/node_modules/stylelint/lib/rules/selector-pseudo-element-colon-notation/index.js b/node_modules/stylelint/lib/rules/selector-pseudo-element-colon-notation/index.js index 696d82fbb2..657d8b4b48 100644 --- a/node_modules/stylelint/lib/rules/selector-pseudo-element-colon-notation/index.js +++ b/node_modules/stylelint/lib/rules/selector-pseudo-element-colon-notation/index.js @@ -78,12 +78,12 @@ function rule(expectation, options, context) { const offset = expectedSingle ? 1 : 0; const extraColon = expectedSingle ? '' : ':'; - fixPositions.forEach((fixPosition) => { + for (const fixPosition of fixPositions) { ruleNode.selector = ruleNode.selector.substring(0, fixPosition.startIndex - offset) + extraColon + ruleNode.selector.substring(fixPosition.startIndex); - }); + } } }); }; diff --git a/node_modules/stylelint/lib/rules/selector-type-case/index.js b/node_modules/stylelint/lib/rules/selector-type-case/index.js index ca4d7d09ca..9f432b4a19 100644 --- a/node_modules/stylelint/lib/rules/selector-type-case/index.js +++ b/node_modules/stylelint/lib/rules/selector-type-case/index.js @@ -11,6 +11,7 @@ const report = require('../../utils/report'); const ruleMessages = require('../../utils/ruleMessages'); const validateOptions = require('../../utils/validateOptions'); const { isString } = require('../../utils/validateTypes'); +const keywordSets = require('../../reference/keywordSets'); const ruleName = 'selector-type-case'; @@ -59,6 +60,10 @@ function rule(expectation, options, context) { return; } + if (keywordSets.validMixedCaseSvgElements.has(tag.value)) { + return; + } + if (optionsMatches(options, 'ignoreTypes', tag.value)) { return; } diff --git a/node_modules/stylelint/lib/rules/string-quotes/index.js b/node_modules/stylelint/lib/rules/string-quotes/index.js index 77dc710766..2167efd9d8 100644 --- a/node_modules/stylelint/lib/rules/string-quotes/index.js +++ b/node_modules/stylelint/lib/rules/string-quotes/index.js @@ -153,9 +153,9 @@ function rule(expectation, secondary, context) { } }); - fixPositions.forEach((fixIndex) => { + for (const fixIndex of fixPositions) { ruleNode.selector = replaceQuote(ruleNode.selector, fixIndex, correctQuote); - }); + } } function checkDeclOrAtRule(node, value, getIndex) { @@ -200,13 +200,13 @@ function rule(expectation, secondary, context) { } }); - fixPositions.forEach((fixIndex) => { + for (const fixIndex of fixPositions) { if (node.type === 'atrule') { node.params = replaceQuote(node.params, fixIndex, correctQuote); } else { node.value = replaceQuote(node.value, fixIndex, correctQuote); } - }); + } } }; } diff --git a/node_modules/stylelint/lib/rules/unit-case/index.js b/node_modules/stylelint/lib/rules/unit-case/index.js index cbacf5792c..471e46ef07 100644 --- a/node_modules/stylelint/lib/rules/unit-case/index.js +++ b/node_modules/stylelint/lib/rules/unit-case/index.js @@ -85,7 +85,7 @@ function rule(expectation, options, context) { node.value = parsedValue.toString(); } } else { - problems.forEach((err) => { + for (const err of problems) { report({ index: err.index, message: err.message, @@ -93,7 +93,7 @@ function rule(expectation, options, context) { result, ruleName, }); - }); + } } } } diff --git a/node_modules/stylelint/lib/rules/value-keyword-case/index.js b/node_modules/stylelint/lib/rules/value-keyword-case/index.js index 76a7aebd55..21a9950fdd 100644 --- a/node_modules/stylelint/lib/rules/value-keyword-case/index.js +++ b/node_modules/stylelint/lib/rules/value-keyword-case/index.js @@ -29,9 +29,9 @@ const gridColumnProps = new Set(['grid-column', 'grid-column-start', 'grid-colum const mapLowercaseKeywordsToCamelCase = new Map(); -keywordSets.camelCaseKeywords.forEach((func) => { +for (const func of keywordSets.camelCaseKeywords) { mapLowercaseKeywordsToCamelCase.set(func.toLowerCase(), func); -}); +} function rule(expectation, options, context) { return (root, result) => { diff --git a/node_modules/stylelint/lib/rules/value-list-comma-newline-after/index.js b/node_modules/stylelint/lib/rules/value-list-comma-newline-after/index.js index a090593beb..679bf67efc 100644 --- a/node_modules/stylelint/lib/rules/value-list-comma-newline-after/index.js +++ b/node_modules/stylelint/lib/rules/value-list-comma-newline-after/index.js @@ -72,25 +72,22 @@ function rule(expectation, options, context) { }); if (fixData) { - fixData.forEach((commaIndices, decl) => { - commaIndices - .sort((a, b) => a - b) - .reverse() - .forEach((index) => { - const value = getDeclarationValue(decl); - const valueIndex = index - declarationValueIndex(decl); - const beforeValue = value.slice(0, valueIndex + 1); - let afterValue = value.slice(valueIndex + 1); + for (const [decl, commaIndices] of fixData.entries()) { + for (const index of commaIndices.sort((a, b) => a - b).reverse()) { + const value = getDeclarationValue(decl); + const valueIndex = index - declarationValueIndex(decl); + const beforeValue = value.slice(0, valueIndex + 1); + let afterValue = value.slice(valueIndex + 1); - if (expectation.startsWith('always')) { - afterValue = context.newline + afterValue; - } else if (expectation.startsWith('never-multi-line')) { - afterValue = afterValue.replace(/^\s*/, ''); - } + if (expectation.startsWith('always')) { + afterValue = context.newline + afterValue; + } else if (expectation.startsWith('never-multi-line')) { + afterValue = afterValue.replace(/^\s*/, ''); + } - setDeclarationValue(decl, beforeValue + afterValue); - }); - }); + setDeclarationValue(decl, beforeValue + afterValue); + } + } } }; } diff --git a/node_modules/stylelint/lib/rules/value-list-comma-space-after/index.js b/node_modules/stylelint/lib/rules/value-list-comma-space-after/index.js index 3bfd1b782c..10efd2f463 100644 --- a/node_modules/stylelint/lib/rules/value-list-comma-space-after/index.js +++ b/node_modules/stylelint/lib/rules/value-list-comma-space-after/index.js @@ -59,24 +59,22 @@ function rule(expectation, options, context) { }); if (fixData) { - fixData.forEach((commaIndices, decl) => { - commaIndices - .sort((a, b) => b - a) - .forEach((index) => { - const value = getDeclarationValue(decl); - const valueIndex = index - declarationValueIndex(decl); - const beforeValue = value.slice(0, valueIndex + 1); - let afterValue = value.slice(valueIndex + 1); + for (const [decl, commaIndices] of fixData.entries()) { + for (const index of commaIndices.sort((a, b) => b - a)) { + const value = getDeclarationValue(decl); + const valueIndex = index - declarationValueIndex(decl); + const beforeValue = value.slice(0, valueIndex + 1); + let afterValue = value.slice(valueIndex + 1); - if (expectation.startsWith('always')) { - afterValue = afterValue.replace(/^\s*/, ' '); - } else if (expectation.startsWith('never')) { - afterValue = afterValue.replace(/^\s*/, ''); - } + if (expectation.startsWith('always')) { + afterValue = afterValue.replace(/^\s*/, ' '); + } else if (expectation.startsWith('never')) { + afterValue = afterValue.replace(/^\s*/, ''); + } - setDeclarationValue(decl, beforeValue + afterValue); - }); - }); + setDeclarationValue(decl, beforeValue + afterValue); + } + } } }; } diff --git a/node_modules/stylelint/lib/rules/value-list-comma-space-before/index.js b/node_modules/stylelint/lib/rules/value-list-comma-space-before/index.js index b16c99ea93..fff20868d4 100644 --- a/node_modules/stylelint/lib/rules/value-list-comma-space-before/index.js +++ b/node_modules/stylelint/lib/rules/value-list-comma-space-before/index.js @@ -59,24 +59,22 @@ function rule(expectation, options, context) { }); if (fixData) { - fixData.forEach((commaIndices, decl) => { - commaIndices - .sort((a, b) => b - a) - .forEach((index) => { - const value = getDeclarationValue(decl); - const valueIndex = index - declarationValueIndex(decl); - let beforeValue = value.slice(0, valueIndex); - const afterValue = value.slice(valueIndex); + for (const [decl, commaIndices] of fixData.entries()) { + for (const index of commaIndices.sort((a, b) => b - a)) { + const value = getDeclarationValue(decl); + const valueIndex = index - declarationValueIndex(decl); + let beforeValue = value.slice(0, valueIndex); + const afterValue = value.slice(valueIndex); - if (expectation.startsWith('always')) { - beforeValue = beforeValue.replace(/\s*$/, ' '); - } else if (expectation.startsWith('never')) { - beforeValue = beforeValue.replace(/\s*$/, ''); - } + if (expectation.startsWith('always')) { + beforeValue = beforeValue.replace(/\s*$/, ' '); + } else if (expectation.startsWith('never')) { + beforeValue = beforeValue.replace(/\s*$/, ''); + } - setDeclarationValue(decl, beforeValue + afterValue); - }); - }); + setDeclarationValue(decl, beforeValue + afterValue); + } + } } }; } diff --git a/node_modules/stylelint/lib/standalone.js b/node_modules/stylelint/lib/standalone.js index 10371313c4..3b98b2617b 100644 --- a/node_modules/stylelint/lib/standalone.js +++ b/node_modules/stylelint/lib/standalone.js @@ -1,25 +1,24 @@ 'use strict'; +const debug = require('debug')('stylelint:standalone'); +const fastGlob = require('fast-glob'); +const fs = require('fs'); +const globby = require('globby'); +const normalizePath = require('normalize-path'); +const path = require('path'); + const createStylelint = require('./createStylelint'); const createStylelintResult = require('./createStylelintResult'); -const debug = require('debug')('stylelint:standalone'); -const fastGlob = require('fast-glob'); const FileCache = require('./utils/FileCache'); const filterFilePaths = require('./utils/filterFilePaths'); const formatters = require('./formatters'); -const fs = require('fs'); +const getFileIgnorer = require('./utils/getFileIgnorer'); const getFormatterOptionsText = require('./utils/getFormatterOptionsText'); -const globby = require('globby'); const hash = require('./utils/hash'); -const isPathNotFoundError = require('./utils/isPathNotFoundError'); const NoFilesFoundError = require('./utils/noFilesFoundError'); -const normalizePath = require('normalize-path'); -const path = require('path'); const pkg = require('../package.json'); const prepareReturnValue = require('./prepareReturnValue'); -const { default: ignore } = require('ignore'); -const DEFAULT_IGNORE_FILENAME = '.stylelintignore'; const ALWAYS_IGNORED_GLOBS = ['**/node_modules/**']; const writeFileAtomic = require('write-file-atomic'); @@ -44,14 +43,15 @@ async function standalone({ configBasedir, configFile, customSyntax, + cwd = process.cwd(), disableDefaultIgnores, files, fix, formatter, globbyOptions, ignoreDisables, - ignorePath = DEFAULT_IGNORE_FILENAME, - ignorePattern = [], + ignorePath, + ignorePattern, maxWarnings, quiet, reportDescriptionlessDisables, @@ -73,21 +73,16 @@ async function standalone({ // The ignorer will be used to filter file paths after the glob is checked, // before any files are actually read - const absoluteIgnoreFilePath = path.isAbsolute(ignorePath) - ? ignorePath - : path.resolve(process.cwd(), ignorePath); - let ignoreText = ''; + + /** @type {import('ignore').Ignore} */ + let ignorer; try { - ignoreText = fs.readFileSync(absoluteIgnoreFilePath, 'utf8'); - } catch (readError) { - if (!isPathNotFoundError(readError)) { - return Promise.reject(readError); - } + ignorer = getFileIgnorer({ cwd, ignorePath, ignorePattern }); + } catch (error) { + return Promise.reject(error); } - const ignorer = ignore().add(ignoreText).add(ignorePattern); - /** @type {Formatter} */ let formatterFunction; @@ -101,6 +96,7 @@ async function standalone({ config, configFile, configBasedir, + cwd, ignoreDisables, ignorePath, reportNeedlessDisables, @@ -115,15 +111,15 @@ async function standalone({ if (!files) { const absoluteCodeFilename = codeFilename !== undefined && !path.isAbsolute(codeFilename) - ? path.join(process.cwd(), codeFilename) + ? path.join(cwd, codeFilename) : codeFilename; // if file is ignored, return nothing if ( absoluteCodeFilename && - !filterFilePaths(ignorer, [path.relative(process.cwd(), absoluteCodeFilename)]).length + !filterFilePaths(ignorer, [path.relative(cwd, absoluteCodeFilename)]).length ) { - return prepareReturnValue([], maxWarnings, formatterFunction); + return prepareReturnValue([], maxWarnings, formatterFunction, cwd); } let stylelintResult; @@ -140,7 +136,7 @@ async function standalone({ } const postcssResult = stylelintResult._postcssResult; - const returnValue = prepareReturnValue([stylelintResult], maxWarnings, formatterFunction); + const returnValue = prepareReturnValue([stylelintResult], maxWarnings, formatterFunction, cwd); if ( fix && @@ -160,8 +156,10 @@ async function standalone({ } let fileList = [files].flat().map((entry) => { - const cwd = (globbyOptions && globbyOptions.cwd) || process.cwd(); - const absolutePath = !path.isAbsolute(entry) ? path.join(cwd, entry) : path.normalize(entry); + const globCWD = (globbyOptions && globbyOptions.cwd) || cwd; + const absolutePath = !path.isAbsolute(entry) + ? path.join(globCWD, entry) + : path.normalize(entry); if (fs.existsSync(absolutePath)) { // This path points to a file. Return an escaped path to avoid globbing @@ -179,29 +177,36 @@ async function standalone({ const stylelintVersion = pkg.version; const hashOfConfig = hash(`${stylelintVersion}_${JSON.stringify(config || {})}`); - fileCache = new FileCache(cacheLocation, hashOfConfig); + fileCache = new FileCache(cacheLocation, cwd, hashOfConfig); } else { // No need to calculate hash here, we just want to delete cache file. - fileCache = new FileCache(cacheLocation); + fileCache = new FileCache(cacheLocation, cwd); // Remove cache file if cache option is disabled fileCache.destroy(); } - let filePaths = await globby(fileList, globbyOptions); + const effectiveGlobbyOptions = { + cwd, + ...(globbyOptions || {}), + absolute: true, + }; + + const globCWD = effectiveGlobbyOptions.cwd; + + let filePaths = await globby(fileList, effectiveGlobbyOptions); // The ignorer filter needs to check paths relative to cwd filePaths = filterFilePaths( ignorer, - filePaths.map((p) => path.relative(process.cwd(), p)), + filePaths.map((p) => path.relative(globCWD, p)), ); let stylelintResults; if (filePaths.length) { - const cwd = (globbyOptions && globbyOptions.cwd) || process.cwd(); let absoluteFilePaths = filePaths.map((filePath) => { const absoluteFilepath = !path.isAbsolute(filePath) - ? path.join(cwd, filePath) + ? path.join(globCWD, filePath) : path.normalize(filePath); return absoluteFilepath; @@ -265,7 +270,7 @@ async function standalone({ fileCache.reconcile(); } - const result = prepareReturnValue(stylelintResults, maxWarnings, formatterFunction); + const result = prepareReturnValue(stylelintResults, maxWarnings, formatterFunction, cwd); debug(`Linting complete in ${Date.now() - startTime}ms`); diff --git a/node_modules/stylelint/lib/utils/FileCache.js b/node_modules/stylelint/lib/utils/FileCache.js index 0474a6ce81..698b3105f1 100644 --- a/node_modules/stylelint/lib/utils/FileCache.js +++ b/node_modules/stylelint/lib/utils/FileCache.js @@ -16,8 +16,12 @@ const DEFAULT_HASH = ''; * @constructor */ class FileCache { - constructor(cacheLocation = DEFAULT_CACHE_LOCATION, hashOfConfig = DEFAULT_HASH) { - const cacheFile = path.resolve(getCacheFile(cacheLocation, process.cwd())); + constructor( + cacheLocation = DEFAULT_CACHE_LOCATION, + cwd = process.cwd(), + hashOfConfig = DEFAULT_HASH, + ) { + const cacheFile = path.resolve(getCacheFile(cacheLocation, cwd)); debug(`Cache file is created at ${cacheFile}`); this._fileCache = fileEntryCache.create(cacheFile); diff --git a/node_modules/stylelint/lib/utils/beforeBlockString.js b/node_modules/stylelint/lib/utils/beforeBlockString.js index b17b856abb..3ae78306b9 100644 --- a/node_modules/stylelint/lib/utils/beforeBlockString.js +++ b/node_modules/stylelint/lib/utils/beforeBlockString.js @@ -1,10 +1,9 @@ 'use strict'; -/** @typedef {import('postcss').Rule} Rule */ -/** @typedef {import('postcss').AtRule} AtRule */ +const { isAtRule, isRule } = require('./typeGuards'); /** - * @param {Rule | AtRule} statement + * @param {import('postcss').Container} statement * @returns {string} */ module.exports = function beforeBlockString(statement, { noRawBefore } = { noRawBefore: false }) { @@ -16,15 +15,12 @@ module.exports = function beforeBlockString(statement, { noRawBefore } = { noRaw result += before; } - switch (statement.type) { - case 'rule': - result += statement.selector; - break; - case 'atrule': - result += `@${statement.name}${statement.raws.afterName || ''}${statement.params}`; - break; - default: - return ''; + if (isRule(statement)) { + result += statement.selector; + } else if (isAtRule(statement)) { + result += `@${statement.name}${statement.raws.afterName || ''}${statement.params}`; + } else { + return ''; } result += statement.raws.between || ''; diff --git a/node_modules/stylelint/lib/utils/blockString.js b/node_modules/stylelint/lib/utils/blockString.js index 5a96442513..6ebd81a411 100644 --- a/node_modules/stylelint/lib/utils/blockString.js +++ b/node_modules/stylelint/lib/utils/blockString.js @@ -4,15 +4,12 @@ const beforeBlockString = require('./beforeBlockString'); const hasBlock = require('./hasBlock'); const rawNodeString = require('./rawNodeString'); -/** @typedef {import('postcss').Rule} Rule */ -/** @typedef {import('postcss').AtRule} AtRule */ - /** * Return a CSS statement's block -- the string that starts and `{` and ends with `}`. * * If the statement has no block (e.g. `@import url(foo.css);`), returns an empty string. * - * @param {Rule | AtRule} statement - postcss rule or at-rule node + * @param {import('postcss').Container} statement * @returns {string} */ module.exports = function blockString(statement) { diff --git a/node_modules/stylelint/lib/utils/checkAgainstRule.js b/node_modules/stylelint/lib/utils/checkAgainstRule.js index 494569e236..ef8a8b3135 100644 --- a/node_modules/stylelint/lib/utils/checkAgainstRule.js +++ b/node_modules/stylelint/lib/utils/checkAgainstRule.js @@ -48,7 +48,8 @@ function checkAgainstRule(options, callback) { /** @type {O} */ (settings[1]), {}, )(options.root, tmpPostcssResult); - tmpPostcssResult.warnings().forEach(callback); + + for (const warning of tmpPostcssResult.warnings()) callback(warning); } module.exports = /** @type {typeof import('stylelint').utils.checkAgainstRule} */ ( diff --git a/node_modules/stylelint/lib/utils/checkInvalidCLIOptions.js b/node_modules/stylelint/lib/utils/checkInvalidCLIOptions.js index 6f8bb5eee2..24099f9853 100644 --- a/node_modules/stylelint/lib/utils/checkInvalidCLIOptions.js +++ b/node_modules/stylelint/lib/utils/checkInvalidCLIOptions.js @@ -97,7 +97,7 @@ module.exports = function checkInvalidCLIOptions(allowedOptions, inputOptions) { return Object.keys(inputOptions) .filter((opt) => !allOptions.includes(opt)) - .map(kebabCase) + .map((opt) => kebabCase(opt)) .reduce((msg, invalid) => { // NOTE: No suggestion for shortcut options because it's too difficult const suggestion = invalid.length >= 2 ? suggest(allOptions, invalid) : null; diff --git a/node_modules/stylelint/lib/utils/configurationError.js b/node_modules/stylelint/lib/utils/configurationError.js index c65b083a5b..1e190c4a5e 100644 --- a/node_modules/stylelint/lib/utils/configurationError.js +++ b/node_modules/stylelint/lib/utils/configurationError.js @@ -1,13 +1,14 @@ 'use strict'; +/** @typedef {import('stylelint').ConfigurationError} ConfigurationError */ + /** * Create configurationError from text and set CLI exit code * @param {string} text - * @returns {Object} + * @returns {ConfigurationError} */ -module.exports = function (text) /* Object */ { - /** @type {Error & {code?: number}} */ - const err = new Error(text); +module.exports = function (text) { + const err = /** @type {ConfigurationError} */ (new Error(text)); err.code = 78; diff --git a/node_modules/stylelint/lib/utils/eachDeclarationBlock.js b/node_modules/stylelint/lib/utils/eachDeclarationBlock.js index 66fac80b8f..25f2b6930d 100644 --- a/node_modules/stylelint/lib/utils/eachDeclarationBlock.js +++ b/node_modules/stylelint/lib/utils/eachDeclarationBlock.js @@ -43,13 +43,13 @@ module.exports = function eachDeclarationBlock(root, callback) { /** @type {Declaration[]} */ const decls = []; - statement.nodes.forEach((node) => { + for (const node of statement.nodes) { if (node.type === 'decl') { decls.push(node); } each(node); - }); + } if (decls.length) { callback(decls.forEach.bind(decls)); diff --git a/node_modules/stylelint/lib/utils/getFileIgnorer.js b/node_modules/stylelint/lib/utils/getFileIgnorer.js index 3f9ecb557c..d0839876be 100644 --- a/node_modules/stylelint/lib/utils/getFileIgnorer.js +++ b/node_modules/stylelint/lib/utils/getFileIgnorer.js @@ -9,27 +9,26 @@ const isPathNotFoundError = require('./isPathNotFoundError'); const DEFAULT_IGNORE_FILENAME = '.stylelintignore'; -/** @typedef {import('stylelint').LinterOptions} StylelintOptions */ - /** - * @param {StylelintOptions} options + * @param {{ cwd: string, ignorePath?: string, ignorePattern?: string[] }} options * @return {import('ignore').Ignore} */ -module.exports = function (options) { +module.exports = function getFileIgnorer(options) { const ignoreFilePath = options.ignorePath || DEFAULT_IGNORE_FILENAME; const absoluteIgnoreFilePath = path.isAbsolute(ignoreFilePath) ? ignoreFilePath - : path.resolve(process.cwd(), ignoreFilePath); + : path.resolve(options.cwd, ignoreFilePath); let ignoreText = ''; try { ignoreText = fs.readFileSync(absoluteIgnoreFilePath, 'utf8'); } catch (readError) { - if (!isPathNotFoundError(readError)) throw readError; + if (!isPathNotFoundError(readError)) { + throw readError; + } } - const ignorePattern = options.ignorePattern || []; - const ignorer = ignore().add(ignoreText).add(ignorePattern); - - return ignorer; + return ignore() + .add(ignoreText) + .add(options.ignorePattern || []); }; diff --git a/node_modules/stylelint/lib/utils/getModulePath.js b/node_modules/stylelint/lib/utils/getModulePath.js index 68fa9b1ae7..8960279891 100644 --- a/node_modules/stylelint/lib/utils/getModulePath.js +++ b/node_modules/stylelint/lib/utils/getModulePath.js @@ -7,16 +7,17 @@ const resolveFrom = require('resolve-from'); /** * @param {string} basedir * @param {string} lookup + * @param {string} [cwd] * @return {string} */ -module.exports = function getModulePath(basedir, lookup) { +module.exports = function getModulePath(basedir, lookup, cwd = process.cwd()) { // 1. Try to resolve from the provided directory - // 2. Try to resolve from `process.cwd` + // 2. Try to resolve from `cwd` or `process.cwd()` // 3. Try to resolve from global `node_modules` directory let path = resolveFrom.silent(basedir, lookup); if (!path) { - path = resolveFrom.silent(process.cwd(), lookup); + path = resolveFrom.silent(cwd, lookup); } if (!path) { diff --git a/node_modules/stylelint/lib/utils/hasBlock.js b/node_modules/stylelint/lib/utils/hasBlock.js index 0873ec3a29..09e3b1f217 100644 --- a/node_modules/stylelint/lib/utils/hasBlock.js +++ b/node_modules/stylelint/lib/utils/hasBlock.js @@ -3,9 +3,9 @@ /** * Check if a statement has an block (empty or otherwise). * - * @param {import('postcss').Rule | import('postcss').AtRule} statement - postcss rule or at-rule node + * @param {import('postcss').Container} statement * @return {boolean} True if `statement` has a block (empty or otherwise) */ -module.exports = function (statement) { +module.exports = function hasBlock(statement) { return statement.nodes !== undefined; }; diff --git a/node_modules/stylelint/lib/utils/isStandardSyntaxColorFunction.js b/node_modules/stylelint/lib/utils/isStandardSyntaxColorFunction.js new file mode 100644 index 0000000000..734b2087cf --- /dev/null +++ b/node_modules/stylelint/lib/utils/isStandardSyntaxColorFunction.js @@ -0,0 +1,23 @@ +'use strict'; + +const isStandardSyntaxFunction = require('./isStandardSyntaxFunction'); + +/** + * Check whether a function is standard syntax color function + * + * @param {import('postcss-value-parser').FunctionNode} node + * @returns {boolean} + */ +module.exports = function isStandardSyntaxColorFunction(node) { + if (!isStandardSyntaxFunction(node)) return false; + + // scss can accept a #hex, or $var variables and we need to check all nested fn nodes + for (const fnNode of node.nodes) { + if (fnNode.type === 'function') return isStandardSyntaxColorFunction(fnNode); + + if (fnNode.type === 'word' && (fnNode.value.startsWith('#') || fnNode.value.startsWith('$'))) + return false; + } + + return true; +}; diff --git a/node_modules/stylelint/lib/utils/isStandardSyntaxDeclaration.js b/node_modules/stylelint/lib/utils/isStandardSyntaxDeclaration.js index 89894bde92..d8291befef 100644 --- a/node_modules/stylelint/lib/utils/isStandardSyntaxDeclaration.js +++ b/node_modules/stylelint/lib/utils/isStandardSyntaxDeclaration.js @@ -18,7 +18,6 @@ function isStandardSyntaxLang(lang) { module.exports = function (decl) { const prop = decl.prop; const parent = decl.parent; - const value = decl.value; // Declarations belong in a declaration block or standard CSS source if ( @@ -32,16 +31,11 @@ module.exports = function (decl) { return false; } - // SCSS var + // SCSS var; covers map and list declarations if (isScssVariable(prop)) { return false; } - // SCSS map and list declarations - if (value.startsWith('(') && value.endsWith(')')) { - return false; - } - // Less var (e.g. @var: x), but exclude variable interpolation (e.g. @{var}) if (prop[0] === '@' && prop[1] !== '{') { return false; @@ -52,6 +46,17 @@ module.exports = function (decl) { return false; } + // Less map (e.g. #my-map() { myprop: red; }) + if ( + parent && + isRule(parent) && + parent.selector && + parent.selector.startsWith('#') && + parent.selector.endsWith('()') + ) { + return false; + } + // Sass nested properties (e.g. border: { style: solid; color: red; }) if ( parent && diff --git a/node_modules/stylelint/lib/utils/isStandardSyntaxHexColor.js b/node_modules/stylelint/lib/utils/isStandardSyntaxHexColor.js new file mode 100644 index 0000000000..71a7581a99 --- /dev/null +++ b/node_modules/stylelint/lib/utils/isStandardSyntaxHexColor.js @@ -0,0 +1,16 @@ +'use strict'; + +/** + * Check whether a hex color is standard + * + * @param {string} hex + * @returns {boolean} + */ +module.exports = function isStandardSyntaxHexColor(hex) { + // Less map usage (e.g. .myclass { color: #colors[somecolor]; }) + if (hex.includes('[')) { + return false; + } + + return true; +}; diff --git a/node_modules/stylelint/lib/utils/typeGuards.js b/node_modules/stylelint/lib/utils/typeGuards.js index 7f41b2be1e..2bf6a4624e 100644 --- a/node_modules/stylelint/lib/utils/typeGuards.js +++ b/node_modules/stylelint/lib/utils/typeGuards.js @@ -43,6 +43,14 @@ module.exports.isDeclaration = function isDeclaration(node) { return node.type === 'decl'; }; +/** + * @param {import('postcss-value-parser').Node} node + * @returns {node is import('postcss-value-parser').FunctionNode} + */ +module.exports.isValueFunction = function isValueFunction(node) { + return node.type === 'function'; +}; + /** * @param {Node} node * @returns {node is (Node & {source: NodeSource})} diff --git a/node_modules/stylelint/lib/utils/validateOptions.js b/node_modules/stylelint/lib/utils/validateOptions.js index 12cc1393a6..f94a274315 100644 --- a/node_modules/stylelint/lib/utils/validateOptions.js +++ b/node_modules/stylelint/lib/utils/validateOptions.js @@ -32,9 +32,9 @@ const IGNORED_OPTIONS = new Set(['severity', 'message', 'reportDisables', 'disab function validateOptions(result, ruleName, ...optionDescriptions) { let noErrors = true; - optionDescriptions.forEach((optionDescription) => { + for (const optionDescription of optionDescriptions) { validate(optionDescription, ruleName, complain); - }); + } /** * @param {string} message diff --git a/node_modules/stylelint/lib/writeOutputFile.js b/node_modules/stylelint/lib/writeOutputFile.js index a495f45a1e..40590d7e0b 100644 --- a/node_modules/stylelint/lib/writeOutputFile.js +++ b/node_modules/stylelint/lib/writeOutputFile.js @@ -1,6 +1,7 @@ 'use strict'; const path = require('path'); +const { mkdir } = require('fs').promises; const stripAnsi = require('strip-ansi'); const writeFileAtomic = require('write-file-atomic'); @@ -10,4 +11,6 @@ const writeFileAtomic = require('write-file-atomic'); * @returns {Promise} */ module.exports = (content, filePath) => - writeFileAtomic(path.normalize(filePath), stripAnsi(content)); + mkdir(path.dirname(filePath), { recursive: true }).then(() => + writeFileAtomic(path.normalize(filePath), stripAnsi(content)), + ); diff --git a/node_modules/stylelint/package.json b/node_modules/stylelint/package.json index efa57d2ef2..5877174d49 100644 --- a/node_modules/stylelint/package.json +++ b/node_modules/stylelint/package.json @@ -1,6 +1,6 @@ { "name": "stylelint", - "version": "14.0.1", + "version": "14.2.0", "description": "A mighty, modern CSS linter.", "keywords": [ "css-in-js", @@ -35,7 +35,7 @@ "types/stylelint/index.d.ts" ], "scripts": { - "benchmark-rule": "node scripts/benchmark-rule.js", + "benchmark-rule": "node scripts/benchmark-rule.mjs", "format": "prettier . --write", "jest": "jest", "lint": "npm-run-all --parallel --continue-on-error lint:*", @@ -76,7 +76,7 @@ "collectCoverage": false, "collectCoverageFrom": [ "lib/**/*.js", - "!lib/vendor/**/*.js" + "!lib/**/{__tests__,testUtils}/**/*.js" ], "coverageDirectory": "./.coverage/", "coverageReporters": [ @@ -109,8 +109,9 @@ }, "dependencies": { "balanced-match": "^2.0.0", + "colord": "^2.9.2", "cosmiconfig": "^7.0.1", - "debug": "^4.3.2", + "debug": "^4.3.3", "execall": "^2.0.0", "fast-glob": "^3.2.7", "fastest-levenshtein": "^1.0.12", @@ -120,11 +121,11 @@ "globby": "^11.0.4", "globjoin": "^0.1.4", "html-tags": "^3.1.0", - "ignore": "^5.1.8", + "ignore": "^5.2.0", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", - "known-css-properties": "^0.23.0", + "known-css-properties": "^0.24.0", "mathml-tag-names": "^2.1.3", "meow": "^9.0.0", "micromatch": "^4.0.4", @@ -135,7 +136,7 @@ "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.6", + "postcss-selector-parser": "^6.0.7", "postcss-value-parser": "^4.1.0", "resolve-from": "^5.0.0", "specificity": "^0.4.1", @@ -143,7 +144,7 @@ "strip-ansi": "^6.0.1", "style-search": "^0.1.0", "svg-tags": "^1.0.0", - "table": "^6.7.2", + "table": "^6.7.5", "v8-compile-cache": "^2.3.0", "write-file-atomic": "^3.0.3" }, @@ -164,26 +165,28 @@ "@types/svg-tags": "^1.0.0", "@types/write-file-atomic": "^3.0.2", "benchmark": "^2.1.4", - "common-tags": "^1.8.0", + "common-tags": "^1.8.2", "deepmerge": "^4.2.2", - "eslint": "^7.32.0", - "eslint-config-stylelint": "^14.0.0", - "got": "^11.8.2", + "eslint": "^8.5.0", + "eslint-config-stylelint": "^15.0.0", + "eslint-plugin-jest": "^25.3.0", "husky": "^7.0.4", - "jest": "^27.3.1", - "jest-preset-stylelint": "^4.1.1", + "jest": "^27.4.5", + "jest-preset-stylelint": "^4.2.0", "jest-watch-typeahead": "^1.0.0", - "lint-staged": "^11.2.4", - "np": "^7.5.0", + "lint-staged": "^12.1.3", + "node-fetch": "^3.1.0", + "np": "^7.6.0", "npm-run-all": "^4.1.5", + "postcss-html": "^1.2.0", "postcss-import": "^14.0.2", "postcss-less": "^5.0.0", "postcss-sass": "^0.5.0", - "postcss-scss": "^4.0.1", - "prettier": "2.4.1", - "remark-cli": "^10.0.0", + "postcss-scss": "^4.0.2", + "prettier": "2.5.1", + "remark-cli": "^10.0.1", "sugarss": "^4.0.1", - "typescript": "^4.4.4" + "typescript": "^4.5.4" }, "engines": { "node": "^12.20.0 || ^14.13.1 || >=16.0.0" diff --git a/node_modules/stylelint/types/stylelint/index.d.ts b/node_modules/stylelint/types/stylelint/index.d.ts index d2914c1713..b7621476ad 100644 --- a/node_modules/stylelint/types/stylelint/index.d.ts +++ b/node_modules/stylelint/types/stylelint/index.d.ts @@ -30,6 +30,8 @@ declare module 'stylelint' { }; export type DisableSettings = ConfigRuleSettings; + export type ResultProcessor = (result: LintResult, file: string | undefined) => LintResult; + export type Config = { extends?: ConfigExtends; plugins?: ConfigPlugins; @@ -41,8 +43,8 @@ declare module 'stylelint' { ignoreFiles?: ConfigIgnoreFiles; ignorePatterns?: string; rules?: ConfigRules; - codeProcessors?: Function[]; - resultProcessors?: Function[]; + codeProcessors?: CodeProcessor[]; + resultProcessors?: ResultProcessor[]; quiet?: boolean; defaultSeverity?: Severity; ignoreDisables?: DisableSettings; @@ -67,6 +69,8 @@ declare module 'stylelint' { isEmpty?: boolean; } | null; + export type ConfigurationError = Error & { code: 78 }; + export type DisabledRange = { comment: PostCSS.Comment; start: number; @@ -161,11 +165,13 @@ declare module 'stylelint' { export type Plugin

= RuleBase; + export type CodeProcessor = (code: string, file: string | undefined) => string; + export type GetPostcssOptions = { code?: string; codeFilename?: string; filePath?: string; - codeProcessors?: Function[]; + codeProcessors?: CodeProcessor[]; syntax?: string; customSyntax?: CustomSyntax; }; @@ -184,6 +190,11 @@ declare module 'stylelint' { config?: Config; configFile?: string; configBasedir?: string; + /** + * The working directory to resolve files from. Defaults to the + * current working directory. + */ + cwd?: string; ignoreDisables?: boolean; ignorePath?: string; ignorePattern?: string[]; @@ -261,6 +272,11 @@ declare module 'stylelint' { }; export type LinterResult = { + /** + * The working directory from which the linter was run when the + * results were generated. + */ + cwd: string; results: LintResult[]; errored: boolean; output: any; @@ -308,6 +324,16 @@ declare module 'stylelint' { * @internal */ createLinter: (options: LinterOptions) => InternalApi; + /** + * Resolves the effective configuation for a given file. Resolves to + * `undefined` if no config is found. + * @param filePath - The path to the file to get the config for. + * @param options - The options to use when creating the Stylelint instance. + */ + resolveConfig: ( + filePath: string, + options?: Pick, + ) => Promise; utils: { /** * Report a problem. @@ -358,7 +384,7 @@ declare module 'stylelint' { * @internal */ export type InternalApi = { - _options: LinterOptions; + _options: LinterOptions & { cwd: string }; _extendExplorer: ReturnType; _specifiedConfigCache: Map>; _postcssResultCache: Map; diff --git a/node_modules/table/README.md b/node_modules/table/README.md index b96006e54f..a0f5147464 100644 --- a/node_modules/table/README.md +++ b/node_modules/table/README.md @@ -3,7 +3,7 @@ > Produces a string that represents array data in a text table. -[![Travis build status](http://img.shields.io/travis/gajus/table/master.svg?style=flat-square)](https://travis-ci.org/gajus/table) +[![Github action status](https://github.com/gajus/table/actions/workflows/main.yml/badge.svg)](https://github.com/gajus/table/actions) [![Coveralls](https://img.shields.io/coveralls/gajus/table.svg?style=flat-square)](https://coveralls.io/github/gajus/table) [![NPM version](http://img.shields.io/npm/v/table.svg?style=flat-square)](https://www.npmjs.org/package/table) [![Canonical Code Style](https://img.shields.io/badge/code%20style-canonical-blue.svg?style=flat-square)](https://github.com/gajus/canonical) @@ -548,6 +548,8 @@ Type: `object` Header configuration. +*Deprecated in favor of the new spanning cells API.* + The header configuration inherits the most of the column's, except: - `content` **{string}**: the header content. - `width:` calculate based on the content width automatically. @@ -589,6 +591,82 @@ console.log(table(data, config)); ``` + +##### config.spanningCells + +Type: `SpanningCellConfig[]` + +Spanning cells configuration. + +The configuration should be straightforward: just specify an array of minimal cell configurations including the position of top-left cell +and the number of columns and/or rows will be expanded from it. + +The content of overlap cells will be ignored to make the `data` shape be consistent. + +By default, the configuration of column that the top-left cell belongs to will be applied to the whole spanning cell, except: +* The `width` will be summed up of all spanning columns. +* The `paddingRight` will be received from the right-most column intentionally. + +Advances customized column-like styles can be configurable to each spanning cell to overwrite the default behavior. + +```js +const data = [ + ['Test Coverage Report', '', '', '', '', ''], + ['Module', 'Component', 'Test Cases', 'Failures', 'Durations', 'Success Rate'], + ['Services', 'User', '50', '30', '3m 7s', '60.0%'], + ['', 'Payment', '100', '80', '7m 15s', '80.0%'], + ['Subtotal', '', '150', '110', '10m 22s', '73.3%'], + ['Controllers', 'User', '24', '18', '1m 30s', '75.0%'], + ['', 'Payment', '30', '24', '50s', '80.0%'], + ['Subtotal', '', '54', '42', '2m 20s', '77.8%'], + ['Total', '', '204', '152', '12m 42s', '74.5%'], +]; + +const config = { + columns: [ + { alignment: 'center', width: 12 }, + { alignment: 'center', width: 10 }, + { alignment: 'right' }, + { alignment: 'right' }, + { alignment: 'right' }, + { alignment: 'right' } + ], + spanningCells: [ + { col: 0, row: 0, colSpan: 6 }, + { col: 0, row: 2, rowSpan: 2, verticalAlignment: 'middle'}, + { col: 0, row: 4, colSpan: 2, alignment: 'right'}, + { col: 0, row: 5, rowSpan: 2, verticalAlignment: 'middle'}, + { col: 0, row: 7, colSpan: 2, alignment: 'right' }, + { col: 0, row: 8, colSpan: 2, alignment: 'right' } + ], +}; + +console.log(table(data, config)); +``` + +``` +╔══════════════════════════════════════════════════════════════════════════════╗ +║ Test Coverage Report ║ +╟──────────────┬────────────┬────────────┬──────────┬───────────┬──────────────╢ +║ Module │ Component │ Test Cases │ Failures │ Durations │ Success Rate ║ +╟──────────────┼────────────┼────────────┼──────────┼───────────┼──────────────╢ +║ │ User │ 50 │ 30 │ 3m 7s │ 60.0% ║ +║ Services ├────────────┼────────────┼──────────┼───────────┼──────────────╢ +║ │ Payment │ 100 │ 80 │ 7m 15s │ 80.0% ║ +╟──────────────┴────────────┼────────────┼──────────┼───────────┼──────────────╢ +║ Subtotal │ 150 │ 110 │ 10m 22s │ 73.3% ║ +╟──────────────┬────────────┼────────────┼──────────┼───────────┼──────────────╢ +║ │ User │ 24 │ 18 │ 1m 30s │ 75.0% ║ +║ Controllers ├────────────┼────────────┼──────────┼───────────┼──────────────╢ +║ │ Payment │ 30 │ 24 │ 50s │ 80.0% ║ +╟──────────────┴────────────┼────────────┼──────────┼───────────┼──────────────╢ +║ Subtotal │ 54 │ 42 │ 2m 20s │ 77.8% ║ +╟───────────────────────────┼────────────┼──────────┼───────────┼──────────────╢ +║ Total │ 204 │ 152 │ 12m 42s │ 74.5% ║ +╚═══════════════════════════╧════════════╧══════════╧═══════════╧══════════════╝ +``` + + ### createStream diff --git a/node_modules/table/dist/alignTableData.js b/node_modules/table/dist/alignTableData.js deleted file mode 100644 index 5daa581a53..0000000000 --- a/node_modules/table/dist/alignTableData.js +++ /dev/null @@ -1,13 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.alignTableData = void 0; -const alignString_1 = require("./alignString"); -const alignTableData = (rows, config) => { - return rows.map((row) => { - return row.map((cell, cellIndex) => { - const { width, alignment } = config.columns[cellIndex]; - return alignString_1.alignString(cell, width, alignment); - }); - }); -}; -exports.alignTableData = alignTableData; diff --git a/node_modules/table/dist/calculateCellWidths.d.ts b/node_modules/table/dist/calculateCellWidths.d.ts deleted file mode 100644 index 677ca4e80f..0000000000 --- a/node_modules/table/dist/calculateCellWidths.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import type { Cell } from './types/internal'; -/** - * Calculates width of each cell contents in a row. - */ -export declare const calculateCellWidths: (cells: Cell[]) => number[]; diff --git a/node_modules/table/dist/calculateCellWidths.js b/node_modules/table/dist/calculateCellWidths.js deleted file mode 100644 index 684115dd5c..0000000000 --- a/node_modules/table/dist/calculateCellWidths.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.calculateCellWidths = void 0; -const string_width_1 = __importDefault(require("string-width")); -/** - * Calculates width of each cell contents in a row. - */ -const calculateCellWidths = (cells) => { - return cells.map((cell) => { - return Math.max(...cell.split('\n').map(string_width_1.default)); - }); -}; -exports.calculateCellWidths = calculateCellWidths; diff --git a/node_modules/table/dist/calculateColumnWidths.d.ts b/node_modules/table/dist/calculateColumnWidths.d.ts deleted file mode 100644 index 7d0b0065e5..0000000000 --- a/node_modules/table/dist/calculateColumnWidths.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { Row } from './types/internal'; -declare const _default: (rows: Row[]) => number[]; -/** - * Produces an array of values that describe the largest value length (width) in every column. - */ -export default _default; diff --git a/node_modules/table/dist/calculateColumnWidths.js b/node_modules/table/dist/calculateColumnWidths.js deleted file mode 100644 index b4f80a380a..0000000000 --- a/node_modules/table/dist/calculateColumnWidths.js +++ /dev/null @@ -1,16 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const calculateCellWidths_1 = require("./calculateCellWidths"); -/** - * Produces an array of values that describe the largest value length (width) in every column. - */ -exports.default = (rows) => { - const columnWidths = new Array(rows[0].length).fill(0); - rows.forEach((row) => { - const cellWidths = calculateCellWidths_1.calculateCellWidths(row); - cellWidths.forEach((cellWidth, cellIndex) => { - columnWidths[cellIndex] = Math.max(columnWidths[cellIndex], cellWidth); - }); - }); - return columnWidths; -}; diff --git a/node_modules/table/dist/calculateRowHeights.js b/node_modules/table/dist/calculateRowHeights.js deleted file mode 100644 index d3411f89ba..0000000000 --- a/node_modules/table/dist/calculateRowHeights.js +++ /dev/null @@ -1,18 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.calculateRowHeights = void 0; -const calculateCellHeight_1 = require("./calculateCellHeight"); -/** - * Produces an array of values that describe the largest value length (height) in every row. - */ -const calculateRowHeights = (rows, config) => { - return rows.map((row) => { - let rowHeight = 1; - row.forEach((cell, cellIndex) => { - const cellHeight = calculateCellHeight_1.calculateCellHeight(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord); - rowHeight = Math.max(rowHeight, cellHeight); - }); - return rowHeight; - }); -}; -exports.calculateRowHeights = calculateRowHeights; diff --git a/node_modules/table/dist/drawBorder.d.ts b/node_modules/table/dist/drawBorder.d.ts deleted file mode 100644 index 9ad5d282f0..0000000000 --- a/node_modules/table/dist/drawBorder.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -import type { DrawVerticalLine } from './types/api'; -import type { TableConfig, SeparatorGetter, TopBorderConfig, JoinBorderConfig, BottomBorderConfig } from './types/internal'; -declare type Separator = { - readonly left: string; - readonly right: string; - readonly body: string; - readonly join: string; -}; -declare const drawBorder: (columnWidths: number[], config: { - separator: Separator; - drawVerticalLine: DrawVerticalLine; -}) => string; -declare const drawBorderTop: (columnWidths: number[], config: { - border: TopBorderConfig; - drawVerticalLine: DrawVerticalLine; -}) => string; -declare const drawBorderJoin: (columnWidths: number[], config: { - border: JoinBorderConfig; - drawVerticalLine: DrawVerticalLine; -}) => string; -declare const drawBorderBottom: (columnWidths: number[], config: { - border: BottomBorderConfig; - drawVerticalLine: DrawVerticalLine; -}) => string; -export declare const createTableBorderGetter: (columnWidths: number[], config: TableConfig) => SeparatorGetter; -export { drawBorder, drawBorderBottom, drawBorderJoin, drawBorderTop, }; diff --git a/node_modules/table/dist/drawBorder.js b/node_modules/table/dist/drawBorder.js deleted file mode 100644 index 1b158d9667..0000000000 --- a/node_modules/table/dist/drawBorder.js +++ /dev/null @@ -1,100 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = exports.createTableBorderGetter = void 0; -const drawContent_1 = require("./drawContent"); -const drawBorder = (columnWidths, config) => { - const { separator, drawVerticalLine } = config; - const columns = columnWidths.map((size) => { - return config.separator.body.repeat(size); - }); - return drawContent_1.drawContent(columns, { - drawSeparator: drawVerticalLine, - separatorGetter: (index, columnCount) => { - if (index === 0) { - return separator.left; - } - if (index === columnCount) { - return separator.right; - } - return separator.join; - }, - }) + '\n'; -}; -exports.drawBorder = drawBorder; -const drawBorderTop = (columnWidths, config) => { - const result = drawBorder(columnWidths, { - ...config, - separator: { - body: config.border.topBody, - join: config.border.topJoin, - left: config.border.topLeft, - right: config.border.topRight, - }, - }); - if (result === '\n') { - return ''; - } - return result; -}; -exports.drawBorderTop = drawBorderTop; -const drawBorderJoin = (columnWidths, config) => { - return drawBorder(columnWidths, { - ...config, - separator: { - body: config.border.joinBody, - join: config.border.joinJoin, - left: config.border.joinLeft, - right: config.border.joinRight, - }, - }); -}; -exports.drawBorderJoin = drawBorderJoin; -const drawBorderBottom = (columnWidths, config) => { - return drawBorder(columnWidths, { - ...config, - separator: { - body: config.border.bottomBody, - join: config.border.bottomJoin, - left: config.border.bottomLeft, - right: config.border.bottomRight, - }, - }); -}; -exports.drawBorderBottom = drawBorderBottom; -const createTableBorderGetter = (columnWidths, config) => { - return (index, size) => { - if (!config.header) { - if (index === 0) { - return drawBorderTop(columnWidths, config); - } - if (index === size) { - return drawBorderBottom(columnWidths, config); - } - return drawBorderJoin(columnWidths, config); - } - // Deal with the header - if (index === 0) { - return drawBorderTop(columnWidths, { - ...config, - border: { - ...config.border, - topJoin: config.border.topBody, - }, - }); - } - if (index === 1) { - return drawBorderJoin(columnWidths, { - ...config, - border: { - ...config.border, - joinJoin: config.border.headerJoin, - }, - }); - } - if (index === size) { - return drawBorderBottom(columnWidths, config); - } - return drawBorderJoin(columnWidths, config); - }; -}; -exports.createTableBorderGetter = createTableBorderGetter; diff --git a/node_modules/table/dist/drawContent.d.ts b/node_modules/table/dist/drawContent.d.ts deleted file mode 100644 index 6785dfe5a3..0000000000 --- a/node_modules/table/dist/drawContent.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -declare type SeparatorConfig = { - drawSeparator: (index: number, size: number) => boolean; - separatorGetter: (index: number, size: number) => string; -}; -/** - * Shared function to draw horizontal borders, rows or the entire table - */ -export declare const drawContent: (contents: string[], separatorConfig: SeparatorConfig) => string; -export {}; diff --git a/node_modules/table/dist/drawContent.js b/node_modules/table/dist/drawContent.js deleted file mode 100644 index ce084dc530..0000000000 --- a/node_modules/table/dist/drawContent.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.drawContent = void 0; -/** - * Shared function to draw horizontal borders, rows or the entire table - */ -const drawContent = (contents, separatorConfig) => { - const { separatorGetter, drawSeparator } = separatorConfig; - const contentSize = contents.length; - const result = []; - if (drawSeparator(0, contentSize)) { - result.push(separatorGetter(0, contentSize)); - } - contents.forEach((content, contentIndex) => { - result.push(content); - // Only append the middle separator if the content is not the last - if (contentIndex + 1 < contentSize && drawSeparator(contentIndex + 1, contentSize)) { - result.push(separatorGetter(contentIndex + 1, contentSize)); - } - }); - if (drawSeparator(contentSize, contentSize)) { - result.push(separatorGetter(contentSize, contentSize)); - } - return result.join(''); -}; -exports.drawContent = drawContent; diff --git a/node_modules/table/dist/drawHeader.d.ts b/node_modules/table/dist/drawHeader.d.ts deleted file mode 100644 index 4407b38d7d..0000000000 --- a/node_modules/table/dist/drawHeader.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { TableConfig } from './types/internal'; -export declare const drawHeader: (width: number, config: TableConfig) => string; diff --git a/node_modules/table/dist/drawHeader.js b/node_modules/table/dist/drawHeader.js deleted file mode 100644 index 4ef46e9816..0000000000 --- a/node_modules/table/dist/drawHeader.js +++ /dev/null @@ -1,29 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.drawHeader = void 0; -const alignString_1 = require("./alignString"); -const drawRow_1 = require("./drawRow"); -const padTableData_1 = require("./padTableData"); -const truncateTableData_1 = require("./truncateTableData"); -const wrapCell_1 = require("./wrapCell"); -const drawHeader = (width, config) => { - if (!config.header) { - throw new Error('Can not draw header without header configuration'); - } - const { alignment, paddingRight, paddingLeft, wrapWord } = config.header; - let content = config.header.content; - content = truncateTableData_1.truncateString(content, config.header.truncate); - const headerLines = wrapCell_1.wrapCell(content, width, wrapWord); - return headerLines.map((headerLine) => { - let line = alignString_1.alignString(headerLine, width, alignment); - line = padTableData_1.padString(line, paddingLeft, paddingRight); - return drawRow_1.drawRow([line], { - ...config, - drawVerticalLine: (index) => { - const columnCount = config.columns.length; - return config.drawVerticalLine(index === 0 ? 0 : columnCount, columnCount); - }, - }); - }).join(''); -}; -exports.drawHeader = drawHeader; diff --git a/node_modules/table/dist/drawRow.d.ts b/node_modules/table/dist/drawRow.d.ts deleted file mode 100644 index 1a8e3ac6d5..0000000000 --- a/node_modules/table/dist/drawRow.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { DrawVerticalLine } from './types/api'; -import type { BodyBorderConfig, Row } from './types/internal'; -export declare const drawRow: (row: Row, config: { - border: BodyBorderConfig; - drawVerticalLine: DrawVerticalLine; -}) => string; diff --git a/node_modules/table/dist/drawTable.d.ts b/node_modules/table/dist/drawTable.d.ts deleted file mode 100644 index 357d6fef6f..0000000000 --- a/node_modules/table/dist/drawTable.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { TableConfig, Row } from './types/internal'; -export declare const drawTable: (rows: Row[], columnWidths: number[], rowHeights: number[], config: TableConfig) => string; diff --git a/node_modules/table/dist/drawTable.js b/node_modules/table/dist/drawTable.js deleted file mode 100644 index 60685dd95b..0000000000 --- a/node_modules/table/dist/drawTable.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.drawTable = void 0; -const string_width_1 = __importDefault(require("string-width")); -const drawBorder_1 = require("./drawBorder"); -const drawContent_1 = require("./drawContent"); -const drawHeader_1 = require("./drawHeader"); -const drawRow_1 = require("./drawRow"); -const utils_1 = require("./utils"); -const drawTable = (rows, columnWidths, rowHeights, config) => { - const { drawHorizontalLine, singleLine, } = config; - const contents = utils_1.groupBySizes(rows, rowHeights).map((group) => { - return group.map((row) => { - return drawRow_1.drawRow(row, config); - }).join(''); - }); - if (config.header) { - // assume that topLeft/right border have width = 1 - const headerWidth = string_width_1.default(drawRow_1.drawRow(rows[0], config)) - 2 - - config.header.paddingLeft - config.header.paddingRight; - const header = drawHeader_1.drawHeader(headerWidth, config); - contents.unshift(header); - } - return drawContent_1.drawContent(contents, { - drawSeparator: (index, size) => { - // Top/bottom border - if (index === 0 || index === size) { - return drawHorizontalLine(index, size); - } - return !singleLine && drawHorizontalLine(index, size); - }, - separatorGetter: drawBorder_1.createTableBorderGetter(columnWidths, config), - }); -}; -exports.drawTable = drawTable; diff --git a/node_modules/table/dist/makeTableConfig.d.ts b/node_modules/table/dist/makeTableConfig.d.ts deleted file mode 100644 index fe5bd9f63a..0000000000 --- a/node_modules/table/dist/makeTableConfig.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -import type { TableUserConfig } from './types/api'; -import type { Row, TableConfig } from './types/internal'; -/** - * Makes a new configuration object out of the userConfig object - * using default values for the missing configuration properties. - */ -export declare const makeTableConfig: (rows: Row[], userConfig?: TableUserConfig) => TableConfig; diff --git a/node_modules/table/dist/makeTableConfig.js b/node_modules/table/dist/makeTableConfig.js deleted file mode 100644 index e37dd75836..0000000000 --- a/node_modules/table/dist/makeTableConfig.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.makeTableConfig = void 0; -const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep")); -const calculateColumnWidths_1 = __importDefault(require("./calculateColumnWidths")); -const utils_1 = require("./utils"); -const validateConfig_1 = require("./validateConfig"); -/** - * Creates a configuration for every column using default - * values for the missing configuration properties. - */ -const makeColumnsConfig = (rows, columns, columnDefault) => { - const columnWidths = calculateColumnWidths_1.default(rows); - return rows[0].map((_, columnIndex) => { - return { - alignment: 'left', - paddingLeft: 1, - paddingRight: 1, - truncate: Number.POSITIVE_INFINITY, - verticalAlignment: 'top', - width: columnWidths[columnIndex], - wrapWord: false, - ...columnDefault, - ...columns === null || columns === void 0 ? void 0 : columns[columnIndex], - }; - }); -}; -const makeHeaderConfig = (config) => { - if (!config.header) { - return undefined; - } - return { - alignment: 'center', - paddingLeft: 1, - paddingRight: 1, - truncate: Number.POSITIVE_INFINITY, - wrapWord: false, - ...config.header, - }; -}; -/** - * Makes a new configuration object out of the userConfig object - * using default values for the missing configuration properties. - */ -const makeTableConfig = (rows, userConfig = {}) => { - var _a, _b, _c; - validateConfig_1.validateConfig('config.json', userConfig); - const config = lodash_clonedeep_1.default(userConfig); - return { - ...config, - border: utils_1.makeBorderConfig(config.border), - columns: makeColumnsConfig(rows, config.columns, config.columnDefault), - drawHorizontalLine: (_a = config.drawHorizontalLine) !== null && _a !== void 0 ? _a : (() => { - return true; - }), - drawVerticalLine: (_b = config.drawVerticalLine) !== null && _b !== void 0 ? _b : (() => { - return true; - }), - header: makeHeaderConfig(config), - singleLine: (_c = config.singleLine) !== null && _c !== void 0 ? _c : false, - }; -}; -exports.makeTableConfig = makeTableConfig; diff --git a/node_modules/table/dist/mapDataUsingRowHeights.d.ts b/node_modules/table/dist/mapDataUsingRowHeights.d.ts deleted file mode 100644 index 38c9bbb160..0000000000 --- a/node_modules/table/dist/mapDataUsingRowHeights.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import type { BaseConfig, Row } from './types/internal'; -export declare const mapDataUsingRowHeights: (unmappedRows: Row[], rowHeights: number[], config: BaseConfig) => Row[]; diff --git a/node_modules/table/dist/src/alignSpanningCell.d.ts b/node_modules/table/dist/src/alignSpanningCell.d.ts new file mode 100644 index 0000000000..a1b6e29d96 --- /dev/null +++ b/node_modules/table/dist/src/alignSpanningCell.d.ts @@ -0,0 +1,7 @@ +import type { SpanningCellContext } from './spanningCellManager'; +import type { RangeConfig } from './types/internal'; +/** + * Fill content into all cells in range in order to calculate total height + */ +export declare const wrapRangeContent: (rangeConfig: RangeConfig, rangeWidth: number, context: SpanningCellContext) => string[]; +export declare const alignVerticalRangeContent: (range: RangeConfig, content: string[], context: SpanningCellContext) => string[]; diff --git a/node_modules/table/dist/src/alignSpanningCell.js b/node_modules/table/dist/src/alignSpanningCell.js new file mode 100644 index 0000000000..09e0325e26 --- /dev/null +++ b/node_modules/table/dist/src/alignSpanningCell.js @@ -0,0 +1,44 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.alignVerticalRangeContent = exports.wrapRangeContent = void 0; +const alignString_1 = require("./alignString"); +const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights"); +const padTableData_1 = require("./padTableData"); +const truncateTableData_1 = require("./truncateTableData"); +const utils_1 = require("./utils"); +const wrapCell_1 = require("./wrapCell"); +/** + * Fill content into all cells in range in order to calculate total height + */ +const wrapRangeContent = (rangeConfig, rangeWidth, context) => { + const { topLeft, paddingRight, paddingLeft, truncate, wrapWord, alignment } = rangeConfig; + const originalContent = context.rows[topLeft.row][topLeft.col]; + const contentWidth = rangeWidth - paddingLeft - paddingRight; + return (0, wrapCell_1.wrapCell)((0, truncateTableData_1.truncateString)(originalContent, truncate), contentWidth, wrapWord).map((line) => { + const alignedLine = (0, alignString_1.alignString)(line, contentWidth, alignment); + return (0, padTableData_1.padString)(alignedLine, paddingLeft, paddingRight); + }); +}; +exports.wrapRangeContent = wrapRangeContent; +const alignVerticalRangeContent = (range, content, context) => { + const { rows, drawHorizontalLine, rowHeights } = context; + const { topLeft, bottomRight, verticalAlignment } = range; + // They are empty before calculateRowHeights function run + if (rowHeights.length === 0) { + return []; + } + const totalCellHeight = (0, utils_1.sumArray)(rowHeights.slice(topLeft.row, bottomRight.row + 1)); + const totalBorderHeight = bottomRight.row - topLeft.row; + const hiddenHorizontalBorderCount = (0, utils_1.sequence)(topLeft.row + 1, bottomRight.row).filter((horizontalBorderIndex) => { + return !drawHorizontalLine(horizontalBorderIndex, rows.length); + }).length; + const availableRangeHeight = totalCellHeight + totalBorderHeight - hiddenHorizontalBorderCount; + return (0, mapDataUsingRowHeights_1.padCellVertically)(content, availableRangeHeight, verticalAlignment).map((line) => { + if (line.length === 0) { + return ' '.repeat(content[0].length); + } + return line; + }); +}; +exports.alignVerticalRangeContent = alignVerticalRangeContent; +//# sourceMappingURL=alignSpanningCell.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/alignSpanningCell.js.map b/node_modules/table/dist/src/alignSpanningCell.js.map new file mode 100644 index 0000000000..dbbfaa4f90 --- /dev/null +++ b/node_modules/table/dist/src/alignSpanningCell.js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;QAC3B,OAAO,EAAE,CAAC;KACX;IAED,MAAM,eAAe,GAAG,IAAA,gBAAQ,EAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;IACrF,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IACxD,MAAM,2BAA2B,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,GAAG,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,qBAAqB,EAAE,EAAE;QAC9G,OAAO,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC,MAAM,CAAC;IAEV,MAAM,oBAAoB,GAAG,eAAe,GAAG,iBAAiB,GAAG,2BAA2B,CAAC;IAE/F,OAAO,IAAA,0CAAiB,EAAC,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACtF,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACrB,OAAO,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;SACtC;QAED,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAxBW,QAAA,yBAAyB,6BAwBpC"} \ No newline at end of file diff --git a/node_modules/table/dist/alignString.d.ts b/node_modules/table/dist/src/alignString.d.ts similarity index 100% rename from node_modules/table/dist/alignString.d.ts rename to node_modules/table/dist/src/alignString.d.ts diff --git a/node_modules/table/dist/alignString.js b/node_modules/table/dist/src/alignString.js similarity index 88% rename from node_modules/table/dist/alignString.js rename to node_modules/table/dist/src/alignString.js index 61dc552c94..a15231a289 100644 --- a/node_modules/table/dist/alignString.js +++ b/node_modules/table/dist/src/alignString.js @@ -16,11 +16,11 @@ const alignCenter = (subject, width) => { return ' '.repeat(Math.floor(width / 2)) + subject + ' '.repeat(Math.ceil(width / 2)); }; const alignJustify = (subject, width) => { - const spaceSequenceCount = utils_1.countSpaceSequence(subject); + const spaceSequenceCount = (0, utils_1.countSpaceSequence)(subject); if (spaceSequenceCount === 0) { return alignLeft(subject, width); } - const addingSpaces = utils_1.distributeUnevenly(width, spaceSequenceCount); + const addingSpaces = (0, utils_1.distributeUnevenly)(width, spaceSequenceCount); if (Math.max(...addingSpaces) > 3) { return alignLeft(subject, width); } @@ -34,7 +34,7 @@ const alignJustify = (subject, width) => { * text in a desired alignment within a container. */ const alignString = (subject, containerWidth, alignment) => { - const subjectWidth = string_width_1.default(subject); + const subjectWidth = (0, string_width_1.default)(subject); if (subjectWidth === containerWidth) { return subject; } @@ -57,3 +57,4 @@ const alignString = (subject, containerWidth, alignment) => { return alignCenter(subject, availableWidth); }; exports.alignString = alignString; +//# sourceMappingURL=alignString.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/alignString.js.map b/node_modules/table/dist/src/alignString.js.map new file mode 100644 index 0000000000..8324952e3c --- /dev/null +++ b/node_modules/table/dist/src/alignString.js.map @@ -0,0 +1 @@ +{"version":3,"file":"alignString.js","sourceRoot":"","sources":["../../src/alignString.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AAIvC,mCAEiB;AAEjB,MAAM,SAAS,GAAG,CAAC,OAAe,EAAE,KAAa,EAAU,EAAE;IAC3D,OAAO,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,KAAa,EAAU,EAAE;IAC5D,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,OAAe,EAAE,KAAa,EAAU,EAAE;IAC7D,OAAO,GAAG,CAAC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CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;KACnC;IAED,MAAM,cAAc,GAAG,cAAc,GAAG,YAAY,CAAC;IAErD,IAAI,SAAS,KAAK,MAAM,EAAE;QACxB,OAAO,SAAS,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;KAC3C;IAED,IAAI,SAAS,KAAK,OAAO,EAAE;QACzB,OAAO,UAAU,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;KAC5C;IAED,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,OAAO,YAAY,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;KAC9C;IAED,OAAO,WAAW,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAC9C,CAAC,CAAC;AA9BW,QAAA,WAAW,eA8BtB"} \ No newline at end of file diff --git a/node_modules/table/dist/alignTableData.d.ts b/node_modules/table/dist/src/alignTableData.d.ts similarity index 100% rename from node_modules/table/dist/alignTableData.d.ts rename to node_modules/table/dist/src/alignTableData.d.ts diff --git a/node_modules/table/dist/src/alignTableData.js b/node_modules/table/dist/src/alignTableData.js new file mode 100644 index 0000000000..942cb3b790 --- /dev/null +++ b/node_modules/table/dist/src/alignTableData.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.alignTableData = void 0; +const alignString_1 = require("./alignString"); +const alignTableData = (rows, config) => { + return rows.map((row, rowIndex) => { + return row.map((cell, cellIndex) => { + var _a; + const { width, alignment } = config.columns[cellIndex]; + const containingRange = (_a = config.spanningCellManager) === null || _a === void 0 ? void 0 : _a.getContainingRange({ col: cellIndex, + row: rowIndex }, { mapped: true }); + if (containingRange) { + return cell; + } + return (0, alignString_1.alignString)(cell, width, alignment); + }); + }); +}; +exports.alignTableData = alignTableData; +//# sourceMappingURL=alignTableData.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/alignTableData.js.map b/node_modules/table/dist/src/alignTableData.js.map new file mode 100644 index 0000000000..c7a9ba3d4e --- /dev/null +++ b/node_modules/table/dist/src/alignTableData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"alignTableData.js","sourceRoot":"","sources":["../../src/alignTableData.ts"],"names":[],"mappings":";;;AAAA,+CAEuB;AAMhB,MAAM,cAAc,GAAG,CAAC,IAAW,EAAE,MAAkB,EAAS,EAAE;IACvE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;QAChC,OAAO,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;;YACjC,MAAM,EAAC,KAAK,EAAE,SAAS,EAAC,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAErD,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,mBAAmB,0CAAE,kBAAkB,CAAC,EAAC,GAAG,EAAE,SAAS;gBACpF,GAAG,EAAE,QAAQ,EAAC,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;YAClC,IAAI,eAAe,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;YAED,OAAO,IAAA,yBAAW,EAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAdW,QAAA,cAAc,kBAczB"} \ No newline at end of file diff --git a/node_modules/table/dist/calculateCellHeight.d.ts b/node_modules/table/dist/src/calculateCellHeight.d.ts similarity index 100% rename from node_modules/table/dist/calculateCellHeight.d.ts rename to node_modules/table/dist/src/calculateCellHeight.d.ts diff --git a/node_modules/table/dist/calculateCellHeight.js b/node_modules/table/dist/src/calculateCellHeight.js similarity index 75% rename from node_modules/table/dist/calculateCellHeight.js rename to node_modules/table/dist/src/calculateCellHeight.js index 372943ad58..010c41f07b 100644 --- a/node_modules/table/dist/calculateCellHeight.js +++ b/node_modules/table/dist/src/calculateCellHeight.js @@ -6,6 +6,7 @@ const wrapCell_1 = require("./wrapCell"); * Calculates height of cell content in regard to its width and word wrapping. */ const calculateCellHeight = (value, columnWidth, useWrapWord = false) => { - return wrapCell_1.wrapCell(value, columnWidth, useWrapWord).length; + return (0, wrapCell_1.wrapCell)(value, columnWidth, useWrapWord).length; }; exports.calculateCellHeight = calculateCellHeight; +//# sourceMappingURL=calculateCellHeight.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/calculateCellHeight.js.map b/node_modules/table/dist/src/calculateCellHeight.js.map new file mode 100644 index 0000000000..61af121080 --- /dev/null +++ b/node_modules/table/dist/src/calculateCellHeight.js.map @@ -0,0 +1 @@ +{"version":3,"file":"calculateCellHeight.js","sourceRoot":"","sources":["../../src/calculateCellHeight.ts"],"names":[],"mappings":";;;AAAA,yCAEoB;AAEpB;;GAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,KAAa,EAAE,WAAmB,EAAE,WAAW,GAAG,KAAK,EAAU,EAAE;IACrG,OAAO,IAAA,mBAAQ,EAAC,KAAK,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,MAAM,CAAC;AAC1D,CAAC,CAAC;AAFW,QAAA,mBAAmB,uBAE9B"} \ No newline at end of file diff --git a/node_modules/table/dist/src/calculateMaximumColumnWidths.d.ts b/node_modules/table/dist/src/calculateMaximumColumnWidths.d.ts new file mode 100644 index 0000000000..d1de524b67 --- /dev/null +++ b/node_modules/table/dist/src/calculateMaximumColumnWidths.d.ts @@ -0,0 +1,7 @@ +import type { SpanningCellConfig } from './types/api'; +import type { Row, Cell } from './types/internal'; +export declare const calculateMaximumCellWidth: (cell: Cell) => number; +/** + * Produces an array of values that describe the largest value length (width) in every column. + */ +export declare const calculateMaximumColumnWidths: (rows: Row[], spanningCellConfigs?: SpanningCellConfig[]) => number[]; diff --git a/node_modules/table/dist/src/calculateMaximumColumnWidths.js b/node_modules/table/dist/src/calculateMaximumColumnWidths.js new file mode 100644 index 0000000000..5b677ed9d0 --- /dev/null +++ b/node_modules/table/dist/src/calculateMaximumColumnWidths.js @@ -0,0 +1,36 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.calculateMaximumColumnWidths = exports.calculateMaximumCellWidth = void 0; +const string_width_1 = __importDefault(require("string-width")); +const utils_1 = require("./utils"); +const calculateMaximumCellWidth = (cell) => { + return Math.max(...cell.split('\n').map(string_width_1.default)); +}; +exports.calculateMaximumCellWidth = calculateMaximumCellWidth; +/** + * Produces an array of values that describe the largest value length (width) in every column. + */ +const calculateMaximumColumnWidths = (rows, spanningCellConfigs = []) => { + const columnWidths = new Array(rows[0].length).fill(0); + const rangeCoordinates = spanningCellConfigs.map(utils_1.calculateRangeCoordinate); + const isSpanningCell = (rowIndex, columnIndex) => { + return rangeCoordinates.some((rangeCoordinate) => { + return (0, utils_1.isCellInRange)({ col: columnIndex, + row: rowIndex }, rangeCoordinate); + }); + }; + rows.forEach((row, rowIndex) => { + row.forEach((cell, cellIndex) => { + if (isSpanningCell(rowIndex, cellIndex)) { + return; + } + columnWidths[cellIndex] = Math.max(columnWidths[cellIndex], (0, exports.calculateMaximumCellWidth)(cell)); + }); + }); + return columnWidths; +}; +exports.calculateMaximumColumnWidths = calculateMaximumColumnWidths; +//# sourceMappingURL=calculateMaximumColumnWidths.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/calculateMaximumColumnWidths.js.map b/node_modules/table/dist/src/calculateMaximumColumnWidths.js.map new file mode 100644 index 0000000000..5cb01fc2ea --- /dev/null +++ b/node_modules/table/dist/src/calculateMaximumColumnWidths.js.map @@ -0,0 +1 @@ +{"version":3,"file":"calculateMaximumColumnWidths.js","sourceRoot":"","sources":["../../src/calculateMaximumColumnWidths.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AAQvC,mCAEiB;AAEV,MAAM,yBAAyB,GAAG,CAAC,IAAU,EAAU,EAAE;IAC9D,OAAO,IAAI,CAAC,GAAG,CACb,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,sBAAW,CAAC,CACrC,CAAC;AACJ,CAAC,CAAC;AAJW,QAAA,yBAAyB,6BAIpC;AAEF;;GAEG;AACI,MAAM,4BAA4B,GAAG,CAAC,IAAW,EAAE,sBAA4C,EAAE,EAAY,EAAE;IACpH,MAAM,YAAY,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACvD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC,gCAAwB,CAAC,CAAC;IAC3E,MAAM,cAAc,GAAG,CAAC,QAAgB,EAAE,WAAmB,EAAW,EAAE;QACxE,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,eAAe,EAAE,EAAE;YAC/C,OAAO,IAAA,qBAAa,EAAC,EAAC,GAAG,EAAE,WAAW;gBACpC,GAAG,EAAE,QAAQ,EAAC,EAAE,eAAe,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE;QAC7B,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;YAC9B,IAAI,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,EAAE;gBACvC,OAAO;aACR;YACD,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAA,iCAAyB,EAAC,IAAI,CAAC,CAAC,CAAC;QAC/F,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AApBW,QAAA,4BAA4B,gCAoBvC"} \ No newline at end of file diff --git a/node_modules/table/dist/src/calculateOutputColumnWidths.d.ts b/node_modules/table/dist/src/calculateOutputColumnWidths.d.ts new file mode 100644 index 0000000000..f16bb54ef4 --- /dev/null +++ b/node_modules/table/dist/src/calculateOutputColumnWidths.d.ts @@ -0,0 +1,2 @@ +import type { TableConfig } from './types/internal'; +export declare const calculateOutputColumnWidths: (config: TableConfig) => number[]; diff --git a/node_modules/table/dist/src/calculateOutputColumnWidths.js b/node_modules/table/dist/src/calculateOutputColumnWidths.js new file mode 100644 index 0000000000..7a4192973b --- /dev/null +++ b/node_modules/table/dist/src/calculateOutputColumnWidths.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.calculateOutputColumnWidths = void 0; +const calculateOutputColumnWidths = (config) => { + return config.columns.map((col) => { + return col.paddingLeft + col.width + col.paddingRight; + }); +}; +exports.calculateOutputColumnWidths = calculateOutputColumnWidths; +//# sourceMappingURL=calculateOutputColumnWidths.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/calculateOutputColumnWidths.js.map b/node_modules/table/dist/src/calculateOutputColumnWidths.js.map new file mode 100644 index 0000000000..dafe77481d --- /dev/null +++ b/node_modules/table/dist/src/calculateOutputColumnWidths.js.map @@ -0,0 +1 @@ +{"version":3,"file":"calculateOutputColumnWidths.js","sourceRoot":"","sources":["../../src/calculateOutputColumnWidths.ts"],"names":[],"mappings":";;;AAIO,MAAM,2BAA2B,GAAG,CAAC,MAAmB,EAAY,EAAE;IAC3E,OAAO,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QAChC,OAAO,GAAG,CAAC,WAAW,GAAG,GAAG,CAAC,KAAK,GAAG,GAAG,CAAC,YAAY,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAJW,QAAA,2BAA2B,+BAItC"} \ No newline at end of file diff --git a/node_modules/table/dist/calculateRowHeights.d.ts b/node_modules/table/dist/src/calculateRowHeights.d.ts similarity index 100% rename from node_modules/table/dist/calculateRowHeights.d.ts rename to node_modules/table/dist/src/calculateRowHeights.d.ts diff --git a/node_modules/table/dist/src/calculateRowHeights.js b/node_modules/table/dist/src/calculateRowHeights.js new file mode 100644 index 0000000000..72ec05a483 --- /dev/null +++ b/node_modules/table/dist/src/calculateRowHeights.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.calculateRowHeights = void 0; +const calculateCellHeight_1 = require("./calculateCellHeight"); +const utils_1 = require("./utils"); +/** + * Produces an array of values that describe the largest value length (height) in every row. + */ +const calculateRowHeights = (rows, config) => { + const rowHeights = []; + for (const [rowIndex, row] of rows.entries()) { + let rowHeight = 1; + row.forEach((cell, cellIndex) => { + var _a; + const containingRange = (_a = config.spanningCellManager) === null || _a === void 0 ? void 0 : _a.getContainingRange({ col: cellIndex, + row: rowIndex }); + if (!containingRange) { + const cellHeight = (0, calculateCellHeight_1.calculateCellHeight)(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord); + rowHeight = Math.max(rowHeight, cellHeight); + return; + } + const { topLeft, bottomRight, height } = containingRange; + // bottom-most cell of a range needs to contain all remain lines of spanning cells + if (rowIndex === bottomRight.row) { + const totalOccupiedSpanningCellHeight = (0, utils_1.sumArray)(rowHeights.slice(topLeft.row)); + const totalHorizontalBorderHeight = bottomRight.row - topLeft.row; + const totalHiddenHorizontalBorderHeight = (0, utils_1.sequence)(topLeft.row + 1, bottomRight.row).filter((horizontalBorderIndex) => { + var _a; + /* istanbul ignore next */ + return !((_a = config.drawHorizontalLine) === null || _a === void 0 ? void 0 : _a.call(config, horizontalBorderIndex, rows.length)); + }).length; + const cellHeight = height - totalOccupiedSpanningCellHeight - totalHorizontalBorderHeight + totalHiddenHorizontalBorderHeight; + rowHeight = Math.max(rowHeight, cellHeight); + } + // otherwise, just depend on other sibling cell heights in the row + }); + rowHeights.push(rowHeight); + } + return rowHeights; +}; +exports.calculateRowHeights = calculateRowHeights; +//# sourceMappingURL=calculateRowHeights.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/calculateRowHeights.js.map b/node_modules/table/dist/src/calculateRowHeights.js.map new file mode 100644 index 0000000000..1a7a2d96ae --- /dev/null +++ b/node_modules/table/dist/src/calculateRowHeights.js.map @@ -0,0 +1 @@ +{"version":3,"file":"calculateRowHeights.js","sourceRoot":"","sources":["../../src/calculateRowHeights.ts"],"names":[],"mappings":";;;AAAA,+DAE+B;AAK/B,mCAGiB;AAEjB;;GAEG;AACI,MAAM,mBAAmB,GAAG,CAAC,IAAW,EAAE,MAAkB,EAAY,EAAE;IAC/E,MAAM,UAAU,GAAa,EAAE,CAAC;IAEhC,KAAK,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;QAC5C,IAAI,SAAS,GAAG,CAAC,CAAC;QAElB,GAAG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;;YAC9B,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,mBAAmB,0CAAE,kBAAkB,CAAC,EAAC,GAAG,EAAE,SAAS;gBACpF,GAAG,EAAE,QAAQ,EAAC,CAAC,CAAC;YAElB,IAAI,CAAC,eAAe,EAAE;gBACpB,MAAM,UAAU,GAAG,IAAA,yCAAmB,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;gBAClH,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;gBAE5C,OAAO;aACR;YACD,MAAM,EAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAC,GAAG,eAAe,CAAC;YAEvD,kFAAkF;YAClF,IAAI,QAAQ,KAAK,WAAW,CAAC,GAAG,EAAE;gBAChC,MAAM,+BAA+B,GAAG,IAAA,gBAAQ,EAAC,UAAU,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;gBAChF,MAAM,2BAA2B,GAAG,WAAW,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;gBAClE,MAAM,iCAAiC,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,GAAG,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,qBAAqB,EAAE,EAAE;;oBACpH,0BAA0B;oBAC1B,OAAO,CAAC,CAAA,MAAA,MAAM,CAAC,kBAAkB,+CAAzB,MAAM,EAAsB,qBAAqB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA,CAAC;gBAC1E,CAAC,CAAC,CAAC,MAAM,CAAC;gBAEV,MAAM,UAAU,GAAG,MAAM,GAAG,+BAA+B,GAAG,2BAA2B,GAAG,iCAAiC,CAAC;gBAC9H,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;aAC7C;YAED,kEAAkE;QACpE,CAAC,CAAC,CAAC;QAEH,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;KAC5B;IAED,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC;AAtCW,QAAA,mBAAmB,uBAsC9B"} \ No newline at end of file diff --git a/node_modules/table/dist/src/calculateSpanningCellWidth.d.ts b/node_modules/table/dist/src/calculateSpanningCellWidth.d.ts new file mode 100644 index 0000000000..8a2820ddbb --- /dev/null +++ b/node_modules/table/dist/src/calculateSpanningCellWidth.d.ts @@ -0,0 +1,3 @@ +import type { SpanningCellParameters } from './spanningCellManager'; +import type { RangeConfig } from './types/internal'; +export declare const calculateSpanningCellWidth: (rangeConfig: RangeConfig, dependencies: SpanningCellParameters) => number; diff --git a/node_modules/table/dist/src/calculateSpanningCellWidth.js b/node_modules/table/dist/src/calculateSpanningCellWidth.js new file mode 100644 index 0000000000..fc8866c030 --- /dev/null +++ b/node_modules/table/dist/src/calculateSpanningCellWidth.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.calculateSpanningCellWidth = void 0; +const utils_1 = require("./utils"); +const calculateSpanningCellWidth = (rangeConfig, dependencies) => { + const { columnsConfig, drawVerticalLine } = dependencies; + const { topLeft, bottomRight } = rangeConfig; + const totalWidth = (0, utils_1.sumArray)(columnsConfig.slice(topLeft.col, bottomRight.col + 1).map(({ width }) => { + return width; + })); + const totalPadding = topLeft.col === bottomRight.col ? + columnsConfig[topLeft.col].paddingRight + + columnsConfig[bottomRight.col].paddingLeft : + (0, utils_1.sumArray)(columnsConfig + .slice(topLeft.col, bottomRight.col + 1) + .map(({ paddingLeft, paddingRight }) => { + return paddingLeft + paddingRight; + })); + const totalBorderWidths = bottomRight.col - topLeft.col; + const totalHiddenVerticalBorders = (0, utils_1.sequence)(topLeft.col + 1, bottomRight.col).filter((verticalBorderIndex) => { + return !drawVerticalLine(verticalBorderIndex, columnsConfig.length); + }).length; + return totalWidth + totalPadding + totalBorderWidths - totalHiddenVerticalBorders; +}; +exports.calculateSpanningCellWidth = calculateSpanningCellWidth; +//# sourceMappingURL=calculateSpanningCellWidth.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/calculateSpanningCellWidth.js.map b/node_modules/table/dist/src/calculateSpanningCellWidth.js.map new file mode 100644 index 0000000000..b0de977a06 --- /dev/null +++ b/node_modules/table/dist/src/calculateSpanningCellWidth.js.map @@ -0,0 +1 @@ +{"version":3,"file":"calculateSpanningCellWidth.js","sourceRoot":"","sources":["../../src/calculateSpanningCellWidth.ts"],"names":[],"mappings":";;;AAMA,mCAEiB;AAEV,MAAM,0BAA0B,GAAG,CAAC,WAAwB,EAAE,YAAoC,EAAU,EAAE;IACnH,MAAM,EAAC,aAAa,EAAE,gBAAgB,EAAC,GAAG,YAAY,CAAC;IACvD,MAAM,EAAC,OAAO,EAAE,WAAW,EAAC,GAAG,WAAW,CAAC;IAE3C,MAAM,UAAU,GAAG,IAAA,gBAAQ,EACzB,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;QACpE,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,YAAY,GAChB,OAAO,CAAC,GAAG,KAAK,WAAW,CAAC,GAAG,CAAC,CAAC;QAC/B,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,YAAY;YACvC,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC;QAC5C,IAAA,gBAAQ,EACN,aAAa;aACV,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,WAAW,CAAC,GAAG,GAAG,CAAC,CAAC;aACvC,GAAG,CAAC,CAAC,EAAC,WAAW,EAAE,YAAY,EAAC,EAAE,EAAE;YACnC,OAAO,WAAW,GAAG,YAAY,CAAC;QACpC,CAAC,CAAC,CACL,CAAC;IACN,MAAM,iBAAiB,GAAG,WAAW,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAExD,MAAM,0BAA0B,GAAG,IAAA,gBAAQ,EAAC,OAAO,CAAC,GAAG,GAAG,CAAC,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,mBAAmB,EAAE,EAAE;QAC3G,OAAO,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC,MAAM,CAAC;IAEV,OAAO,UAAU,GAAG,YAAY,GAAG,iBAAiB,GAAG,0BAA0B,CAAC;AACpF,CAAC,CAAC;AA5BW,QAAA,0BAA0B,8BA4BrC"} \ No newline at end of file diff --git a/node_modules/table/dist/createStream.d.ts b/node_modules/table/dist/src/createStream.d.ts similarity index 100% rename from node_modules/table/dist/createStream.d.ts rename to node_modules/table/dist/src/createStream.d.ts diff --git a/node_modules/table/dist/createStream.js b/node_modules/table/dist/src/createStream.js similarity index 66% rename from node_modules/table/dist/createStream.js rename to node_modules/table/dist/src/createStream.js index d941b4b6f9..d526161df4 100644 --- a/node_modules/table/dist/createStream.js +++ b/node_modules/table/dist/src/createStream.js @@ -10,46 +10,47 @@ const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights"); const padTableData_1 = require("./padTableData"); const stringifyTableData_1 = require("./stringifyTableData"); const truncateTableData_1 = require("./truncateTableData"); +const utils_1 = require("./utils"); const prepareData = (data, config) => { - let rows = stringifyTableData_1.stringifyTableData(data); - rows = truncateTableData_1.truncateTableData(rows, config); - const rowHeights = calculateRowHeights_1.calculateRowHeights(rows, config); - rows = mapDataUsingRowHeights_1.mapDataUsingRowHeights(rows, rowHeights, config); - rows = alignTableData_1.alignTableData(rows, config); - rows = padTableData_1.padTableData(rows, config); + let rows = (0, stringifyTableData_1.stringifyTableData)(data); + rows = (0, truncateTableData_1.truncateTableData)(rows, (0, utils_1.extractTruncates)(config)); + const rowHeights = (0, calculateRowHeights_1.calculateRowHeights)(rows, config); + rows = (0, mapDataUsingRowHeights_1.mapDataUsingRowHeights)(rows, rowHeights, config); + rows = (0, alignTableData_1.alignTableData)(rows, config); + rows = (0, padTableData_1.padTableData)(rows, config); return rows; }; const create = (row, columnWidths, config) => { const rows = prepareData([row], config); const body = rows.map((literalRow) => { - return drawRow_1.drawRow(literalRow, config); + return (0, drawRow_1.drawRow)(literalRow, config); }).join(''); let output; output = ''; - output += drawBorder_1.drawBorderTop(columnWidths, config); + output += (0, drawBorder_1.drawBorderTop)(columnWidths, config); output += body; - output += drawBorder_1.drawBorderBottom(columnWidths, config); + output += (0, drawBorder_1.drawBorderBottom)(columnWidths, config); output = output.trimEnd(); process.stdout.write(output); }; const append = (row, columnWidths, config) => { const rows = prepareData([row], config); const body = rows.map((literalRow) => { - return drawRow_1.drawRow(literalRow, config); + return (0, drawRow_1.drawRow)(literalRow, config); }).join(''); let output = ''; - const bottom = drawBorder_1.drawBorderBottom(columnWidths, config); + const bottom = (0, drawBorder_1.drawBorderBottom)(columnWidths, config); if (bottom !== '\n') { output = '\r\u001B[K'; } - output += drawBorder_1.drawBorderJoin(columnWidths, config); + output += (0, drawBorder_1.drawBorderJoin)(columnWidths, config); output += body; output += bottom; output = output.trimEnd(); process.stdout.write(output); }; const createStream = (userConfig) => { - const config = makeStreamConfig_1.makeStreamConfig(userConfig); + const config = (0, makeStreamConfig_1.makeStreamConfig)(userConfig); const columnWidths = Object.values(config.columns).map((column) => { return column.width + column.paddingLeft + column.paddingRight; }); @@ -70,3 +71,4 @@ const createStream = (userConfig) => { }; }; exports.createStream = createStream; +//# sourceMappingURL=createStream.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/createStream.js.map b/node_modules/table/dist/src/createStream.js.map new file mode 100644 index 0000000000..7ec269cff2 --- /dev/null +++ b/node_modules/table/dist/src/createStream.js.map @@ -0,0 +1 @@ +{"version":3,"file":"createStream.js","sourceRoot":"","sources":["../../src/createStream.ts"],"names":[],"mappings":";;;AAAA,qDAE0B;AAC1B,+DAE+B;AAC/B,6CAIsB;AACtB,uCAEmB;AACnB,yDAE4B;AAC5B,qEAEkC;AAClC,iDAEwB;AACxB,6DAE8B;AAC9B,2DAE6B;AAQ7B,mCAEiB;AAEjB,MAAM,WAAW,GAAG,CAAC,IAAW,EAAE,MAAoB,EAAE,EAAE;IACxD,IAAI,IAAI,GAAG,IAAA,uCAAkB,EAAC,IAAI,CAAC,CAAC;IAEpC,IAAI,GAAG,IAAA,qCAAiB,EAAC,IAAI,EAAE,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC,CAAC;IAEzD,MAAM,UAAU,GAAG,IAAA,yCAAmB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAErD,IAAI,GAAG,IAAA,+CAAsB,EAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACxD,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,GAAG,IAAA,2BAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;I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AAM,GAAG,YAAY,CAAC;KACvB;IAED,MAAM,IAAI,IAAA,2BAAc,EAAC,YAAY,EAAE,MAAM,CAAC,CAAC;IAC/C,MAAM,IAAI,IAAI,CAAC;IACf,MAAM,IAAI,MAAM,CAAC;IAEjB,MAAM,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;IAE1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEK,MAAM,YAAY,GAAG,CAAC,UAA4B,EAAkB,EAAE;IAC3E,MAAM,MAAM,GAAG,IAAA,mCAAgB,EAAC,UAAU,CAAC,CAAC;IAE5C,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE;QAChE,OAAO,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC,YAAY,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,IAAI,KAAK,GAAG,IAAI,CAAC;IAEjB,OAAO;QACL,KAAK,EAAE,CAAC,GAAa,EAAE,EAAE;YACvB,IAAI,GAAG,CAAC,MAAM,KAAK,MAAM,CAAC,WAAW,EAAE;gBACrC,MAAM,IAAI,KAAK,CAAC,uDAAuD,CAAC,CAAC;aAC1E;YAED,IAAI,KAAK,EAAE;gBACT,KAAK,GAAG,KAAK,CAAC;gBAEd,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;aACnC;iBAAM;gBACL,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,CAAC;aACnC;QACH,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAxBW,QAAA,YAAY,gBAwBvB"} \ No newline at end of file diff --git a/node_modules/table/dist/src/drawBorder.d.ts b/node_modules/table/dist/src/drawBorder.d.ts new file mode 100644 index 0000000000..82b4dc54ef --- /dev/null +++ b/node_modules/table/dist/src/drawBorder.d.ts @@ -0,0 +1,34 @@ +import type { SpanningCellManager } from './spanningCellManager'; +import type { BorderConfig, DrawVerticalLine } from './types/api'; +import type { SeparatorGetter } from './types/internal'; +declare type Separator = { + readonly left: string; + readonly right: string; + readonly body: string; + readonly bodyJoinOuter?: string; + readonly bodyJoinInner?: string; + readonly join: string; + readonly joinUp?: string; + readonly joinDown?: string; + readonly joinLeft?: string; + readonly joinRight?: string; +}; +export declare const drawBorderSegments: (columnWidths: number[], parameters: Parameters[1]) => string[]; +export declare const createSeparatorGetter: (dependencies: Parameters[1]) => (verticalBorderIndex: number, columnCount: number) => string; +export declare const drawBorder: (columnWidths: number[], parameters: Omit & { + separator: Separator; +}) => string; +export declare const drawBorderTop: (columnWidths: number[], parameters: DrawBorderParameters) => string; +export declare const drawBorderJoin: (columnWidths: number[], parameters: DrawBorderParameters) => string; +export declare const drawBorderBottom: (columnWidths: number[], parameters: DrawBorderParameters) => string; +export declare type BorderGetterParameters = { + border: BorderConfig; + drawVerticalLine: DrawVerticalLine; + spanningCellManager?: SpanningCellManager; + rowCount?: number; +}; +export declare type DrawBorderParameters = Omit & { + horizontalBorderIndex?: number; +}; +export declare const createTableBorderGetter: (columnWidths: number[], parameters: BorderGetterParameters) => SeparatorGetter; +export {}; diff --git a/node_modules/table/dist/src/drawBorder.js b/node_modules/table/dist/src/drawBorder.js new file mode 100644 index 0000000000..81ede50633 --- /dev/null +++ b/node_modules/table/dist/src/drawBorder.js @@ -0,0 +1,202 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createTableBorderGetter = exports.drawBorderBottom = exports.drawBorderJoin = exports.drawBorderTop = exports.drawBorder = exports.createSeparatorGetter = exports.drawBorderSegments = void 0; +const drawContent_1 = require("./drawContent"); +const drawBorderSegments = (columnWidths, parameters) => { + const { separator, horizontalBorderIndex, spanningCellManager } = parameters; + return columnWidths.map((columnWidth, columnIndex) => { + const normalSegment = separator.body.repeat(columnWidth); + if (horizontalBorderIndex === undefined) { + return normalSegment; + } + /* istanbul ignore next */ + const range = spanningCellManager === null || spanningCellManager === void 0 ? void 0 : spanningCellManager.getContainingRange({ col: columnIndex, + row: horizontalBorderIndex }); + if (!range) { + return normalSegment; + } + const { topLeft } = range; + // draw border segments as usual for top border of spanning cell + if (horizontalBorderIndex === topLeft.row) { + return normalSegment; + } + // if for first column/row of spanning cell, just skip + if (columnIndex !== topLeft.col) { + return ''; + } + return range.extractBorderContent(horizontalBorderIndex); + }); +}; +exports.drawBorderSegments = drawBorderSegments; +const createSeparatorGetter = (dependencies) => { + const { separator, spanningCellManager, horizontalBorderIndex, rowCount } = dependencies; + // eslint-disable-next-line complexity + return (verticalBorderIndex, columnCount) => { + const inSameRange = spanningCellManager === null || spanningCellManager === void 0 ? void 0 : spanningCellManager.inSameRange; + if (horizontalBorderIndex !== undefined && inSameRange) { + const topCell = { col: verticalBorderIndex, + row: horizontalBorderIndex - 1 }; + const leftCell = { col: verticalBorderIndex - 1, + row: horizontalBorderIndex }; + const oppositeCell = { col: verticalBorderIndex - 1, + row: horizontalBorderIndex - 1 }; + const currentCell = { col: verticalBorderIndex, + row: horizontalBorderIndex }; + const pairs = [ + [oppositeCell, topCell], + [topCell, currentCell], + [currentCell, leftCell], + [leftCell, oppositeCell], + ]; + // left side of horizontal border + if (verticalBorderIndex === 0) { + if (inSameRange(currentCell, topCell) && separator.bodyJoinOuter) { + return separator.bodyJoinOuter; + } + return separator.left; + } + // right side of horizontal border + if (verticalBorderIndex === columnCount) { + if (inSameRange(oppositeCell, leftCell) && separator.bodyJoinOuter) { + return separator.bodyJoinOuter; + } + return separator.right; + } + // top horizontal border + if (horizontalBorderIndex === 0) { + if (inSameRange(currentCell, leftCell)) { + return separator.body; + } + return separator.join; + } + // bottom horizontal border + if (horizontalBorderIndex === rowCount) { + if (inSameRange(topCell, oppositeCell)) { + return separator.body; + } + return separator.join; + } + const sameRangeCount = pairs.map((pair) => { + return inSameRange(...pair); + }).filter(Boolean).length; + // four cells are belongs to different spanning cells + if (sameRangeCount === 0) { + return separator.join; + } + // belong to one spanning cell + if (sameRangeCount === 4) { + return ''; + } + // belongs to two spanning cell + if (sameRangeCount === 2) { + if (inSameRange(...pairs[1]) && inSameRange(...pairs[3]) && separator.bodyJoinInner) { + return separator.bodyJoinInner; + } + return separator.body; + } + /* istanbul ignore next */ + if (sameRangeCount === 1) { + if (!separator.joinRight || !separator.joinLeft || !separator.joinUp || !separator.joinDown) { + throw new Error(`Can not get border separator for position [${horizontalBorderIndex}, ${verticalBorderIndex}]`); + } + if (inSameRange(...pairs[0])) { + return separator.joinDown; + } + if (inSameRange(...pairs[1])) { + return separator.joinLeft; + } + if (inSameRange(...pairs[2])) { + return separator.joinUp; + } + return separator.joinRight; + } + /* istanbul ignore next */ + throw new Error('Invalid case'); + } + if (verticalBorderIndex === 0) { + return separator.left; + } + if (verticalBorderIndex === columnCount) { + return separator.right; + } + return separator.join; + }; +}; +exports.createSeparatorGetter = createSeparatorGetter; +const drawBorder = (columnWidths, parameters) => { + const borderSegments = (0, exports.drawBorderSegments)(columnWidths, parameters); + const { drawVerticalLine, horizontalBorderIndex, spanningCellManager } = parameters; + return (0, drawContent_1.drawContent)({ + contents: borderSegments, + drawSeparator: drawVerticalLine, + elementType: 'border', + rowIndex: horizontalBorderIndex, + separatorGetter: (0, exports.createSeparatorGetter)(parameters), + spanningCellManager, + }) + '\n'; +}; +exports.drawBorder = drawBorder; +const drawBorderTop = (columnWidths, parameters) => { + const { border } = parameters; + const result = (0, exports.drawBorder)(columnWidths, { + ...parameters, + separator: { + body: border.topBody, + join: border.topJoin, + left: border.topLeft, + right: border.topRight, + }, + }); + if (result === '\n') { + return ''; + } + return result; +}; +exports.drawBorderTop = drawBorderTop; +const drawBorderJoin = (columnWidths, parameters) => { + const { border } = parameters; + return (0, exports.drawBorder)(columnWidths, { + ...parameters, + separator: { + body: border.joinBody, + bodyJoinInner: border.bodyJoin, + bodyJoinOuter: border.bodyLeft, + join: border.joinJoin, + joinDown: border.joinMiddleDown, + joinLeft: border.joinMiddleLeft, + joinRight: border.joinMiddleRight, + joinUp: border.joinMiddleUp, + left: border.joinLeft, + right: border.joinRight, + }, + }); +}; +exports.drawBorderJoin = drawBorderJoin; +const drawBorderBottom = (columnWidths, parameters) => { + const { border } = parameters; + return (0, exports.drawBorder)(columnWidths, { + ...parameters, + separator: { + body: border.bottomBody, + join: border.bottomJoin, + left: border.bottomLeft, + right: border.bottomRight, + }, + }); +}; +exports.drawBorderBottom = drawBorderBottom; +const createTableBorderGetter = (columnWidths, parameters) => { + return (index, size) => { + const drawBorderParameters = { ...parameters, + horizontalBorderIndex: index }; + if (index === 0) { + return (0, exports.drawBorderTop)(columnWidths, drawBorderParameters); + } + else if (index === size) { + return (0, exports.drawBorderBottom)(columnWidths, drawBorderParameters); + } + return (0, exports.drawBorderJoin)(columnWidths, drawBorderParameters); + }; +}; +exports.createTableBorderGetter = createTableBorderGetter; +//# sourceMappingURL=drawBorder.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/drawBorder.js.map b/node_modules/table/dist/src/drawBorder.js.map new file mode 100644 index 0000000000..c14af9b973 --- /dev/null +++ b/node_modules/table/dist/src/drawBorder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"drawBorder.js","sourceRoot":"","sources":["../../src/drawBorder.ts"],"names":[],"mappings":";;;AAAA,+CAEuB;AA0BhB,MAAM,kBAAkB,GAAG,CAAC,YAAsB,EAAE,UAA4C,EAAY,EAAE;IACnH,MAAM,EAAC,SAAS,EAAE,qBAAqB,EAAE,mBAAmB,EAAC,GAAG,UAAU,CAAC;IAE3E,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,EAAE;QACnD,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QACzD,IAAI,qBAAqB,KAAK,SAAS,EAAE;YACvC,OAAO,aAAa,CAAC;SACtB;QAED,0BAA0B;QAC1B,MAAM,KAAK,GAAG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AC,GAAG,UAAU;YAC/D,qBAAqB,EAAE,KAAK,EAAC,CAAC;QAEhC,IAAI,KAAK,KAAK,CAAC,EAAE;YACf,OAAO,IAAA,qBAAa,EAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;SAC1D;aAAM,IAAI,KAAK,KAAK,IAAI,EAAE;YACzB,OAAO,IAAA,wBAAgB,EAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;SAC7D;QAED,OAAO,IAAA,sBAAc,EAAC,YAAY,EAAE,oBAAoB,CAAC,CAAC;IAC5D,CAAC,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,uBAAuB,2BAalC"} \ No newline at end of file diff --git a/node_modules/table/dist/src/drawContent.d.ts b/node_modules/table/dist/src/drawContent.d.ts new file mode 100644 index 0000000000..3ac2f8cea8 --- /dev/null +++ b/node_modules/table/dist/src/drawContent.d.ts @@ -0,0 +1,14 @@ +import type { SpanningCellManager } from './spanningCellManager'; +/** + * Shared function to draw horizontal borders, rows or the entire table + */ +declare type DrawContentParameters = { + contents: string[]; + drawSeparator: (index: number, size: number) => boolean; + separatorGetter: (index: number, size: number) => string; + spanningCellManager?: SpanningCellManager; + rowIndex?: number; + elementType?: 'border' | 'cell' | 'row'; +}; +export declare const drawContent: (parameters: DrawContentParameters) => string; +export {}; diff --git a/node_modules/table/dist/src/drawContent.js b/node_modules/table/dist/src/drawContent.js new file mode 100644 index 0000000000..98d494ea91 --- /dev/null +++ b/node_modules/table/dist/src/drawContent.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.drawContent = void 0; +const drawContent = (parameters) => { + const { contents, separatorGetter, drawSeparator, spanningCellManager, rowIndex, elementType } = parameters; + const contentSize = contents.length; + const result = []; + if (drawSeparator(0, contentSize)) { + result.push(separatorGetter(0, contentSize)); + } + contents.forEach((content, contentIndex) => { + if (!elementType || elementType === 'border' || elementType === 'row') { + result.push(content); + } + if (elementType === 'cell' && rowIndex === undefined) { + result.push(content); + } + if (elementType === 'cell' && rowIndex !== undefined) { + /* istanbul ignore next */ + const containingRange = spanningCellManager === null || spanningCellManager === void 0 ? void 0 : spanningCellManager.getContainingRange({ col: contentIndex, + row: rowIndex }); + // when drawing content row, just add a cell when it is a normal cell + // or belongs to first column of spanning cell + if (!containingRange || contentIndex === containingRange.topLeft.col) { + result.push(content); + } + } + // Only append the middle separator if the content is not the last + if (contentIndex + 1 < contentSize && drawSeparator(contentIndex + 1, contentSize)) { + const separator = separatorGetter(contentIndex + 1, contentSize); + if (elementType === 'cell' && rowIndex !== undefined) { + const currentCell = { col: contentIndex + 1, + row: rowIndex }; + /* istanbul ignore next */ + const containingRange = spanningCellManager === null || spanningCellManager === void 0 ? void 0 : spanningCellManager.getContainingRange(currentCell); + if (!containingRange || containingRange.topLeft.col === currentCell.col) { + result.push(separator); + } + } + else { + result.push(separator); + } + } + }); + if (drawSeparator(contentSize, contentSize)) { + result.push(separatorGetter(contentSize, contentSize)); + } + return result.join(''); +}; +exports.drawContent = drawContent; +//# sourceMappingURL=drawContent.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/drawContent.js.map b/node_modules/table/dist/src/drawContent.js.map new file mode 100644 index 0000000000..991c2a5d77 --- /dev/null +++ b/node_modules/table/dist/src/drawContent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"drawContent.js","sourceRoot":"","sources":["../../src/drawContent.ts"],"names":[],"mappings":";;;AAmBO,MAAM,WAAW,GAAG,CAAC,UAAiC,EAAU,EAAE;IACvE,MAAM,EAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,mBAAmB,EAAE,QAAQ,EAAE,WAAW,EAAC,GAAG,UAAU,CAAC;IAC1G,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC;IACpC,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC,EAAE;QACjC,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,EA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E,IAAI,CAAC,eAAe,IAAI,eAAe,CAAC,OAAO,CAAC,GAAG,KAAK,WAAW,CAAC,GAAG,EAAE;oBACvE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;iBACxB;aACF;iBAAM;gBACL,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;aACxB;SACF;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,aAAa,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE;QAC3C,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAC;KACxD;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACzB,CAAC,CAAC;AArDW,QAAA,WAAW,eAqDtB"} \ No newline at end of file diff --git a/node_modules/table/dist/src/drawRow.d.ts b/node_modules/table/dist/src/drawRow.d.ts new file mode 100644 index 0000000000..c0238a8d88 --- /dev/null +++ b/node_modules/table/dist/src/drawRow.d.ts @@ -0,0 +1,10 @@ +import type { SpanningCellManager } from './spanningCellManager'; +import type { DrawVerticalLine } from './types/api'; +import type { BodyBorderConfig, Row } from './types/internal'; +export declare type DrawRowConfig = { + border: BodyBorderConfig; + drawVerticalLine: DrawVerticalLine; + spanningCellManager?: SpanningCellManager; + rowIndex?: number; +}; +export declare const drawRow: (row: Row, config: DrawRowConfig) => string; diff --git a/node_modules/table/dist/drawRow.js b/node_modules/table/dist/src/drawRow.js similarity index 68% rename from node_modules/table/dist/drawRow.js rename to node_modules/table/dist/src/drawRow.js index 7d5756b176..a86a27901f 100644 --- a/node_modules/table/dist/drawRow.js +++ b/node_modules/table/dist/src/drawRow.js @@ -3,9 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.drawRow = void 0; const drawContent_1 = require("./drawContent"); const drawRow = (row, config) => { - const { border, drawVerticalLine } = config; - return drawContent_1.drawContent(row, { + const { border, drawVerticalLine, rowIndex, spanningCellManager } = config; + return (0, drawContent_1.drawContent)({ + contents: row, drawSeparator: drawVerticalLine, + elementType: 'cell', + rowIndex, separatorGetter: (index, columnCount) => { if (index === 0) { return border.bodyLeft; @@ -15,6 +18,8 @@ const drawRow = (row, config) => { } return border.bodyJoin; }, + spanningCellManager, }) + '\n'; }; exports.drawRow = drawRow; +//# sourceMappingURL=drawRow.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/drawRow.js.map b/node_modules/table/dist/src/drawRow.js.map new file mode 100644 index 0000000000..ca3c5bd94d --- /dev/null +++ b/node_modules/table/dist/src/drawRow.js.map @@ -0,0 +1 @@ +{"version":3,"file":"drawRow.js","sourceRoot":"","sources":["../../src/drawRow.ts"],"names":[],"mappings":";;;AAAA,+CAEuB;AAmBhB,MAAM,OAAO,GAAG,CAAC,GAAQ,EAAE,MAAqB,EAAU,EAAE;IACjE,MAAM,EAAC,MAAM,EAAE,gBAAgB,EAAE,QAAQ,EAAE,mBAAmB,EAAC,GAAG,MAAM,CAAC;IAEzE,OAAO,IAAA,yBAAW,EAAC;QACjB,QAAQ,EAAE,GAAG;QACb,aAAa,EAAE,gBAAgB;QAC/B,WAAW,EAAE,MAAM;QACnB,QAAQ;QACR,eAAe,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;YACtC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACf,OAAO,MAAM,CAAC,QAAQ,CAAC;aACxB;YAED,IAAI,KAAK,KAAK,WAAW,EAAE;gBACzB,OAAO,MAAM,CAAC,SAAS,CAAC;aACzB;YAED,OAAO,MAAM,CAAC,QAAQ,CAAC;QACzB,CAAC;QACD,mBAAmB;KACpB,CAAC,GAAG,IAAI,CAAC;AACZ,CAAC,CAAC;AArBW,QAAA,OAAO,WAqBlB"} \ No newline at end of file diff --git a/node_modules/table/dist/src/drawTable.d.ts b/node_modules/table/dist/src/drawTable.d.ts new file mode 100644 index 0000000000..f234f30497 --- /dev/null +++ b/node_modules/table/dist/src/drawTable.d.ts @@ -0,0 +1,2 @@ +import type { TableConfig, Row } from './types/internal'; +export declare const drawTable: (rows: Row[], outputColumnWidths: number[], rowHeights: number[], config: TableConfig) => string; diff --git a/node_modules/table/dist/src/drawTable.js b/node_modules/table/dist/src/drawTable.js new file mode 100644 index 0000000000..dab8f987e9 --- /dev/null +++ b/node_modules/table/dist/src/drawTable.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.drawTable = void 0; +const drawBorder_1 = require("./drawBorder"); +const drawContent_1 = require("./drawContent"); +const drawRow_1 = require("./drawRow"); +const utils_1 = require("./utils"); +const drawTable = (rows, outputColumnWidths, rowHeights, config) => { + const { drawHorizontalLine, singleLine, } = config; + const contents = (0, utils_1.groupBySizes)(rows, rowHeights).map((group, groupIndex) => { + return group.map((row) => { + return (0, drawRow_1.drawRow)(row, { ...config, + rowIndex: groupIndex }); + }).join(''); + }); + return (0, drawContent_1.drawContent)({ contents, + drawSeparator: (index, size) => { + // Top/bottom border + if (index === 0 || index === size) { + return drawHorizontalLine(index, size); + } + return !singleLine && drawHorizontalLine(index, size); + }, + elementType: 'row', + rowIndex: -1, + separatorGetter: (0, drawBorder_1.createTableBorderGetter)(outputColumnWidths, { ...config, + rowCount: contents.length }), + spanningCellManager: config.spanningCellManager }); +}; +exports.drawTable = drawTable; +//# sourceMappingURL=drawTable.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/drawTable.js.map b/node_modules/table/dist/src/drawTable.js.map new file mode 100644 index 0000000000..882d6e378d --- /dev/null +++ b/node_modules/table/dist/src/drawTable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"drawTable.js","sourceRoot":"","sources":["../../src/drawTable.ts"],"names":[],"mappings":";;;AAAA,6CAEsB;AACtB,+CAEuB;AACvB,uCAEmB;AAInB,mCAEiB;AAEV,MAAM,SAAS,GAAG,CAAC,IAAW,EAAE,kBAA4B,EAAE,UAAoB,EAAE,MAAmB,EAAU,EAAE;IACxH,MAAM,EACJ,kBAAkB,EAClB,UAAU,GACX,GAAG,MAAM,CAAC;IAEX,MAAM,QAAQ,GAAG,IAAA,oBAAY,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;QACxE,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;YACvB,OAAO,IAAA,iBAAO,EAAC,GAAG,EAAE,EAAC,GAAG,MAAM;gBAC5B,QAAQ,EAAE,UAAU,EAAC,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,yBAAW,EAAC,EAAC,QAAQ;QAC1B,aAAa,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC7B,oBAAoB;YACpB,IAAI,KAAK,KAAK,CAAC,IAAI,KAAK,KAAK,IAAI,EAAE;gBACjC,OAAO,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;aACxC;YAED,OAAO,CAAC,UAAU,IAAI,kBAAkB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACxD,CAAC;QACD,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,CAAC,CAAC;QACZ,eAAe,EAAE,IAAA,oCAAuB,EAAC,kBAAkB,EAAE,EAAC,GAAG,MAAM;YACrE,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAC,CAAC;QAC7B,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,EAAC,CAAC,CAAC;AACtD,CAAC,CAAC;AA3BW,QAAA,SAAS,aA2BpB"} \ No newline at end of file diff --git a/node_modules/table/dist/generated/validators.d.ts b/node_modules/table/dist/src/generated/validators.d.ts similarity index 75% rename from node_modules/table/dist/generated/validators.d.ts rename to node_modules/table/dist/src/generated/validators.d.ts index 54e3584f5f..bec42e4a41 100644 --- a/node_modules/table/dist/generated/validators.d.ts +++ b/node_modules/table/dist/src/generated/validators.d.ts @@ -4,10 +4,10 @@ declare function validate43(data: any, { instancePath, parentData, parentDataPro parentDataProperty: any; rootData?: any; }): boolean; -declare function validate76(data: any, { instancePath, parentData, parentDataProperty, rootData }?: { +declare function validate86(data: any, { instancePath, parentData, parentDataProperty, rootData }?: { instancePath?: string | undefined; parentData: any; parentDataProperty: any; rootData?: any; }): boolean; -export { validate43 as _config_json, validate76 as _streamConfig_json }; +export { validate43 as _config_json, validate86 as _streamConfig_json }; diff --git a/node_modules/table/dist/generated/validators.js b/node_modules/table/dist/src/generated/validators.js similarity index 67% rename from node_modules/table/dist/generated/validators.js rename to node_modules/table/dist/src/generated/validators.js index 7438c707ac..6e5fc66752 100644 --- a/node_modules/table/dist/generated/validators.js +++ b/node_modules/table/dist/src/generated/validators.js @@ -47,6 +47,50 @@ const schema13 = { }, "singleLine": { "typeof": "boolean" + }, + "spanningCells": { + "type": "array", + "items": { + "type": "object", + "properties": { + "col": { + "type": "integer", + "minimum": 0 + }, + "row": { + "type": "integer", + "minimum": 0 + }, + "colSpan": { + "type": "integer", + "minimum": 1 + }, + "rowSpan": { + "type": "integer", + "minimum": 1 + }, + "alignment": { + "$ref": "shared.json#/definitions/alignment" + }, + "verticalAlignment": { + "$ref": "shared.json#/definitions/verticalAlignment" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "integer" + }, + "paddingLeft": { + "type": "integer" + }, + "paddingRight": { + "type": "integer" + } + }, + "required": ["row", "col"], + "additionalProperties": false + } } }, "additionalProperties": false @@ -101,6 +145,18 @@ const schema15 = { }, "joinJoin": { "$ref": "#/definitions/border" + }, + "joinMiddleUp": { + "$ref": "#/definitions/border" + }, + "joinMiddleDown": { + "$ref": "#/definitions/border" + }, + "joinMiddleLeft": { + "$ref": "#/definitions/border" + }, + "joinMiddleRight": { + "$ref": "#/definitions/border" } }, "additionalProperties": false @@ -333,6 +389,50 @@ function validate45(data, { instancePath = "", parentData, parentDataProperty, r errors = vErrors.length; } } + if (data.joinMiddleUp !== undefined) { + if (!(validate46(data.joinMiddleUp, { + instancePath: instancePath + "/joinMiddleUp", + parentData: data, + parentDataProperty: "joinMiddleUp", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinMiddleDown !== undefined) { + if (!(validate46(data.joinMiddleDown, { + instancePath: instancePath + "/joinMiddleDown", + parentData: data, + parentDataProperty: "joinMiddleDown", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinMiddleLeft !== undefined) { + if (!(validate46(data.joinMiddleLeft, { + instancePath: instancePath + "/joinMiddleLeft", + parentData: data, + parentDataProperty: "joinMiddleLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinMiddleRight !== undefined) { + if (!(validate46(data.joinMiddleRight, { + instancePath: instancePath + "/joinMiddleRight", + parentData: data, + parentDataProperty: "joinMiddleRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } } else { const err1 = { @@ -360,94 +460,6 @@ const schema17 = { "enum": ["left", "right", "center", "justify"] }; const func0 = require("ajv/dist/runtime/equal").default; -function validate64(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { - let vErrors = null; - let errors = 0; - if (typeof data !== "string") { - const err0 = { - instancePath, - schemaPath: "#/type", - keyword: "type", - params: { - type: "string" - }, - message: "must be string" - }; - if (vErrors === null) { - vErrors = [err0]; - } - else { - vErrors.push(err0); - } - errors++; - } - if (!((((data === "left") || (data === "right")) || (data === "center")) || (data === "justify"))) { - const err1 = { - instancePath, - schemaPath: "#/enum", - keyword: "enum", - params: { - allowedValues: schema17.enum - }, - message: "must be equal to one of the allowed values" - }; - if (vErrors === null) { - vErrors = [err1]; - } - else { - vErrors.push(err1); - } - errors++; - } - validate64.errors = vErrors; - return errors === 0; -} -const schema18 = { - "oneOf": [{ - "type": "object", - "patternProperties": { - "^[0-9]+$": { - "$ref": "#/definitions/column" - } - }, - "additionalProperties": false - }, { - "type": "array", - "items": { - "$ref": "#/definitions/column" - } - }] -}; -const pattern0 = new RegExp("^[0-9]+$", "u"); -const schema19 = { - "type": "object", - "properties": { - "alignment": { - "$ref": "#/definitions/alignment" - }, - "verticalAlignment": { - "type": "string", - "enum": ["top", "middle", "bottom"] - }, - "width": { - "type": "integer", - "minimum": 1 - }, - "wrapWord": { - "type": "boolean" - }, - "truncate": { - "type": "integer" - }, - "paddingLeft": { - "type": "integer" - }, - "paddingRight": { - "type": "integer" - } - }, - "additionalProperties": false -}; function validate68(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; @@ -490,7 +502,140 @@ function validate68(data, { instancePath = "", parentData, parentDataProperty, r validate68.errors = vErrors; return errors === 0; } -function validate67(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { +const schema18 = { + "oneOf": [{ + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }, { + "type": "array", + "items": { + "$ref": "#/definitions/column" + } + }] +}; +const pattern0 = new RegExp("^[0-9]+$", "u"); +const schema19 = { + "type": "object", + "properties": { + "alignment": { + "$ref": "#/definitions/alignment" + }, + "verticalAlignment": { + "$ref": "#/definitions/verticalAlignment" + }, + "width": { + "type": "integer", + "minimum": 1 + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "integer" + }, + "paddingLeft": { + "type": "integer" + }, + "paddingRight": { + "type": "integer" + } + }, + "additionalProperties": false +}; +function validate72(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { + let vErrors = null; + let errors = 0; + if (typeof data !== "string") { + const err0 = { + instancePath, + schemaPath: "#/type", + keyword: "type", + params: { + type: "string" + }, + message: "must be string" + }; + if (vErrors === null) { + vErrors = [err0]; + } + else { + vErrors.push(err0); + } + errors++; + } + if (!((((data === "left") || (data === "right")) || (data === "center")) || (data === "justify"))) { + const err1 = { + instancePath, + schemaPath: "#/enum", + keyword: "enum", + params: { + allowedValues: schema17.enum + }, + message: "must be equal to one of the allowed values" + }; + if (vErrors === null) { + vErrors = [err1]; + } + else { + vErrors.push(err1); + } + errors++; + } + validate72.errors = vErrors; + return errors === 0; +} +const schema21 = { + "type": "string", + "enum": ["top", "middle", "bottom"] +}; +function validate74(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { + let vErrors = null; + let errors = 0; + if (typeof data !== "string") { + const err0 = { + instancePath, + schemaPath: "#/type", + keyword: "type", + params: { + type: "string" + }, + message: "must be string" + }; + if (vErrors === null) { + vErrors = [err0]; + } + else { + vErrors.push(err0); + } + errors++; + } + if (!(((data === "top") || (data === "middle")) || (data === "bottom"))) { + const err1 = { + instancePath, + schemaPath: "#/enum", + keyword: "enum", + params: { + allowedValues: schema21.enum + }, + message: "must be equal to one of the allowed values" + }; + if (vErrors === null) { + vErrors = [err1]; + } + else { + vErrors.push(err1); + } + errors++; + } + validate74.errors = vErrors; + return errors === 0; +} +function validate71(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -515,59 +660,31 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r } } if (data.alignment !== undefined) { - if (!(validate68(data.alignment, { + if (!(validate72(data.alignment, { instancePath: instancePath + "/alignment", parentData: data, parentDataProperty: "alignment", rootData }))) { - vErrors = vErrors === null ? validate68.errors : vErrors.concat(validate68.errors); + vErrors = vErrors === null ? validate72.errors : vErrors.concat(validate72.errors); errors = vErrors.length; } } if (data.verticalAlignment !== undefined) { - let data1 = data.verticalAlignment; - if (typeof data1 !== "string") { - const err1 = { - instancePath: instancePath + "/verticalAlignment", - schemaPath: "#/properties/verticalAlignment/type", - keyword: "type", - params: { - type: "string" - }, - message: "must be string" - }; - if (vErrors === null) { - vErrors = [err1]; - } - else { - vErrors.push(err1); - } - errors++; - } - if (!(((data1 === "top") || (data1 === "middle")) || (data1 === "bottom"))) { - const err2 = { - instancePath: instancePath + "/verticalAlignment", - schemaPath: "#/properties/verticalAlignment/enum", - keyword: "enum", - params: { - allowedValues: schema19.properties.verticalAlignment.enum - }, - message: "must be equal to one of the allowed values" - }; - if (vErrors === null) { - vErrors = [err2]; - } - else { - vErrors.push(err2); - } - errors++; + if (!(validate74(data.verticalAlignment, { + instancePath: instancePath + "/verticalAlignment", + parentData: data, + parentDataProperty: "verticalAlignment", + rootData + }))) { + vErrors = vErrors === null ? validate74.errors : vErrors.concat(validate74.errors); + errors = vErrors.length; } } if (data.width !== undefined) { let data2 = data.width; if (!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))) { - const err3 = { + const err1 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/type", keyword: "type", @@ -577,16 +694,16 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r message: "must be integer" }; if (vErrors === null) { - vErrors = [err3]; + vErrors = [err1]; } else { - vErrors.push(err3); + vErrors.push(err1); } errors++; } if ((typeof data2 == "number") && (isFinite(data2))) { if (data2 < 1 || isNaN(data2)) { - const err4 = { + const err2 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/minimum", keyword: "minimum", @@ -597,10 +714,10 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r message: "must be >= 1" }; if (vErrors === null) { - vErrors = [err4]; + vErrors = [err2]; } else { - vErrors.push(err4); + vErrors.push(err2); } errors++; } @@ -608,7 +725,7 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r } if (data.wrapWord !== undefined) { if (typeof data.wrapWord !== "boolean") { - const err5 = { + const err3 = { instancePath: instancePath + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", @@ -617,6 +734,48 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r }, message: "must be boolean" }; + if (vErrors === null) { + vErrors = [err3]; + } + else { + vErrors.push(err3); + } + errors++; + } + } + if (data.truncate !== undefined) { + let data4 = data.truncate; + if (!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) { + const err4 = { + instancePath: instancePath + "/truncate", + schemaPath: "#/properties/truncate/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err4]; + } + else { + vErrors.push(err4); + } + errors++; + } + } + if (data.paddingLeft !== undefined) { + let data5 = data.paddingLeft; + if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) { + const err5 = { + instancePath: instancePath + "/paddingLeft", + schemaPath: "#/properties/paddingLeft/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; if (vErrors === null) { vErrors = [err5]; } @@ -626,12 +785,12 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r errors++; } } - if (data.truncate !== undefined) { - let data4 = data.truncate; - if (!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) { + if (data.paddingRight !== undefined) { + let data6 = data.paddingRight; + if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) { const err6 = { - instancePath: instancePath + "/truncate", - schemaPath: "#/properties/truncate/type", + instancePath: instancePath + "/paddingRight", + schemaPath: "#/properties/paddingRight/type", keyword: "type", params: { type: "integer" @@ -647,51 +806,9 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r errors++; } } - if (data.paddingLeft !== undefined) { - let data5 = data.paddingLeft; - if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) { - const err7 = { - instancePath: instancePath + "/paddingLeft", - schemaPath: "#/properties/paddingLeft/type", - keyword: "type", - params: { - type: "integer" - }, - message: "must be integer" - }; - if (vErrors === null) { - vErrors = [err7]; - } - else { - vErrors.push(err7); - } - errors++; - } - } - if (data.paddingRight !== undefined) { - let data6 = data.paddingRight; - if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) { - const err8 = { - instancePath: instancePath + "/paddingRight", - schemaPath: "#/properties/paddingRight/type", - keyword: "type", - params: { - type: "integer" - }, - message: "must be integer" - }; - if (vErrors === null) { - vErrors = [err8]; - } - else { - vErrors.push(err8); - } - errors++; - } - } } else { - const err9 = { + const err7 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -701,17 +818,17 @@ function validate67(data, { instancePath = "", parentData, parentDataProperty, r message: "must be object" }; if (vErrors === null) { - vErrors = [err9]; + vErrors = [err7]; } else { - vErrors.push(err9); + vErrors.push(err7); } errors++; } - validate67.errors = vErrors; + validate71.errors = vErrors; return errors === 0; } -function validate66(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { +function validate70(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; const _errs0 = errors; @@ -741,13 +858,13 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r } for (const key1 in data) { if (pattern0.test(key1)) { - if (!(validate67(data[key1], { + if (!(validate71(data[key1], { instancePath: instancePath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), parentData: data, parentDataProperty: key1, rootData }))) { - vErrors = vErrors === null ? validate67.errors : vErrors.concat(validate67.errors); + vErrors = vErrors === null ? validate71.errors : vErrors.concat(validate71.errors); errors = vErrors.length; } } @@ -780,13 +897,13 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r if (Array.isArray(data)) { const len0 = data.length; for (let i0 = 0; i0 < len0; i0++) { - if (!(validate67(data[i0], { + if (!(validate71(data[i0], { instancePath: instancePath + "/" + i0, parentData: data, parentDataProperty: i0, rootData }))) { - vErrors = vErrors === null ? validate67.errors : vErrors.concat(validate67.errors); + vErrors = vErrors === null ? validate71.errors : vErrors.concat(validate71.errors); errors = vErrors.length; } } @@ -849,10 +966,10 @@ function validate66(data, { instancePath = "", parentData, parentDataProperty, r } } } - validate66.errors = vErrors; + validate70.errors = vErrors; return errors === 0; } -function validate73(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { +function validate79(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -877,59 +994,31 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r } } if (data.alignment !== undefined) { - if (!(validate68(data.alignment, { + if (!(validate72(data.alignment, { instancePath: instancePath + "/alignment", parentData: data, parentDataProperty: "alignment", rootData }))) { - vErrors = vErrors === null ? validate68.errors : vErrors.concat(validate68.errors); + vErrors = vErrors === null ? validate72.errors : vErrors.concat(validate72.errors); errors = vErrors.length; } } if (data.verticalAlignment !== undefined) { - let data1 = data.verticalAlignment; - if (typeof data1 !== "string") { - const err1 = { - instancePath: instancePath + "/verticalAlignment", - schemaPath: "#/properties/verticalAlignment/type", - keyword: "type", - params: { - type: "string" - }, - message: "must be string" - }; - if (vErrors === null) { - vErrors = [err1]; - } - else { - vErrors.push(err1); - } - errors++; - } - if (!(((data1 === "top") || (data1 === "middle")) || (data1 === "bottom"))) { - const err2 = { - instancePath: instancePath + "/verticalAlignment", - schemaPath: "#/properties/verticalAlignment/enum", - keyword: "enum", - params: { - allowedValues: schema19.properties.verticalAlignment.enum - }, - message: "must be equal to one of the allowed values" - }; - if (vErrors === null) { - vErrors = [err2]; - } - else { - vErrors.push(err2); - } - errors++; + if (!(validate74(data.verticalAlignment, { + instancePath: instancePath + "/verticalAlignment", + parentData: data, + parentDataProperty: "verticalAlignment", + rootData + }))) { + vErrors = vErrors === null ? validate74.errors : vErrors.concat(validate74.errors); + errors = vErrors.length; } } if (data.width !== undefined) { let data2 = data.width; if (!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))) { - const err3 = { + const err1 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/type", keyword: "type", @@ -939,16 +1028,16 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r message: "must be integer" }; if (vErrors === null) { - vErrors = [err3]; + vErrors = [err1]; } else { - vErrors.push(err3); + vErrors.push(err1); } errors++; } if ((typeof data2 == "number") && (isFinite(data2))) { if (data2 < 1 || isNaN(data2)) { - const err4 = { + const err2 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/minimum", keyword: "minimum", @@ -959,10 +1048,10 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r message: "must be >= 1" }; if (vErrors === null) { - vErrors = [err4]; + vErrors = [err2]; } else { - vErrors.push(err4); + vErrors.push(err2); } errors++; } @@ -970,7 +1059,7 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r } if (data.wrapWord !== undefined) { if (typeof data.wrapWord !== "boolean") { - const err5 = { + const err3 = { instancePath: instancePath + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", @@ -979,6 +1068,48 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r }, message: "must be boolean" }; + if (vErrors === null) { + vErrors = [err3]; + } + else { + vErrors.push(err3); + } + errors++; + } + } + if (data.truncate !== undefined) { + let data4 = data.truncate; + if (!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) { + const err4 = { + instancePath: instancePath + "/truncate", + schemaPath: "#/properties/truncate/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err4]; + } + else { + vErrors.push(err4); + } + errors++; + } + } + if (data.paddingLeft !== undefined) { + let data5 = data.paddingLeft; + if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) { + const err5 = { + instancePath: instancePath + "/paddingLeft", + schemaPath: "#/properties/paddingLeft/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; if (vErrors === null) { vErrors = [err5]; } @@ -988,12 +1119,12 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r errors++; } } - if (data.truncate !== undefined) { - let data4 = data.truncate; - if (!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) { + if (data.paddingRight !== undefined) { + let data6 = data.paddingRight; + if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) { const err6 = { - instancePath: instancePath + "/truncate", - schemaPath: "#/properties/truncate/type", + instancePath: instancePath + "/paddingRight", + schemaPath: "#/properties/paddingRight/type", keyword: "type", params: { type: "integer" @@ -1009,51 +1140,9 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r errors++; } } - if (data.paddingLeft !== undefined) { - let data5 = data.paddingLeft; - if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) { - const err7 = { - instancePath: instancePath + "/paddingLeft", - schemaPath: "#/properties/paddingLeft/type", - keyword: "type", - params: { - type: "integer" - }, - message: "must be integer" - }; - if (vErrors === null) { - vErrors = [err7]; - } - else { - vErrors.push(err7); - } - errors++; - } - } - if (data.paddingRight !== undefined) { - let data6 = data.paddingRight; - if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) { - const err8 = { - instancePath: instancePath + "/paddingRight", - schemaPath: "#/properties/paddingRight/type", - keyword: "type", - params: { - type: "integer" - }, - message: "must be integer" - }; - if (vErrors === null) { - vErrors = [err8]; - } - else { - vErrors.push(err8); - } - errors++; - } - } } else { - const err9 = { + const err7 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -1063,14 +1152,56 @@ function validate73(data, { instancePath = "", parentData, parentDataProperty, r message: "must be object" }; if (vErrors === null) { - vErrors = [err9]; + vErrors = [err7]; } else { - vErrors.push(err9); + vErrors.push(err7); } errors++; } - validate73.errors = vErrors; + validate79.errors = vErrors; + return errors === 0; +} +function validate84(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { + let vErrors = null; + let errors = 0; + if (typeof data !== "string") { + const err0 = { + instancePath, + schemaPath: "#/type", + keyword: "type", + params: { + type: "string" + }, + message: "must be string" + }; + if (vErrors === null) { + vErrors = [err0]; + } + else { + vErrors.push(err0); + } + errors++; + } + if (!(((data === "top") || (data === "middle")) || (data === "bottom"))) { + const err1 = { + instancePath, + schemaPath: "#/enum", + keyword: "enum", + params: { + allowedValues: schema21.enum + }, + message: "must be equal to one of the allowed values" + }; + if (vErrors === null) { + vErrors = [err1]; + } + else { + vErrors.push(err1); + } + errors++; + } + validate84.errors = vErrors; return errors === 0; } function validate43(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { @@ -1079,7 +1210,7 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { for (const key0 in data) { - if (!(((((((key0 === "border") || (key0 === "header")) || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "drawVerticalLine")) || (key0 === "drawHorizontalLine")) || (key0 === "singleLine"))) { + if (!((((((((key0 === "border") || (key0 === "header")) || (key0 === "columns")) || (key0 === "columnDefault")) || (key0 === "drawVerticalLine")) || (key0 === "drawHorizontalLine")) || (key0 === "singleLine")) || (key0 === "spanningCells"))) { const err0 = { instancePath, schemaPath: "#/additionalProperties", @@ -1171,13 +1302,13 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r } } if (data1.alignment !== undefined) { - if (!(validate64(data1.alignment, { + if (!(validate68(data1.alignment, { instancePath: instancePath + "/header/alignment", parentData: data1, parentDataProperty: "alignment", rootData }))) { - vErrors = vErrors === null ? validate64.errors : vErrors.concat(validate64.errors); + vErrors = vErrors === null ? validate68.errors : vErrors.concat(validate68.errors); errors = vErrors.length; } } @@ -1285,24 +1416,24 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r } } if (data.columns !== undefined) { - if (!(validate66(data.columns, { + if (!(validate70(data.columns, { instancePath: instancePath + "/columns", parentData: data, parentDataProperty: "columns", rootData }))) { - vErrors = vErrors === null ? validate66.errors : vErrors.concat(validate66.errors); + vErrors = vErrors === null ? validate70.errors : vErrors.concat(validate70.errors); errors = vErrors.length; } } if (data.columnDefault !== undefined) { - if (!(validate73(data.columnDefault, { + if (!(validate79(data.columnDefault, { instancePath: instancePath + "/columnDefault", parentData: data, parentDataProperty: "columnDefault", rootData }))) { - vErrors = vErrors === null ? validate73.errors : vErrors.concat(validate73.errors); + vErrors = vErrors === null ? validate79.errors : vErrors.concat(validate79.errors); errors = vErrors.length; } } @@ -1360,9 +1491,385 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r errors++; } } + if (data.spanningCells !== undefined) { + let data13 = data.spanningCells; + if (Array.isArray(data13)) { + const len0 = data13.length; + for (let i0 = 0; i0 < len0; i0++) { + let data14 = data13[i0]; + if (data14 && typeof data14 == "object" && !Array.isArray(data14)) { + if (data14.row === undefined) { + const err12 = { + instancePath: instancePath + "/spanningCells/" + i0, + schemaPath: "#/properties/spanningCells/items/required", + keyword: "required", + params: { + missingProperty: "row" + }, + message: "must have required property '" + "row" + "'" + }; + if (vErrors === null) { + vErrors = [err12]; + } + else { + vErrors.push(err12); + } + errors++; + } + if (data14.col === undefined) { + const err13 = { + instancePath: instancePath + "/spanningCells/" + i0, + schemaPath: "#/properties/spanningCells/items/required", + keyword: "required", + params: { + missingProperty: "col" + }, + message: "must have required property '" + "col" + "'" + }; + if (vErrors === null) { + vErrors = [err13]; + } + else { + vErrors.push(err13); + } + errors++; + } + for (const key2 in data14) { + if (!(func8.call(schema13.properties.spanningCells.items.properties, key2))) { + const err14 = { + instancePath: instancePath + "/spanningCells/" + i0, + schemaPath: "#/properties/spanningCells/items/additionalProperties", + keyword: "additionalProperties", + params: { + additionalProperty: key2 + }, + message: "must NOT have additional properties" + }; + if (vErrors === null) { + vErrors = [err14]; + } + else { + vErrors.push(err14); + } + errors++; + } + } + if (data14.col !== undefined) { + let data15 = data14.col; + if (!(((typeof data15 == "number") && (!(data15 % 1) && !isNaN(data15))) && (isFinite(data15)))) { + const err15 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/col", + schemaPath: "#/properties/spanningCells/items/properties/col/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err15]; + } + else { + vErrors.push(err15); + } + errors++; + } + if ((typeof data15 == "number") && (isFinite(data15))) { + if (data15 < 0 || isNaN(data15)) { + const err16 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/col", + schemaPath: "#/properties/spanningCells/items/properties/col/minimum", + keyword: "minimum", + params: { + comparison: ">=", + limit: 0 + }, + message: "must be >= 0" + }; + if (vErrors === null) { + vErrors = [err16]; + } + else { + vErrors.push(err16); + } + errors++; + } + } + } + if (data14.row !== undefined) { + let data16 = data14.row; + if (!(((typeof data16 == "number") && (!(data16 % 1) && !isNaN(data16))) && (isFinite(data16)))) { + const err17 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/row", + schemaPath: "#/properties/spanningCells/items/properties/row/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err17]; + } + else { + vErrors.push(err17); + } + errors++; + } + if ((typeof data16 == "number") && (isFinite(data16))) { + if (data16 < 0 || isNaN(data16)) { + const err18 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/row", + schemaPath: "#/properties/spanningCells/items/properties/row/minimum", + keyword: "minimum", + params: { + comparison: ">=", + limit: 0 + }, + message: "must be >= 0" + }; + if (vErrors === null) { + vErrors = [err18]; + } + else { + vErrors.push(err18); + } + errors++; + } + } + } + if (data14.colSpan !== undefined) { + let data17 = data14.colSpan; + if (!(((typeof data17 == "number") && (!(data17 % 1) && !isNaN(data17))) && (isFinite(data17)))) { + const err19 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/colSpan", + schemaPath: "#/properties/spanningCells/items/properties/colSpan/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err19]; + } + else { + vErrors.push(err19); + } + errors++; + } + if ((typeof data17 == "number") && (isFinite(data17))) { + if (data17 < 1 || isNaN(data17)) { + const err20 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/colSpan", + schemaPath: "#/properties/spanningCells/items/properties/colSpan/minimum", + keyword: "minimum", + params: { + comparison: ">=", + limit: 1 + }, + message: "must be >= 1" + }; + if (vErrors === null) { + vErrors = [err20]; + } + else { + vErrors.push(err20); + } + errors++; + } + } + } + if (data14.rowSpan !== undefined) { + let data18 = data14.rowSpan; + if (!(((typeof data18 == "number") && (!(data18 % 1) && !isNaN(data18))) && (isFinite(data18)))) { + const err21 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/rowSpan", + schemaPath: "#/properties/spanningCells/items/properties/rowSpan/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err21]; + } + else { + vErrors.push(err21); + } + errors++; + } + if ((typeof data18 == "number") && (isFinite(data18))) { + if (data18 < 1 || isNaN(data18)) { + const err22 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/rowSpan", + schemaPath: "#/properties/spanningCells/items/properties/rowSpan/minimum", + keyword: "minimum", + params: { + comparison: ">=", + limit: 1 + }, + message: "must be >= 1" + }; + if (vErrors === null) { + vErrors = [err22]; + } + else { + vErrors.push(err22); + } + errors++; + } + } + } + if (data14.alignment !== undefined) { + if (!(validate68(data14.alignment, { + instancePath: instancePath + "/spanningCells/" + i0 + "/alignment", + parentData: data14, + parentDataProperty: "alignment", + rootData + }))) { + vErrors = vErrors === null ? validate68.errors : vErrors.concat(validate68.errors); + errors = vErrors.length; + } + } + if (data14.verticalAlignment !== undefined) { + if (!(validate84(data14.verticalAlignment, { + instancePath: instancePath + "/spanningCells/" + i0 + "/verticalAlignment", + parentData: data14, + parentDataProperty: "verticalAlignment", + rootData + }))) { + vErrors = vErrors === null ? validate84.errors : vErrors.concat(validate84.errors); + errors = vErrors.length; + } + } + if (data14.wrapWord !== undefined) { + if (typeof data14.wrapWord !== "boolean") { + const err23 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/wrapWord", + schemaPath: "#/properties/spanningCells/items/properties/wrapWord/type", + keyword: "type", + params: { + type: "boolean" + }, + message: "must be boolean" + }; + if (vErrors === null) { + vErrors = [err23]; + } + else { + vErrors.push(err23); + } + errors++; + } + } + if (data14.truncate !== undefined) { + let data22 = data14.truncate; + if (!(((typeof data22 == "number") && (!(data22 % 1) && !isNaN(data22))) && (isFinite(data22)))) { + const err24 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/truncate", + schemaPath: "#/properties/spanningCells/items/properties/truncate/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err24]; + } + else { + vErrors.push(err24); + } + errors++; + } + } + if (data14.paddingLeft !== undefined) { + let data23 = data14.paddingLeft; + if (!(((typeof data23 == "number") && (!(data23 % 1) && !isNaN(data23))) && (isFinite(data23)))) { + const err25 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/paddingLeft", + schemaPath: "#/properties/spanningCells/items/properties/paddingLeft/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err25]; + } + else { + vErrors.push(err25); + } + errors++; + } + } + if (data14.paddingRight !== undefined) { + let data24 = data14.paddingRight; + if (!(((typeof data24 == "number") && (!(data24 % 1) && !isNaN(data24))) && (isFinite(data24)))) { + const err26 = { + instancePath: instancePath + "/spanningCells/" + i0 + "/paddingRight", + schemaPath: "#/properties/spanningCells/items/properties/paddingRight/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err26]; + } + else { + vErrors.push(err26); + } + errors++; + } + } + } + else { + const err27 = { + instancePath: instancePath + "/spanningCells/" + i0, + schemaPath: "#/properties/spanningCells/items/type", + keyword: "type", + params: { + type: "object" + }, + message: "must be object" + }; + if (vErrors === null) { + vErrors = [err27]; + } + else { + vErrors.push(err27); + } + errors++; + } + } + } + else { + const err28 = { + instancePath: instancePath + "/spanningCells", + schemaPath: "#/properties/spanningCells/type", + keyword: "type", + params: { + type: "array" + }, + message: "must be array" + }; + if (vErrors === null) { + vErrors = [err28]; + } + else { + vErrors.push(err28); + } + errors++; + } + } } else { - const err12 = { + const err29 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -1372,18 +1879,18 @@ function validate43(data, { instancePath = "", parentData, parentDataProperty, r message: "must be object" }; if (vErrors === null) { - vErrors = [err12]; + vErrors = [err29]; } else { - vErrors.push(err12); + vErrors.push(err29); } errors++; } validate43.errors = vErrors; return errors === 0; } -exports["streamConfig.json"] = validate76; -const schema22 = { +exports["streamConfig.json"] = validate86; +const schema24 = { "$id": "streamConfig.json", "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", @@ -1408,7 +1915,7 @@ const schema22 = { "required": ["columnDefault", "columnCount"], "additionalProperties": false }; -function validate77(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { +function validate87(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -1608,6 +2115,50 @@ function validate77(data, { instancePath = "", parentData, parentDataProperty, r errors = vErrors.length; } } + if (data.joinMiddleUp !== undefined) { + if (!(validate46(data.joinMiddleUp, { + instancePath: instancePath + "/joinMiddleUp", + parentData: data, + parentDataProperty: "joinMiddleUp", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinMiddleDown !== undefined) { + if (!(validate46(data.joinMiddleDown, { + instancePath: instancePath + "/joinMiddleDown", + parentData: data, + parentDataProperty: "joinMiddleDown", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinMiddleLeft !== undefined) { + if (!(validate46(data.joinMiddleLeft, { + instancePath: instancePath + "/joinMiddleLeft", + parentData: data, + parentDataProperty: "joinMiddleLeft", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } + if (data.joinMiddleRight !== undefined) { + if (!(validate46(data.joinMiddleRight, { + instancePath: instancePath + "/joinMiddleRight", + parentData: data, + parentDataProperty: "joinMiddleRight", + rootData + }))) { + vErrors = vErrors === null ? validate46.errors : vErrors.concat(validate46.errors); + errors = vErrors.length; + } + } } else { const err1 = { @@ -1627,10 +2178,10 @@ function validate77(data, { instancePath = "", parentData, parentDataProperty, r } errors++; } - validate77.errors = vErrors; + validate87.errors = vErrors; return errors === 0; } -function validate95(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { +function validate109(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; const _errs0 = errors; @@ -1660,13 +2211,13 @@ function validate95(data, { instancePath = "", parentData, parentDataProperty, r } for (const key1 in data) { if (pattern0.test(key1)) { - if (!(validate67(data[key1], { + if (!(validate71(data[key1], { instancePath: instancePath + "/" + key1.replace(/~/g, "~0").replace(/\//g, "~1"), parentData: data, parentDataProperty: key1, rootData }))) { - vErrors = vErrors === null ? validate67.errors : vErrors.concat(validate67.errors); + vErrors = vErrors === null ? validate71.errors : vErrors.concat(validate71.errors); errors = vErrors.length; } } @@ -1699,13 +2250,13 @@ function validate95(data, { instancePath = "", parentData, parentDataProperty, r if (Array.isArray(data)) { const len0 = data.length; for (let i0 = 0; i0 < len0; i0++) { - if (!(validate67(data[i0], { + if (!(validate71(data[i0], { instancePath: instancePath + "/" + i0, parentData: data, parentDataProperty: i0, rootData }))) { - vErrors = vErrors === null ? validate67.errors : vErrors.concat(validate67.errors); + vErrors = vErrors === null ? validate71.errors : vErrors.concat(validate71.errors); errors = vErrors.length; } } @@ -1768,10 +2319,10 @@ function validate95(data, { instancePath = "", parentData, parentDataProperty, r } } } - validate95.errors = vErrors; + validate109.errors = vErrors; return errors === 0; } -function validate99(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { +function validate113(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { let vErrors = null; let errors = 0; if (data && typeof data == "object" && !Array.isArray(data)) { @@ -1796,59 +2347,31 @@ function validate99(data, { instancePath = "", parentData, parentDataProperty, r } } if (data.alignment !== undefined) { - if (!(validate68(data.alignment, { + if (!(validate72(data.alignment, { instancePath: instancePath + "/alignment", parentData: data, parentDataProperty: "alignment", rootData }))) { - vErrors = vErrors === null ? validate68.errors : vErrors.concat(validate68.errors); + vErrors = vErrors === null ? validate72.errors : vErrors.concat(validate72.errors); errors = vErrors.length; } } if (data.verticalAlignment !== undefined) { - let data1 = data.verticalAlignment; - if (typeof data1 !== "string") { - const err1 = { - instancePath: instancePath + "/verticalAlignment", - schemaPath: "#/properties/verticalAlignment/type", - keyword: "type", - params: { - type: "string" - }, - message: "must be string" - }; - if (vErrors === null) { - vErrors = [err1]; - } - else { - vErrors.push(err1); - } - errors++; - } - if (!(((data1 === "top") || (data1 === "middle")) || (data1 === "bottom"))) { - const err2 = { - instancePath: instancePath + "/verticalAlignment", - schemaPath: "#/properties/verticalAlignment/enum", - keyword: "enum", - params: { - allowedValues: schema19.properties.verticalAlignment.enum - }, - message: "must be equal to one of the allowed values" - }; - if (vErrors === null) { - vErrors = [err2]; - } - else { - vErrors.push(err2); - } - errors++; + if (!(validate74(data.verticalAlignment, { + instancePath: instancePath + "/verticalAlignment", + parentData: data, + parentDataProperty: "verticalAlignment", + rootData + }))) { + vErrors = vErrors === null ? validate74.errors : vErrors.concat(validate74.errors); + errors = vErrors.length; } } if (data.width !== undefined) { let data2 = data.width; if (!(((typeof data2 == "number") && (!(data2 % 1) && !isNaN(data2))) && (isFinite(data2)))) { - const err3 = { + const err1 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/type", keyword: "type", @@ -1858,16 +2381,16 @@ function validate99(data, { instancePath = "", parentData, parentDataProperty, r message: "must be integer" }; if (vErrors === null) { - vErrors = [err3]; + vErrors = [err1]; } else { - vErrors.push(err3); + vErrors.push(err1); } errors++; } if ((typeof data2 == "number") && (isFinite(data2))) { if (data2 < 1 || isNaN(data2)) { - const err4 = { + const err2 = { instancePath: instancePath + "/width", schemaPath: "#/properties/width/minimum", keyword: "minimum", @@ -1878,10 +2401,10 @@ function validate99(data, { instancePath = "", parentData, parentDataProperty, r message: "must be >= 1" }; if (vErrors === null) { - vErrors = [err4]; + vErrors = [err2]; } else { - vErrors.push(err4); + vErrors.push(err2); } errors++; } @@ -1889,7 +2412,7 @@ function validate99(data, { instancePath = "", parentData, parentDataProperty, r } if (data.wrapWord !== undefined) { if (typeof data.wrapWord !== "boolean") { - const err5 = { + const err3 = { instancePath: instancePath + "/wrapWord", schemaPath: "#/properties/wrapWord/type", keyword: "type", @@ -1898,6 +2421,48 @@ function validate99(data, { instancePath = "", parentData, parentDataProperty, r }, message: "must be boolean" }; + if (vErrors === null) { + vErrors = [err3]; + } + else { + vErrors.push(err3); + } + errors++; + } + } + if (data.truncate !== undefined) { + let data4 = data.truncate; + if (!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) { + const err4 = { + instancePath: instancePath + "/truncate", + schemaPath: "#/properties/truncate/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; + if (vErrors === null) { + vErrors = [err4]; + } + else { + vErrors.push(err4); + } + errors++; + } + } + if (data.paddingLeft !== undefined) { + let data5 = data.paddingLeft; + if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) { + const err5 = { + instancePath: instancePath + "/paddingLeft", + schemaPath: "#/properties/paddingLeft/type", + keyword: "type", + params: { + type: "integer" + }, + message: "must be integer" + }; if (vErrors === null) { vErrors = [err5]; } @@ -1907,12 +2472,12 @@ function validate99(data, { instancePath = "", parentData, parentDataProperty, r errors++; } } - if (data.truncate !== undefined) { - let data4 = data.truncate; - if (!(((typeof data4 == "number") && (!(data4 % 1) && !isNaN(data4))) && (isFinite(data4)))) { + if (data.paddingRight !== undefined) { + let data6 = data.paddingRight; + if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) { const err6 = { - instancePath: instancePath + "/truncate", - schemaPath: "#/properties/truncate/type", + instancePath: instancePath + "/paddingRight", + schemaPath: "#/properties/paddingRight/type", keyword: "type", params: { type: "integer" @@ -1928,51 +2493,9 @@ function validate99(data, { instancePath = "", parentData, parentDataProperty, r errors++; } } - if (data.paddingLeft !== undefined) { - let data5 = data.paddingLeft; - if (!(((typeof data5 == "number") && (!(data5 % 1) && !isNaN(data5))) && (isFinite(data5)))) { - const err7 = { - instancePath: instancePath + "/paddingLeft", - schemaPath: "#/properties/paddingLeft/type", - keyword: "type", - params: { - type: "integer" - }, - message: "must be integer" - }; - if (vErrors === null) { - vErrors = [err7]; - } - else { - vErrors.push(err7); - } - errors++; - } - } - if (data.paddingRight !== undefined) { - let data6 = data.paddingRight; - if (!(((typeof data6 == "number") && (!(data6 % 1) && !isNaN(data6))) && (isFinite(data6)))) { - const err8 = { - instancePath: instancePath + "/paddingRight", - schemaPath: "#/properties/paddingRight/type", - keyword: "type", - params: { - type: "integer" - }, - message: "must be integer" - }; - if (vErrors === null) { - vErrors = [err8]; - } - else { - vErrors.push(err8); - } - errors++; - } - } } else { - const err9 = { + const err7 = { instancePath, schemaPath: "#/type", keyword: "type", @@ -1982,17 +2505,17 @@ function validate99(data, { instancePath = "", parentData, parentDataProperty, r message: "must be object" }; if (vErrors === null) { - vErrors = [err9]; + vErrors = [err7]; } else { - vErrors.push(err9); + vErrors.push(err7); } errors++; } - validate99.errors = vErrors; + validate113.errors = vErrors; return errors === 0; } -function validate76(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { +function validate86(data, { instancePath = "", parentData, parentDataProperty, rootData = data } = {}) { /*# sourceURL="streamConfig.json" */ ; let vErrors = null; let errors = 0; @@ -2054,35 +2577,35 @@ function validate76(data, { instancePath = "", parentData, parentDataProperty, r } } if (data.border !== undefined) { - if (!(validate77(data.border, { + if (!(validate87(data.border, { instancePath: instancePath + "/border", parentData: data, parentDataProperty: "border", rootData }))) { - vErrors = vErrors === null ? validate77.errors : vErrors.concat(validate77.errors); + vErrors = vErrors === null ? validate87.errors : vErrors.concat(validate87.errors); errors = vErrors.length; } } if (data.columns !== undefined) { - if (!(validate95(data.columns, { + if (!(validate109(data.columns, { instancePath: instancePath + "/columns", parentData: data, parentDataProperty: "columns", rootData }))) { - vErrors = vErrors === null ? validate95.errors : vErrors.concat(validate95.errors); + vErrors = vErrors === null ? validate109.errors : vErrors.concat(validate109.errors); errors = vErrors.length; } } if (data.columnDefault !== undefined) { - if (!(validate99(data.columnDefault, { + if (!(validate113(data.columnDefault, { instancePath: instancePath + "/columnDefault", parentData: data, parentDataProperty: "columnDefault", rootData }))) { - vErrors = vErrors === null ? validate99.errors : vErrors.concat(validate99.errors); + vErrors = vErrors === null ? validate113.errors : vErrors.concat(validate113.errors); errors = vErrors.length; } } @@ -2165,6 +2688,7 @@ function validate76(data, { instancePath = "", parentData, parentDataProperty, r } errors++; } - validate76.errors = vErrors; + validate86.errors = vErrors; return errors === 0; } +//# sourceMappingURL=validators.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/generated/validators.js.map b/node_modules/table/dist/src/generated/validators.js.map new file mode 100644 index 0000000000..0436fc2edb --- /dev/null +++ b/node_modules/table/dist/src/generated/validators.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../../src/generated/validators.js"],"names":[],"mappings":"AAAA,YAAY,CAAC;AACb,OAAO,CAAC,aAAa,CAAC,GAAG,UAAU,CAAC;AACpC,MAAM,QAAQ,GAAG;IACb,KAAK,EAAE,aAAa;IACpB,SAAS,EAAE,yCAAyC;IACpD,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE;QACV,QAAQ,EAAE;YACN,MAAM,EAAE,kCAAkC;SAC7C;QACD,QAAQ,EAAE;YACN,MAAM,EAAE,QAAQ;YAChB,YAAY,EAAE;gBACV,SAAS,EAAE;oBACP,MAAM,EAAE,QAAQ;iBACnB;gBACD,WAAW,EAAE;oBACT,MAAM,EAAE,oCAAoC;iBAC/C;gBACD,UAAU,EAAE;oBACR,MAAM,EAAE,SAAS;iBACpB;gBAC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;wBAClB,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;qBACpB;yBAAM;wBACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBACtB;oBACD,MAAM,EAAE,CAAC;iBACZ;aACJ;SACJ;QACD,IAAI,IAAI,CAAC,gBAAgB,KAAK,SAAS,EAAE;YACrC,IAAI,OAAO,IAAI,CAAC,gBAAgB,IAAI,UAAU,EAAE;gBAC5C,MAAM,IAAI,GAAG;oBACT,YAAY,EAAE,YAAY,GAAG,mBAAmB;oBAChD,UAAU,EAAE,sCAAsC;oBAClD,OAAO,EAAE,QAAQ;oBACjB,MAAM,EAAE,EAAE;oBACV,OAAO,EAAE,yCAAyC;iBACrD,CAAC;gBACF,IAAI,OAAO,KAAK,IAAI,EAAE;oBAClB,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;iBACpB;qBAAM;oBACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;iBACtB;gBACD,MAAM,EAAE,CAAC;aACZ;SACJ;KACJ;SAAM;QACH,MAAM,IAAI,GAAG;YACT,YAAY;YACZ,UAAU,EAAE,QAAQ;YACpB,OAAO,EAAE,MAAM;YACf,MAAM,EAAE;gBACJ,IAAI,EAAE,QAAQ;aACjB;YACD,OAAO,EAAE,gBAAgB;SAC5B,CAAC;QACF,IAAI,OAAO,KAAK,IAAI,EAAE;YAClB,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;SACpB;aAAM;YACH,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACtB;QACD,MAAM,EAAE,CAAC;KACZ;IACD,UAAU,CAAC,MAAM,GAAG,OAAO,CAAC;IAC5B,OAAO,MAAM,KAAK,CAAC,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/node_modules/table/dist/getBorderCharacters.d.ts b/node_modules/table/dist/src/getBorderCharacters.d.ts similarity index 100% rename from node_modules/table/dist/getBorderCharacters.d.ts rename to node_modules/table/dist/src/getBorderCharacters.d.ts diff --git a/node_modules/table/dist/getBorderCharacters.js b/node_modules/table/dist/src/getBorderCharacters.js similarity index 80% rename from node_modules/table/dist/getBorderCharacters.js rename to node_modules/table/dist/src/getBorderCharacters.js index 3662a8a2ef..24b2612ce0 100644 --- a/node_modules/table/dist/getBorderCharacters.js +++ b/node_modules/table/dist/src/getBorderCharacters.js @@ -21,6 +21,10 @@ const getBorderCharacters = (name) => { joinLeft: '╟', joinRight: '╢', joinJoin: '┼', + joinMiddleDown: '┬', + joinMiddleUp: '┴', + joinMiddleLeft: '┤', + joinMiddleRight: '├', }; } if (name === 'norc') { @@ -41,6 +45,10 @@ const getBorderCharacters = (name) => { joinLeft: '├', joinRight: '┤', joinJoin: '┼', + joinMiddleDown: '┬', + joinMiddleUp: '┴', + joinMiddleLeft: '┤', + joinMiddleRight: '├', }; } if (name === 'ramac') { @@ -61,6 +69,10 @@ const getBorderCharacters = (name) => { joinLeft: '|', joinRight: '|', joinJoin: '|', + joinMiddleDown: '+', + joinMiddleUp: '+', + joinMiddleLeft: '+', + joinMiddleRight: '+', }; } if (name === 'void') { @@ -81,8 +93,13 @@ const getBorderCharacters = (name) => { joinLeft: '', joinRight: '', joinJoin: '', + joinMiddleDown: '', + joinMiddleUp: '', + joinMiddleLeft: '', + joinMiddleRight: '', }; } throw new Error('Unknown border template "' + name + '".'); }; exports.getBorderCharacters = getBorderCharacters; +//# sourceMappingURL=getBorderCharacters.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/getBorderCharacters.js.map b/node_modules/table/dist/src/getBorderCharacters.js.map new file mode 100644 index 0000000000..848b993e16 --- /dev/null +++ b/node_modules/table/dist/src/getBorderCharacters.js.map @@ -0,0 +1 @@ +{"version":3,"file":"getBorderCharacters.js","sourceRoot":"","sources":["../../src/getBorderCharacters.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAMzC,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAgB,EAAE;IAChE,IAAI,IAAI,KAAK,WAAW,EAAE;QACxB,OA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UAAU,EAAE,GAAG;YACf,WAAW,EAAE,GAAG;YAEhB,QAAQ,EAAE,GAAG;YACb,SAAS,EAAE,GAAG;YACd,QAAQ,EAAE,GAAG;YACb,UAAU,EAAE,GAAG;YAEf,QAAQ,EAAE,GAAG;YACb,QAAQ,EAAE,GAAG;YACb,SAAS,EAAE,GAAG;YACd,QAAQ,EAAE,GAAG;YACb,cAAc,EAAE,GAAG;YACnB,YAAY,EAAE,GAAG;YACjB,cAAc,EAAE,GAAG;YACnB,eAAe,EAAE,GAAG;SACrB,CAAC;KACH;IAED,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,OAAO;YACL,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,EAAE;YAEZ,UAAU,EAAE,EAAE;YACd,UAAU,EAAE,EAAE;YACd,UAAU,EAAE,EAAE;YACd,WAAW,EAAE,EAAE;YAEf,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,UAAU,EAAE,EAAE;YAEd,QAAQ,EAAE,EAAE;YACZ,QAAQ,EAAE,EAAE;YACZ,SAAS,EAAE,EAAE;YACb,QAAQ,EAAE,EAAE;YACZ,cAAc,EAAE,EAAE;YAClB,YAAY,EAAE,EAAE;YAChB,cAAc,EAAE,EAAE;YAClB,eAAe,EAAE,EAAE;SACpB,CAAC;KACH;IAED,MAAM,IAAI,KAAK,CAAC,2BAA2B,GAAG,IAAI,GAAG,IAAI,CAAC,CAAC;AAC7D,CAAC,CAAC;AAlHW,QAAA,mBAAmB,uBAkH9B"} \ No newline at end of file diff --git a/node_modules/table/dist/index.d.ts b/node_modules/table/dist/src/index.d.ts similarity index 100% rename from node_modules/table/dist/index.d.ts rename to node_modules/table/dist/src/index.d.ts diff --git a/node_modules/table/dist/index.js b/node_modules/table/dist/src/index.js similarity index 97% rename from node_modules/table/dist/index.js rename to node_modules/table/dist/src/index.js index f8f84022f6..6271ec689a 100644 --- a/node_modules/table/dist/index.js +++ b/node_modules/table/dist/src/index.js @@ -18,3 +18,4 @@ Object.defineProperty(exports, "getBorderCharacters", { enumerable: true, get: f const table_1 = require("./table"); Object.defineProperty(exports, "table", { enumerable: true, get: function () { return table_1.table; } }); __exportStar(require("./types/api"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/index.js.map b/node_modules/table/dist/src/index.js.map new file mode 100644 index 0000000000..93443068c0 --- /dev/null +++ b/node_modules/table/dist/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,iDAEwB;AAUtB,6FAXA,2BAAY,OAWA;AATd,+DAE+B;AAQ7B,oGATA,yCAAmB,OASA;AAPrB,mCAEiB;AAGf,sFAJA,aAAK,OAIA;AAKP,8CAA4B"} \ No newline at end of file diff --git a/node_modules/table/dist/src/injectHeaderConfig.d.ts b/node_modules/table/dist/src/injectHeaderConfig.d.ts new file mode 100644 index 0000000000..8acf707184 --- /dev/null +++ b/node_modules/table/dist/src/injectHeaderConfig.d.ts @@ -0,0 +1,3 @@ +import type { SpanningCellConfig, TableUserConfig } from './types/api'; +import type { Row } from './types/internal'; +export declare const injectHeaderConfig: (rows: Row[], config: TableUserConfig) => [Row[], SpanningCellConfig[]]; diff --git a/node_modules/table/dist/src/injectHeaderConfig.js b/node_modules/table/dist/src/injectHeaderConfig.js new file mode 100644 index 0000000000..2e82d1253c --- /dev/null +++ b/node_modules/table/dist/src/injectHeaderConfig.js @@ -0,0 +1,29 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.injectHeaderConfig = void 0; +const injectHeaderConfig = (rows, config) => { + var _a; + let spanningCellConfig = (_a = config.spanningCells) !== null && _a !== void 0 ? _a : []; + const headerConfig = config.header; + const adjustedRows = [...rows]; + if (headerConfig) { + spanningCellConfig = spanningCellConfig.map(({ row, ...rest }) => { + return { ...rest, + row: row + 1 }; + }); + const { content, ...headerStyles } = headerConfig; + spanningCellConfig.unshift({ alignment: 'center', + col: 0, + colSpan: rows[0].length, + paddingLeft: 1, + paddingRight: 1, + row: 0, + wrapWord: false, + ...headerStyles }); + adjustedRows.unshift([content, ...Array.from({ length: rows[0].length - 1 }).fill('')]); + } + return [adjustedRows, + spanningCellConfig]; +}; +exports.injectHeaderConfig = injectHeaderConfig; +//# sourceMappingURL=injectHeaderConfig.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/injectHeaderConfig.js.map b/node_modules/table/dist/src/injectHeaderConfig.js.map new file mode 100644 index 0000000000..29eead9747 --- /dev/null +++ b/node_modules/table/dist/src/injectHeaderConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"injectHeaderConfig.js","sourceRoot":"","sources":["../../src/injectHeaderConfig.ts"],"names":[],"mappings":";;;AAQO,MAAM,kBAAkB,GAAG,CAAC,IAAW,EAAE,MAAuB,EAAiC,EAAE;;IACxG,IAAI,kBAAkB,GAAG,MAAA,MAAM,CAAC,aAAa,mCAAI,EAAE,CAAC;IACpD,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC;IACnC,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAE/B,IAAI,YAAY,EAAE;QAChB,kBAAkB,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAAC,EAAC,GAAG,EAAE,GAAG,IAAI,EAAC,EAAE,EAAE;YAC7D,OAAO,EAAC,GAAG,IAAI;gBACb,GAAG,EAAE,GAAG,GAAG,CAAC,EAAC,CAAC;QAClB,CAAC,CAAC,CAAC;QAEH,MAAM,EAAC,OAAO,EAAE,GAAG,YAAY,EAAC,GAAG,YAAY,CAAC;QAEhD,kBAAkB,CAAC,OAAO,CAAC,EAAC,SAAS,EAAE,QAAQ;YAC7C,GAAG,EAAE,CAAC;YACN,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM;YACvB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;YACf,GAAG,EAAE,CAAC;YACN,QAAQ,EAAE,KAAK;YACf,GAAG,YAAY,EAAC,CAAC,CAAC;QAEpB,YAAY,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,IAAI,CAAS,EAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,EAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KAC/F;IAED,OAAO,CAAC,YAAY;QAClB,kBAAkB,CAAC,CAAC;AACxB,CAAC,CAAC;AA3BW,QAAA,kBAAkB,sBA2B7B"} \ No newline at end of file diff --git a/node_modules/table/dist/src/makeRangeConfig.d.ts b/node_modules/table/dist/src/makeRangeConfig.d.ts new file mode 100644 index 0000000000..b2d2c336aa --- /dev/null +++ b/node_modules/table/dist/src/makeRangeConfig.d.ts @@ -0,0 +1,3 @@ +import type { SpanningCellConfig } from './types/api'; +import type { ColumnConfig, RangeConfig } from './types/internal'; +export declare const makeRangeConfig: (spanningCellConfig: SpanningCellConfig, columnsConfig: ColumnConfig[]) => RangeConfig; diff --git a/node_modules/table/dist/src/makeRangeConfig.js b/node_modules/table/dist/src/makeRangeConfig.js new file mode 100644 index 0000000000..2acd824c16 --- /dev/null +++ b/node_modules/table/dist/src/makeRangeConfig.js @@ -0,0 +1,18 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeRangeConfig = void 0; +const utils_1 = require("./utils"); +const makeRangeConfig = (spanningCellConfig, columnsConfig) => { + var _a; + const { topLeft, bottomRight } = (0, utils_1.calculateRangeCoordinate)(spanningCellConfig); + const cellConfig = { + ...columnsConfig[topLeft.col], + ...spanningCellConfig, + paddingRight: (_a = spanningCellConfig.paddingRight) !== null && _a !== void 0 ? _a : columnsConfig[bottomRight.col].paddingRight, + }; + return { ...cellConfig, + bottomRight, + topLeft }; +}; +exports.makeRangeConfig = makeRangeConfig; +//# sourceMappingURL=makeRangeConfig.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/makeRangeConfig.js.map b/node_modules/table/dist/src/makeRangeConfig.js.map new file mode 100644 index 0000000000..c37642ee7b --- /dev/null +++ b/node_modules/table/dist/src/makeRangeConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeRangeConfig.js","sourceRoot":"","sources":["../../src/makeRangeConfig.ts"],"names":[],"mappings":";;;AAMA,mCAEiB;AAEV,MAAM,eAAe,GAAG,CAAC,kBAAsC,EAAE,aAA6B,EAAe,EAAE;;IACpH,MAAM,EAAC,OAAO,EAAE,WAAW,EAAC,GAAG,IAAA,gCAAwB,EAAC,kBAAkB,CAAC,CAAC;IAE5E,MAAM,UAAU,GAA6B;QAC3C,GAAG,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC;QAC7B,GAAG,kBAAkB;QACrB,YAAY,EACV,MAAA,kBAAkB,CAAC,YAAY,mCAC/B,aAAa,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,YAAY;KAC9C,CAAC;IAEF,OAAO,EAAC,GAAG,UAAU;QACnB,WAAW;QACX,OAAO,EAAC,CAAC;AACb,CAAC,CAAC;AAdW,QAAA,eAAe,mBAc1B"} \ No newline at end of file diff --git a/node_modules/table/dist/makeStreamConfig.d.ts b/node_modules/table/dist/src/makeStreamConfig.d.ts similarity index 73% rename from node_modules/table/dist/makeStreamConfig.d.ts rename to node_modules/table/dist/src/makeStreamConfig.d.ts index 177ca2784e..cdd1f04528 100644 --- a/node_modules/table/dist/makeStreamConfig.d.ts +++ b/node_modules/table/dist/src/makeStreamConfig.d.ts @@ -4,4 +4,4 @@ import type { StreamConfig } from './types/internal'; * Makes a new configuration object out of the userConfig object * using default values for the missing configuration properties. */ -export declare const makeStreamConfig: (userConfig: StreamUserConfig) => StreamConfig; +export declare const makeStreamConfig: (config: StreamUserConfig) => StreamConfig; diff --git a/node_modules/table/dist/makeStreamConfig.js b/node_modules/table/dist/src/makeStreamConfig.js similarity index 74% rename from node_modules/table/dist/makeStreamConfig.js rename to node_modules/table/dist/src/makeStreamConfig.js index b8ae96f40b..227b5795ca 100644 --- a/node_modules/table/dist/makeStreamConfig.js +++ b/node_modules/table/dist/src/makeStreamConfig.js @@ -1,10 +1,6 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeStreamConfig = void 0; -const lodash_clonedeep_1 = __importDefault(require("lodash.clonedeep")); const utils_1 = require("./utils"); const validateConfig_1 = require("./validateConfig"); /** @@ -29,9 +25,8 @@ const makeColumnsConfig = (columnCount, columns = {}, columnDefault) => { * Makes a new configuration object out of the userConfig object * using default values for the missing configuration properties. */ -const makeStreamConfig = (userConfig) => { - validateConfig_1.validateConfig('streamConfig.json', userConfig); - const config = lodash_clonedeep_1.default(userConfig); +const makeStreamConfig = (config) => { + (0, validateConfig_1.validateConfig)('streamConfig.json', config); if (config.columnDefault.width === undefined) { throw new Error('Must provide config.columnDefault.width when creating a stream.'); } @@ -40,8 +35,9 @@ const makeStreamConfig = (userConfig) => { return true; }, ...config, - border: utils_1.makeBorderConfig(config.border), + border: (0, utils_1.makeBorderConfig)(config.border), columns: makeColumnsConfig(config.columnCount, config.columns, config.columnDefault), }; }; exports.makeStreamConfig = makeStreamConfig; +//# sourceMappingURL=makeStreamConfig.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/makeStreamConfig.js.map b/node_modules/table/dist/src/makeStreamConfig.js.map new file mode 100644 index 0000000000..715a3fe049 --- /dev/null +++ b/node_modules/table/dist/src/makeStreamConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeStreamConfig.js","sourceRoot":"","sources":["../../src/makeStreamConfig.ts"],"names":[],"mappings":";;;AASA,mCAEiB;AACjB,qDAE0B;AAE1B;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,WAAmB,EAC5C,UAAuC,EAAE,EACzC,aAAgD,EAAkB,EAAE;IACpE,OAAO,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,WAAW,EAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,EAAE;QACxD,OAAO;YACL,SAAS,EAAE,MAAM;YACjB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,MAAM,CAAC,iBAAiB;YAClC,iBAAiB,EAAE,KAAK;YACxB,QAAQ,EAAE,KAAK;YACf,GAAG,aAAa;YAChB,GAAG,OAAO,CAAC,KAAK,CAAC;SAClB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF;;;GAGG;AACI,MAAM,gBAAgB,GAAG,CAAC,MAAwB,EAAgB,EAAE;IACzE,IAAA,+BAAc,EAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;IAE5C,IAAI,MAAM,CAAC,aAAa,CAAC,KAAK,KAAK,SAAS,EAAE;QAC5C,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;KACpF;IAED,OAAO;QACL,gBAAgB,EAAE,GAAG,EAAE;YACrB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,GAAG,MAAM;QACT,MAAM,EAAE,IAAA,wBAAgB,EAAC,MAAM,CAAC,MAAM,CAAC;QACvC,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,aAAa,CAAC;KACrF,CAAC;AACJ,CAAC,CAAC;AAfW,QAAA,gBAAgB,oBAe3B"} \ No newline at end of file diff --git a/node_modules/table/dist/src/makeTableConfig.d.ts b/node_modules/table/dist/src/makeTableConfig.d.ts new file mode 100644 index 0000000000..599c018e12 --- /dev/null +++ b/node_modules/table/dist/src/makeTableConfig.d.ts @@ -0,0 +1,7 @@ +import type { SpanningCellConfig, TableUserConfig } from './types/api'; +import type { Row, TableConfig } from './types/internal'; +/** + * Makes a new configuration object out of the userConfig object + * using default values for the missing configuration properties. + */ +export declare const makeTableConfig: (rows: Row[], config?: TableUserConfig, injectedSpanningCellConfig?: SpanningCellConfig[] | undefined) => TableConfig; diff --git a/node_modules/table/dist/src/makeTableConfig.js b/node_modules/table/dist/src/makeTableConfig.js new file mode 100644 index 0000000000..8b858aea30 --- /dev/null +++ b/node_modules/table/dist/src/makeTableConfig.js @@ -0,0 +1,62 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeTableConfig = void 0; +const calculateMaximumColumnWidths_1 = require("./calculateMaximumColumnWidths"); +const spanningCellManager_1 = require("./spanningCellManager"); +const utils_1 = require("./utils"); +const validateConfig_1 = require("./validateConfig"); +const validateSpanningCellConfig_1 = require("./validateSpanningCellConfig"); +/** + * Creates a configuration for every column using default + * values for the missing configuration properties. + */ +const makeColumnsConfig = (rows, columns, columnDefault, spanningCellConfigs) => { + const columnWidths = (0, calculateMaximumColumnWidths_1.calculateMaximumColumnWidths)(rows, spanningCellConfigs); + return rows[0].map((_, columnIndex) => { + return { + alignment: 'left', + paddingLeft: 1, + paddingRight: 1, + truncate: Number.POSITIVE_INFINITY, + verticalAlignment: 'top', + width: columnWidths[columnIndex], + wrapWord: false, + ...columnDefault, + ...columns === null || columns === void 0 ? void 0 : columns[columnIndex], + }; + }); +}; +/** + * Makes a new configuration object out of the userConfig object + * using default values for the missing configuration properties. + */ +const makeTableConfig = (rows, config = {}, injectedSpanningCellConfig) => { + var _a, _b, _c, _d, _e; + (0, validateConfig_1.validateConfig)('config.json', config); + (0, validateSpanningCellConfig_1.validateSpanningCellConfig)(rows, (_a = config.spanningCells) !== null && _a !== void 0 ? _a : []); + const spanningCellConfigs = (_b = injectedSpanningCellConfig !== null && injectedSpanningCellConfig !== void 0 ? injectedSpanningCellConfig : config.spanningCells) !== null && _b !== void 0 ? _b : []; + const columnsConfig = makeColumnsConfig(rows, config.columns, config.columnDefault, spanningCellConfigs); + const drawVerticalLine = (_c = config.drawVerticalLine) !== null && _c !== void 0 ? _c : (() => { + return true; + }); + const drawHorizontalLine = (_d = config.drawHorizontalLine) !== null && _d !== void 0 ? _d : (() => { + return true; + }); + return { + ...config, + border: (0, utils_1.makeBorderConfig)(config.border), + columns: columnsConfig, + drawHorizontalLine, + drawVerticalLine, + singleLine: (_e = config.singleLine) !== null && _e !== void 0 ? _e : false, + spanningCellManager: (0, spanningCellManager_1.createSpanningCellManager)({ + columnsConfig, + drawHorizontalLine, + drawVerticalLine, + rows, + spanningCellConfigs, + }), + }; +}; +exports.makeTableConfig = makeTableConfig; +//# sourceMappingURL=makeTableConfig.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/makeTableConfig.js.map b/node_modules/table/dist/src/makeTableConfig.js.map new file mode 100644 index 0000000000..11617bf6ca --- /dev/null +++ b/node_modules/table/dist/src/makeTableConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"makeTableConfig.js","sourceRoot":"","sources":["../../src/makeTableConfig.ts"],"names":[],"mappings":";;;AAAA,iFAEwC;AACxC,+DAE+B;AAS/B,mCAEiB;AACjB,qDAE0B;AAC1B,6EAEsC;AAEtC;;;GAGG;AACH,MAAM,iBAAiB,GAAG,CAAC,IAAW,EACpC,OAAqC,EACrC,aAAgC,EAChC,mBAA0C,EAAkB,EAAE;IAC9D,MAAM,YAAY,GAAG,IAAA,2DAA4B,EAAC,IAAI,EAAE,mBAAmB,CAAC,CAAC;IAE7E,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,EAAE;QACpC,OAAO;YACL,SAAS,EAAE,MAAM;YACjB,WAAW,EAAE,CAAC;YACd,YAAY,EAAE,CAAC;YACf,QAAQ,EAAE,MAAM,CAAC,iBAAiB;YAClC,iBAAiB,EAAE,KAAK;YACxB,KAAK,EAAE,YAAY,CAAC,WAAW,CAAC;YAChC,QAAQ,EAAE,KAAK;YACf,GAAG,aAAa;YAChB,GAAG,OAAO,aAAP,OAAO,uBAA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eights.d.ts b/node_modules/table/dist/src/mapDataUsingRowHeights.d.ts new file mode 100644 index 0000000000..1508e905dc --- /dev/null +++ b/node_modules/table/dist/src/mapDataUsingRowHeights.d.ts @@ -0,0 +1,4 @@ +import type { VerticalAlignment } from './types/api'; +import type { BaseConfig, Row } from './types/internal'; +export declare const padCellVertically: (lines: string[], rowHeight: number, verticalAlignment: VerticalAlignment) => string[]; +export declare const mapDataUsingRowHeights: (unmappedRows: Row[], rowHeights: number[], config: BaseConfig) => Row[]; diff --git a/node_modules/table/dist/mapDataUsingRowHeights.js b/node_modules/table/dist/src/mapDataUsingRowHeights.js similarity index 51% rename from node_modules/table/dist/mapDataUsingRowHeights.js rename to node_modules/table/dist/src/mapDataUsingRowHeights.js index 5727681d4e..c13003dc84 100644 --- a/node_modules/table/dist/mapDataUsingRowHeights.js +++ b/node_modules/table/dist/src/mapDataUsingRowHeights.js @@ -1,12 +1,12 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.mapDataUsingRowHeights = void 0; +exports.mapDataUsingRowHeights = exports.padCellVertically = void 0; +const utils_1 = require("./utils"); const wrapCell_1 = require("./wrapCell"); const createEmptyStrings = (length) => { return new Array(length).fill(''); }; -const padCellVertically = (lines, rowHeight, columnConfig) => { - const { verticalAlignment } = columnConfig; +const padCellVertically = (lines, rowHeight, verticalAlignment) => { const availableLines = rowHeight - lines.length; if (verticalAlignment === 'top') { return [...lines, ...createEmptyStrings(availableLines)]; @@ -20,25 +20,33 @@ const padCellVertically = (lines, rowHeight, columnConfig) => { ...createEmptyStrings(Math.ceil(availableLines / 2)), ]; }; -const flatten = (array) => { - return [].concat(...array); -}; +exports.padCellVertically = padCellVertically; const mapDataUsingRowHeights = (unmappedRows, rowHeights, config) => { - const tableWidth = unmappedRows[0].length; + const nColumns = unmappedRows[0].length; const mappedRows = unmappedRows.map((unmappedRow, unmappedRowIndex) => { const outputRowHeight = rowHeights[unmappedRowIndex]; const outputRow = Array.from({ length: outputRowHeight }, () => { - return new Array(tableWidth).fill(''); + return new Array(nColumns).fill(''); }); unmappedRow.forEach((cell, cellIndex) => { - const cellLines = wrapCell_1.wrapCell(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord); - const paddedCellLines = padCellVertically(cellLines, outputRowHeight, config.columns[cellIndex]); + var _a; + const containingRange = (_a = config.spanningCellManager) === null || _a === void 0 ? void 0 : _a.getContainingRange({ col: cellIndex, + row: unmappedRowIndex }); + if (containingRange) { + containingRange.extractCellContent(unmappedRowIndex).forEach((cellLine, cellLineIndex) => { + outputRow[cellLineIndex][cellIndex] = cellLine; + }); + return; + } + const cellLines = (0, wrapCell_1.wrapCell)(cell, config.columns[cellIndex].width, config.columns[cellIndex].wrapWord); + const paddedCellLines = (0, exports.padCellVertically)(cellLines, outputRowHeight, config.columns[cellIndex].verticalAlignment); paddedCellLines.forEach((cellLine, cellLineIndex) => { outputRow[cellLineIndex][cellIndex] = cellLine; }); }); return outputRow; }); - return flatten(mappedRows); + return (0, utils_1.flatten)(mappedRows); }; exports.mapDataUsingRowHeights = mapDataUsingRowHeights; +//# sourceMappingURL=mapDataUsingRowHeights.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/mapDataUsingRowHeights.js.map b/node_modules/table/dist/src/mapDataUsingRowHeights.js.map new file mode 100644 index 0000000000..7bbe0f86cb --- /dev/null +++ b/node_modules/table/dist/src/mapDataUsingRowHeights.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mapDataUsingRowHeights.js","sourceRoot":"","sources":["../../src/mapDataUsingRowHeights.ts"],"names":[],"mappings":";;;AAOA,mCAEiB;AACjB,yCAEoB;AAEpB,MAAM,kBAAkB,GAAG,CAAC,MAAc,EAAE,EAAE;IAC5C,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACpC,CAAC,CAAC;AAEK,MAAM,iBAAiB,GAAG,CAAC,KAAe,EAAE,SAAiB,EAAE,iBAAoC,EAAY,EAAE;IACt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,gBAAgB,EAAC,CAAC,CAAC;YAC1B,IAAI,eAAe,EAAE;gBACnB,eAAe,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE;oBACvF,SAAS,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;gBACjD,CAAC,CAAC,CAAC;gBAEH,OAAO;aACR;YACD,MAAM,SAAS,GAAG,IAAA,mBAAQ,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,CAAC;YAEtG,MAAM,eAAe,GAAG,IAAA,yBAAiB,EAAC,SAAS,EAAE,eAAe,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,iBAAiB,CAAC,CAAC;YAEnH,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,aAAa,EAAE,EAAE;gBAClD,SAAS,CAAC,aAAa,CAAC,CAAC,SAAS,CAAC,GAAG,QAAQ,CAAC;YACjD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC,CAAC;IAEH,OAAO,IAAA,eAAO,EAAC,UAAU,CAAC,CAAC;AAC7B,CAAC,CAAC;AAhCW,QAAA,sBAAsB,0BAgCjC"} \ No newline at end of file diff --git a/node_modules/table/dist/padTableData.d.ts b/node_modules/table/dist/src/padTableData.d.ts similarity index 100% rename from node_modules/table/dist/padTableData.d.ts rename to node_modules/table/dist/src/padTableData.d.ts diff --git a/node_modules/table/dist/padTableData.js b/node_modules/table/dist/src/padTableData.js similarity index 53% rename from node_modules/table/dist/padTableData.js rename to node_modules/table/dist/src/padTableData.js index c0016ab5cd..38580f82ce 100644 --- a/node_modules/table/dist/padTableData.js +++ b/node_modules/table/dist/src/padTableData.js @@ -6,11 +6,18 @@ const padString = (input, paddingLeft, paddingRight) => { }; exports.padString = padString; const padTableData = (rows, config) => { - return rows.map((cells) => { + return rows.map((cells, rowIndex) => { return cells.map((cell, cellIndex) => { + var _a; + const containingRange = (_a = config.spanningCellManager) === null || _a === void 0 ? void 0 : _a.getContainingRange({ col: cellIndex, + row: rowIndex }, { mapped: true }); + if (containingRange) { + return cell; + } const { paddingLeft, paddingRight } = config.columns[cellIndex]; - return exports.padString(cell, paddingLeft, paddingRight); + return (0, exports.padString)(cell, paddingLeft, paddingRight); }); }); }; exports.padTableData = padTableData; +//# sourceMappingURL=padTableData.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/padTableData.js.map b/node_modules/table/dist/src/padTableData.js.map new file mode 100644 index 0000000000..2cf9c94c1f --- /dev/null +++ b/node_modules/table/dist/src/padTableData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"padTableData.js","sourceRoot":"","sources":["../../src/padTableData.ts"],"names":[],"mappings":";;;AAKO,MAAM,SAAS,GAAG,CAAC,KAAa,EAAE,WAAmB,EAAE,YAAoB,EAAU,EAAE;IAC5F,OAAO,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE,CAAC,CAAC;AAFW,QAAA,SAAS,aAEpB;AAEK,MAAM,YAAY,GAAG,CAAC,IAAW,EAAE,MAAkB,EAAS,EAAE;IACrE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAClC,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;;YACnC,MAAM,eAAe,GAAG,MAAA,MAAM,CAAC,mBAAmB,0CAAE,kBAAkB,CAAC,EAAC,GAAG,EAAE,SAAS;gBACpF,GAAG,EAAE,QAAQ,EAAC,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;YAClC,IAAI,eAAe,EAAE;gBACnB,OAAO,IAAI,CAAC;aACb;YAED,MAAM,EAAC,WAAW,EAAE,YAAY,EAAC,GAAG,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;YAE9D,OAAO,IAAA,iBAAS,EAAC,IAAI,EAAE,WAAW,EAAE,YAAY,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAdW,QAAA,YAAY,gBAcvB"} \ No newline at end of file diff --git a/node_modules/table/dist/src/schemas/config.json b/node_modules/table/dist/src/schemas/config.json new file mode 100644 index 0000000000..cccb5ac1b9 --- /dev/null +++ b/node_modules/table/dist/src/schemas/config.json @@ -0,0 +1,95 @@ +{ + "$id": "config.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "border": { + "$ref": "shared.json#/definitions/borders" + }, + "header": { + "type": "object", + "properties": { + "content": { + "type": "string" + }, + "alignment": { + "$ref": "shared.json#/definitions/alignment" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "integer" + }, + "paddingLeft": { + "type": "integer" + }, + "paddingRight": { + "type": "integer" + } + }, + "required": ["content"], + "additionalProperties": false + }, + "columns": { + "$ref": "shared.json#/definitions/columns" + }, + "columnDefault": { + "$ref": "shared.json#/definitions/column" + }, + "drawVerticalLine": { + "typeof": "function" + }, + "drawHorizontalLine": { + "typeof": "function" + }, + "singleLine": { + "typeof": "boolean" + }, + "spanningCells": { + "type": "array", + "items": { + "type": "object", + "properties": { + "col": { + "type": "integer", + "minimum": 0 + }, + "row": { + "type": "integer", + "minimum": 0 + }, + "colSpan": { + "type": "integer", + "minimum": 1 + }, + "rowSpan": { + "type": "integer", + "minimum": 1 + }, + "alignment": { + "$ref": "shared.json#/definitions/alignment" + }, + "verticalAlignment": { + "$ref": "shared.json#/definitions/verticalAlignment" + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "integer" + }, + "paddingLeft": { + "type": "integer" + }, + "paddingRight": { + "type": "integer" + } + }, + "required": ["row", "col"], + "additionalProperties": false + } + } + }, + "additionalProperties": false +} diff --git a/node_modules/table/dist/src/schemas/shared.json b/node_modules/table/dist/src/schemas/shared.json new file mode 100644 index 0000000000..52a2d3a644 --- /dev/null +++ b/node_modules/table/dist/src/schemas/shared.json @@ -0,0 +1,139 @@ +{ + "$id": "shared.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "definitions": { + "columns": { + "oneOf": [ + { + "type": "object", + "patternProperties": { + "^[0-9]+$": { + "$ref": "#/definitions/column" + } + }, + "additionalProperties": false + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/column" + } + } + ] + }, + "column": { + "type": "object", + "properties": { + "alignment": { + "$ref": "#/definitions/alignment" + }, + "verticalAlignment": { + "$ref": "#/definitions/verticalAlignment" + }, + "width": { + "type": "integer", + "minimum": 1 + }, + "wrapWord": { + "type": "boolean" + }, + "truncate": { + "type": "integer" + }, + "paddingLeft": { + "type": "integer" + }, + "paddingRight": { + "type": "integer" + } + }, + "additionalProperties": false + }, + "borders": { + "type": "object", + "properties": { + "topBody": { + "$ref": "#/definitions/border" + }, + "topJoin": { + "$ref": "#/definitions/border" + }, + "topLeft": { + "$ref": "#/definitions/border" + }, + "topRight": { + "$ref": "#/definitions/border" + }, + "bottomBody": { + "$ref": "#/definitions/border" + }, + "bottomJoin": { + "$ref": "#/definitions/border" + }, + "bottomLeft": { + "$ref": "#/definitions/border" + }, + "bottomRight": { + "$ref": "#/definitions/border" + }, + "bodyLeft": { + "$ref": "#/definitions/border" + }, + "bodyRight": { + "$ref": "#/definitions/border" + }, + "bodyJoin": { + "$ref": "#/definitions/border" + }, + "headerJoin": { + "$ref": "#/definitions/border" + }, + "joinBody": { + "$ref": "#/definitions/border" + }, + "joinLeft": { + "$ref": "#/definitions/border" + }, + "joinRight": { + "$ref": "#/definitions/border" + }, + "joinJoin": { + "$ref": "#/definitions/border" + }, + "joinMiddleUp": { + "$ref": "#/definitions/border" + }, + "joinMiddleDown": { + "$ref": "#/definitions/border" + }, + "joinMiddleLeft": { + "$ref": "#/definitions/border" + }, + "joinMiddleRight": { + "$ref": "#/definitions/border" + } + }, + "additionalProperties": false + }, + "border": { + "type": "string" + }, + "alignment": { + "type": "string", + "enum": [ + "left", + "right", + "center", + "justify" + ] + }, + "verticalAlignment": { + "type": "string", + "enum": [ + "top", + "middle", + "bottom" + ] + } + } +} diff --git a/node_modules/table/dist/src/schemas/streamConfig.json b/node_modules/table/dist/src/schemas/streamConfig.json new file mode 100644 index 0000000000..94d3514012 --- /dev/null +++ b/node_modules/table/dist/src/schemas/streamConfig.json @@ -0,0 +1,25 @@ +{ + "$id": "streamConfig.json", + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "object", + "properties": { + "border": { + "$ref": "shared.json#/definitions/borders" + }, + "columns": { + "$ref": "shared.json#/definitions/columns" + }, + "columnDefault": { + "$ref": "shared.json#/definitions/column" + }, + "columnCount": { + "type": "integer", + "minimum": 1 + }, + "drawVerticalLine": { + "typeof": "function" + } + }, + "required": ["columnDefault", "columnCount"], + "additionalProperties": false +} diff --git a/node_modules/table/dist/src/spanningCellManager.d.ts b/node_modules/table/dist/src/spanningCellManager.d.ts new file mode 100644 index 0000000000..a865f6a01c --- /dev/null +++ b/node_modules/table/dist/src/spanningCellManager.d.ts @@ -0,0 +1,21 @@ +import type { DrawHorizontalLine, DrawVerticalLine, SpanningCellConfig } from './types/api'; +import type { CellCoordinates, ColumnConfig, ResolvedRangeConfig, Row } from './types/internal'; +export declare type SpanningCellManager = { + getContainingRange: (cell: CellCoordinates, options?: { + mapped: true; + }) => ResolvedRangeConfig | undefined; + inSameRange: (cell1: CellCoordinates, cell2: CellCoordinates) => boolean; + rowHeights: number[]; + setRowHeights: (rowHeights: number[]) => void; +}; +export declare type SpanningCellParameters = { + spanningCellConfigs: SpanningCellConfig[]; + rows: Row[]; + columnsConfig: ColumnConfig[]; + drawVerticalLine: DrawVerticalLine; + drawHorizontalLine: DrawHorizontalLine; +}; +export declare type SpanningCellContext = SpanningCellParameters & { + rowHeights: number[]; +}; +export declare const createSpanningCellManager: (parameters: SpanningCellParameters) => SpanningCellManager; diff --git a/node_modules/table/dist/src/spanningCellManager.js b/node_modules/table/dist/src/spanningCellManager.js new file mode 100644 index 0000000000..d74345dd8f --- /dev/null +++ b/node_modules/table/dist/src/spanningCellManager.js @@ -0,0 +1,86 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createSpanningCellManager = void 0; +const alignSpanningCell_1 = require("./alignSpanningCell"); +const calculateSpanningCellWidth_1 = require("./calculateSpanningCellWidth"); +const makeRangeConfig_1 = require("./makeRangeConfig"); +const utils_1 = require("./utils"); +const findRangeConfig = (cell, rangeConfigs) => { + return rangeConfigs.find((rangeCoordinate) => { + return (0, utils_1.isCellInRange)(cell, rangeCoordinate); + }); +}; +const getContainingRange = (rangeConfig, context) => { + const width = (0, calculateSpanningCellWidth_1.calculateSpanningCellWidth)(rangeConfig, context); + const wrappedContent = (0, alignSpanningCell_1.wrapRangeContent)(rangeConfig, width, context); + const alignedContent = (0, alignSpanningCell_1.alignVerticalRangeContent)(rangeConfig, wrappedContent, context); + const getCellContent = (rowIndex) => { + const { topLeft } = rangeConfig; + const { drawHorizontalLine, rowHeights } = context; + const totalWithinHorizontalBorderHeight = rowIndex - topLeft.row; + const totalHiddenHorizontalBorderHeight = (0, utils_1.sequence)(topLeft.row + 1, rowIndex).filter((index) => { + /* istanbul ignore next */ + return !(drawHorizontalLine === null || drawHorizontalLine === void 0 ? void 0 : drawHorizontalLine(index, rowHeights.length)); + }).length; + const offset = (0, utils_1.sumArray)(rowHeights.slice(topLeft.row, rowIndex)) + totalWithinHorizontalBorderHeight - totalHiddenHorizontalBorderHeight; + return alignedContent.slice(offset, offset + rowHeights[rowIndex]); + }; + const getBorderContent = (borderIndex) => { + const { topLeft } = rangeConfig; + const offset = (0, utils_1.sumArray)(context.rowHeights.slice(topLeft.row, borderIndex)) + (borderIndex - topLeft.row - 1); + return alignedContent[offset]; + }; + return { + ...rangeConfig, + extractBorderContent: getBorderContent, + extractCellContent: getCellContent, + height: wrappedContent.length, + width, + }; +}; +const inSameRange = (cell1, cell2, ranges) => { + const range1 = findRangeConfig(cell1, ranges); + const range2 = findRangeConfig(cell2, ranges); + if (range1 && range2) { + return (0, utils_1.areCellEqual)(range1.topLeft, range2.topLeft); + } + return false; +}; +const hashRange = (range) => { + const { row, col } = range.topLeft; + return `${row}/${col}`; +}; +const createSpanningCellManager = (parameters) => { + const { spanningCellConfigs, columnsConfig } = parameters; + const ranges = spanningCellConfigs.map((config) => { + return (0, makeRangeConfig_1.makeRangeConfig)(config, columnsConfig); + }); + const rangeCache = {}; + let rowHeights = []; + return { getContainingRange: (cell, options) => { + var _a; + const originalRow = (options === null || options === void 0 ? void 0 : options.mapped) ? (0, utils_1.findOriginalRowIndex)(rowHeights, cell.row) : cell.row; + const range = findRangeConfig({ ...cell, + row: originalRow }, ranges); + if (!range) { + return undefined; + } + if (rowHeights.length === 0) { + return getContainingRange(range, { ...parameters, + rowHeights }); + } + const hash = hashRange(range); + (_a = rangeCache[hash]) !== null && _a !== void 0 ? _a : (rangeCache[hash] = getContainingRange(range, { ...parameters, + rowHeights })); + return rangeCache[hash]; + }, + inSameRange: (cell1, cell2) => { + return inSameRange(cell1, cell2, ranges); + }, + rowHeights, + setRowHeights: (_rowHeights) => { + rowHeights = _rowHeights; + } }; +}; +exports.createSpanningCellManager = createSpanningCellManager; +//# sourceMappingURL=spanningCellManager.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/spanningCellManager.js.map b/node_modules/table/dist/src/spanningCellManager.js.map new file mode 100644 index 0000000000..4c58a5da6b --- /dev/null +++ b/node_modules/table/dist/src/spanningCellManager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"spanningCellManager.js","sourceRoot":"","sources":["../../src/spanningCellManager.ts"],"names":[],"mappings":";;;AAAA,2DAE6B;AAC7B,6EAEsC;AACtC,uDAE2B;AAa3B,mCAIiB;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,KAAK,EAAE,MAAM,CAAC,CAAC;QAC3C,CAAC;QACD,UAAU;QACV,aAAa,EAAE,CAAC,WAAqB,EAAE,EAAE;YACvC,UAAU,GAAG,WAAW,CAAC;QAC3B,CAAC,EAAC,CAAC;AACL,CAAC,CAAC;AArCW,QAAA,yBAAyB,6BAqCpC"} \ No newline at end of file diff --git a/node_modules/table/dist/stringifyTableData.d.ts b/node_modules/table/dist/src/stringifyTableData.d.ts similarity index 100% rename from node_modules/table/dist/stringifyTableData.d.ts rename to node_modules/table/dist/src/stringifyTableData.d.ts diff --git a/node_modules/table/dist/stringifyTableData.js b/node_modules/table/dist/src/stringifyTableData.js similarity index 75% rename from node_modules/table/dist/stringifyTableData.js rename to node_modules/table/dist/src/stringifyTableData.js index 961b78d0bb..177141ace2 100644 --- a/node_modules/table/dist/stringifyTableData.js +++ b/node_modules/table/dist/src/stringifyTableData.js @@ -5,8 +5,9 @@ const utils_1 = require("./utils"); const stringifyTableData = (rows) => { return rows.map((cells) => { return cells.map((cell) => { - return utils_1.normalizeString(String(cell)); + return (0, utils_1.normalizeString)(String(cell)); }); }); }; exports.stringifyTableData = stringifyTableData; +//# sourceMappingURL=stringifyTableData.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/stringifyTableData.js.map b/node_modules/table/dist/src/stringifyTableData.js.map new file mode 100644 index 0000000000..84a4b1257b --- /dev/null +++ b/node_modules/table/dist/src/stringifyTableData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stringifyTableData.js","sourceRoot":"","sources":["../../src/stringifyTableData.ts"],"names":[],"mappings":";;;AAGA,mCAEiB;AAEV,MAAM,kBAAkB,GAAG,CAAC,IAAiB,EAAS,EAAE;IAC7D,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACxB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACxB,OAAO,IAAA,uBAAe,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AANW,QAAA,kBAAkB,sBAM7B"} \ No newline at end of file diff --git a/node_modules/table/dist/table.d.ts b/node_modules/table/dist/src/table.d.ts similarity index 100% rename from node_modules/table/dist/table.d.ts rename to node_modules/table/dist/src/table.d.ts diff --git a/node_modules/table/dist/src/table.js b/node_modules/table/dist/src/table.js new file mode 100644 index 0000000000..0a8622728d --- /dev/null +++ b/node_modules/table/dist/src/table.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.table = void 0; +const alignTableData_1 = require("./alignTableData"); +const calculateOutputColumnWidths_1 = require("./calculateOutputColumnWidths"); +const calculateRowHeights_1 = require("./calculateRowHeights"); +const drawTable_1 = require("./drawTable"); +const injectHeaderConfig_1 = require("./injectHeaderConfig"); +const makeTableConfig_1 = require("./makeTableConfig"); +const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights"); +const padTableData_1 = require("./padTableData"); +const stringifyTableData_1 = require("./stringifyTableData"); +const truncateTableData_1 = require("./truncateTableData"); +const utils_1 = require("./utils"); +const validateTableData_1 = require("./validateTableData"); +const table = (data, userConfig = {}) => { + (0, validateTableData_1.validateTableData)(data); + let rows = (0, stringifyTableData_1.stringifyTableData)(data); + const [injectedRows, injectedSpanningCellConfig] = (0, injectHeaderConfig_1.injectHeaderConfig)(rows, userConfig); + const config = (0, makeTableConfig_1.makeTableConfig)(injectedRows, userConfig, injectedSpanningCellConfig); + rows = (0, truncateTableData_1.truncateTableData)(injectedRows, (0, utils_1.extractTruncates)(config)); + const rowHeights = (0, calculateRowHeights_1.calculateRowHeights)(rows, config); + config.spanningCellManager.setRowHeights(rowHeights); + rows = (0, mapDataUsingRowHeights_1.mapDataUsingRowHeights)(rows, rowHeights, config); + rows = (0, alignTableData_1.alignTableData)(rows, config); + rows = (0, padTableData_1.padTableData)(rows, config); + const outputColumnWidths = (0, calculateOutputColumnWidths_1.calculateOutputColumnWidths)(config); + return (0, drawTable_1.drawTable)(rows, outputColumnWidths, rowHeights, config); +}; +exports.table = table; +//# sourceMappingURL=table.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/table.js.map b/node_modules/table/dist/src/table.js.map new file mode 100644 index 0000000000..bb03676b86 --- /dev/null +++ b/node_modules/table/dist/src/table.js.map @@ -0,0 +1 @@ +{"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/table.ts"],"names":[],"mappings":";;;AAAA,qDAE0B;AAC1B,+EAEuC;AACvC,+DAE+B;AAC/B,2CAEqB;AACrB,6DAE8B;AAC9B,uDAE2B;AAC3B,qEAEkC;AAClC,iDAEwB;AACxB,6DAE8B;AAC9B,2DAE6B;AAI7B,mCAEiB;AACjB,2DAE6B;AAEtB,MAAM,KAAK,GAAG,CAAC,IAAiB,EAAE,aAA8B,EAAE,EAAU,EAAE;IACnF,IAAA,qCAAiB,EAAC,IAAI,CAAC,CAAC;IAExB,IAAI,IAAI,GAAG,IAAA,uCAAkB,EAAC,IAAI,CAAC,CAAC;IAEpC,MAAM,CAAC,YAAY,EAAE,0BAA0B,CAAC,GAAG,IAAA,uCAAkB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;IAExF,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,YAAY,EAAE,UAAU,EAAE,0BAA0B,CAAC,CAAC;IAErF,IAAI,GAAG,IAAA,qCAAiB,EAAC,YAAY,EAAE,IAAA,wBAAgB,EAAC,MAAM,CAAC,CAAC,CAAC;IAEjE,MAAM,UAAU,GAAG,IAAA,yCAAmB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAErD,MAAM,CAAC,mBAAmB,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IAErD,IAAI,GAAG,IAAA,+CAAsB,EAAC,IAAI,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;IACxD,IAAI,GAAG,IAAA,+BAAc,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACpC,IAAI,GAAG,IAAA,2BAAY,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAElC,MAAM,kBAAkB,GAAG,IAAA,yDAA2B,EAAC,MAAM,CAAC,CAAC;IAE/D,OAAO,IAAA,qBAAS,EAAC,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;AACjE,CAAC,CAAC;AAtBW,QAAA,KAAK,SAsBhB"} \ No newline at end of file diff --git a/node_modules/table/dist/src/truncateTableData.d.ts b/node_modules/table/dist/src/truncateTableData.d.ts new file mode 100644 index 0000000000..e88e1ad572 --- /dev/null +++ b/node_modules/table/dist/src/truncateTableData.d.ts @@ -0,0 +1,6 @@ +import type { Row } from './types/internal'; +export declare const truncateString: (input: string, length: number) => string; +/** + * @todo Make it work with ASCII content. + */ +export declare const truncateTableData: (rows: Row[], truncates: number[]) => Row[]; diff --git a/node_modules/table/dist/truncateTableData.js b/node_modules/table/dist/src/truncateTableData.js similarity index 74% rename from node_modules/table/dist/truncateTableData.js rename to node_modules/table/dist/src/truncateTableData.js index 5810242a3d..1f7980fd5f 100644 --- a/node_modules/table/dist/truncateTableData.js +++ b/node_modules/table/dist/src/truncateTableData.js @@ -6,18 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.truncateTableData = exports.truncateString = void 0; const lodash_truncate_1 = __importDefault(require("lodash.truncate")); const truncateString = (input, length) => { - return lodash_truncate_1.default(input, { length, + return (0, lodash_truncate_1.default)(input, { length, omission: '…' }); }; exports.truncateString = truncateString; /** * @todo Make it work with ASCII content. */ -const truncateTableData = (rows, config) => { +const truncateTableData = (rows, truncates) => { return rows.map((cells) => { return cells.map((cell, cellIndex) => { - return exports.truncateString(cell, config.columns[cellIndex].truncate); + return (0, exports.truncateString)(cell, truncates[cellIndex]); }); }); }; exports.truncateTableData = truncateTableData; +//# sourceMappingURL=truncateTableData.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/truncateTableData.js.map b/node_modules/table/dist/src/truncateTableData.js.map new file mode 100644 index 0000000000..921869f681 --- /dev/null +++ b/node_modules/table/dist/src/truncateTableData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"truncateTableData.js","sourceRoot":"","sources":["../../src/truncateTableData.ts"],"names":[],"mappings":";;;;;;AAAA,sEAAuC;AAKhC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAE,MAAc,EAAU,EAAE;IACtE,OAAO,IAAA,yBAAQ,EAAC,KAAK,EAAE,EAAC,MAAM;QAC5B,QAAQ,EAAE,GAAG,EAAC,CAAC,CAAC;AACpB,CAAC,CAAC;AAHW,QAAA,cAAc,kBAGzB;AAEF;;GAEG;AACI,MAAM,iBAAiB,GAAG,CAAC,IAAW,EAAE,SAAmB,EAAS,EAAE;IAC3E,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QACxB,OAAO,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE;YACnC,OAAO,IAAA,sBAAc,EAAC,IAAI,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AANW,QAAA,iBAAiB,qBAM5B"} \ No newline at end of file diff --git a/node_modules/table/dist/types/api.d.ts b/node_modules/table/dist/src/types/api.d.ts similarity index 87% rename from node_modules/table/dist/types/api.d.ts rename to node_modules/table/dist/src/types/api.d.ts index 165549a33a..f76c51e050 100644 --- a/node_modules/table/dist/types/api.d.ts +++ b/node_modules/table/dist/src/types/api.d.ts @@ -14,6 +14,10 @@ export declare type BorderUserConfig = { readonly joinRight?: string; readonly joinBody?: string; readonly joinJoin?: string; + readonly joinMiddleUp?: string; + readonly joinMiddleDown?: string; + readonly joinMiddleLeft?: string; + readonly joinMiddleRight?: string; readonly headerJoin?: string; readonly bodyRight?: string; readonly bodyLeft?: string; @@ -22,7 +26,7 @@ export declare type BorderUserConfig = { export declare type BorderConfig = Required; export declare type Alignment = 'center' | 'justify' | 'left' | 'right'; export declare type VerticalAlignment = 'bottom' | 'middle' | 'top'; -export declare type ColumnUserConfig = { +export declare type CellUserConfig = { /** * Cell content horizontal alignment (default: left) */ @@ -31,10 +35,6 @@ export declare type ColumnUserConfig = { * Cell content vertical alignment (default: top) */ readonly verticalAlignment?: VerticalAlignment; - /** - * Column width (default: auto calculation based on the cell content) - */ - readonly width?: number; /** * Number of characters are which the content will be truncated (default: Infinity) */ @@ -52,6 +52,15 @@ export declare type ColumnUserConfig = { */ readonly wrapWord?: boolean; }; +export declare type ColumnUserConfig = CellUserConfig & { + /** + * Column width (default: auto calculation based on the cell content) + */ + readonly width?: number; +}; +/** + * @deprecated Use spanning cell API instead + */ export declare type HeaderUserConfig = Omit & { readonly content: string; }; @@ -90,6 +99,13 @@ export declare type TableUserConfig = BaseUserConfig & { * Horizontal lines inside the table are not drawn. */ readonly singleLine?: boolean; + readonly spanningCells?: SpanningCellConfig[]; +}; +export declare type SpanningCellConfig = CellUserConfig & { + readonly row: number; + readonly col: number; + readonly rowSpan?: number; + readonly colSpan?: number; }; export declare type StreamUserConfig = BaseUserConfig & { /** diff --git a/node_modules/table/dist/types/api.js b/node_modules/table/dist/src/types/api.js similarity index 71% rename from node_modules/table/dist/types/api.js rename to node_modules/table/dist/src/types/api.js index c8ad2e549b..57bf49a1d8 100644 --- a/node_modules/table/dist/types/api.js +++ b/node_modules/table/dist/src/types/api.js @@ -1,2 +1,3 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=api.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/types/api.js.map b/node_modules/table/dist/src/types/api.js.map new file mode 100644 index 0000000000..f396fdb600 --- /dev/null +++ b/node_modules/table/dist/src/types/api.js.map @@ -0,0 +1 @@ +{"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/types/api.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/table/dist/types/internal.d.ts b/node_modules/table/dist/src/types/internal.d.ts similarity index 100% rename from node_modules/table/dist/types/internal.d.ts rename to node_modules/table/dist/src/types/internal.d.ts diff --git a/node_modules/table/dist/types/internal.js b/node_modules/table/dist/src/types/internal.js similarity index 68% rename from node_modules/table/dist/types/internal.js rename to node_modules/table/dist/src/types/internal.js index c8ad2e549b..f8a3d3e791 100644 --- a/node_modules/table/dist/types/internal.js +++ b/node_modules/table/dist/src/types/internal.js @@ -1,2 +1,3 @@ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=internal.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/types/internal.js.map b/node_modules/table/dist/src/types/internal.js.map new file mode 100644 index 0000000000..b612aad962 --- /dev/null +++ b/node_modules/table/dist/src/types/internal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../../src/types/internal.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/node_modules/table/dist/src/utils.d.ts b/node_modules/table/dist/src/utils.d.ts new file mode 100644 index 0000000000..a165ace578 --- /dev/null +++ b/node_modules/table/dist/src/utils.d.ts @@ -0,0 +1,10 @@ +import type { SpanningCellConfig } from './types/api'; +import type { BaseConfig, CellCoordinates, RangeCoordinate } from './types/internal'; +export declare const sequence: (start: number, end: number) => number[]; +export declare const sumArray: (array: number[]) => number; +export declare const extractTruncates: (config: BaseConfig) => number[]; +export declare const flatten: (array: T[][]) => T[]; +export declare const findOriginalRowIndex: (mappedRowHeights: number[], mappedRowIndex: number) => number; +export declare const calculateRangeCoordinate: (spanningCellConfig: SpanningCellConfig) => RangeCoordinate; +export declare const areCellEqual: (cell1: CellCoordinates, cell2: CellCoordinates) => boolean; +export declare const isCellInRange: (cell: CellCoordinates, { topLeft, bottomRight }: RangeCoordinate) => boolean; diff --git a/node_modules/table/dist/utils.js b/node_modules/table/dist/src/utils.js similarity index 52% rename from node_modules/table/dist/utils.js rename to node_modules/table/dist/src/utils.js index 46d15851bf..f2f25b03b5 100644 --- a/node_modules/table/dist/utils.js +++ b/node_modules/table/dist/src/utils.js @@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.distributeUnevenly = exports.countSpaceSequence = exports.groupBySizes = exports.makeBorderConfig = exports.splitAnsi = exports.normalizeString = void 0; +exports.isCellInRange = exports.areCellEqual = exports.calculateRangeCoordinate = exports.findOriginalRowIndex = exports.flatten = exports.extractTruncates = exports.sumArray = exports.sequence = exports.distributeUnevenly = exports.countSpaceSequence = exports.groupBySizes = exports.makeBorderConfig = exports.splitAnsi = exports.normalizeString = void 0; const slice_ansi_1 = __importDefault(require("slice-ansi")); const string_width_1 = __importDefault(require("string-width")); const strip_ansi_1 = __importDefault(require("strip-ansi")); @@ -23,11 +23,11 @@ exports.normalizeString = normalizeString; * @internal */ const splitAnsi = (input) => { - const lengths = strip_ansi_1.default(input).split('\n').map(string_width_1.default); + const lengths = (0, strip_ansi_1.default)(input).split('\n').map(string_width_1.default); const result = []; let startIndex = 0; lengths.forEach((length) => { - result.push(length === 0 ? '' : slice_ansi_1.default(input, startIndex, startIndex + length)); + result.push(length === 0 ? '' : (0, slice_ansi_1.default)(input, startIndex, startIndex + length)); // Plus 1 for the newline character itself startIndex += length + 1; }); @@ -41,7 +41,7 @@ exports.splitAnsi = splitAnsi; */ const makeBorderConfig = (border) => { return { - ...getBorderCharacters_1.getBorderCharacters('honeywell'), + ...(0, getBorderCharacters_1.getBorderCharacters)('honeywell'), ...border, }; }; @@ -90,3 +90,54 @@ const distributeUnevenly = (sum, length) => { }); }; exports.distributeUnevenly = distributeUnevenly; +const sequence = (start, end) => { + return Array.from({ length: end - start + 1 }, (_, index) => { + return index + start; + }); +}; +exports.sequence = sequence; +const sumArray = (array) => { + return array.reduce((accumulator, element) => { + return accumulator + element; + }, 0); +}; +exports.sumArray = sumArray; +const extractTruncates = (config) => { + return config.columns.map(({ truncate }) => { + return truncate; + }); +}; +exports.extractTruncates = extractTruncates; +const flatten = (array) => { + return [].concat(...array); +}; +exports.flatten = flatten; +const findOriginalRowIndex = (mappedRowHeights, mappedRowIndex) => { + const rowIndexMapping = (0, exports.flatten)(mappedRowHeights.map((height, index) => { + return Array.from({ length: height }, () => { + return index; + }); + })); + return rowIndexMapping[mappedRowIndex]; +}; +exports.findOriginalRowIndex = findOriginalRowIndex; +const calculateRangeCoordinate = (spanningCellConfig) => { + const { row, col, colSpan = 1, rowSpan = 1 } = spanningCellConfig; + return { bottomRight: { col: col + colSpan - 1, + row: row + rowSpan - 1 }, + topLeft: { col, + row } }; +}; +exports.calculateRangeCoordinate = calculateRangeCoordinate; +const areCellEqual = (cell1, cell2) => { + return cell1.row === cell2.row && cell1.col === cell2.col; +}; +exports.areCellEqual = areCellEqual; +const isCellInRange = (cell, { topLeft, bottomRight }) => { + return (topLeft.row <= cell.row && + cell.row <= bottomRight.row && + topLeft.col <= cell.col && + cell.col <= bottomRight.col); +}; +exports.isCellInRange = isCellInRange; +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/utils.js.map b/node_modules/table/dist/src/utils.js.map new file mode 100644 index 0000000000..dee1173569 --- /dev/null +++ b/node_modules/table/dist/src/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAC/B,gEAAuC;AACvC,4DAAmC;AACnC,+DAE+B;AAY/B;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,KAAa,EAAU,EAAE;IACvD,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC,CAAC;AAFW,QAAA,eAAe,mBAE1B;AAEF;;;;GAIG;AACI,MAAM,SAAS,GAAG,CAAC,KAAa,EAAY,EAAE;IACnD,MAAM,OAAO,GAAG,IAAA,oBAAS,EAAC,KAAK,CAAC,CAAC,KAAK,C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,CAAC,GAAG,CAAC;AAC5D,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEK,MAAM,aAAa,GAAG,CAAC,IAAqB,EAAE,EAAC,OAAO,EAAE,WAAW,EAAkB,EAAW,EAAE;IACvG,OAAO,CACL,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG;QACvB,IAAI,CAAC,GAAG,IAAI,WAAW,CAAC,GAAG;QAC3B,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG;QACvB,IAAI,CAAC,GAAG,IAAI,WAAW,CAAC,GAAG,CAC5B,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,aAAa,iBAOxB"} \ No newline at end of file diff --git a/node_modules/table/dist/validateConfig.d.ts b/node_modules/table/dist/src/validateConfig.d.ts similarity index 100% rename from node_modules/table/dist/validateConfig.d.ts rename to node_modules/table/dist/src/validateConfig.d.ts diff --git a/node_modules/table/dist/validateConfig.js b/node_modules/table/dist/src/validateConfig.js similarity index 89% rename from node_modules/table/dist/validateConfig.js rename to node_modules/table/dist/src/validateConfig.js index f1a743bc1d..2df152ea83 100644 --- a/node_modules/table/dist/validateConfig.js +++ b/node_modules/table/dist/src/validateConfig.js @@ -8,6 +8,7 @@ const validators_1 = __importDefault(require("./generated/validators")); const validateConfig = (schemaId, config) => { const validate = validators_1.default[schemaId]; if (!validate(config) && validate.errors) { + // eslint-disable-next-line promise/prefer-await-to-callbacks const errors = validate.errors.map((error) => { return { message: error.message, @@ -23,3 +24,4 @@ const validateConfig = (schemaId, config) => { } }; exports.validateConfig = validateConfig; +//# sourceMappingURL=validateConfig.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/validateConfig.js.map b/node_modules/table/dist/src/validateConfig.js.map new file mode 100644 index 0000000000..db240b3904 --- /dev/null +++ b/node_modules/table/dist/src/validateConfig.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validateConfig.js","sourceRoot":"","sources":["../../src/validateConfig.ts"],"names":[],"mappings":";;;;;;AAIA,wEAAgD;AAKzC,MAAM,cAAc,GAAG,CAAC,QAA6C,EAAE,MAAuB,EAAQ,EAAE;IAC7G,MAAM,QAAQ,GAAG,oBAAU,CAAC,QAAQ,CAAqB,CAAC;IAC1D,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE;QACxC,6DAA6D;QAC7D,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAkB,EAAE,EAAE;YACxD,OAAO;gBACL,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,UAAU,EAAE,KAAK,CAAC,UAAU;aAC7B,CAAC;QACJ,CAAC,CAAC,CAAC;QAEH,+BAA+B;QAC/B,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9B,8BAA8B;QAE9B,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;KACpC;AACH,CAAC,CAAC;AAnBW,QAAA,cAAc,kBAmBzB"} \ No newline at end of file diff --git a/node_modules/table/dist/src/validateSpanningCellConfig.d.ts b/node_modules/table/dist/src/validateSpanningCellConfig.d.ts new file mode 100644 index 0000000000..d04bd34295 --- /dev/null +++ b/node_modules/table/dist/src/validateSpanningCellConfig.d.ts @@ -0,0 +1,3 @@ +import type { SpanningCellConfig } from './types/api'; +import type { Row } from './types/internal'; +export declare const validateSpanningCellConfig: (rows: Row[], configs: SpanningCellConfig[]) => void; diff --git a/node_modules/table/dist/src/validateSpanningCellConfig.js b/node_modules/table/dist/src/validateSpanningCellConfig.js new file mode 100644 index 0000000000..e2859ad246 --- /dev/null +++ b/node_modules/table/dist/src/validateSpanningCellConfig.js @@ -0,0 +1,46 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validateSpanningCellConfig = void 0; +const utils_1 = require("./utils"); +const inRange = (start, end, value) => { + return start <= value && value <= end; +}; +const validateSpanningCellConfig = (rows, configs) => { + const [nRow, nCol] = [rows.length, rows[0].length]; + configs.forEach((config, configIndex) => { + const { colSpan, rowSpan } = config; + if (colSpan === undefined && rowSpan === undefined) { + throw new Error(`Expect at least colSpan or rowSpan is provided in config.spanningCells[${configIndex}]`); + } + if (colSpan !== undefined && colSpan < 1) { + throw new Error(`Expect colSpan is not equal zero, instead got: ${colSpan} in config.spanningCells[${configIndex}]`); + } + if (rowSpan !== undefined && rowSpan < 1) { + throw new Error(`Expect rowSpan is not equal zero, instead got: ${rowSpan} in config.spanningCells[${configIndex}]`); + } + }); + const rangeCoordinates = configs.map(utils_1.calculateRangeCoordinate); + rangeCoordinates.forEach(({ topLeft, bottomRight }, rangeIndex) => { + if (!inRange(0, nCol - 1, topLeft.col) || + !inRange(0, nRow - 1, topLeft.row) || + !inRange(0, nCol - 1, bottomRight.col) || + !inRange(0, nRow - 1, bottomRight.row)) { + throw new Error(`Some cells in config.spanningCells[${rangeIndex}] are out of the table`); + } + }); + const configOccupy = Array.from({ length: nRow }, () => { + return Array.from({ length: nCol }); + }); + rangeCoordinates.forEach(({ topLeft, bottomRight }, rangeIndex) => { + (0, utils_1.sequence)(topLeft.row, bottomRight.row).forEach((row) => { + (0, utils_1.sequence)(topLeft.col, bottomRight.col).forEach((col) => { + if (configOccupy[row][col] !== undefined) { + throw new Error(`Spanning cells in config.spanningCells[${configOccupy[row][col]}] and config.spanningCells[${rangeIndex}] are overlap each other`); + } + configOccupy[row][col] = rangeIndex; + }); + }); + }); +}; +exports.validateSpanningCellConfig = validateSpanningCellConfig; +//# sourceMappingURL=validateSpanningCellConfig.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/validateSpanningCellConfig.js.map b/node_modules/table/dist/src/validateSpanningCellConfig.js.map new file mode 100644 index 0000000000..d5097be45e --- /dev/null +++ b/node_modules/table/dist/src/validateSpanningCellConfig.js.map @@ -0,0 +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IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAzCW,QAAA,0BAA0B,8BAyCrC"} \ No newline at end of file diff --git a/node_modules/table/dist/validateTableData.d.ts b/node_modules/table/dist/src/validateTableData.d.ts similarity index 100% rename from node_modules/table/dist/validateTableData.d.ts rename to node_modules/table/dist/src/validateTableData.d.ts diff --git a/node_modules/table/dist/validateTableData.js b/node_modules/table/dist/src/validateTableData.js similarity index 92% rename from node_modules/table/dist/validateTableData.js rename to node_modules/table/dist/src/validateTableData.js index 60ae307409..a85e807556 100644 --- a/node_modules/table/dist/validateTableData.js +++ b/node_modules/table/dist/src/validateTableData.js @@ -22,10 +22,11 @@ const validateTableData = (rows) => { } for (const cell of row) { // eslint-disable-next-line no-control-regex - if (/[\u0001-\u0006\u0008\u0009\u000B-\u001A]/.test(utils_1.normalizeString(String(cell)))) { + if (/[\u0001-\u0006\u0008\u0009\u000B-\u001A]/.test((0, utils_1.normalizeString)(String(cell)))) { throw new Error('Table data must not contain control characters.'); } } } }; exports.validateTableData = validateTableData; +//# sourceMappingURL=validateTableData.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/validateTableData.js.map b/node_modules/table/dist/src/validateTableData.js.map new file mode 100644 index 0000000000..568fb10bb1 --- /dev/null +++ b/node_modules/table/dist/src/validateTableData.js.map @@ -0,0 +1 @@ +{"version":3,"file":"validateTableData.js","sourceRoot":"","sources":["../../src/validateTableData.ts"],"names":[],"mappings":";;;AAAA,mCAEiB;AAEV,MAAM,iBAAiB,GAAG,CAAC,IAAiB,EAAQ,EAAE;IAC3D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACxB,MAAM,IAAI,SAAS,CAAC,8BAA8B,CAAC,CAAC;KACrD;IAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KACxD;IAED,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QACxB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;KAC3D;IAED,MAAM,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAEpC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YACvB,MAAM,IAAI,SAAS,CAAC,kCAAkC,CAAC,CAAC;SACzD;QAED,IAAI,GAAG,CAAC,MAAM,KAAK,YAAY,EAAE;YAC/B,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;SAClE;QAED,KAAK,MAAM,IAAI,IAAI,GAAG,EAAE;YACtB,4CAA4C;YAC5C,IAAI,0CAA0C,CAAC,IAAI,CAAC,IAAA,uBAAe,EAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;gBAClF,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;aACpE;SACF;KACF;AACH,CAAC,CAAC;AA/BW,QAAA,iBAAiB,qBA+B5B"} \ No newline at end of file diff --git a/node_modules/table/dist/wrapCell.d.ts b/node_modules/table/dist/src/wrapCell.d.ts similarity index 100% rename from node_modules/table/dist/wrapCell.d.ts rename to node_modules/table/dist/src/wrapCell.d.ts diff --git a/node_modules/table/dist/wrapCell.js b/node_modules/table/dist/src/wrapCell.js similarity index 78% rename from node_modules/table/dist/wrapCell.js rename to node_modules/table/dist/src/wrapCell.js index 64229d2553..b2ce8de0d5 100644 --- a/node_modules/table/dist/wrapCell.js +++ b/node_modules/table/dist/src/wrapCell.js @@ -13,15 +13,15 @@ const wrapWord_1 = require("./wrapWord"); */ const wrapCell = (cellValue, cellWidth, useWrapWord) => { // First split on literal newlines - const cellLines = utils_1.splitAnsi(cellValue); + const cellLines = (0, utils_1.splitAnsi)(cellValue); // Then iterate over the list and word-wrap every remaining line if necessary. for (let lineNr = 0; lineNr < cellLines.length;) { let lineChunks; if (useWrapWord) { - lineChunks = wrapWord_1.wrapWord(cellLines[lineNr], cellWidth); + lineChunks = (0, wrapWord_1.wrapWord)(cellLines[lineNr], cellWidth); } else { - lineChunks = wrapString_1.wrapString(cellLines[lineNr], cellWidth); + lineChunks = (0, wrapString_1.wrapString)(cellLines[lineNr], cellWidth); } // Replace our original array element with whatever the wrapping returned cellLines.splice(lineNr, 1, ...lineChunks); @@ -30,3 +30,4 @@ const wrapCell = (cellValue, cellWidth, useWrapWord) => { return cellLines; }; exports.wrapCell = wrapCell; +//# sourceMappingURL=wrapCell.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/wrapCell.js.map b/node_modules/table/dist/src/wrapCell.js.map new file mode 100644 index 0000000000..9ce0736ec9 --- /dev/null +++ b/node_modules/table/dist/src/wrapCell.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapCell.js","sourceRoot":"","sources":["../../src/wrapCell.ts"],"names":[],"mappings":";;;AAAA,mCAEiB;AACjB,6CAEsB;AACtB,yCAEoB;AAEpB;;;;;;GAMG;AACI,MAAM,QAAQ,GAAG,CAAC,SAAiB,EAAE,SAAiB,EAAE,WAAoB,EAAY,EAAE;IAC/F,kCAAkC;IAClC,MAAM,SAAS,GAAG,IAAA,iBAAS,EAAC,SAAS,CAAC,CAAC;IAEvC,8EAA8E;IAC9E,KAAK,IAAI,MAAM,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,GAAG;QAC/C,IAAI,UAAU,CAAC;QAEf,IAAI,WAAW,EAAE;YACf,UAAU,GAAG,IAAA,mBAAQ,EAAC,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;SACrD;aAAM;YACL,UAAU,GAAG,IAAA,uBAAU,EAAC,SAAS,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC;SACvD;QAED,yEAAyE;QACzE,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,CAAC;QAC3C,MAAM,IAAI,UAAU,CAAC,MAAM,CAAC;KAC7B;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AApBW,QAAA,QAAQ,YAoBnB"} \ No newline at end of file diff --git a/node_modules/table/dist/wrapString.d.ts b/node_modules/table/dist/src/wrapString.d.ts similarity index 100% rename from node_modules/table/dist/wrapString.d.ts rename to node_modules/table/dist/src/wrapString.d.ts diff --git a/node_modules/table/dist/wrapString.js b/node_modules/table/dist/src/wrapString.js similarity index 77% rename from node_modules/table/dist/wrapString.js rename to node_modules/table/dist/src/wrapString.js index 08fcc3fee5..b09bd17367 100644 --- a/node_modules/table/dist/wrapString.js +++ b/node_modules/table/dist/src/wrapString.js @@ -18,9 +18,10 @@ const wrapString = (subject, size) => { let subjectSlice = subject; const chunks = []; do { - chunks.push(slice_ansi_1.default(subjectSlice, 0, size)); - subjectSlice = slice_ansi_1.default(subjectSlice, size).trim(); - } while (string_width_1.default(subjectSlice)); + chunks.push((0, slice_ansi_1.default)(subjectSlice, 0, size)); + subjectSlice = (0, slice_ansi_1.default)(subjectSlice, size).trim(); + } while ((0, string_width_1.default)(subjectSlice)); return chunks; }; exports.wrapString = wrapString; +//# sourceMappingURL=wrapString.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/wrapString.js.map b/node_modules/table/dist/src/wrapString.js.map new file mode 100644 index 0000000000..c1c2a5bdd8 --- /dev/null +++ b/node_modules/table/dist/src/wrapString.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapString.js","sourceRoot":"","sources":["../../src/wrapString.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAC/B,gEAAuC;AAEvC;;;;;;;GAOG;AACI,MAAM,UAAU,GAAG,CAAC,OAAe,EAAE,IAAY,EAAY,EAAE;IACpE,IAAI,YAAY,GAAG,OAAO,CAAC;IAE3B,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,GAAG;QACD,MAAM,CAAC,IAAI,CAAC,IAAA,oBAAK,EAAC,YAAY,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;QAE1C,YAAY,GAAG,IAAA,oBAAK,EAAC,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;KACjD,QAAQ,IAAA,sBAAW,EAAC,YAAY,CAAC,EAAE;IAEpC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB"} \ No newline at end of file diff --git a/node_modules/table/dist/wrapWord.d.ts b/node_modules/table/dist/src/wrapWord.d.ts similarity index 100% rename from node_modules/table/dist/wrapWord.d.ts rename to node_modules/table/dist/src/wrapWord.d.ts diff --git a/node_modules/table/dist/wrapWord.js b/node_modules/table/dist/src/wrapWord.js similarity index 79% rename from node_modules/table/dist/wrapWord.js rename to node_modules/table/dist/src/wrapWord.js index 1f2da3c570..7571aa6e5b 100644 --- a/node_modules/table/dist/wrapWord.js +++ b/node_modules/table/dist/src/wrapWord.js @@ -7,10 +7,10 @@ exports.wrapWord = void 0; const slice_ansi_1 = __importDefault(require("slice-ansi")); const strip_ansi_1 = __importDefault(require("strip-ansi")); const calculateStringLengths = (input, size) => { - let subject = strip_ansi_1.default(input); + let subject = (0, strip_ansi_1.default)(input); const chunks = []; // https://regex101.com/r/gY5kZ1/1 - const re = new RegExp('(^.{1,' + String(size) + '}(\\s+|$))|(^.{1,' + String(size - 1) + '}(\\\\|/|_|\\.|,|;|-))'); + const re = new RegExp('(^.{1,' + String(Math.max(size, 1)) + '}(\\s+|$))|(^.{1,' + String(Math.max(size - 1, 1)) + '}(\\\\|/|_|\\.|,|;|-))'); do { let chunk; const match = re.exec(subject); @@ -33,9 +33,10 @@ const wrapWord = (input, size) => { const result = []; let startIndex = 0; calculateStringLengths(input, size).forEach(([length, offset]) => { - result.push(slice_ansi_1.default(input, startIndex, startIndex + length)); + result.push((0, slice_ansi_1.default)(input, startIndex, startIndex + length)); startIndex += length + offset; }); return result; }; exports.wrapWord = wrapWord; +//# sourceMappingURL=wrapWord.js.map \ No newline at end of file diff --git a/node_modules/table/dist/src/wrapWord.js.map b/node_modules/table/dist/src/wrapWord.js.map new file mode 100644 index 0000000000..fc61519dfb --- /dev/null +++ b/node_modules/table/dist/src/wrapWord.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrapWord.js","sourceRoot":"","sources":["../../src/wrapWord.ts"],"names":[],"mappings":";;;;;;AAAA,4DAA+B;AAC/B,4DAAmC;AAEnC,MAAM,sBAAsB,GAAG,CAAC,KAAa,EAAE,IAAY,EAA0C,EAAE;IACrG,IAAI,OAAO,GAAG,IAAA,oBAAS,EAAC,KAAK,CAAC,CAAC;IAE/B,MAAM,MAAM,GAA4B,EAAE,CAAC;IAE3C,kCAAkC;IAClC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,GAAG,mBAAmB,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,wBAAwB,CAAC,CAAC;IAE7I,GAAG;QACD,IAAI,KAAa,CAAC;QAElB,MAAM,KAAK,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAE/B,IAAI,KAAK,EAAE;YACT,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YAEjB,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAEtC,MAAM,aAAa,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC;YAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,aAAa,CAAC;YAE5C,MAAM,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,MAAM,CAAC,CAAC,CAAC;SACtC;aAAM;YACL,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;YAC/B,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAE9B,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;SAChC;KACF,QAAQ,OAAO,CAAC,MAAM,EAAE;IAEzB,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEK,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,IAAY,EAAY,EAAE;IAChE,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,sBAAsB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,EAAE;QAC/D,MAAM,CAAC,IAAI,CAAC,IAAA,oBAAK,EAAC,KAAK,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC;QAE3D,UAAU,IAAI,MAAM,GAAG,MAAM,CAAC;IAChC,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAXW,QAAA,QAAQ,YAWnB"} \ No newline at end of file diff --git a/node_modules/table/dist/table.js b/node_modules/table/dist/table.js deleted file mode 100644 index 72c879dc41..0000000000 --- a/node_modules/table/dist/table.js +++ /dev/null @@ -1,26 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.table = void 0; -const alignTableData_1 = require("./alignTableData"); -const calculateCellWidths_1 = require("./calculateCellWidths"); -const calculateRowHeights_1 = require("./calculateRowHeights"); -const drawTable_1 = require("./drawTable"); -const makeTableConfig_1 = require("./makeTableConfig"); -const mapDataUsingRowHeights_1 = require("./mapDataUsingRowHeights"); -const padTableData_1 = require("./padTableData"); -const stringifyTableData_1 = require("./stringifyTableData"); -const truncateTableData_1 = require("./truncateTableData"); -const validateTableData_1 = require("./validateTableData"); -const table = (data, userConfig = {}) => { - validateTableData_1.validateTableData(data); - let rows = stringifyTableData_1.stringifyTableData(data); - const config = makeTableConfig_1.makeTableConfig(rows, userConfig); - rows = truncateTableData_1.truncateTableData(rows, config); - const rowHeights = calculateRowHeights_1.calculateRowHeights(rows, config); - rows = mapDataUsingRowHeights_1.mapDataUsingRowHeights(rows, rowHeights, config); - rows = alignTableData_1.alignTableData(rows, config); - rows = padTableData_1.padTableData(rows, config); - const cellWidths = calculateCellWidths_1.calculateCellWidths(rows[0]); - return drawTable_1.drawTable(rows, cellWidths, rowHeights, config); -}; -exports.table = table; diff --git a/node_modules/table/dist/truncateTableData.d.ts b/node_modules/table/dist/truncateTableData.d.ts deleted file mode 100644 index 60bc368eed..0000000000 --- a/node_modules/table/dist/truncateTableData.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { BaseConfig, Row } from './types/internal'; -export declare const truncateString: (input: string, length: number) => string; -/** - * @todo Make it work with ASCII content. - */ -export declare const truncateTableData: (rows: Row[], config: BaseConfig) => Row[]; diff --git a/node_modules/table/dist/utils.d.ts b/node_modules/table/dist/utils.d.ts deleted file mode 100644 index cb0ff5c3b5..0000000000 --- a/node_modules/table/dist/utils.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/node_modules/table/package.json b/node_modules/table/package.json index 64944ac4b1..43cc41aabb 100644 --- a/node_modules/table/package.json +++ b/node_modules/table/package.json @@ -6,7 +6,6 @@ }, "dependencies": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", @@ -15,10 +14,9 @@ "description": "Formats data into a string table.", "devDependencies": { "@types/chai": "^4.2.16", - "@types/lodash.clonedeep": "^4.5.6", "@types/lodash.mapvalues": "^4.6.6", "@types/lodash.truncate": "^4.4.6", - "@types/mocha": "^8.2.2", + "@types/mocha": "^9.0.0", "@types/node": "^14.14.37", "@types/sinon": "^10.0.0", "@types/slice-ansi": "^4.0.0", @@ -27,19 +25,19 @@ "chai": "^4.2.0", "chalk": "^4.1.0", "coveralls": "^3.1.0", - "eslint": "^7.16.0", + "eslint": "^7.32.0", "eslint-config-canonical": "^25.0.0", - "gitdown": "^3.1.3", + "gitdown": "^3.1.4", "husky": "^4.3.6", - "js-beautify": "^1.13.0", + "js-beautify": "^1.14.0", "lodash.mapvalues": "^4.6.0", "mkdirp": "^1.0.4", "mocha": "^8.2.1", "nyc": "^15.1.0", "semantic-release": "^17.3.1", - "sinon": "^9.2.2", + "sinon": "^12.0.1", "ts-node": "^9.1.1", - "typescript": "4.2.4" + "typescript": "4.5.2" }, "engines": { "node": ">=10.0.0" @@ -58,37 +56,22 @@ "ansi" ], "license": "BSD-3-Clause", - "main": "./dist/index.js", + "main": "./dist/src/index.js", "files": [ - "dist/**/*.js", - "dist/**/*.d.ts" + "dist/src/" ], "name": "table", - "nyc": { - "extensions": [ - ".ts" - ], - "exclude": [ - "src/generated/validators.js", - "test/**/*.ts" - ], - "reporter": [ - "text-lcov", - "text" - ] - }, "repository": { "type": "git", "url": "https://github.com/gajus/table" }, "scripts": { - "compile": "tsc", - "prebuild": "rm -fr ./dist && mkdirp dist", - "build": "npm run create-validators && npm run compile", + "prebuild": "rm -fr ./src/generated && mkdirp ./src/generated", + "build": "npm run create-validators && tsc", "create-readme": "gitdown ./.README/README.md --output-file ./README.md", - "create-validators": "rm -fr ./src/generated && mkdirp ./src/generated && ajv compile --all-errors --inline-refs=false -s src/schemas/config -s src/schemas/streamConfig -r src/schemas/shared -c ajv-keywords/dist/keywords/typeof -o | js-beautify > ./src/generated/validators.js", - "lint": "eslint --ignore-path .gitignore ./src ./test", - "test": "npm run create-validators && mocha --require ts-node/register \"./test/**/*.ts\"" + "create-validators": "ajv compile --all-errors --inline-refs=false -s src/schemas/config -s src/schemas/streamConfig -r src/schemas/shared -c ajv-keywords/dist/keywords/typeof -o | js-beautify > ./src/generated/validators.js", + "lint": "eslint ./src ./test", + "test": "nyc mocha && nyc check-coverage --lines 95" }, - "version": "6.7.2" + "version": "6.8.0" } diff --git a/package-lock.json b/package-lock.json index 5d5b4c58f3..e2d547ae4c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,11 +8,11 @@ "license": "BSD-3-Clause", "devDependencies": { "@istanbuljs/schema": "0.1.3", - "@types/chai": "^4.3.0", + "@types/chai": "4.3.0", "@types/codemirror": "0.0.108", "@types/estree": "0.0.50", "@types/filesystem": "0.0.32", - "@types/istanbul-lib-coverage": "^2.0.4", + "@types/istanbul-lib-coverage": "2.0.4", "@types/istanbul-lib-instrument": "1.7.4", "@types/istanbul-lib-report": "3.0.0", "@types/istanbul-lib-source-maps": "4.0.1", @@ -20,9 +20,9 @@ "@types/karma-chai-sinon": "0.1.16", "@types/marked": "4.0.1", "@types/mocha": "9.0.0", - "@types/node": "^17.0.8", + "@types/node": "17.0.8", "@types/rimraf": "3.0.2", - "@types/sinon": "^10.0.6", + "@types/sinon": "10.0.6", "@typescript-eslint/eslint-plugin": "5.9.0", "@typescript-eslint/parser": "5.9.0", "@web/rollup-plugin-import-meta-assets": "1.0.7", @@ -50,20 +50,20 @@ "karma-spec-reporter": "0.0.32", "license-checker": "25.0.1", "mocha": "9.1.3", - "postcss": "8.3.11", + "postcss": "^8.4.5", "puppeteer": "10.0.0", "recast": "0.20.4", "rimraf": "3.0.2", - "rollup": "^2.63.0", + "rollup": "2.63.0", "rollup-plugin-minify-html-template-literals": "1.2.0", "rollup-plugin-terser": "7.0.2", "sinon": "12.0.1", "source-map-support": "0.5.19", - "stylelint": "14.0.1", - "stylelint-config-standard": "23.0.0", + "stylelint": "^14.2.0", + "stylelint-config-standard": "^24.0.0", "svgo": "2.3.1", - "terser": "^5.10.0", - "typescript": "^4.5.4", + "terser": "5.10.0", + "typescript": "4.5.4", "ws": "7.5.3", "yargs": "16.2.0" } @@ -1817,6 +1817,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "node_modules/colord": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", + "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "dev": true + }, "node_modules/colorette": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", @@ -4618,9 +4624,9 @@ } }, "node_modules/known-css-properties": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.23.0.tgz", - "integrity": "sha512-h9ivI88e1lFNmTT4HovBN33Ysn0OIJG7IPG2mkpx2uniQXFWqo35QdiX7w0TovlUFXfW8aPFblP5/q0jlOr2sA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.24.0.tgz", + "integrity": "sha512-RTSoaUAfLvpR357vWzAz/50Q/BmHfmE6ETSWfutT0AJiw10e6CmcdYRQJlLRd95B53D0Y2aD1jSxD3V3ySF+PA==", "dev": true }, "node_modules/levn": { @@ -4690,12 +4696,6 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, - "node_modules/lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "node_modules/lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -5785,14 +5785,14 @@ } }, "node_modules/postcss": { - "version": "8.3.11", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz", - "integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==", + "version": "8.4.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", + "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==", "dev": true, "dependencies": { "nanoid": "^3.1.30", "picocolors": "^1.0.0", - "source-map-js": "^0.6.2" + "source-map-js": "^1.0.1" }, "engines": { "node": "^10 || ^12 || >=14" @@ -5831,9 +5831,9 @@ } }, "node_modules/postcss-selector-parser": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz", - "integrity": "sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==", + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.8.tgz", + "integrity": "sha512-D5PG53d209Z1Uhcc0qAZ5U3t5HagH3cxu+WLZ22jt3gLUpXM4eXXfiO14jiDWST3NNooX/E8wISfOhZ9eIjGTQ==", "dev": true, "dependencies": { "cssesc": "^3.0.0", @@ -6464,6 +6464,9 @@ }, "engines": { "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, "node_modules/slice-ansi/node_modules/ansi-styles": { @@ -6476,6 +6479,9 @@ }, "engines": { "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, "node_modules/slice-ansi/node_modules/color-convert": { @@ -6569,9 +6575,9 @@ } }, "node_modules/source-map-js": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", - "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", + "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", "dev": true, "engines": { "node": ">=0.10.0" @@ -6819,14 +6825,15 @@ "dev": true }, "node_modules/stylelint": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.0.1.tgz", - "integrity": "sha512-ZcAkmFLVCultmwkQUjxKzxW/o5+CzNmDk6TPJj/d4Y7ipTGGrewIWmNm+InjdSr04PR5/yynsAJeYJY/wisdMg==", + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.2.0.tgz", + "integrity": "sha512-i0DrmDXFNpDsWiwx6SPRs4/pyw4kvZgqpDGvsTslQMY7hpUl6r33aQvNSn6cnTg2wtZ9rreFElI7XAKpOWi1vQ==", "dev": true, "dependencies": { "balanced-match": "^2.0.0", + "colord": "^2.9.2", "cosmiconfig": "^7.0.1", - "debug": "^4.3.2", + "debug": "^4.3.3", "execall": "^2.0.0", "fast-glob": "^3.2.7", "fastest-levenshtein": "^1.0.12", @@ -6836,11 +6843,11 @@ "globby": "^11.0.4", "globjoin": "^0.1.4", "html-tags": "^3.1.0", - "ignore": "^5.1.8", + "ignore": "^5.2.0", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", - "known-css-properties": "^0.23.0", + "known-css-properties": "^0.24.0", "mathml-tag-names": "^2.1.3", "meow": "^9.0.0", "micromatch": "^4.0.4", @@ -6851,7 +6858,7 @@ "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.6", + "postcss-selector-parser": "^6.0.7", "postcss-value-parser": "^4.1.0", "resolve-from": "^5.0.0", "specificity": "^0.4.1", @@ -6859,7 +6866,7 @@ "strip-ansi": "^6.0.1", "style-search": "^0.1.0", "svg-tags": "^1.0.0", - "table": "^6.7.2", + "table": "^6.7.5", "v8-compile-cache": "^2.3.0", "write-file-atomic": "^3.0.3" }, @@ -6884,9 +6891,9 @@ } }, "node_modules/stylelint-config-standard": { - "version": "23.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-23.0.0.tgz", - "integrity": "sha512-8PDlk+nWuc1T66nVaODTdVodN0pjuE5TBlopi39Lt9EM36YJsRhqttMyUhnS78oc/59Q6n8iw2GJB4QcoFqtRg==", + "version": "24.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-24.0.0.tgz", + "integrity": "sha512-+RtU7fbNT+VlNbdXJvnjc3USNPZRiRVp/d2DxOF/vBDDTi0kH5RX2Ny6errdtZJH3boO+bmqIYEllEmok4jiuw==", "dev": true, "dependencies": { "stylelint-config-recommended": "^6.0.0" @@ -7067,13 +7074,12 @@ } }, "node_modules/table": { - "version": "6.7.2", - "resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz", - "integrity": "sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", + "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", "dev": true, "dependencies": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", @@ -9091,6 +9097,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, + "colord": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/colord/-/colord-2.9.2.tgz", + "integrity": "sha512-Uqbg+J445nc1TKn4FoDPS6ZZqAvEDnwrH42yo8B40JSOgSLxMZ/gt3h4nmCtPLQeXhjJJkqBx7SCY35WnIixaQ==", + "dev": true + }, "colorette": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.2.2.tgz", @@ -11258,9 +11270,9 @@ "dev": true }, "known-css-properties": { - "version": "0.23.0", - "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.23.0.tgz", - "integrity": "sha512-h9ivI88e1lFNmTT4HovBN33Ysn0OIJG7IPG2mkpx2uniQXFWqo35QdiX7w0TovlUFXfW8aPFblP5/q0jlOr2sA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.24.0.tgz", + "integrity": "sha512-RTSoaUAfLvpR357vWzAz/50Q/BmHfmE6ETSWfutT0AJiw10e6CmcdYRQJlLRd95B53D0Y2aD1jSxD3V3ySF+PA==", "dev": true }, "levn": { @@ -11323,12 +11335,6 @@ "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", "dev": true }, - "lodash.clonedeep": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz", - "integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8=", - "dev": true - }, "lodash.get": { "version": "4.4.2", "resolved": "https://registry.npmjs.org/lodash.get/-/lodash.get-4.4.2.tgz", @@ -12176,14 +12182,14 @@ "dev": true }, "postcss": { - "version": "8.3.11", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.11.tgz", - "integrity": "sha512-hCmlUAIlUiav8Xdqw3Io4LcpA1DOt7h3LSTAC4G6JGHFFaWzI6qvFt9oilvl8BmkbBRX1IhM90ZAmpk68zccQA==", + "version": "8.4.5", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.5.tgz", + "integrity": "sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg==", "dev": true, "requires": { "nanoid": "^3.1.30", "picocolors": "^1.0.0", - "source-map-js": "^0.6.2" + "source-map-js": "^1.0.1" }, "dependencies": { "nanoid": { @@ -12214,9 +12220,9 @@ "requires": {} }, "postcss-selector-parser": { - "version": "6.0.6", - "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.6.tgz", - "integrity": "sha512-9LXrvaaX3+mcv5xkg5kFwqSzSH1JIObIx51PrndZwlmznwXRfxMddDvo9gve3gVR8ZTKgoFDdWkbRFmEhT4PMg==", + "version": "6.0.8", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.0.8.tgz", + "integrity": "sha512-D5PG53d209Z1Uhcc0qAZ5U3t5HagH3cxu+WLZ22jt3gLUpXM4eXXfiO14jiDWST3NNooX/E8wISfOhZ9eIjGTQ==", "dev": true, "requires": { "cssesc": "^3.0.0", @@ -12792,9 +12798,9 @@ "dev": true }, "source-map-js": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-0.6.2.tgz", - "integrity": "sha512-/3GptzWzu0+0MBQFrDKzw/DvvMTUORvgY6k6jd/VS6iCR4RDTKWH6v6WPwQoUO8667uQEf9Oe38DxAYWY5F/Ug==", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.0.1.tgz", + "integrity": "sha512-4+TN2b3tqOCd/kaGRJ/sTYA0tR0mdXx26ipdolxcwtJVqEnqNYvlCAt1q3ypy4QMlYus+Zh34RNtYLoq2oQ4IA==", "dev": true }, "source-map-support": { @@ -13004,14 +13010,15 @@ "dev": true }, "stylelint": { - "version": "14.0.1", - "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.0.1.tgz", - "integrity": "sha512-ZcAkmFLVCultmwkQUjxKzxW/o5+CzNmDk6TPJj/d4Y7ipTGGrewIWmNm+InjdSr04PR5/yynsAJeYJY/wisdMg==", + "version": "14.2.0", + "resolved": "https://registry.npmjs.org/stylelint/-/stylelint-14.2.0.tgz", + "integrity": "sha512-i0DrmDXFNpDsWiwx6SPRs4/pyw4kvZgqpDGvsTslQMY7hpUl6r33aQvNSn6cnTg2wtZ9rreFElI7XAKpOWi1vQ==", "dev": true, "requires": { "balanced-match": "^2.0.0", + "colord": "^2.9.2", "cosmiconfig": "^7.0.1", - "debug": "^4.3.2", + "debug": "^4.3.3", "execall": "^2.0.0", "fast-glob": "^3.2.7", "fastest-levenshtein": "^1.0.12", @@ -13021,11 +13028,11 @@ "globby": "^11.0.4", "globjoin": "^0.1.4", "html-tags": "^3.1.0", - "ignore": "^5.1.8", + "ignore": "^5.2.0", "import-lazy": "^4.0.0", "imurmurhash": "^0.1.4", "is-plain-object": "^5.0.0", - "known-css-properties": "^0.23.0", + "known-css-properties": "^0.24.0", "mathml-tag-names": "^2.1.3", "meow": "^9.0.0", "micromatch": "^4.0.4", @@ -13036,7 +13043,7 @@ "postcss-media-query-parser": "^0.2.3", "postcss-resolve-nested-selector": "^0.1.1", "postcss-safe-parser": "^6.0.0", - "postcss-selector-parser": "^6.0.6", + "postcss-selector-parser": "^6.0.7", "postcss-value-parser": "^4.1.0", "resolve-from": "^5.0.0", "specificity": "^0.4.1", @@ -13044,7 +13051,7 @@ "strip-ansi": "^6.0.1", "style-search": "^0.1.0", "svg-tags": "^1.0.0", - "table": "^6.7.2", + "table": "^6.7.5", "v8-compile-cache": "^2.3.0", "write-file-atomic": "^3.0.3" }, @@ -13095,9 +13102,9 @@ "requires": {} }, "stylelint-config-standard": { - "version": "23.0.0", - "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-23.0.0.tgz", - "integrity": "sha512-8PDlk+nWuc1T66nVaODTdVodN0pjuE5TBlopi39Lt9EM36YJsRhqttMyUhnS78oc/59Q6n8iw2GJB4QcoFqtRg==", + "version": "24.0.0", + "resolved": "https://registry.npmjs.org/stylelint-config-standard/-/stylelint-config-standard-24.0.0.tgz", + "integrity": "sha512-+RtU7fbNT+VlNbdXJvnjc3USNPZRiRVp/d2DxOF/vBDDTi0kH5RX2Ny6errdtZJH3boO+bmqIYEllEmok4jiuw==", "dev": true, "requires": { "stylelint-config-recommended": "^6.0.0" @@ -13191,13 +13198,12 @@ } }, "table": { - "version": "6.7.2", - "resolved": "https://registry.npmjs.org/table/-/table-6.7.2.tgz", - "integrity": "sha512-UFZK67uvyNivLeQbVtkiUs8Uuuxv24aSL4/Vil2PJVtMgU8Lx0CYkP12uCGa3kjyQzOSgV1+z9Wkb82fCGsO0g==", + "version": "6.8.0", + "resolved": "https://registry.npmjs.org/table/-/table-6.8.0.tgz", + "integrity": "sha512-s/fitrbVeEyHKFa7mFdkuQMWlH1Wgw/yEXMt5xACT4ZpzWFluehAxRtUUQKPuWhaLAWhFcVx6w3oC8VKaUfPGA==", "dev": true, "requires": { "ajv": "^8.0.1", - "lodash.clonedeep": "^4.5.0", "lodash.truncate": "^4.4.2", "slice-ansi": "^4.0.0", "string-width": "^4.2.3", diff --git a/scripts/deps/manage_node_deps.py b/scripts/deps/manage_node_deps.py index ab84d50f2d..2e4e34c874 100755 --- a/scripts/deps/manage_node_deps.py +++ b/scripts/deps/manage_node_deps.py @@ -81,9 +81,7 @@ DEPS = { "karma-spec-reporter": "0.0.32", "license-checker": "25.0.1", "mocha": "9.1.3", - # Purposefully not the latest; we keep this in sync with what stylelint - # depends on - "postcss": "8.3.11", + "postcss": "8.4.5", "puppeteer": "10.0.0", "recast": "0.20.4", "rimraf": "3.0.2", @@ -92,8 +90,8 @@ DEPS = { "rollup-plugin-terser": "7.0.2", "sinon": "12.0.1", "source-map-support": "0.5.19", - "stylelint": "14.0.1", - "stylelint-config-standard": "23.0.0", + "stylelint": "14.2.0", + "stylelint-config-standard": "24.0.0", "svgo": "2.3.1", "terser": "5.10.0", "typescript": "4.5.4",