123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- "use strict";
- exports.__esModule = true;
- exports.default = void 0;
- var _picocolors = _interopRequireDefault(require("picocolors"));
- var _terminalHighlight = _interopRequireDefault(require("./terminal-highlight"));
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
- function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- /**
- * The CSS parser throws this error for broken CSS.
- *
- * Custom parsers can throw this error for broken custom syntax using
- * the {@link Node#error} method.
- *
- * PostCSS will use the input source map to detect the original error location.
- * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,
- * PostCSS will show the original position in the Sass file.
- *
- * If you need the position in the PostCSS input
- * (e.g., to debug the previous compiler), use `error.input.file`.
- *
- * @example
- * // Catching and checking syntax error
- * try {
- * postcss.parse('a{')
- * } catch (error) {
- * if (error.name === 'CssSyntaxError') {
- * error //=> CssSyntaxError
- * }
- * }
- *
- * @example
- * // Raising error from plugin
- * throw node.error('Unknown variable', { plugin: 'postcss-vars' })
- */
- var CssSyntaxError = /*#__PURE__*/function (_Error) {
- _inheritsLoose(CssSyntaxError, _Error);
- /**
- * @param {string} message Error message.
- * @param {number} [line] Source line of the error.
- * @param {number} [column] Source column of the error.
- * @param {string} [source] Source code of the broken file.
- * @param {string} [file] Absolute path to the broken file.
- * @param {string} [plugin] PostCSS plugin name, if error came from plugin.
- */
- function CssSyntaxError(message, line, column, source, file, plugin) {
- var _this;
- _this = _Error.call(this, message) || this;
- /**
- * Always equal to `'CssSyntaxError'`. You should always check error type
- * by `error.name === 'CssSyntaxError'`
- * instead of `error instanceof CssSyntaxError`,
- * because npm could have several PostCSS versions.
- *
- * @type {string}
- *
- * @example
- * if (error.name === 'CssSyntaxError') {
- * error //=> CssSyntaxError
- * }
- */
- _this.name = 'CssSyntaxError';
- /**
- * Error message.
- *
- * @type {string}
- *
- * @example
- * error.message //=> 'Unclosed block'
- */
- _this.reason = message;
- if (file) {
- /**
- * Absolute path to the broken file.
- *
- * @type {string}
- *
- * @example
- * error.file //=> 'a.sass'
- * error.input.file //=> 'a.css'
- */
- _this.file = file;
- }
- if (source) {
- /**
- * Source code of the broken file.
- *
- * @type {string}
- *
- * @example
- * error.source //=> 'a { b {} }'
- * error.input.column //=> 'a b { }'
- */
- _this.source = source;
- }
- if (plugin) {
- /**
- * Plugin name, if error came from plugin.
- *
- * @type {string}
- *
- * @example
- * error.plugin //=> 'postcss-vars'
- */
- _this.plugin = plugin;
- }
- if (typeof line !== 'undefined' && typeof column !== 'undefined') {
- /**
- * Source line of the error.
- *
- * @type {number}
- *
- * @example
- * error.line //=> 2
- * error.input.line //=> 4
- */
- _this.line = line;
- /**
- * Source column of the error.
- *
- * @type {number}
- *
- * @example
- * error.column //=> 1
- * error.input.column //=> 4
- */
- _this.column = column;
- }
- _this.setMessage();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(_assertThisInitialized(_this), CssSyntaxError);
- }
- return _this;
- }
- var _proto = CssSyntaxError.prototype;
- _proto.setMessage = function setMessage() {
- /**
- * Full error text in the GNU error format
- * with plugin, file, line and column.
- *
- * @type {string}
- *
- * @example
- * error.message //=> 'a.css:1:1: Unclosed block'
- */
- this.message = this.plugin ? this.plugin + ': ' : '';
- this.message += this.file ? this.file : '<css input>';
- if (typeof this.line !== 'undefined') {
- this.message += ':' + this.line + ':' + this.column;
- }
- this.message += ': ' + this.reason;
- }
- /**
- * Returns a few lines of CSS source that caused the error.
- *
- * If the CSS has an input source map without `sourceContent`,
- * this method will return an empty string.
- *
- * @param {boolean} [color] Whether arrow will be colored red by terminal
- * color codes. By default, PostCSS will detect
- * color support by `process.stdout.isTTY`
- * and `process.env.NODE_DISABLE_COLORS`.
- *
- * @example
- * error.showSourceCode() //=> " 4 | }
- * // 5 | a {
- * // > 6 | bad
- * // | ^
- * // 7 | }
- * // 8 | b {"
- *
- * @return {string} Few lines of CSS source that caused the error.
- */
- ;
- _proto.showSourceCode = function showSourceCode(color) {
- var _this2 = this;
- if (!this.source) return '';
- var css = this.source;
- if (_terminalHighlight.default) {
- if (typeof color === 'undefined') color = _picocolors.default.isColorSupported;
- if (color) css = (0, _terminalHighlight.default)(css);
- }
- var lines = css.split(/\r?\n/);
- var start = Math.max(this.line - 3, 0);
- var end = Math.min(this.line + 2, lines.length);
- var maxWidth = String(end).length;
- function mark(text) {
- if (color && _picocolors.default.red) {
- return _picocolors.default.red(_picocolors.default.bold(text));
- }
- return text;
- }
- function aside(text) {
- if (color && _picocolors.default.gray) {
- return _picocolors.default.gray(text);
- }
- return text;
- }
- return lines.slice(start, end).map(function (line, index) {
- var number = start + 1 + index;
- var gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ';
- if (number === _this2.line) {
- var spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, _this2.column - 1).replace(/[^\t]/g, ' ');
- return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^');
- }
- return ' ' + aside(gutter) + line;
- }).join('\n');
- }
- /**
- * Returns error position, message and source code of the broken part.
- *
- * @example
- * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block
- * // > 1 | a {
- * // | ^"
- *
- * @return {string} Error position, message and source code.
- */
- ;
- _proto.toString = function toString() {
- var code = this.showSourceCode();
- if (code) {
- code = '\n\n' + code + '\n';
- }
- return this.name + ': ' + this.message + code;
- }
- /**
- * @memberof CssSyntaxError#
- * @member {Input} input Input object with PostCSS internal information
- * about input file. If input has source map
- * from previous tool, PostCSS will use origin
- * (for example, Sass) source. You can use this
- * object to get PostCSS input source.
- *
- * @example
- * error.input.file //=> 'a.css'
- * error.file //=> 'a.sass'
- */
- ;
- return CssSyntaxError;
- }( /*#__PURE__*/_wrapNativeSuper(Error));
- var _default = CssSyntaxError;
- exports.default = _default;
- module.exports = exports.default;
- //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNzcy1zeW50YXgtZXJyb3IuZXM2Il0sIm5hbWVzIjpbIkNzc1N5bnRheEVycm9yIiwibWVzc2FnZSIsImxpbmUiLCJjb2x1bW4iLCJzb3VyY2UiLCJmaWxlIiwicGx1Z2luIiwibmFtZSIsInJlYXNvbiIsInNldE1lc3NhZ2UiLCJFcnJvciIsImNhcHR1cmVTdGFja1RyYWNlIiwic2hvd1NvdXJjZUNvZGUiLCJjb2xvciIsImNzcyIsInRlcm1pbmFsSGlnaGxpZ2h0IiwicGljbyIsImlzQ29sb3JTdXBwb3J0ZWQiLCJsaW5lcyIsInNwbGl0Iiwic3RhcnQiLCJNYXRoIiwibWF4IiwiZW5kIiwibWluIiwibGVuZ3RoIiwibWF4V2lkdGgiLCJTdHJpbmciLCJtYXJrIiwidGV4dCIsInJlZCIsImJvbGQiLCJhc2lkZSIsImdyYXkiLCJzbGljZSIsIm1hcCIsImluZGV4IiwibnVtYmVyIiwiZ3V0dGVyIiwic3BhY2luZyIsInJlcGxhY2UiLCJqb2luIiwidG9TdHJpbmciLCJjb2RlIl0sIm1hcHBpbmdzIjoiOzs7OztBQUFBOztBQUVBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUVBOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7SUEyQk1BLGM7OztBQUNKOzs7Ozs7OztBQVFBLDBCQUFhQyxPQUFiLEVBQXNCQyxJQUF0QixFQUE0QkMsTUFBNUIsRUFBb0NDLE1BQXBDLEVBQTRDQyxJQUE1QyxFQUFrREMsTUFBbEQsRUFBMEQ7QUFBQTs7QUFDeEQsOEJBQU1MLE9BQU47QUFFQTs7Ozs7Ozs7Ozs7Ozs7QUFhQSxVQUFLTSxJQUFMLEdBQVksZ0JBQVo7QUFDQTs7Ozs7Ozs7O0FBUU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gICAgLyoqXG4gICAgICAgKiBBYnNvbHV0ZSBwYXRoIHRvIHRoZSBicm9rZW4gZmlsZS5cbiAgICAgICAqXG4gICAgICAgKiBAdHlwZSB7c3RyaW5nfVxuICAgICAgICpcbiAgICAgICAqIEBleGFtcGxlXG4gICAgICAgKiBlcnJvci5maWxlICAgICAgIC8vPT4gJ2Euc2FzcydcbiAgICAgICAqIGVycm9yLmlucHV0LmZpbGUgLy89PiAnYS5jc3MnXG4gICAgICAgKi9cbiAgICAgIHRoaXMuZmlsZSA9IGZpbGVcbiAgICB9XG4gICAgaWYgKHNvdXJjZSkge1xuICAgICAgLyoqXG4gICAgICAgKiBTb3VyY2UgY29kZSBvZiB0aGUgYnJva2VuIGZpbGUuXG4gICAgICAgKlxuICAgICAgICogQHR5cGUge3N0cmluZ31cbiAgICAgICAqXG4gICAgICAgKiBAZXhhbXBsZVxuICAgICAgICogZXJyb3Iuc291cmNlICAgICAgIC8vPT4gJ2EgeyBiIHt9IH0nXG4gICAgICAgKiBlcnJvci5pbnB1dC5jb2x1bW4gLy89PiAnYSBiIHsgfSdcbiAgICAgICAqL1xuICAgICAgdGhpcy5zb3VyY2UgPSBzb3VyY2VcbiAgICB9XG4gICAgaWYgKHBsdWdpbikge1xuICAgICAgLyoqXG4gICAgICAgKiBQbHVnaW4gbmFtZSwgaWYgZXJyb3IgY2FtZSBmcm9tIHBsdWdpbi5cbiAgICAgICAqXG4gICAgICAgKiBAdHlwZSB7c3RyaW5nfVxuICAgICAgICpcbiAgICAgICAqIEBleGFtcGxlXG4gICAgICAgKiBlcnJvci5wbHVnaW4gLy89PiAncG9zdGNzcy12YXJzJ1xuICAgICAgICovXG4gICAgICB0aGlzLnBsdWdpbiA9IHBsdWdpblxuICAgIH1cbiAgICBpZiAodHlwZW9mIGxpbmUgIT09ICd1bmRlZmluZWQnICYmIHR5cGVvZiBjb2x1bW4gIT09ICd1bmRlZmluZWQnKSB7XG4gICAgICAvKipcbiAgICAgICAqIFNvdXJjZSBs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AgLy8gICAgPiA2IHwgICBiYWRcbiAgICogICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgICAgfCAgIF5cbiAgICogICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgIDcgfCB9XG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgLy8gICAgICA4IHwgYiB7XCJcbiAgICpcbiAgICogQHJldHVybiB7c3RyaW5nfSBGZXcgbGluZXMgb2YgQ1NTIHNvdXJjZSB0aGF0IGNhdXNlZCB0aGUgZXJyb3IuXG4gICAqL1xuICBzaG93U291cmNlQ29kZSAoY29sb3IpIHtcbiAgICBpZiAoIXRoaXMuc291cmNlKSByZXR1cm4gJydcblxuICAgIGxldCBjc3MgPSB0aGlzLnNvdXJjZVxuICAgIGlmICh0ZXJtaW5hbEhpZ2hsaWdodCkge1xuICAgICAgaWYgKHR5cGVvZiBjb2xvciA9PT0gJ3VuZGVmaW5lZCcpIGNvbG9yID0gcGljby5pc0NvbG9yU3VwcG9ydGVkXG4gICAgICBpZiAoY29sb3IpIGNzcyA9IHRlcm1pbmFsSGlnaGxpZ2h0KGNzcylcbiAgICB9XG5cbiAgICBsZXQgbGluZXMgPSBjc3Muc3BsaXQoL1xccj9cXG4vKVxuICAgIGxldCBzdGFydCA9IE1hdGgubWF4KHRoaXMubGluZSAtIDMsIDApXG4gICAgbGV0IGVuZCA9IE1hdGgubWluKHRoaXMubGluZSArIDIsIGxpbmVzLmxlbmd0aClcblxuICAgIGxldCBtYXhXaWR0aCA9IFN0cmluZyhlbmQpLmxlbmd0aFxuXG4gICAgZnVuY3Rpb24gbWFyayAodGV4dCkge1xuICAgICAgaWYgKGNvbG9yICYmIHBpY28ucmVkKSB7XG4gICAgICAgIHJldHVybiBwaWNvLnJlZChwaWNvLmJvbGQodGV4dCkpXG4gICAgICB9XG4gICAgICByZXR1cm4gdGV4dFxuICAgIH1cbiAgICBmdW5jdGlvbiBhc2lkZSAodGV4dCkge1xuICAgICAgaWYgKGNvbG9yICYmIHBpY28uZ3JheSkge1xuICAgICAgICByZXR1cm4gcGljby5ncmF5KHRleHQpXG4gICAgICB9XG4gICAgICByZXR1cm4gdGV4dFxuICAgIH1cblxuICAgIHJldHVybiBsaW5lc1xuICAgICAgLnNsaWNlKHN0YXJ0LCBlbmQpXG4gICAgICAubWFwKChsaW5lLCBpbmRleCkgPT4ge1xuICAgICAgICBsZXQgbnVtYmVyID0gc3RhcnQgKyAxICsgaW5kZXhcbiAgICAgICAgbGV0IGd1dHRlciA9ICcgJyArICgnICcgKyBudW1iZXIpLnNsaWNlKC1tYXhXaWR0aCkgKyAnIHwgJ1xuICAgICAgICBpZiAobnVtYmVyID09PSB0aGlzLmxpbmUpIHtcbiAgICAgICAgICBsZXQgc3BhY2luZyA9XG4gICAgICAgICAgICBhc2lkZShndXR0ZXIucmVwbGFjZSgvXFxkL2csICcgJykpICtcbiAgICAgICAgICAgIGxpbmUuc2xpY2UoMCwgdGhpcy5jb2x1bW4gLSAxKS5yZXBsYWNlKC9bXlxcdF0vZywgJyAnKVxuICAgICAgICAgIHJldHVybiBtYXJrKCc+JykgKyBhc2lkZShndXR0ZXIpICsgbGluZSArICdcXG4gJyArIHNwYWNpbmcgKyBtYXJrKCdeJylcbiAgICAgICAgfVxuICAgICAgICByZXR1cm4gJyAnICsgYXNpZGUoZ3V0dGVyKSArIGxpbmVcbiAgICAgIH0pXG4gICAgICAuam9pbignXFxuJylcbiAgfVxuXG4gIC8qKlxuICAgKiBSZXR1cm5zIGVycm9yIHBvc2l0aW9uLCBtZXNzYWdlIGFuZCBzb3VyY2UgY29kZSBvZiB0aGUgYnJva2VuIHBhcnQuXG4gICAqXG4gICAqIEBleGFtcGxlXG4gICAqIGVycm9yLnRvU3RyaW5nKCkgLy89PiBcIkNzc1N5bnRheEVycm9yOiBhcHAuY3NzOjE6MTogVW5jbG9zZWQgYmxvY2tcbiAgICogICAgICAgICAgICAgICAgICAvLyAgICA+IDEgfCBhIHtcbiAgICogICAgICAgICAgICAgICAgICAvLyAgICAgICAgfCBeXCJcbiAgICpcbiAgICogQHJldHVybiB7c3RyaW5nfSBFcnJvciBwb3NpdGlvbiwgbWVzc2FnZSBhbmQgc291cmNlIGNvZGUuXG4gICAqL1xuICB0b1N0cmluZyAoKSB7XG4gICAgbGV0IGNvZGUgPSB0aGlzLnNob3dTb3VyY2VDb2RlKClcbiAgICBpZiAoY29kZSkge1xuICAgICAgY29kZSA9ICdcXG5cXG4nICsgY29kZSArICdcXG4nXG4gICAgfVxuICAgIHJldHVybiB0aGlzLm5hbWUgKyAnOiAnICsgdGhpcy5tZXNzYWdlICsgY29kZVxuICB9XG5cbiAgLyoqXG4gICAqIEBtZW1iZXJvZiBDc3NTeW50YXhFcnJvciNcbiAgICogQG1lbWJlciB7SW5wdXR9IGlucHV0IElucHV0IG9iamVjdCB3aXRoIFBvc3RDU1MgaW50ZXJuYWwgaW5mb3JtYXRpb25cbiAgICogICAgICAgICAgICAgICAgICAgICAgIGFib3V0IGlucHV0IGZpbGUuIElmIGlucHV0IGhhcyBzb3VyY2UgbWFwXG4gICAqICAgICAgICAgICAgICAgICAgICAgICBmcm9tIHByZXZpb3VzIHRvb2wsIFBvc3RDU1Mgd2lsbCB1c2Ugb3JpZ2luXG4gICAqICAgICAgICAgICAgICAgICAgICAgICAoZm9yIGV4YW1wbGUsIFNhc3MpIHNvdXJjZS4gWW91IGNhbiB1c2UgdGhpc1xuICAgKiAgICAgICAgICAgICAgICAgICAgICAgb2JqZWN0IHRvIGdldCBQb3N0Q1NTIGlucHV0IHNvdXJjZS5cbiAgICpcbiAgICogQGV4YW1wbGVcbiAgICogZXJyb3IuaW5wdXQuZmlsZSAvLz0+ICdhLmNzcydcbiAgICogZXJyb3IuZmlsZSAgICAgICAvLz0+ICdhLnNhc3MnXG4gICAqL1xufVxuXG5leHBvcnQgZGVmYXVsdCBDc3NTeW50YXhFcnJvclxuIl0sImZpbGUiOiJjc3Mtc3ludGF4LWVycm9yLmpzIn0=
|