Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

css-syntax-error.js 24KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. "use strict";
  2. exports.__esModule = true;
  3. exports.default = void 0;
  4. var _supportsColor = _interopRequireDefault(require("supports-color"));
  5. var _chalk = _interopRequireDefault(require("chalk"));
  6. var _terminalHighlight = _interopRequireDefault(require("./terminal-highlight"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  9. function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
  10. 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); }
  11. 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); }
  12. 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; } }
  13. function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
  14. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  15. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  16. /**
  17. * The CSS parser throws this error for broken CSS.
  18. *
  19. * Custom parsers can throw this error for broken custom syntax using
  20. * the {@link Node#error} method.
  21. *
  22. * PostCSS will use the input source map to detect the original error location.
  23. * If you wrote a Sass file, compiled it to CSS and then parsed it with PostCSS,
  24. * PostCSS will show the original position in the Sass file.
  25. *
  26. * If you need the position in the PostCSS input
  27. * (e.g., to debug the previous compiler), use `error.input.file`.
  28. *
  29. * @example
  30. * // Catching and checking syntax error
  31. * try {
  32. * postcss.parse('a{')
  33. * } catch (error) {
  34. * if (error.name === 'CssSyntaxError') {
  35. * error //=> CssSyntaxError
  36. * }
  37. * }
  38. *
  39. * @example
  40. * // Raising error from plugin
  41. * throw node.error('Unknown variable', { plugin: 'postcss-vars' })
  42. */
  43. var CssSyntaxError = /*#__PURE__*/function (_Error) {
  44. _inheritsLoose(CssSyntaxError, _Error);
  45. /**
  46. * @param {string} message Error message.
  47. * @param {number} [line] Source line of the error.
  48. * @param {number} [column] Source column of the error.
  49. * @param {string} [source] Source code of the broken file.
  50. * @param {string} [file] Absolute path to the broken file.
  51. * @param {string} [plugin] PostCSS plugin name, if error came from plugin.
  52. */
  53. function CssSyntaxError(message, line, column, source, file, plugin) {
  54. var _this;
  55. _this = _Error.call(this, message) || this;
  56. /**
  57. * Always equal to `'CssSyntaxError'`. You should always check error type
  58. * by `error.name === 'CssSyntaxError'`
  59. * instead of `error instanceof CssSyntaxError`,
  60. * because npm could have several PostCSS versions.
  61. *
  62. * @type {string}
  63. *
  64. * @example
  65. * if (error.name === 'CssSyntaxError') {
  66. * error //=> CssSyntaxError
  67. * }
  68. */
  69. _this.name = 'CssSyntaxError';
  70. /**
  71. * Error message.
  72. *
  73. * @type {string}
  74. *
  75. * @example
  76. * error.message //=> 'Unclosed block'
  77. */
  78. _this.reason = message;
  79. if (file) {
  80. /**
  81. * Absolute path to the broken file.
  82. *
  83. * @type {string}
  84. *
  85. * @example
  86. * error.file //=> 'a.sass'
  87. * error.input.file //=> 'a.css'
  88. */
  89. _this.file = file;
  90. }
  91. if (source) {
  92. /**
  93. * Source code of the broken file.
  94. *
  95. * @type {string}
  96. *
  97. * @example
  98. * error.source //=> 'a { b {} }'
  99. * error.input.column //=> 'a b { }'
  100. */
  101. _this.source = source;
  102. }
  103. if (plugin) {
  104. /**
  105. * Plugin name, if error came from plugin.
  106. *
  107. * @type {string}
  108. *
  109. * @example
  110. * error.plugin //=> 'postcss-vars'
  111. */
  112. _this.plugin = plugin;
  113. }
  114. if (typeof line !== 'undefined' && typeof column !== 'undefined') {
  115. /**
  116. * Source line of the error.
  117. *
  118. * @type {number}
  119. *
  120. * @example
  121. * error.line //=> 2
  122. * error.input.line //=> 4
  123. */
  124. _this.line = line;
  125. /**
  126. * Source column of the error.
  127. *
  128. * @type {number}
  129. *
  130. * @example
  131. * error.column //=> 1
  132. * error.input.column //=> 4
  133. */
  134. _this.column = column;
  135. }
  136. _this.setMessage();
  137. if (Error.captureStackTrace) {
  138. Error.captureStackTrace(_assertThisInitialized(_this), CssSyntaxError);
  139. }
  140. return _this;
  141. }
  142. var _proto = CssSyntaxError.prototype;
  143. _proto.setMessage = function setMessage() {
  144. /**
  145. * Full error text in the GNU error format
  146. * with plugin, file, line and column.
  147. *
  148. * @type {string}
  149. *
  150. * @example
  151. * error.message //=> 'a.css:1:1: Unclosed block'
  152. */
  153. this.message = this.plugin ? this.plugin + ': ' : '';
  154. this.message += this.file ? this.file : '<css input>';
  155. if (typeof this.line !== 'undefined') {
  156. this.message += ':' + this.line + ':' + this.column;
  157. }
  158. this.message += ': ' + this.reason;
  159. }
  160. /**
  161. * Returns a few lines of CSS source that caused the error.
  162. *
  163. * If the CSS has an input source map without `sourceContent`,
  164. * this method will return an empty string.
  165. *
  166. * @param {boolean} [color] Whether arrow will be colored red by terminal
  167. * color codes. By default, PostCSS will detect
  168. * color support by `process.stdout.isTTY`
  169. * and `process.env.NODE_DISABLE_COLORS`.
  170. *
  171. * @example
  172. * error.showSourceCode() //=> " 4 | }
  173. * // 5 | a {
  174. * // > 6 | bad
  175. * // | ^
  176. * // 7 | }
  177. * // 8 | b {"
  178. *
  179. * @return {string} Few lines of CSS source that caused the error.
  180. */
  181. ;
  182. _proto.showSourceCode = function showSourceCode(color) {
  183. var _this2 = this;
  184. if (!this.source) return '';
  185. var css = this.source;
  186. if (_terminalHighlight.default) {
  187. if (typeof color === 'undefined') color = _supportsColor.default.stdout;
  188. if (color) css = (0, _terminalHighlight.default)(css);
  189. }
  190. var lines = css.split(/\r?\n/);
  191. var start = Math.max(this.line - 3, 0);
  192. var end = Math.min(this.line + 2, lines.length);
  193. var maxWidth = String(end).length;
  194. function mark(text) {
  195. if (color && _chalk.default.red) {
  196. return _chalk.default.red.bold(text);
  197. }
  198. return text;
  199. }
  200. function aside(text) {
  201. if (color && _chalk.default.gray) {
  202. return _chalk.default.gray(text);
  203. }
  204. return text;
  205. }
  206. return lines.slice(start, end).map(function (line, index) {
  207. var number = start + 1 + index;
  208. var gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ';
  209. if (number === _this2.line) {
  210. var spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, _this2.column - 1).replace(/[^\t]/g, ' ');
  211. return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^');
  212. }
  213. return ' ' + aside(gutter) + line;
  214. }).join('\n');
  215. }
  216. /**
  217. * Returns error position, message and source code of the broken part.
  218. *
  219. * @example
  220. * error.toString() //=> "CssSyntaxError: app.css:1:1: Unclosed block
  221. * // > 1 | a {
  222. * // | ^"
  223. *
  224. * @return {string} Error position, message and source code.
  225. */
  226. ;
  227. _proto.toString = function toString() {
  228. var code = this.showSourceCode();
  229. if (code) {
  230. code = '\n\n' + code + '\n';
  231. }
  232. return this.name + ': ' + this.message + code;
  233. }
  234. /**
  235. * @memberof CssSyntaxError#
  236. * @member {Input} input Input object with PostCSS internal information
  237. * about input file. If input has source map
  238. * from previous tool, PostCSS will use origin
  239. * (for example, Sass) source. You can use this
  240. * object to get PostCSS input source.
  241. *
  242. * @example
  243. * error.input.file //=> 'a.css'
  244. * error.file //=> 'a.sass'
  245. */
  246. ;
  247. return CssSyntaxError;
  248. }( /*#__PURE__*/_wrapNativeSuper(Error));
  249. var _default = CssSyntaxError;
  250. exports.default = _default;
  251. module.exports = exports.default;
  252. //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImNzcy1zeW50YXgtZXJyb3IuZXM2Il0sIm5hbWVzIjpbIkNzc1N5bnRheEVycm9yIiwibWVzc2FnZSIsImxpbmUiLCJjb2x1bW4iLCJzb3VyY2UiLCJmaWxlIiwicGx1Z2luIiwibmFtZSIsInJlYXNvbiIsInNldE1lc3NhZ2UiLCJFcnJvciIsImNhcHR1cmVTdGFja1RyYWNlIiwic2hvd1NvdXJjZUNvZGUiLCJjb2xvciIsImNzcyIsInRlcm1pbmFsSGlnaGxpZ2h0Iiwic3VwcG9ydHNDb2xvciIsInN0ZG91dCIs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Vycm9yJ2AuIFlvdSBzaG91bGQgYWx3YXlzIGNoZWNrIGVycm9yIHR5cGVcbiAgICAgKiBieSBgZXJyb3IubmFtZSA9PT0gJ0Nzc1N5bnRheEVycm9yJ2BcbiAgICAgKiBpbnN0ZWFkIG9mIGBlcnJvciBpbnN0YW5jZW9mIENzc1N5bnRheEVycm9yYCxcbiAgICAgKiBiZWNhdXNlIG5wbSBjb3VsZCBoYXZlIHNldmVyYWwgUG9zdENTUyB2ZXJzaW9ucy5cbiAgICAgKlxuICAgICAqIEB0eXBlIHtzdHJpbmd9XG4gICAgICpcbiAgICAgKiBAZXhhbXBsZVxuICAgICAqIGlmIChlcnJvci5uYW1lID09PSAnQ3NzU3ludGF4RXJyb3InKSB7XG4gICAgICogICBlcnJvciAvLz0+IENzc1N5bnRheEVycm9yXG4gICAgICogfVxuICAgICAqL1xuICAgIHRoaXMubmFtZSA9ICdDc3NTeW50YXhFcnJvcidcbiAgICAvKipcbiAgICAgKiBFcnJvciBtZXNzYWdlLlxuICAgICAqXG4gICAgICogQHR5cGUge3N0cmluZ31cbiAgICAgKlxuICAgICAqIEBleGFtcGxlXG4gICAgICogZXJyb3IubWVzc2FnZSAvLz0+ICdVbmNsb3NlZCBibG9jaydcbiAgICAgKi9cbiAgICB0aGlzLnJlYXNvbiA9IG1lc3NhZ2VcblxuICAgIGlmIChmaWxlKSB7XG4gICAgICAvKipcbiAgICAgICAqIEFic29sdXRlIHBhdGggdG8gdGhlIGJyb2tlbiBmaWxlLlxuICAgICAgICpcbiAgICAgICAqIEB0eXBlIHtzdHJpbmd9XG4gICAgICAgKlxuICAgICAgICogQGV4YW1wbGVcbiAgICAgICAqIGVycm9yLmZpbGUgICAgICAgLy89PiAnYS5zYXNzJ1xuICAgICAgICogZXJyb3IuaW5wdXQuZmlsZSAvLz0+ICdhLmNzcydcbiAgICAgICAqL1xuICAgICAgdGhpcy5maWxlID0gZmlsZVxuICAgIH1cbiAgICBpZiAoc291cmNlKSB7XG4gICAgICAvKipcbiAgICAgICAqIFNvdXJjZSBjb2RlIG9mIHRoZSBicm9rZW4gZmlsZS5cbiAgICAgICAqXG4gICAgICAgKiBAdHlwZSB7c3RyaW5nfVxuICAgICAgICpcbiAgICAgICAqIEBleGFtcGxlXG4gICAgICAgKiBlcnJvci5zb3VyY2UgICAgICAgLy89PiAnYSB7IGIge30gfSdcbiAgICAgICAqIGVycm9yLmlucHV0LmNvbHVtbiAvLz0+ICdhIGIgeyB9J1xuICAgICAgICovXG4gICAgICB0aGlzLnNvdXJjZSA9IHNvdXJjZVxuICAgIH1cbiAgICBpZiAocGx1Z2luKSB7XG4gICAgICAvKipcbiAgICAgICAqIFBsdWdpbiBuYW1lLCBpZiBlcnJvciBjYW1lIGZyb20gcGx1Z2luLlxuICAgICAgICpcbiAgICAgICAqIEB0eXBlIHtzdHJpbmd9XG4gICAgICAgKlxuICAgICAgICogQGV4YW1wbGVcbiAgICAgICAqIGVycm9yLnBsdWdpbiAvLz0+ICdwb3N0Y3NzLXZhcnMnXG4gICAgICAgKi9cbiAgICAgIHRoaXMucGx1Z2luID0gcGx1Z2luXG4gICAgfVxuICAgIGlmICh0eXBlb2YgbGluZSAhPT0gJ3VuZGVmaW5lZCcgJiYgdHlwZW9mIGNvbHVtbiAhPT0gJ3VuZGVmaW5lZCcpIHtcbiAgICAgIC8qKlxuICAgICAgICogU291cmNlIGxpbmUgb2YgdGhlIGVycm9yLlxuICAgICAgICpcbiAgICAgICAqIEB0eXBlIHtudW1iZXJ9XG4gICAgICAgKlxuICAgICAgICogQGV4YW1wbGVcbiAgICAgICAqIGVycm9yLmxpbmUgICAgICAgLy89PiAyXG4gICAgICAgKiBlcnJvci5pbnB1dC5saW5lIC8vPT4gNFxuICAgICAgICovXG4gICAgICB0aGlzLmxpbmUgPSBsaW5lXG4gICAgICAvKipcbiAgICAgICAqIFNvdXJjZSBjb2x1bW4gb2YgdGhlIGVycm9yLlxuICAgICAgICpcbiAgICAgICAqIEB0eXBlIHtudW1iZXJ9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2UgdGhhdCBjYXVzZWQgdGhlIGVycm9yLlxuICAgKlxuICAgKiBJZiB0aGUgQ1NTIGhhcyBhbiBpbnB1dCBzb3VyY2UgbWFwIHdpdGhvdXQgYHNvdXJjZUNvbnRlbnRgLFxuICAgKiB0aGlzIG1ldGhvZCB3aWxsIHJldHVybiBhbiBlbXB0eSBzdHJpbmcuXG4gICAqXG4gICAqIEBwYXJhbSB7Ym9vbGVhbn0gW2NvbG9yXSBXaGV0aGVyIGFycm93IHdpbGwgYmUgY29sb3JlZCByZWQgYnkgdGVybWluYWxcbiAgICogICAgICAgICAgICAgICAgICAgICAgICAgIGNvbG9yIGNvZGVzLiBCeSBkZWZhdWx0LCBQb3N0Q1NTIHdpbGwgZGV0ZWN0XG4gICAqICAgICAgICAgICAgICAgICAgICAgICAgICBjb2xvciBzdXBwb3J0IGJ5IGBwcm9jZXNzLnN0ZG91dC5pc1RUWWBcbiAgICogICAgICAgICAgICAgICAgICAgICAgICAgIGFuZCBgcHJvY2Vzcy5lbnYuTk9ERV9ESVNBQkxFX0NPTE9SU2AuXG4gICAqXG4gICAqIEBleGFtcGxlXG4gICAqIGVycm9yLnNob3dTb3VyY2VDb2RlKCkgLy89PiBcIiAgNCB8IH1cbiAgICogICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgIDUgfCBhIHtcbiAgICogICAgICAgICAgICAgICAgICAgICAgICAvLyAgICA+IDYgfCAgIGJhZFxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICB8ICAgXlxuICAgKiAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgNyB8IH1cbiAgICogICAgICAgICAgICAgICAgICAgICAgICAvLyAgICAgIDggfCBiIHtcIlxuICAgKlxuICAgKiBAcmV0dXJuIHtzdHJpbmd9IEZldyBsaW5lcyBvZiBDU1Mgc291cmNlIHRoYXQgY2F1c2VkIHRoZSBlcnJvci5cbiAgICovXG4gIHNob3dTb3VyY2VDb2RlIChjb2xvcikge1xuICAgIG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